/**
  * getClientList
  *
  * @param mixed[]   &$list
  *  string  $list[]['dirname']
  *  string  $list[]['dataname']
  *  string  $list[]['access_controller']
  *
  * @return  void
  */
 public static function getClientList(&$list)
 {
     //don't call this method multiple times when site owner duplicate.
     static $isCalled = false;
     if ($isCalled === true) {
         return;
     }
     //get dirname list of this module
     $dirnames = Legacy_Utils::getDirnameListByTrustDirname(basename(dirname(dirname(dirname(__FILE__)))));
     foreach ($dirnames as $dir) {
         //setup client module info
         $list[] = array('dirname' => $dir, 'dataname' => 'forums', 'access_controller' => Xcforum_Utils::getModuleConfig($dir, 'access_controller'));
         $list[] = array('dirname' => $dir, 'dataname' => 'topics', 'access_controller' => Xcforum_Utils::getModuleConfig($dir, 'access_controller'));
         $list[] = array('dirname' => $dir, 'dataname' => 'posts', 'access_controller' => Xcforum_Utils::getModuleConfig($dir, 'access_controller'));
         $list[] = array('dirname' => $dir, 'dataname' => 'users2topics', 'access_controller' => Xcforum_Utils::getModuleConfig($dir, 'access_controller'));
     }
     $isCalled = true;
 }
