source: extensions/ASearchEngine/ase_ajax.php @ 32342

Last change on this file since 32342 was 16008, checked in by grum, 12 years ago

feature:2635- compatibility with Piwigo 2.4

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1<?php
2/*
3 * -----------------------------------------------------------------------------
4 * Plugin Name: Advanced Search Engine
5 * -----------------------------------------------------------------------------
6 * Author     : Grum
7 *   email    : grum@piwigo.org
8 *   website  : http://photos.grum.fr
9 *   PWG user : http://forum.piwigo.org/profile.php?id=3706
10 *
11 *   << May the Little SpaceFrog be with you ! >>
12 *
13 * -----------------------------------------------------------------------------
14 *
15 * See main.inc.php for release information
16 *
17 * manage all the ajax requests
18 * -----------------------------------------------------------------------------
19 */
20
21  define('PHPWG_ROOT_PATH',dirname(dirname(dirname(__FILE__))).'/');
22
23  /*
24   * set ajax module in admin mode if request is used for admin interface
25   */
26  if(!isset($_REQUEST['ajaxfct'])) $_REQUEST['ajaxfct']='';
27  if(preg_match('/^admin\./i', $_REQUEST['ajaxfct'])) define('IN_ADMIN', true);
28  if(!defined('AJAX_CALL')) define('AJAX_CALL', true);
29
30
31  // the common.inc.php file loads all the main.inc.php plugins files
32  include_once(PHPWG_ROOT_PATH.'include/common.inc.php' );
33  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php');
34  include_once('ase_root.class.inc.php');
35
36  load_language('plugin.lang', ASE_PATH);
37
38
39  class ASE_Ajax extends ASE_root
40  {
41    /**
42     * constructor
43     */
44    public function __construct($prefixeTable, $filelocation)
45    {
46      parent::__construct($prefixeTable, $filelocation);
47      $this->loadConfig();
48      $this->checkRequest();
49      $this->returnAjaxContent();
50    }
51
52    /**
53     * check the $_REQUEST values and set default values
54     *
55     */
56    protected function checkRequest()
57    {
58      global $user;
59
60      GPCAjax::checkToken();
61
62      // check if asked function is valid
63      if(!($_REQUEST[GPC_AJAX]=='admin.config.setConfig'
64           )) $_REQUEST[GPC_AJAX]='';
65
66      if(preg_match('/^admin\./i', $_REQUEST[GPC_AJAX]) and !is_admin()) $_REQUEST[GPC_AJAX]='';
67
68
69      if($_REQUEST[GPC_AJAX]!='')
70      {
71
72      }
73    } //checkRequest
74
75
76    /**
77     * return ajax content
78     */
79    protected function returnAjaxContent()
80    {
81      $result="<p class='errors'>An error has occured</p>";
82
83      switch($_REQUEST[GPC_AJAX])
84      {
85        case 'admin.config.setConfig':
86          break;
87      }
88      GPCAjax::returnResult($result);
89    }
90
91
92    /*------------------------------------------------------------------------*
93     *
94     * ADMIN FUNCTIONS
95     *
96     *----------------------------------------------------------------------- */
97
98
99
100  } //class
101
102
103  $returned=new ASE_Ajax($prefixeTable, __FILE__);
104?>
Note: See TracBrowser for help on using the repository browser.