source: extensions/ASearchEngine/ase_ajax.php @ 7196

Revision 7196, 2.8 KB checked in by grum, 9 years ago (diff)

Commit first files

  • Property svn:executable set to *
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']))
28  {
29    define('IN_ADMIN', true);
30  }
31
32  // the common.inc.php file loads all the main.inc.php plugins files
33  include_once(PHPWG_ROOT_PATH.'include/common.inc.php' );
34  include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php');
35  include_once('ase_root.class.inc.php');
36
37  load_language('plugin.lang', ASE_PATH);
38
39
40  class ASE_Ajax extends ASE_root
41  {
42    /**
43     * constructor
44     */
45    public function __construct($prefixeTable, $filelocation)
46    {
47      parent::__construct($prefixeTable, $filelocation);
48      $this->loadConfig();
49      $this->checkRequest();
50      $this->returnAjaxContent();
51    }
52
53    /**
54     * check the $_REQUEST values and set default values
55     *
56     */
57    protected function checkRequest()
58    {
59      global $user;
60
61      if(!isset($_REQUEST['ajaxfct'])) $_REQUEST['ajaxfct']='';
62
63      // check if asked function is valid
64      if(!($_REQUEST['ajaxfct']=='admin.maps.getList'
65           //$_REQUEST['ajaxfct']=='public.maps.getMarkerInfos'
66           )) $_REQUEST['ajaxfct']='';
67
68      if(preg_match('/^admin\./i', $_REQUEST['ajaxfct']) and !is_admin()) $_REQUEST['ajaxfct']='';
69
70
71      if($_REQUEST['ajaxfct']!='')
72      {
73        /*
74         * no check for admin.maps.getList & admin.assoc.getList requests
75         */
76
77
78      }
79    } //checkRequest
80
81
82    /**
83     * return ajax content
84     */
85    protected function returnAjaxContent()
86    {
87      $result="<p class='errors'>An error has occured</p>";
88      /*
89      switch($_REQUEST['ajaxfct'])
90      {
91        case 'admin.maps.getList':
92          $result=$this->ajax_gmaps_admin_mapsGetList();
93          break;
94      }
95      */
96      GPCAjax::returnResult($result);
97    }
98
99
100    /*------------------------------------------------------------------------*
101     *
102     * ADMIN FUNCTIONS
103     *
104     *----------------------------------------------------------------------- */
105
106
107
108  } //class
109
110
111  $returned=new ASE_Ajax($prefixeTable, __FILE__);
112?>
Note: See TracBrowser for help on using the repository browser.