示例#2
0
 /**
  * getClientData
  *
  * @param mixed     &$list
  * @param string    $dirname
  * @param string    $dataname
  * @param int[]     $idList
  *
  * @return  void
  */
 public static function getClientData(&$list, $dirname, $dataname, $idList)
 {
     //default
     $limit = 5;
     $start = 0;
     $handler = Legacy_Utils::getModuleHandler($dataname, $dirname);
     if (!$handler) {
         return;
     }
     //setup client module info
     $cri = Xcforum_Utils::getListCriteria($dirname);
     $cri->add(new Criteria($handler->mPrimary, $idList, 'IN'));
     $objs = $handler->getObjects($cri, $limit, $start);
     if (count($objs) > 0) {
         $list['dirname'][] = $dirname;
         $list['dataname'][] = $dataname;
         $list['data'][] = $objs;
         $handler = xoops_gethandler('module');
         $module = $handler->getByDirname($dirname);
         $list['title'][] = $module->name();
         $list['template_name'][] = 'db:' . $dirname . '_' . $dataname . '_inc_view.html';
     }
 }
 /**
  * &_createPermission
  * 
  * @param   int  $group
  * 
  * @return  XoopsGroupPerm
  **/
 private function &_createPermission($group)
 {
     $gpermHandler =& Xcforum_Utils::getXoopsHandler('groupperm');
     $perm =& $gpermHandler->create();
     $perm->setVar('gperm_groupid', $group);
     $perm->setVar('gperm_itemid', $this->_mXoopsModule->getVar('mid'));
     $perm->setVar('gperm_modid', 1);
     return $perm;
 }
 /**
  * executeViewSuccess
  *
  * @param	XCube_RenderTarget	&$render
  *
  * @return	void
  **/
 public function executeViewSuccess(&$render)
 {
     // set each permission flags and usr's info
     if (is_object($this->mObject)) {
         if (isset($this->forum_id) && $this->forum_id > 0) {
             if (isset($this->mForumAcc) && count($this->mForumAcc) > 0) {
                 if ($this->can_read === true) {
                     // permissions
                     $params = array();
                     $params['uid'] = $this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser') ? $this->mRoot->mContext->mXoopsUser->get('uid') : 0;
                     $params['can_read'] = true;
                     $params['can_post'] = in_array($this->forum_id, $this->mForumAcc['post']);
                     $params['can_edit'] = in_array($this->forum_id, $this->mForumAcc['edit']);
                     $params['can_delete'] = in_array($this->forum_id, $this->mForumAcc['delete']);
                     $params['can_reply'] = in_array($this->forum_id, $this->mForumAcc['post']);
                     $params['isadminormod'] = $this->mod_isadmin ? true : in_array($this->forum_id, $this->mForumAcc['moderate']);
                     $params['mod_config'] =& $this->mod_config;
                     foreach ($this->mPostsObj as &$obj) {
                         /*
                          * 		// permissions
                          */
                         $rtn = Xcforum_Utils::processThispost($obj, $this->mObject, $params);
                         $obj->initVar('poster_dispname', XOBJ_DTYPE_STRING, $rtn['poster_dispname'], false);
                         $obj->initVar('poster_uname', XOBJ_DTYPE_STRING, $rtn['poster_uname'], false);
                         $obj->initVar('poster_name', XOBJ_DTYPE_STRING, $rtn['poster_name'], false);
                         $obj->initVar('poster_gname', XOBJ_DTYPE_STRING, $rtn['poster_gname'], false);
                         $obj->initVar('poster_avatar', XOBJ_DTYPE_STRING, $rtn['poster_avatar'], false);
                         $obj->initVar('poster_from4disp', XOBJ_DTYPE_STRING, $rtn['poster_from4disp'], false);
                         $obj->initVar('signature', XOBJ_DTYPE_STRING, $rtn['poster_signature'], false);
                         $obj->initVar('poster_uid', XOBJ_DTYPE_INT, $rtn['poster_uid'], false);
                         $obj->initVar('poster_regdate', XOBJ_DTYPE_INT, $rtn['poster_regdate'], false);
                         $obj->initVar('poster_rank', XOBJ_DTYPE_INT, $rtn['poster_rank'], false);
                         $obj->initVar('poster_is_online', XOBJ_DTYPE_INT, $rtn['poster_is_online'], false);
                         $obj->initVar('poster_posts_count', XOBJ_DTYPE_INT, $rtn['poster_posts_count'], false);
                         $obj->initVar('can_read', XOBJ_DTYPE_INT, true, false);
                         $obj->initVar('can_post', XOBJ_DTYPE_INT, $rtn['can_post'], false);
                         $obj->initVar('can_edit', XOBJ_DTYPE_INT, $rtn['can_edit'], false);
                         $obj->initVar('can_delete', XOBJ_DTYPE_INT, $rtn['can_delete'], false);
                         $obj->initVar('can_reply', XOBJ_DTYPE_INT, $rtn['can_reply'], false);
                     }
                     $this->mForumObj->initVar('isadminormod', XOBJ_DTYPE_INT, $params['isadminormod'], false);
                     unset($params);
                 }
             }
         }
     }
     //$memberHandler =& Xcforum_Utils::getXoopsHandler('member');
     //$cri = new criteriacompo();
     //$cri->add( new criteria('uid', $uids, 'IN'));
     //$mUsers = $memberHandler->getUsers();
     //adump($mUsers);
     //adump($users);
     /*
     $uses[$uid] = array(
     	'uid' => $uid,
     	'uname' => $obj->get('uname'),
     	'name' => $obj->get('name'),
     );
     */
     $render->setTemplateName($this->mAsset->mDirname . '_topic_view.html');
     $render->setAttribute('forumObj', $this->mForumObj);
     $render->setAttribute('topicObj', $this->mObject);
     $render->setAttribute('postObj', $this->mPostsObj);
     $render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     $render->setAttribute('pageNavi', $this->mFilter->mNavi);
     $render->setAttribute('topics', $this->mTopics_ExtObj);
     $render->setAttribute('external_link_id', $this->ext_link_id);
     $render->setAttribute('tree_tp_count', @count($this->mTopics_ExtObj));
     parent::executeViewSuccess($render);
 }
