I try to modify the submit (submit.php) in:
if (!empty($_POST['submit'])) {
include_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php';
$eh = new ErrorHandler; //ErrorHandler object
$submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
// RMV - why store submitter on form??
/*
if (!$_POST['submitter'] and $xoopsUser) {
$submitter = $xoopsUser->uid();
}elseif(!$_POST['submitter'] and !$xoopsUser) {
$submitter = 0;
}else{
$submitter = intval($_POST['submitter']);
}
*/
// Check if Title exist
if ( !isset($_POST['title']) || ('' == $_POST['title']) ) {
$error[]=_MD_MYLINKS_ERRORTITLE;
}
$title = $myts->addSlashes($_POST['title']);
// Check if URL exist
$url = $_POST['url'];
if ( (!isset($url)) || ('' == $url) || ('http://' == $url)) {
$error[]=_MD_MYLINKS_ERRORURL;
}
$url = $myts->addSlashes($url);
// Check if Description exist
if ( '' == $_POST['message'] ) {
$error[]=_MD_MYLINKS_ERRORDESC;
}
if (isset($error)) {
$err=implode("
",$error);
redirect_header('submit.php', 2, $err);
exit();
}
$notify = !empty($_POST['notify']) ? 1 : 0;
$cid = mylinksUtility::mylinks_cleanVars($_POST, 'cid', 0, 'int', array('min'=>0));
$description = $myts->addSlashes($_POST['message']);
$date = time();
$newid = $xoopsDB->genId($xoopsDB->prefix('mylinks_links').'_lid_seq');
$mylinksAdmin = ( is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid()) ) ? true : false;
$status = ( ( 1 == $xoopsModuleConfig['autoapprove'] ) || $mylinksAdmin ) ? 1 : 0;
$sql = sprintf("INSERT INTO %s (lid, cid, title, url, logourl, submitter, status, date, hits, rating, votes, comments) VALUES (%u, %u, '%s', '%s', '%s', %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix("mylinks_links"), $newid, $cid, $title, $url, ' ', $submitter, $status, $date, 0, 0, 0, 0);
$xoopsDB->query($sql) or $eh->show('0013');
if ($newid == 0) {
$newid = $xoopsDB->getInsertId();
}
$sql = sprintf("INSERT INTO %s (lid, description) VALUES (%u, '%s')", $xoopsDB->prefix("mylinks_text"), $newid, $description);
$xoopsDB->query($sql) or $eh->show('0013');
// Notify of new link (anywhere) and new link in category.
$notification_handler =& xoops_gethandler('notification');
$tags = array();
$tags['LINK_NAME'] = $title;
$tags['LINK_URL'] = XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/singlelink.php?cid={$cid}&lid={$newid}";
$sql = "SELECT title FROM " . $xoopsDB->prefix("mylinks_cat") . " WHERE cid={$cid}";
$result = $xoopsDB->query($sql);
$row = $xoopsDB->fetchArray($result);
$tags['CATEGORY_NAME'] = $row['title'];
$tags['CATEGORY_URL'] = XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/viewcat.php?cid={$cid}";
if ( 1 == $xoopsModuleConfig['autoapprove'] ) {
$notification_handler->triggerEvent('global', 0, 'new_link', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_link', $tags);
redirect_header('index.php', 2, _MD_MYLINKS_RECEIVED . "
" . _MD_MYLINKS_ISAPPROVED . "");
} else {
$tags['WAITINGLINKS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listNewLinks';
$notification_handler->triggerEvent('global', 0, 'link_submit', $tags);
$notification_handler->triggerEvent('category', $cid, 'link_submit', $tags);
if ($notify) {
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
$notification_handler->subscribe('link', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
}
redirect_header('index.php', 2, _MD_MYLINKS_RECEIVED);
}
exit();
} else {
Is not very good solution but the errors display is better.