Incorrect accessYou cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; exit(); } class public_reputationhistory_reputationhistory_reputationhistory extends ipsCommand { /** * Basic template, replaced as needed * * @access protected * @var string Basic skin template to replace */ protected $template = array(); const BOTH_REPUTATION = 'b'; const POSITIVE_REPUTATION = 'p'; const NEGATIVE_REPUTATION = 'n'; /** * Main class entry point * * @access public * @param object ipsRegistry reference * @return void [Outputs to screen] */ public function doExecute( ipsRegistry $registry ) { //----------------------------------------- // Make sure the portal is installed an enabled //----------------------------------------- if( ! IPSLib::appIsInstalled( 'reputationhistory' ) ) { $this->registry->output->showError( 'no_permission', 1076 ); } if(!$this->settings['db31_rh_turn_on']) { $this->registry->output->showError( $this->lang->words['error_application_turn_off'] ); } if(!in_array($this->memberData['member_group_id'], explode(',', $this->settings['db31_rh_permition_group']))) { $this->registry->output->showError( 'no_permission' ); } //----------------------------------------- // Get global skin and language files //----------------------------------------- ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_history' ) ); //----------------------------------------- // Assign skeletal template ma-doo-bob //----------------------------------------- $this->DB->build( array( 'select' => 'COUNT(type_id) as max', 'from' => 'reputation_index', ) ); $this->DB->execute(); $total_possible = $this->DB->fetch(); $pagination = $this->registry->output->generatePagination( array( 'totalItems' => $total_possible['max'], 'itemsPerPage' => $this->settings['db31_rh_amount_per_site'], 'currentStartValue' => $this->request['st'], 'seoTitle' => 'reputationhistory', 'baseUrl' => "app=reputationhistory" ) ); $this->template = $this->registry->output->getTemplate('reputationhistory')->header($pagination); if($total_possible['max'] > 0) { $query = array( 'select' => 'mg.members_display_name as from_name, mg.member_id as from_id, mg.members_seo_name as from_seo_name', 'from' => array( 'members' => 'mg' ), 'add_join' => array( array( 'select' => 'ri.type_id, ri.rep_date, ri.rep_rating, ri.rep_msg', 'from' => array( 'reputation_index' => 'ri' ), 'where' => 'mg.member_id=ri.member_id', 'type' => 'inner' ), array( 'select' => 'p.pid', 'from' => array( 'posts' => 'p' ), 'where' => 'p.pid=ri.type_id', 'type' => 'inner' ), array( 'select' => 'mg1.members_display_name as to_name, mg1.member_id as to_id, mg1.members_seo_name as to_seo_name', 'from' => array( 'members' => 'mg1' ), 'where' => 'mg1.member_id=p.author_id', 'type' => 'inner' ), array( 'select' => 't.title', 'from' => array( 'topics' => 't' ), 'where' => 't.tid=p.topic_id', 'type' => 'inner' ), array( 'select' => 'g.prefix as from_prefix, g.suffix as from_suffix', 'from' => array( 'groups' => 'g' ), 'where' => 'g.g_id=mg.member_group_id', 'type' => 'inner' ), array( 'select' => 'g1.prefix as to_prefix, g1.suffix as to_suffix', 'from' => array( 'groups' => 'g1' ), 'where' => 'g1.g_id=mg1.member_group_id', 'type' => 'inner' ) ), 'order' => 'ri.rep_date DESC', 'limit' => array( intval($this->request['st']), $this->settings['db31_rh_amount_per_site'] ) ); switch($this->settings['db31_rh_type_reputation']) { case self::POSITIVE_REPUTATION: $query['where'] = 'ri.rep_rating=1'; break; case self::NEGATIVE_REPUTATION: $query['where'] = 'ri.rep_rating=-1'; break; } $this->DB->build( $query ); $this->DB->execute(); $i = 0; while( $r = $this->DB->fetch() ) { $tmp = array(); $tmp['from_username'] = IPSLib::makeProfileLink( $r['from_prefix'].$r['from_name'].$r['from_suffix'], $r['from_id'], $r['from_seo_name'] ); $tmp['from_username_id'] = $r['from_id']; $tmp['from_username_seo'] = $r['from_seo_name']; $tmp['to_username'] = IPSLib::makeProfileLink( $r['to_prefix'].$r['to_name'].$r['to_suffix'], $r['to_id'], $r['to_seo_name'] ); $tmp['to_username_id'] = $r['to_id']; $tmp['to_username_seo'] = $r['to_seo_name']; $tmp['to_msg'] = $r['rep_msg']; $tmp['topic'] = sprintf('%s', $this->settings['base_url'].'app=forums&module=forums&section=findpost&pid='.$r['pid'], $r['title'], $r['title'].' '); $tmp['point'] = (($r['rep_rating'] == 1) ? ''.$r['rep_rating'].'' : ''.$r['rep_rating'].'' ); $tmp['date'] = $this->registry->class_localization->getDate( $r['rep_date'], 'LONG' ); $tmp['class'] = (($i++ % 2 == 0) ? 'row1' : 'row2'); $this->template .= $this->registry->output->getTemplate('reputationhistory')->row($tmp); } } else { $this->template .= $this->registry->output->getTemplate('reputationhistory')->norow(); } $this->template .= $this->registry->output->getTemplate('reputationhistory')->footer($pagination); $this->template .= ''; $this->_do_output(); } /** * Internal do output method. Extend class and overwrite method if you need to modify this functionality. * * @access protected * @return void */ protected function _do_output() { //----------------------------------------- // Pass to print... //----------------------------------------- $this->registry->output->addContent( $this->template ); $this->registry->output->setTitle( $this->lang->words['page_title'] ); $this->registry->output->addNavigation( $this->lang->words['page_title'], 'app=reputationhistory', 'reputationhistory' ); $this->registry->output->sendOutput(); exit(); } } ?>