예제 #1
0
function b_ams_author_show($options)
{
    if (!isset($options[3])) {
        $options[3] = "average";
    }
    include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
    $block = array();
    $authors = AmsStory::getAuthors($options[1], $options[0], $options[2], $options[3]);
    if (is_array($authors) && count($authors) > 0) {
        $block['authors'] = $authors;
    }
    return $block;
}
예제 #2
0
function b_ams_top_show($options)
{
    $myts =& MyTextSanitizer::getInstance();
    include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
    $block = array();
    if (!isset($options[4]) || $options[4] == 0 || $options[4] == array(0)) {
        $stories = AmsStory::getAllPublished($options[1], 0, false, 0, 1, true, $options[0]);
    } else {
        // If using Xoops 2.0.9.1 way of saving array values
        if (is_array($options[4])) {
            $topics = $options[4];
        } else {
            $topics = array_slice($options, 4);
        }
        $stories = AmsStory::getAllPublished($options[1], 0, false, $topics, 1, true, $options[0]);
    }
    foreach ($stories as $key => $story) {
        switch ($options[0]) {
            case "rating":
                $stat = $story->rating;
                break;
            case "counter":
                $stat = $story->counter();
                break;
            case "published":
                $stat = formatTimestamp($story->published(), "s");
                break;
        }
        $news = array();
        $title = $story->title();
        if (strlen($title) >= $options[2]) {
            $title = xoops_substr($title, 0, $options[2] - 1);
        }
        $html = $story->nohtml ? 0 : 1;
        $news['title'] = $title;
        $news['id'] = $story->storyid();
        $news['date'] = formatTimestamp($story->published(), "s");
        $news['hits'] = $stat;
        $news['friendlyurl'] = $story->friendlyurl;
        $news['friendlyurl_enable'] = $story->friendlyurl_enable;
        if ($options[3] > 0) {
            $news['teaser'] = xoops_substr($myts->displayTarea($story->hometext, $html), 0, $options[3] - 1);
        } else {
            $news['teaser'] = "";
        }
        $block['stories'][] = $news;
    }
    return $block;
}
예제 #3
0
function b_ams_spotlight_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
    global $xoopsModule;
    if (!isset($xoopsModule) || $xoopsModule->getVar('dirname') != "AMS") {
        $mod_handler =& xoops_gethandler('module');
        $amsModule =& $mod_handler->getByDirname('AMS');
    } else {
        $amsModule =& $xoopsModule;
    }
    $spotlight_handler =& xoops_getmodulehandler('spotlight', 'AMS');
    $block =& $spotlight_handler->getSpotlightBlock();
    //load special block instruction if exist
    if (file_exists(XOOPS_ROOT_PATH . '/modules/AMS/templates/' . $options[2] . '.php')) {
        include XOOPS_ROOT_PATH . '/modules/AMS/templates/' . $options[2] . '.php';
    }
    $GLOBALS['xoopsTpl']->assign('spotlights', $block['spotlights']);
    $block['spotlightcontent'] = $GLOBALS['xoopsTpl']->fetch('db:' . $options[2]);
    $GLOBALS['xoopsTpl']->clear_assign('spotlights');
    if (count($options) > 0) {
        if (intval($options[0]) > 0) {
            $stories = AmsStory::getAllPublished(intval($options[0]), 0, false, 0, 1, true, 'published', $block['ids']);
            $count = 0;
            foreach (array_keys($stories) as $i) {
                $block['stories'][] = array('id' => $stories[$i]->storyid(), 'title' => $stories[$i]->title(), 'hits' => $stories[$i]->counter(), 'friendlyurl_enable' => $stories[$i]->friendlyurl_enable, 'friendlyurl' => $stories[$i]->friendlyurl);
                $count++;
            }
        }
        if ($options[1] == 1) {
            $block['total_art'] = AmsStory::countPublishedByTopic();
            $block['total_read'] = AmsStory::countReads();
            $comment_handler =& xoops_gethandler('comment');
            $block['total_comments'] = $comment_handler->getCount(new Criteria('com_modid', $amsModule->getVar('mid')));
        }
        $block['showministats'] = $options[1];
        $block['showother'] = intval($options[0]) > 0;
    }
    return $block;
}
예제 #4
0
function b_ams_topics_moderate()
{
    include_once XOOPS_ROOT_PATH . "/class/xoopstopic.php";
    include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
    $block = array();
    $storyarray = AmsStory::getAllSubmitted(0, true, true);
    if (count($storyarray) > 0) {
        $block['lang_story_title'] = _AMS_MB_TITLE;
        $block['lang_story_date'] = _AMS_MB_POSTED;
        $block['lang_story_author'] = _AMS_MB_POSTER;
        $block['lang_story_action'] = _AMS_MB_ACTION;
        $block['lang_story_topic'] = _AMS_MB_TOPIC;
        foreach ($storyarray as $thisstory) {
            $uids[$thisstory->uid()] = $thisstory->uid();
        }
        $member_handler =& xoops_gethandler('member');
        $user_arr = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($uids)) . ")", 'IN'), true);
        foreach ($storyarray as $newstory) {
            $newstory->uname($user_arr);
            $title = $newstory->title();
            if (!isset($title) || $title == "") {
                $linktitle = "<a href='" . XOOPS_URL . "/modules/AMS/index.php?op=edit&amp;storyid=" . $newstory->storyid() . "'>" . _AD_NOSUBJECT . "</a>";
            } else {
                $linktitle = "<a href='" . XOOPS_URL . "/modules/AMS/submit.php?op=edit&amp;storyid=" . $newstory->storyid() . "'>" . $title . "</a>";
            }
            $story['title'] = $linktitle;
            $story['date'] = formatTimestamp($newstory->created());
            $story['author'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $newstory->uid() . "'>" . $newstory->uname . "</a>";
            $story['action'] = "<a href='" . XOOPS_URL . "/modules/AMS/submit.php?op=delete&amp;storyid=" . $newstory->storyid() . "'>" . _AMS_MB_DELETE . "</a>";
            $story['topic_title'] = $newstory->topic_title();
            $block['stories'][] =& $story;
            unset($story);
        }
    }
    return $block;
}
예제 #5
0
//  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 '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php';
$com_itemid = isset($_GET['com_itemid']) ? intval($_GET['com_itemid']) : 0;
if ($com_itemid > 0) {
    $article = new AmsStory($com_itemid);
    $article->uname();
    $com_replytext = _POSTEDBY . '&nbsp;<b>' . $article->uname . '</b>&nbsp;' . _DATE . '&nbsp;<b>' . formatTimestamp($article->published()) . '</b><br /><br />' . $article->hometext();
    $bodytext = $article->bodytext();
    if ($bodytext != '') {
        $com_replytext .= '<br /><br />' . $bodytext . '';
    }
    $com_replytitle = $article->title();
    include XOOPS_ROOT_PATH . '/include/comment_new.php';
}
예제 #6
0
include "../../mainfile.php";
if (file_exists(XOOPS_ROOT_PATH . '/modules/AMS/language/' . $xoopsConfig['language'] . '/main.php')) {
    include_once XOOPS_ROOT_PATH . '/modules/AMS/language/' . $xoopsConfig['language'] . '/main.php';
} else {
    include_once XOOPS_ROOT_PATH . '/modules/AMS/language/english/main.php';
}
if (!$xoopsUser) {
    redirect_header(XOOPS_URL . '/modules/AMS/index.php', 3, _NOPERM);
}
include_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php';
$storyid = isset($_POST['storyid']) ? intval($_POST['storyid']) : (isset($_GET['storyid']) ? intval($_GET['storyid']) : 0);
if (!$storyid) {
    redirect_header(XOOPS_URL . "/modules/AMS/index.php", 2, _AMS_NW_NOSTORY);
    exit;
}
$article = new AmsStory($storyid);
if ($xoopsUser->getVar('uid') != $article->uid()) {
    $gperm_handler =& xoops_gethandler('groupperm');
    $groups = $xoopsUser->getGroups();
    if (!$gperm_handler->checkRight("ams_approve", $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
        redirect_header(XOOPS_URL . '/modules/AMS/index.php', 3, _NOPERM);
        exit;
    }
}
$op = isset($_POST['op']) ? $_POST['op'] : "default";
$myts =& MyTextSanitizer::getInstance();
$xoopsConfigSearch =& $config_handler->getConfigsByCat(XOOPS_CONF_SEARCH);
$xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0;
// disable caching
$xoopsOption['template_main'] = 'ams_searchform.html';
include_once XOOPS_ROOT_PATH . '/header.php';
예제 #7
0
    $xoopsTpl->assign('lang_articles', _AMS_NW_ARTICLES);
    $xoopsTpl->assign('currentmonth', $months_arr[$frommonth]);
    $xoopsTpl->assign('currentyear', $fromyear);
    $xoopsTpl->assign('lang_actions', _AMS_NW_ACTIONS);
    $xoopsTpl->assign('lang_date', _AMS_NW_DATE);
    $xoopsTpl->assign('lang_views', _AMS_NW_VIEWS);
    // must adjust the selected time to server timestamp
    $timeoffset = $useroffset - $xoopsConfig['server_TZ'];
    $monthstart = mktime(0 - $timeoffset, 0, 0, $frommonth, 1, $fromyear);
    $monthend = mktime(23 - $timeoffset, 59, 59, $frommonth + 1, 0, $fromyear);
    $monthend = $monthend > time() ? time() : $monthend;
    $sql = "SELECT * FROM " . $xoopsDB->prefix("ams_article") . " WHERE published >= {$monthstart} and published <= {$monthend} ORDER by published DESC";
    $result = $xoopsDB->query($sql);
    $count = 0;
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $article = new AmsStory($myrow);
        $story = array();
        $story['title'] = "<a href='index.php?storytopic=" . $article->topicid() . "'>" . $article->topic_title() . "</a>: <a href='article.php?storyid=" . $article->storyid() . "'>" . $article->title() . "</a>";
        $story['counter'] = $article->counter();
        $story['date'] = formatTimestamp($article->published(), "m", $useroffset);
        $story['print_link'] = 'print.php?storyid=' . $article->storyid();
        $story['mail_link'] = 'mailto:?subject=' . sprintf(_AMS_NW_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_AMS_NW_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?storyid=' . $article->storyid();
        $xoopsTpl->append('stories', $story);
        $count++;
    }
    $xoopsTpl->assign('lang_printer', _AMS_NW_PRINTERFRIENDLY);
    $xoopsTpl->assign('lang_sendstory', _AMS_NW_SENDSTORY);
    $xoopsTpl->assign('lang_storytotal', sprintf(_AMS_NW_THEREAREINTOTAL, $count));
} else {
    $xoopsTpl->assign('show_articles', false);
}
예제 #8
0
<?php

