[7196] | 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 |
---|
[7207] | 64 | if(!($_REQUEST['ajaxfct']=='admin.config.setConfig' |
---|
[7196] | 65 | )) $_REQUEST['ajaxfct']=''; |
---|
| 66 | |
---|
| 67 | if(preg_match('/^admin\./i', $_REQUEST['ajaxfct']) and !is_admin()) $_REQUEST['ajaxfct']=''; |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | if($_REQUEST['ajaxfct']!='') |
---|
| 71 | { |
---|
| 72 | |
---|
| 73 | } |
---|
| 74 | } //checkRequest |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | * return ajax content |
---|
| 79 | */ |
---|
| 80 | protected function returnAjaxContent() |
---|
| 81 | { |
---|
| 82 | $result="<p class='errors'>An error has occured</p>"; |
---|
[7207] | 83 | |
---|
[7196] | 84 | switch($_REQUEST['ajaxfct']) |
---|
| 85 | { |
---|
[7207] | 86 | case 'admin.config.setConfig': |
---|
[7196] | 87 | $result=$this->ajax_gmaps_admin_mapsGetList(); |
---|
| 88 | break; |
---|
| 89 | } |
---|
| 90 | GPCAjax::returnResult($result); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | /*------------------------------------------------------------------------* |
---|
| 95 | * |
---|
| 96 | * ADMIN FUNCTIONS |
---|
| 97 | * |
---|
| 98 | *----------------------------------------------------------------------- */ |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | } //class |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | $returned=new ASE_Ajax($prefixeTable, __FILE__); |
---|
| 106 | ?> |
---|