1
surance
Article module hack problem
  • 2008/4/6 2:51

  • surance

  • Just popping in

  • Posts: 4

  • Since: 2008/2/24


I have a problem when hack the article module.
Below is detail:
I add a block , It is only a simple block.
but when I update the module of article,
the first page of the website went to a blank--yes, blank, no error.

I want to know why the fist page of the website went to blank?

If I have got some mistakes , I want to know the error message. How can I get the error message?


And below is all the scripts I add.



1) xoops_version.php
add some scripts:

$modversion["blocks"][] = array(
"file" => "show_by_you.php",
"name" => art_constant("MI_BY_YOU"),
"description" => art_constant("MI_BY_YOU"),
"show_func" => $GLOBALS["ART_VAR_PREFIX"]."_article_show",
"options" => "10", // MaxItems
"edit_func" => $GLOBALS["ART_VAR_PREFIX"]."_article_edit",
"template" => $GLOBALS["artdirname"]."_block_by_you.html");



2)show_by_you.php:
/**
* Article management
*
* @copyright The XOOPS project https://xoops.org/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author Shurong Yin (xxpyeippx or surance)
* @since 1.00
* @version $Id$
* @package module::article
*/

if (!defined('XOOPS_ROOT_PATH')){ exit(); }

include dirname(dirname(__FILE__))."/include/vars.php";
mod_loadFunctions("parse", $GLOBALS["artdirname"]);

/**
* Functions handling module blocks
* @package module::article
*
* @author Surance (xxpyeippx)
* @copyright copyright © 2000 The XOOPS Project
*
* @param VAR_PREFIX variable prefix for the function name
*/

art_parse_function(
/**#@+
* Function to display articles
*
* {@link article}
* {@link xcategory}
* {@link permission}
* {@link config}
*
* @param array $options:
* 0 - maxlines

*/
function [VAR_PREFIX]_article_show($options)
{
global $xoopsDB;

$block = array();
$artConfig = art_load_config();
art_define_url_delimiter();

$query = "select A.art_id,A.art_title,A.art_time_publish,A.cat_id,C.cat_title as category from `xoops_ch__art_article` as A".
"inner join `xoops_ch__art_category` as C".
"on A.cat_id=C.`cat_id`".
"where A.cat_id=9";
$result = $xoopsDB->query($query, $options[0], 0);
if (!$result) {
xoops_error($xoopsDB->error());
// return $block;
}

while ($row = $xoopsDB->fetchArray($result)) {
$rows[] = $row;
}

foreach ($rows as $row) {
$block["articles"][] = array( "id"=>$row["art_id"], "title"=>$row["art_title"], "category"=>$row["category"]);
}
$block["dirname"] = $GLOBALS["artdirname"];

return $block;
}

function [VAR_PREFIX]_article_edit($options)
{
$form = art_constant("MB_ITEMS")."  

";
return $form;
}
/**#@-*/

?>





3)article_block_by_you.html:





<{foreachq item=article from=$block.articles}>

<{$article.title}> (<{$article.category|default:0}>)

<{/foreach}>

2
noo-b
Re: Article module hack problem
  • 2008/4/6 3:26

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


can you access the admin panel?

turn on the debug in system > preferences
I Love Xoops

3
surance
Re: Article module hack problem
  • 2008/4/6 5:39

  • surance

  • Just popping in

  • Posts: 4

  • Since: 2008/2/24


@noo-b:
thanks . I'll try.
anyway ,it's a good method to avoid user to see error.

4
surance
Re: Article module hack problem
  • 2008/4/6 6:19

  • surance

  • Just popping in

  • Posts: 4

  • Since: 2008/2/24


@noo-b

I got it!!
thank you....I should learn more about xoops...
it has wonderful debug method. Thanks again.

Login

Who's Online

441 user(s) are online (302 user(s) are browsing Support Forums)


Members: 0


Guests: 441


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits