| Apache Linux webd001.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 uid=2234(oyaide) gid=100(users) groups=100(users) server ip : 213.186.33.18 | your ip : 216.73.216.136 safemode OFF > / home / oyaide / www / moycompany.com / piwigo2 / plugins / GrumPluginClasses / classes / |
| Filename | /home/oyaide/www/moycompany.com/piwigo2/plugins/GrumPluginClasses/classes/GPCAjax.class.inc.php |
| Size | 1.89 kb |
| Permission | rw----r-- |
| Owner | oyaide : users |
| Create time | 11-Mar-2016 09:47 |
| Last modified | 24-Jun-2012 21:18 |
| Last accessed | 24-Jun-2012 21:18 |
| Actions | edit | rename | delete | download (gzip) |
| View | text | code | image |
<?php
/* -----------------------------------------------------------------------------
class name : GPCAjax
class version : 3.1.0
plugin version : 3.5.2
date : 2012-06-19
------------------------------------------------------------------------------
author: grum at piwigo.org
<< May the Little SpaceFrog be with you >>
------------------------------------------------------------------------------
:: HISTORY
| release | date |
| 3.0.0 | 2010/03/30 | * Update class & function names
| | |
| 3.1.0 | 2012/06/19 | * Check token request
| | |
| | |
| | |
| | |
| | |
| | |
| | |
------------------------------------------------------------------------------
no constructor, only static function are provided
- static function return_result($str)
---------------------------------------------------------------------- */
define('GPC_AJAX', 'ajaxfct');
class GPCAjax
{
static public function returnResult($str)
{
//$chars=get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES);
$chars['<']='<';
$chars['>']='>';
$chars['&']='&';
exit(strtr($str, $chars));
}
/**
* check if there's a valid token in $_REQUEST
* if no, the GPC_AJAX call is set to empty value
*
* @param String $fct: the ajax function field (GPC_AJAX by default)
* @param String $token: the token field ('token' by default) to check
* @return Boolean: true if ok, otherwise false
*/
static public function checkToken($fct=GPC_AJAX, $token='token')
{
if(!isset($_REQUEST[$token])) $_REQUEST[$token]='';
if($fct!='' && !isset($_REQUEST[$fct])) $_REQUEST[$fct]='';
if($_REQUEST[$token]==get_pwg_token()) return(true);
if($fct!='') $_REQUEST[$fct]='';
return(false);
}
} //class
?>
/* -----------------------------------------------------------------------------
class name : GPCAjax
class version : 3.1.0
plugin version : 3.5.2
date : 2012-06-19
------------------------------------------------------------------------------
author: grum at piwigo.org
<< May the Little SpaceFrog be with you >>
------------------------------------------------------------------------------
:: HISTORY
| release | date |
| 3.0.0 | 2010/03/30 | * Update class & function names
| | |
| 3.1.0 | 2012/06/19 | * Check token request
| | |
| | |
| | |
| | |
| | |
| | |
| | |
------------------------------------------------------------------------------
no constructor, only static function are provided
- static function return_result($str)
---------------------------------------------------------------------- */
define('GPC_AJAX', 'ajaxfct');
class GPCAjax
{
static public function returnResult($str)
{
//$chars=get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES);
$chars['<']='<';
$chars['>']='>';
$chars['&']='&';
exit(strtr($str, $chars));
}
/**
* check if there's a valid token in $_REQUEST
* if no, the GPC_AJAX call is set to empty value
*
* @param String $fct: the ajax function field (GPC_AJAX by default)
* @param String $token: the token field ('token' by default) to check
* @return Boolean: true if ok, otherwise false
*/
static public function checkToken($fct=GPC_AJAX, $token='token')
{
if(!isset($_REQUEST[$token])) $_REQUEST[$token]='';
if($fct!='' && !isset($_REQUEST[$fct])) $_REQUEST[$fct]='';
if($_REQUEST[$token]==get_pwg_token()) return(true);
if($fct!='') $_REQUEST[$fct]='';
return(false);
}
} //class
?>