/** * Adds a rating to the index * * @access public * @return void */ public function doRating() { /* INIT */ $app = $this->request['app_rate']; $type = $this->request['type']; $type_id = intval($this->request['type_id']); $rating = intval($this->request['rating']); /* Check */ if (!$app || !$type || !$type_id || !$rating) { $this->returnString($this->lang->words['ajax_incomplete_data']); } /* Get the rep library */ require_once IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php'; $repCache = new classReputationCache(); /* Add the rating */ if ($repCache->addRate($type, $type_id, $rating, '', 0, $app) === false) { $this->returnString($repCache->error_message); } else { $this->returnString('done'); } }
/** * Adds a rating to the index * * @access public * @return void */ public function doRating() { /* INIT */ $app = $this->request['app_rate']; $type = $this->request['type']; $type_id = intval($this->request['type_id']); $rating = intval($this->request['rating']); /* Check */ if (!$app || !$type || !$type_id || !$rating) { $this->registry->output->showError('reputation_missing_data', 10126); } /* Check the secure key. Needed here to prevent direct URLs from increasing reps */ if ($this->request['secure_key'] != $this->member->form_hash) { $this->registry->output->showError('reputation_missing_data', 10126); } /* Get the rep library */ require_once IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php'; $repCache = new classReputationCache(); /* Add the rating */ if (!$repCache->addRate($type, $type_id, $rating, '', 0, $app)) { $this->registry->output->showError($repCache->error_message, 10127); } else { /* Redirect to */ $return_url = ''; if (isset($this->request['post_return']) && $this->request['post_return']) { $return_url = $this->settings['base_url'] . 'app=forums&module=forums§ion=findpost&pid=' . intval($this->request['post_return']); } else { if ($_SERVER['HTTP_REFERER']) { $return_url = $_SERVER['HTTP_REFERER']; } else { $return_url = $this->settings['base_url']; } } /* Probably Temporary :) */ $this->registry->output->silentRedirect($return_url); } }