1
mariolino
AMS: moderate_news error
  • 2006/11/4 14:16

  • mariolino

  • Just popping in

  • Posts: 1

  • Since: 2006/11/4


i can't delete articles in ams_moderate

CODE:

function b_ams_topics_moderate() {
include_once XOOPS_ROOT_PATH."/class/xoopstopic.php";
include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
$block = array();

$storyarray = AmsStory :: getAllSubmitted(0, true, true);
if ( count( $storyarray ) > 0 )
{
$block['lang_story_title'] = _AMS_MB_TITLE;
$block['lang_story_date'] = _AMS_MB_POSTED;
$block['lang_story_author'] =_AMS_MB_POSTER;
$block['lang_story_action'] =_AMS_MB_ACTION;
$block['lang_story_topic'] =_AMS_MB_TOPIC;
foreach ($storyarray as $thisstory) {
$uids[$thisstory->uid()] = $thisstory->uid();
}
$member_handler =& xoops_gethandler('member');
$user_arr = $member_handler->getUsers(new Criteria('uid', "(".implode(',', array_keys($uids)).")", 'IN') , true);
foreach( $storyarray as $newstory )
{
$newstory->uname($user_arr);
$title = $newstory -> title();
if ( !isset( $title ) || ( $title == "" ) )
{
$title = _AD_NOSUBJECT;
}
$linktitle = "" . $title . "";
$story['title'] = $linktitle;
$story['date'] = formatTimestamp( $newstory -> created());
$story['author'] = "" . $newstory -> uname . "";
$story['action'] = "" . _AMS_MB_DELETE . "";
$story['topic_title'] = $newstory -> topic_title();
$block['stories'][] =& $story;
unset($story);
}
}
return $block;
}


in submit.php i have this CODE:

switch ($op) {
case "delete":
if ( !empty( $_POST['ok'] ) )
{
if ( empty( $_POST['storyid'] ) )
{
redirect_header( 'index.php?op=newarticle', 2, _AMS_AM_EMPTYNODELETE );
exit();
}
$storyid = intval($_POST['storyid']);
$story = new AmsStory( $storyid );
$story -> delete();
$sfiles = new sFiles();
$filesarr=Array();
$filesarr=$sfiles->getAllbyStory($storyid);
if(count($filesarr)>0)
{
foreach ($filesarr as $onefile)
{
$onefile->delete();
}
}
xoops_comment_delete( $xoopsModule -> getVar( 'mid' ), $storyid );
xoops_notification_deletebyitem( $xoopsModule -> getVar( 'mid' ), 'story', $storyid );
redirect_header( 'index.php?op=newarticle', 1, _AMS_AM_DBUPDATED );
exit();
}
else
{
//xoops_cp_header();
echo "

" . _AMS_AM_CONFIG . "

";
xoops_confirm( array( 'op' => 'delete', 'storyid' => $_REQUEST['storyid'], 'ok' => 1 ), 'submit.php', _AMS_AM_RUSUREDEL );
}
break;

Login

Who's Online

363 user(s) are online (74 user(s) are browsing Support Forums)


Members: 0


Guests: 363


more...

Donat-O-Meter

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

Latest GitHub Commits