include "../../mainfile.php";
include_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php';
if (empty($_POST['submit'])) {
    $_POST['submit'] = '';
}
$storyid = isset($_POST['storyid']) ? intval($_POST['storyid']) : (isset($_GET['storyid']) ? intval($_GET['storyid']) : 0);
if ($storyid > 0) {
    $article = new AmsStory($storyid);
} else {
    redirect_header(XOOPS_URL . '/modules/AMS/index.php', 3, _AMS_NW_NOSTORY);
    exit;
}
if ($_POST['submit'] != '' && $storyid > 0) {
    if ($article->rateStory($_POST['rating'])) {
        $ratemessage = _AMS_NW_RATING_SUCCESSFUL;
    } else {
        $ratemessage = $article->renderErrors();
    }
    redirect_header(XOOPS_URL . "/modules/AMS/article.php?storyid=" . $article->storyid(), 3, $ratemessage);
    exit;
} else {
    $xoopsOption['template_main'] = "ams_ratearticle.html";
    include XOOPS_ROOT_PATH . "/header.php";
    include 'include/ratingform.inc.php';
}
$xoopsTpl->assign('breadcrumb', $article->getPath(true) . " > " . _AMS_NW_RATE);
include '../../footer.php';
예제 #9
0
     if ($story->calculateVersion(true)) {
         if ($story->updateVersion()) {
             $message = sprintf(_AMS_NW_VERSIONUPDATED, $story->version . "." . $story->revision . "." . $story->revisionminor);
             //redirect_header('article.php?storyid='.$story->storyid(), 3, $message);
             //exit();
         } else {
             $message = $story->renderErrors();
         }
     } else {
         $message = $story->renderErrors();
     }
     redirect_header(XOOPS_URL . '/modules/AMS/article.php?storyid=' . $story->storyid(), 3, $message);
     break;
 case 'form':
 default:
     $story = new AmsStory();
     $story->setTitle('');
     $story->setHometext('');
     $noname = 0;
     $story->setNohtml(0);
     $story->setNosmiley(0);
     $story->setNotifypub(1);
     $story->setTopicId(0);
     if ($approveprivilege) {
         $story->setTopicdisplay(0);
         $story->setTopicalign('R');
         $story->setIhome(0);
         $story->setBodytext('');
         $story->setApproved(1);
         $story->set = '';
         $expired = 0;
예제 #10
0
<?php

include "../../mainfile.php";
include_once 'class/class.sfiles.php';
include_once 'class/class.newsstory.php';
$myts =& MyTextSanitizer::getInstance();
// MyTextSanitizer object
$fileid = isset($_GET['fileid']) ? intval($_GET['fileid']) : 0;
if (empty($fileid)) {
    redirect_header(XOOPS_URL . "/modules/AMS/index.php", 2, _ERRORS);
    exit;
}
$sfiles = new sFiles($fileid);
// Do we have the right to see the file ?
$article = new AmsStory($sfiles->getStoryid());
// and the news, can we see it ?
if ($article->published() == 0 || $article->published() > time()) {
    redirect_header(XOOPS_URL . '/modules/AMS/index.php', 2, _AMS_NW_NOSTORY);
    exit;
}
/*
*
* Remarks. Save for later if needed. Expired articles still allowed to be read in AMS. Remove this remark if you want to forbid it.
// Expired
if ( $article->expired() != 0 && $article->expired() < time() ) {
    redirect_header(XOOPS_URL.'/modules/AMS/index.php', 2, _AMS_NW_NOSTORY);
    exit();
}
*/
$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
예제 #11
0
 function getSpotlightBlock($display_only = true)
 {
     $myts =& MyTextSanitizer::getInstance();
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
     $block = array();
     if ($display_only) {
         $criteria = new Criteria('display', 1);
     } else {
         $criteria = new Criteria('spotlightid', 0, ">");
     }
     $criteria->setSort('weight');
     $spots =& $this->getObjects($criteria);
     if (count($spots) == 0) {
         return $block;
     }
     $ids = array();
     foreach (array_keys($spots) as $i) {
         switch ($spots[$i]->getVar('mode')) {
             // Latest Article
             case 1:
                 $article_arr = AmsStory::getAllPublished(1, 0, false, 0, 1, true, 'published', $ids);
                 $article =& $article_arr[0];
                 if (!is_object($article)) {
                     continue;
                 }
                 $ids[$article->storyid()] = $article->storyid();
                 $uids[] = $article->uid();
                 break;
                 // Latest Article in Topic
             // Latest Article in Topic
             case 2:
                 $article_arr = AmsStory::getAllPublished(1, 0, false, $spots[$i]->getVar('topicid'), 1, true, 'published', $ids);
                 $article =& $article_arr[0];
                 if (!is_object($article)) {
                     continue;
                 }
                 $ids[$article->storyid()] = $article->storyid();
                 $uids[] = $article->uid();
                 break;
                 // Specific Article
             // Specific Article
             case 3:
                 $article = new AmsStory($spots[$i]->getVar('storyid'));
                 if (!is_object($article)) {
                     continue;
                 }
                 $ids[$article->storyid()] = $article->storyid();
                 $uids[] = $article->uid();
                 break;
             case 4:
                 $article = "";
         }
         $spotarticles[] = $article;
     }
     $member_handler =& xoops_gethandler('member');
     $users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_unique($uids)) . ")", 'IN'), true);
     foreach (array_keys($spotarticles) as $i) {
         $article =& $spotarticles[$i];
         $image = $spots[$i]->getImage($article);
         if (is_object($article)) {
             $article->uname($users);
             $teaser = $spots[$i]->getVar('autoteaser') != 1 ? $myts->displayTarea($spots[$i]->getVar('teaser', 'n'), 1) : ($spots[$i]->getVar('maxlength') > 0 ? xoops_substr($article->hometext(), 0, $spots[$i]->getVar('maxlength'), "") : $article->hometext());
             $id = $article->storyid();
             $title = $article->title();
             $hits = $article->counter();
             $poster = $article->uname;
             $posterid = $article->uid();
             $posttime = formatTimestamp($article->published());
             $custom = 0;
             $friendlyurl_enable = $article->friendlyurl_enable;
             $friendlyurl = $article->friendlyurl;
         } else {
             $id = 0;
             $title = "";
             $hits = 0;
             $custom = 1;
             $posterid = 0;
             $posttime = "";
             $poster = "";
             $teaser = $myts->displayTarea($spots[$i]->getVar('teaser', 'n'), 1);
         }
         $block['spotlights'][] = array('spotid' => $spots[$i]->getVar('spotlightid'), 'id' => $id, 'title' => $title, 'hits' => $hits, 'image' => $image, 'text' => $teaser, 'weight' => $spots[$i]->getVar('weight'), 'display' => $spots[$i]->getVar('display'), 'posttime' => $posttime, 'poster' => $poster, 'posterid' => $posterid, 'autoteaser' => $spots[$i]->getVar('autoteaser'), 'custom' => $custom, 'friendlyurl_enable' => $friendlyurl_enable, 'friendlyurl' => $friendlyurl);
     }
     $block['ids'] = $ids;
     return $block;
 }
