$file = new WfsFiles(); $file->setByUploadFile($HTTP_POST_VARS['filename']); if (empty($HTTP_POST_VARS['downloadfilename'])) { $file->setFileShowName($HTTP_POST_VARS['filename']); } else { $file->setFileShowName($HTTP_POST_VARS['$downloadfilename']); } $article->addFile($HTTP_POST_VARS['filename']); } if ($wfsConfig['autoapprove'] == 1) { $approve = 1; $story->setApproved($approve); $story->setPublished(time()); $story->setExpired(0); } $result = $story->store(); if ($result) { if ($wfsConfig['notifysubmit'] == 1) { $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($xoopsConfig['adminmail']); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(_NW_NOTIFYSBJCT); $body = _NW_NOTIFYMSG; $body .= "\n\n" . _NW_TITLE . ": " . $story->title(); $body .= "\n" . _POSTEDBY . ": " . XoopsUser::getUnameFromId($uid); $body .= "\n" . _DATE . ": " . formatTimestamp(time(), 'm', $xoopsConfig['default_TZ']); $body .= "\n\n" . XOOPS_URL . '/modules/wfsection/admin/index.php?op=edit&articleid=' . $result; $xoopsMailer->setBody($body); $xoopsMailer->send();
$article->setUrl($url); $article->setUrlname($urlname); // no change // $article->setNotifyPub($notifypub); // $article->setUid($uid); // $article->setNohtml($nohtml_db); // $article->setHtmlpage(""); // $article->setIshtml(0); // $article->setWeight(100); // $article->setPublished(0); // $article->setExpired(0); // $article->setType('user'); // $article->setApproved($approve); $result = $article->store(); // if (!$result) // { echo "error $articleid"; } // redirect_header("index.php",2,_WFS_MODIFYEND); if (!$result) { redirect_header("index.php",10,_WFS_MODIFY_FAIL); exit; } redirect_header("article.php?articleid=".$articleid,5,_WFS_MODIFY_END); exit; break;
$article->setPublished(time()); } $article->loadPostVars(); if (empty($HTTP_POST_VARS['maintext']) || $HTTP_POST_VARS['ishtml']) { xoops_cp_header(); echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"even\">"; //echo $HTTP_POST_VARS['ishtml']; echo _AM_NOMAINTEXT . "<br />"; echo "</td></tr></table>"; break; } if ($article->approved && $article->type() != "admin") { $article->setPublished(time()); $isnew = '1'; } $article->store(); if (!empty($isnew) && $article->notifypub() && $article->uid() != 0) { $poster = new XoopsUser($article->uid()); $subject = _AM_ARTPUBLISHED; $message = sprintf(_AM_HELLO, $poster->uname()); $message .= "\n\n" . _AM_YOURARTPUB . "\n\n"; $message .= _AM_TITLEC . $article->title() . "\n" . _AM_URLC . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleryid=" . $article->storyid() . "\n" . _AM_PUBLISHEDC . formatTimestamp($article->published(), "{$timestanp}", 0) . "\n\n"; $message .= $xoopsConfig['sitename'] . "\n" . XOOPS_URL . ""; $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($poster->getVar("email")); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject($subject); $xoopsMailer->setBody($message); $xoopsMailer->send();
function db_store($maintext,$title,$time) { global $xoopsUser, $wfsConfig; $cid = $_POST['categoryid']; $flag_test = $_POST['test']; if ($flag_test) { return; } if (!$maintext) { return false; } if (!$title) { return false; } if (!$time) { return false; } if (!$cid) { return false; } $article = new WfsArticle(); // bug // title occure error in DB processing, whiche have an escape character // $article->setTitle($title); // bug // double addslashes when magic_quotes_gpc is off // $article->setTitle( addslashes($title) ); // $article->setMainText( addslashes($maintext) ); if (get_magic_quotes_gpc()) { $title = addslashes($title); $maintext = addslashes($maintext); } $article->setTitle( $title ); $article->setMainText( $maintext ); $article->setPublished($time); $article->setCategoryid($cid); $article->setUid( $xoopsUser->getvar('uid') ); $article->settype("admin"); $article->groupid = saveAccess('1 3 2'); // admin guest user $article->setChangeuser(-1); $article->setHtmlpage(''); $article->setWeight(0); $article->setExpired(0); $article->noshowart = 0; $article->nohtml = 0; $article->nosmiley = 0; $article->approved = 0; $article->offline = 0; $article->notifypub = 0; $article->ishtml = 0; $article->nobr = 1; $article->enaamp = 1; if ( $article->store() ) { return true; } else { return false; } }