当前位置: 首页>>代码示例>>PHP>>正文


PHP CKunenaTools::modifyCategoryStats方法代码示例

本文整理汇总了PHP中CKunenaTools::modifyCategoryStats方法的典型用法代码示例。如果您正苦于以下问题:PHP CKunenaTools::modifyCategoryStats方法的具体用法?PHP CKunenaTools::modifyCategoryStats怎么用?PHP CKunenaTools::modifyCategoryStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKunenaTools的用法示例。


在下文中一共展示了CKunenaTools::modifyCategoryStats方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUserLink

 /**
  * adds the link for the connect param
  * @since 1.7.3
  * @param  $user pass-by-reference
  * @return void
  */
 private function getUserLink(&$user)
 {
     $username = KunenaFactory::getUser($user['userid'])->getName();
     if ($user['leapcorrection'] == $this->timeo->format('z', true) + 1) {
         $subject = getSubject($username);
         $db = JFactory::getDBO();
         $query = "SELECT id,catid,subject,time as year FROM #__kunena_messages WHERE subject='{$subject}'";
         $db->setQuery($query, 0, 1);
         $post = $db->loadAssoc();
         if ($db->getErrorMsg()) {
             KunenaError::checkDatabaseError();
         }
         $catid = $this->params->get('bcatid');
         $postyear = new JDate($post['year'], $this->soffset);
         if (empty($post) && !empty($catid) || !empty($post) && !empty($catid) && $postyear->format('Y', true) < $this->timeo->format('Y', true)) {
             $botname = $this->params->get('swkbbotname', JText::_('SW_KBIRTHDAY_FORUMPOST_BOTNAME_DEF'));
             $botid = $this->params->get('swkbotid');
             $time = CKunenaTimeformat::internalTime();
             //Insert the birthday thread into DB
             $query = "INSERT INTO #__kunena_messages (catid,name,userid,email,subject,time, ip)\n\t\t    \t\tVALUES({$catid},'{$botname}',{$botid}, '','{$subject}', {$time}, '')";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             //What ID get our thread?
             $messid = (int) $db->insertID();
             //Insert the thread message into DB
             $message = getMessage($username);
             $query = "INSERT INTO #__kunena_messages_text (mesid,message)\n                    VALUES({$messid},'{$message}')";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             //We know the thread ID so we can update the parent thread id with it's own ID because we know it's
             //the first post
             $query = "UPDATE #__kunena_messages SET thread={$messid} WHERE id={$messid}";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             // now increase the #s in categories
             CKunenaTools::modifyCategoryStats($messid, 0, $time, $catid);
             $user['link'] = CKunenaLink::GetViewLink('view', $messid, $catid, '', $username);
             $uri = JFactory::getURI();
             if ($uri->getVar('option') == 'com_kunena') {
                 $app =& JFactory::getApplication();
                 $app->redirect($uri->toString());
             }
         } elseif (!empty($post)) {
             $user['link'] = CKunenaLink::GetViewLink('view', $post['id'], $post['catid'], '', $username);
         }
     } else {
         $user['link'] = CKunenaLink::GetProfileLink($user['userid']);
     }
 }
开发者ID:rich20,项目名称:mod_sw_kbirthday_J16,代码行数:64,代码来源:forum.php

示例2: ApproveMessage

 public function ApproveMessage()
 {
     if ($this->_checkToken()) {
         return false;
     }
     $array = JRequest::getVar('cb', array(0), 'post', 'array');
     $backUrl = JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server');
     $success = 0;
     require_once KUNENA_PATH_LIB . '/kunena.posting.class.php';
     foreach ($array as $id => $value) {
         if (!$value) {
             continue;
         }
         $message = new CKunenaPosting();
         $message->action($id);
         if (!$message->canApprove()) {
             $errors = $message->getErrors();
             foreach ($errors as $field => $error) {
                 $this->_app->enqueueMessage($field . ': ' . $error, 'error');
             }
             continue;
         }
         $this->_db->setQuery("UPDATE `#__kunena_messages` SET hold='0' WHERE id={$this->_db->Quote($id)}");
         $this->_db->query();
         if (KunenaError::checkDatabaseError()) {
             return;
         }
         CKunenaTools::modifyCategoryStats($message->get('id'), $message->get('parent'), $message->get('time'), $message->get('catid'));
         $message->emailToSubscribers(null, $this->config->allowsubscriptions, false, false);
         $success++;
     }
     //end foreach
     if ($success) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_APPROVE_SUCCESS'), 'notice');
     }
     while (@ob_end_clean()) {
     }
     $this->app->redirect($backUrl);
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:39,代码来源:kunena.review.php