예제 #12
0
$xoopsTpl->xoops_setCaching(0);
if ($xoopsConfig['debug_mode'] == 3) {
    $xoopsTpl->xoops_setDebugging(true);
}
$xoopsTpl->assign(array('xoops_theme' => $xoopsConfig['theme_set'], 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'] . '/', 'xoops_themecss' => xoops_getcss($xoopsConfig['theme_set']), 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
$storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;
$version = isset($_GET['version']) ? intval($_GET['version']) : 0;
$revision = isset($_GET['revision']) ? intval($_GET['revision']) : 0;
$revisionminor = isset($_GET['revisionminor']) ? intval($_GET['revisionminor']) : 0;
if (!$storyid || !$version) {
    redirect_header(XOOPS_URL . "/modules/AMS/index.php", 2, _AMS_NW_NOSTORY);
    exit;
}
$myts =& MyTextSanitizer::getInstance();
// set comment mode if not set
$article = new AmsStory();
$article->getNewsVersion($storyid, $version, $revision, $revisionminor);
$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
    $groups = $xoopsUser->getGroups();
} else {
    $groups = XOOPS_GROUP_ANONYMOUS;
}
if (!$gperm_handler->checkRight("ams_approve", $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
    redirect_header(XOOPS_URL . '/modules/AMS/index.php', 3, _NOPERM);
    exit;
}
$xoopsOption['template_main'] = 'ams_article.html';
include_once XOOPS_ROOT_PATH . '/header.php';
$xoopsTpl->assign('story', $article->toArray(true, false, -1));
$banner = $myts->displayTarea($article->getBanner(), 1);
예제 #13
0
 /**
  * Static method
  */
 function getAllNews($limit, $start = 0, $criteria = null)
 {
     $ret = array();
     $db =& XoopsDatabaseFactory::getDatabaseConnection();
     if ($criteria == null) {
         $criteria = new Criteria();
     }
     $criteria->setLimit($limit);
     $criteria->setStart($start);
     $sql = "SELECT n.*, t.*, a.* FROM " . $db->prefix('ams_article') . " n, " . $db->prefix('ams_text') . " t, " . $db->prefix('ams_audience') . " a WHERE n.storyid=t.storyid AND n.audienceid=a.audienceid AND n.published != 0 AND t.current=1";
     if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
         $render = $criteria->render();
         if ($render != "") {
             $sql .= ' AND ' . $render;
         }
         $sql .= " GROUP BY n.storyid";
         if ($criteria->getSort() != '') {
             $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
         }
         $limit = $criteria->getLimit();
         $start = $criteria->getStart();
     }
     $result = $db->query($sql, $limit, $start);
     if (!$result) {
         return $ret;
     }
     while ($myrow = $db->fetchArray($result)) {
         $story = new AmsStory();
         $story->makeStory($myrow);
         $ret[$myrow['storyid']] =& $story;
         unset($story);
     }
     return $ret;
 }
예제 #14
0
        $xt->getTopic($xoopsOption['storytopic']);
        $pagetitle .= ' - ' . $xt->topic_title();
        $xoopsTpl->assign('breadcrumb', $xt->getTopicPath(true));
    } else {
        $xoopsTpl->assign('breadcrumb', '');
    }
} else {
    include_once XOOPS_ROOT_PATH . "/class/tree.php";
    $xt = new AmsTopic($xoopsDB->prefix("ams_topics"));
    $allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex']);
    $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
    $alltopics = $topic_obj_tree->getFirstChild(0);
    $article_counts = AmsStory::countPublishedOrderedByTopic();
    $smarty_topics = array();
    foreach (array_keys($alltopics) as $i) {
        $allstories[$i] = AmsStory::getAllPublished($xoopsOption['storynum'], 0, false, $i, 0);
        if (count($allstories[$i]) > 0) {
            foreach ($allstories[$i] as $thisstory) {
                $uids[$thisstory->uid()] = $thisstory->uid();
            }
        }
        if (!isset($article_counts[$i])) {
            $article_counts[$i] = 0;
        }
    }
    if (count($uids) > 0) {
        $member_handler =& xoops_gethandler('member');
        $user_arr = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($uids)) . ")", 'IN'), true);
        foreach ($alltopics as $topicid => $topic) {
            $topicstories = array();
            foreach ($allstories[$topicid] as $thisstory) {
예제 #15
0
function delTopic()
{
    if (!isset($_REQUEST['topic_id']) || $_REQUEST['topic_id'] == 0) {
        redirect_header('index.php?op=topicsmanager', 3, _AMS_AM_NOTOPICSELECTED);
    }
    global $xoopsDB, $xoopsModule;
    if (!isset($_POST['ok'])) {
        echo "<h4>" . _AMS_AM_CONFIG . "</h4>";
        $xt = new XoopsTopic($xoopsDB->prefix("ams_topics"), intval($_GET['topic_id']));
        xoops_confirm(array('op' => 'delTopic', 'topic_id' => intval($_GET['topic_id']), 'ok' => 1), 'index.php', _AMS_AM_WAYSYWTDTTAL . '<br />' . $xt->topic_title('S'));
    } else {
        $xt = new XoopsTopic($xoopsDB->prefix("ams_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 = AmsStory::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'), 'ams_approve', $eachtopic->topic_id);
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'ams_submit', $eachtopic->topic_id);
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'ams_view', $eachtopic->topic_id);
        }
        redirect_header('index.php?op=topicsmanager', 1, _AMS_AM_DBUPDATED);
        exit;
    }
}
예제 #16
0
     }
     if (!empty($_POST['ok'])) {
         include_once XOOPS_ROOT_PATH . "/header.php";
         $story->delversions($_POST['version'], $_POST['revision'], $_POST['revisionminor']);
         redirect_header(XOOPS_URL . '/modules/AMS/article.php?storyid=' . $story->storyid, 3, sprintf(_AMS_NW_VERSIONUPDATED, $_POST['version'] . "." . $_POST['revision'] . "." . $_POST['revisionminor']));
     } else {
         $version_array = explode(".", $_POST['version']);
         if (!isset($version_array[2])) {
             $version_array[2] = 0;
         }
         include_once XOOPS_ROOT_PATH . "/header.php";
         xoops_confirm(array('op' => 'delversions', 'submit' => 1, 'ok' => 1, 'storyid' => $_POST['storyid'], 'version' => $version_array[0], 'revision' => $version_array[1], 'revisionminor' => $version_array[2]), 'versions.php', _AMS_NW_RUSUREDELVERSIONS);
     }
     break;
 case "delallversions":
     $story = new AmsStory(intval($_POST['storyid']));
     $gperm_handler =& xoops_gethandler('groupperm');
     if (!$xoopsUser || !$gperm_handler->checkRight("ams_approve", $story->topicid(), $xoopsUser->getGroups(), $xoopsModule->mid())) {
         redirect_header(XOOPS_URL . '/modules/AMS/article.php?storyid=' . $story->storyid, 3, _NOPERM);
         exit;
     }
     if (!empty($_POST['ok'])) {
         include_once XOOPS_ROOT_PATH . "/header.php";
         $story->delallversions($_POST['version'], $_POST['revision'], $_POST['revisionminor']);
         redirect_header(XOOPS_URL . '/modules/AMS/article.php?storyid=' . $story->storyid, 3, sprintf(_AMS_NW_VERSIONUPDATED, $_POST['version'] . "." . $_POST['revision'] . "." . $_POST['revisionminor']));
     } else {
         $version_array = explode(".", $_POST['version']);
         if (!isset($version_array[2])) {
             $version_array[2] = 0;
         }
         include_once XOOPS_ROOT_PATH . "/header.php";
예제 #17
0
} else {
    include_once XOOPS_ROOT_PATH . '/modules/AMS/language/english/main.php';
}
/*foreach ($_POST as $k => $v) {
    ${$k} = $v;
}
*/
$storyid = isset($_GET['storyid']) ? $_GET['storyid'] : 0;
$storyid = intval($storyid);
if (empty($storyid)) {
    redirect_header(XOOPS_URL . "/modules/AMS/index.php", 2, _AMS_NW_NOSTORY);
    exit;
}
$myts =& MyTextSanitizer::getInstance();
// set comment mode if not set
$article = new AmsStory($storyid);
if ($article->published() == 0 || $article->published() > time()) {
    //redirect_header('index.php', 2, _AMS_NW_NOSTORY);
    include_once XOOPS_ROOT_PATH . '/header.php';
    include XOOPS_ROOT_PATH . '/footer.php';
    exit;
}
$admin = false;
$gperm_handler =& xoops_gethandler('groupperm');
if (is_object($xoopsUser)) {
    $groups = $xoopsUser->getGroups();
} else {
    $groups = XOOPS_GROUP_ANONYMOUS;
}
if (!$gperm_handler->checkRight("ams_approve", $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
    if (!$gperm_handler->checkRight("ams_view", $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {