Exemplo n.º 1
0
 function fbMovePosts($catid, $isMod, $return)
 {
     $app =& JFactory::getApplication();
     $backUrl = $app->getUserState("com_kunena.ActionBulk");
     $kunena_db =& JFactory::getDBO();
     $kunena_my =& JFactory::getUser();
     // $isMod if user is moderator in the current category
     if (!$isMod) {
         // Test also if user is a moderator in some other category
         $kunena_db->setQuery("SELECT userid FROM #__fb_moderation WHERE userid='{$kunena_my->id}'");
         $isMod = $kunena_db->loadResult();
         check_dberror("Unable to load moderation info.");
     }
     $isAdmin = CKunenaTools::isModOrAdmin();
     //isMod will stay until better group management comes in
     if (!$isAdmin && !$isMod) {
         $app->redirect($return, _POST_NOT_MODERATOR);
     }
     $catid = (int) $catid;
     if ($catid > 0) {
         $items = fbGetArrayInts("fbDelete");
         // start iterating here
         foreach ($items as $id => $value) {
             $id = (int) $id;
             $kunena_db->setQuery("SELECT subject, catid, time AS timestamp FROM #__fb_messages WHERE id='{$id}'");
             $oldRecord = $kunena_db->loadObjectList();
             check_dberror("Unable to load message detail.");
             $newCatObj = new jbCategory($kunena_db, $oldRecord[0]->catid);
             if (fb_has_moderator_permission($kunena_db, $newCatObj, $kunena_my->id, $isAdmin)) {
                 $newSubject = _MOVED_TOPIC . " " . $oldRecord[0]->subject;
                 $kunena_db->setQuery("SELECT MAX(time) AS timestamp FROM #__fb_messages WHERE thread='{$id}'");
                 $lastTimestamp = $kunena_db->loadResult();
                 check_dberror("Unable to load messages max(time).");
                 if ($lastTimestamp == "") {
                     $lastTimestamp = $oldRecord[0]->timestamp;
                 }
                 //perform the actual move
                 $kunena_db->setQuery("UPDATE #__fb_messages SET `catid`='{$catid}' WHERE `id`='{$id}' OR `thread`='{$id}'");
                 $kunena_db->query();
                 check_dberror("Unable to move thread.");
                 $err = _POST_SUCCESS_MOVE;
             } else {
                 $err = _POST_NOT_MODERATOR;
             }
         }
         //end foreach
     } else {
         $err = _POST_NO_DEST_CATEGORY;
     }
     CKunenaTools::reCountBoards();
     $app->redirect($return, $err);
 }
Exemplo n.º 2
0
 if (file_exists(KUNENA_ABSTMPLTPATH . '/fb_layout.php')) {
     require_once KUNENA_ABSTMPLTPATH . '/fb_layout.php';
 } else {
     require_once KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'fb_layout.php';
 }
 require_once KUNENA_PATH_LIB . DS . 'kunena.permissions.php';
 require_once KUNENA_PATH_LIB . DS . 'kunena.category.class.php';
 require_once JPATH_BASE . '/libraries/joomla/template/template.php';
 if ($catid != '') {
     $thisCat = new jbCategory($kunena_db, $catid);
 }
 $KunenaTemplate = new patTemplate();
 $KunenaTemplate->setRoot(KUNENA_ABSTMPLTPATH);
 $KunenaTemplate->readTemplatesFromFile("header.html");
 $KunenaTemplate->readTemplatesFromFile("footer.html");
 $is_Moderator = fb_has_moderator_permission($kunena_db, $thisCat, $kunena_my->id, $is_admin);
 if ($func == '') {
     switch ($fbConfig->fbdefaultpage) {
         case 'recent':
             $func = 'latest';
             break;
         case 'my':
             $func = $kunena_my->id > 0 ? 'mylatest' : 'latest';
             break;
         default:
             $func = 'listcat';
     }
 }
 // Kunena Current Template Icons Pack
 // See if there's an icon pack installed
 $useIcons = 0;
