2 if ( !class_exists('BaseActions') )
4 include $DIR_LIBS . 'BaseActions.php';
8 class AdminActions extends BaseActions
10 // reference to the skin object for which a part is being parsed
15 /* NOTE: list of whole available action names for tags
24 'adminskineditallowedlist',
27 'adminskinselectoptions',
28 'adminspecialskinlist',
29 'admintemplateoverview',
30 'allowedadminskinactions',
53 'configsettingsyesno',
56 'defaultadminskintypes',
66 'editadmintemplateinfo',
72 'editplugoptionslist',
88 'insertpluginoptions',
93 'languageselectoptions',
94 'listplugplugoptionrow',
111 'selectlocaladminskinfiles',
112 'selectlocalskinfiles',
113 'skineditallowedlist',
130 * AdminActions::$default_actions
131 * list of whole action names with which this class can deal
133 static private $default_actions = array(
144 * AdminActions::$skin_type_friendly_names
145 * friendly name for wrapped page types
147 static private $default_skin_types = array(
148 'actionlog' => _ADM_SKPRT_ACTIONLOG,
149 'activate' => _ADM_SKPRT_ACTIVATE,
150 'activatesetpwd' => _ADM_SKPRT_ACTIVATESETPWD,
151 'addnewlog' => _ADM_SKPRT_ADDNEWLOG,
152 'adminerrorpage' => _ADM_SKPRT_ADMINERRORPAGE,
153 'adminskindelete' => _ADM_SKPRT_ADMINSKINDELETE,
154 'adminskinedit' => _ADM_SKPRT_ADMINSKINEDIT,
155 'adminskinedittype' => _ADM_SKPRT_ADMINSKINEDITTYPE,
156 'adminskiniedoimport' => _ADM_SKPRT_ADMINSKINIEDOIMPORT,
157 'adminskinieimport' => _ADM_SKPRT_ADMINSKINIEIMPORT,
158 'adminskinieoverview' => _ADM_SKPRT_ADMINSKINIEOVERVIEW,
159 'adminskinoverview' => _ADM_SKPRT_ADMINSKINOVERVIEW,
160 'adminskinremovetype' => _ADM_SKPRT_ADMINSKINREMOVETYPE,
161 'admintemplatedelete' => _ADM_SKPRT_ADMINTEMPLATEDELETE,
162 'admintemplateedit' => _ADM_SKPRT_ADMINTEMPLATEEDIT,
163 'admintemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW,
164 'backupoverview' => _ADM_SKPRT_BACKUPOVERVIEW,
165 'backuprestore' => _ADM_SKPRT_BACKUPRESTORE,
166 'banlist' => _ADM_SKPRT_BANLIST,
167 'banlistdelete' => _ADM_SKPRT_BANLISTDELETE,
168 'banlistdeleteconfirm' => _ADM_SKPRT_BANLISTDELETECONFIRM,
169 'banlistnew' => _ADM_SKPRT_BANLISTNEW,
170 'batchcategory' => _ADM_SKPRT_BATCHCATEGORY,
171 'batchcomment' => _ADM_SKPRT_BATCHCOMMENT,
172 'batchdelete' => _ADM_SKPRT_BATCHDELETE,
173 'batchitem' => _ADM_SKPRT_BATCHITEM,
174 'batchmember' => _ADM_SKPRT_BATCHMEMBER,
175 'batchmove' => _ADM_SKPRT_BATCHMOVE,
176 'batchmovecat' => _ADM_SKPRT_BATCHMOVECAT,
177 'batchteam' => _ADM_SKPRT_BATCHTEAM,
178 'blogcommentlist' => _ADM_SKPRT_BLOGCOMMENTLIST,
179 'blogselectbox' => _ADM_SKPRT_BLOGSELECTBOX,
180 'blogsettings' => _ADM_SKPRT_BLOGSETTINGS,
181 'bookmarklet' => _ADM_SKPRT_BOOKMARKLET,
182 'browseowncomments' => _ADM_SKPRT_BROWSEOWNCOMMENTS,
183 'browseownitems' => _ADM_SKPRT_BROWSEOWNITEMS,
184 'categorydelete' => _ADM_SKPRT_CATEGORYDELETE,
185 'categoryedit' => _ADM_SKPRT_CATEGORYEDIT,
186 'commentdelete' => _ADM_SKPRT_COMMENTDELETE,
187 'commentedit' => _ADM_SKPRT_COMMENTEDIT,
188 'createitem' => _ADM_SKPRT_CREATEITEM,
189 'createnewlog' => _ADM_SKPRT_CREATENEWLOG,
190 'deleteblog' => _ADM_SKPRT_DELETEBLOG,
191 'editmembersettings' => _ADM_SKPRT_EDITMEMBERSETTINGS,
192 'insertpluginoptions' => _ADM_SKPRT_INSERTPLUGINO,
193 'itemcommentlist' => _ADM_SKPRT_ITEMCOMMENTLIST,
194 'itemdelete' => _ADM_SKPRT_ITEMDELETE,
195 'itemedit' => _ADM_SKPRT_ITEMEDIT,
196 'itemlist' => _ADM_SKPRT_ITEMLIST,
197 'itemmove' => _ADM_SKPRT_ITEMMOVE,
198 'login' => FALSE, //missing
199 'manage' => _ADM_SKPRT_MANAGE,
200 'manageteam' => _ADM_SKPRT_MANAGETEAM,
201 'memberdelete' => _ADM_SKPRT_MEMBERDELETE,
202 'memberedit' => FALSE, //missing
203 'overview' => _ADM_SKPRT_OVERVIEW,
204 'pagefoot' => _ADM_SKPRT_PAGEFOOT,
205 'pagehead' => _ADM_SKPRT_PAGEHEAD,
206 'plugindelete' => _ADM_SKPRT_PLUGINDELETE,
207 'pluginhelp' => _ADM_SKPRT_PLUGINHELP,
208 'pluginlist' => _ADM_SKPRT_PLUGINLIST,
209 'pluginoptions' => _ADM_SKPRT_PLUGINOPTIONS,
210 'settingsedit' => _ADM_SKPRT_SETTINGSEDIT,
211 'showlogin' => _ADM_SKPRT_SHOWLOGIN,
212 'skindelete' => _ADM_SKPRT_SKINDELETE,
213 'skinedit' => _ADM_SKPRT_SKINEDIT,
214 'skinedittype' => _ADM_SKPRT_SKINEDITTYPE,
215 'skiniedoimport' => _ADM_SKPRT_SKINIEDOIMPORT,
216 'skinieimport' => _ADM_SKPRT_SKINIEIMPORT,
217 'skinieoverview' => _ADM_SKPRT_SKINIEOVERVIEW,
218 'skinoverview' => _ADM_SKPRT_SKINOVERVIEW,
219 'skinremovetype' => _ADM_SKPRT_SKINREMOVETYPE,
220 'systemoverview' => _ADM_SKPRT_SYSTEMOVERVIEW,
221 'teamdelete' => _ADM_SKPRT_TEAMDELETE,
222 'templatedelete' => _ADM_SKPRT_TEMPLATEDELETE,
223 'templateedit' => _ADM_SKPRT_TEMPLATEEDIT,
224 'templateoverview' => _ADM_SKPRT_TEMPLATEOVERVIEW,
225 'usermanagement' => _ADM_SKPRT_USERMANAGEMENT,
229 * AdminActions::getAvailableSkinTypes()
233 * @return array list of friendly names for page actions
235 static public function getAvailableSkinTypes()
237 return self::$default_skin_types;
241 * AdminActions::getDefaultTypes()
245 * @return array list of friendly names for page actions
247 static public function getDefaultTypes()
249 return self::$default_skin_types;
253 * AdminActions::__construct()
254 * Constructor for a new Actions object
256 * @param string $type
259 public function __construct($type)
261 // call constructor of superclass first
262 parent::__construct();
263 $this->skintype = $type;
264 if ( !class_exists('Navlist') || !class_exists('Batch') )
267 include $DIR_LIBS . 'ENCAPSULATE.php';
273 * AdminActions::getAvailableActions()
276 * @return array allowed actions for the page type
278 public function getAvailableActions()
280 $extra_actions = array();
282 switch ( $this->skintype )
285 $extra_actions = array(
290 $extra_actions = array(
295 case 'activatesetpwd':
296 $extra_actions = array(
300 $extra_actions = array(
306 case 'adminerrorpage':
307 $extra_actions = array(
310 case 'adminskindelete':
311 $extra_actions = array(
315 case 'adminskinedit':
316 $extra_actions = array(
318 'defaultadminskintypes',
319 'adminspecialskinlist',
322 case 'adminskinedittype':
323 $extra_actions = array(
326 'allowedadminskinactions',
327 'adminskineditallowedlist',
330 case 'adminskiniedoimport':
331 $extra_actions = array(
335 case 'adminskinieimport':
336 $extra_actions = array(
340 case 'adminskinieoverview':
341 $extra_actions = array(
342 'selectlocaladminskinfiles',
346 case 'adminskinoverview':
347 $extra_actions = array(
351 case 'adminskinremovetype':
352 $extra_actions = array(
356 case 'admintemplatedelete':
357 $extra_actions = array(
358 'editadmintemplateinfo',
360 case 'admintemplateedit':
361 $extra_actions = array(
362 'editadmintemplateinfo',
365 case 'admntemplateoverview':
366 $extra_actions = array(
367 'admintemplateoverview',
370 case 'backupoverview':
371 $extra_actions = array(
374 case 'backuprestore':
375 $extra_actions = array(
379 $extra_actions = array(
385 case 'banlistdelete':
386 $extra_actions = array(
391 case 'banlistdeleteconfirm':
392 $extra_actions = array(
393 'banlistdeletedlist',
398 $extra_actions = array(
404 case 'batchcategory':
405 $extra_actions = array(
411 $extra_actions = array(
417 $extra_actions = array(
423 $extra_actions = array(
429 $extra_actions = array(
435 $extra_actions = array(
444 $extra_actions = array(
453 $extra_actions = array(
459 case 'blogcommentlist':
460 $extra_actions = array(
466 case 'blogselectbox':
467 $extra_actions = array(
472 $extra_actions = array(
488 $extra_actions = array(
492 case 'browseowncomments':
493 $extra_actions = array(
497 case 'browseownitems':
498 $extra_actions = array(
502 case 'categorydelete':
503 $extra_actions = array(
509 $extra_actions = array(
516 case 'commentdelete':
517 $extra_actions = array(
522 $extra_actions = array(
527 $extra_actions = array(
539 $extra_actions = array(
545 $extra_actions = array(
550 case 'editmembersettings':
551 $extra_actions = array(
553 'languageselectoptions',
554 'adminskinselectoptions',
558 case 'insertpluginoptions':
559 $extra_actions = array(
560 'insertpluginoptions',
563 case 'itemcommentlist':
564 $extra_actions = array(
570 $extra_actions = array(
577 $extra_actions = array(
589 $extra_actions = array(
596 $extra_actions = array(
602 $extra_actions = array(
606 $extra_actions = array(
615 $extra_actions = array(
620 $extra_actions = array(
625 $extra_actions = array(
633 $extra_actions = array(
646 $extra_actions = array(
651 $extra_actions = array(
657 $extra_actions = array(
662 case 'pluginoptions':
663 $extra_actions = array(
665 'editplugoptionslist',
669 $extra_actions = array(
672 'configsettingsedit',
673 'languageselectoptions',
674 'configsettingsyesno',
682 $extra_actions = array(
687 $extra_actions = array(
692 $extra_actions = array(
698 $extra_actions = array(
701 'allowedskinactions',
702 'skineditallowedlist',
703 'skineditallowedlist',
706 case 'skiniedoimport':
707 $extra_actions = array(
712 $extra_actions = array(
716 case 'skinieoverview':
717 $extra_actions = array(
718 'selectlocalskinfiles',
723 $extra_actions = array(
727 case 'skinremovetype':
728 $extra_actions = array(
732 case 'systemoverview':
733 $extra_actions = array(
738 $extra_actions = array(
744 case 'templatedelete':
745 $extra_actions = array(
750 $extra_actions = array(
754 case 'templateoverview':
755 $extra_actions = array(
759 case 'usermanagement':
760 $extra_actions = array(
766 $extra_actions = array(
776 'selectlocaladminskinfiles',
784 $defined_actions = array_merge(self::$default_actions, $extra_actions);
786 return array_merge($defined_actions, parent::getAvailableActions());
790 * AdminActions::setSkin()
792 * @param object $skin an instance of Skin class
795 public function setSkin(&$skin)
797 $this->skin =& $skin;
802 * AdminActions::parse_actionloglist()
803 * Parse skinvar actionloglist
805 * @param string $templateName name of template to use
808 public function parse_actionloglist($templateName = '')
810 $query = "SELECT * FROM %s ORDER BY timestamp DESC";
811 $query = sprintf($query, sql_table('actionlog'));
813 $template['content'] = 'actionlist';
814 $amount = showlist($query, 'table', $template, $templateName);
820 * AdminActions::parse_activationmessage()
821 * Parse skinvar activationmessage
823 * @param string $type type of message
824 * @param string $templateName name of template to use
827 public function parse_activationmessage($type, $templateName = '')
829 global $CONF, $manager;
833 if ( !empty($templateName))
835 $template = Template::read($templateName);
838 $key = postVar('ackey');
841 Admin::error(_ERROR_ACTIVATE);
844 $info = MEMBER::getActivationInfo($key);
847 Admin::error(_ERROR_ACTIVATE);
850 $mem = MEMBER::createFromId($info->vmember);
853 Admin::error(_ERROR_ACTIVATE);
855 switch ( $info->vtype )
858 if ( array_key_exists('ACTIVATE_FORGOT_TITLE', $template) && !empty($template['ACTIVATE_FORGOT_TITLE']) )
860 $title = $template['ACTIVATE_FORGOT_TITLE'];
864 $title = _ACTIVATE_FORGOT_TITLE;
866 if ( array_key_exists('ACTIVATE_FORGOT_TEXT', $template) && !empty($template['ACTIVATE_FORGOT_TEXT']) )
868 $text = $template['ACTIVATE_FORGOT_TEXT'];
872 $text = _ACTIVATE_FORGOT_TEXT;
876 if ( array_key_exists('ACTIVATE_REGISTER_TITLE', $template) && !empty($template['ACTIVATE_REGISTER_TITLE']) )
878 $title = $template['ACTIVATE_REGISTER_TITLE'];
882 $title = _ACTIVATE_REGISTER_TITLE;
884 if ( array_key_exists('ACTIVATE_REGISTER_TEXT', $template) && !empty($template['ACTIVATE_REGISTER_TEXT']) )
886 $text = $template['ACTIVATE_REGISTER_TEXT'];
890 $text = _ACTIVATE_REGISTER_TEXT;
893 case 'addresschange':
894 if ( array_key_exists('ACTIVATE_CHANGE_TITLE', $template) && !empty($template['ACTIVATE_CHANGE_TITLE']) )
896 $title = $template['ACTIVATE_CHANGE_TITLE'];
900 $title = _ACTIVATE_CHANGE_TITLE;
902 if (array_key_exists('ACTIVATE_CHANGE_TEXT', $template) && !empty($template['ACTIVATE_CHANGE_TEXT']))
904 $text = $template['ACTIVATE_CHANGE_TEXT'];
908 $text = _ACTIVATE_CHANGE_TEXT;
913 'memberName' => Entity::hsc($mem->getDisplayName()),
914 'realName' => Entity::hsc($mem->getRealName()),
919 echo Template::fill($title, $aVars);
922 echo Template::fill($text, $aVars);
925 echo Entity::hsc($key);
932 * AdminActions::parse_addtickettourl()
933 * Parse skinvar addtickettourl
935 * @param string $url URI for ticket
938 public function parse_addtickettourl($url)
941 $url = $manager->addTicketToUrl($url);
942 echo Entity::hsc($url);
947 * AdminActions::parse_adminbanlist()
948 * Parse skinvar adminbanlist
950 * @param string $templateName name of template to use
953 public function parse_adminbanlist($templateName = '')
955 $blogid = intRequestVar('blogid');
957 $query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";
958 $query = sprintf($query, sql_table('ban'), (integer) $blogid);
960 $template['content'] = 'banlist';
962 $amount = Showlist($query, 'table', $template, $templateName);
972 * AdminActions::parse_adminbatchaction()
973 * Parse skinvar adminbatchaction
978 public function parse_adminbatchaction()
980 echo Entity::hsc(requestVar('batchaction'));
985 * AdminActions::parse_adminbatchlist()
986 * Parse skinvar adminbatchlist
988 * @param string $templateName name of template to use
991 public function parse_adminbatchlist($templateName = '')
994 $templates = array();
996 if ( !empty($templateName) )
998 $templates = Template::read($templateName);
1001 if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) )
1003 $template = '<li><%text(_BATCH_EXECUTING)%>'
1004 . '<b><%adminbatchaction%></b>'
1005 . '<%batchlisttype%>'
1006 . '<b><%batchid%></b>...'
1007 . '<b><%batchlistmsg%></b>'
1012 $template = $templates['ADMIN_BATCHLIST'];
1015 $selected = requestIntArray('batch');
1016 $action = requestVar('batchaction');
1018 switch ( $this->skintype )
1021 $batchlisttype = _BATCH_ONITEM;
1022 $deleteaction = 'deleteOneItem';
1023 $moveaction = 'moveOneItem';
1024 $destid = intRequestVar('destcatid');
1026 case 'batchcomment':
1027 $batchlisttype = _BATCH_ONCOMMENT;
1028 $deleteaction = 'deleteOneComment';
1031 $batchlisttype = _BATCH_ONMEMBER;
1032 $deleteaction = 'deleteOneMember';
1033 $setadminsql = sql_table('member') . ' SET madmin = 1 WHERE mnumber = ';
1034 $unsetchksql = 'SELECT * FROM ' . sql_table('member') . ' WHERE madmin = 1 AND mcanlogin = 1';
1035 $unsetupsql = sql_table('member') . ' SET madmin = 0 WHERE mnumber = ';
1036 $unseterrmsg = _ERROR_ATLEASTONEADMIN;
1039 $blogid = intRequestVar('blogid');
1040 $batchlisttype = _BATCH_ONTEAM;
1041 $deleteaction = 'deleteOneTeamMember';
1042 $setadminsql = sql_table('team') . ' SET tadmin = 1 WHERE tblog = ' . $blogid . ' AND tmember = ';
1043 $unsetchksql = 'SELECT * FROM ' . sql_table('team') . ' WHERE tadmin = 1 AND tblog = ' . $blogid;
1044 $unseterrmsg = _ERROR_ATLEASTONEBLOGADMIN;
1045 $unsetupsql = sql_table('team') . ' SET tadmin = 0 WHERE tblog = ' . $blogid . ' AND tmember = ';
1047 case 'batchcategory':
1048 $batchlisttype = _BATCH_ONCATEGORY;
1049 $deleteaction = 'deleteOneCategory';
1050 $moveaction = 'moveOneCategory';
1051 $destid = intRequestVar('destblogid');
1055 // walk over all selectedids and perform action
1056 foreach ( $selected as $selectedid )
1059 $selectedid = intval($selectedid);
1064 if ( $this->skintype != 'batchteam' )
1066 $error = Admin::deleteaction($selectedid);
1070 $error = Admin::deleteOneTeamMember($blogid, $selectedid);
1074 $error = Admin::moveaction($selectedid, $destid);
1078 sql_query("UPDATE {$setadminsql} {$selectedid};");
1082 // there should always remain at least one super-admin
1083 $r = sql_query($unsetchksql);
1084 if ( sql_num_rows($r) < 2 )
1086 $error = $unseterrmsg;
1090 sql_query("UPDATE {$setadminsql} {$selectedid};");
1094 $error = _BATCH_UNKNOWN . Entity::hsc($action);
1098 'batchid' => $selectedid,
1099 'batchlisttype' => Entity::hsc($batchlisttype),
1100 'adminbatchaction' => Entity::hsc($action),
1101 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,
1104 $handler = new AdminActions('template');
1105 $parser = new Parser($handler);
1108 $parser->parse($template);
1109 $template = ob_get_contents();
1112 echo Template::fill($template, $data);
1118 * AdminActions::parse_adminbloglink()
1119 * Parse skinvar adminbloglink
1121 * @param string $templateName name of template to use
1124 public function parse_adminbloglink($templateName = '')
1127 $blogid = intRequestVar('blogid');
1128 $blog =& $manager->getBlog($blogid);
1129 $templates = array();
1131 if ( !empty($templateName) )
1133 $templates = Template::read($templateName);
1136 if ( !array_key_exists('ADMIN_BLOGLINK', $templates) || empty($templates['ADMIN_BLOGLINK']) )
1138 $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
1142 $template = $templates['ADMIN_BLOGLINK'];
1146 'url' => Entity::hsc($blog->getURL()),
1147 'adminbloglinktitle' => _BLOGLIST_TT_VISIT,
1148 'blogname' => Entity::hsc($blog->getName())
1151 echo Template::fill($template, $data);
1156 * AdminActions::parse_adminerrormesg()
1157 * Parse skinvar adminerrormesg
1162 public function parse_adminerrormesg()
1167 if ( requestVar('errormessage') )
1169 $message = requestVar('errormessage');
1171 elseif ( cookieVar($CONF['CookiePrefix'] . 'errormessage') )
1173 $message = cookieVar($CONF['CookiePrefix'] . 'errormessage');
1175 elseif ( Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage') )
1177 $message = Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage');
1179 echo Entity::hsc($message);
1184 * AdminActions::parse_adminskineditallowedlist()
1185 * Parse skinvar adminskineditallowedlist
1187 * @param string $type template/blog
1188 * @param string $templateName name of template to use
1191 public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
1195 /* TODO: blog seems not to be used */
1197 $query = "SELECT bshortname, bname FROM %s";
1198 $query = sprintf($query, sql_table('blog'));
1200 'content' => 'shortblognames'
1202 Showlist($query, 'table', $show, $templateName);
1205 $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname LIKE 'admin/%%'";
1206 $query = sprintf($query, sql_table('template_desc'));
1208 'content' => 'shortnames'
1210 Showlist($query, 'table', $show, $templateName);
1217 * AdminActions::parse_adminskinielist()
1218 * Parse skinvar adminskinielist
1220 * @param string $type skin/template
1221 * @param string $templateName name of template to use
1224 public function parse_adminskinielist($type, $templateName = '')
1226 $templates = array();
1227 if ( $templateName )
1229 $templates = Template::read($templateName);
1232 if ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) )
1235 . "<input type=\"checkbox\" name=\"<%typeid%>\" id=\"<%expid%>\" />\n"
1236 . "<label for=\"<%expid%>\"><%expname%></label>"
1238 . "<td><%expdesc%></td>\n"
1244 $template = $templates['SKINIE_EXPORT_LIST'];
1250 $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%';";
1251 $query = sprintf($query, sql_table('skin_desc'));
1252 $res = sql_query($query);
1254 while ( $skinObj = sql_fetch_object($res) )
1257 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
1258 'expid' => 'skinexp' . $skinObj->sdnumber,
1259 'expname' => Entity::hsc($skinObj->sdname),
1260 'expdesc' => Entity::hsc($skinObj->sddesc),
1262 echo Template::fill($template, $data);
1266 $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%';";
1267 $query = sprintf($query, sql_table('template_desc'));
1268 $res = sql_query($query);
1269 while ( $templateObj = sql_fetch_object($res) )
1272 'typeid' => 'template[' . $templateObj->tdnumber . ']',
1273 'expid' => 'templateexp' . $templateObj->tdnumber,
1274 'expname' => Entity::hsc($templateObj->tdname),
1275 'expdesc' => Entity::hsc($templateObj->tddesc),
1277 echo Template::fill($template, $data);
1285 * AdminActions::parse_adminskinoverview()
1286 * Parse skinvar adminskinoverview
1288 * @param string $templateName name of template to use
1291 public function parse_adminskinoverview($templateName = '')
1293 $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%' ORDER BY sdname;";
1294 $query = sprintf($query, sql_table('skin_desc'));
1296 $template['content'] = 'adminskinlist';
1297 $template['tabindex'] = 10;
1298 $template['friendly_names'] = $this->skin->getAvailableTypes();
1299 Showlist($query, 'table', $template, $templateName);
1304 * AdminActions::parse_adminskinselectoptions()
1305 * Parse skinvar adminskinselectoptions
1310 public function parse_adminskinselectoptions()
1313 $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';";
1314 $query = sprintf($query, sql_table('skin_desc'));
1316 $template['name'] = 'adminskin';
1317 $template['selected'] = $CONF['DefaultAdminSkin'];
1318 $template['tabindex'] = 110;
1319 Showlist($query, 'select', $template, '');
1324 * AdminActions::parse_adminspecialskinlist()
1325 * Parse skinvar adminspecialskinlist
1327 * @param string $templateName name of template to use
1329 public function parse_adminspecialskinlist($templateName = '')
1331 $templates = array();
1332 if ( $templateName )
1334 $templates = Template::read($templateName);
1337 $nType = $this->skin->getAvailableTypes();
1338 $skinid = intRequestVar('skinid');
1340 $query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";
1341 $query = sprintf($query, sql_table('skin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
1343 $res = sql_query($query);
1344 if ( $res && sql_num_rows($res) > 0 )
1346 /* NOTE: set templates for HEAD/BODY/FOOT */
1347 if ( !array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
1349 $template['head'] = "<ul>\n";
1353 $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
1355 if ( !array_key_exists('ADMIN_SPECIALSKINLIST_BODY', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
1357 $template['body'] = '<li>'
1358 . '<a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
1361 . '(<a tabindex="<%tabindex%>" href="index.php?action=adminskinremovetype&skinid=<%skinid%>&type=<%skintype%>">'
1368 $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
1370 if ( !array_key_exists('ADMIN_SPECIALSKINLIST_FOOT', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
1372 $template['foot'] = "</ul>\n";
1376 $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
1383 echo $template['head'];
1384 while ( $row = sql_fetch_assoc($res) )
1387 'tabindex' => $tabstart++,
1388 'skinid' => $skinid,
1389 'skintype' => Entity::hsc(strtolower($row['stype']))
1391 echo Template::fill($template['body'], $data);
1394 echo $template['foot'];
1400 * AdminActions::parse_admintemplateoverview()
1401 * Parse skinvar admintemplateoverview
1403 * @param string $templateName name of template to use
1406 public function parse_admintemplateoverview($templateName = '')
1408 $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%' ORDER BY tdname;";
1409 $query = sprintf($query, sql_table('template_desc'));
1411 $template['content'] = 'admintemplatelist';
1412 $template['tabindex'] = 10;
1414 Showlist($query, 'table', $template, $templateName);
1419 * AdminActions::parse_allowedadminskinactions()
1420 * Parse skinvar allowedadminskinactions
1425 public function parse_allowedadminskinactions()
1427 global $DIR_ADMINSKINS;
1428 $skinType = strtolower(trim(requestVar('type')));
1429 $actions = $this->skin->getAllowedActionsForType($skinType);
1432 while ( $current = array_shift($actions) )
1434 // TODO: remove this
1435 // skip deprecated vars
1436 if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')
1441 echo helplink("adminskinvar-{$current}") . "$current</a>\n";
1443 if ( count($actions) != 0 )
1452 * AdminActions::parse_allowedskinactions()
1453 * Parse skinvar allowedskinactions
1458 public function parse_allowedskinactions()
1460 $skinType = strtolower(trim(requestVar('type')));
1461 $skinid = intRequestVar('skinid');
1463 $skin = new Skin($skinid);
1464 $actions = $skin->getAllowedActionsForType($skinType);
1467 while ( $current = array_shift($actions) )
1469 // TODO: remove this
1470 // skip deprecated vars
1471 if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )
1476 /* TODO: alternative function should be used or not? */
1477 echo helplink("skinvar-{$current}") . "$current</a>\n";
1479 if ( count($actions) != 0 )
1488 * AdminActions::parse_banlistdeletedlist()
1489 * Parse skinvar banlistdeletedlist
1491 * @param string $templateName name of template to use
1494 public function parse_banlistdeletedlist($templateName = '')
1497 $templates = array();
1499 if ( $templateName )
1501 $templates = Template::read($templateName);
1503 if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) )
1505 $template = "<li><%blogname%></li>\n";
1509 $template = $templates['BANLIST_DELETED_LIST'];
1512 $deleted = requestArray('delblogs');
1513 foreach ( $deleted as $delblog )
1515 $blog =& $manager->getBlog($delblog);
1517 Entity::hsc($blog->getName())
1519 Template::fill($template, $data);
1525 * AdminActions::parse_batchdeletelist()
1526 * Parse skinvar batchdeletelist
1531 public function parse_batchdeletelist()
1533 $selected = requestIntArray('batch');
1536 foreach ( $selected as $select )
1538 echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
1540 // add hidden vars for team & comment
1541 if ( requestVar('action') == 'batchteam' )
1543 echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";
1545 if ( requestVar('action') == 'batchcomment' )
1547 echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";
1553 * AdminActions::parse_batchdeletetype()
1554 * Parse skinvar batchdeletetype
1559 public function parse_batchdeletetype()
1561 echo Entity::hsc(requestVar('action'));
1566 * AdminActions::parse_batchmovebtn()
1567 * Parse skinvar batchmovebtn
1572 public function parse_batchmovebtn()
1574 $actionType = requestVar('action');
1575 switch ( $actionType )
1580 case 'batchcategory':
1588 * AdminActions::parse_batchmovelist()
1589 * Parse skinvar batchmovelist
1594 public function parse_batchmovelist()
1596 $selected = requestIntArray('batch');
1597 foreach ( $selected as $select )
1599 echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";
1605 * AdminActions::parse_batchmovetitle()
1606 * Parse skinvar batchmovetitle
1611 public function parse_batchmovetitle()
1613 $actionType = requestVar('action');
1614 switch ( $actionType )
1619 case 'batchcategory':
1620 echo _MOVECAT_TITLE;
1627 * AdminActions::parse_batchmovetype()
1628 * Parse skinvar batchmovetype
1633 public function parse_batchmovetype()
1635 echo Entity::hsc(requestVar('action'));
1640 * AdminActions::parse_blogcatlist()
1641 * Parse skinvar blogcatlist
1646 public function parse_blogcatlist()
1649 $blogid = intRequestVar('blogid');
1650 $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
1651 $query = sprintf($query, sql_table('category'), (integer) $blogid);
1653 $template['content'] = 'categorylist';
1654 $template['tabindex'] = 200;
1656 $batch = new Batch('category');
1657 $batch->showlist($query, 'table', $template);
1662 * AdminActions::parse_blogid()
1663 * Parse skinvar blogid
1668 function parse_blogid()
1670 echo intRequestVar('blogid');
1675 * AdminActions::parse_blognotifysetting()
1676 * Parse skinvar blognotifysetting
1681 public function parse_blognotifysetting($type)
1684 $blogid = intRequestVar('blogid');
1685 $blog = $manager->getBlog($blogid);
1690 if ( !$blog->notifyOnComment() )
1696 if ( !$blog->notifyOnVote() )
1702 if ( !$blog->notifyOnNewItem() )
1708 echo ' checked="checked"';
1713 * AdminActions::parse_blogselectbox()
1714 * Parse skinvar blogselectbox
1719 public function parse_blogselectbox()
1723 $selectData = requestVar('selectData');
1724 $mode = $selectData['mode'];
1725 $name = Entity::hsc($selectData['name']);
1726 $tabindex = Entity::hsc($selectData['tabindex']);
1727 $aBlogIds = array_map('intval', $selectData['aBlogIds']);
1728 $showNewCat = intval($selectData['showNewCat']);
1729 $selected = intval($selectData['selected']);
1731 echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
1733 // 1. select blogs (we'll create optiongroups)
1734 // (only select those blogs that have the user on the team)
1735 $queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
1736 $queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
1737 $blogs = sql_query($queryBlogs);
1739 if ( $mode == 'category' )
1741 if ( sql_num_rows($blogs) > 1 )
1745 while ( $oBlog = sql_fetch_object($blogs) )
1747 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1749 echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\">\n";
1752 // show selection to create new category when allowed/wanted
1755 // check if allowed to do so
1756 if ( $member->blogAdminRights($oBlog->bnumber) )
1758 echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
1762 // 2. for each category in that blog
1763 $catQuery = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
1764 $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
1765 $categories = sql_query($catQuery);
1766 while ( $oCat = sql_fetch_object($categories) )
1768 if ( $oCat->catid == $selected )
1770 $selectText = ' selected="selected" ';
1776 echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . Entity::hsc($oCat->cname) . "</option>\n";
1779 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1788 while ( $oBlog = sql_fetch_object($blogs) )
1790 echo '<option value="' . $oBlog->bnumber . '"';
1791 if ( $oBlog->bnumber == $selected )
1793 echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . Entity::hsc($oBlog->bname) . "</option>\n";
1797 echo '<option value="' . $oBlog->bnumber . '">' . Entity::hsc($oBlog->bname) . "</option>\n";
1806 * AdminActions::parse_blogsetting()
1807 * Parse skinvar blogsetting
1809 * @param string $which name of weblog setting
1812 public function parse_blogsetting($which)
1814 echo $this->parse_getblogsetting($which);
1819 * AdminActions::parse_blogsettingyesno()
1820 * Parse skinvar blogsettingyesno
1822 * @param string $type type of weblog setting
1823 * @param string $templateName name of template to use
1826 public function parse_blogsettingyesno($type, $templateName = '')
1830 $blogid = intRequestVar('blogid');
1831 $blog = $manager->getBlog($blogid);
1835 case 'convertbreaks':
1836 $checkedval = $blog->convertBreaks();
1839 case 'allowpastposting':
1840 $checkedval = $blog->allowPastPosting();
1844 $checkedval = $blog->commentsEnabled();
1848 $checkedval = $blog->isPublic();
1852 $checkedval = $blog->emailRequired();
1856 $checkedval = $blog->getSearchable();
1860 $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName);
1865 * AdminActions::parse_blogteamlist()
1866 * Parse skinvar blogteamlist
1868 * @param string $templateName name of template to use
1871 public function parse_blogteamlist($templateName = '')
1874 $blogid = intRequestVar('blogid');
1875 $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "
1877 . "WHERE tmember=mnumber AND tblog= %d";
1878 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1880 $template['content'] = 'teamlist';
1881 $template['tabindex'] = 10;
1883 $batch = new Batch('team');
1884 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
1889 * AdminActions::parse_blogteammembers()
1890 * Parse skinvar blogteammembers
1895 public function parse_blogteammembers()
1897 $blogid = intRequestVar('blogid');
1898 $query = "SELECT mname, mrealname "
1900 . "WHERE mnumber=tmember AND tblog=%d;";
1901 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1902 $res = sql_query($query);
1903 $memberNames = array();
1904 while ( $o = sql_fetch_object($res) )
1906 $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
1908 echo implode(',', $memberNames);
1912 * AdminActions::parse_blogtime()
1913 * Parse skinvar blogtime
1915 * @param string $type type of time
1916 * @param string $format format for time expression
1917 * @param integer $offset offset of time
1920 public function parse_blogtime($type, $format = '%H:%M', $offset = 0)
1924 if ( $type != 'blogtime' )
1926 /* return server time */
1927 $timestamp = time() + $offset;
1931 $bid = intRequestVar('blogid');
1932 $b = $manager->getBlog($bid);
1933 $timestamp = $b->getCorrectTime() + $offset;
1936 echo i18n::formatted_datetime($format, $timestamp);
1941 * AdminActions::parse_bookmarkletadmin()
1942 * Parse skinvar bookmarkletadmin
1947 public function parse_bookmarkletadmin()
1951 $blogid = intRequestVar('blogid');
1953 echo Entity::hsc('javascript:' . getBookmarklet($blogid));
1958 * AdminActions::parse_categories()
1959 * Parse skinvar categories
1961 * create category dropdown box
1963 * @param string $type name of setting for category
1966 function parse_categories($startidx = 0)
1971 $itemid = intRequestVar('itemid');
1973 $item =& $manager->getItem($itemid, 1, 1);
1974 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
1976 if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
1978 $item['body'] = removeBreaks($item['body']);
1979 $item['more'] = removeBreaks($item['more']);
1982 $contents = array();
1983 if ( requestVar('action') == 'itemedit' )
1987 if ( isset($contents['catid']) && $contents['catid'] )
1989 $catid = $contents['catid']; // on edit item
1993 $catid = $blog->getDefaultCategory(); // on add item
1995 Admin::selectBlogCategory('catid', $catid, $startidx, 1, $blog->getID());
2000 * AdminActions::parse_category()
2001 * Parse skinvar category
2003 * @param string $type name of setting for category
2006 public function parse_category($type = 'name')
2008 echo $this->parse_getcategory($type);
2013 * AdminActions::parse_categorysetting()
2014 * Parse skinvar categorysetting
2016 * @param string $type type in category setting
2019 public function parse_categorysetting($type)
2021 $catid = intRequestVar('catid');
2022 if ( $type == 'id' )
2027 $blogid = intRequestVar('blogid');
2028 $query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
2029 $query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
2030 $res = sql_query($query);
2031 $obj = sql_fetch_object($res);
2033 if ( $type != 'name' )
2035 echo Entity::hsc($obj->cdesc);
2039 echo Entity::hsc($obj->cname);
2046 * AdminActions::parse_codename()
2047 * Parse templatevar codename
2053 function parse_checkedonval($value, $name)
2058 $itemid = intRequestVar('itemid');
2059 $item =& $manager->getItem($itemid, 1, 1);
2061 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
2063 if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
2065 $item['body'] = removeBreaks($item['body']);
2066 $item['more'] = removeBreaks($item['more']);
2069 $contents = array();
2070 if ( requestVar('action') == 'itemedit' )
2074 if ( !isset($contents[$name]) )
2076 $contents[$name] = '';
2078 if ($contents[$name] == $value)
2080 echo 'checked="checked"';
2086 * AdminActions::parse_codename()
2087 * Parse templatevar codename
2092 * TODO: is this need???
2094 public function parse_codename()
2097 echo $nucleus['codename'];
2102 * AdminActions::parse_commentnavlist()
2103 * Parse skinvar commentnavlist
2108 public function parse_commentnavlist()
2110 global $CONF, $manager, $member;
2113 if ( postVar('start') )
2115 $start = intPostVar('start');
2122 // amount of items to show
2123 if ( postVar('amount') )
2125 $amount = intPostVar('amount');
2129 $amount = (integer) $CONF['DefaultListSize'];
2135 $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
2137 . 'LEFT OUTER JOIN %s ON mnumber=cmember '
2139 $query = sprintf($query, sql_table('comment'), sql_table('member'));
2141 if ( $this->skintype == 'itemcommentlist' )
2143 $itemid = intRequestVar('itemid');
2144 $query .= " citem={$itemid}";
2145 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2147 $nonComments = _NOCOMMENTS;
2149 elseif ( $this->skintype == 'browseowncomments' )
2152 $query .= ' cmember=' . $member->getID();
2153 $template['canAddBan'] = 0;
2155 $nonComments = _NOCOMMENTS_YOUR;
2157 elseif ( $this->skintype == 'blogcommentlist' )
2160 $query .= ' cblog=' . intRequestVar('blogid');
2161 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2162 $bid = intRequestVar('blogid');
2163 $nonComments = _NOCOMMENTS_BLOG;
2166 $search = postVar('search');
2167 if ( !empty($search) )
2169 $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
2172 $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
2174 $template['content'] = 'commentlist';
2176 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
2177 $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
2182 * AdminActions::parse_configsettingsedit()
2183 * Parse skinvar configsettingsedit
2185 * @param string $type type of global configuration
2188 public function parse_configsettingsedit($type)
2193 case 'DefaultListSize':
2194 if ( !array_key_exists('DefaultListSize', $CONF) )
2196 $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
2197 $query = sprintf($query, sql_table('config'));
2199 $CONF['DefaultListSize'] = 10;
2201 elseif ( intval($CONF['DefaultListSize']) < 1 )
2203 $CONF['DefaultListSize'] = 10;
2205 echo intval($CONF['DefaultListSize']);
2207 case 'SessionCookie':
2208 $value = $CONF['SessionCookie'];
2209 $txt1 = _SETTINGS_COOKIESESSION;
2210 $txt2 = _SETTINGS_COOKIEMONTH;
2211 $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);
2214 $value = $CONF['URLMode'];
2215 $txt1 = _SETTINGS_URLMODE_NORMAL;
2216 $txt2 = _SETTINGS_URLMODE_PATHINFO;
2217 $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);
2220 if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )
2222 echo Entity::hsc($CONF[$type]);
2230 * AdminActions::parse_configsettingsyesno()
2231 * Parse skinvar configsettingsyesno
2233 * @param string $type type of global setting
2234 * @param integer $tabindex tabindex attribute of input element
2237 public function parse_configsettingsyesno($type, $tabindex)
2240 if ( array_key_exists($type, $CONF) )
2242 $this->parse_inputyesno($type, $CONF[$type], $tabindex);
2248 * AdminActions::parse_contents()
2249 * Parse skinvar contents
2251 * @param string $which part for item
2254 function parse_contents($which)
2259 $contents = array();
2261 if ( requestVar('action') == 'itemedit' )
2263 $itemid = intRequestVar('itemid');
2264 $item =& $manager->getItem($itemid, 1, 1);
2266 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
2268 if ( $item && $blog->convertBreaks() )
2270 $item['body'] = removeBreaks($item['body']);
2271 $item['more'] = removeBreaks($item['more']);
2275 elseif ( requestVar('action') == 'createitem' )
2277 $blogid = intRequestVar('blogid');
2278 $blog =& $manager->getBlog($blogid);
2282 'contents' => &$contents,
2288 if ( !array_key_exists($which, $contents) )
2290 $contents[$which] = '';
2292 echo Entity::hsc($contents[$which],ENT_QUOTES);
2296 * AdminActions::parse_currenttime()
2297 * Parse skinvar currenttime
2299 * @param string $what
2302 function parse_currenttime($what)
2305 if ( requestVar('action') == 'itemedit' )
2307 $itemid = intRequestVar('itemid');
2308 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
2310 elseif ( requestVar('action') == 'createitem' )
2312 $blog =& $manager->getBlog(intRequestVar('blogid'));
2314 $nu = getdate($blog->getCorrectTime());
2319 * AdminActions::parse_customhelplink()
2320 * Parse skinvar customhelplink
2322 * @param string $topic name of topic
2323 * @param string $tplName name of template
2324 * @param string $url string as URI
2325 * @param string $iconURL string as URI for icon
2326 * @param string $alt alternative text for image element
2327 * @param string $title title for anchor element
2330 public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
2332 $this->customHelp($topic, $url, $iconURL);
2337 * AdminActions::parse_date()
2338 * Parse skinvar date
2340 public function parse_date($format = 'c')
2342 global $CONF, $manager;
2343 echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
2348 * AdminActions::parse_defaultadminskintypes()
2349 * Parse skinvar defaultadminskintypes
2351 * @param string $tabindex index number for tabindex attribute of input element
2352 * @param string $templateName name of template
2355 public function parse_defaultadminskintypes($tabindex, $templateName = '')
2357 $templates = array();
2359 if ( $templateName )
2361 $templates = Template::read($templateName);
2364 $types = $this->skin->getAvailableTypes();
2367 /* NOTE: set templates for HEAD/BODY/FOOT */
2368 if ( !array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) || empty($templates['ADMINSKINTYPELIST_HEAD']) )
2370 $template['head'] = "<ul>\n";
2374 $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
2376 if ( !array_key_exists('ADMINSKINTYPELIST_BODY', $templates) || empty($templates['ADMINSKINTYPELIST_BODY']) )
2378 $template['body'] = "<li>"
2379 . "<a tabindex=\"<%tabindex%>\" href=\"index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>\"><%name%></a> <%help%>"
2384 $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
2386 if ( !array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) || empty($templates['ADMINSKINTYPELIST_FOOT']) )
2388 $template['foot'] = "</ul>\n";
2392 $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
2395 $handler = new AdminActions('template');
2396 $parser = new PARSER($handler);
2398 /* NOTE: do output */
2399 echo $template['head'];
2400 foreach ( $types as $type => $fName )
2402 $helplink = $this->customHelpHtml("skinpart{$type}{$templateName}");
2404 'tabindex' => $tabindex,
2405 'skintype' => $type,
2407 'help' => $helplink,
2408 'skinid' => intrequestVar('skinid'),
2410 $parser->parse(Template::fill($template['body'], $data));
2413 echo $template['foot'];
2419 * AdminActions::parse_defblogselect()
2420 * Parse skinvar defblogselect
2422 * @param string $templateName name of template
2425 public function parse_defblogselect($templateName = '')
2429 $query = "SELECT bname as text, bnumber as value FROM %s;";
2430 $query = sprintf($query, sql_table('blog'));
2432 $template['name'] = 'DefaultBlog';
2433 $template['selected'] = $CONF['DefaultBlog'];
2434 $template['tabindex'] = 10;
2436 Showlist($query, 'select', $template, $templateName);
2442 * AdminActions::parse_defcatselect()
2443 * Parse skinvar defcatselect
2445 * @param string $templateName name of template
2448 public function parse_defcatselect($templateName = '')
2452 $blogid = intRequestVar('blogid');
2453 $blog = $manager->getBlog($blogid);
2455 $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
2456 $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
2458 $template['name'] = 'defcat';
2459 $template['selected'] = $blog->getDefaultCategory();
2460 $template['tabindex'] = 110;
2462 Showlist($query, 'select', $template, $templateName);
2468 * AdminActions::parse_defskinselect()
2469 * Parse skinvar defskinselect
2471 * @param string $type type of skin
2472 * @param string $templateName name of template
2475 public function parse_defskinselect($type = 'blog', $templateName = '')
2477 global $CONF, $manager;
2479 $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname NOT LIKE 'admin/%%';";
2480 $query = sprintf($query, sql_table('skin_desc'));
2482 $blogid = intRequestVar('blogid');
2486 $template['selected'] = $CONF['BaseSkin'];
2490 $blog = $manager->getBlog($blogid);
2491 $template['selected'] = $blog->getDefaultSkin();
2494 if ( $type != 'blog' )
2496 $nname = 'BaseSkin';
2503 $template['name'] = $nname;
2504 $template['tabindex'] = 50;
2506 Showlist($query, 'select', $template, $templateName);
2512 * AdminActions::parse_deletecomment()
2513 * Parse skinvar deletecomment
2515 * @param string $type type of infomation for comment
2518 public function parse_deletecomment($type = 'id')
2520 $commentid = intRequestVar('commentid');
2521 $comment = COMMENT::getComment($commentid);
2526 echo intRequestVar('commentid');
2529 if ( array_key_exists('member', $comment) && !empty($comment['member']) )
2531 echo $comment['member'];
2535 echo $comment['user'];
2539 $body = strip_tags($comment['body']);
2540 echo Entity::hsc(shorten($body, 300, '...'));
2546 * AdminActions::parse_deleteitembody()
2547 * Parse skinvar deleteitembody
2552 public function parse_deleteitembody()
2556 $itemid = intRequestVar('itemid');
2557 $item =& $manager->getItem($itemid, 1, 1);
2559 $body = strip_tags($item['body']);
2561 echo Entity::hsc(shorten($body, 300, '...'));
2567 * AdminActions::parse_deleteitemid()
2568 * Parse skinvar deleteitemid
2573 public function parse_deleteitemid()
2575 echo (integer) intRequestVar('itemid');
2580 * AdminActions::parse_deleteitemtitle()
2581 * Parse skinvar deleteitemtitle
2586 public function parse_deleteitemtitle()
2590 $itemid = intRequestVar('itemid');
2591 $item =& $manager->getItem($itemid, 1, 1);
2593 echo Entity::hsc(strip_tags($item['title']));
2599 * AdminActions::parse_editadminskin()
2600 * Parse skinvar editadminskin
2602 * @param string $type type of skin setting
2605 public function parse_editadminskin($type = 'id')
2607 $skinid = intRequestVar('skinid');
2608 $skin = new Skin($skinid);
2612 echo intRequestVar('skinid');
2615 echo Entity::hsc($skin->getName());
2618 echo Entity::hsc($skin->getDescription());
2621 echo Entity::hsc($skin->getContentType());
2624 echo Entity::hsc($skin->getIncludePrefix());
2627 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2635 * AdminActions::parse_editadminskintype()
2636 * Parse skinvar editadminskintype
2638 * @param string $type name of skin type
2641 public function parse_editadminskintype($type = 'id')
2643 global $CONF, $manager, $member;
2645 $fNames = $this->skin->getAvailableTypes();
2646 $sType = strtolower(trim(requestVar('type')));
2651 echo intRequestVar('skinid');
2654 echo Entity::hsc($this->skin->getName());
2657 echo Entity::hsc($this->skin->getDescription());
2660 echo Entity::hsc($this->skin->getContentType());
2663 echo Entity::hsc($this->skin->getContentFromDB($sType));
2666 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2667 echo Entity::hsc($skinType);
2670 echo Entity::hsc($sType);
2673 echo Entity::hsc($this->skin->getIncludePrefix());
2676 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2677 echo Entity::hsc($incMode);
2686 * AdminActions::parse_editcomment()
2687 * Parse skinvar editcomment
2689 * @param string $type type of comment setting
2692 public function parse_editcomment($type = 'id')
2696 $commentid = intRequestVar('commentid');
2697 $comment = COMMENT::getComment($commentid);
2699 $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
2704 echo intRequestVar('commentid');
2707 if ( !array_key_exists('member', $comment) || empty($comment['member']) )
2709 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
2713 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
2717 echo date("Y-m-d @ H:i", $comment['timestamp']);
2720 $comment['body'] = str_replace('<br />', '', $comment['body']);
2721 $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
2722 echo $comment['body'];
2724 echo $comment[$type];
2731 * AdminActions::parse_editdesturl()
2732 * Parse skinvar editdesturl
2734 public function parse_editdesturl()
2736 if ( requestVar('desturl') )
2738 echo Entity::hsc(requestVar('desturl'));
2744 * AdminActions::parse_editmemberlist()
2745 * Parse skinvar editmemberlist
2747 * @param string $templateName name of template
2750 public function parse_editmemberlist($templateName = '')
2753 // show list of members with actions
2754 $query = 'SELECT * FROM '.sql_table('member');
2755 $template['content'] = 'memberlist';
2756 $template['tabindex'] = 10;
2758 $batch = new Batch('member');
2759 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
2764 * AdminActions::parse_editmember()
2765 * Parse skinvar editmember
2767 * @param string $type type of information for member
2768 * @return string $tempateName name of template to use
2771 public function parse_editmember($type = 'id', $templateName = '')
2773 global $CONF, $manager, $member;
2775 $memberid = intRequestVar('memberid');
2776 $mem = MEMBER::createFromID($memberid);
2781 echo intRequestVar('memberid');
2784 if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
2786 echo Entity::hsc($mem->getDisplayName());
2790 $dispName = Entity::hsc($mem->getDisplayName());
2791 if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
2793 echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
2802 echo Entity::hsc($mem->getRealName());
2805 echo Entity::hsc($mem->getEmail());
2808 echo Entity::hsc($mem->getURL());
2811 $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
2814 $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
2817 echo Entity::hsc($mem->getNotes());
2820 $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
2829 * AdminActions::parse_editpluginfo()
2830 * Parse skinvar editpluginfo
2832 * @param string $type type of plugin info
2835 public function parse_editpluginfo($type)
2837 $pid = intRequestVar('plugid');
2844 echo Entity::hsc(getPluginNameFromPid($pid));
2851 * AdminActions::parse_editplugoptionslist()
2852 * Parse skinvar editplugoptionslist
2854 * @param string $templateName name of template
2857 public function parse_editplugoptionslist($templateName = '')
2861 $pid = intRequestVar('plugid');
2862 $aOptions = array();
2865 $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC;";
2866 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
2867 $resource = sql_query($query);
2869 while ( $o = sql_fetch_object($resource) )
2871 array_push($aOIDs, $o->oid);
2872 $aOptions[$o->oid] = array(
2874 'value' => $o->odef,
2875 'name' => $o->oname,
2876 'description' => $o->odesc,
2877 'type' => $o->otype,
2878 'typeinfo' => $o->oextra,
2883 // fill out actual values
2884 if ( count($aOIDs) > 0 )
2886 $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
2887 $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
2889 $result = sql_query($query);
2891 while ( $o = sql_fetch_object($result) )
2893 $aOptions[$o->oid]['value'] = $o->ovalue;
2899 'context' => 'global',
2901 'options' => &$aOptions
2903 $manager->notify('PrePluginOptionsEdit', $data);
2905 $template['content'] = 'plugoptionlist';
2907 $amount = Showlist($aOptions, 'table', $template, $templateName);
2911 echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
2917 * AdminActions::parse_editskin()
2918 * Parse skinvar editskin
2920 * @param string $type type of skin
2923 public function parse_editskin($type = 'id')
2925 $skinid = intRequestVar('skinid');
2926 $skin = new SKIN($skinid);
2930 echo intRequestVar('skinid');
2933 echo Entity::hsc($skin->getName());
2936 echo Entity::hsc($skin->getDescription());
2939 echo Entity::hsc($skin->getContentType());
2942 echo Entity::hsc($skin->getIncludePrefix());
2945 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2953 * AdminActions::parse_editskintype()
2954 * Parse skinvar editskintype
2956 * @param string $type name of type for skin type
2959 public function parse_editskintype($type = 'id')
2961 global $CONF, $manager, $member;
2962 $skinid = intRequestVar('skinid');
2963 $skin = new SKIN($skinid);
2964 $fNames = $skin->getAvailableTypes();
2965 $sType = strtolower(trim(requestVar('type')));
2970 echo intRequestVar('skinid');
2973 echo Entity::hsc($skin->getName());
2976 echo Entity::hsc($skin->getDescription());
2979 echo Entity::hsc($skin->getContentType());
2982 echo Entity::hsc($skin->getContentFromDB($sType));
2985 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2986 echo Entity::hsc($skinType);
2989 echo Entity::hsc($sType);
2992 echo Entity::hsc($skin->getIncludePrefix());
2995 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2996 echo Entity::hsc($incMode);
3005 * AdminActions::parse_adminurl()
3006 * Parse skinvar adminurl
3007 * (shortcut for admin url)
3012 public function parse_adminurl()
3014 $this->parse_sitevar('adminurl');
3019 * AdminActions::parse_edittemplateinfo()
3020 * Parse skinvar edittemplateinfo
3022 * @param string $type name of type for skin
3023 * @param string $description description for skin
3024 * @param string $name name of skin
3025 * @param string $help
3026 * @param string $tabindex index value for tabindex attribute of input element
3027 * @param string $big
3028 * @param string $tplt name of template
3031 public function parse_edittemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
3035 $t_id = intRequestVar('templateid');
3036 $t_name = Template::getNameFromId($t_id);
3037 $t_desc = Template::getDesc($t_id);
3038 $template = &Template::read($t_name);
3046 echo Entity::hsc($t_name);
3049 echo Entity::hsc($t_desc);
3051 case 'extratemplate':
3053 $pluginfields = array();
3054 $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields));
3059 $tmplt = Template::read($desc);
3061 if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
3065 . '<th colspan="2"><%explugtplname%>' . "</th>\n";
3069 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
3072 foreach ( $pluginfields as $pfkey => $pfvalue )
3074 $data = array('explugtplname' => Entity::hsc($pfkey));
3076 echo Template::fill($base, $data);
3078 foreach ( $pfvalue as $pffield => $pfdesc )
3080 $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
3085 $desc = defined($desc) ? constant($desc) : $desc;
3086 $name = defined($name) ? constant($name) : $name;
3087 $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
3095 * AdminActions::parse_editadmintemplateinfo()
3096 * Parse skinvar editadmintemplateinfo
3098 * @param string $type type of skin template
3099 * @param string $description description of template
3100 * @param string $name name of stemplate
3101 * @param string $tabindex index number for tabindex attribute of input element
3102 * @param string $big
3103 * @param string $tplt
3105 public function parse_editadmintemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
3109 $t_id = intRequestVar('templateid');
3110 $t_name = Template::getNameFromId($t_id);
3111 $t_desc = Template::getDesc($t_id);
3112 $template = &Template::read($t_name);
3120 echo Entity::hsc($t_name);
3123 echo Entity::hsc($t_desc);
3125 case 'extratemplate':
3127 $pluginfields = array();
3128 $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields));
3133 $tmplt = Template::read($desc);
3135 if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
3139 . '<th colspan="2"><%explugtplname%>' . "</th>\n";
3143 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
3146 foreach ( $pluginfields as $pfkey => $pfvalue )
3148 $data = array('explugtplname' => Entity::hsc($pfkey));
3150 echo Template::fill($base, $data);
3152 foreach ( $pfvalue as $pffield => $pfdesc )
3154 $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
3159 $desc = defined($desc) ? constant($desc) : $desc;
3160 $name = defined($name) ? constant($name) : $name;
3161 $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
3168 * AdminActions::parse_eventformextra()
3169 * Parse skinvar eventformextra
3171 * @param string $type name of type for event form extra
3174 public function parse_eventformextra($type = 'activation')
3183 $key = requestVar('ackey');
3186 Admin::error(_ERROR_ACTIVATE);
3188 $info = MEMBER::getActivationInfo($key);
3191 Admin::error(_ERROR_ACTIVATE);
3193 $mem = MEMBER::createFromId($info->vmember);
3196 Admin::error(_ERROR_ACTIVATE);
3199 'type' => 'activation',
3203 case 'membermailform-notloggedin':
3204 $data = array('type' => 'membermailform-notloggedin',);
3207 $manager->notify('FormExtra', $data);
3212 * AdminActions::parse_extrahead()
3213 * Parse skinvar extrahead
3215 public function parse_extrahead()
3219 $extrahead = Admin::getAdminextrahead();
3222 'extrahead' => &$extrahead,
3223 'action' => Admin::getAdminAction()
3226 $manager->notify('AdminPrePageHead', $data);
3232 * AdminActions::parse_member()
3233 * Parse skinvar member
3234 * (includes a member info thingie)
3236 * @param string $what which memberdata is needed
3239 public function parse_member($what)
3241 global $memberinfo, $member, $CONF;
3243 // 1. only allow the member-details-page specific variables on member pages
3244 if ( $this->skintype == 'member' )
3249 echo Entity::hsc($memberinfo->getDisplayName());
3252 echo Entity::hsc($memberinfo->getRealName());
3255 echo Entity::hsc($memberinfo->getNotes());
3258 echo Entity::hsc($memberinfo->getURL());
3261 echo Entity::hsc($memberinfo->getEmail());
3264 echo Entity::hsc($memberinfo->getID());
3269 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3270 if ( $member->isLoggedIn() )
3275 echo $member->getDisplayName();
3277 case 'yourrealname':
3278 echo $member->getRealName();
3281 echo $member->getNotes();
3284 echo $member->getURL();
3287 echo $member->getEmail();
3290 echo $member->getID();
3292 case 'yourprofileurl':
3293 if ( $CONF['URLMode'] == 'pathinfo' )
3295 echo Link::create_member_link($member->getID());
3299 echo $CONF['IndexURL'] . Link::create_member_link($member->getID());
3308 * AdminActions::parse_version()
3309 * Parse skinvar version
3310 * (include nucleus versionnumber)
3315 public function parse_version()
3318 echo 'Nucleus CMS ' . $nucleus['version'];
3323 * AdminActions::parse_sitevar()
3324 * Parse skinvar sitevar
3325 * (include a sitevar)
3327 * @param string $which
3330 public function parse_sitevar($which)
3336 echo $CONF['IndexURL'];
3339 echo $CONF['SiteName'];
3342 echo $CONF['AdminEmail'];
3345 echo $CONF['AdminURL'];
3351 * AdminActions::parse_charset()
3352 * Parse skinvar charset
3357 public function parse_charset()
3359 echo i18n::get_current_charset();
3364 * AdminActions::parse_getblogsetting()
3365 * Parse skinvar getblogsetting
3367 public function parse_getblogsetting($which)
3375 elseif ( $bid = intRequestVar('blogid') )
3378 $b = $manager->getBlog($bid);
3388 return Entity::hsc($b->getID());
3391 return Entity::hsc($b->getURL());
3394 return Entity::hsc($b->getName());
3397 return Entity::hsc($b->getDescription());
3400 return Entity::hsc($b->getShortName());
3402 case 'notifyaddress':
3403 return Entity::hsc($b->getNotifyAddress());
3406 return Entity::hsc($b->getMaxComments());
3409 return Entity::hsc($b->getUpdateFile());
3412 return Entity::hsc($b->getTimeOffset());
3419 * AdminActions::parse_geteditpluginfo()
3420 * Parse skinvar geteditpluginfo
3422 * @param string $type name of setting for edit plugin info
3425 public function parse_geteditpluginfo($type)
3427 $pid = intRequestVar('plugid');
3434 return Entity::hsc(getPluginNameFromPid($pid));
3441 * AdminActions::parse_getmember()
3442 * Parse skinvar getmember
3443 * (includes a member info thingie)
3445 * @param string $what name of setting for member
3448 public function parse_getmember($what)
3450 global $memberinfo, $member;
3451 // 1. only allow the member-details-page specific variables on member pages
3452 if ( $this->skintype == 'member' )
3457 return Entity::hsc($memberinfo->getDisplayName());
3460 return Entity::hsc($memberinfo->getRealName());
3463 return Entity::hsc($memberinfo->getNotes());
3466 return Entity::hsc($memberinfo->getURL());
3469 return Entity::hsc($memberinfo->getEmail());
3472 return Entity::hsc($memberinfo->getID());
3476 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3477 if ( $member->isLoggedIn() )
3482 return $member->getDisplayName();
3484 case 'yourrealname':
3485 return $member->getRealName();
3488 return $member->getNotes();
3491 return $member->getURL();
3494 return $member->getEmail();
3497 return $member->getID();
3505 * AdminActions::parse_headmessage()
3506 * Parse skinvar headmessage
3511 public function parse_headmessage()
3513 if ( !empty(Admin::$headMess) )
3515 echo '<p>' . _MESSAGE . ': ' . Entity::hsc(Admin::$headMess) . "</p>\n";
3521 * AdminActions::parse_helplink()
3522 * Parse skinvar helplink
3524 * @param string $topic name of topic for help
3527 public function parse_helplink($topic = '')
3529 if ( !empty($topic) )
3537 * AdminActions::parse_helpplugname()
3538 * Parse skinvar helpplugname
3543 public function parse_helpplugname()
3545 $plugid = intGetVar('plugid');
3546 Entity::hsc(getPluginNameFromPid($plugid));
3551 * AdminActions::parse_ilistaddnew()
3552 * Parse skinvar ilistaddnew
3557 public function parse_ilistaddnew()
3559 $blogid = intRequestVar('blogid');
3560 if ( intPostVar('start') == 0 )
3562 echo '<p><a href="index.php?action=createitem&blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";
3568 * AdminActions::parse_importskininfo()
3569 * Parse skinvar importskininfo
3571 * @param string $type name of information for imported skin
3574 public function parse_importskininfo($type)
3579 echo Entity::hsc(requestVar('skininfo'));
3582 $dataArr = requestArray('skinnames');
3583 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3586 $dataArr = requestArray('tpltnames');
3587 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3590 $dataArr = requestArray('skinclashes');
3591 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3594 $dataArr = requestArray('tpltclashes');
3595 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3598 echo Entity::hsc(requestVar('skinfile'));
3601 echo Entity::hsc(requestVar('mode'));
3608 * AdminActions::parse_inputyesno()
3609 * Parse skinvar inputyesno
3611 * some init stuff for all forms
3616 function parse_init()
3621 if ( requestVar('action') == 'itemedit' )
3623 $itemid = intRequestVar('itemid');
3624 $item =& $manager->getItem($itemid, 1, 1);
3626 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
3627 if ( $item && $blog->convertBreaks() )
3629 $item['body'] = removeBreaks($item['body']);
3630 $item['more'] = removeBreaks($item['more']);
3633 $authorid = $contents['authorid'];
3635 elseif ( requestVar('action') == 'createitem' )
3637 $blogid = intRequestVar('blogid');
3638 $blog =& $manager->getBlog($blogid);
3641 $blog->insertJavaScriptInfo($authorid);
3646 * AdminActions::parse_inputyesno()
3647 * Parse skinvar inputyesno
3649 * @param string $name
3650 * @param string $checkedval
3651 * @param string $tabindex
3652 * @param string $value1
3653 * @param string $value2
3654 * @param string $yesval
3655 * @param string $noval
3656 * @param string $isAdmin
3657 * @param string $templateName
3660 public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
3662 self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
3667 * AdminActions::parse_insertpluginfo()
3668 * Parse templatevar insertpluginfo
3670 public function parse_insertpluginfo($type)
3672 $option = Admin::$aOptions;
3676 return $option['pid'];
3679 return Entity::hsc($option['pfile']);
3686 * AdminActions::parse_insertpluginoptions()
3687 * Parse skinvar insertpluginoptions
3689 * @param string $templateName name of template
3692 public function parse_insertpluginoptions($templateName = '')
3694 $options = Admin::getAdminaOption();
3695 $template = array();
3696 $templats = array();
3698 if ( $templateName )
3700 $templates = Template::read($templateName);
3702 if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
3704 $template['title'] = "<tr>"
3705 . "<th colspan=\"2\"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>"
3710 $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
3712 if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
3714 $template['body'] = "<tr>"
3715 . "<%listplugplugoptionrow%>"
3720 $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
3725 include_libs('ACTIONS.php');
3726 $handler = new Actions($this->skintype);
3727 $parser = new PARSER($handler);
3729 foreach ( $options as $option )
3733 if ( $prevPid != $option['pid'] )
3735 $prevPid = $option['pid'];
3736 $parser->parse($template['title']);
3739 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3741 if ( @$meta['access'] != 'hidden' )
3743 $parsed = $parser->parse($template['body']);
3750 * AdminActions::parse_insplugoptcontent()
3751 * Parse skinvar insplugoptcontent
3756 public function parse_insplugoptcontent()
3758 $option = Admin::$aOption;
3760 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3761 if ( array_key_exists('access', $meta) && $meta['access'] != 'hidden' )
3764 listplug_plugOptionRow($option);
3771 * AdminActions::parse_iprangeinput()
3772 * Parse skinvar iprangeinput
3777 public function parse_iprangeinput()
3779 if ( requestVar('ip') )
3781 $iprangeVal = Entity::hsc(requestVar('ip'));
3782 echo "<input name=\"iprange\" type=\"radio\" value=\"{$iprangeVal}\" checked=\"checked\" id=\"ip_fixed\" />\n";
3783 echo "<label for=\"ip_fixed\">{$iprangeVal}</label><br />\n";
3784 echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
3785 echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
3786 echo "<input name=\"customiprange\" value=\"{$iprangeVal}\" maxlength=\"15\" size=\"15\" />\n";
3790 echo '<input name="iprange" value="custom" type="hidden" />' . "\n";
3791 echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";
3797 * AdminActions::parse_itemnavlist()
3798 * Parse skinvar itemnavlist
3803 public function parse_itemnavlist()
3805 global $CONF, $manager, $member;
3806 if ( $this->skintype == 'itemlist' )
3808 $blogid = intRequestVar('blogid');
3809 $blog =& $manager->getBlog($blogid);
3811 if ( postVar('start') )
3813 $start = intPostVar('start');
3820 // amount of items to show
3821 if ( postVar('amount') )
3823 $amount = intPostVar('amount');
3827 $amount = intval($CONF['DefaultListSize']);
3833 $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
3834 . " FROM %s, %s, %s, %s"
3835 . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid";
3837 $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
3839 if ( $this->skintype == 'itemlist' )
3841 $query .= ' AND iblog = ' . $blogid;
3842 $template['now'] = $blog->getCorrectTime(time());
3844 // non-blog-admins can only edit/delete their own items
3845 if ( !$member->blogAdminRights($blogid) )
3847 $query .= ' AND iauthor = ' . $member->getID();
3850 elseif ( $this->skintype == 'browseownitems' )
3852 $query .= ' AND iauthor = ' . $member->getID();
3854 $template['now'] = time();
3857 // search through items
3858 $search = postVar('search');
3860 if ( !empty($search) )
3862 $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
3863 . ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
3864 . ' OR (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
3866 $query .= ' ORDER BY itime DESC'
3867 . " LIMIT {$start},{$amount}";
3869 $template['content'] = 'itemlist';
3871 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
3872 $navList->showBatchList('item', $query, 'table', $template);
3877 * AdminActions::parse_itemoptions()
3878 * Parse skinvar itemoptions
3879 * Adds the itemOptions of a plugin to a page
3882 function parse_itemoptions()
3884 $this->parse_pluginoptions('item');
3889 * AdminActions::parse_itemoptions()
3891 * date change on edit item
3893 * Parse skinvar itemoptions
3894 * Adds the itemOptions of a plugin to a page
3897 function parse_itemtime($what)
3902 $itemid = intRequestVar('itemid');
3903 $item =& $manager->getItem($itemid, 1, 1);
3905 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
3907 if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
3909 $item['body'] = removeBreaks($item['body']);
3910 $item['more'] = removeBreaks($item['more']);
3913 $contents = array();
3914 if ( requestVar('action') == 'itemedit' )
3918 elseif ( requestVar('action') == 'createitem' )
3921 'contents' => &$contents,
3922 'blog' => &$this->blog
3924 $manager->notify('PreAddItemForm', $data);
3926 $itemtime = getdate($contents['timestamp']);
3927 echo $itemtime[$what];
3932 * AdminActions::parse_jstoolbaroptions()
3933 * Parse skinvar jstoolbaroptions
3938 public function parse_jstoolbaroptions()
3942 _SETTINGS_JSTOOLBAR_NONE,
3943 _SETTINGS_JSTOOLBAR_SIMPLE,
3944 _SETTINGS_JSTOOLBAR_FULL
3948 foreach ( $options as $option )
3950 $text = "<option value=\"%d\"%s>%s</option>\n";
3951 $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';
3952 echo sprintf($text, $i, $extra, $option);
3958 * Parse skinvar languageselectoptions
3960 function parse_languageselectoptions()
3962 $locales = i18n::get_available_locale_list();
3963 $memid = intRequestVar('memberid');
3967 $mem = MEMBER::createFromID($memid);
3968 if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
3970 echo "<option value=\"\" selected=\"selected\">" . ENTITY::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3974 echo "<option value=\"\">" . ENTITY::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3979 if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
3981 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
3984 foreach ( $locales as $locale )
3988 if ( $locale == $mem->getLocale() )
3990 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3994 echo "<option value=\"{$locale}\">{$locale}</option>\n";
3999 if ( $locale == i18n::get_current_locale() )
4001 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
4005 echo "<option value=\"{$locale}\">{$locale}</option>\n";
4013 * AdminActions::parse_localeselectoptions()
4014 * Parse skinvar localeselectoptions
4019 public function parse_localeselectoptions()
4021 $locales = i18n::get_available_locale_list();
4023 $memid = intRequestVar('memberid');
4026 $mem = MEMBER::createFromID($memid);
4027 if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
4029 echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
4033 echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
4038 if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
4040 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
4043 foreach ( $locales as $locale )
4047 if ( $locale == $mem->getLocale() )
4049 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
4053 echo "<option value=\"{$locale}\">{$locale}</option>\n";
4058 if ( $locale == i18n::get_current_locale() )
4060 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
4064 echo "<option value=\"{$locale}\">{$locale}</option>\n";
4072 * AdminActions::parse_listplugplugoptionrow()
4073 * Parse templatevar listplugplugoptionrow
4075 * @param string $templateName name of template
4078 public function parse_listplugplugoptionrow($templateName = '')
4080 echo listplug_plugOptionRow(Admin::$aOptions, $templateName);
4085 * AdminActions::parse_mediadirwarning()
4086 * Parse skinvar mediadirwarning
4091 public function parse_mediadirwarning()
4094 if ( !is_dir($DIR_MEDIA) )
4096 echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";
4098 if ( !is_readable($DIR_MEDIA) )
4100 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";
4102 if ( !is_writeable($DIR_MEDIA) )
4104 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";
4110 * AdminActions::parse_movedistselect()
4111 * Parse skinvar movedistselect
4113 public function parse_movedistselect()
4115 $actionType = requestVar('action');
4116 switch ( $actionType )
4119 Admin::selectBlogCategory('destcatid');
4121 case 'batchcategory':
4122 Admin::selectBlog('destblogid');
4125 if ( $this->skintype == 'itemmove' )
4127 $query = "SELECT icat as result FROM %s WHERE inumber=%d;";
4128 $query = sprintf($query, sql_table('item'), intRequestVar('itemid'));
4129 $catid = quickQuery(sprintf($query, intRequestVar('itemid')));
4130 Admin::selectBlogCategory('catid', $catid, 10, 1);
4138 * AdminActions::parse_moveitemid()
4139 * Parse skinvar moveitemid
4144 public function parse_moveitemid()
4146 echo intRequestVar('itemid');
4151 * AdminActions::parse_newestcompare()
4152 * Parse skinvar newestcompare
4157 public function parse_newestcompare()
4161 $newestVersion = getLatestVersion();
4162 $newestCompare = str_replace('/', '.', $newestVersion);
4163 $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
4165 if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
4167 echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
4168 echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
4174 * AdminActions::parse_newmemberselect()
4175 * Parse skinvar newmemberselect
4177 * @param string $templateName name of template to use
4180 public function parse_newmemberselect($templateName = '')
4182 $blogid = intRequestVar('blogid');
4184 $query = "SELECT tmember FROM %s WHERE tblog=%d;";
4185 $query = sprintf($query, sql_table('team'), (integer) $blogid);
4186 $res = sql_query($query);
4189 while ( $tmember = sql_fetch_object($res) )
4191 $tmem[] = intval($tmember->tmember);
4194 $query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
4195 $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
4197 $template['name'] = 'memberid';
4198 $template['tabindex'] = 10000;
4199 Showlist($query, 'select', $template, $templateName);
4204 * AdminActions::parse_newpluginlist()
4205 * Parse skinvar newpluginlist
4210 public function parse_newpluginlist()
4212 $candidates = $this->newPlugCandidates;
4213 foreach ( $candidates as $name )
4215 echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";
4221 * AdminActions::parse_outputspecialdirs()
4222 * Parse skinvar outputspecialdirs
4224 * @param string $type type of setting for directory
4227 public function parse_outputspecialdirs($type)
4229 global $DIR_MEDIA, $DIR_NUCLEUS;
4234 echo Entity::hsc($DIR_NUCLEUS);
4237 echo Entity::hsc($DIR_MEDIA);
4244 * AdminActions::parse_passrequestvars()
4245 * Parse skinvar passrequestvars
4250 public function parse_passrequestvars()
4252 $passvar = Admin::getAdminpassvar();
4253 $oldaction = postVar('oldaction');
4255 if ( ($oldaction != 'logout')
4256 && ($oldaction != 'login')
4258 && !postVar('customaction') )
4266 * AdminActions::parse_pluginextras()
4267 * Parse skinvar pluginextras
4269 * @param string $type type of plugin context
4272 public function parse_pluginextras($type = 'global')
4278 $id = intRequestVar('memberid');
4279 $mem = MEMBER::createFromID($id);
4280 $manager->notify('MemberSettingsFormExtras', array('member' => &$mem));
4283 $id = intRequestVar('blogid');
4284 $blg = $manager->getBlog($id);
4285 $manager->notify('BlogSettingsFormExtras', array('member' => &$blg));
4289 'GeneralSettingsFormExtras',
4299 * AdminActions::parse_pluginhelp()
4300 * Parse skinvar pluginhelp
4305 public function parse_pluginhelp()
4307 global $manager, $DIR_PLUGINS;
4309 $plugid = intGetVar('plugid');
4310 $plugName = getPluginNameFromPid($plugid);
4311 $plug =& $manager->getPlugin($plugName);
4313 if ( $plug->supportsFeature('HelpPage') > 0 )
4315 $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
4316 if ( @file_exists($helpfile . 'php') )
4318 @include($helpfile . 'php');
4321 elseif ( @file_exists($helpfile . 'html') )
4323 @include($helpfile . 'html');
4327 echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";
4328 echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";
4333 * AdminActions::parse_pluginlistlist()
4334 * Parse skinvar pluginlistlist
4336 * @param string $templateName name of template to use
4339 public function parse_pluginlistlist($templateName = '')
4341 $query = "SELECT * FROM %s ORDER BY porder ASC;";
4342 $query = sprintf($query, sql_table('plugin'));
4344 $template['content'] = 'pluginlist';
4345 $template['tabindex'] = 10;
4347 Showlist($query, 'table', $template, $templateName);
4353 * AdminActions::parse_pluginoptions()
4354 * Parse skinvar pluginoptions
4356 * @param string $type type of plugin option
4359 public function parse_pluginoptions($type = 'global')
4366 $id = intRequestVar('memberid');
4369 $id = intRequestVar('blogid');
4372 $id = intRequestVar('catid');
4378 Admin::insertPluginOptions($type, $id);
4383 * AdminActions::parse_qmenuaddselect()
4384 * Parse skinvar qmanuaddselect
4386 * @param string $templateName name of template to use
4389 public function parse_qmenuaddselect($templateName = '')
4392 $showAll = requestVar('showall');
4393 if ( $member->isAdmin() && ($showAll == 'yes') )
4395 // Super-Admins have access to all blogs! (no add item support though)
4396 $query = 'SELECT bnumber as value, bname as text'
4397 . ' FROM ' . sql_table('blog')
4398 . ' ORDER BY bname';
4402 $query = 'SELECT bnumber as value, bname as text'
4403 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
4404 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
4405 . ' ORDER BY bname';
4408 $template['name'] = 'blogid';
4409 $template['tabindex'] = 15000;
4410 $template['extra'] = _QMENU_ADD_SELECT;
4411 $template['selected'] = -1;
4412 $template['shorten'] = 10;
4413 $template['shortenel'] = '';
4414 $template['javascript'] = 'onchange="return form.submit()"';
4416 Showlist($query, 'select', $template, $templateName);
4422 * AdminActions::parse_quickmenu()
4423 * Parse skinvar quickmenu
4425 * @param string $templateName name of template to use
4428 public function parse_quickmenu($templateName = '')
4431 $templates = array();
4432 $template = array();
4433 if ( !empty($templateName) )
4435 $templates = Template::read($templateName);
4437 $pluginExtras = array();
4441 'options' => &$pluginExtras
4444 if ( count($pluginExtras) > 0 )
4446 if ( !array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || empty($templates['PLUGIN_QUICKMENU_TITLE']) )
4448 $template['title'] = "<h2><%text(_QMENU_PLUGINS)%></h2>\n";
4452 $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
4454 if ( !array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || empty($templates['PLUGIN_QUICKMENU_HEAD']) )
4456 $template['head'] = "<ul>\n";
4460 $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
4462 if ( !array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) && empty($templates['PLUGIN_QUICKMENU_BODY']) )
4464 $template['body'] = "<li><a href=\"<%plugadminurl%>\" title=\"<%plugadmintooltip%>\"><%plugadmintitle%></a></li>\n";
4468 $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
4470 if ( !array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || empty($templates['PLUGIN_QUICKMENU_FOOT']) )
4472 $template['foot'] = "</ul>\n";
4476 $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
4479 $handler = new Actions($this->skintype);
4480 $parser = new PARSER($handler);
4482 $parser->parse($template['title']);
4483 echo $template['head'];
4484 foreach ( $pluginExtras as $aInfo )
4487 'plugadminurl' => Entity::hsc($aInfo['url']),
4488 'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
4489 'plugadmintitle' => Entity::hsc($aInfo['title']),
4491 echo Template::fill($template['body'], $data);
4493 echo $template['foot'];
4499 * AdminActions::parse_requestblogid()
4500 * Parse skinvar requestblogid
4505 public function parse_requestblogid()
4507 echo intRequestVar('blogid');
4512 * AdminActions::parse_requestiprange()
4513 * Parse skinvar requestiprange
4518 public function parse_requestiprange()
4520 if ( requestVar('iprange') )
4522 echo Entity::hsc(requestVar('iprange'));
4524 elseif ( requestVar('ip') )
4526 echo Entity::hsc(requestVar('ip'));
4532 * AdminActions::parse_selectlocaladminskinfiles()
4533 * Parse skinvar selectlocaladminskinfiles
4538 public function parse_selectlocaladminskinfiles()
4540 global $DIR_SKINS, $manager;
4542 $adminskindir = $DIR_SKINS . 'admin/';
4543 $candidates = SkinImport::searchForCandidates($adminskindir);
4545 foreach ( $candidates as $skinname => $skinfile )
4547 $html = Entity::hsc($skinfile);
4548 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4555 * AdminActions::parse_selectlocalskinfiles()
4556 * Parse skinvar selectlocalskinfiles
4561 public function parse_selectlocalskinfiles()
4565 $candidates = SkinImport::searchForCandidates($DIR_SKINS);
4567 foreach ( $candidates as $skinname => $skinfile )
4569 $html = Entity::hsc($skinfile);
4570 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4577 * AdminActions::parse_skineditallowedlist()
4578 * Parse skinvar skineditallowedlist
4580 * @param string $type type of skin
4581 * @param string $templateName name of template
4584 public function parse_skineditallowedlist($type, $templateName = '')
4589 $query = "SELECT bshortname, bname FROM %s;";
4591 'content' => 'shortblognames'
4593 $query = sprintf($query, sql_table('blog'));
4594 Showlist($query, 'table', $show, $templateName);
4597 $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname NOT LIKE 'admin/%%';";
4599 'content' => 'shortnames'
4601 $query = sprintf($query, sql_table('template_desc'));
4602 Showlist($query, 'table', $show, $templateName);
4609 * AdminActions::parse_skinielist()
4610 * Parse skinvar skinielist
4612 * @param string $type type of skin
4613 * @param string $templateName name of template to use
4616 public function parse_skinielist($type, $templateName = '')
4618 $templates = array();
4619 if ( $templateName )
4621 $templates = Template::read($templateName);
4623 if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
4625 $template = $templates['SKINIE_EXPORT_LIST'];
4630 . "<input type=\"checkbox\" name=\"<%typeid%>\" id=\"<%expid%>\" />\n"
4631 . "<label for=\"<%expid%>\"><%expname%></label>\n"
4633 . "<td><%expdesc%></td>\n"
4640 $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
4641 while ( $skinObj = sql_fetch_object($res) )
4644 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
4645 'expid' => 'skinexp' . $skinObj->sdnumber,
4646 'expname' => Entity::hsc($skinObj->sdname),
4647 'expdesc' => Entity::hsc($skinObj->sddesc),
4649 echo Template::fill($template, $data);
4653 $res = sql_query('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%%';");
4654 while ($templateObj = sql_fetch_object($res)) {
4656 'typeid' => 'template[' . $templateObj->tdnumber . ']',
4657 'expid' => 'templateexp' . $templateObj->tdnumber,
4658 'expname' => Entity::hsc($templateObj->tdname),
4659 'expdesc' => Entity::hsc($templateObj->tddesc),
4661 echo Template::fill($template, $data);
4669 * AdminActions::parse_skinoverview()
4670 * Parse skinvar skinoverview
4672 * @param string $templateName name of template to use
4675 public function parse_skinoverview($templateName = '')
4678 $query = "SELECT * FROM %s WHERE sdname NOT LIKE 'admin/%%';";
4679 $query = sprintf($query, sql_table('skin_desc'));
4681 $template['content'] = 'skinlist';
4682 $template['tabindex'] = 10;
4684 Showlist($query, 'table', $template, $templateName);
4689 * AdminActions::parse_skintypehelp()
4690 * Check editing skintypehelp
4695 public function parse_skintypehelp()
4697 $nowSkinType = strtolower(trim(requestVar('type')));
4699 /* TODO: use Skin class */
4700 $regularType = array(
4711 if ( in_array($nowSkinType, $regularType) )
4713 help('skinpart' . $nowSkinType);
4717 help('skinpartspecial');
4723 * AdminActions::parse_specialskinlist()
4724 * Parse skinvar specialskinlist
4726 * @param string $templateName name of template to use
4729 public function parse_specialskinlist($templateName = '')
4731 $templates = array();
4732 if ( $templateName )
4734 $templates = Template::read($templateName);
4737 /* TODO: use Skin class */
4748 $skinid = intRequestVar('skinid');
4749 $query = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
4750 $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
4752 $res = sql_query($query);
4753 if ( $res && sql_num_rows($res) > 0 )
4756 if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
4758 $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
4762 $template['head'] = "<ul>\n";
4764 echo Template::fill($template['head'], $data);
4765 if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
4767 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&skinid=<%skinid%>'
4768 . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
4769 . 'action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
4773 $template['body'] = $templates['SPECIALSKINLIST_BODY'];
4777 while ( $row = sql_fetch_assoc($res) )
4780 'tabindex' => $tabstart++,
4781 'skinid' => $skinid,
4782 'skintype' => Entity::hsc(strtolower($row['stype']))
4784 echo Template::fill($template['body'], $data);
4787 if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
4789 $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
4793 $template['foot'] = "</ul>\n";
4795 echo Template::fill($template['foot'], $data);
4801 * AdminActions::parse_sprinttext()
4804 * @param string $which
4805 * @param string $val
4808 public function parse_sprinttext($which, $val)
4810 if ( !defined($which) )
4816 $base = constant($which);
4819 if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
4821 if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
4823 $met = 'parse_' . $matchies[0];
4827 $arg = trim($args[0], '()');
4828 $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
4831 if ( method_exists($this, $met) )
4833 $value = call_user_func(array(&$this, $met), $arg);
4837 if ( !isset($value) || empty($value) )
4841 echo sprintf($base, $value);
4846 * AdminActions::parse_systemsettings()
4847 * Parse skinvar systemsettings
4849 * @param string $type type of settings for system
4850 * @param string $templateName name of template to use
4853 public function parse_systemsettings($type = 'phpinfo', $templateName = '')
4855 global $member, $CONF, $nucleus;
4857 $member->isAdmin() or Admin::disallow();
4859 $enable = _ADMIN_SYSTEMOVERVIEW_ENABLE;
4860 $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
4867 case 'sqlserverinfo':
4868 echo sql_get_server_info();
4870 case 'sqlclientinfo':
4871 echo sql_get_client_info();
4873 case 'magicquotesgpc':
4874 echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
4876 case 'magicquotesruntime':
4877 echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';
4879 case 'registerglobals':
4880 echo ini_get('register_globals') ? 'On' : 'Off';
4883 $templates = array();
4884 if ( $templateName )
4886 $templates = Template::read($templateName);
4888 if ( !array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) || empty($templates['SYSTEMINFO_GDSETTINGS']) )
4890 $template = "<tr>\n"
4891 . "<td><%key%></td>\n"
4892 . "<td><%value%></td>\n"
4897 $template = $templates['SYSTEMINFO_GDSETTINGS'];
4900 $gdinfo = gd_info();
4902 foreach ( $gdinfo as $key => $value )
4904 if ( is_bool($value) )
4906 $value = $value ? $enable : $disable;
4910 $value = Entity::hsc($value);
4916 echo Template::fill($template, $data);
4921 phpinfo(INFO_MODULES);
4922 $im = ob_get_contents();
4924 echo ( i18n::strpos($im, 'mod_rewrite') !== FALSE ) ? $enable : $disable;
4926 case 'nucleusversion':
4927 echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
4929 case 'nucleuspatchlevel':
4930 echo getNucleusPatchLevel();
4936 echo $CONF['ItemURL'];
4938 case 'alertonheaderssent':
4939 echo $CONF['alertOnHeadersSent'] ? $enable : $disable;
4941 case 'nucleuscodename':
4942 if ( $nucleus['codename'] != '' )
4944 echo ' "' . $nucleus['codename'] . '"';
4947 case 'versioncheckurl':
4948 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4955 * AdminActions::parse_templateoverview()
4956 * Parse skinvar templateoverview
4958 * @param string $templateName name of template to use
4961 public function parse_templateoverview($templateName = '')
4963 $query = "SELECT * FROM %s WHERE tdname NOT LIKE 'admin/%%' ORDER BY tdname";
4964 $query = sprintf($query, sql_table('template_desc'));
4966 $template['content'] = 'templatelist';
4967 $template['tabindex'] = 10;
4969 Showlist($query, 'table', $template, $templateName);
4975 * AdminActions::parse_ticket()
4981 public function parse_ticket()
4984 $manager->addTicketHidden();
4989 * AdminActions::parse_versioncheckurl()
4990 * Parse skinvar versioncheckurl
4995 public function parse_versioncheckurl()
4997 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
5002 * AdminActions::parse_yrbloglist()
5003 * Parse skinvar yrbloglist
5005 * @param string $templateName name of template to use
5008 public function parse_yrbloglist($templateName = '')
5011 $showAll = requestVar('showall');
5013 if ( $member->isAdmin() && ($showAll == 'yes') )
5015 // Super-Admins have access to all blogs! (no add item support though)
5016 $query = "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
5018 . " ORDER BY bnumber;";
5019 $query = sprintf($query, sql_table('blog'));
5023 $query = "SELECT bnumber, bname, tadmin, burl, bshortname"
5025 . " WHERE tblog=bnumber and tmember=%d"
5026 . " ORDER BY bnumber;";
5027 $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
5030 $template['content'] = 'bloglist';
5031 $template['superadmin'] = $member->isAdmin();
5033 $amount = Showlist($query, 'table', $template, $templateName);
5035 if ( ($showAll != 'yes') && ($member->isAdmin()) )
5037 $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
5039 $total = quickQuery($query);
5040 if ( $total > $amount )
5042 echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
5048 echo _OVERVIEW_NOBLOGS;
5050 elseif( $amount != 0 )
5052 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
5054 $query = "SELECT ititle, inumber, bshortname"
5056 . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1;';
5057 $query = sprintf($query, sql_table('item'), sql_table('blog'), (integer) $member->getID());
5059 $template['content'] = 'draftlist';
5061 $amountdrafts = Showlist($query, 'table', $template, $templateName);
5062 if ( $amountdrafts == 0 )
5064 echo _OVERVIEW_NODRAFTS;
5071 * AdminActions::checkCondition()
5072 * Checks conditions for if statements
5074 * @param string $field type of <%if%>
5075 * @param string $name property of field
5076 * @param string $value value of property
5077 * @return boolean condition
5079 protected function checkCondition($field, $name='', $value = '')
5081 global $CONF, $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
5092 $blog =& $manager->getBlog($blogid);
5096 $blogid = getBlogIDFromCatID($catid);
5098 $blog =& $manager->getBlog($blogid);
5100 elseif ( intRequestVar('catid') )
5102 $catid = intRequestVar('catid');
5103 $blogid = getBlogIDFromCatID($catid);
5105 $blog =& $manager->getBlog($blogid);
5112 $condition = ($blog && $this->ifCategory($name, $value));
5115 $condition = ($blog && ($blog->getSetting($name) == $value));
5118 $condition = $member->isLoggedIn();
5121 $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
5124 $condition = $member->isLoggedIn() && $this->ifAdmin($name);
5127 $condition = $member->isLoggedIn() && $member->isAdmin();
5129 case 'allowloginedit':
5130 $condition = $member->isLoggedIn() && ($CONF['AllowLoginEdit'] || $member->isAdmin());
5133 $condition = ($itemidnext != '');
5136 $condition = ($itemidprev != '');
5138 case 'archiveprevexists':
5139 $condition = ($archiveprevexists == true);
5141 case 'archivenextexists':
5142 $condition = ($archivenextexists == true);
5145 $condition = (($name == $this->skintype) || ($name == requestVar('action')));
5148 $condition = $this->ifHasPlugin($name, $value);
5151 $condition = (Admin::getAdminAction() == $name);
5153 case 'adminoldaction':
5154 $condition = (Admin::getAdminAction() == $name);
5156 case 'addresschange':
5157 $condition = ($this->ifAddresscange());
5159 case 'bechangepass':
5160 $condition = ($this->beChangePassword());
5162 case 'skincandidates':
5163 $condition = ($this->ifSkincandidates());
5166 $condition = requestVar('nameclashes');
5168 case 'existsnewplugin':
5169 $condition = ($this->existsNewPlugin());
5172 $condition = (boolean) ($member->getAutosave() == $value);
5175 $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
5182 * Actions::_ifHasPlugin()
5183 * hasplugin,PlugName
5184 * -> checks if plugin exists
5185 * hasplugin,PlugName,OptionName
5186 * -> checks if the option OptionName from plugin PlugName is not set to 'no'
5187 * hasplugin,PlugName,OptionName=value
5188 * -> checks if the option OptionName from plugin PlugName is set to value
5190 * @param string $name name of plugin
5191 * @param string $value
5194 private function ifHasPlugin($name, $value)
5198 // (pluginInstalled method won't write a message in the actionlog on failure)
5199 if ( $manager->pluginInstalled("NP_{$name}") )
5201 $plugin =& $manager->getPlugin("NP_{$name}");
5202 if ( $plugin != NULL )
5210 list($name2, $value2) = preg_split('#=#', $value, 2);
5211 if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
5215 else if ( $plugin->getOption($name2) == $value2 )
5226 * Actions::beChangePassword()
5231 private function beChangePassword()
5233 return intRequestVar('bNeedsPasswordChange');
5237 * Actions::ifSkincandidates()
5238 * Checks if a plugin exists and call its doIf function
5244 private function ifSkincandidates()
5247 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
5248 return (count($candidates) > 0);
5252 * Actions::ifPlugin()
5253 * Checks if a plugin exists and call its doIf function
5255 * @param string $name name of plugin
5256 * @param string $key
5257 * @param string $value
5260 private function ifPlugin($name, $key = '', $value = '')
5264 $plugin =& $manager->getPlugin("NP_{$name}");
5270 $params = func_get_args();
5271 array_shift($params);
5273 return call_user_func_array(array(&$plugin, 'doIf'), $params);
5277 * AdminActions::ifCategory()
5278 * Different checks for a category
5280 * @param string $key key for information of category
5281 * @param string $value value for information of category
5284 private function ifCategory($key = '', $value='')
5286 global $blog, $catid;
5288 // when no parameter is defined, just check if a category is selected
5289 if (($key != 'catname' && $key != 'catid') || ($value == ''))
5291 return $blog->isValidCategory($catid);
5294 // check category name
5295 if ( $key == 'catname' )
5297 $value = $blog->getCategoryIdFromName($value);
5298 if ($value == $catid)
5300 return $blog->isValidCategory($catid);
5304 // check category id
5305 if (($key == 'catid') && ($value == $catid))
5307 return $blog->isValidCategory($catid);
5314 * AdminActions::ifOnTeam()
5315 * Checks if a member is on the team of a blog and return his rights
5317 * @param string $blogName name of weblog
5320 private function ifOnTeam($blogName = '')
5322 global $blog, $member, $manager;
5324 // when no blog found
5325 if ( ($blogName == '') && !is_object($blog) )
5330 // explicit blog selection
5331 if ($blogName != '')
5333 $blogid = getBlogIDFromName($blogName);
5336 if (($blogName == '') || !$manager->existsBlogID($blogid))
5339 $blogid = $blog->getID();
5341 return $member->teamRights($blogid);
5345 * AdminActions::ifAdmin()
5346 * Checks if a member is admin of a blog
5348 * @param string $blogName name of weblog
5351 private function ifAdmin($blogName = '')
5353 global $blog, $member, $manager;
5355 // when no blog found
5356 if (($blogName == '') && (!is_object($blog)))
5361 // explicit blog selection
5362 if ($blogName != '')
5364 $blogid = getBlogIDFromName($blogName);
5367 if (($blogName == '') || !$manager->existsBlogID($blogid))
5370 $blogid = $blog->getID();
5373 return $member->isBlogAdmin($blogid);
5377 * AdminActions::ifAddresscange()
5378 * Check e-Mail address is changed
5383 private function ifAddresscange()
5385 $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");
5390 $info = MEMBER::getActivationInfo($key);
5395 $mem = MEMBER::createFromId($info->vmember);
5400 if ( $info->vtype == 'addresschange' )
5408 * AdminActions::templateEditRow()
5411 * @param array $template
5412 * @param string $desc
5413 * @param string $name
5414 * @param string $help
5415 * @param integer $tabindex
5416 * @param boolean $big
5417 * @param array $tmplt
5420 private function templateEditRow(&$template, $desc, $name, $help = '', $tabindex = 0, $big = 0, $tplt = '')
5424 if ( !array_key_exists($name, $template) )
5426 $template[$name] = '';
5434 $tmplt = skinableTEMPLATE::read($tplt);
5438 'description' => $desc,
5439 'help' => empty($help) ? '' : helpHtml('template' . $help),
5442 'tabindex' => $tabindex,
5443 'rows' => $big ? 10 : 5,
5446 if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $tmplt) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
5448 $base['head'] = "</tr>"
5450 . "<td><%description%><%help%></td>\n"
5451 . "<td id=\"td<%count%>\">\n"
5452 . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">\n";
5456 $base['head'] = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
5459 if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $tmplt) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
5461 $base['tail'] = "</textarea>\n"
5466 $base['tail'] = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
5469 echo TEMPLATE::fill($base['head'], $data);
5470 echo ENTITY::hsc($template[$name]);
5471 echo TEMPLATE::fill($base['tail'], $data);
5479 * AdminActions::customHelp()
5480 * shows a link to custom help file
5483 * @param string $tplName
5484 * @param string $url
5485 * @param string $iconURL
5486 * @param string $alt
5487 * @param string $title
5491 private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
5493 echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
5497 * AdminActions::customHelp()
5498 * shows a link to custom help file
5501 * @param string $tplName
5502 * @param string $url
5503 * @param string $iconURL
5504 * @param string $alt
5505 * @param string $title
5509 static function customHelplink($id, $tplName = '', $url = '', $title = '', $onclick = '')
5513 $templates = array();
5517 $templates = Template::read($tplName);
5520 if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ANCHOR', $templates) || empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) )
5522 $template = "<a href=\"<%helpurl%>#<%helptarget%>\" title=\"<%title%>\" <%onclick%>>\n";
5526 $template = $templates['ADMIN_CUSTOMHELPLINK_ANCHOR'];
5531 $url = $CONF['AdminURL'] . 'documentation/customHelp.html';
5534 if ( empty($onclick) )
5536 $onclick = 'onclick="if (event && event.preventDefault) event.preventDefault(); return help(this.href);"';
5538 elseif ( preg_match('#^onclick#', $onclick) )
5540 $onclick = $onclick;
5544 $onclick = 'onclick="' . $onclick . '"';
5549 'helptarget' => $id,
5550 'onclick' => $onclick,
5551 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
5553 return Template::fill($template, $data);
5557 * AdminActions::customHelpHtml()
5560 * @param string $tplName
5561 * @param string $url
5562 * @param string $iconURL
5563 * @param string $alt
5564 * @param string $title
5565 * @param string $onclick
5566 * @return string anchor element with help uri
5568 private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
5572 $templates = array();
5576 $templates = Template::read($tplName);
5578 if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) || !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
5580 $template = "<img src=\"<%iconurl%>\" <%width%><%height%>alt=\"<%alt%>\" title=\"<%title%>\" /></a>\n";
5584 $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
5587 if ( empty($iconURL) )
5589 $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
5592 if ( function_exists('getimagesize') )
5594 $size = getimagesize($iconURL);
5595 $width = 'width="' . $size[0] . '" ';
5596 $height = 'height="' . $size[1] . '" ';
5600 'iconurl' => $iconURL,
5602 'height' => $height,
5603 'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
5604 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
5607 $icon = Template::fill($template, $data);
5608 $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
5610 return $help . $icon;
5614 * AdminActions::input_yesno
5617 * @param $checkedval
5624 * @param $templateName
5627 private function input_yesno($name,
5638 $templates = array();
5639 if ( $templateName )
5641 $templates = Template::read($templateName);
5644 if ( $name == 'admin' )
5646 if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
5648 $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
5649 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
5650 . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
5651 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
5655 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
5660 if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
5662 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
5666 if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
5668 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
5671 if ( !isset($template) )
5673 $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
5674 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
5675 . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
5676 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
5681 $id = Entity::hsc($name);
5682 $id = str_replace('[', '-', $id);
5683 $id = str_replace(']', '-', $id);
5684 $id1 = $id . Entity::hsc($value1);
5685 $id2 = $id . Entity::hsc($value2);
5687 'name' => Entity::hsc($name),
5688 'yesval' => Entity::hsc($value1),
5689 'noval' => Entity::hsc($value2),
5692 'yesvaltext' => $yesval,
5693 'novaltext' => $noval,
5694 'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
5695 'nocheckedval' => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
5696 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
5701 return Template::fill($template, $dat);
5705 echo Template::fill($template, $dat);
5711 * AdminActions::existsNewPlugin()
5712 * Check exists new plugin
5715 * @return boolean exists or not
5717 private function existsNewPlugin()
5719 global $DIR_PLUGINS;
5721 $candidates = array();
5722 $files = scandir($DIR_PLUGINS);
5724 foreach ( $files as $file )
5726 if ( preg_match("#^NP_(.*)\.php$#", $file, $matches) )
5728 $name = $matches[1];
5729 $query = "SELECT * FROM %s WHERE pfile='%s';";
5730 $query = sprintf($query, sql_table('plugin'), sql_real_escape_string("{NP_{$name}"));
5731 $res = sql_query($query);
5733 if ( sql_num_rows($res) == 0 )
5735 $candidates[] = $name;
5740 $this->newPlugCandidates = $candidates;
5741 return (count($candidates) > 0);