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 'admintemplateedit':
357 $extra_actions = array(
358 'editadmintemplateinfo',
361 case 'admntemplateoverview':
362 $extra_actions = array(
363 'admintemplateoverview',
366 case 'backupoverview':
367 $extra_actions = array(
370 case 'backuprestore':
371 $extra_actions = array(
375 $extra_actions = array(
381 case 'banlistdelete':
382 $extra_actions = array(
387 case 'banlistdeleteconfirm':
388 $extra_actions = array(
389 'banlistdeletedlist',
394 $extra_actions = array(
400 case 'batchcategory':
401 $extra_actions = array(
407 $extra_actions = array(
413 $extra_actions = array(
419 $extra_actions = array(
425 $extra_actions = array(
431 $extra_actions = array(
440 $extra_actions = array(
449 $extra_actions = array(
455 case 'blogcommentlist':
456 $extra_actions = array(
462 case 'blogselectbox':
463 $extra_actions = array(
468 $extra_actions = array(
483 $extra_actions = array(
487 case 'browseowncomments':
488 $extra_actions = array(
492 case 'browseownitems':
493 $extra_actions = array(
497 case 'categorydelete':
498 $extra_actions = array(
504 $extra_actions = array(
510 case 'commentdelete':
511 $extra_actions = array(
516 $extra_actions = array(
521 $extra_actions = array(
532 $extra_actions = array(
538 $extra_actions = array(
543 case 'editmembersettings':
544 $extra_actions = array(
546 'languageselectoptions',
547 'adminskinselectoptions',
551 case 'insertpluginoptions':
552 $extra_actions = array(
553 'insertpluginoptions',
556 case 'itemcommentlist':
557 $extra_actions = array(
563 $extra_actions = array(
570 $extra_actions = array(
582 $extra_actions = array(
589 $extra_actions = array(
595 $extra_actions = array(
599 $extra_actions = array(
608 $extra_actions = array(
613 $extra_actions = array(
618 $extra_actions = array(
626 $extra_actions = array(
639 $extra_actions = array(
644 $extra_actions = array(
650 $extra_actions = array(
655 case 'pluginoptions':
656 $extra_actions = array(
658 'editplugoptionslist',
662 $extra_actions = array(
665 'configsettingsedit',
666 'languageselectoptions',
667 'configsettingsyesno',
675 $extra_actions = array(
680 $extra_actions = array(
685 $extra_actions = array(
691 $extra_actions = array(
694 'allowedskinactions',
695 'skineditallowedlist',
696 'skineditallowedlist',
699 case 'skiniedoimport':
700 $extra_actions = array(
705 $extra_actions = array(
709 case 'skinieoverview':
710 $extra_actions = array(
711 'selectlocalskinfiles',
716 $extra_actions = array(
720 case 'skinremovetype':
721 $extra_actions = array(
725 case 'systemoverview':
726 $extra_actions = array(
731 $extra_actions = array(
737 case 'templatedelete':
738 $extra_actions = array(
743 $extra_actions = array(
747 case 'templateoverview':
748 $extra_actions = array(
752 case 'usermanagement':
753 $extra_actions = array(
759 $extra_actions = array(
769 'selectlocaladminskinfiles',
777 $defined_actions = array_merge(self::$default_actions, $extra_actions);
779 return array_merge($defined_actions, parent::getAvailableActions());
783 * AdminActions::setSkin()
785 * @param object $skin an instance of Skin class
788 public function setSkin(&$skin)
790 $this->skin =& $skin;
795 * AdminActions::parse_actionloglist()
796 * Parse skinvar actionloglist
798 * @param string $templateName name of template to use
801 public function parse_actionloglist($templateName = '')
803 $query = "SELECT * FROM %s ORDER BY timestamp DESC";
804 $query = sprintf($query, sql_table('actionlog'));
806 $template['content'] = 'actionlist';
807 $amount = showlist($query, 'table', $template, $templateName);
813 * AdminActions::parse_activationmessage()
814 * Parse skinvar activationmessage
816 * @param string $type type of message
817 * @param string $templateName name of template to use
820 public function parse_activationmessage($type, $templateName = '')
822 global $CONF, $manager;
826 if ( !empty($templateName))
828 $template = Template::read($templateName);
831 $key = postVar('ackey');
834 Admin::error(_ERROR_ACTIVATE);
837 $info = MEMBER::getActivationInfo($key);
840 Admin::error(_ERROR_ACTIVATE);
843 $mem = MEMBER::createFromId($info->vmember);
846 Admin::error(_ERROR_ACTIVATE);
848 switch ( $info->vtype )
851 if ( array_key_exists('ACTIVATE_FORGOT_TITLE', $template) && !empty($template['ACTIVATE_FORGOT_TITLE']) )
853 $title = $template['ACTIVATE_FORGOT_TITLE'];
857 $title = _ACTIVATE_FORGOT_TITLE;
859 if ( array_key_exists('ACTIVATE_FORGOT_TEXT', $template) && !empty($template['ACTIVATE_FORGOT_TEXT']) )
861 $text = $template['ACTIVATE_FORGOT_TEXT'];
865 $text = _ACTIVATE_FORGOT_TEXT;
869 if ( array_key_exists('ACTIVATE_REGISTER_TITLE', $template) && !empty($template['ACTIVATE_REGISTER_TITLE']) )
871 $title = $template['ACTIVATE_REGISTER_TITLE'];
875 $title = _ACTIVATE_REGISTER_TITLE;
877 if ( array_key_exists('ACTIVATE_REGISTER_TEXT', $template) && !empty($template['ACTIVATE_REGISTER_TEXT']) )
879 $text = $template['ACTIVATE_REGISTER_TEXT'];
883 $text = _ACTIVATE_REGISTER_TEXT;
886 case 'addresschange':
887 if ( array_key_exists('ACTIVATE_CHANGE_TITLE', $template) && !empty($template['ACTIVATE_CHANGE_TITLE']) )
889 $title = $template['ACTIVATE_CHANGE_TITLE'];
893 $title = _ACTIVATE_CHANGE_TITLE;
895 if (array_key_exists('ACTIVATE_CHANGE_TEXT', $template) && !empty($template['ACTIVATE_CHANGE_TEXT']))
897 $text = $template['ACTIVATE_CHANGE_TEXT'];
901 $text = _ACTIVATE_CHANGE_TEXT;
906 'memberName' => Entity::hsc($mem->getDisplayName()),
907 'realName' => Entity::hsc($mem->getRealName()),
912 echo Template::fill($title, $aVars);
915 echo Template::fill($text, $aVars);
918 echo Entity::hsc($key);
925 * AdminActions::parse_addtickettourl()
926 * Parse skinvar addtickettourl
928 * @param string $url URI for ticket
931 public function parse_addtickettourl($url)
934 $url = $manager->addTicketToUrl($url);
935 echo Entity::hsc($url);
940 * AdminActions::parse_adminbanlist()
941 * Parse skinvar adminbanlist
943 * @param string $templateName name of template to use
946 public function parse_adminbanlist($templateName = '')
948 $blogid = intRequestVar('blogid');
950 $query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";
951 $query = sprintf($query, sql_table('ban'), (integer) $blogid);
953 $template['content'] = 'banlist';
955 $amount = Showlist($query, 'table', $template, $templateName);
965 * AdminActions::parse_adminbatchaction()
966 * Parse skinvar adminbatchaction
971 public function parse_adminbatchaction()
973 echo Entity::hsc(requestVar('batchaction'));
978 * AdminActions::parse_adminbatchlist()
979 * Parse skinvar adminbatchlist
981 * @param string $templateName name of template to use
984 public function parse_adminbatchlist($templateName = '')
987 $templates = array();
989 if ( !empty($templateName) )
991 $templates = Template::read($templateName);
994 if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) )
996 $template = '<li><%text(_BATCH_EXECUTING)%>'
997 . '<b><%adminbatchaction%></b>'
998 . '<%batchlisttype%>'
999 . '<b><%batchid%></b>...'
1000 . '<b><%batchlistmsg%></b>'
1005 $template = $templates['ADMIN_BATCHLIST'];
1008 $selected = requestIntArray('batch');
1009 $action = requestVar('batchaction');
1011 switch ( $this->skintype )
1014 $batchlisttype = _BATCH_ONITEM;
1015 $deleteaction = 'deleteOneItem';
1016 $moveaction = 'moveOneItem';
1017 $destid = intRequestVar('destcatid');
1019 case 'batchcomment':
1020 $batchlisttype = _BATCH_ONCOMMENT;
1021 $deleteaction = 'deleteOneComment';
1024 $batchlisttype = _BATCH_ONMEMBER;
1025 $deleteaction = 'deleteOneMember';
1026 $setadminsql = sql_table('member') . ' SET madmin = 1 WHERE mnumber = ';
1027 $unsetchksql = 'SELECT * FROM ' . sql_table('member') . ' WHERE madmin = 1 AND mcanlogin = 1';
1028 $unsetupsql = sql_table('member') . ' SET madmin = 0 WHERE mnumber = ';
1029 $unseterrmsg = _ERROR_ATLEASTONEADMIN;
1032 $blogid = intRequestVar('blogid');
1033 $batchlisttype = _BATCH_ONTEAM;
1034 $deleteaction = 'deleteOneTeamMember';
1035 $setadminsql = sql_table('team') . ' SET tadmin = 1 WHERE tblog = ' . $blogid . ' AND tmember = ';
1036 $unsetchksql = 'SELECT * FROM ' . sql_table('team') . ' WHERE tadmin = 1 AND tblog = ' . $blogid;
1037 $unseterrmsg = _ERROR_ATLEASTONEBLOGADMIN;
1038 $unsetupsql = sql_table('team') . ' SET tadmin = 0 WHERE tblog = ' . $blogid . ' AND tmember = ';
1040 case 'batchcategory':
1041 $batchlisttype = _BATCH_ONCATEGORY;
1042 $deleteaction = 'deleteOneCategory';
1043 $moveaction = 'moveOneCategory';
1044 $destid = intRequestVar('destblogid');
1048 // walk over all selectedids and perform action
1049 foreach ( $selected as $selectedid )
1052 $selectedid = intval($selectedid);
1057 if ( $this->skintype != 'batchteam' )
1059 $error = Admin::deleteaction($selectedid);
1063 $error = Admin::deleteOneTeamMember($blogid, $selectedid);
1067 $error = Admin::moveaction($selectedid, $destid);
1071 sql_query("UPDATE {$setadminsql} {$selectedid};");
1075 // there should always remain at least one super-admin
1076 $r = sql_query($unsetchksql);
1077 if ( sql_num_rows($r) < 2 )
1079 $error = $unseterrmsg;
1083 sql_query("UPDATE {$setadminsql} {$selectedid};");
1087 $error = _BATCH_UNKNOWN . Entity::hsc($action);
1091 'batchid' => $selectedid,
1092 'batchlisttype' => Entity::hsc($batchlisttype),
1093 'adminbatchaction' => Entity::hsc($action),
1094 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,
1097 $handler = new AdminActions('template');
1098 $parser = new Parser($handler);
1101 $parser->parse($template);
1102 $template = ob_get_contents();
1105 echo Template::fill($template, $data);
1111 * AdminActions::parse_adminbloglink()
1112 * Parse skinvar adminbloglink
1114 * @param string $templateName name of template to use
1117 public function parse_adminbloglink($templateName = '')
1120 $blogid = intRequestVar('blogid');
1121 $blog =& $manager->getBlog($blogid);
1122 $templates = array();
1124 if ( !empty($templateName) )
1126 $templates = Template::read($templateName);
1129 if ( !array_key_exists('ADMIN_BLOGLINK', $templates) || empty($templates['ADMIN_BLOGLINK']) )
1131 $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
1135 $template = $templates['ADMIN_BLOGLINK'];
1139 'url' => Entity::hsc($blog->getURL()),
1140 'adminbloglinktitle' => _BLOGLIST_TT_VISIT,
1141 'blogname' => Entity::hsc($blog->getName())
1144 echo Template::fill($template, $data);
1149 * AdminActions::parse_adminerrormesg()
1150 * Parse skinvar adminerrormesg
1155 public function parse_adminerrormesg()
1160 if ( requestVar('errormessage') )
1162 $message = requestVar('errormessage');
1164 elseif ( cookieVar($CONF['CookiePrefix'] . 'errormessage') )
1166 $message = cookieVar($CONF['CookiePrefix'] . 'errormessage');
1168 elseif ( Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage') )
1170 $message = Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage');
1172 echo Entity::hsc($message);
1177 * AdminActions::parse_adminskineditallowedlist()
1178 * Parse skinvar adminskineditallowedlist
1180 * @param string $type template/blog
1181 * @param string $templateName name of template to use
1184 public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
1188 /* TODO: blog seems not to be used */
1190 $query = "SELECT bshortname, bname FROM %s";
1191 $query = sprintf($query, sql_table('blog'));
1193 'content' => 'shortblognames'
1197 $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname LIKE 'admin/%%'";
1198 $query = sprintf($query, sql_table('template_desc'));
1200 'content' => 'shortnames'
1204 Showlist($query, 'table', $show, $templateName);
1209 * AdminActions::parse_adminskinielist()
1210 * Parse skinvar adminskinielist
1212 * @param string $type skin/template
1213 * @param string $templateName name of template to use
1216 public function parse_adminskinielist($type, $templateName = '')
1218 $templates = array();
1219 if ( $templateName )
1221 $templates = Template::read($templateName);
1224 if ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) )
1227 . "<input type=\"checkbox\" name=\"<%typeid%>\" id=\"<%expid%>\" />\n"
1228 . "<label for=\"<%expid%>\"><%expname%></label>"
1230 . "<td><%expdesc%></td>\n"
1236 $template = $templates['SKINIE_EXPORT_LIST'];
1242 $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%';";
1243 $query = sprintf($query, sql_table('skin_desc'));
1244 $res = sql_query($query);
1246 while ( $skinObj = sql_fetch_object($res) )
1249 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
1250 'expid' => 'skinexp' . $skinObj->sdnumber,
1251 'expname' => Entity::hsc($skinObj->sdname),
1252 'expdesc' => Entity::hsc($skinObj->sddesc),
1254 echo Template::fill($template, $data);
1258 $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%';";
1259 $query = sprintf($query, sql_table('template_desc'));
1260 $res = sql_query($query);
1261 while ( $templateObj = sql_fetch_object($res) )
1264 'typeid' => 'template[' . $templateObj->tdnumber . ']',
1265 'expid' => 'templateexp' . $templateObj->tdnumber,
1266 'expname' => Entity::hsc($templateObj->tdname),
1267 'expdesc' => Entity::hsc($templateObj->tddesc),
1269 echo Template::fill($template, $data);
1277 * AdminActions::parse_adminskinoverview()
1278 * Parse skinvar adminskinoverview
1280 * @param string $templateName name of template to use
1283 public function parse_adminskinoverview($templateName = '')
1285 $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%' ORDER BY sdname;";
1286 $query = sprintf($query, sql_table('skin_desc'));
1288 $template['content'] = 'adminskinlist';
1289 $template['tabindex'] = 10;
1290 $template['friendly_names'] = $this->skin->getAvailableTypes();
1291 Showlist($query, 'table', $template, $templateName);
1296 * AdminActions::parse_adminskinselectoptions()
1297 * Parse skinvar adminskinselectoptions
1302 public function parse_adminskinselectoptions()
1305 $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';";
1306 $query = sprintf($query, sql_table('skin_desc'));
1308 $template['name'] = 'adminskin';
1309 $template['selected'] = $CONF['DefaultAdminSkin'];
1310 $template['tabindex'] = 110;
1311 Showlist($query, 'select', $template, '');
1316 * AdminActions::parse_adminspecialskinlist()
1317 * Parse skinvar adminspecialskinlist
1319 * @param string $templateName name of template to use
1321 public function parse_adminspecialskinlist($templateName = '')
1323 $templates = array();
1324 if ( $templateName )
1326 $templates = Template::read($templateName);
1329 $nType = $this->skin->getAvailableTypes();
1330 $skinid = intRequestVar('skinid');
1332 $query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";
1333 $query = sprintf($query, sql_table('skin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
1335 $res = sql_query($query);
1336 if ( $res && sql_num_rows($res) > 0 )
1338 /* NOTE: set templates for HEAD/BODY/FOOT */
1339 if ( !array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
1341 $template['head'] = "<ul>\n";
1345 $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
1347 if ( !array_key_exists('ADMIN_SPECIALSKINLIST_BODY', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
1349 $template['body'] = '<li>'
1350 . '<a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
1353 . '(<a tabindex="<%tabindex%>" href="index.php?action=adminskinremovetype&skinid=<%skinid%>&type=<%skintype%>">'
1360 $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
1362 if ( !array_key_exists('ADMIN_SPECIALSKINLIST_FOOT', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
1364 $template['foot'] = "</ul>\n";
1368 $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
1375 echo $template['head'];
1376 while ( $row = sql_fetch_assoc($res) )
1379 'tabindex' => $tabstart++,
1380 'skinid' => $skinid,
1381 'skintype' => Entity::hsc(strtolower($row['stype']))
1383 echo Template::fill($template['body'], $data);
1386 echo $template['foot'];
1392 * AdminActions::parse_admintemplateoverview()
1393 * Parse skinvar admintemplateoverview
1395 * @param string $templateName name of template to use
1398 public function parse_admintemplateoverview($templateName = '')
1400 $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%' ORDER BY tdname;";
1401 $query = sprintf($query, sql_table('template_desc'));
1403 $template['content'] = 'admintemplatelist';
1404 $template['tabindex'] = 10;
1406 Showlist($query, 'table', $template, $templateName);
1411 * AdminActions::parse_allowedadminskinactions()
1412 * Parse skinvar allowedadminskinactions
1417 public function parse_allowedadminskinactions()
1419 global $DIR_ADMINSKINS;
1420 $skinType = strtolower(trim(requestVar('type')));
1421 $actions = $this->skin->getAllowedActionsForType($skinType);
1424 while ( $current = array_shift($actions) )
1426 // TODO: remove this
1427 // skip deprecated vars
1428 if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')
1433 echo helplink("adminskinvar-{$current}") . "$current</a>\n";
1435 if ( count($actions) != 0 )
1444 * AdminActions::parse_allowedskinactions()
1445 * Parse skinvar allowedskinactions
1450 public function parse_allowedskinactions()
1452 $skinType = strtolower(trim(requestVar('type')));
1453 $skinid = intRequestVar('skinid');
1455 $skin = new Skin($skinid);
1456 $actions = $skin->getAllowedActionsForType($skinType);
1459 while ( $current = array_shift($actions) )
1461 // TODO: remove this
1462 // skip deprecated vars
1463 if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )
1468 /* TODO: alternative function should be used or not? */
1469 echo helplink("skinvar-{$current}") . "$current</a>\n";
1471 if ( count($actions) != 0 )
1480 * AdminActions::parse_banlistdeletedlist()
1481 * Parse skinvar banlistdeletedlist
1483 * @param string $templateName name of template to use
1486 public function parse_banlistdeletedlist($templateName = '')
1489 $templates = array();
1491 if ( $templateName )
1493 $templates = Template::read($templateName);
1495 if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) )
1497 $template = "<li><%blogname%></li>\n";
1501 $template = $templates['BANLIST_DELETED_LIST'];
1504 $deleted = requestArray('delblogs');
1505 foreach ( $deleted as $delblog )
1507 $blog =& $manager->getBlog($delblog);
1509 Entity::hsc($blog->getName())
1511 Template::fill($template, $data);
1517 * AdminActions::parse_batchdeletelist()
1518 * Parse skinvar batchdeletelist
1523 public function parse_batchdeletelist()
1525 $selected = requestIntArray('batch');
1528 foreach ( $selected as $select )
1530 echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
1532 // add hidden vars for team & comment
1533 if ( requestVar('action') == 'batchteam' )
1535 echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";
1537 if ( requestVar('action') == 'batchcomment' )
1539 echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";
1545 * AdminActions::parse_batchdeletetype()
1546 * Parse skinvar batchdeletetype
1551 public function parse_batchdeletetype()
1553 echo Entity::hsc(requestVar('action'));
1558 * AdminActions::parse_batchmovebtn()
1559 * Parse skinvar batchmovebtn
1564 public function parse_batchmovebtn()
1566 $actionType = requestVar('action');
1567 switch ( $actionType )
1572 case 'batchcategory':
1580 * AdminActions::parse_batchmovelist()
1581 * Parse skinvar batchmovelist
1586 public function parse_batchmovelist()
1588 $selected = requestIntArray('batch');
1589 foreach ( $selected as $select )
1591 echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";
1597 * AdminActions::parse_batchmovetitle()
1598 * Parse skinvar batchmovetitle
1603 public function parse_batchmovetitle()
1605 $actionType = requestVar('action');
1606 switch ( $actionType )
1611 case 'batchcategory':
1612 echo _MOVECAT_TITLE;
1619 * AdminActions::parse_batchmovetype()
1620 * Parse skinvar batchmovetype
1625 public function parse_batchmovetype()
1627 echo Entity::hsc(requestVar('action'));
1632 * AdminActions::parse_blogcatlist()
1633 * Parse skinvar blogcatlist
1638 public function parse_blogcatlist()
1641 $blogid = intRequestVar('blogid');
1642 $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
1643 $query = sprintf($query, sql_table('category'), (integer) $blogid);
1645 $template['content'] = 'categorylist';
1646 $template['tabindex'] = 200;
1648 $batch = new Batch('member');
1649 $batch->showlist($query, 'table', $template);
1654 * AdminActions::parse_blogid()
1655 * Parse skinvar blogid
1660 function parse_blogid()
1662 echo intRequestVar('blogid');
1667 * AdminActions::parse_blognotifysetting()
1668 * Parse skinvar blognotifysetting
1673 public function parse_blognotifysetting($type)
1676 $blogid = intRequestVar('blogid');
1677 $blog = $manager->getBlog($blogid);
1682 if ( !$blog->notifyOnComment() )
1688 if ( !$blog->notifyOnVote() )
1694 if ( !$blog->notifyOnNewItem() )
1700 echo ' checked="checked"';
1705 * AdminActions::parse_blogselectbox()
1706 * Parse skinvar blogselectbox
1711 public function parse_blogselectbox()
1715 $selectData = requestVar('selectData');
1716 $mode = $selectData['mode'];
1717 $name = Entity::hsc($selectData['name']);
1718 $tabindex = Entity::hsc($selectData['tabindex']);
1719 $aBlogIds = array_map('intval', $selectData['aBlogIds']);
1720 $showNewCat = intval($selectData['showNewCat']);
1721 $selected = intval($selectData['selected']);
1723 echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
1725 // 1. select blogs (we'll create optiongroups)
1726 // (only select those blogs that have the user on the team)
1727 $queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
1728 $queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
1729 $blogs = sql_query($queryBlogs);
1731 if ( $mode == 'category' )
1733 if ( sql_num_rows($blogs) > 1 )
1737 while ( $oBlog = sql_fetch_object($blogs) )
1739 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1741 echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\>\n";
1744 // show selection to create new category when allowed/wanted
1747 // check if allowed to do so
1748 if ( $member->blogAdminRights($oBlog->bnumber) )
1750 echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
1754 // 2. for each category in that blog
1755 $catQuery = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
1756 $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
1757 $categories = sql_query($catQuery);
1758 while ( $oCat = sql_fetch_object($categories) )
1760 if ( $oCat->catid == $selected )
1762 $selectText = ' selected="selected" ';
1768 echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . Entity::hsc($oCat->cname) . "</option>\n";
1771 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1780 while ( $oBlog = sql_fetch_object($blogs) )
1782 echo '<option value="' . $oBlog->bnumber . '"';
1783 if ( $oBlog->bnumber == $selected )
1785 echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . Entity::hsc($oBlog->bname) . "</option>\n";
1789 echo '<option value="' . $oBlog->bnumber . '">' . Entity::hsc($oBlog->bname) . "</option>\n";
1798 * AdminActions::parse_blogsetting()
1799 * Parse skinvar blogsetting
1801 * @param string $which name of weblog setting
1804 public function parse_blogsetting($which)
1806 echo $this->parse_getblogsetting($which);
1811 * AdminActions::parse_blogsettingyesno()
1812 * Parse skinvar blogsettingyesno
1814 * @param string $type type of weblog setting
1815 * @param string $templateName name of template to use
1818 public function parse_blogsettingyesno($type, $templateName = '')
1822 $blogid = intRequestVar('blogid');
1823 $blog = $manager->getBlog($blogid);
1827 case 'convertbreaks':
1828 $checkedval = $blog->convertBreaks();
1831 case 'allowpastposting':
1832 $checkedval = $blog->allowPastPosting();
1836 $checkedval = $blog->commentsEnabled();
1840 $checkedval = $blog->isPublic();
1844 $checkedval = $blog->emailRequired();
1848 $checkedval = $blog->getSearchable();
1852 $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName);
1857 * AdminActions::parse_blogteamlist()
1858 * Parse skinvar blogteamlist
1860 * @param string $templateName name of template to use
1863 public function parse_blogteamlist($templateName = '')
1866 $blogid = intRequestVar('blogid');
1867 $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "
1869 . "WHERE tmember=mnumber AND tblog= %d";
1870 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1872 $template['content'] = 'teamlist';
1873 $template['tabindex'] = 10;
1875 $batch = new Batch('team');
1876 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
1881 * AdminActions::parse_blogteammembers()
1882 * Parse skinvar blogteammembers
1887 public function parse_blogteammembers()
1889 $blogid = intRequestVar('blogid');
1890 $query = "SELECT mname, mrealname "
1892 . "WHERE mnumber=tmember AND tblog=%d;";
1893 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1894 $res = sql_query($query);
1895 $memberNames = array();
1896 while ( $o = sql_fetch_object($res) )
1898 $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
1900 echo implode(',', $memberNames);
1904 * AdminActions::parse_blogtime()
1905 * Parse skinvar blogtime
1907 * @param string $type type of time
1908 * @param string $format format for time expression
1909 * @param integer $offset offset of time
1912 public function parse_blogtime($type, $format = '%H:%M', $offset = 0)
1916 if ( $type != 'blogtime' )
1918 /* return server time */
1919 $timestamp = time() + $offset;
1923 $bid = intRequestVar('blogid');
1924 $b = $manager->getBlog($bid);
1925 $timestamp = $b->getCorrectTime() + $offset;
1928 echo i18n::formatted_datetime($format, $timestamp);
1933 * AdminActions::parse_bookmarkletadmin()
1934 * Parse skinvar bookmarkletadmin
1939 public function parse_bookmarkletadmin()
1943 $blogid = intRequestVar('blogid');
1945 echo Entity::hsc('javascript:' . getBookmarklet($blogid));
1950 * AdminActions::parse_categories()
1951 * Parse skinvar categories
1953 * create category dropdown box
1955 * @param string $type name of setting for category
1958 function parse_categories($startidx = 0)
1963 $itemid = intRequestVar('itemid');
1965 $item =& $manager->getItem($itemid, 1, 1);
1966 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
1968 if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
1970 $item['body'] = removeBreaks($item['body']);
1971 $item['more'] = removeBreaks($item['more']);
1974 $contents = array();
1975 if ( requestVar('action') == 'itemedit' )
1979 if ( isset($contents['catid']) && $contents['catid'] )
1981 $catid = $contents['catid']; // on edit item
1985 $catid = $blog->getDefaultCategory(); // on add item
1987 Admin::selectBlogCategory('catid', $catid, $startidx, 1, $blog->getID());
1992 * AdminActions::parse_category()
1993 * Parse skinvar category
1995 * @param string $type name of setting for category
1998 public function parse_category($type = 'name')
2000 echo $this->parse_getcategory($type);
2005 * AdminActions::parse_categorysetting()
2006 * Parse skinvar categorysetting
2008 * @param string $type type in category setting
2011 public function parse_categorysetting($type)
2013 $catid = intRequestVar('catid');
2014 if ( $type == 'id' )
2019 $blogid = intRequestVar('blogid');
2020 $query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
2021 $query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
2022 $res = sql_query($query);
2023 $obj = sql_fetch_object($res);
2025 if ( $type != desc )
2027 echo Entity::hsc($obj->cdesc);
2031 echo Entity::hsc($obj->cname);
2038 * AdminActions::parse_codename()
2039 * Parse templatevar codename
2045 function parse_checkedonval($value, $name)
2050 $itemid = intRequestVar('itemid');
2051 $item =& $manager->getItem($itemid, 1, 1);
2053 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
2055 if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
2057 $item['body'] = removeBreaks($item['body']);
2058 $item['more'] = removeBreaks($item['more']);
2061 $contents = array();
2062 if ( requestVar('action') == 'itemedit' )
2066 if ( !isset($contents[$name]) )
2068 $contents[$name] = '';
2070 if ($contents[$name] == $value)
2072 echo 'checked="checked"';
2078 * AdminActions::parse_codename()
2079 * Parse templatevar codename
2084 * TODO: is this need???
2086 public function parse_codename()
2089 echo $nucleus['codename'];
2094 * AdminActions::parse_commentnavlist()
2095 * Parse skinvar commentnavlist
2100 public function parse_commentnavlist()
2102 global $CONF, $manager, $member;
2105 if ( postVar('start') )
2107 $start = intPostVar('start');
2114 // amount of items to show
2115 if ( postVar('amount') )
2117 $amount = intPostVar('amount');
2121 $amount = (integer) $CONF['DefaultListSize'];
2127 $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
2129 . 'LEFT OUTER JOIN %s ON mnumber=cmember '
2131 $query = sprintf($query, sql_table('comment'), sql_table('member'));
2133 if ( $this->skintype == 'itemcommentlist' )
2135 $itemid = intRequestVar('itemid');
2136 $query .= " citem={$itemid}";
2137 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2139 $nonComments = _NOCOMMENTS;
2141 elseif ( $this->skintype == 'browseowncomments' )
2144 $query .= ' cmember=' . $member->getID();
2145 $template['canAddBan'] = 0;
2147 $nonComments = _NOCOMMENTS_YOUR;
2149 elseif ( $this->skintype == 'blogcommentlist' )
2152 $query .= ' cblog=' . intRequestVar('blogid');
2153 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2154 $bid = intRequestVar('blogid');
2155 $nonComments = _NOCOMMENTS_BLOG;
2158 $search = postVar('search');
2159 if ( !empty($search) )
2161 $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
2164 $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
2166 $template['content'] = 'commentlist';
2168 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
2169 $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
2174 * AdminActions::parse_configsettingsedit()
2175 * Parse skinvar configsettingsedit
2177 * @param string $type type of global configuration
2180 public function parse_configsettingsedit($type)
2185 case 'DefaultListSize':
2186 if ( !array_key_exists('DefaultListSize', $CONF) )
2188 $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
2189 $query = sprintf($query, sql_table('config'));
2191 $CONF['DefaultListSize'] = 10;
2193 elseif ( intval($CONF['DefaultListSize']) < 1 )
2195 $CONF['DefaultListSize'] = 10;
2197 echo intval($CONF['DefaultListSize']);
2199 case 'SessionCookie':
2200 $value = $CONF['SessionCookie'];
2201 $txt1 = _SETTINGS_COOKIESESSION;
2202 $txt2 = _SETTINGS_COOKIEMONTH;
2203 $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);
2206 $value = $CONF['URLMode'];
2207 $txt1 = _SETTINGS_URLMODE_NORMAL;
2208 $txt2 = _SETTINGS_URLMODE_PATHINFO;
2209 $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);
2212 if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )
2214 echo Entity::hsc($CONF[$type]);
2222 * AdminActions::parse_configsettingsyesno()
2223 * Parse skinvar configsettingsyesno
2225 * @param string $type type of global setting
2226 * @param integer $tabindex tabindex attribute of input element
2229 public function parse_configsettingsyesno($type, $tabindex)
2232 if ( array_key_exists($type, $CONF) )
2234 $this->parse_inputyesno($type, $CONF[$type], $tabindex);
2240 * AdminActions::parse_contents()
2241 * Parse skinvar contents
2243 * @param string $which part for item
2246 function parse_contents($which)
2251 $contents = array();
2253 if ( requestVar('action') == 'itemedit' )
2255 $itemid = intRequestVar('itemid');
2256 $item =& $manager->getItem($itemid, 1, 1);
2258 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
2260 if ( $item && $blog->convertBreaks() )
2262 $item['body'] = removeBreaks($item['body']);
2263 $item['more'] = removeBreaks($item['more']);
2267 elseif ( requestVar('action') == 'createitem' )
2269 $blogid = intRequestVar('blogid');
2270 $blog =& $manager->getBlog($blogid);
2274 'contents' => &$contents,
2280 if ( !array_key_exists($which, $contents) )
2282 $contents[$which] = '';
2284 echo Entity::hsc($contents[$which],ENT_QUOTES);
2288 * AdminActions::parse_currenttime()
2289 * Parse skinvar currenttime
2291 * @param string $what
2294 function parse_currenttime($what)
2297 if ( requestVar('action') == 'itemedit' )
2299 $itemid = intRequestVar('itemid');
2300 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
2302 elseif ( requestVar('action') == 'createitem' )
2304 $blog =& $manager->getBlog(intRequestVar('blogid'));
2306 $nu = getdate($blog->getCorrectTime());
2311 * AdminActions::parse_customhelplink()
2312 * Parse skinvar customhelplink
2314 * @param string $topic name of topic
2315 * @param string $tplName name of template
2316 * @param string $url string as URI
2317 * @param string $iconURL string as URI for icon
2318 * @param string $alt alternative text for image element
2319 * @param string $title title for anchor element
2322 public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
2324 $this->customHelp($topic, $url, $iconURL);
2329 * AdminActions::parse_date()
2330 * Parse skinvar date
2332 public function parse_date($format = 'c')
2334 global $CONF, $manager;
2335 echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
2340 * AdminActions::parse_defaultadminskintypes()
2341 * Parse skinvar defaultadminskintypes
2343 * @param string $tabindex index number for tabindex attribute of input element
2344 * @param string $templateName name of template
2347 public function parse_defaultadminskintypes($tabindex, $templateName = '')
2349 $templates = array();
2351 if ( $templateName )
2353 $templates = Template::read($templateName);
2356 $types = $this->skin->getAvailableTypes();
2359 /* NOTE: set templates for HEAD/BODY/FOOT */
2360 if ( !array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) || empty($templates['ADMINSKINTYPELIST_HEAD']) )
2362 $template['head'] = "<ul>\n";
2366 $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
2368 if ( !array_key_exists('ADMINSKINTYPELIST_BODY', $templates) || empty($templates['ADMINSKINTYPELIST_BODY']) )
2370 $template['body'] = "<li>"
2371 . "<a tabindex=\"<%tabindex%>\" href=\"index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>\"><%name%></a> <%help%>"
2376 $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
2378 if ( !array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) || empty($templates['ADMINSKINTYPELIST_FOOT']) )
2380 $template['foot'] = "</ul>\n";
2384 $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
2387 $handler = new AdminActions('template');
2388 $parser = new PARSER($handler);
2390 /* NOTE: do output */
2391 echo $template['head'];
2392 foreach ( $types as $type => $fName )
2394 $helplink = $this->customHelpHtml("skinpart{$type}{$templateName}");
2396 'tabindex' => $tabindex,
2397 'skintype' => $type,
2399 'help' => $helplink,
2400 'skinid' => intrequestVar('skinid'),
2402 $parser->parse(Template::fill($template['body'], $data));
2405 echo $template['foot'];
2411 * AdminActions::parse_defblogselect()
2412 * Parse skinvar defblogselect
2414 * @param string $templateName name of template
2417 public function parse_defblogselect($templateName = '')
2421 $query = "SELECT bname as text, bnumber as value FROM %s;";
2422 $query = sprintf($query, sql_table('blog'));
2424 $template['name'] = 'DefaultBlog';
2425 $template['selected'] = $CONF['DefaultBlog'];
2426 $template['tabindex'] = 10;
2428 Showlist($query, 'select', $template, $templateName);
2434 * AdminActions::parse_defcatselect()
2435 * Parse skinvar defcatselect
2437 * @param string $templateName name of template
2440 public function parse_defcatselect($templateName = '')
2444 $blogid = intRequestVar('blogid');
2445 $blog = $manager->getBlog($blogid);
2447 $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
2448 $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
2450 $template['name'] = 'defcat';
2451 $template['selected'] = $blog->getDefaultCategory();
2452 $template['tabindex'] = 110;
2454 Showlist($query, 'select', $template, $templateName);
2460 * AdminActions::parse_defskinselect()
2461 * Parse skinvar defskinselect
2463 * @param string $type type of skin
2464 * @param string $templateName name of template
2467 public function parse_defskinselect($type = 'blog', $templateName = '')
2471 $query = "SELECT sdname as text, sdnumber as value FROM %s;";
2472 $query = sprintf($query, sql_table('skin_desc'));
2474 $blogid = intRequestVar('blogid');
2479 $template['selected'] = $CONF['BaseSkin'];
2483 $blog = $manager->getBlog($blogid);
2484 $template['selected'] = $blog->getDefaultSkin();
2487 if ( $type != 'blog' )
2489 $nname = 'BaseSkin';
2496 $template['name'] = $nname;
2497 $template['tabindex'] = 50;
2499 Showlist($query, 'select', $template, $templateName);
2505 * AdminActions::parse_deletecomment()
2506 * Parse skinvar deletecomment
2508 * @param string $type type of infomation for comment
2511 public function parse_deletecomment($type = 'id')
2513 $commentid = intRequestVar('commentid');
2514 $comment = COMMENT::getComment($commentid);
2519 echo intRequestVar('commentid');
2522 if ( array_key_exists('member', $comment) && !empty($comment['member']) )
2524 echo $comment['member'];
2528 echo $comment['user'];
2532 $body = strip_tags($comment['body']);
2533 echo Entity::hsc(shorten($body, 300, '...'));
2539 * AdminActions::parse_deleteitembody()
2540 * Parse skinvar deleteitembody
2545 public function parse_deleteitembody()
2549 $itemid = intRequestVar('itemid');
2550 $item =& $manager->getItem($itemid, 1, 1);
2552 $body = strip_tags($item['body']);
2554 echo Entity::hsc(shorten($body, 300, '...'));
2560 * AdminActions::parse_deleteitemid()
2561 * Parse skinvar deleteitemid
2566 public function parse_deleteitemid()
2568 echo (integer) intRequestVar('itemid');
2573 * AdminActions::parse_deleteitemtitle()
2574 * Parse skinvar deleteitemtitle
2579 public function parse_deleteitemtitle()
2583 $itemid = intRequestVar('itemid');
2584 $item =& $manager->getItem($itemid, 1, 1);
2586 echo Entity::hsc(strip_tags($item['title']));
2592 * AdminActions::parse_editadminskin()
2593 * Parse skinvar editadminskin
2595 * @param string $type type of skin setting
2598 public function parse_editadminskin($type = 'id')
2600 $skinid = intRequestVar('skinid');
2601 $skin = new Skin($skinid);
2605 echo intRequestVar('skinid');
2608 echo Entity::hsc($skin->getName());
2611 echo Entity::hsc($skin->getDescription());
2614 echo Entity::hsc($skin->getContentType());
2617 echo Entity::hsc($skin->getIncludePrefix());
2620 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2628 * AdminActions::parse_editadminskintype()
2629 * Parse skinvar editadminskintype
2631 * @param string $type name of skin type
2634 public function parse_editadminskintype($type = 'id')
2636 global $CONF, $manager, $member;
2638 $fNames = $this->skin->getAvailableTypes();
2639 $sType = strtolower(trim(requestVar('type')));
2644 echo intRequestVar('skinid');
2647 echo Entity::hsc($this->skin->getName());
2650 echo Entity::hsc($this->skin->getDescription());
2653 echo Entity::hsc($this->skin->getContentType());
2656 echo Entity::hsc($this->skin->getContentFromDB($sType));
2659 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2660 echo Entity::hsc($skinType);
2663 echo Entity::hsc($sType);
2666 echo Entity::hsc($this->skin->getIncludePrefix());
2669 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2670 echo Entity::hsc($incMode);
2679 * AdminActions::parse_editcomment()
2680 * Parse skinvar editcomment
2682 * @param string $type type of comment setting
2685 public function parse_editcomment($type = 'id')
2689 $commentid = intRequestVar('commentid');
2690 $comment = COMMENT::getComment($commentid);
2692 $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
2697 echo intRequestVar('commentid');
2700 if ( !array_key_exists('member', $comment) || empty($comment['member']) )
2702 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
2706 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
2710 echo date("Y-m-d @ H:i", $comment['timestamp']);
2713 $comment['body'] = str_replace('<br />', '', $comment['body']);
2714 $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
2715 echo $comment['body'];
2717 echo $comment[$type];
2724 * AdminActions::parse_editdesturl()
2725 * Parse skinvar editdesturl
2727 public function parse_editdesturl()
2729 if ( requestVar('desturl') )
2731 echo Entity::hsc(requestVar('desturl'));
2737 * AdminActions::parse_editmemberlist()
2738 * Parse skinvar editmemberlist
2740 * @param string $templateName name of template
2743 public function parse_editmemberlist($templateName = '')
2746 // show list of members with actions
2747 $query = 'SELECT * FROM '.sql_table('member');
2748 $template['content'] = 'memberlist';
2749 $template['tabindex'] = 10;
2751 $batch = new Batch('member');
2752 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
2757 * AdminActions::parse_editmember()
2758 * Parse skinvar editmember
2760 * @param string $type type of information for member
2761 * @return string $tempateName name of template to use
2764 public function parse_editmember($type = 'id', $templateName = '')
2766 global $CONF, $manager, $member;
2768 $memberid = intRequestVar('memberid');
2769 $mem = MEMBER::createFromID($memberid);
2774 echo intRequestVar('memberid');
2777 if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
2779 echo Entity::hsc($mem->getDisplayName());
2783 $dispName = Entity::hsc($mem->getDisplayName());
2784 if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
2786 echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
2795 echo Entity::hsc($mem->getRealName());
2798 echo Entity::hsc($mem->getEmail());
2801 echo Entity::hsc($mem->getURL());
2804 $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
2807 $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
2810 echo Entity::hsc($mem->getNotes());
2813 $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
2822 * AdminActions::parse_editpluginfo()
2823 * Parse skinvar editpluginfo
2825 * @param string $type type of plugin info
2828 public function parse_editpluginfo($type)
2830 $pid = intRequestVar('plugid');
2837 echo Entity::hsc(getPluginNameFromPid($pid));
2844 * AdminActions::parse_editplugoptionslist()
2845 * Parse skinvar editplugoptionslist
2847 * @param string $templateName name of template
2850 public function parse_editplugoptionslist($templateName = '')
2854 $pid = intRequestVar('plugid');
2855 $aOptions = array();
2858 $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC;";
2859 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
2860 $resource = sql_query($query);
2862 while ( $o = sql_fetch_object($resource) )
2864 array_push($aOIDs, $o->oid);
2865 $aOptions[$o->oid] = array(
2867 'value' => $o->odef,
2868 'name' => $o->oname,
2869 'description' => $o->odesc,
2870 'type' => $o->otype,
2871 'typeinfo' => $o->oextra,
2876 // fill out actual values
2877 if ( count($aOIDs) > 0 )
2879 $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
2880 $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
2882 $result = sql_query($query);
2884 while ( $o = sql_fetch_object($result) )
2886 $aOptions[$o->oid]['value'] = $o->ovalue;
2892 'context' => 'global',
2894 'options' => &$aOptions
2896 $manager->notify('PrePluginOptionsEdit', $data);
2898 $template['content'] = 'plugoptionlist';
2900 $amount = Showlist($aOptions, 'table', $template, $templateName);
2904 echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
2910 * AdminActions::parse_editskin()
2911 * Parse skinvar editskin
2913 * @param string $type type of skin
2916 public function parse_editskin($type = 'id')
2918 $skinid = intRequestVar('skinid');
2919 $skin = new SKIN($skinid);
2923 echo intRequestVar('skinid');
2926 echo Entity::hsc($skin->getName());
2929 echo Entity::hsc($skin->getDescription());
2932 echo Entity::hsc($skin->getContentType());
2935 echo Entity::hsc($skin->getIncludePrefix());
2938 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2946 * AdminActions::parse_editskintype()
2947 * Parse skinvar editskintype
2949 * @param string $type name of type for skin type
2952 public function parse_editskintype($type = 'id')
2954 global $CONF, $manager, $member;
2955 $skinid = intRequestVar('skinid');
2956 $skin = new SKIN($skinid);
2957 $fNames = $skin->getAvailableTypes();
2958 $sType = strtolower(trim(requestVar('type')));
2963 echo intRequestVar('skinid');
2966 echo Entity::hsc($skin->getName());
2969 echo Entity::hsc($skin->getDescription());
2972 echo Entity::hsc($skin->getContentType());
2975 echo Entity::hsc($skin->getContentFromDB($sType));
2978 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2979 echo Entity::hsc($skinType);
2982 echo Entity::hsc($sType);
2985 echo Entity::hsc($skin->getIncludePrefix());
2988 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2989 echo Entity::hsc($incMode);
2998 * AdminActions::parse_adminurl()
2999 * Parse skinvar adminurl
3000 * (shortcut for admin url)
3005 public function parse_adminurl()
3007 $this->parse_sitevar('adminurl');
3012 * AdminActions::parse_edittemplateinfo()
3013 * Parse skinvar edittemplateinfo
3015 * @param string $type name of type for skin
3016 * @param string $description description for skin
3017 * @param string $name name of skin
3018 * @param string $help
3019 * @param string $tabindex index value for tabindex attribute of input element
3020 * @param string $big
3021 * @param string $tplt name of template
3024 public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
3028 $t_id = intRequestVar('templateid');
3029 $t_name = Template::getNameFromId($t_id);
3030 $t_desc = Template::getDesc($t_id);
3031 $template = &Template::read($t_name);
3039 echo Entity::hsc($t_name);
3042 echo Entity::hsc($t_desc);
3044 case 'extratemplate':
3046 $pluginfields = array();
3047 $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields));
3052 $tmplt = Template::read($desc);
3054 if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
3058 . '<th colspan="2"><%explugtplname%>' . "</th>\n";
3062 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
3065 foreach ( $pluginfields as $pfkey => $pfvalue )
3067 $data = array('explugtplname' => Entity::hsc($pfkey));
3069 echo Template::fill($base, $data);
3071 foreach ( $pfvalue as $pffield => $pfdesc )
3073 $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
3078 $desc = defined($desc) ? constant($desc) : $desc;
3079 $name = defined($name) ? constant($name) : $name;
3080 $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
3088 * AdminActions::parse_editadmintemplateinfo()
3089 * Parse skinvar editadmintemplateinfo
3091 * @param string $type type of skin template
3092 * @param string $description description of template
3093 * @param string $name name of stemplate
3094 * @param string $tabindex index number for tabindex attribute of input element
3095 * @param string $big
3096 * @param string $tplt
3098 public function parse_editadmintemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
3102 $t_id = intRequestVar('templateid');
3103 $t_name = Template::getNameFromId($t_id);
3104 $t_desc = Template::getDesc($t_id);
3105 $template = &Template::read($t_name);
3113 echo Entity::hsc($t_name);
3116 echo Entity::hsc($t_desc);
3118 case 'extratemplate':
3120 $pluginfields = array();
3121 $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields));
3126 $tmplt = Template::read($desc);
3128 if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
3132 . '<th colspan="2"><%explugtplname%>' . "</th>\n";
3136 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
3139 foreach ( $pluginfields as $pfkey => $pfvalue )
3141 $data = array('explugtplname' => Entity::hsc($pfkey));
3143 echo Template::fill($base, $data);
3145 foreach ( $pfvalue as $pffield => $pfdesc )
3147 $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
3152 $desc = defined($desc) ? constant($desc) : $desc;
3153 $name = defined($name) ? constant($name) : $name;
3154 $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
3161 * AdminActions::parse_eventformextra()
3162 * Parse skinvar eventformextra
3164 * @param string $type name of type for event form extra
3167 public function parse_eventformextra($type = 'activation')
3176 $key = requestVar('ackey');
3179 Admin::error(_ERROR_ACTIVATE);
3181 $info = MEMBER::getActivationInfo($key);
3184 Admin::error(_ERROR_ACTIVATE);
3186 $mem = MEMBER::createFromId($info->vmember);
3189 Admin::error(_ERROR_ACTIVATE);
3192 'type' => 'activation',
3196 case 'membermailform-notloggedin':
3197 $data = array('type' => 'membermailform-notloggedin',);
3200 $manager->notify('FormExtra', $data);
3205 * AdminActions::parse_extrahead()
3206 * Parse skinvar extrahead
3208 public function parse_extrahead()
3212 $extrahead = Admin::getAdminextrahead();
3215 'extrahead' => &$extrahead,
3216 'action' => Admin::getAdminAction()
3219 $manager->notify('AdminPrePageHead', $data);
3225 * AdminActions::parse_member()
3226 * Parse skinvar member
3227 * (includes a member info thingie)
3229 * @param string $what which memberdata is needed
3232 public function parse_member($what)
3234 global $memberinfo, $member, $CONF;
3236 // 1. only allow the member-details-page specific variables on member pages
3237 if ( $this->skintype == 'member' )
3242 echo Entity::hsc($memberinfo->getDisplayName());
3245 echo Entity::hsc($memberinfo->getRealName());
3248 echo Entity::hsc($memberinfo->getNotes());
3251 echo Entity::hsc($memberinfo->getURL());
3254 echo Entity::hsc($memberinfo->getEmail());
3257 echo Entity::hsc($memberinfo->getID());
3262 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3263 if ( $member->isLoggedIn() )
3268 echo $member->getDisplayName();
3270 case 'yourrealname':
3271 echo $member->getRealName();
3274 echo $member->getNotes();
3277 echo $member->getURL();
3280 echo $member->getEmail();
3283 echo $member->getID();
3285 case 'yourprofileurl':
3286 if ( $CONF['URLMode'] == 'pathinfo' )
3288 echo Link::create_member_link($member->getID());
3292 echo $CONF['IndexURL'] . Link::create_member_link($member->getID());
3301 * AdminActions::parse_version()
3302 * Parse skinvar version
3303 * (include nucleus versionnumber)
3308 public function parse_version()
3311 echo 'Nucleus CMS ' . $nucleus['version'];
3316 * AdminActions::parse_sitevar()
3317 * Parse skinvar sitevar
3318 * (include a sitevar)
3320 * @param string $which
3323 public function parse_sitevar($which)
3329 echo $CONF['IndexURL'];
3332 echo $CONF['SiteName'];
3335 echo $CONF['AdminEmail'];
3338 echo $CONF['AdminURL'];
3344 * AdminActions::parse_charset()
3345 * Parse skinvar charset
3350 public function parse_charset()
3352 echo i18n::get_current_charset();
3357 * AdminActions::parse_getblogsetting()
3358 * Parse skinvar getblogsetting
3360 public function parse_getblogsetting($which)
3368 elseif ( $bid = intRequestVar('blogid') )
3371 $b = $manager->getBlog($bid);
3381 return Entity::hsc($b->getID());
3384 return Entity::hsc($b->getURL());
3387 return Entity::hsc($b->getName());
3390 return Entity::hsc($b->getDescription());
3393 return Entity::hsc($b->getShortName());
3395 case 'notifyaddress':
3396 return Entity::hsc($b->getNotifyAddress());
3399 return Entity::hsc($b->getMaxComments());
3402 return Entity::hsc($b->getUpdateFile());
3405 return Entity::hsc($b->getTimeOffset());
3412 * AdminActions::parse_geteditpluginfo()
3413 * Parse skinvar geteditpluginfo
3415 * @param string $type name of setting for edit plugin info
3418 public function parse_geteditpluginfo($type)
3420 $pid = intRequestVar('plugid');
3427 return Entity::hsc(getPluginNameFromPid($pid));
3434 * AdminActions::parse_getmember()
3435 * Parse skinvar getmember
3436 * (includes a member info thingie)
3438 * @param string $what name of setting for member
3441 public function parse_getmember($what)
3443 global $memberinfo, $member;
3444 // 1. only allow the member-details-page specific variables on member pages
3445 if ( $this->skintype == 'member' )
3450 return Entity::hsc($memberinfo->getDisplayName());
3453 return Entity::hsc($memberinfo->getRealName());
3456 return Entity::hsc($memberinfo->getNotes());
3459 return Entity::hsc($memberinfo->getURL());
3462 return Entity::hsc($memberinfo->getEmail());
3465 return Entity::hsc($memberinfo->getID());
3469 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3470 if ( $member->isLoggedIn() )
3475 return $member->getDisplayName();
3477 case 'yourrealname':
3478 return $member->getRealName();
3481 return $member->getNotes();
3484 return $member->getURL();
3487 return $member->getEmail();
3490 return $member->getID();
3498 * AdminActions::parse_headmessage()
3499 * Parse skinvar headmessage
3504 public function parse_headmessage()
3506 if ( !empty(Admin::$headMess) )
3508 echo '<p>' . _MESSAGE . ': ' . Entity::hsc(Admin::$headMess) . "</p>\n";
3514 * AdminActions::parse_helplink()
3515 * Parse skinvar helplink
3517 * @param string $topic name of topic for help
3520 public function parse_helplink($topic = '')
3522 if ( !empty($topic) )
3530 * AdminActions::parse_helpplugname()
3531 * Parse skinvar helpplugname
3536 public function parse_helpplugname()
3538 $plugid = intGetVar('plugid');
3539 Entity::hsc(getPluginNameFromPid($plugid));
3544 * AdminActions::parse_ilistaddnew()
3545 * Parse skinvar ilistaddnew
3550 public function parse_ilistaddnew()
3552 $blogid = intRequestVar('blogid');
3553 if ( intPostVar('start') == 0 )
3555 echo '<p><a href="index.php?action=createitem&blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";
3561 * AdminActions::parse_importskininfo()
3562 * Parse skinvar importskininfo
3564 * @param string $type name of information for imported skin
3567 public function parse_importskininfo($type)
3572 echo Entity::hsc(requestVar('skininfo'));
3575 $dataArr = requestArray('skinnames');
3576 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3579 $dataArr = requestArray('tpltnames');
3580 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3583 $dataArr = requestArray('skinclashes');
3584 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3587 $dataArr = requestArray('tpltclashes');
3588 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3591 echo Entity::hsc(requestVar('skinfile'));
3594 echo Entity::hsc(requestVar('mode'));
3601 * AdminActions::parse_inputyesno()
3602 * Parse skinvar inputyesno
3604 * some init stuff for all forms
3608 function parse_init()
3612 if ( requestVar('action') == 'itemedit' )
3614 $itemid = intRequestVar('itemid');
3615 $item =& $manager->getItem($itemid, 1, 1);
3617 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
3618 if ( $item && $blog->convertBreaks() )
3620 $item['body'] = removeBreaks($item['body']);
3621 $item['more'] = removeBreaks($item['more']);
3624 $authorid = $contents['authorid'];
3626 elseif ( requestVar('action') == 'createitem' )
3628 $blog =& $manager->getBlog(intRequestVar($blogid));
3631 $blog->insertJavaScriptInfo($authorid);
3635 * AdminActions::parse_inputyesno()
3636 * Parse skinvar inputyesno
3638 * @param string $name
3639 * @param string $checkedval
3640 * @param string $tabindex
3641 * @param string $value1
3642 * @param string $value2
3643 * @param string $yesval
3644 * @param string $noval
3645 * @param string $isAdmin
3646 * @param string $templateName
3649 public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
3651 self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
3656 * AdminActions::parse_insertpluginfo()
3657 * Parse templatevar insertpluginfo
3659 public function parse_insertpluginfo($type)
3661 $option = Admin::$aOptions;
3665 return $option['pid'];
3668 return Entity::hsc($option['pfile']);
3675 * AdminActions::parse_insertpluginoptions()
3676 * Parse skinvar insertpluginoptions
3678 * @param string $templateName name of template
3681 public function parse_insertpluginoptions($templateName = '')
3683 $options = Admin::getAdminaOption();
3684 $template = array();
3685 $templats = array();
3687 if ( $templateName )
3689 $templates = Template::read($templateName);
3691 if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
3693 $template['title'] = "<tr>"
3694 . "<th colspan=\"2\"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>"
3699 $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
3701 if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
3703 $template['body'] = "<tr>"
3704 . "<%listplugplugoptionrow%>"
3709 $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
3714 $handler = new Actions($this->skintype);
3715 $parser = new PARSER($handler);
3717 foreach ( $options as $option )
3721 if ( $prevPid != $option['pid'] )
3723 $prevPid = $option['pid'];
3724 $parser->parse($template['title']);
3727 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3729 if ( @$meta['access'] != 'hidden' )
3731 $parsed = $parser->parse($template['body']);
3738 * AdminActions::parse_insplugoptcontent()
3739 * Parse skinvar insplugoptcontent
3744 public function parse_insplugoptcontent()
3746 $option = Admin::$aOption;
3748 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3749 if ( array_key_exists('access', $meta) && $meta['access'] != 'hidden' )
3752 listplug_plugOptionRow($option);
3759 * AdminActions::parse_iprangeinput()
3760 * Parse skinvar iprangeinput
3765 public function parse_iprangeinput()
3767 if ( requestVar('ip') )
3769 $iprangeVal = Entity::hsc(requestVar('ip'));
3770 echo "<input name=\"iprange\" type=\"radio\" value=\"{$iprangeVal}\" checked=\"checked\" id=\"ip_fixed\" />\n";
3771 echo "<label for=\"ip_fixed\">{$iprangeVal}</label><br />\n";
3772 echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
3773 echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
3774 echo "<input name=\"customiprange\" value=\"{$iprangeVal}\" maxlength=\"15\" size=\"15\" />\n";
3778 echo '<input name="iprange" value="custom" type="hidden" />' . "\n";
3779 echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";
3785 * AdminActions::parse_itemnavlist()
3786 * Parse skinvar itemnavlist
3791 public function parse_itemnavlist()
3793 global $CONF, $manager, $member;
3794 if ( $this->skintype == 'itemlist' )
3796 $blogid = intRequestVar('blogid');
3797 $blog =& $manager->getBlog($blogid);
3799 if ( postVar('start') )
3801 $start = intPostVar('start');
3808 // amount of items to show
3809 if ( postVar('amount') )
3811 $amount = intPostVar('amount');
3815 $amount = intval($CONF['DefaultListSize']);
3821 $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
3822 . " FROM %s, %s, %s, %s"
3823 . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid";
3825 $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
3827 if ( $this->skintype == 'itemlist' )
3829 $query .= ' AND iblog = ' . $blogid;
3830 $template['now'] = $blog->getCorrectTime(time());
3832 // non-blog-admins can only edit/delete their own items
3833 if ( !$member->blogAdminRights($blogid) )
3835 $query .= ' AND iauthor = ' . $member->getID();
3838 elseif ( $this->skintype == 'browseownitems' )
3840 $query .= ' AND iauthor = ' . $member->getID();
3842 $template['now'] = time();
3845 // search through items
3846 $search = postVar('search');
3848 if ( !empty($search) )
3850 $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
3851 . ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
3852 . ' OR (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
3854 $query .= ' ORDER BY itime DESC'
3855 . " LIMIT {$start},{$amount}";
3857 $template['content'] = 'itemlist';
3859 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
3860 $navList->showBatchList('item', $query, 'table', $template);
3865 * AdminActions::parse_itemoptions()
3866 * Parse skinvar itemoptions
3867 * Adds the itemOptions of a plugin to a page
3870 function parse_itemoptions()
3872 $this->parse_pluginoptions('item');
3877 * AdminActions::parse_itemoptions()
3879 * date change on edit item
3881 * Parse skinvar itemoptions
3882 * Adds the itemOptions of a plugin to a page
3885 function parse_itemtime($what)
3890 $itemid = intRequestVar('itemid');
3891 $item =& $manager->getItem($itemid, 1, 1);
3893 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
3895 if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
3897 $item['body'] = removeBreaks($item['body']);
3898 $item['more'] = removeBreaks($item['more']);
3901 $contents = array();
3902 if ( requestVar('action') == 'itemedit' )
3906 elseif ( requestVar('action') == 'createitem' )
3909 'contents' => &$contents,
3910 'blog' => &$this->blog
3912 $manager->notify('PreAddItemForm', $data);
3914 $itemtime = getdate($contents['timestamp']);
3915 echo $itemtime[$what];
3920 * AdminActions::parse_jstoolbaroptions()
3921 * Parse skinvar jstoolbaroptions
3926 public function parse_jstoolbaroptions()
3930 _SETTINGS_JSTOOLBAR_NONE,
3931 _SETTINGS_JSTOOLBAR_SIMPLE,
3932 _SETTINGS_JSTOOLBAR_FULL
3936 foreach ( $options as $option )
3938 $text = "<option value=\"%d\"%s>%s</option>\n";
3939 $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';
3940 echo sprintf($text, $i, $extra, $option);
3946 * Parse skinvar languageselectoptions
3948 function parse_languageselectoptions()
3950 $locales = i18n::get_available_locale_list();
3951 $memid = intRequestVar('memberid');
3955 $mem = MEMBER::createFromID($memid);
3956 if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
3958 echo "<option value=\"\" selected=\"selected\">" . ENTITY::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3962 echo "<option value=\"\">" . ENTITY::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3967 if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
3969 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
3972 foreach ( $locales as $locale )
3976 if ( $locale == $mem->getLocale() )
3978 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3982 echo "<option value=\"{$locale}\">{$locale}</option>\n";
3987 if ( $locale == i18n::get_current_locale() )
3989 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3993 echo "<option value=\"{$locale}\">{$locale}</option>\n";
4001 * AdminActions::parse_localeselectoptions()
4002 * Parse skinvar localeselectoptions
4007 public function parse_localeselectoptions()
4009 $locales = i18n::get_available_locale_list();
4011 $memid = intRequestVar('memberid');
4014 $mem = MEMBER::createFromID($memid);
4015 if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
4017 echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
4021 echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
4026 if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
4028 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
4031 foreach ( $locales as $locale )
4035 if ( $locale == $mem->getLocale() )
4037 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
4041 echo "<option value=\"{$locale}\">{$locale}</option>\n";
4046 if ( $locale == i18n::get_current_locale() )
4048 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
4052 echo "<option value=\"{$locale}\">{$locale}</option>\n";
4060 * AdminActions::parse_listplugplugoptionrow()
4061 * Parse templatevar listplugplugoptionrow
4063 * @param string $templateName name of template
4066 public function parse_listplugplugoptionrow($templateName = '')
4068 echo listplug_plugOptionRow(Admin::$aOptions, $templateName);
4073 * AdminActions::parse_mediadirwarning()
4074 * Parse skinvar mediadirwarning
4079 public function parse_mediadirwarning()
4082 if ( !is_dir($DIR_MEDIA) )
4084 echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";
4086 if ( !is_readable($DIR_MEDIA) )
4088 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";
4090 if ( !is_writeable($DIR_MEDIA) )
4092 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";
4098 * AdminActions::parse_movedistselect()
4099 * Parse skinvar movedistselect
4101 public function parse_movedistselect()
4103 $actionType = requestVar('action');
4104 switch ( $actionType )
4107 Admin::selectBlogCategory('destcatid');
4109 case 'batchcategory':
4110 Admin::selectBlog('destblogid');
4113 if ( $this->skintype == 'itemmove' )
4115 $query = "SELECT icat as result FROM %s WHERE inumber=%d;";
4116 $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
4117 $catid = quickQuery(sprintf($query, intRequestVar('itemid')));
4118 Admin::selectBlogCategory('catid', $catid, 10, 1);
4126 * AdminActions::parse_moveitemid()
4127 * Parse skinvar moveitemid
4132 public function parse_moveitemid()
4134 echo intRequestVar('itemid');
4139 * AdminActions::parse_newestcompare()
4140 * Parse skinvar newestcompare
4145 public function parse_newestcompare()
4149 $newestVersion = getLatestVersion();
4150 $newestCompare = str_replace('/', '.', $newestVersion);
4151 $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
4153 if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
4155 echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
4156 echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
4162 * AdminActions::parse_newmemberselect()
4163 * Parse skinvar newmemberselect
4165 * @param string $templateName name of template to use
4168 public function parse_newmemberselect($templateName = '')
4170 $blogid = intRequestVar('blogid');
4172 $query = "SELECT tmember FROM %s WHERE tblog=%d;";
4173 $query = sprintf($query, sql_table('team'), (integer) $blogid);
4174 $res = sql_query($query);
4177 while ( $tmember = sql_fetch_object($res) )
4179 $tmem[] = intval($tmember->tmember);
4182 $query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
4183 $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
4185 $template['name'] = 'memberid';
4186 $template['tabindex'] = 10000;
4187 Showlist($query, 'select', $template, $templateName);
4192 * AdminActions::parse_newpluginlist()
4193 * Parse skinvar newpluginlist
4198 public function parse_newpluginlist()
4200 $candidates = $this->newPlugCandidates;
4201 foreach ( $candidates as $name )
4203 echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";
4209 * AdminActions::parse_outputspecialdirs()
4210 * Parse skinvar outputspecialdirs
4212 * @param string $type type of setting for directory
4215 public function parse_outputspecialdirs($type)
4217 global $DIR_MEDIA, $DIR_NUCLEUS;
4222 echo Entity::hsc($DIR_NUCLEUS);
4225 echo Entity::hsc($DIR_MEDIA);
4232 * AdminActions::parse_passrequestvars()
4233 * Parse skinvar passrequestvars
4238 public function parse_passrequestvars()
4240 $passvar = Admin::getAdminpassvar();
4241 $oldaction = postVar('oldaction');
4243 if ( ($oldaction != 'logout')
4244 && ($oldaction != 'login')
4246 && !postVar('customaction') )
4254 * AdminActions::parse_pluginextras()
4255 * Parse skinvar pluginextras
4257 * @param string $type type of plugin context
4260 public function parse_pluginextras($type = 'global')
4266 $id = intRequestVar('memberid');
4267 $mem = MEMBER::createFromID($id);
4268 $manager->notify('MemberSettingsFormExtras', array('member' => &$mem));
4271 $id = intRequestVar('blogid');
4272 $blg = $manager->getBlog($id);
4273 $manager->notify('BlogSettingsFormExtras', array('member' => &$blg));
4277 'GeneralSettingsFormExtras',
4287 * AdminActions::parse_pluginhelp()
4288 * Parse skinvar pluginhelp
4293 public function parse_pluginhelp()
4295 global $manager, $DIR_PLUGINS;
4297 $plugid = intGetVar('plugid');
4298 $plugName = getPluginNameFromPid($plugid);
4299 $plug =& $manager->getPlugin($plugName);
4301 if ( $plug->supportsFeature('HelpPage') > 0 )
4303 $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
4304 if ( @file_exists($helpfile . 'php') )
4306 @include($helpfile . 'php');
4309 elseif ( @file_exists($helpfile . 'html') )
4311 @include($helpfile . 'html');
4315 echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";
4316 echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";
4321 * AdminActions::parse_pluginlistlist()
4322 * Parse skinvar pluginlistlist
4324 * @param string $templateName name of template to use
4327 public function parse_pluginlistlist($templateName = '')
4329 $query = "SELECT * FROM %s ORDER BY porder ASC;";
4330 $query = sprintf($query, sql_table('plugin'));
4332 $template['content'] = 'pluginlist';
4333 $template['tabindex'] = 10;
4335 Showlist($query, 'table', $template, $templateName);
4341 * AdminActions::parse_pluginoptions()
4342 * Parse skinvar pluginoptions
4344 * @param string $type type of plugin option
4347 public function parse_pluginoptions($type = 'global')
4354 $id = intRequestVar('memberid');
4357 $id = intRequestVar('blogid');
4360 $id = intRequestVar('catid');
4366 Admin::insertPluginOptions($type, $id);
4371 * AdminActions::parse_qmenuaddselect()
4372 * Parse skinvar qmanuaddselect
4374 * @param string $templateName name of template to use
4377 public function parse_qmenuaddselect($templateName = '')
4380 $showAll = requestVar('showall');
4381 if ( $member->isAdmin() && ($showAll == 'yes') )
4383 // Super-Admins have access to all blogs! (no add item support though)
4384 $query = 'SELECT bnumber as value, bname as text'
4385 . ' FROM ' . sql_table('blog')
4386 . ' ORDER BY bname';
4390 $query = 'SELECT bnumber as value, bname as text'
4391 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
4392 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
4393 . ' ORDER BY bname';
4396 $template['name'] = 'blogid';
4397 $template['tabindex'] = 15000;
4398 $template['extra'] = _QMENU_ADD_SELECT;
4399 $template['selected'] = -1;
4400 $template['shorten'] = 10;
4401 $template['shortenel'] = '';
4402 $template['javascript'] = 'onchange="return form.submit()"';
4404 Showlist($query, 'select', $template, $templateName);
4410 * AdminActions::parse_quickmenu()
4411 * Parse skinvar quickmenu
4413 * @param string $templateName name of template to use
4416 public function parse_quickmenu($templateName = '')
4419 $templates = array();
4420 $template = array();
4421 if ( !empty($templateName) )
4423 $templates = Template::read($templateName);
4425 $pluginExtras = array();
4429 'options' => &$pluginExtras
4432 if ( count($pluginExtras) > 0 )
4434 if ( !array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || empty($templates['PLUGIN_QUICKMENU_TITLE']) )
4436 $template['title'] = "<h2><%text(_QMENU_PLUGINS)%></h2>\n";
4440 $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
4442 if ( !array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || empty($templates['PLUGIN_QUICKMENU_HEAD']) )
4444 $template['head'] = "<ul>\n";
4448 $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
4450 if ( !array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) && empty($templates['PLUGIN_QUICKMENU_BODY']) )
4452 $template['body'] = "<li><a href=\"<%plugadminurl%>\" title=\"<%plugadmintooltip%>\"><%plugadmintitle%></a></li>\n";
4456 $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
4458 if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
4460 $template['foot'] = "</ul>\n";
4464 $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
4467 $handler = new Actions($this->skintype);
4468 $parser = new PARSER($handler);
4470 $parser->parse($template['title']);
4471 echo $template['head'];
4472 foreach ( $pluginExtras as $aInfo )
4475 'plugadminurl' => Entity::hsc($aInfo['url']),
4476 'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
4477 'plugadmintitle' => Entity::hsc($aInfo['title']),
4479 echo Template::fill($template['body'], $data);
4481 echo $template['foot'];
4487 * AdminActions::parse_requestblogid()
4488 * Parse skinvar requestblogid
4493 public function parse_requestblogid()
4495 echo intRequestVar('blogid');
4500 * AdminActions::parse_requestiprange()
4501 * Parse skinvar requestiprange
4506 public function parse_requestiprange()
4508 if ( requestVar('iprange') )
4510 echo Entity::hsc(requestVar('iprange'));
4512 elseif ( requestVar('ip') )
4514 echo Entity::hsc(requestVar('ip'));
4520 * AdminActions::parse_selectlocaladminskinfiles()
4521 * Parse skinvar selectlocaladminskinfiles
4526 public function parse_selectlocaladminskinfiles()
4528 global $DIR_SKINS, $manager;
4530 $adminskindir = $DIR_SKINS . 'admin/';
4531 $candidates = SkinImport::searchForCandidates($adminskindir);
4533 foreach ( $candidates as $skinname => $skinfile )
4535 $html = Entity::hsc($skinfile);
4536 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4543 * AdminActions::parse_selectlocalskinfiles()
4544 * Parse skinvar selectlocalskinfiles
4549 public function parse_selectlocalskinfiles()
4553 $candidates = SkinImport::searchForCandidates($DIR_SKINS);
4555 foreach ( $candidates as $skinname => $skinfile )
4557 $html = Entity::hsc($skinfile);
4558 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4565 * AdminActions::parse_skineditallowedlist()
4566 * Parse skinvar skineditallowedlist
4568 * @param string $type type of skin
4569 * @param string $templateName name of template
4572 public function parse_skineditallowedlist($type, $templateName = '')
4577 $query = "SELECT bshortname, bname FROM %s;";
4579 'content' => 'shortblognames'
4581 $query = sprintf($query, sql_table('blog'));
4582 Showlist($query, 'table', $show, $templateName);
4585 $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname NOT LIKE 'admin/%%';";
4587 'content' => 'shortnames'
4589 $query = sprintf($query, sql_table('template_desc'));
4590 Showlist($query, 'table', $show, $templateName);
4597 * AdminActions::parse_skinielist()
4598 * Parse skinvar skinielist
4600 * @param string $type type of skin
4601 * @param string $templateName name of template to use
4604 public function parse_skinielist($type, $templateName = '')
4606 $templates = array();
4607 if ( $templateName )
4609 $templates = Template::read($templateName);
4611 if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
4613 $template = $templates['SKINIE_EXPORT_LIST'];
4618 . "<input type=\"checkbox\" name=\"<%typeid%>\" id=\"<%expid%>\" />\n"
4619 . "<label for=\"<%expid%>\"><%expname%></label>\n"
4621 . "<td><%expdesc%></td>\n"
4628 $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
4629 while ( $skinObj = sql_fetch_object($res) )
4632 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
4633 'expid' => 'skinexp' . $skinObj->sdnumber,
4634 'expname' => Entity::hsc($skinObj->sdname),
4635 'expdesc' => Entity::hsc($skinObj->sddesc),
4637 echo Template::fill($template, $data);
4641 $res = sql_query('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%%';");
4642 while ($templateObj = sql_fetch_object($res)) {
4644 'typeid' => 'template[' . $templateObj->tdnumber . ']',
4645 'expid' => 'templateexp' . $templateObj->tdnumber,
4646 'expname' => Entity::hsc($templateObj->tdname),
4647 'expdesc' => Entity::hsc($templateObj->tddesc),
4649 echo Template::fill($template, $data);
4657 * AdminActions::parse_skinoverview()
4658 * Parse skinvar skinoverview
4660 * @param string $templateName name of template to use
4663 public function parse_skinoverview($templateName = '')
4666 $query = "SELECT * FROM %s WHERE sdname NOT LIKE 'admin/%%';";
4667 $query = sprintf($query, sql_table('skin_desc'));
4669 $template['content'] = 'skinlist';
4670 $template['tabindex'] = 10;
4671 $template['friendly_names'] = $this->skin->getDefaultTypes();
4673 Showlist($query, 'table', $template, $templateName);
4678 * AdminActions::parse_skintypehelp()
4679 * Check editing skintypehelp
4684 public function parse_skintypehelp()
4686 $nowSkinType = strtolower(trim(requestVar('type')));
4688 /* TODO: use Skin class */
4689 $regularType = array(
4700 if ( in_array($nowSkinType, $regularType) )
4702 help('skinpart' . $nowSkinType);
4706 help('skinpartspecial');
4712 * AdminActions::parse_specialskinlist()
4713 * Parse skinvar specialskinlist
4715 * @param string $templateName name of template to use
4718 public function parse_specialskinlist($templateName = '')
4720 $templates = array();
4721 if ( $templateName )
4723 $templates = Template::read($templateName);
4726 /* TODO: use Skin class */
4737 $skinid = intRequestVar('skinid');
4738 $query = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
4739 $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
4741 $res = sql_query($query);
4742 if ( $res && sql_num_rows($res) > 0 )
4745 if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
4747 $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
4751 $template['head'] = "<ul>\n";
4753 echo Template::fill($template['head'], $data);
4754 if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
4756 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&skinid=<%skinid%>'
4757 . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
4758 . 'action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
4762 $template['body'] = $templates['SPECIALSKINLIST_BODY'];
4766 while ( $row = sql_fetch_assoc($res) )
4769 'tabindex' => $tabstart++,
4770 'skinid' => $skinid,
4771 'skintype' => Entity::hsc(strtolower($row['stype']))
4773 echo Template::fill($template['body'], $data);
4776 if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
4778 $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
4782 $template['foot'] = "</ul>\n";
4784 echo Template::fill($template['foot'], $data);
4790 * AdminActions::parse_sprinttext()
4793 * @param string $which
4794 * @param string $val
4797 public function parse_sprinttext($which, $val)
4799 if ( !defined($which) )
4805 $base = constant($which);
4808 if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
4810 if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
4812 $met = 'parse_' . $matchies[0];
4816 $arg = trim($args[0], '()');
4817 $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
4820 if ( method_exists($this, $met) )
4822 $value = call_user_func(array(&$this, $met), $arg);
4826 if ( !isset($value) || empty($value) )
4830 echo sprintf($base, $value);
4835 * AdminActions::parse_systemsettings()
4836 * Parse skinvar systemsettings
4838 * @param string $type type of settings for system
4839 * @param string $templateName name of template to use
4842 public function parse_systemsettings($type = 'phpinfo', $templateName = '')
4844 global $member, $CONF, $nucleus;
4846 $member->isAdmin() or Admin::disallow();
4848 $enable = _ADMIN_SYSTEMOVERVIEW_ENABLE;
4849 $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
4856 case 'sqlserverinfo':
4857 echo sql_get_server_info();
4859 case 'sqlclientinfo':
4860 echo sql_get_client_info();
4862 case 'magicquotesgpc':
4863 echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
4865 case 'magicquotesruntime':
4866 echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';
4868 case 'registerglobals':
4869 echo ini_get('register_globals') ? 'On' : 'Off';
4872 $templates = array();
4873 if ( $templateName )
4875 $templates = Template::read($templateName);
4877 if ( !array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) || empty($templates['SYSTEMINFO_GDSETTINGS']) )
4879 $template = "<tr>\n"
4880 . "<td><%key%></td>\n"
4881 . "<td><%value%></td>\n"
4886 $template = $templates['SYSTEMINFO_GDSETTINGS'];
4889 $gdinfo = gd_info();
4891 foreach ( $gdinfo as $key => $value )
4893 if ( is_bool($value) )
4895 $value = $value ? $enable : $disable;
4899 $value = Entity::hsc($value);
4905 echo Template::fill($template, $data);
4910 phpinfo(INFO_MODULES);
4911 $im = ob_get_contents();
4913 echo ( i18n::strpos($im, 'mod_rewrite') !== FALSE ) ? $enable : $disable;
4915 case 'nucleusversion':
4916 echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
4918 case 'nucleuspatchlevel':
4919 echo getNucleusPatchLevel();
4925 echo $CONF['ItemURL'];
4927 case 'alertonheaderssent':
4928 echo $CONF['alertOnHeadersSent'] ? $enable : $disable;
4930 case 'nucleuscodename':
4931 if ( $nucleus['codename'] != '' )
4933 echo ' "' . $nucleus['codename'] . '"';
4936 case 'versioncheckurl':
4937 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4944 * AdminActions::parse_templateoverview()
4945 * Parse skinvar templateoverview
4947 * @param string $templateName name of template to use
4950 public function parse_templateoverview($templateName = '')
4952 $query = "SELECT * FROM %s WHERE tdname NOT LIKE 'admin/%%' ORDER BY tdname";
4953 $query = sprintf($query, sql_table('template_desc'));
4955 $template['content'] = 'templatelist';
4956 $template['tabindex'] = 10;
4958 Showlist($query, 'table', $template, $templateName);
4964 * AdminActions::parse_ticket()
4970 public function parse_ticket()
4973 $manager->addTicketHidden();
4978 * AdminActions::parse_versioncheckurl()
4979 * Parse skinvar versioncheckurl
4984 public function parse_versioncheckurl()
4986 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4991 * AdminActions::parse_yrbloglist()
4992 * Parse skinvar yrbloglist
4994 * @param string $templateName name of template to use
4997 public function parse_yrbloglist($templateName = '')
5000 $showAll = requestVar('showall');
5002 if ( $member->isAdmin() && ($showAll == 'yes') )
5004 // Super-Admins have access to all blogs! (no add item support though)
5005 $query = "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
5007 . " ORDER BY bnumber;";
5008 $query = sprintf($query, sql_table('blog'));
5012 $query = "SELECT bnumber, bname, tadmin, burl, bshortname"
5014 . " WHERE tblog=bnumber and tmember=%d"
5015 . " ORDER BY bnumber;";
5016 $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
5019 $template['content'] = 'bloglist';
5020 $template['superadmin'] = $member->isAdmin();
5022 $amount = Showlist($query, 'table', $template, $templateName);
5024 if ( ($showAll != 'yes') && ($member->isAdmin()) )
5026 $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
5028 $total = quickQuery($query);
5029 if ( $total > $amount )
5031 echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
5037 echo _OVERVIEW_NOBLOGS;
5039 elseif( $amount != 0 )
5041 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
5043 $query = "SELECT ititle, inumber, bshortname"
5045 . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1;';
5046 $query = sprintf($query, sql_table('item'), sql_table('blog'), (integer) $member->getID());
5048 $template['content'] = 'draftlist';
5050 $amountdrafts = Showlist($query, 'table', $template, $templateName);
5051 if ( $amountdrafts == 0 )
5053 echo _OVERVIEW_NODRAFTS;
5060 * AdminActions::checkCondition()
5061 * Checks conditions for if statements
5063 * @param string $field type of <%if%>
5064 * @param string $name property of field
5065 * @param string $value value of property
5066 * @return boolean condition
5068 protected function checkCondition($field, $name='', $value = '')
5070 global $CONF, $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
5081 $blog =& $manager->getBlog($blogid);
5085 $blogid = getBlogIDFromCatID($catid);
5087 $blog =& $manager->getBlog($blogid);
5089 elseif ( intRequestVar('catid') )
5091 $catid = intRequestVar('catid');
5092 $blogid = getBlogIDFromCatID($catid);
5094 $blog =& $manager->getBlog($blogid);
5101 $condition = ($blog && $this->ifCategory($name, $value));
5104 $condition = ($blog && ($blog->getSetting($name) == $value));
5107 $condition = $member->isLoggedIn();
5110 $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
5113 $condition = $member->isLoggedIn() && $this->ifAdmin($name);
5116 $condition = $member->isLoggedIn() && $member->isAdmin();
5118 case 'allowloginedit':
5119 $condition = $member->isLoggedIn() && ($CONF['AllowLoginEdit'] || $member->isAdmin());
5122 $condition = ($itemidnext != '');
5125 $condition = ($itemidprev != '');
5127 case 'archiveprevexists':
5128 $condition = ($archiveprevexists == true);
5130 case 'archivenextexists':
5131 $condition = ($archivenextexists == true);
5134 $condition = (($name == $this->skintype) || ($name == requestVar('action')));
5137 $condition = $this->ifHasPlugin($name, $value);
5140 $condition = (Admin::getAdminAction() == $name);
5142 case 'adminoldaction':
5143 $condition = (Admin::getAdminAction() == $name);
5145 case 'addresschange':
5146 $condition = ($this->ifAddresscange());
5148 case 'bechangepass':
5149 $condition = ($this->beChangePassword());
5151 case 'skincandidates':
5152 $condition = ($this->ifSkincandidates());
5155 $condition = requestVar('nameclashes');
5157 case 'existsnewplugin':
5158 $condition = ($this->existsNewPlugin());
5161 $condition = (boolean) ($member->getAutosave() == $value);
5164 $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
5171 * Actions::_ifHasPlugin()
5172 * hasplugin,PlugName
5173 * -> checks if plugin exists
5174 * hasplugin,PlugName,OptionName
5175 * -> checks if the option OptionName from plugin PlugName is not set to 'no'
5176 * hasplugin,PlugName,OptionName=value
5177 * -> checks if the option OptionName from plugin PlugName is set to value
5179 * @param string $name name of plugin
5180 * @param string $value
5183 private function ifHasPlugin($name, $value)
5187 // (pluginInstalled method won't write a message in the actionlog on failure)
5188 if ( $manager->pluginInstalled("NP_{$name}") )
5190 $plugin =& $manager->getPlugin("NP_{$name}");
5191 if ( $plugin != NULL )
5199 list($name2, $value2) = preg_split('#=#', $value, 2);
5200 if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
5204 else if ( $plugin->getOption($name2) == $value2 )
5215 * Actions::beChangePassword()
5220 private function beChangePassword()
5222 return intRequestVar('bNeedsPasswordChange');
5226 * Actions::ifSkincandidates()
5227 * Checks if a plugin exists and call its doIf function
5233 private function ifSkincandidates()
5236 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
5237 return (count($candidates) > 0);
5241 * Actions::ifPlugin()
5242 * Checks if a plugin exists and call its doIf function
5244 * @param string $name name of plugin
5245 * @param string $key
5246 * @param string $value
5249 private function ifPlugin($name, $key = '', $value = '')
5253 $plugin =& $manager->getPlugin("NP_{$name}");
5259 $params = func_get_args();
5260 array_shift($params);
5262 return call_user_func_array(array(&$plugin, 'doIf'), $params);
5266 * AdminActions::ifCategory()
5267 * Different checks for a category
5269 * @param string $key key for information of category
5270 * @param string $value value for information of category
5273 private function ifCategory($key = '', $value='')
5275 global $blog, $catid;
5277 // when no parameter is defined, just check if a category is selected
5278 if (($key != 'catname' && $key != 'catid') || ($value == ''))
5280 return $blog->isValidCategory($catid);
5283 // check category name
5284 if ( $key == 'catname' )
5286 $value = $blog->getCategoryIdFromName($value);
5287 if ($value == $catid)
5289 return $blog->isValidCategory($catid);
5293 // check category id
5294 if (($key == 'catid') && ($value == $catid))
5296 return $blog->isValidCategory($catid);
5303 * AdminActions::ifOnTeam()
5304 * Checks if a member is on the team of a blog and return his rights
5306 * @param string $blogName name of weblog
5309 private function ifOnTeam($blogName = '')
5311 global $blog, $member, $manager;
5313 // when no blog found
5314 if ( ($blogName == '') && !is_object($blog) )
5319 // explicit blog selection
5320 if ($blogName != '')
5322 $blogid = getBlogIDFromName($blogName);
5325 if (($blogName == '') || !$manager->existsBlogID($blogid))
5328 $blogid = $blog->getID();
5330 return $member->teamRights($blogid);
5334 * AdminActions::ifAdmin()
5335 * Checks if a member is admin of a blog
5337 * @param string $blogName name of weblog
5340 private function ifAdmin($blogName = '')
5342 global $blog, $member, $manager;
5344 // when no blog found
5345 if (($blogName == '') && (!is_object($blog)))
5350 // explicit blog selection
5351 if ($blogName != '')
5353 $blogid = getBlogIDFromName($blogName);
5356 if (($blogName == '') || !$manager->existsBlogID($blogid))
5359 $blogid = $blog->getID();
5362 return $member->isBlogAdmin($blogid);
5366 * AdminActions::ifAddresscange()
5367 * Check e-Mail address is changed
5372 private function ifAddresscange()
5374 $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");
5379 $info = MEMBER::getActivationInfo($key);
5384 $mem = MEMBER::createFromId($info->vmember);
5389 if ( $info->vtype == 'addresschange' )
5397 * AdminActions::templateEditRow()
5400 * @param array $template
5401 * @param string $desc
5402 * @param string $name
5403 * @param string $help
5404 * @param integer $tabindex
5405 * @param boolean $big
5406 * @param array $tmplt
5409 private function templateEditRow(&$template, $desc, $name, $help = '', $tabindex = 0, $big = 0, $tplt = '')
5413 if ( !array_key_exists($name, $template) )
5415 $template[$name] = '';
5423 $tmplt = skinableTEMPLATE::read($tplt);
5427 'description' => $desc,
5428 'help' => empty($help) ? '' : helpHtml('template' . $help),
5431 'tabindex' => $tabindex,
5432 'rows' => $big ? 10 : 5,
5435 if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $tmplt) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
5437 $base['head'] = "</tr>"
5439 . "<td><%description%><%help%></td>\n"
5440 . "<td id=\"td<%count%>\">\n"
5441 . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">\n";
5445 $base['head'] = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
5448 if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $tmplt) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
5450 $base['tail'] = "</textarea>\n"
5455 $base['tail'] = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
5458 echo TEMPLATE::fill($base['head'], $data);
5459 echo ENTITY::hsc($template[$name]);
5460 echo TEMPLATE::fill($base['tail'], $data);
5468 * AdminActions::customHelp()
5469 * shows a link to custom help file
5472 * @param string $tplName
5473 * @param string $url
5474 * @param string $iconURL
5475 * @param string $alt
5476 * @param string $title
5480 private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
5482 echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
5486 * AdminActions::customHelp()
5487 * shows a link to custom help file
5490 * @param string $tplName
5491 * @param string $url
5492 * @param string $iconURL
5493 * @param string $alt
5494 * @param string $title
5498 static function customHelplink($id, $tplName = '', $url = '', $title = '', $onclick = '')
5502 $templates = array();
5506 $templates = Template::read($tplName);
5509 if ( !array_key_exists($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) || empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) )
5511 $template = "<a href=\"<%helpurl%>#<%helptarget%>\" title=\"<%title%>\" <%onclick%>>\n";
5515 $template = $templates['ADMIN_CUSTOMHELPLINK_ANCHOR'];
5520 $url = $CONF['AdminURL'] . 'documentation/customHelp.html';
5523 if ( empty($onclick) )
5525 $onclick = 'onclick="if (event && event.preventDefault) event.preventDefault(); return help(this.href);"';
5527 elseif ( preg_match('#^onclick#', $onclick) )
5529 $onclick = $onclick;
5533 $onclick = 'onclick="' . $onclick . '"';
5538 'helptarget' => $id,
5539 'onclick' => $onclick,
5540 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
5542 return Template::fill($template, $data);
5546 * AdminActions::customHelpHtml()
5549 * @param string $tplName
5550 * @param string $url
5551 * @param string $iconURL
5552 * @param string $alt
5553 * @param string $title
5554 * @param string $onclick
5555 * @return string anchor element with help uri
5557 private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
5561 $templates = array();
5565 $templates = Template::read($tplName);
5567 if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) || !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
5569 $template = "<img src=\"<%iconurl%>\" <%width%><%height%>alt=\"<%alt%>\" title=\"<%title%>\" /></a>\n";
5573 $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
5576 if ( empty($iconURL) )
5578 $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
5581 if ( function_exists('getimagesize') )
5583 $size = getimagesize($iconURL);
5584 $width = 'width="' . $size[0] . '" ';
5585 $height = 'height="' . $size[1] . '" ';
5589 'iconurl' => $iconURL,
5591 'height' => $height,
5592 'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
5593 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
5596 $icon = Template::fill($template, $data);
5597 $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
5599 return $help . $icon;
5603 * AdminActions::input_yesno
5606 * @param $checkedval
5613 * @param $templateName
5616 private function input_yesno($name,
5627 $templates = array();
5628 if ( $templateName )
5630 $templates = Template::read($templateName);
5633 if ( $name == 'admin' )
5635 if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
5637 $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
5638 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
5639 . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
5640 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
5644 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
5649 if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
5651 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
5655 if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
5657 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
5660 if ( !isset($template) )
5662 $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
5663 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
5664 . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
5665 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
5670 $id = Entity::hsc($name);
5671 $id = str_replace('[', '-', $id);
5672 $id = str_replace(']', '-', $id);
5673 $id1 = $id . Entity::hsc($value1);
5674 $id2 = $id . Entity::hsc($value2);
5676 'name' => Entity::hsc($name),
5677 'yesval' => Entity::hsc($value1),
5678 'noval' => Entity::hsc($value2),
5681 'yesvaltext' => $yesval,
5682 'novaltext' => $noval,
5683 'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
5684 'nocheckedval' => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
5685 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
5690 return Template::fill($template, $dat);
5694 echo Template::fill($template, $dat);
5700 * AdminActions::existsNewPlugin()
5701 * Check exists new plugin
5704 * @return boolean exists or not
5706 private function existsNewPlugin()
5708 global $DIR_PLUGINS;
5710 $candidates = array();
5711 $files = scandir($DIR_PLUGINS);
5713 foreach ( $files as $file )
5715 if ( preg_match("#^NP_(.*)\.php$#", $file, $matches) )
5717 $name = $matches[1];
5718 $query = "SELECT * FROM %s WHERE pfile='%s';";
5719 $query = sprintf($query, sql_table('plugin'), sql_real_escape_string("{NP_{$name}"));
5720 $res = sql_query($query);
5722 if ( sql_num_rows($res) == 0 )
5724 $candidates[] = $name;
5729 $this->newPlugCandidates = $candidates;
5730 return (count($candidates) > 0);