HEX
Server: Apache/2.4.59 (Debian)
System: Linux skycube.cz 4.19.0-25-amd64 #1 SMP Debian 4.19.289-2 (2023-08-08) x86_64
User: ilya (534)
PHP: 7.3.31-1~deb10u7
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/ilya/data/www/irkboard.ru/admin/applications/core/modules_public/ajax/reports.php
<?php

/**
 * Invision Power Services
 * IP.Board v3.0.1
 * Reports AJAX options
 * Last Updated: $Date: 2009-05-29 23:46:26 -0400 (Fri, 29 May 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: 4707 $
 *
 */

class public_core_ajax_reports extends ipsAjaxCommand 
{
	/**
	 * Class entry point
	 *
	 * @access	public
	 * @param	object		Registry reference
	 * @return	void		[Outputs to screen]
	 */
	public function doExecute( ipsRegistry $registry ) 
	{
		$this->registry->class_localization->loadLanguageFile( array( 'public_reports' ) );

		$this->DB->loadCacheFile( IPSLib::getAppDir('core') . '/sql/' . ips_DBRegistry::getDriverType() . '_report_queries.php', 'report_sql_queries' );

		require_once( IPSLib::getAppDir('core') .'/sources/classes/reportLibrary.php' );
		$this->registry->setClass( 'reportLibrary', new reportLibrary( $this->registry ) );
		
		/* What to do */
		switch( $this->request['do'] )
		{
			case 'change_status':
				$this->output = $this->_changeStatus();
			break;
		}
	}
	
	/**
	 * Adds a rating to the index
	 *
	 * @access	private
	 * @return	void
	 */
	private function _changeStatus()
	{
		//-----------------------------------------
		// Get status's and flags
		//-----------------------------------------
		
		$this->registry->getClass('reportLibrary')->buildStatuses( true );
			
		$COM_PERM = $this->registry->getClass('reportLibrary')->buildQueryPermissions();
		
		//-----------------------------------------
		// Process changes if info is correct
		//-----------------------------------------
		
		if( is_numeric($this->request['id']) && $this->request['id'] > 0 )
		{
			$the_id = intval( $this->request['id'] );
			$return = array('id' => $the_id);
			
			$this->DB->buildFromCache( 'grab_report', array( 'COM' => $COM_PERM, 'rid' => $the_id ), 'report_sql_queries' );
			$res = $this->DB->execute();

			if( $this->DB->getTotalRows() > 0 )
			{
				$report = $this->DB->fetch();

				$old_status = $report['status'];
				$new_status = $this->request['status'];

				if( $old_status != $new_status )
				{
					$build_update = array(
										'status'		=> $new_status,
										'date_updated'	=> time(),
										'updated_by'	=> $this->memberData['member_id'],
									);

					$this->DB->update( 'rc_reports_index', $build_update, "id=".$the_id );
				}
				
				$this->registry->getClass('reportLibrary')->updateCacheTime();
				$this->registry->getClass('reportLibrary')->rebuildMemberCacheArray();
				
				//-----------------------------------------
				// Need to reload data to get right "points" :(
				//-----------------------------------------
				
				$this->DB->buildFromCache( 'grab_report', array( 'COM' => $COM_PERM, 'rid' => $the_id ), 'report_sql_queries' );
				$res = $this->DB->execute();
				$report = $this->DB->fetch();

				//-----------------------------------------
				// Pick the right flag.. or else!
				//-----------------------------------------

				$return['img']		= str_replace( '<#IMG_DIR#>', $this->registry->output->skin['set_image_dir'], $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['img'] );
				$return['width']	= $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['width'];
				$return['height']	= $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['height'];
				$return['is_png']	= $this->registry->getClass('reportLibrary')->flag_cache[ $report['status'] ][ $report['points'] ]['is_png'];

				//-----------------------------------------
				// Image? PNG? Using 'Is-Evil' machine?
				//-----------------------------------------
				
				if( $return['img'] != '' )
				{
					$this->returnJsonArray( array( 'img' => $this->registry->getClass('output')->getTemplate('reports')->statusIcon( $return['img'], $return['width'], $return['height'] ) ) );
				}
				else
				{
					$this->returnString( '&nbsp;' );
				}
			}
		}
		else
		{
			$this->returnString( 'error' );
		}
	}
}