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
|
<?php
/* * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) * Copyright (C) 2002-2005 The Nucleus Group * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * (see nucleus/documentation/index.html#license for more info) */ /** * code to make it easier to create plugin admin areas * * @license http://nucleuscms.org/license.txt GNU General Public License * @copyright Copyright (C) 2002-2005 The Nucleus Group * @version $Id: PLUGINADMIN.php,v 1.8.2.1 2005/08/15 10:50:12 dekarma Exp $ */
global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES, $HTTP_SESSION_VARS; $aVarsToCheck = array('DIR_LIBS'); foreach ($aVarsToCheck as $varName) { if (phpversion() >= '4.1.0') { if ( isset($_GET[$varName]) || isset($_POST[$varName]) || isset($_COOKIE[$varName]) || isset($_ENV[$varName]) || isset($_SESSION[$varName]) || isset($_FILES[$varName]) ){ die('Sorry. An error occurred.'); } } else { if ( isset($HTTP_GET_VARS[$varName]) || isset($HTTP_POST_VARS[$varName]) || isset($HTTP_COOKIE_VARS[$varName]) || isset($HTTP_ENV_VARS[$varName]) || isset($HTTP_SESSION_VARS[$varName]) || isset($HTTP_POST_FILES[$varName]) ){ die('Sorry. An error occurred.'); } } }
include($DIR_LIBS . 'ADMIN.php');
class PluginAdmin { var $strFullName; // NP_SomeThing var $plugin; // ref. to plugin object var $bValid; // evaluates to true when object is considered valid var $admin; // ref to an admin object function PluginAdmin($pluginName) { global $manager; $this->strFullName = 'NP_' . $pluginName; // check if plugin exists and is installed if (!$manager->pluginInstalled($this->strFullName)) doError('Invalid plugin'); $this->plugin =& $manager->getPlugin($this->strFullName); $this->bValid = $this->plugin; if (!$this->bValid) doError('Invalid plugin'); $this->admin = new ADMIN(); $this->admin->action = 'plugin_' . $pluginName; } function start($extraHead = '') { global $CONF; $strBaseHref = '<base href="' . htmlspecialchars($CONF['AdminURL']) . '" />'; $extraHead .= $strBaseHref; $this->admin->pagehead($extraHead); } function end() { $this->admin->pagefoot(); } }
?>
|