File: /var/www/ilya/data/www/irkboard.ru/admin/applications/core/modules_public/ajax/reputation.php
<?php
/**
* Invision Power Services
* IP.Board v3.0.1
* Reputation
* Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Core
* @link http://www.invisionpower.com
* @version $Rev: 3887 $
*
*/
class public_core_ajax_reputation extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
/* What to do */
switch( $this->request['do'] )
{
case 'add_rating':
$this->doRating();
break;
}
/* Output */
$this->returnHtml( $this->output );
}
/**
* 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( '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' );
}
}
}