Exemplo n.º 3
0
                        </th>
                    </tr>

                    <?php 
                //    show forums within the categories
                $kunena_db->setQuery("SELECT c.*, m.id AS mesid, m.subject, mm.catid, m.name AS mname, m.userid, u.username, u.name AS uname FROM #__fb_categories AS c\n                    LEFT JOIN #__fb_messages AS m ON c.id_last_msg=m.id\n                    LEFT JOIN #__users AS u ON u.id=m.userid\n                    LEFT JOIN #__fb_messages AS mm ON mm.id=c.id_last_msg\n                    WHERE c.parent='{$cat->id}' AND c.published='1' ORDER BY ordering");
                $rows = $kunena_db->loadObjectList();
                check_dberror("Unable to load categories.");
                $tabclass = array("sectiontableentry1", "sectiontableentry2");
                $k = 0;
                if (sizeof($rows) == 0) {
                    echo '' . _GEN_NOFORUMS . '';
                } else {
                    foreach ($rows as $singlerow) {
                        $obj_fb_cat = new jbCategory($kunena_db, $singlerow->id);
                        $is_Mod = fb_has_moderator_permission($kunena_db, $obj_fb_cat, $kunena_my->id, $is_admin);
                        if (in_array($singlerow->id, $allow_forum)) {
                            //    $k=for alternating row colors:
                            $k = 1 - $k;
                            $numtopics = $singlerow->numTopics;
                            $numreplies = $singlerow->numPosts;
                            $lastPosttime = $singlerow->time_last_msg;
                            $lastptime = KUNENA_timeformat(CKunenaTools::fbGetShowTime($singlerow->time_last_msg));
                            $forumDesc = stripslashes(smile::smileReplace($singlerow->description, 0, $fbConfig->disemoticons, $smileyList));
                            $forumDesc = nl2br($forumDesc);
                            $forumDesc = smile::htmlwrap($forumDesc, $fbConfig->wrap);
                            //    Get the forumsubparent categories :: get the subcategories here
                            $kunena_db->setQuery("SELECT id, name, numTopics, numPosts FROM #__fb_categories WHERE parent='{$singlerow->id}' AND published='1' ORDER BY ordering");
                            $forumparents = $kunena_db->loadObjectList();
                            check_dberror("Unable to load categories.");
                            foreach ($forumparents as $childnum => $childforum) {
Exemplo n.º 4
0
                                        ?>
"/>
                    </form>

            <?php 
                                    } else {
                                        if ($do == "domovepost") {
                                            $catid = (int) $catid;
                                            $id = (int) $id;
                                            $bool_leaveGhost = JRequest::getInt('leaveGhost', 0);
                                            //get the some details from the original post for later
                                            $kunena_db->setQuery("SELECT id, subject, catid, time AS timestamp FROM #__fb_messages WHERE id='{$id}'");
                                            $oldRecord = $kunena_db->loadObjectList();
                                            check_dberror("Unable to load messages.");
                                            $newCatObj = new jbCategory($kunena_db, $oldRecord[0]->catid);
                                            if (!fb_has_moderator_permission($kunena_db, $newCatObj, $kunena_my->id, $is_admin)) {
                                                $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR);
                                            }
                                            $newSubject = _MOVED_TOPIC . " " . $oldRecord[0]->subject;
                                            $kunena_db->setQuery("SELECT MAX(time) AS timestamp FROM #__fb_messages WHERE thread='{$id}'");
                                            $lastTimestamp = $kunena_db->loadResult();
                                            check_dberror("Unable to load last timestamp.");
                                            if ($lastTimestamp == "") {
                                                $lastTimestamp = $oldRecord[0]->timestamp;
                                            }
                                            //perform the actual move
                                            //Move topic post first
                                            $kunena_db->setQuery("UPDATE #__fb_messages SET `catid`='{$catid}' WHERE `id`='{$id}'");
                                            $kunena_db->query() or trigger_dberror('Unable to move thread.');
                                            $kunena_db->setQuery("UPDATE #__fb_messages set `catid`='{$catid}' WHERE `thread`='{$id}'");
                                            $kunena_db->query() or trigger_dberror('Unable to move thread.');
Exemplo n.º 5
0
}
$obj_KUNENA_tmpl = new patTemplate();
$obj_KUNENA_tmpl->setBasedir(KUNENA_ABSTMPLTPATH);
// Permissions: Check for administrators and moderators
if ($my->id != 0) {
    $aro_group = $acl->getAroGroup($my->id);
    if ($aro_group and CKunenaTools::isJoomla15()) {
        $aro_group->group_id = $aro_group->id;
    }
    // changed fieldname in Joomla 1.5: "group_id" -> "id"
    $is_admin = strtolower($aro_group->name) == 'super administrator' || strtolower($aro_group->name) == 'administrator';
} else {
    $aro_group = 0;
    $is_admin = 0;
}
$is_Moderator = fb_has_moderator_permission($database, $thisCat, $my->id, $is_admin);
//intercept the RSS request; we should stop afterwards
if ($func == 'fb_rss') {
    include KUNENA_ABSSOURCESPATH . 'kunena.rss.php';
    die;
}
if ($func == 'fb_pdf') {
    include KUNENA_ABSSOURCESPATH . 'kunena.pdf.php';
    die;
}
if ($func == '') {
    switch ($fbConfig->fbdefaultpage) {
        case 'recent':
            $func = 'latest';
            break;
        case 'my':