示例3: unset

 $duplicatetimewindow = $posttime - $fbConfig->fbsessiontimeout;
 unset($existingPost);
 $kunena_db->setQuery("SELECT m.id FROM #__fb_messages AS m JOIN #__fb_messages_text AS t ON m.id=t.mesid WHERE m.userid='{$kunena_my->id}' AND m.name='{$fb_authorname}' AND m.email='{$email}' AND m.subject='{$subject}' AND m.ip='{$ip}' AND t.message='{$message}' AND m.time>='{$duplicatetimewindow}'");
 $kunena_db->query() or trigger_dberror('Unable to load post.');
 $existingPost = $kunena_db->loadObject();
 unset($pid);
 if ($existingPost !== null) {
     $pid = $existingPost->id;
 }
 if (!isset($pid)) {
     $kunena_db->setQuery("INSERT INTO #__fb_messages\r\n                                    \t\t\t\t\t\t(parent,thread,catid,name,userid,email,subject,time,ip,topic_emoticon,hold)\r\n                                    \t\t\t\t\t\tVALUES('{$parent}','{$thread}','{$catid}'," . $kunena_db->quote($fb_authorname) . ",'{$kunena_my->id}'," . $kunena_db->quote($email) . "," . $kunena_db->quote($subject) . ",'{$posttime}','{$ip}','{$topic_emoticon}','{$holdPost}')");
     if ($kunena_db->query()) {
         $pid = $kunena_db->insertId();
         // now increase the #s in categories only case approved
         if ($holdPost == 0) {
             CKunenaTools::modifyCategoryStats($pid, $parent, $posttime, $catid);
         }
         $kunena_db->setQuery("INSERT INTO #__fb_messages_text (mesid,message) VALUES('{$pid}'," . $kunena_db->quote($message) . ")");
         $kunena_db->query();
         if ($thread == 0) {
             //if thread was zero, we now know to which id it belongs, so we can determine the thread and update it
             $kunena_db->setQuery("UPDATE #__fb_messages SET thread='{$pid}' WHERE id='{$pid}'");
             $kunena_db->query();
         }
         //update the user posts count
         if ($kunena_my->id) {
             $kunena_db->setQuery("UPDATE #__fb_users SET posts=posts+1 WHERE userid={$kunena_my->id}");
             $kunena_db->query();
         }
         //Update the attachments table if an image has been attached
         if (!empty($imageLocation) && file_exists($imageLocation)) {
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:31,代码来源:post.php

示例4: savePost


//.........这里部分代码省略.........
     $dberror = $this->checkDatabaseError();
     if ($dberror) {
         // Delete partial message on error
         $query = "DELETE FROM #__kunena_messages WHERE mesid={$this->_db->quote($id)}";
         $this->_db->setQuery($query);
         $this->_db->query();
         return $this->setError('-post-', JText::_('COM_KUNENA_POST_ERROR_SAVE'));
     }
     $this->set('id', $id);
     if ($this->parent->thread == 0) {
         // For new thread, we now know to where the message belongs
         $this->set('thread', $id);
         $query = "UPDATE #__kunena_messages SET thread={$this->_db->quote($id)} WHERE id={$this->_db->quote($id)}";
         $this->_db->setQuery($query);
         $this->_db->query();
         $dberror = $this->checkDatabaseError();
         if ($dberror) {
             return $this->setError('-post-', JText::_('COM_KUNENA_POST_ERROR_SAVE'));
         }
     }
     //update the user posts count
     $userid = (int) $this->get('userid');
     if ($userid) {
         $userprofile = KunenaFactory::getUser($userid);
         if (!$userprofile->exists()) {
             $userprofile->save();
         }
         $query = "UPDATE #__kunena_users SET posts=posts+1 WHERE userid={$this->_db->quote($userid)}";
         $this->_db->setQuery($query);
         $this->_db->query();
     }
     // now increase the #s in categories only case approved
     if (!$this->get('hold')) {
         CKunenaTools::modifyCategoryStats($id, $this->get('parent'), $this->get('time'), $this->get('catid'));
     }
     // Add attachments if there are any
     // TODO: find better way
     if ($this->getOption('attachments')) {
         require_once KUNENA_PATH_LIB . '/kunena.attachments.class.php';
         $attachments = CKunenaAttachments::getInstance();
         $message = $this->get('message');
         $fileinfos = $attachments->multiupload($id, $message);
         foreach ($fileinfos as $fileinfo) {
             if (!$fileinfo['status']) {
                 $this->_app->enqueueMessage(JText::sprintf('COM_KUNENA_UPLOAD_FAILED', $fileinfo['name']) . ': ' . $fileinfo['error'], 'error');
             }
         }
         $this->_db->setQuery("UPDATE #__kunena_messages_text SET message={$this->_db->quote($message)} WHERE mesid={$this->_db->Quote($id)}");
         $this->_db->query();
     }
     // Mark topic read for me
     CKunenaTools::markTopicRead($this->get('thread'), $this->_my->id);
     // Mark topic unread for others
     // First take care of old sessions to make our job easier and faster
     $lasttime = $this->get('time') - max(intval(JFactory::getConfig()->getValue('config.lifetime')) * 60, intval(KunenaFactory::getConfig()->fbsessiontimeout)) - 60;
     $query = "UPDATE #__kunena_sessions SET readtopics='0' WHERE currvisit<{$this->_db->quote($lasttime)}";
     $this->_db->setQuery($query);
     $this->_db->query();
     $dberror = $this->checkDatabaseError();
     if ($dberror) {
         return $this->setError('-post-', JText::_('COM_KUNENA_POST_ERROR_SESSIONS'));
     }
     // Then look at users who have read the thread
     $thread = $this->get('thread');
     $query = "SELECT userid, readtopics FROM #__kunena_sessions WHERE readtopics LIKE '%{$thread}%' AND userid!={$this->_db->quote($userid)}";
     $this->_db->setQuery($query);
开发者ID:redigy,项目名称:Kunena-1.6,代码行数:67,代码来源:kunena.posting.class.php

示例5: approve

 protected function approve()
 {
     if ($this->tokenProtection('get')) {
         return false;
     }
     if (!$this->load()) {
         return false;
     }
     if ($this->moderatorProtection()) {
         return false;
     }
     if ($this->isUserBanned()) {
         return false;
     }
     if ($this->isIPBanned()) {
         return false;
     }
     require_once KUNENA_PATH_LIB . '/kunena.posting.class.php';
     $message = new CKunenaPosting();
     $message->action($this->id);
     if ($message->canApprove()) {
         $success_msg = JText::_('COM_KUNENA_MODERATE_1APPROVE_FAIL');
         $this->_db->setQuery("UPDATE #__kunena_messages SET hold=0 WHERE id={$this->_db->Quote($this->id)}");
         if ($this->id && $this->_db->query() && $this->_db->getAffectedRows() == 1) {
             $success_msg = JText::_('COM_KUNENA_MODERATE_APPROVE_SUCCESS');
             $this->_db->setQuery("SELECT COUNT(*) AS totalmessages FROM #__kunena_messages WHERE thread={$this->_db->Quote($this->msg_cat->thread)}");
             $result = $this->_db->loadObject();
             KunenaError::checkDatabaseError();
             $threadPages = ceil($result->totalmessages / $this->config->messages_per_page);
             //construct a useable URL (for plaintext - so no &amp; encoding!)
             jimport('joomla.environment.uri');
             $uri =& JURI::getInstance(JURI::base());
             $LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . str_replace('&amp;', '&', CKunenaLink::GetThreadPageURL('view', $this->catid, $this->msg_cat->thread, $threadPages, $this->config->messages_per_page, $this->id));
             $message->emailToSubscribers($LastPostUrl, $this->config->allowsubscriptions, $this->config->mailmod, $this->config->mailadmin);
             CKunenaTools::modifyCategoryStats($this->id, $this->msg_cat->parent, $this->msg_cat->time, $this->msg_cat->catid);
         }
     }
     while (@ob_end_clean()) {
     }
     $this->_app->redirect(CKunenaLink::GetMessageURL($this->id, $this->catid, 0, false), $success_msg);
 }
开发者ID:redigy,项目名称:Kunena-1.6,代码行数:41,代码来源:post.php

示例6: jbApprovePosts

/**
 * approve selected messages
 * @param object database
 * @param array cid post ids
 */
function jbApprovePosts($kunena_db, $cid)
{
    if (count($cid) == 0) {
        return 0;
    }
    $ret = 1;
    reset($cid);
    foreach ($cid as $id) {
        $id = (int) $id;
        $newQuery = "SELECT * FROM #__fb_messages WHERE id='{$id}'";
        $kunena_db->setQuery($newQuery, 0, 1);
        $msg = null;
        $msg = $kunena_db->loadObject();
        if (!$msg) {
            continue;
        }
        // continue stats
        $kunena_db->setQuery("UPDATE `#__fb_messages` SET hold='0' WHERE id='{$id}'");
        if (!$kunena_db->query()) {
            $ret = 0;
            // mark error
        }
        CKunenaTools::modifyCategoryStats($id, $msg->parent, $msg->time, $msg->catid);
    }
    return $ret;
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:31,代码来源:moderate_messages.php


注:本文中的CKunenaTools::modifyCategoryStats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。