示例#5
0
 /**
  * _setupAccessController
  *
  * @param	string	$dataname
  *
  * @return	void
  **/
 protected function _setupAccessController($dataname)
 {
     //adump('AccessController Start');
     $this->mAccessController['main'] = Xcforum_Utils::getAccessControllerObject($this->mDirname, $dataname);
     $idList['view'] = $this->mAccessController['main']->getPermittedIdList(Xcforum_AbstractAccessController::VIEW, 0);
     //adump('AccessController End');
     $idList['post'] = $this->mAccessController['main']->getPermittedIdList(Xcforum_AbstractAccessController::POST, 0);
     $idList['manage'] = $this->mAccessController['main']->getPermittedIdList(Xcforum_AbstractAccessController::MANAGE, 0);
     $this->fIdList4Cat['view'] = $this->_getForumid4Cats($idList['view']);
     $this->fIdList4Cat['post'] = $this->_getForumid4Cats($idList['post']);
     $this->fIdList4Cat['manage'] = $this->_getForumid4Cats($idList['manage']);
 }
 /**
  * _uninstallBlocks
  * 
  * @param   void
  * 
  * @return  void
  **/
 private function _uninstallBlocks()
 {
     Xcforum_InstallUtils::uninstallAllOfBlocks($this->_mXoopsModule, $this->mLog);
     $tplHandler =& Xcforum_Utils::getXoopsHandler('tplfile');
     $cri = new Criteria('tpl_module', $this->_mXoopsModule->get('dirname'));
     if (!$tplHandler->deleteAll($cri)) {
         $this->mLog->addError(XCube_Utils::formatString(_MI_XCFORUM_INSTALL_ERROR_BLOCK_TPL_DELETED, $tplHandler->db->error()));
     }
 }
 /**
  * executeViewInput
  * 
  * @param   XCube_RenderTarget  &$render
  * 
  * @return  void
  **/
 public function executeViewInput(&$render)
 {
     include XCFORUM_TRUST_PATH . '/include/constant_can_override.inc.php';
     $options4html = "";
     $forum_configs = @unserialize($this->mObject->get('forum_options'));
     if (is_array($forum_configs)) {
         foreach ($forum_configs as $key => $val) {
             if (isset($xcforum_configs_can_be_override[$key])) {
                 $options4html .= htmlspecialchars($key, ENT_QUOTES, _CHARSET) . ':' . htmlspecialchars($val, ENT_QUOTES, _CHARSET) . "\n";
             }
         }
     }
     $render->setAttribute('forum_options', $options4html);
     $render->setAttribute('forum_options_desc', Xcforum_Utils::main_get_categoryoptions4edit($xcforum_configs_can_be_override));
     //$render->setTemplateName($this->mAsset->mDirname . '_forums_edit.html');
     $render->setTemplateName($this->mAsset->mDirname . '_forum_form.html');
     //$render->setAttribute('actionForm', $this->mActionForm);
     //$render->setAttribute('object', $this->mObject);
     //$render->setAttribute('dirname', $this->mAsset->mDirname);
     //$render->setAttribute('mod_url', XOOPS_MODULE_URL . '/'. $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     //$render->setAttribute('mod_isadmin', $this->mod_isadmin);
     //set tag usage
     //$render->setAttribute('tag_dirname', $this->mRoot->mContext->mModuleConfig['tag_dirname']);
     $render->setAttribute('accessController', $this->mAccessController['main']);
     parent::executeViewInput($render);
 }
 /**
  * getOverrideFileInfo
  * 
  * @param   string  $file
  * @param   string  $prefix
  * @param   bool  $isSpDirName
  * 
  * @return  {string 'theme',string 'file',string 'dirname'}
  **/
 public static function getOverrideFileInfo($file, $prefix = null, $isSpDirName = false)
 {
     $ret = array('url' => null, 'path' => null, 'theme' => null, 'dirname' => null, 'file' => null);
     if (strpos($file, '..') !== false || strpos($prefix, '..' !== false)) {
         return $ret;
     }
     $root =& XCube_Root::getSingleton();
     $module =& $root->mContext->mXoopsModule;
     $dirName = $root->mContext->mRequest->getRequest('dirname');
     if ($isSpDirName && preg_match('/^\\w+$/', $dirName)) {
         $handler =& Xcforum_Utils::getXoopsHandler('module');
         $module =& $handler->getByDirname($dirName);
     }
     $isModule = is_object($module);
     $theme = $root->mSiteConfig['Legacy']['Theme'];
     $ret['theme'] = $theme;
     $dirName = $isModule ? $module->get('dirname') : null;
     $trustDirName = $isModule ? $module->getInfo('trust_dirname') : null;
     $ret['file'] = $file;
     $file = $prefix . $file;
     switch (true) {
         case $isModule && file_exists($path = sprintf('%s/modules/%s/%s', XOOPS_THEME_PATH, $theme, $dirName, $file)):
             $ret['url'] = sprintf('%s/%s/modules/%s/%s', XOOPS_THEME_URL, $theme, $dirName, $file);
             $ret['path'] = $path;
             return $ret;
         case $isModule && file_exists($path = sprintf('%s/themes/%s/modules/%s/%s', XOOPS_TRUST_PATH, $theme, $trustDirName, $file)):
             $ret['path'] = $path;
             $ret['dirname'] = $trustDirName;
             return $ret;
         case file_exists($path = sprintf('%s/%s/%s', XOOPS_THEME_PATH, $theme, $file)):
             $ret['url'] = sprintf('%s/%s/%s', XOOPS_THEME_URL, $theme, $file);
             $ret['path'] = $path;
             $ret['dirname'] = null;
             return $ret;
         case file_exists($path = sprintf('%s/themes/%s/%s', XOOPS_TRUST_PATH, $theme, $file)):
             $ret['path'] = $path;
             $ret['dirname'] = null;
             return $ret;
         case $isModule && file_exists($path = sprintf('%s/%s/admin/templates/%s', XOOPS_MODULE_PATH, $dirName, $file)):
             $ret['url'] = sprintf('%s/%s/admin/templates/%s', XOOPS_MODULE_URL, $dirName, $file);
             $ret['path'] = $path;
             $ret['theme'] = null;
             return $ret;
         case $isModule && file_exists($path = sprintf('%s/modules/%s/admin/templates/%s', XOOPS_TRUST_PATH, $trustDirName, $file)):
             $ret['path'] = $path;
             $ret['theme'] = null;
             $ret['dirname'] = $trustDirName;
             return $ret;
         case file_exists($path = XCFORUM_ADMIN_RENDER_FALLBACK_PATH . '/' . $file):
             $ret['url'] = XCFORUM_ADMIN_RENDER_FALLBACK_URL . '/' . $file;
             $ret['path'] = $path;
             $ret['theme'] = null;
             $ret['dirname'] = null;
             return $ret;
         default:
             $ret['theme'] = null;
             $ret['dirname'] = null;
             $ret['file'] = null;
             return $ret;
     }
 }
 /**
  * executeViewSuccess
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewSuccess(&$render)
 {
     if (isset($this->forum_id) && $this->forum_id > 0) {
         if (isset($this->mForumAcc) && count($this->mForumAcc) > 0) {
             if ($this->can_read === true) {
                 // permissions
                 $params = array();
                 $params['uid'] = $this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser') ? $this->mRoot->mContext->mXoopsUser->get('uid') : 0;
                 $params['can_read'] = true;
                 $params['can_post'] = in_array($this->forum_id, $this->mForumAcc['post']);
                 $params['can_edit'] = in_array($this->forum_id, $this->mForumAcc['edit']);
                 $params['can_delete'] = in_array($this->forum_id, $this->mForumAcc['delete']);
                 $params['can_reply'] = in_array($this->forum_id, $this->mForumAcc['post']);
                 $params['isadminormod'] = $this->mod_isadmin ? true : in_array($this->forum_id, $this->mForumAcc['moderate']);
                 $params['mod_config'] =& $this->mod_config;
                 $rtn = Xcforum_Utils::processThispost($this->mObject, $this->mTopicObj, $params);
                 //adump($rtn);
                 $this->mObject->initVar('poster_dispname', XOBJ_DTYPE_STRING, $rtn['poster_dispname'], false);
                 $this->mObject->initVar('poster_uname', XOBJ_DTYPE_STRING, $rtn['poster_uname'], false);
                 $this->mObject->initVar('poster_name', XOBJ_DTYPE_STRING, $rtn['poster_name'], false);
                 $this->mObject->initVar('poster_gname', XOBJ_DTYPE_STRING, $rtn['poster_gname'], false);
                 $this->mObject->initVar('can_read', XOBJ_DTYPE_INT, true, false);
                 $this->mObject->initVar('can_post', XOBJ_DTYPE_INT, $rtn['can_post'], false);
                 $this->mObject->initVar('can_edit', XOBJ_DTYPE_INT, $rtn['can_edit'], false);
                 $this->mObject->initVar('can_delete', XOBJ_DTYPE_INT, $rtn['can_delete'], false);
                 $this->mObject->initVar('can_reply', XOBJ_DTYPE_INT, $rtn['can_reply'], false);
                 $this->mForumObj->initVar('isadminormod', XOBJ_DTYPE_INT, $rtn['isadminormod'], false);
                 // for posts tree
                 foreach ($this->mPostsObj as &$obj) {
                     $rtn = Xcforum_Utils::processThispost($obj, $this->mTopicObj, $params);
                     $obj->initVar('poster_dispname', XOBJ_DTYPE_STRING, $rtn['poster_dispname'], false);
                     $obj->initVar('poster_uname', XOBJ_DTYPE_STRING, $rtn['poster_uname'], false);
                     $obj->initVar('poster_name', XOBJ_DTYPE_STRING, $rtn['poster_name'], false);
                     $obj->initVar('poster_gname', XOBJ_DTYPE_STRING, $rtn['poster_gname'], false);
                 }
             }
         }
     }
     $render->setTemplateName($this->mAsset->mDirname . '_post_view.html');
     $render->setAttribute('forumObj', $this->mForumObj);
     $render->setAttribute('topicObj', $this->mTopicObj);
     $render->setAttribute('postObj', $this->mObject);
     $render->setAttribute('postsObj', $this->mPostsObj);
     $render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     $render->setAttribute('topics', $this->mTopics_ExtObj);
     $render->setAttribute('external_link_id', $this->ext_link_id);
     $render->setAttribute('tree_tp_count', @count($this->mTopics_ExtObj));
     $render->setAttribute('can_edit', $this->can_edit);
     $render->setAttribute('can_delete', $this->can_delete);
     $render->setAttribute('can_reply', $this->can_reply);
     parent::executeViewSuccess($render);
 }
示例#10
0
 /**
  * _setupAccessController
  * 
  * @param	string	$dataname
  * 
  * @return	void
  **/
 protected function _setupAccessController($dataname)
 {
     $this->mAccessController['main'] = Xcforum_Utils::getAccessControllerObject($this->mAsset->mDirname, $dataname);
 }
