Ignore:
Timestamp:
Jun 24, 2012, 9:18:26 PM (12 years ago)
Author:
grum
Message:

feature:2634- compatibility with Piwigo 2.4
+add some objects on js framework

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/classes/GPCAjax.class.inc.php

    r5550 r16012  
    33/* -----------------------------------------------------------------------------
    44  class name     : GPCAjax
    5   class version  : 3.0.0
    6   plugin version : 3.0.0
    7   date           : 2010-03-30
     5  class version  : 3.1.0
     6  plugin version : 3.5.2
     7  date           : 2012-06-19
    88  ------------------------------------------------------------------------------
    99  author: grum at piwigo.org
     
    1515| release | date       |
    1616| 3.0.0   | 2010/03/30 | * Update class & function names
     17|         |            |
     18| 3.1.0   | 2012/06/19 | * Check token request
     19|         |            |
    1720|         |            |
    1821|         |            |
     
    2730   ---------------------------------------------------------------------- */
    2831
    29 
     32define('GPC_AJAX', 'ajaxfct');
    3033
    3134class GPCAjax
     
    3942    exit(strtr($str, $chars));
    4043  }
     44
     45  /**
     46   * check if there's a valid token in $_REQUEST
     47   * if no, the GPC_AJAX call is set to empty value
     48   *
     49   * @param String $fct: the ajax function field (GPC_AJAX by default)
     50   * @param String $token: the token field ('token' by default) to check
     51   * @return Boolean: true if ok, otherwise false
     52   */
     53  static public function checkToken($fct=GPC_AJAX, $token='token')
     54  {
     55    if(!isset($_REQUEST[$token])) $_REQUEST[$token]='';
     56    if($fct!='' && !isset($_REQUEST[$fct])) $_REQUEST[$fct]='';
     57
     58    if($_REQUEST[$token]==get_pwg_token()) return(true);
     59
     60    if($fct!='') $_REQUEST[$fct]='';
     61    return(false);
     62  }
    4163} //class
    4264
Note: See TracChangeset for help on using the changeset viewer.