Titre du sujet : Re: Notifications qui ne fonctionne pas dans xoopstube par seboseboss sur 31/03/2015 16:17:04
Salut
On le vois au dessus à partir du cid mais je sais pas pourquoi il garde 0 alors qu'on a bien donnée une nouvelle id à la catégorie qu'on est en train de créer, d'ailleurs tout fonctionne parfaitement sauf cette variable du message.
J'ai peut être pas compris ce que tu demandait, pourrait tu être plus clair car on voit comment est défini category_url, le soucis c'est que la variable $newid renvoi 0.
Voila l'op en entier:
case 'addCat':
$groups = isset($_REQUEST['groups']) ? $_REQUEST['groups'] : array();
$cid = (isset($_REQUEST['cid'])) ? $_REQUEST['cid'] : 0;
$pid = (isset($_REQUEST['pid'])) ? $_REQUEST['pid'] : 0;
$weight = (isset($_REQUEST['weight']) && $_REQUEST['weight'] > 0) ? $_REQUEST['weight'] : 0;
$spotlighthis = (isset($_REQUEST['lid'])) ? $_REQUEST['lid'] : 0;
$spotlighttop = ($_REQUEST['spotlighttop'] == 1) ? 1 : 0;
$title = $xtubemyts->addslashes($_REQUEST['title']);
$descriptionb = $xtubemyts->addslashes($_REQUEST['description']);
$imgurl = (
$_REQUEST['imgurl'] && $_REQUEST['imgurl'] != 'blank.gif') ? $xtubemyts->addslashes($_REQUEST['imgurl']) : '';
$client_id = (isset($_REQUEST['client_id'])) ? $_REQUEST['client_id'] : 0;
if ($client_id > 0) {
$banner_id = 0;
} else {
$banner_id = (isset($_REQUEST['banner_id'])) ? $_REQUEST['banner_id'] : 0;
}
$nohtml = isset($_REQUEST['nohtml']);
$nosmiley = isset($_REQUEST['nosmiley']);
$noxcodes = isset($_REQUEST['noxcodes']);
$noimages = isset($_REQUEST['noimages']);
$nobreak = isset($_REQUEST['nobreak']);
if (!$cid) {
$cid = 0;
$sql = "INSERT INTO " . $xoopsDB->prefix('xoopstube_cat')
. " (cid, pid, title, imgurl, description, nohtml, nosmiley, noxcodes, noimages, nobreak, weight, spotlighttop, spotlighthis, client_id, banner_id ) VALUES ('', $pid, '$title', '$imgurl', '$descriptionb', '$nohtml', '$nosmiley', '$noxcodes', '$noimages', '$nobreak', '$weight', $spotlighttop, $spotlighthis, $client_id, $banner_id )";
if ($cid == 0) {
$newid = $xoopsDB->getInsertId();
}
// Notify of new category
global $xoopsModule;
$tags = array();
$tags['CATEGORY_NAME'] = $title;
$tags['CATEGORY_URL']
=
XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . intval($newid);
$notification_handler = &xoops_gethandler('notification');
$notification_handler->triggerEvent('global', 0, 'new_category', $tags);
$database_mess = _AM_XTUBE_CCATEGORY_CREATED;
} else {
if ($cid == $pid) {
redirect_header('category.php', 1, _AM_XTUBE_ERROR_CATISCAT);
exit();
}
$sql = "UPDATE " . $xoopsDB->prefix('xoopstube_cat')
. " SET title ='$title', imgurl='$imgurl', pid =$pid, description='$descriptionb', spotlighthis='$spotlighthis' , spotlighttop='$spotlighttop', nohtml='$nohtml', nosmiley='$nosmiley', noxcodes='$noxcodes', noimages='$noimages', nobreak='$nobreak', weight='$weight', client_id='$client_id', banner_id='$banner_id' WHERE cid="
. intval($cid);
$database_mess = _AM_XTUBE_CCATEGORY_MODIFIED;
}
if (!$result = $xoopsDB->query($sql)) {
XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
return FALSE;
}
redirect_header('category.php', 1, $database_mess);
break;
|