-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathimanager.php
More file actions
executable file
·120 lines (111 loc) · 3.16 KB
/
imanager.php
File metadata and controls
executable file
·120 lines (111 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
if(!isset($_SESSION)){session_start();}
if(!isset($_SESSION['cat']) || is_null($_SESSION['cat'])) $_SESSION['cat'] = null;
// get correct id for the plugin
$thisfile = basename(__FILE__, '.php');
// include path & file constants
include($thisfile.'/lib/inc/_def.php');
register_plugin(
$thisfile,
'ItemManager',
IM_VERSION_GS,
'Juri Ehret',
'http://ehret-studio.com',
'A simple flat-file framework for GetSimple-CMS',
'imanager',
'im_render_backend'
);
// activate actions
add_action('admin-pre-header', 'ajaxGetLists');
add_action('nav-tab', 'createNavTab', array($thisfile, $thisfile, 'Manager'));
//add_action($thisfile.'-sidebar', 'im_render_backend', array('sidebar'));
register_style('imstyle', IM_SITE_URL.'plugins/'.$thisfile.'/css/im-styles.css',
GSVERSION, 'screen');
register_style('jqdatepicker', IM_SITE_URL.'plugins/'.$thisfile.'/css/jq-datepicker.css',
GSVERSION, 'screen');
register_style('blueimp', IM_SITE_URL.'plugins/'.$thisfile.'/css/blueimp-gallery.min.css',
GSVERSION, 'screen');
register_style('imstylefonts', IM_SITE_URL.'plugins/'.$thisfile
.'/css/fonts/font-awesome/css/font-awesome.min.css', GSVERSION, 'screen');
register_script('immain', IM_SITE_URL."plugins/$thisfile/js/main.js", IM_VERSION, true);
queue_style('imstyle', GSBACK);
queue_style('jqdatepicker', GSBACK);
queue_style('imstylefonts', GSBACK);
queue_style('blueimp', GSBACK);
queue_script('immain', GSBACK);
// ItemManager
include(GSPLUGINPATH.'imanager/lib/ItemManager.php');
/**
* Core ItemManager's function, we use it to create an ItemManager instance
*
* @param string $name
*
* @return Im\ItemManager instance
*/
function imanager($name='')
{
global $im;
if($im === null) $im = new ItemManager();
return !empty($name) ? $im->$name : $im;
}
/**
* Loads and renders ItemManager's backend
* (executed inside admin panel only)
*
*/
function im_render_backend($arg=null)
{
global $im;
if(is_null($arg))
{
// check whether the user inside admin panel
if(defined('IN_GS') && !empty($_GET['id']) && $_GET['id'] == IM_NAME) {
defined('IS_ADMIN_PANEL') or define('IS_ADMIN_PANEL', true);
}
if($im === null) $im = imanager();
if(defined('IS_ADMIN_PANEL'))
{
(!$im->config->injectActions) or $im->setActions();
if($im->config->hiddeAdmin) {
echo $im->config->adminDisabledMsg;
} else
{
$im->admin->init();
echo $im->admin->display();
}
}
} else
{
if(defined('IS_ADMIN_PANEL')) echo $im->admin->display($arg);
}
}
/**
* Ajax call before rendering the admin headers
*/
function ajaxGetLists()
{
global $im;
if(isset($_GET['getcatlist']) || isset($_GET['getitemlist']))
{
// check whether the user inside admin panel
if(defined('IN_GS') && !empty($_GET['id']) && $_GET['id'] == IM_NAME) {
define('IS_ADMIN_PANEL', true);
}
if($im === null) $im = imanager();
if(defined('IS_ADMIN_PANEL'))
{
(!$im->config->injectActions) or $im->setActions();
if(!$im->config->hiddeAdmin)
{
$im->admin->init();
echo $im->admin->display();
}
exit();
}
}
}
/**
* Deprecated ItemManager's call for backward compatibility only
*/
class IManager extends ItemManager { public function __construct() { parent::__construct(); } }
?>