示例#11
0
 /**
  * saveXoopsModule
  * 
  * @param   XoopsModule  &$module
  * 
  * @return  void
  **/
 public function saveXoopsModule(&$module)
 {
     $moduleHandler =& Xcforum_Utils::getXoopsHandler('module');
     if ($moduleHandler->insert($module)) {
         $this->mLog->addReport(_MI_XCFORUM_INSTALL_MSG_UPDATE_FINISHED);
     } else {
         $this->mLog->addError(_MI_XCFORUM_INSTALL_ERROR_UPDATE_FINISHED);
     }
 }
 /**
  * executeViewIndex
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewIndex(&$render)
 {
     // permissions
     $params = array();
     $params['uid'] = $this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser') ? $this->mRoot->mContext->mXoopsUser->get('uid') : 0;
     $params['can_read'] = true;
     $params['can_post'] = in_array($this->forum_id, $this->mForumAcc['post']);
     $params['can_edit'] = in_array($this->forum_id, $this->mForumAcc['edit']);
     $params['can_delete'] = in_array($this->forum_id, $this->mForumAcc['delete']);
     $params['can_reply'] = in_array($this->forum_id, $this->mForumAcc['post']);
     $params['isadminormod'] = $this->mod_isadmin ? true : in_array($this->forum_id, $this->mForumAcc['moderate']);
     $params['mod_config'] =& $this->mod_config;
     //adump($mObj);
     if (isset($this->forum_id) && $this->forum_id > 0) {
         if (isset($this->mForumAcc) && count($this->mForumAcc) > 0) {
             if (in_array($this->forum_id, $this->mForumAcc['can_read'])) {
                 $this->mForumObj->initVar('can_post', XOBJ_DTYPE_INT, $params['can_post'], false);
                 $isadminormod = $this->mod_isadmin || $params['isadminormod'];
                 $this->mForumObj->initVar('isadminormod', XOBJ_DTYPE_INT, $isadminormod, false);
             }
         }
     }
     foreach ($this->mObjects as &$mObj) {
         $mObj->initVar('topic_votes_avg', XOBJ_DTYPE_INT, (int) $mObj->get('topic_votes_sum') / ((int) $mObj->get('topic_votes_count') - 0.01), false);
         $bit_new = (int) $mObj->get('topic_last_post_time') > @$mObj->get('u2t_time') ? 1 : 0;
         $bit_hot = (int) $mObj->get('topic_votes_count') > $this->mod_config['hot_threshold'] ? 1 : 0;
         $mObj->initVar('bit_new', XOBJ_DTYPE_INT, $bit_new, false);
         $mObj->initVar('bit_hot', XOBJ_DTYPE_INT, $bit_hot, false);
         $mObj->initVar('topic_votes_src', XOBJ_DTYPE_STRING, "", false);
         $mObj->initVar('topic_page_jump', XOBJ_DTYPE_STRING, "", false);
         $params['guest_name'] = $mObj->get('fp_guest_name');
         $rtn = Xcforum_Utils::getPosterData($mObj->get('topic_first_uid'), $params);
         $poster_dispname = isset($rtn['poster_dispname']) ? $rtn['poster_dispname'] : "";
         $poster_uname = isset($rtn['poster_uname']) ? $rtn['poster_uname'] : "";
         $poster_name = isset($rtn['poster_name']) ? $rtn['poster_name'] : "";
         $poster_gname = isset($rtn['poster_gname']) ? $rtn['poster_gname'] : "";
         $mObj->initVar('first_post_dispname', XOBJ_DTYPE_STRING, $poster_dispname, false);
         $mObj->initVar('first_post_uname', XOBJ_DTYPE_STRING, $poster_uname, false);
         $mObj->initVar('first_post_name', XOBJ_DTYPE_STRING, $poster_name, false);
         $mObj->initVar('first_post_gname', XOBJ_DTYPE_STRING, $poster_gname, false);
         $params['guest_name'] = $mObj->get('lp_guest_name');
         $rtn = Xcforum_Utils::getPosterData($mObj->get('topic_last_uid'), $params);
         $poster_dispname = isset($rtn['poster_dispname']) ? $rtn['poster_dispname'] : "";
         $poster_uname = isset($rtn['poster_uname']) ? $rtn['poster_uname'] : "";
         $poster_name = isset($rtn['poster_name']) ? $rtn['poster_name'] : "";
         $poster_gname = isset($rtn['poster_gname']) ? $rtn['poster_gname'] : "";
         $mObj->initVar('last_post_dispname', XOBJ_DTYPE_STRING, $poster_dispname, false);
         $mObj->initVar('last_post_uname', XOBJ_DTYPE_STRING, $poster_uname, false);
         $mObj->initVar('last_post_name', XOBJ_DTYPE_STRING, $poster_name, false);
         $mObj->initVar('last_post_gname', XOBJ_DTYPE_STRING, $poster_gname, false);
     }
     //$render->setTemplateName($this->mAsset->mDirname . '_topics_list.html');
     $render->setTemplateName($this->mAsset->mDirname . '_topic_list.html');
     $render->setAttribute('forumObj', $this->mForumObj);
     //$render->setAttribute('objects', $this->mObjects);
     //$render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('dataname', self::DATANAME);
     $render->setAttribute('pageNavi', $this->mFilter->mNavi);
     //adump($this->mFilter->mNavi);
     $render->setAttribute('solved_options', $this->solved_options);
     $render->setAttribute('query', $this->query4assign);
     $q_solved = (int) $this->mRoot->mContext->mRequest->getRequest('solved');
     if ($q_solved > 0) {
         $qstr_solved = "&solved=" . $q_solved;
     }
     $q_txt = $this->mRoot->mContext->mRequest->getRequest('txt');
     if ($q_txt) {
         $qstr_txt = "&txt=" . htmlspecialchars($q_txt, ENT_QUOTES, _CHARSET);
     }
     $qstr = $qstr_solved || $qstr_txt ? $qstr_solved . $qstr_txt : "";
     $render->setAttribute('qstr', $qstr);
     $render->setAttribute('topic_hits', $this->topic_hits);
     // pagenav
     $pagenav = '';
     //$query4nav = 'topic_id=' . $topic_id ;
     $query4nav = 'action=TopicsList';
     $query4nav .= $this->forum_id > 0 ? '&forum_id=' . $this->forum_id : '';
     // LIMIT
     $num = $this->mod_config['topics_per_page'] < 5 ? 5 : (int) $this->mod_config['topics_per_page'];
     $pos = 0;
     if ($this->topic_hits > $num) {
         // POS
         $pos = $this->mRoot->mContext->mRequest->getRequest('start');
         //$pos = isset( $pos ) ? (int)$pos : (($postorder == 0) || ($postorder == 2) ? (int)(($this->topic_hits-1) / $num) * $num : 0) ;
         $pos = isset($pos) ? (int) $pos : 0;
         require_once XCFORUM_TRUST_PATH . '/class/Pagenav.class.php';
         $pagenav_obj = new XcforumPagenav($this->topic_hits, $num, $pos, 'start', $query4nav);
         $pagenav = $pagenav_obj->getNav();
         $render->setAttribute('pagenav', $pagenav);
     }
     parent::executeViewIndex($render);
 }
 /**
  * fetch
  * 
  * @param   void
  * 
  * @return  void
  **/
 public function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('topic_id')) !== null) {
         $this->mNavi->addExtra('topic_id', $value);
         $this->_mCriteria->add(new Criteria('topic_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('forum_id')) !== null) {
         $this->mNavi->addExtra('forum_id', $value);
         $this->_mCriteria->add(new Criteria('forum_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_external_link_id')) !== null) {
         $this->mNavi->addExtra('topic_external_link_id', $value);
         $this->_mCriteria->add(new Criteria('topic_external_link_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_title')) !== null) {
         $this->mNavi->addExtra('topic_title', $value);
         $this->_mCriteria->add(new Criteria('topic_title', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_first_uid')) !== null) {
         $this->mNavi->addExtra('topic_first_uid', $value);
         $this->_mCriteria->add(new Criteria('topic_first_uid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_first_post_id')) !== null) {
         $this->mNavi->addExtra('topic_first_post_id', $value);
         $this->_mCriteria->add(new Criteria('topic_first_post_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_first_post_time')) !== null) {
         $this->mNavi->addExtra('topic_first_post_time', $value);
         $this->_mCriteria->add(new Criteria('topic_first_post_time', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_last_uid')) !== null) {
         $this->mNavi->addExtra('topic_last_uid', $value);
         $this->_mCriteria->add(new Criteria('topic_last_uid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_last_post_id')) !== null) {
         $this->mNavi->addExtra('topic_last_post_id', $value);
         $this->_mCriteria->add(new Criteria('topic_last_post_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_last_post_time')) !== null) {
         $this->mNavi->addExtra('topic_last_post_time', $value);
         $this->_mCriteria->add(new Criteria('topic_last_post_time', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_views')) !== null) {
         $this->mNavi->addExtra('topic_views', $value);
         $this->_mCriteria->add(new Criteria('topic_views', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_posts_count')) !== null) {
         $this->mNavi->addExtra('topic_posts_count', $value);
         $this->_mCriteria->add(new Criteria('topic_posts_count', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_locked')) !== null) {
         $this->mNavi->addExtra('topic_locked', $value);
         $this->_mCriteria->add(new Criteria('topic_locked', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_sticky')) !== null) {
         $this->mNavi->addExtra('topic_sticky', $value);
         $this->_mCriteria->add(new Criteria('topic_sticky', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_solved')) !== null) {
         $this->mNavi->addExtra('topic_solved', $value);
         $this->_mCriteria->add(new Criteria('topic_solved', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_invisible')) !== null) {
         $this->mNavi->addExtra('topic_invisible', $value);
         $this->_mCriteria->add(new Criteria('topic_invisible', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_votes_sum')) !== null) {
         $this->mNavi->addExtra('topic_votes_sum', $value);
         $this->_mCriteria->add(new Criteria('topic_votes_sum', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_votes_count')) !== null) {
         $this->mNavi->addExtra('topic_votes_count', $value);
         $this->_mCriteria->add(new Criteria('topic_votes_count', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('status')) !== null) {
         $this->mNavi->addExtra('status', $value);
         $this->_mCriteria->add(new Criteria('status', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('posttime')) !== null) {
         $this->mNavi->addExtra('posttime', $value);
         $this->_mCriteria->add(new Criteria('posttime', $value));
     }
     // TXT
     $myts =& Xcforum_Utils::getMytextSanitizer();
     $q_txt = $root->mContext->mRequest->getRequest('txt');
     if (!empty($q_txt)) {
         $txt = $myts->stripSlashesGPC($q_txt);
         //$query4assign['txt'] = htmlspecialchars( $txt , ENT_QUOTES , _CHARSET ) ;
         $txt4sql = addslashes($txt);
         //$whr_txt = "fp.subject LIKE '%$txt4sql%' OR fp.post_text LIKE '%$txt4sql%'" ;
         $this->_mCriteria->add(new criteria('topic_title', $txt4sql, 'LIKE'));
     } else {
         //$query4assign['txt'] = '' ;
         //$whr_txt = '1' ;
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
 /**
  * updateConfigOrderByInfo
  *
  * @param   Legacy_PreferenceInformation  &$info
  * @param   XoopsModule  &$module
  * @param   Legacy_ModuleInstallLog  &$log
  *
  * @return  bool
  **/
 public static function updateConfigOrderByInfo(&$info, &$module, &$log)
 {
     $configHandler =& Xcforum_Utils::getXoopsHandler('config');
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('conf_modid', $module->get('mid')));
     $cri->add(new Criteria('conf_catid', 0));
     $cri->add(new Criteria('conf_name', $info->mName));
     $configs =& $configHandler->getConfigs($cri);
     if (!(count($configs) > 0 && is_object($configs[0]))) {
         $log->addError(_MI_XCFORUM_INSTALL_ERROR_CONFIG_NOT_FOUND);
         return false;
     }
     $config =& $configs[0];
     $config->set('conf_order', $info->mOrder);
     if (!$configHandler->insertConfig($config)) {
         $log->addError(XCube_Utils::formatString(_MI_XCFORUM_INSTALL_ERROR_CONFIG_UPDATED, $config->get('conf_name')));
         return false;
     }
     return true;
 }
示例#15
0
 public function updatePostTree()
 {
     // called by PostsEditAction::prepare
     $first_post_id = $this->topic_obj->get('topic_first_post_id');
     $first_post_id = $first_post_id > 0 ? $first_post_id : 0;
     $obj = $this->inserted_obj;
     $unique_path = $obj->get('unique_path');
     $trsFunc =& Xcforum_Utils::getTransactFuncObject();
     $tree_array = $trsFunc->maketree_recursive($first_post_id, 'post_id', array(), 0, empty($unique_path) ? '.1' : $unique_path);
     if (!empty($tree_array)) {
         $mObj = new Xcforum_PostsObject();
         $mHandler = new self($this->mRoot->mController->mDB, $this->mDirname);
         foreach ($tree_array as $key => $val) {
             //$db->queryF( "UPDATE ".$db->prefix($this->mAsset->mDirname."_posts")." SET depth_in_tree=".$val['depth'].", order_in_tree=".($key+1).", unique_path='".addslashes($val['unique_path'])."' WHERE post_id=".$val['post_id'] ) ;
             $mObj = $mHandler->get($val['post_id']);
             if (is_object($mObj)) {
                 $mObj->set('depth_in_tree', $val['depth']);
                 $mObj->set('order_in_tree', $key + 1);
                 $mObj->set('unique_path', addslashes($val['unique_path']));
                 $mHandler->insert($mObj, false);
             }
         }
     }
 }
示例#16
0
 /**
  * getBlock
  * 
  * @param   Legacy_AbstractBlockProcedure  &$obj
  * @param   XoopsBlock  $block
  * 
  * @return  void
  **/
 public static function getBlock(&$obj, $block)
 {
     $moduleHandler =& Xcforum_Utils::getXoopsHandler('module');
     $module =& $moduleHandler->get($block->get('mid'));
     if (is_object($module) && $module->getInfo('trust_dirname') == 'xcforum') {
         require_once XCFORUM_TRUST_PATH . '/blocks/' . $block->get('func_file');
         $className = 'Xcforum_' . substr($block->get('show_func'), 4);
         $obj = new $className($block);
     }
 }
示例#17
0
 /**
  * _setupObject
  * 
  * @param   void
  * 
  * @return  bool
  * 
  * @private
  **/
 protected function _setupObject()
 {
     $categoryIds = null;
     $objects = array();
     $catIdArr = array();
     //get block options
     $limit = $this->getBlockOption('limit');
     //get module asset for handlers
     $asset = null;
     XCube_DelegateUtils::call('Module.xcforum.Global.Event.GetAssetManager', new XCube_Ref($asset), $this->_mBlock->get('dirname'));
     $this->_mHandler =& $asset->getObject('handler', 'topics');
     $categoryArr = null;
     if (trim($this->getBlockOption('catIds'))) {
         $categoryArr['dirname'] = Xcforum_Utils::getAccessController($this->_mBlock->get('dirname'))->get('dirname');
         $categoryArr['id'] = explode(',', $this->getBlockOption('catIds'));
     }
     $attributes = array();
     //		$this->_mObject = $this->_mHandler->getComments($categoryArr, null, null, $this->getBlockOption('limit'));
     $this->_mObject = $this->_mHandler->getTopicsObj($attributes, '', $limit, 0);
     return true;
 }