$xoopsTpl -> assign ( 'lang_legendname', $legendname ); $xoopsTpl -> assign ( 'lang_legenddesc', $legenddesc ); $xoopsTpl -> assign ( 'lang_home', constant("_MD_{$MYDIRNAME}_HOME") ); $xoopsTpl -> assign ( 'lang_caution', $caution); $xoopsTpl -> assign ( 'titleblockuse', intval($xoopsModuleConfig["titleblockuse"]) ); $xoopsTpl -> assign ( 'h1id', $myts -> makeTboxData4Show( $xoopsModuleConfig["h1id"] ) ); include( XOOPS_ROOT_PATH . '/footer.php' ); break; } // $init = $myts -> addSlashes(getInitial($_POST['term'],$_POST['proc'])); $term = $myts -> addSlashes($_POST['term']); $proc = $myts -> addSlashes($_POST['proc']); $init = getInitial($term,$proc); $proc = getJsortCode($proc); $definition = !empty( $_POST['definition'] ) ? $myts -> addSlashes( $_POST['definition'] ) : ''; $ref = !empty( $_POST['ref'] ) ? $myts -> addSlashes( $_POST['ref'] ) : ''; $url = !empty( $_POST['url'] ) ? $myts -> addSlashes( $_POST['url'] ) : ''; $datesub = time(); $offline = $request = 0; if ( $xoopsModuleConfig['autoapprove'] == 1 ) { $submit = 0; } else { $submit = 1; }
function entrySave($entryID = '') { global $cat_table,$ent_table,$xoopsGTicket,$MYDIRNAME; // Ticket check if ( ! $xoopsGTicket->check() ) { redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors()); } $xoopsDB =& Database::getInstance(); $myts =& MyTextSanitizer::getInstance(); $entryID = !empty($_POST['entryID']) ? intval($_POST['entryID']) : 0; $categoryID = !empty($_POST['categoryID']) ? intval($_POST['categoryID']) : 0; $block = !empty($_POST['block']) ? intval($_POST['block']) : 0; $offline = !empty($_POST['offline']) ? intval($_POST['offline']) : 0; $breaks = !empty($_POST['breaks']) ? intval($_POST['breaks']) : 0; $html = !empty($_POST['html']) ? intval($_POST['html']) : 0; $smiley = !empty($_POST['smiley']) ? intval($_POST['smiley']) : 0; $xcodes = !empty($_POST['xcodes']) ? intval($_POST['xcodes']) : 0; $uid = !empty($_POST['uid']) ? intval($_POST['uid']) : 1; // $init = $myts -> addSlashes(getInitial($_POST['term'],$_POST['proc'])); $term = !empty($_POST['term']) ? $myts -> addSlashes($_POST['term']) : ''; $proc = !empty($_POST['proc']) ? $myts -> addSlashes($_POST['proc']) : ''; $init = getInitial($term,$proc); $definition = !empty($_POST['definition']) ? $myts -> addSlashes($_POST['definition']) : ''; $ref = !empty($_POST['ref']) ? $myts -> addSlashes($_POST['ref']) : ''; $url = !empty($_POST['url']) ? $myts -> addSlashes($_POST['url']) : ''; $notifypub = !empty($_POST['notifypub']) ? intval($_POST['notifypub']) : 0; $date = time(); $proc = getJsortCode($proc); if ( $xoopsDB -> query( "UPDATE $ent_table SET term = '$term', proc = '$proc', init = '$init', categoryID = '$categoryID', definition = '$definition', ref = '$ref', url = '$url', uid = '$uid', submit = '0', datesub = '$date', html = '$html', smiley = '$smiley', xcodes = '$xcodes', breaks = '$breaks', block = '$block', offline = '0', notifypub = '$notifypub', request = '0' WHERE entryID = '$entryID'" ) ) { //posts count up $xoopsDB->query( "UPDATE ".$xoopsDB->prefix('users')." SET posts=posts+1 WHERE uid='$uid'" ) ; redirect_header( "submissions.php", 1, constant("_AM_{$MYDIRNAME}_ENTRYAUTHORIZED") ); } else { redirect_header( "submissions.php", 1, constant("_AM_{$MYDIRNAME}_ENTRYNOTUPDATED") ); } }
} } if ($_POST['op'] == 'update') { $result4 = $xoopsDB -> query( "SELECT entryID, term, proc FROM $ent_table WHERE length(init) <= '2' AND request = '0' LIMIT 100"); if ($result4) { while (list( $entryID , $term, $proc ) = $xoopsDB->fetchRow($result4)) { if (ereg(",",$proc)) { list($temp,$proc) = explode(",",$proc); } $init = getInitial($term,$proc) ; $proc = $myts -> addSlashes(getJsortCode($proc)); $result5 = $xoopsDB->query("UPDATE $ent_table SET init='".$init."', proc='".$proc."' WHERE entryID = '".intval($entryID))."'"; if (!$result5) { xoops_cp_header(); xoops_error("ERROR entryID $entryID"); xoops_cp_footer(); exit(); } } redirect_header('update.php',1,constant("_AM_{$MYDIRNAME}_CATMODIFIED")); exit(); } else { xoops_cp_header();
function entrySave ($entryID = '') { global $xoopsUser,$xoopsConfig,$mydirname,$MYDIRNAME,$cat_table,$ent_table,$xoopsGTicket; // Ticket check if ( ! $xoopsGTicket->check() ) { redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors()); } $xoopsDB =& Database::getInstance(); $xoopsModule = XoopsModule::getByDirname("$mydirname"); $myts =& MyTextSanitizer::getInstance(); $categoryID = !empty($_POST['categoryID']) ? intval($_POST['categoryID']) : ''; $uid = !empty($_POST['uid']) ? intval($_POST['uid']) : ''; $datesub = !empty($_POST['renewdate']) ? mktime( intval($_POST['autohour']), intval($_POST['automin']), 0, intval($_POST['automonth']), intval($_POST['autoday']), intval($_POST['autoyear']) ) : intval($_POST['datesub']); $html = !empty($_POST['html']) ? intval($_POST['html']) : 0; $smiley = !empty($_POST['smiley']) ? intval($_POST['smiley']) : 0; $xcodes = !empty($_POST['xcodes']) ? intval($_POST['xcodes']) : 0; $breaks = !empty($_POST['breaks']) ? intval($_POST['breaks']) : 0; $term = !empty($_POST['term']) ? $myts->addSlashes($_POST['term']) : ''; $proc = !empty($_POST['proc']) ? $myts->addSlashes($_POST['proc']) : ''; $init = getInitial($term,$proc); $definition = !empty($_POST['definition']) ? $myts -> addSlashes( $_POST['definition'] ) : ''; $ref = !empty($_POST['ref']) ? $myts->addSlashes($_POST['ref']) : ''; $url = !empty($_POST['url']) ? $myts->addSlashes($_POST['url']) : ''; $block = !empty($_POST['block']) ? intval($_POST['block']) : 0; $offline = !empty($_POST['offline']) ? intval($_POST['offline']) : 0; $submit = 0; $notifypub = 0; $request = 0; $proc = getJsortCode($proc); // Save to database if ( $entryID > 0 ) { if ( $xoopsDB -> query( "UPDATE $ent_table SET term = '$term', proc = '$proc', categoryID = '$categoryID', init = '$init', definition = '$definition', ref = '$ref', url = '$url', uid = '$uid', submit = '$submit', datesub = '$datesub', html = '$html', smiley = '$smiley', xcodes = '$xcodes', breaks = '$breaks', block = '$block', offline = '$offline', notifypub = '$notifypub', request = '$request' WHERE entryID = '$entryID'" ) ) { include_once( XOOPS_ROOT_PATH . '/modules/'.$xoopsModule->dirname().'/entries_write.php' ); //okino calculateTotals(); redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_ENTRYMODIFIED") ); } else { redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_ENTRYNOTUPDATED") ); } } else // That is, $entryID exists, thus were editing an entry { $date = !empty($_POST['renewdate']) ? $datesub : time(); $uid = $xoopsUser -> uid(); if ( $xoopsDB -> query( "INSERT INTO $ent_table (entryID, categoryID, term, proc, init, definition, ref, url, uid, submit, datesub, html, smiley, xcodes, breaks, block, offline, notifypub, request ) VALUES ('', '$categoryID', '$term', '$proc', '$init', '$definition', '$ref', '$url', '$uid', '$submit', '$date', '$html', '$smiley', '$xcodes', '$breaks', '$block', '$offline', '$notifypub', '$request' )" ) ) { include_once( XOOPS_ROOT_PATH . '/modules/'.$xoopsModule->dirname().'/entries_write.php' ); //okino //posts count up $xoopsDB->query( "UPDATE ".$xoopsDB->prefix('users')." SET posts=posts+1 WHERE uid='$uid'" ) ; calculateTotals(); redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_ENTRYCREATEDOK") ); } else { redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_ENTRYNOTCREATED") ); } } }