function editUserProfile($option, $uid) { if (empty($uid[0])) { echo JText::_('COM_KUNENA_PROFILE_NO_USER'); return; } $kunena_db =& JFactory::getDBO(); $kunena_acl =& JFactory::getACL(); $kunena_db->setQuery("SELECT * FROM #__kunena_users LEFT JOIN #__users on #__users.id=#__kunena_users.userid WHERE userid={$uid['0']}"); $userDetails = $kunena_db->loadObjectList(); if (KunenaError::checkDatabaseError()) { return; } $user = $userDetails[0]; //Mambo userids are unique, so we don't worry about that $prefview = $user->view; $ordering = $user->ordering; $moderator = $user->moderator; $userRank = $user->rank; //grab all special ranks $kunena_db->setQuery("SELECT * FROM #__kunena_ranks WHERE rank_special = '1'"); $specialRanks = $kunena_db->loadObjectList(); if (KunenaError::checkDatabaseError()) { return; } //build select list options $yesnoRank[] = JHTML::_('select.option', '0', JText::_('COM_KUNENA_RANK_NO_ASSIGNED')); foreach ($specialRanks as $ranks) { $yesnoRank[] = JHTML::_('select.option', $ranks->rank_id, $ranks->rank_title); } //build special ranks select list $selectRank = JHTML::_('select.genericlist', $yesnoRank, 'newrank', 'class="inputbox" size="5"', 'value', 'text', $userRank); // make the select list for the view type $yesno[] = JHTML::_('select.option', 'flat', JText::_('COM_KUNENA_A_FLAT')); $yesno[] = JHTML::_('select.option', 'threaded', JText::_('COM_KUNENA_A_THREADED')); // build the html select list $selectPref = JHTML::_('select.genericlist', $yesno, 'newview', 'class="inputbox" size="2"', 'value', 'text', $prefview); // make the select list for the moderator flag $yesnoMod[] = JHTML::_('select.option', '1', JText::_('COM_KUNENA_ANN_YES')); $yesnoMod[] = JHTML::_('select.option', '0', JText::_('COM_KUNENA_ANN_NO')); // build the html select list $selectMod = JHTML::_('select.genericlist', $yesnoMod, 'moderator', 'class="inputbox" size="2"', 'value', 'text', $moderator); // make the select list for the moderator flag $yesnoOrder[] = JHTML::_('select.option', '0', JText::_('COM_KUNENA_USER_ORDER_ASC')); $yesnoOrder[] = JHTML::_('select.option', '1', JText::_('COM_KUNENA_USER_ORDER_DESC')); // build the html select list $selectOrder = JHTML::_('select.genericlist', $yesnoOrder, 'neworder', 'class="inputbox" size="2"', 'value', 'text', $ordering); //get all subscriptions for this user $kunena_db->setQuery("select thread from #__kunena_subscriptions where userid={$uid['0']}"); $subslist = $kunena_db->loadObjectList(); if (KunenaError::checkDatabaseError()) { return; } //get all categories subscriptions for this user $kunena_db->setQuery("select catid from #__kunena_subscriptions_categories where userid={$uid['0']}"); $subscatslist = $kunena_db->loadObjectList(); if (KunenaError::checkDatabaseError()) { return; } //get all moderation category ids for this user $kunena_db->setQuery("select catid from #__kunena_moderation where userid=" . $uid[0]); $modCatList = $kunena_db->loadResultArray(); if (KunenaError::checkDatabaseError()) { return; } if ($moderator && empty($modCatList)) { $modCatList[] = 0; } $categoryList = array(); $categoryList[] = JHTML::_('select.option', 0, JText::_('COM_KUNENA_GLOBAL_MODERATOR')); $modCats = CKunenaTools::KSelectList('catid[]', $categoryList, 'class="inputbox" multiple="multiple"', false, 'kforums', $modCatList); //get all IPs used by this user $kunena_db->setQuery("SELECT ip FROM #__kunena_messages WHERE userid={$uid['0']} GROUP BY ip"); $iplist = implode("','", $kunena_db->loadResultArray()); if (KunenaError::checkDatabaseError()) { return; } $list = array(); if ($iplist) { $iplist = "'{$iplist}'"; $kunena_db->setQuery("SELECT m.ip,m.userid,u.username,COUNT(*) as mescnt FROM #__kunena_messages AS m INNER JOIN #__users AS u ON m.userid=u.id WHERE m.ip IN ({$iplist}) GROUP BY m.userid,m.ip"); $list = $kunena_db->loadObjectlist(); if (KunenaError::checkDatabaseError()) { return; } } $useridslist = array(); foreach ($list as $item) { $useridslist[$item->ip][] = $item; } html_Kunena::editUserProfile($option, $user, $subslist, $subscatslist, $selectRank, $selectPref, $selectMod, $selectOrder, $uid[0], $modCats, $useridslist); }
protected function moderate($modchoices = '', $modthread = 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.moderation.class.php'; $this->moderateTopic = $modthread; $this->moderateMultiplesChoices = $modchoices; // Get list of latest messages: $query = "SELECT id,subject FROM #__kunena_messages WHERE catid={$this->_db->Quote($this->catid)} AND parent=0 AND hold=0 AND moved=0 AND thread!={$this->_db->Quote($this->msg_cat->thread)} ORDER BY id DESC"; $this->_db->setQuery($query, 0, 30); $messagesList = $this->_db->loadObjectlist(); if (KunenaError::checkDatabaseError()) { return; } // Get thread and reply count from current message: $query = "SELECT t.id,t.subject,COUNT(mm.id) AS replies FROM #__kunena_messages AS m\n\t\t\tINNER JOIN #__kunena_messages AS t ON m.thread=t.id\n\t\t\tLEFT JOIN #__kunena_messages AS mm ON mm.thread=m.thread AND mm.id > m.id\n\t\t\tWHERE m.id={$this->_db->Quote($this->id)}\n\t\t\tGROUP BY m.thread"; $this->_db->setQuery($query, 0, 1); $this->threadmsg = $this->_db->loadObject(); if (KunenaError::checkDatabaseError()) { return; } $messages = array(); if ($this->moderateTopic) { $messages[] = JHTML::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_MOVE_TOPIC')); } else { $messages[] = JHTML::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_CREATE_TOPIC')); } $messages[] = JHTML::_('select.option', -1, JText::_('COM_KUNENA_MODERATION_ENTER_TOPIC')); foreach ($messagesList as $mes) { $messages[] = JHTML::_('select.option', $mes->id, kunena_htmlspecialchars($mes->subject)); } $this->messagelist = JHTML::_('select.genericlist', $messages, 'targettopic', 'class="inputbox"', 'value', 'text', 0, 'kmod_targettopic'); $options = array(); $this->categorylist = CKunenaTools::KSelectList('targetcat', $options, 'class="inputbox kmove_selectbox"', false, 'kmod_categories', $this->catid); $this->message = $this->msg_cat; $this->user = KunenaFactory::getUser($this->msg_cat->userid); CKunenaTools::loadTemplate('/moderate/moderate.php'); }