> ------------------------------------------------------------------------------ See main.inc.php for release information --------------------------------------------------------------------------- */ define('PHPWG_ROOT_PATH',dirname(dirname(dirname(__FILE__))).'/'); /* * set ajax module in admin mode if request is used for admin interface */ if(!isset($_REQUEST['ajaxfct'])) $_REQUEST['ajaxfct']=''; if(preg_match('/^admin\./i', $_REQUEST['ajaxfct'])) { define('IN_ADMIN', true); } // the common.inc.php file loads all the main.inc.php plugins files include_once(PHPWG_ROOT_PATH.'include/common.inc.php' ); include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php'); include_once('hgram_root.class.inc.php'); load_language('plugin.lang', HGRAM_PATH); class HGram_ajax extends HGram_root { /** * constructor */ public function __construct($prefixeTable, $filelocation) { parent::__construct($prefixeTable, $filelocation); $this->loadConfig(); $this->checkRequest(); $this->returnAjaxContent(); } /** * check the $_REQUEST values and set default values * */ protected function checkRequest() { global $user; if(!isset($_REQUEST['ajaxfct'])) $_REQUEST['ajaxfct']=''; // check if asked function is valid if(!( $_REQUEST['ajaxfct']=='public.histo.build' ) ) $_REQUEST['ajaxfct']=''; if(preg_match('/^admin\./i', $_REQUEST['ajaxfct']) and !is_admin()) $_REQUEST['ajaxfct']=''; // check token validity if(!isset($_REQUEST['token'])) $_REQUEST['token']=''; if($_REQUEST['ajaxfct']!='') { /* * check public.histo.build */ if($_REQUEST['ajaxfct']=="public.histo.build") { if(!isset($_REQUEST['id'])) $_REQUEST['ajaxfct']=''; if($_REQUEST['token']!=self::getToken($_REQUEST['id'])) $_REQUEST['ajaxfct']=''; } } } /** * return ajax content */ protected function returnAjaxContent() { $result="

An error has occured

"; switch($_REQUEST['ajaxfct']) { case 'public.histo.build': $result=$this->ajax_hgram_public_histoBuild($_REQUEST['id']); break; } GPCAjax::returnResult($result); } /*------------------------------------------------------------------------* * * PUBLIC FUNCTIONS * *----------------------------------------------------------------------- */ private function ajax_hgram_public_histoBuild($imageId) { return(self::getHistogramGraph($imageId, true)); } /*------------------------------------------------------------------------* * * ADMIN FUNCTIONS * *----------------------------------------------------------------------- */ } //class $returned=new HGram_ajax($prefixeTable, __FILE__); ?>