2 class AdminActions extends BaseActions
4 // reference to the skin object for which a part is being parsed
7 // an instance of parser class
12 /* NOTE: list of whole available action names for tags
21 'adminskineditallowedlist',
24 'adminskinselectoptions',
25 'adminspecialskinlist',
26 'admintemplateoverview',
27 'allowedadminskinactions',
50 'configsettingsyesno',
53 'defaultadminskintypes',
63 'editadmintemplateinfo',
69 'editplugoptionslist',
85 'insertpluginoptions',
90 'languageselectoptions',
91 'listplugplugoptionrow',
108 'selectlocaladminskinfiles',
109 'selectlocalskinfiles',
110 'skineditallowedlist',
127 * AdminActions::$default_actions
128 * list of whole action names with which this class can deal
130 static private $default_actions = array(
141 * AdminActions::$skin_type_friendly_names
142 * friendly name for wrapped page types
144 static private $default_skin_types = array(
145 'actionlog' => _ADM_SKPRT_ACTIONLOG,
146 'activate' => _ADM_SKPRT_ACTIVATE,
147 'activatesetpwd' => _ADM_SKPRT_ACTIVATESETPWD,
148 'addnewlog' => _ADM_SKPRT_ADDNEWLOG,
149 'adminerrorpage' => _ADM_SKPRT_ADMINERRORPAGE,
150 'adminskindelete' => _ADM_SKPRT_ADMINSKINDELETE,
151 'adminskinedit' => _ADM_SKPRT_ADMINSKINEDIT,
152 'adminskinedittype' => _ADM_SKPRT_ADMINSKINEDITTYPE,
153 'adminskiniedoimport' => _ADM_SKPRT_ADMINSKINIEDOIMPORT,
154 'adminskinieimport' => _ADM_SKPRT_ADMINSKINIEIMPORT,
155 'adminskinieoverview' => _ADM_SKPRT_ADMINSKINIEOVERVIEW,
156 'adminskinoverview' => _ADM_SKPRT_ADMINSKINOVERVIEW,
157 'adminskinremovetype' => _ADM_SKPRT_ADMINSKINREMOVETYPE,
158 'admintemplatedelete' => _ADM_SKPRT_ADMINTEMPLATEDELETE,
159 'admintemplateedit' => _ADM_SKPRT_ADMINTEMPLATEEDIT,
160 'admintemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW,
161 'backupoverview' => _ADM_SKPRT_BACKUPOVERVIEW,
162 'backuprestore' => _ADM_SKPRT_BACKUPRESTORE,
163 'banlist' => _ADM_SKPRT_BANLIST,
164 'banlistdelete' => _ADM_SKPRT_BANLISTDELETE,
165 'banlistdeleteconfirm' => _ADM_SKPRT_BANLISTDELETECONFIRM,
166 'banlistnew' => _ADM_SKPRT_BANLISTNEW,
167 'batchcategory' => _ADM_SKPRT_BATCHCATEGORY,
168 'batchcomment' => _ADM_SKPRT_BATCHCOMMENT,
169 'batchdelete' => _ADM_SKPRT_BATCHDELETE,
170 'batchitem' => _ADM_SKPRT_BATCHITEM,
171 'batchmember' => _ADM_SKPRT_BATCHMEMBER,
172 'batchmove' => _ADM_SKPRT_BATCHMOVE,
173 'batchteam' => _ADM_SKPRT_BATCHTEAM,
174 'blogcommentlist' => _ADM_SKPRT_BLOGCOMMENTLIST,
175 'blogselectbox' => _ADM_SKPRT_BLOGSELECTBOX,
176 'blogsettings' => _ADM_SKPRT_BLOGSETTINGS,
177 'bookmarklet' => _ADM_SKPRT_BOOKMARKLET,
178 'browseowncomments' => _ADM_SKPRT_BROWSEOWNCOMMENTS,
179 'browseownitems' => _ADM_SKPRT_BROWSEOWNITEMS,
180 'categorydelete' => _ADM_SKPRT_CATEGORYDELETE,
181 'categoryedit' => _ADM_SKPRT_CATEGORYEDIT,
182 'commentdelete' => _ADM_SKPRT_COMMENTDELETE,
183 'commentedit' => _ADM_SKPRT_COMMENTEDIT,
184 'createitem' => _ADM_SKPRT_CREATEITEM,
185 'createnewlog' => _ADM_SKPRT_CREATENEWLOG,
186 'deleteblog' => _ADM_SKPRT_DELETEBLOG,
187 'editmembersettings' => _ADM_SKPRT_EDITMEMBERSETTINGS,
188 'insertpluginoptions' => _ADM_SKPRT_INSERTPLUGINO,
189 'itemcommentlist' => _ADM_SKPRT_ITEMCOMMENTLIST,
190 'itemdelete' => _ADM_SKPRT_ITEMDELETE,
191 'itemedit' => _ADM_SKPRT_ITEMEDIT,
192 'itemlist' => _ADM_SKPRT_ITEMLIST,
193 'itemmove' => _ADM_SKPRT_ITEMMOVE,
194 'login' => FALSE, //missing
195 'manage' => _ADM_SKPRT_MANAGE,
196 'manageteam' => _ADM_SKPRT_MANAGETEAM,
197 'memberdelete' => _ADM_SKPRT_MEMBERDELETE,
198 'memberedit' => FALSE, //missing
199 'overview' => _ADM_SKPRT_OVERVIEW,
200 'pagefoot' => _ADM_SKPRT_PAGEFOOT,
201 'pagehead' => _ADM_SKPRT_PAGEHEAD,
202 'plugindelete' => _ADM_SKPRT_PLUGINDELETE,
203 'pluginhelp' => _ADM_SKPRT_PLUGINHELP,
204 'pluginlist' => _ADM_SKPRT_PLUGINLIST,
205 'pluginoptions' => _ADM_SKPRT_PLUGINOPTIONS,
206 'settingsedit' => _ADM_SKPRT_SETTINGSEDIT,
207 'showlogin' => _ADM_SKPRT_SHOWLOGIN,
208 'skindelete' => _ADM_SKPRT_SKINDELETE,
209 'skinedit' => _ADM_SKPRT_SKINEDIT,
210 'skinedittype' => _ADM_SKPRT_SKINEDITTYPE,
211 'skiniedoimport' => _ADM_SKPRT_SKINIEDOIMPORT,
212 'skinieimport' => _ADM_SKPRT_SKINIEIMPORT,
213 'skinieoverview' => _ADM_SKPRT_SKINIEOVERVIEW,
214 'skinoverview' => _ADM_SKPRT_SKINOVERVIEW,
215 'skinremovetype' => _ADM_SKPRT_SKINREMOVETYPE,
216 'systemoverview' => _ADM_SKPRT_SYSTEMOVERVIEW,
217 'teamdelete' => _ADM_SKPRT_TEAMDELETE,
218 'templatedelete' => _ADM_SKPRT_TEMPLATEDELETE,
219 'templateedit' => _ADM_SKPRT_TEMPLATEEDIT,
220 'templateoverview' => _ADM_SKPRT_TEMPLATEOVERVIEW,
221 'usermanagement' => _ADM_SKPRT_USERMANAGEMENT,
225 * AdminActions::getDefinedActions()
228 * @param string $type page type
229 * @return array allowed actions for the page type
231 static public function getDefinedActions($type = '')
233 $extra_actions = array();
238 $extra_actions = array(
243 $extra_actions = array(
248 case 'activatesetpwd':
249 $extra_actions = array(
253 $extra_actions = array(
259 case 'adminerrorpage':
260 $extra_actions = array(
263 case 'adminskindelete':
264 $extra_actions = array(
268 case 'adminskinedit':
269 $extra_actions = array(
271 'defaultadminskintypes',
272 'adminspecialskinlist',
275 case 'adminskinedittype':
276 $extra_actions = array(
279 'allowedadminskinactions',
280 'adminskineditallowedlist',
283 case 'adminskiniedoimport':
284 $extra_actions = array(
288 case 'adminskinieimport':
289 $extra_actions = array(
293 case 'adminskinieoverview':
294 $extra_actions = array(
295 'selectlocaladminskinfiles',
299 case 'adminskinoverview':
300 $extra_actions = array(
304 case 'adminskinremovetype':
305 $extra_actions = array(
309 case 'admintemplateedit':
310 $extra_actions = array(
311 'editadmintemplateinfo',
314 case 'admintemplateoverview':
315 $extra_actions = array(
316 'admintemplateoverview',
319 case 'backupoverview':
320 $extra_actions = array(
323 case 'backuprestore':
324 $extra_actions = array(
328 $extra_actions = array(
334 case 'banlistdelete':
335 $extra_actions = array(
340 case 'banlistdeleteconfirm':
341 $extra_actions = array(
342 'banlistdeletedlist',
347 $extra_actions = array(
353 case 'batchcategory':
354 $extra_actions = array(
360 $extra_actions = array(
366 $extra_actions = array(
372 $extra_actions = array(
378 $extra_actions = array(
384 $extra_actions = array(
393 $extra_actions = array(
402 $extra_actions = array(
408 case 'blogcommentlist':
409 $extra_actions = array(
415 case 'blogselectbox':
416 $extra_actions = array(
421 $extra_actions = array(
436 $extra_actions = array(
440 case 'browseowncomments':
441 $extra_actions = array(
445 case 'browseownitems':
446 $extra_actions = array(
450 case 'categorydelete':
451 $extra_actions = array(
457 $extra_actions = array(
463 case 'commentdelete':
464 $extra_actions = array(
469 $extra_actions = array(
474 $extra_actions = array(
487 $extra_actions = array(
493 $extra_actions = array(
498 case 'editmembersettings':
499 $extra_actions = array(
501 'languageselectoptions',
502 'adminskinselectoptions',
506 case 'insertpluginoptions':
507 $extra_actions = array(
508 'insertpluginoptions',
511 case 'itemcommentlist':
512 $extra_actions = array(
518 $extra_actions = array(
525 $extra_actions = array(
539 $extra_actions = array(
546 $extra_actions = array(
552 $extra_actions = array(
556 $extra_actions = array(
565 $extra_actions = array(
570 $extra_actions = array(
575 $extra_actions = array(
583 $extra_actions = array(
596 $extra_actions = array(
601 $extra_actions = array(
607 $extra_actions = array(
612 case 'pluginoptions':
613 $extra_actions = array(
615 'editplugoptionslist',
619 $extra_actions = array(
622 'configsettingsedit',
623 'languageselectoptions',
624 'configsettingsyesno',
632 $extra_actions = array(
637 $extra_actions = array(
642 $extra_actions = array(
648 $extra_actions = array(
651 'allowedskinactions',
652 'skineditallowedlist',
653 'skineditallowedlist',
656 case 'skiniedoimport':
657 $extra_actions = array(
662 $extra_actions = array(
666 case 'skinieoverview':
667 $extra_actions = array(
668 'selectlocalskinfiles',
673 $extra_actions = array(
677 case 'skinremovetype':
678 $extra_actions = array(
682 case 'systemoverview':
683 $extra_actions = array(
688 $extra_actions = array(
694 case 'templatedelete':
695 $extra_actions = array(
700 $extra_actions = array(
704 case 'templateoverview':
705 $extra_actions = array(
709 case 'usermanagement':
710 $extra_actions = array(
716 $extra_actions = array(
726 'selectlocaladminskinfiles',
734 $defined_actions = array_merge(self::$default_actions, $extra_actions);
736 return array_merge($defined_actions, parent::getDefinedActions());
740 * AdminActions::getSkinTypeFriendlyNames()
744 * @return array list of friendly names for page actions
746 static public function getDefaultSkinTypes()
748 return self::$default_skin_types;
752 * AdminActions::__construct()
753 * Constructor for a new Actions object
755 * @param string $type
758 public function __construct($type)
760 $this->BaseActions();
761 $this->skintype = $type;
766 * AdminActions::setSkin()
768 * @param object $skin an instance of Skin class
771 public function setSkin(&$skin)
773 $this->skin =& $skin;
778 * AdminActions::setParser()
781 * @param object $parser an instance of Parser class
784 public function setParser(&$parser)
786 $this->parser =& $parser;
791 * AdminActions::parse_actionloglist()
792 * Parse skinvar actionloglist
794 * @param string $templateName name of template to use
797 public function parse_actionloglist($templateName = '')
799 $query = "SELECT * FROM %s ORDER BY timestamp DESC";
800 $query = sprintf($query, sql_table('actionlog'));
802 $template['content'] = 'actionlist';
803 $amount = showlist($query, 'table', $template, $templateName);
809 * AdminActions::parse_activationmessage()
810 * Parse skinvar activationmessage
812 * @param string $type type of message
813 * @param string $templateName name of template to use
816 public function parse_activationmessage($type, $templateName = '')
818 global $CONF, $manager;
822 if ( !empty($templateName))
824 $template = Template::read($templateName);
827 $key = postVar('ackey');
830 Admin::error(_ERROR_ACTIVATE);
833 $info = MEMBER::getActivationInfo($key);
836 Admin::error(_ERROR_ACTIVATE);
839 $mem = MEMBER::createFromId($info->vmember);
842 Admin::error(_ERROR_ACTIVATE);
844 switch ( $info->vtype )
847 if ( array_key_exists('ACTIVATE_FORGOT_TITLE', $template) && !empty($template['ACTIVATE_FORGOT_TITLE']) )
849 $title = $template['ACTIVATE_FORGOT_TITLE'];
853 $title = _ACTIVATE_FORGOT_TITLE;
855 if ( array_key_exists('ACTIVATE_FORGOT_TEXT', $template) && !empty($template['ACTIVATE_FORGOT_TEXT']) )
857 $text = $template['ACTIVATE_FORGOT_TEXT'];
861 $text = _ACTIVATE_FORGOT_TEXT;
865 if ( array_key_exists('ACTIVATE_REGISTER_TITLE', $template) && !empty($template['ACTIVATE_REGISTER_TITLE']) )
867 $title = $template['ACTIVATE_REGISTER_TITLE'];
871 $title = _ACTIVATE_REGISTER_TITLE;
873 if ( array_key_exists('ACTIVATE_REGISTER_TEXT', $template) && !empty($template['ACTIVATE_REGISTER_TEXT']) )
875 $text = $template['ACTIVATE_REGISTER_TEXT'];
879 $text = _ACTIVATE_REGISTER_TEXT;
882 case 'addresschange':
883 if ( array_key_exists('ACTIVATE_CHANGE_TITLE', $template) && !empty($template['ACTIVATE_CHANGE_TITLE']) )
885 $title = $template['ACTIVATE_CHANGE_TITLE'];
889 $title = _ACTIVATE_CHANGE_TITLE;
891 if (array_key_exists('ACTIVATE_CHANGE_TEXT', $template) && !empty($template['ACTIVATE_CHANGE_TEXT']))
893 $text = $template['ACTIVATE_CHANGE_TEXT'];
897 $text = _ACTIVATE_CHANGE_TEXT;
902 'memberName' => Entity::hsc($mem->getDisplayName()),
903 'realName' => Entity::hsc($mem->getRealName()),
908 echo TEMPLATE::fill($title, $aVars);
911 echo TEMPLATE::fill($text, $aVars);
914 echo Entity::hsc($key);
921 * AdminActions::parse_addtickettourl()
922 * Parse skinvar addtickettourl
924 * @param string $url URI for ticket
927 public function parse_addtickettourl($url)
930 $url = $manager->addTicketToUrl($url);
931 echo Entity::hsc($url);
936 * AdminActions::parse_adminbanlist()
937 * Parse skinvar adminbanlist
939 * @param string $templateName name of template to use
942 public function parse_adminbanlist($templateName = '')
944 $blogid = intRequestVar('blogid');
946 $query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";
947 $query = sprintf($query, sql_table('ban'), (integer) $blogid);
949 $template['content'] = 'banlist';
951 $amount = Showlist($query, 'table', $template, $templateName);
961 * AdminActions::parse_adminbatchaction()
962 * Parse skinvar adminbatchaction
967 public function parse_adminbatchaction()
969 echo Entity::hsc(requestVar('batchaction'));
974 * AdminActions::parse_adminbatchlist()
975 * Parse skinvar adminbatchlist
977 * @param string $templateName name of template to use
980 public function parse_adminbatchlist($templateName = '')
983 $templates = array();
984 if ( !empty($templateName) )
986 $templates = Template::read($templateName);
988 if ( isset($templates['ADMIN_BATCHLIST']) || !empty($templates['ADMIN_BATCHLIST']) )
990 $template = $templates['ADMIN_BATCHLIST'];
994 $template = '<li><%text(_BATCH_EXECUTING)%>'
995 . '<b><%adminbatchaction%></b>'
996 . '<%batchlisttype%>'
997 . '<b><%batchid%></b>...'
998 . '<b><%batchlistmsg%></b>'
1002 $selected = requestIntArray('batch');
1003 $action = requestVar('batchaction');
1005 switch ( $this->skintype )
1008 $batchlisttype = _BATCH_ONITEM;
1009 $deleteaction = 'deleteOneItem';
1010 $moveaction = 'moveOneItem';
1011 $destid = intRequestVar('destcatid');
1013 case 'batchcomment':
1014 $batchlisttype = _BATCH_ONCOMMENT;
1015 $deleteaction = 'deleteOneComment';
1018 $batchlisttype = _BATCH_ONMEMBER;
1019 $deleteaction = 'deleteOneMember';
1020 $setadminsql = sql_table('member') . ' SET madmin = 1 WHERE mnumber = ';
1021 $unsetchksql = 'SELECT * FROM ' . sql_table('member') . ' WHERE madmin = 1 AND mcanlogin = 1';
1022 $unsetupsql = sql_table('member') . ' SET madmin = 0 WHERE mnumber = ';
1023 $unseterrmsg = _ERROR_ATLEASTONEADMIN;
1026 $blogid = intRequestVar('blogid');
1027 $batchlisttype = _BATCH_ONTEAM;
1028 $deleteaction = 'deleteOneTeamMember';
1029 $setadminsql = sql_table('team') . ' SET tadmin = 1 WHERE tblog = ' . $blogid . ' AND tmember = ';
1030 $unsetchksql = 'SELECT * FROM ' . sql_table('team') . ' WHERE tadmin = 1 AND tblog = ' . $blogid;
1031 $unseterrmsg = _ERROR_ATLEASTONEBLOGADMIN;
1032 $unsetupsql = sql_table('team') . ' SET tadmin = 0 WHERE tblog = ' . $blogid . ' AND tmember = ';
1034 case 'batchcategory':
1035 $batchlisttype = _BATCH_ONCATEGORY;
1036 $deleteaction = 'deleteOneCategory';
1037 $moveaction = 'moveOneCategory';
1038 $destid = intRequestVar('destblogid');
1042 // walk over all selectedids and perform action
1043 foreach ( $selected as $selectedid )
1046 $selectedid = intval($selectedid);
1050 if ( $this->skintype != 'batchteam' )
1052 $error = Admin::$deleteaction($selectedid);
1056 $error = Admin::deleteOneTeamMember($blogid, $selectedid);
1060 $error = Admin::moveaction($selectedid, $destid);
1064 sql_query('UPDATE ' . $setadminsql . $selectedid);
1068 // there should always remain at least one super-admin
1069 $r = sql_query($unsetchksql);
1070 if ( sql_num_rows($r) < 2 )
1072 $error = $unseterrmsg;
1076 sql_query('UPDATE ' . $unsetupsql . $selectedid);
1080 $error = _BATCH_UNKNOWN . Entity::hsc($action);
1083 'batchid' => $selectedid,
1084 'batchlisttype' => Entity::hsc($batchlisttype),
1085 'adminbatchaction' => Entity::hsc($action),
1086 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,
1088 $handler = new Actions('template', $template, new ADMIN);
1089 $parser = new Parser($handler);
1092 $parser->parse($template);
1093 $template = ob_get_contents();
1096 echo TEMPLATE::fill($template, $data);
1102 * AdminActions::parse_adminbloglink()
1103 * Parse skinvar adminbloglink
1105 * @param string $templateName name of template to use
1108 public function parse_adminbloglink($templateName = '')
1111 $blogid = intRequestVar('blogid');
1112 $blog =& $manager->getBlog($blogid);
1113 $templates = array();
1115 if ( !empty($templateName) )
1117 $templates = Template::read($templateName);
1120 if ( isset($templates['ADMIN_BLOGLINK']) || !empty($templates['ADMIN_BLOGLINK']) )
1122 $template = $templates['ADMIN_BLOGLINK'];
1126 $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
1130 'url' => Entity::hsc($blog->getURL()),
1131 'adminbloglinktitle' => _BLOGLIST_TT_VISIT,
1132 'blogname' => Entity::hsc($blog->getName())
1135 echo TEMPLATE::fill($template, $data);
1140 * AdminActions::parse_adminerrormesg()
1141 * Parse skinvar adminerrormesg
1146 public function parse_adminerrormesg()
1151 if ( requestVar('errormessage') )
1153 $message = requestVar('errormessage');
1155 elseif ( cookieVar($CONF['CookiePrefix'] . 'errormessage') )
1157 $message = cookieVar($CONF['CookiePrefix'] . 'errormessage');
1159 elseif ( Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage') )
1161 $message = Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage');
1163 echo Entity::hsc($message);
1168 * AdminActions::parse_adminskineditallowedlist()
1169 * Parse skinvar adminskineditallowedlist
1171 * @param string $type template/blog
1172 * @param string $templateName name of template to use
1175 public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
1179 /* TODO: blog seems not to be used */
1181 $query = "SELECT bshortname, bname FROM %s";
1182 $query = sprintf($query, sql_table('blog'));
1184 'content' => 'shortblognames'
1188 $query = "SELECT tdname as name, tddesc as description FROM %s;";
1189 $query = sprintf($query, sql_table('admintemplate_desc'));
1191 'content' => 'shortnames'
1195 Showlist($query, 'table', $show, $templateName);
1200 * AdminActions::parse_adminskinielist()
1201 * Parse skinvar adminskinielist
1203 * @param string $type skin/template
1204 * @param string $templateName name of template to use
1207 public function parse_adminskinielist($type, $templateName = '')
1209 $templates = array();
1210 if ( $templateName )
1212 $templates = Template::read($templateName);
1214 if ( isset($templates['SKINIE_EXPORT_LIST']) && !empty($templates['SKINIE_EXPORT_LIST']) )
1216 $template = $templates['SKINIE_EXPORT_LIST'];
1220 $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
1221 . "<td><%expdesc%></td>\n"
1227 $query = "SELECT * FROM %s WHERE sdincmode = 'admin';";
1228 $query = sprintf($query, sql_table('skin_desc'));
1229 $res = sql_query($query);
1231 while ( $skinObj = sql_fetch_object($res) )
1234 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
1235 'expid' => 'skinexp' . $skinObj->sdnumber,
1236 'expname' => Entity::hsc($skinObj->sdname),
1237 'expdesc' => Entity::hsc($skinObj->sddesc),
1239 echo TEMPLATE::fill($template, $data);
1243 $query = "SELECT * FROM %s;";
1244 $query = sprintf($query, sql_table('admintemplate_desc'));
1245 $res = sql_query($query);
1246 while ( $templateObj = sql_fetch_object($res) )
1249 'typeid' => 'template[' . $templateObj->tdnumber . ']',
1250 'expid' => 'templateexp' . $templateObj->tdnumber,
1251 'expname' => Entity::hsc($templateObj->tdname),
1252 'expdesc' => Entity::hsc($templateObj->tddesc),
1254 echo TEMPLATE::fill($template, $data);
1262 * AdminActions::parse_adminskinoverview()
1263 * Parse skinvar adminskinoverview
1265 * @param string $templateName name of template to use
1268 public function parse_adminskinoverview($templateName = '')
1270 $query = "SELECT * FROM %s WHERE sdincmode = 'admin' ORDER BY sdname;";
1271 $query = sprintf($query, sql_table('skin_desc'));
1273 $template['content'] = 'adminskinlist';
1274 $template['tabindex'] = 10;
1275 $template['friendly_names'] = Skin::getFriendlyNames('AdminActions');
1276 Showlist($query, 'table', $template, $templateName);
1281 * AdminActions::parse_adminskinselectoptions()
1282 * Parse skinvar adminskinselectoptions
1287 public function parse_adminskinselectoptions()
1290 $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdincmode = 'admin';";
1291 $query = sprintf($query, sql_table('skin_desc'));
1293 $template['name'] = 'adminskin';
1294 $template['selected'] = $CONF['DefaultAdminSkin'];
1295 $template['tabindex'] = 110;
1296 Showlist($query, 'select', $template, '');
1301 * AdminActions::parse_adminspecialskinlist()
1302 * Parse skinvar adminspecialskinlist
1304 * @param string $templateName name of template to use
1306 public function parse_adminspecialskinlist($templateName = '')
1308 $templates = array();
1309 if ( $templateName )
1311 $templates = Template::read($templateName);
1314 $nType = Skin::getFriendlyNames('AdminActions');
1315 $skinid = intRequestVar('skinid');
1317 $query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";
1318 $query = sprintf($query, sql_table('skin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
1320 $res = sql_query($query);
1321 if ( $res && sql_num_rows($res) > 0 )
1324 if ( array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
1326 $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
1330 $template['head'] = "<ul>\n";
1332 echo TEMPLATE::fill($template['head'], $data);
1334 if ( array_key_exists('ADMIN_SPECIALSKINLIST_BODY', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
1336 $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
1340 $template['body'] = '<li>'
1341 . '<a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
1344 . '(<a tabindex="<%tabindex%>" href="index.php?action=adminskinremovetype&skinid=<%skinid%>&type=<%skintype%>">'
1350 while ( $row = sql_fetch_assoc($res) )
1353 'tabindex' => $tabstart++,
1354 'skinid' => $skinid,
1355 'skintype' => Entity::hsc(strtolower($row['stype']))
1357 echo TEMPLATE::fill($template['body'], $data);
1361 if ( array_key_exists('ADMIN_SPECIALSKINLIST_FOOT', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
1363 $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
1367 $template['foot'] = "</ul>\n";
1369 echo TEMPLATE::fill($template['foot'], $data);
1375 * AdminActions::parse_admintemplateoverview()
1376 * Parse skinvar admintemplateoverview
1378 * @param string $templateName name of template to use
1381 public function parse_admintemplateoverview($templateName = '')
1383 $query = "SELECT * FROM %s ORDER BY tdname;";
1384 $query = sprintf($query, sql_table('admintemplate_desc'));
1386 $template['content'] = 'admintemplatelist';
1387 $template['tabindex'] = 10;
1389 Showlist($query, 'table', $template, $templateName);
1394 * AdminActions::parse_allowedadminskinactions()
1395 * Parse skinvar allowedadminskinactions
1400 public function parse_allowedadminskinactions()
1402 global $DIR_ADMINSKINS;
1403 $skinType = strtolower(trim(requestVar('type')));
1404 $actions = Skin::getAllowedActionsForType($skinType);
1407 while ( $current = array_shift($actions) )
1409 // skip deprecated vars
1410 if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')
1415 echo helplink("adminskinvar-{$current}") . "$current</a>\n";
1416 // echo "<a href=\"{$DIR_ADMINSKINS}documentation/help.html#{$current}\" onclick=\"if (event && event.preventDefault) event.preventDefault(); return help(this.href);\">{$current}</a>\n";
1418 if ( count($actions) != 0 )
1427 * AdminActions::parse_allowedskinactions()
1428 * Parse skinvar allowedskinactions
1433 public function parse_allowedskinactions()
1435 $skinType = strtolower(trim(requestVar('type')));
1436 $actions = SKIN::getAllowedActionsForType($skinType);
1439 while ( $current = array_shift($actions) )
1441 // skip deprecated vars
1442 if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )
1447 /* TODO: alternative function should be used or not? */
1448 echo helplink("skinvar-{$current}") . "$current</a>\n";
1450 if ( count($actions) != 0 )
1459 * AdminActions::parse_banlistdeletedlist()
1460 * Parse skinvar banlistdeletedlist
1462 * @param string $templateName name of template to use
1465 public function parse_banlistdeletedlist($templateName = '')
1468 $templates = array();
1470 if ( $templateName )
1472 $templates = Template::read($templateName);
1474 if ( isset($templates['BANLIST_DELETED_LIST']) && !empty($templates['BANLIST_DELETED_LIST']) )
1476 $template = $templates['BANLIST_DELETED_LIST'];
1480 $template = "<li><%blogname%></li>\n";
1482 $deleted = requestArray('delblogs');
1483 foreach ( $deleted as $delblog )
1485 $blog =& $manager->getBlog($delblog);
1487 Entity::hsc($blog->getName())
1489 TEMPLATE::fill($template, $data);
1495 * AdminActions::parse_batchdeletelist()
1496 * Parse skinvar batchdeletelist
1501 public function parse_batchdeletelist()
1503 $selected = requestIntArray('batch');
1506 foreach ( $selected as $select )
1508 echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
1510 // add hidden vars for team & comment
1511 if ( requestVar('action') == 'batchteam' )
1513 echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";
1515 if ( requestVar('action') == 'batchcomment' )
1517 echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";
1523 * AdminActions::parse_batchdeletetype()
1524 * Parse skinvar batchdeletetype
1529 public function parse_batchdeletetype()
1531 echo Entity::hsc(requestVar('action'));
1536 * AdminActions::parse_batchmovebtn()
1537 * Parse skinvar batchmovebtn
1542 public function parse_batchmovebtn()
1544 $actionType = requestVar('action');
1545 switch ( $actionType )
1550 case 'batchcategory':
1558 * AdminActions::parse_batchmovelist()
1559 * Parse skinvar batchmovelist
1564 public function parse_batchmovelist()
1566 $selected = requestIntArray('batch');
1567 foreach ( $selected as $select )
1569 echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";
1575 * AdminActions::parse_batchmovetitle()
1576 * Parse skinvar batchmovetitle
1581 public function parse_batchmovetitle()
1583 $actionType = requestVar('action');
1584 switch ( $actionType )
1589 case 'batchcategory':
1590 echo _MOVECAT_TITLE;
1597 * AdminActions::parse_batchmovetype()
1598 * Parse skinvar batchmovetype
1603 public function parse_batchmovetype()
1605 echo Entity::hsc(requestVar('action'));
1610 * AdminActions::parse_blogcatlist()
1611 * Parse skinvar blogcatlist
1616 public function parse_blogcatlist()
1619 $blogid = intRequestVar('blogid');
1620 $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
1621 $query = sprintf($query, sql_table('category'), (integer) $blogid);
1623 $template['content'] = 'categorylist';
1624 $template['tabindex'] = 200;
1626 $batch = new Batch('member');
1627 $batch->showlist($query, 'table', $template);
1632 * AdminActions::parse_blognotifysetting()
1633 * Parse skinvar blognotifysetting
1638 public function parse_blognotifysetting($type)
1641 $blogid = intRequestVar('blogid');
1642 $blog = $manager->getBlog($blogid);
1647 if ( !$blog->notifyOnComment() )
1653 if ( !$blog->notifyOnVote() )
1659 if ( !$blog->notifyOnNewItem() )
1665 echo ' checked="checked"';
1670 * AdminActions::parse_blogselectbox()
1671 * Parse skinvar blogselectbox
1676 public function parse_blogselectbox()
1680 $selectData = requestVar('selectData');
1681 $mode = $selectData['mode'];
1682 $name = Entity::hsc($selectData['name']);
1683 $tabindex = Entity::hsc($selectData['tabindex']);
1684 $aBlogIds = array_map('intval', $selectData['aBlogIds']);
1685 $showNewCat = intval($selectData['showNewCat']);
1686 $selected = intval($selectData['selected']);
1688 echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
1690 // 1. select blogs (we'll create optiongroups)
1691 // (only select those blogs that have the user on the team)
1692 $queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
1693 $queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
1694 $blogs = sql_query($queryBlogs);
1696 if ( $mode == 'category' )
1698 if ( sql_num_rows($blogs) > 1 )
1702 while ( $oBlog = sql_fetch_object($blogs) )
1704 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1706 echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\>\n";
1709 // show selection to create new category when allowed/wanted
1712 // check if allowed to do so
1713 if ( $member->blogAdminRights($oBlog->bnumber) )
1715 echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
1719 // 2. for each category in that blog
1720 $catQueriy = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
1721 $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
1722 $categories = sql_query(sprintf($catQueriy));
1723 while ( $oCat = sql_fetch_object($categories) )
1725 if ( $oCat->catid == $selected )
1727 $selectText = ' selected="selected" ';
1733 echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . Entity::hsc($oCat->cname) . "</option>\n";
1736 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1745 while ( $oBlog = sql_fetch_object($blogs) )
1747 echo '<option value="' . $oBlog->bnumber . '"';
1748 if ( $oBlog->bnumber == $selected )
1750 echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . Entity::hsc($oBlog->bname) . "</option>\n";
1754 echo '<option value="' . $oBlog->bnumber . '">' . Entity::hsc($oBlog->bname) . "</option>\n";
1763 * AdminActions::parse_blogsetting()
1764 * Parse skinvar blogsetting
1766 * @param string $which name of weblog setting
1769 public function parse_blogsetting($which)
1771 echo $this->parse_getblogsetting($which);
1776 * AdminActions::parse_blogsettingyesno()
1777 * Parse skinvar blogsettingyesno
1779 * @param string $type type of weblog setting
1780 * @param string $templateName name of template to use
1783 public function parse_blogsettingyesno($type, $templateName = '')
1787 $blogid = intRequestVar('blogid');
1788 $blog = $manager->getBlog($blogid);
1792 case 'convertbreaks':
1793 $checkedval = $blog->convertBreaks();
1796 case 'allowpastposting':
1797 $checkedval = $blog->allowPastPosting();
1801 $checkedval = $blog->commentsEnabled();
1805 $checkedval = $blog->isPublic();
1809 $checkedval = $blog->emailRequired();
1813 $checkedval = $blog->getSearchable();
1817 $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName);
1822 * AdminActions::parse_blogteamlist()
1823 * Parse skinvar blogteamlist
1825 * @param string $templateName name of template to use
1828 public function parse_blogteamlist($templateName = '')
1831 $blogid = intRequestVar('blogid');
1832 $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "
1834 . "WHERE tmember=mnumber AND tblog= %d";
1835 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1837 $template['content'] = 'teamlist';
1838 $template['tabindex'] = 10;
1840 $batch = new Batch('team');
1841 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
1846 * AdminActions::parse_blogteammembers()
1847 * Parse skinvar blogteammembers
1852 public function parse_blogteammembers()
1854 $blogid = intRequestVar('blogid');
1855 $query = "SELECT mname, mrealname "
1857 . "WHERE mnumber=tmember AND tblog=%d;";
1858 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1859 $res = sql_query($query);
1860 $memberNames = array();
1861 while ($o = sql_fetch_object($res)) {
1862 $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
1864 echo implode(',', $memberNames);
1868 * AdminActions::parse_blogtime()
1869 * Parse skinvar blogtime
1871 * @param string $type type of time
1872 * @param string $format format for time expression
1873 * @param integer $offset offset of time
1876 public function parse_blogtime($type, $format = '%H:%M', $offset = 0)
1880 if ( $type != 'blogtime' )
1882 /* return server time */
1883 $timestamp = time() + $offset;
1887 $bid = intRequestVar('blogid');
1888 $b = $manager->getBlog($bid);
1889 $timestamp = $b->getCorrectTime() + $offset;
1892 echo i18n::formatted_datetime($format, $timestamp);
1897 * AdminActions::parse_bookmarkletadmin()
1898 * Parse skinvar bookmarkletadmin
1903 public function parse_bookmarkletadmin()
1907 $blogid = intRequestVar('blogid');
1909 echo Entity::hsc(getBookmarklet($blogid));
1914 * AdminActions::parse_category()
1915 * Parse skinvar category
1917 * @param string $type name of setting for category
1920 public function parse_category($type = 'name')
1922 echo $this->parse_getcategory($type);
1927 * AdminActions::parse_categorysetting()
1928 * Parse skinvar categorysetting
1930 * @param string $type type in category setting
1933 public function parse_categorysetting($type)
1935 $catid = intRequestVar('catid');
1936 if ( $type == 'id' )
1941 $blogid = intRequestVar('blogid');
1942 $query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
1943 $query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
1944 $res = sql_query($query);
1945 $obj = sql_fetch_object($res);
1947 if ( $type != desc )
1949 echo Entity::hsc($obj->cdesc);
1953 echo Entity::hsc($obj->cname);
1960 * AdminActions::parse_codename()
1961 * Parse templatevar codename
1966 * TODO: is this need???
1968 public function parse_codename()
1971 echo $nucleus['codename'];
1976 * AdminActions::parse_commentnavlist()
1977 * Parse skinvar commentnavlist
1982 public function parse_commentnavlist()
1984 global $CONF, $manager, $member;
1987 if ( postVar('start') )
1989 $start = intPostVar('start');
1996 // amount of items to show
1997 if ( postVar('amount') )
1999 $amount = intPostVar('amount');
2003 $amount = (integer) $CONF['DefaultListSize'];
2009 $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
2011 . 'LEFT OUTER JOIN %s ON mnumber=cmember '
2013 $query = sprintf($query, sql_table('comment'), sql_table('member'));
2015 if ( $this->skintype == 'itemcommentlist' )
2017 $itemid = intRequestVar('itemid');
2018 $query .= " citem={$itemid}";
2019 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2021 $nonComments = _NOCOMMENTS;
2023 elseif ( $this->skintype == 'browseowncomments' )
2026 $query .= ' cmember=' . $member->getID();
2027 $template['canAddBan'] = 0;
2029 $nonComments = _NOCOMMENTS_YOUR;
2031 elseif ( $this->skintype == 'blogcommentlist' )
2034 $query .= ' cblog=' . intRequestVar('blogid');
2035 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2036 $bid = intRequestVar('blogid');
2037 $nonComments = _NOCOMMENTS_BLOG;
2040 $search = postVar('search');
2041 if ( !empty($search) )
2043 $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
2046 $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
2048 $template['content'] = 'commentlist';
2050 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
2051 $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
2056 * AdminActions::parse_configsettingsedit()
2057 * Parse skinvar configsettingsedit
2059 * @param string $type type of global configuration
2062 public function parse_configsettingsedit($type)
2067 case 'DefaultListSize':
2068 if ( !array_key_exists('DefaultListSize', $CONF) )
2070 $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
2071 $query = sprintf($query, sql_table('config'));
2073 $CONF['DefaultListSize'] = 10;
2075 elseif ( intval($CONF['DefaultListSize']) < 1 )
2077 $CONF['DefaultListSize'] = 10;
2079 echo intval($CONF['DefaultListSize']);
2081 case 'SessionCookie':
2082 $value = $CONF['SessionCookie'];
2083 $txt1 = _SETTINGS_COOKIESESSION;
2084 $txt2 = _SETTINGS_COOKIEMONTH;
2085 $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);
2088 $value = $CONF['URLMode'];
2089 $txt1 = _SETTINGS_URLMODE_NORMAL;
2090 $txt2 = _SETTINGS_URLMODE_PATHINFO;
2091 $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);
2094 if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )
2096 echo Entity::hsc($CONF[$type]);
2104 * AdminActions::parse_configsettingsyesno()
2105 * Parse skinvar configsettingsyesno
2107 * @param string $type type of global setting
2108 * @param integer $tabindex tabindex attribute of input element
2111 public function parse_configsettingsyesno($type, $tabindex)
2114 if ( array_key_exists($type, $CONF) )
2116 $this->parse_inputyesno($type, $CONF[$type], $tabindex);
2122 * AdminActions::parse_customhelplink()
2123 * Parse skinvar customhelplink
2125 * @param string $topic name of topic
2126 * @param string $tplName name of template
2127 * @param string $url string as URI
2128 * @param string $iconURL string as URI for icon
2129 * @param string $alt alternative text for image element
2130 * @param string $title title for anchor element
2133 public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
2135 $this->customHelp($topic, $url, $iconURL);
2140 * AdminActions::parse_date()
2141 * Parse skinvar date
2143 public function parse_date($format = 'c')
2145 global $CONF, $manager;
2146 echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
2151 * AdminActions::parse_defaultadminskintypes()
2152 * Parse skinvar defaultadminskintypes
2154 * @param string $tabindex index number for tabindex attribute of input element
2155 * @param string $templateName name of template
2158 public function parse_defaultadminskintypes($tabindex, $templateName = '')
2160 $templates = array();
2161 if ( $templateName )
2163 $templates = Template::read($templateName);
2166 $types = Skin::getFriendlyNames('AdminActions');
2169 if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )
2171 $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
2175 $template['head'] = "<ul>\n";
2178 echo $template['head'];
2180 if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )
2182 $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
2186 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
2187 . "<%name%></a> <%help%></li>\n";
2189 $handler = new Actions('template', $template, new ADMIN);
2190 $parser = new PARSER(Actions::getDefinedActions(), $handler);
2192 foreach ( $types as $type => $fName )
2194 $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);
2196 'tabindex' => $tabindex,
2197 'skintype' => $type,
2199 'help' => $helplink,
2200 'skinid' => intrequestVar('skinid'),
2202 $templateBody = Template::fill($template['body'], $data);
2203 $parser->parse($templateBody);
2206 if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )
2208 $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
2212 $template['foot'] = " </ul>\n";
2214 echo $template['foot'];
2219 * AdminActions::parse_defblogselect()
2220 * Parse skinvar defblogselect
2222 * @param string $templateName name of template
2225 public function parse_defblogselect($templateName = '')
2228 $query = "SELECT bname as text, bnumber as value FROM %s;";
2229 $query = sprintf($query, sql_table('blog'));
2230 $template['name'] = 'DefaultBlog';
2231 $template['selected'] = $CONF['DefaultBlog'];
2232 $template['tabindex'] = 10;
2233 Showlist($query, 'select', $template, $templateName);
2238 * AdminActions::parse_defcatselect()
2239 * Parse skinvar defcatselect
2241 * @param string $templateName name of template
2244 public function parse_defcatselect($templateName = '')
2247 $blogid = intRequestVar('blogid');
2248 $blog = $manager->getBlog($blogid);
2249 $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
2250 $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
2251 $template['name'] = 'defcat';
2252 $template['selected'] = $blog->getDefaultCategory();
2253 $template['tabindex'] = 110;
2254 Showlist($query, 'select', $template, $templateName);
2259 * AdminActions::parse_defskinselect()
2260 * Parse skinvar defskinselect
2262 * @param string $type type of skin
2263 * @param string $templateName name of template
2266 public function parse_defskinselect($type = 'blog', $templateName = '')
2269 $query = "SELECT sdname as text, sdnumber as value FROM %s;";
2270 $query = sprintf($query, sql_table('skin_desc'));
2272 $blogid = intRequestVar('blogid');
2277 $template['selected'] = $CONF['BaseSkin'];
2281 $blog = $manager->getBlog($blogid);
2282 $template['selected'] = $blog->getDefaultSkin();
2285 if ( $type != 'blog' )
2287 $nname = 'BaseSkin';
2294 $template['name'] = $nname;
2295 $template['tabindex'] = 50;
2296 Showlist($query, 'select', $template, $templateName);
2301 * AdminActions::parse_deletecomment()
2302 * Parse skinvar deletecomment
2304 * @param string $type type of infomation for comment
2307 public function parse_deletecomment($type = 'id')
2309 $commentid = intRequestVar('commentid');
2310 $comment = COMMENT::getComment($commentid);
2315 echo intRequestVar('commentid');
2318 if ( array_key_exists('member', $comment) && !empty($comment['member']) )
2320 echo $comment['member'];
2324 echo $comment['user'];
2328 $body = strip_tags($comment['body']);
2329 echo Entity::hsc(shorten($body, 300, '...'));
2335 * AdminActions::parse_deleteitembody()
2336 * Parse skinvar deleteitembody
2341 public function parse_deleteitembody()
2344 $itemid = intRequestVar('itemid');
2345 $item =& $manager->getItem($itemid, 1, 1);
2346 $body = strip_tags($item['body']);
2347 echo Entity::hsc(shorten($body, 300, '...'));
2352 * AdminActions::parse_deleteitemid()
2353 * Parse skinvar deleteitemid
2358 public function parse_deleteitemid()
2360 echo (integer) intRequestVar('itemid');
2365 * AdminActions::parse_deleteitemtitle()
2366 * Parse skinvar deleteitemtitle
2371 public function parse_deleteitemtitle()
2374 $itemid = intRequestVar('itemid');
2375 $item =& $manager->getItem($itemid, 1, 1);
2376 echo Entity::hsc(strip_tags($item['title']));
2381 * AdminActions::parse_editadminskin()
2382 * Parse skinvar editadminskin
2384 * @param string $type type of skin setting
2387 public function parse_editadminskin($type = 'id')
2389 $skinid = intRequestVar('skinid');
2390 $skin = new Skin($skinid);
2394 echo intRequestVar('skinid');
2397 echo Entity::hsc($skin->getName());
2400 echo Entity::hsc($skin->getDescription());
2403 echo Entity::hsc($skin->getContentType());
2406 echo Entity::hsc($skin->getIncludePrefix());
2409 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2417 * AdminActions::parse_editadminskintype()
2418 * Parse skinvar editadminskintype
2420 * @param string $type name of skin type
2423 public function parse_editadminskintype($type = 'id')
2425 global $CONF, $manager, $member;
2426 $skinid = intRequestVar('skinid');
2427 $skin = new Skin($skinid);
2428 $fNames = Skin::getFriendlyNames();
2429 $sType = strtolower(trim(requestVar('type')));
2434 echo intRequestVar('skinid');
2437 echo Entity::hsc($skin->getName());
2440 echo Entity::hsc($skin->getDescription());
2443 echo Entity::hsc($skin->getContentType());
2446 echo Entity::hsc($skin->getContent($sType));
2449 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2450 echo Entity::hsc($skinType);
2453 echo Entity::hsc($sType);
2456 echo Entity::hsc($skin->getIncludePrefix());
2459 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2460 echo Entity::hsc($incMode);
2469 * AdminActions::parse_editadmintemplateinfo()
2470 * Parse skinvar editadmintemplateinfo
2472 * @param string $type type of skin template
2473 * @param string $description description of template
2474 * @param string $name name of stemplate
2475 * @param string $tabindex index number for tabindex attribute of input element
2476 * @param string $big
2477 * @param string $tplt
2479 public function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2482 $templateid = intRequestVar('templateid');
2483 $templatename = Template::getNameFromId($templateid);
2484 $templatedescription = Template::getDesc($templateid);
2485 $template =& Template::read($templatename);
2489 echo intval($templateid);
2492 echo Entity::hsc($templatename);
2495 echo Entity::hsc($templatedescription);
2497 case 'extratemplate':
2499 $pluginfields = array();
2501 'AdminTemplateExtraFields',
2503 'fields' => &$pluginfields
2509 $tmplt = Template::read($description);
2511 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2513 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2519 . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2521 foreach ( $pluginfields as $pfkey => $pfvalue )
2524 'explugtplname' => Entity::hsc($pfkey)
2526 echo TEMPLATE::fill($base, $data);
2527 foreach ( $pfvalue as $pffield => $pfdesc )
2529 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2534 $desc = defined($description) ? constant($description) : $description;
2535 $name = defined($name) ? constant($name) : $name;
2536 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2543 * AdminActions::parse_editcomment()
2544 * Parse skinvar editcomment
2546 * @param string $type type of comment setting
2549 public function parse_editcomment($type = 'id')
2552 $commentid = intRequestVar('commentid');
2553 $comment = COMMENT::getComment($commentid);
2555 $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
2560 echo intRequestVar('commentid');
2563 if (array_key_exists('member', $comment) && !empty($comment['member']) )
2565 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
2569 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
2573 echo date("Y-m-d @ H:i", $comment['timestamp']);
2576 $comment['body'] = str_replace('<br />', '', $comment['body']);
2577 $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
2578 echo $comment['body'];
2580 echo $comment[$type];
2587 * AdminActions::parse_editdesturl()
2588 * Parse skinvar editdesturl
2590 public function parse_editdesturl()
2592 if ( requestVar('desturl') )
2594 echo Entity::hsc(requestVar('desturl'));
2600 * AdminActions::parse_editmemberlist()
2601 * Parse skinvar editmemberlist
2603 * @param string $templateName name of template
2606 public function parse_editmemberlist($templateName = '')
2609 // show list of members with actions
2610 $query = 'SELECT * FROM '.sql_table('member');
2611 $template['content'] = 'memberlist';
2612 $template['tabindex'] = 10;
2614 $batch = new Batch('member');
2615 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
2620 * AdminActions::parse_editmember()
2621 * Parse skinvar editmember
2623 * @param string $type type of information for member
2624 * @return string $tempateName name of template to use
2627 public function parse_editmember($type = 'id', $templateName = '')
2629 global $CONF, $manager, $member;
2630 $memberid = intRequestVar('memberid');
2631 $mem = MEMBER::createFromID($memberid);
2636 echo intRequestVar('memberid');
2639 if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
2641 echo Entity::hsc($mem->getDisplayName());
2645 $dispName = Entity::hsc($mem->getDisplayName());
2646 if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
2648 echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
2657 echo Entity::hsc($mem->getRealName());
2660 echo Entity::hsc($mem->getEmail());
2663 echo Entity::hsc($mem->getURL());
2666 $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
2669 $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
2672 echo Entity::hsc($mem->getNotes());
2675 $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
2684 * AdminActions::parse_editpluginfo()
2685 * Parse skinvar editpluginfo
2687 * @param string $type type of plugin info
2690 public function parse_editpluginfo($type)
2692 $pid = intRequestVar('plugid');
2699 echo Entity::hsc(getPluginNameFromPid($pid));
2706 * AdminActions::parse_editplugoptionslist()
2707 * Parse skinvar editplugoptionslist
2709 * @param string $templateName name of template
2712 public function parse_editplugoptionslist($templateName = '')
2716 $pid = intRequestVar('plugid');
2717 $aOptions = array();
2720 $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";
2721 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
2722 $resource = sql_query($query);
2724 while ( $o = sql_fetch_object($resource) )
2726 array_push($aOIDs, $o->oid);
2727 $aOptions[$o->oid] = array(
2730 'value' => $o->odef,
2731 'name' => $o->oname,
2732 'description' => $o->odesc,
2733 'type' => $o->otype,
2734 'typeinfo' => $o->oextra,
2739 // fill out actual values
2740 if ( count($aOIDs) > 0 )
2742 $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
2743 $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
2745 $result = sql_query($query);
2747 while ( $o = sql_fetch_object($result) )
2749 $aOptions[$o->oid]['value'] = $o->ovalue;
2755 'PrePluginOptionsEdit',
2757 'context' => 'global',
2759 'options' => &$aOptions
2763 $template['content'] = 'plugoptionlist';
2764 $amount = Showlist($aOptions, 'table', $template, $templateName);
2767 echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
2773 * AdminActions::parse_editskin()
2774 * Parse skinvar editskin
2776 * @param string $type type of skin
2779 public function parse_editskin($type = 'id')
2781 $skinid = intRequestVar('skinid');
2782 $skin = new SKIN($skinid);
2786 echo intRequestVar('skinid');
2789 echo Entity::hsc($skin->getName());
2792 echo Entity::hsc($skin->getDescription());
2795 echo Entity::hsc($skin->getContentType());
2798 echo Entity::hsc($skin->getIncludePrefix());
2801 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2809 * AdminActions::parse_editskintype()
2810 * Parse skinvar editskintype
2812 * @param string $type name of type for skin type
2815 public function parse_editskintype($type = 'id')
2817 global $CONF, $manager, $member;
2818 $skinid = intRequestVar('skinid');
2819 $skin = new SKIN($skinid);
2820 $fNames = SKIN::getFriendlyNames('Actions');
2821 $sType = strtolower(trim(requestVar('type')));
2826 echo intRequestVar('skinid');
2829 echo Entity::hsc($skin->getName());
2832 echo Entity::hsc($skin->getDescription());
2835 echo Entity::hsc($skin->getContentType());
2838 echo Entity::hsc($skin->getContent($sType));
2841 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2842 echo Entity::hsc($skinType);
2845 echo Entity::hsc($sType);
2848 echo Entity::hsc($skin->getIncludePrefix());
2851 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2852 echo Entity::hsc($incMode);
2861 * AdminActions::parse_edittemplateinfo()
2862 * Parse skinvar edittemplateinfo
2864 * @param string $type name of type for skin
2865 * @param string $description description for skin
2866 * @param string $name name of skin
2867 * @param string $help
2868 * @param string $tabindex index value for tabindex attribute of input element
2869 * @param string $big
2870 * @param string $tplt name of template
2872 public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2875 $templateid = intRequestVar('templateid');
2876 $templatename = TEMPLATE::getNameFromId($templateid);
2877 $templatedescription = TEMPLATE::getDesc($templateid);
2878 $template =& $manager->getTemplate($templatename);
2882 echo intval($templateid);
2885 echo Entity::hsc($templatename);
2888 echo Entity::hsc($templatedescription);
2890 case 'extratemplate':
2892 $pluginfields = array();
2894 'TemplateExtraFields',
2896 'fields' => &$pluginfields
2902 $tmplt = Template::read($description);
2904 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2906 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2910 $base = "</tr><tr>\n"
2911 . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2913 foreach ( $pluginfields as $pfkey => $pfvalue )
2916 'explugtplname' => Entity::hsc($pfkey)
2918 echo TEMPLATE::fill($base, $data);
2919 foreach ( $pfvalue as $pffield => $pfdesc )
2921 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2926 $desc = defined($description) ? constant($description) : $description;
2927 $name = defined($name) ? constant($name) : $name;
2928 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2935 * AdminActions::parse_eventformextra()
2936 * Parse skinvar eventformextra
2938 * @param string $type name of type for event form extra
2941 public function parse_eventformextra($type = 'activation')
2947 $key = requestVar('ackey');
2950 Admin::error(_ERROR_ACTIVATE);
2952 $info = MEMBER::getActivationInfo($key);
2955 Admin::error(_ERROR_ACTIVATE);
2957 $mem = MEMBER::createFromId($info->vmember);
2960 Admin::error(_ERROR_ACTIVATE);
2963 'type' => 'activation',
2967 case 'membermailform-notloggedin':
2969 'type' => 'membermailform-notloggedin',
2973 $manager->notify('FormExtra', $data);
2978 * AdminActions::parse_extrahead()
2979 * Parse skinvar extrahead
2981 public function parse_extrahead()
2984 $extrahead = Admin::extrahead;
2988 'extrahead' => &$extrahead,
2989 'action' => Admin::action
2997 * AdminActions::parse_getblogsetting()
2998 * Parse skinvar getblogsetting
3000 public function parse_getblogsetting($which)
3008 elseif ( $bid = intRequestVar('blogid') )
3011 $b = $manager->getBlog($bid);
3021 return Entity::hsc($b->getID());
3024 return Entity::hsc($b->getURL());
3027 return Entity::hsc($b->getName());
3030 return Entity::hsc($b->getDescription());
3033 return Entity::hsc($b->getShortName());
3035 case 'notifyaddress':
3036 return Entity::hsc($b->getNotifyAddress());
3039 return Entity::hsc($b->getMaxComments());
3042 return Entity::hsc($b->getUpdateFile());
3045 return Entity::hsc($b->getTimeOffset());
3052 * AdminActions::parse_geteditpluginfo()
3053 * Parse skinvar geteditpluginfo
3055 * @param string $type name of setting for edit plugin info
3058 public function parse_geteditpluginfo($type)
3060 $pid = intRequestVar('plugid');
3067 return Entity::hsc(getPluginNameFromPid($pid));
3074 * AdminActions::parse_getmember()
3075 * Parse skinvar getmember
3076 * (includes a member info thingie)
3078 * @param string $what name of setting for member
3081 public function parse_getmember($what)
3083 global $memberinfo, $member;
3084 // 1. only allow the member-details-page specific variables on member pages
3085 if ( $this->skintype == 'member' )
3090 return Entity::hsc($memberinfo->getDisplayName());
3093 return Entity::hsc($memberinfo->getRealName());
3096 return Entity::hsc($memberinfo->getNotes());
3099 return Entity::hsc($memberinfo->getURL());
3102 return Entity::hsc($memberinfo->getEmail());
3105 return Entity::hsc($memberinfo->getID());
3109 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3110 if ( $member->isLoggedIn() )
3115 return $member->getDisplayName();
3117 case 'yourrealname':
3118 return $member->getRealName();
3121 return $member->getNotes();
3124 return $member->getURL();
3127 return $member->getEmail();
3130 return $member->getID();
3138 * AdminActions::parse_headmessage()
3139 * Parse skinvar headmessage
3144 public function parse_headmessage()
3146 if ( !empty(Admin::$headMess) )
3148 echo '<p>' . _MESSAGE . ': ' . Entity::hsc(Admin::$headMess) . "</p>\n";
3154 * AdminActions::parse_helplink()
3155 * Parse skinvar helplink
3157 * @param string $topic name of topic for help
3160 public function parse_helplink($topic = '')
3162 if ( empty($topic) )
3171 * AdminActions::parse_helpplugname()
3172 * Parse skinvar helpplugname
3177 public function parse_helpplugname()
3179 $plugid = intGetVar('plugid');
3180 Entity::hsc(getPluginNameFromPid($plugid));
3185 * AdminActions::parse_ilistaddnew()
3186 * Parse skinvar ilistaddnew
3191 public function parse_ilistaddnew()
3193 $blogid = intRequestVar('blogid');
3194 if ( intPostVar('start') == 0 )
3196 echo '<p><a href="index.php?action=createitem&blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";
3202 * AdminActions::parse_importskininfo()
3203 * Parse skinvar importskininfo
3205 * @param string $type name of information for imported skin
3208 public function parse_importskininfo($type)
3213 echo Entity::hsc(requestVar('skininfo'));
3216 $dataArr = requestArray('skinnames');
3217 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3220 $dataArr = requestArray('tpltnames');
3221 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3224 $dataArr = requestArray('skinclashes');
3225 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3228 $dataArr = requestArray('tpltclashes');
3229 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3232 echo Entity::hsc(requestVar('skinfile'));
3235 echo Entity::hsc(requestVar('mode'));
3242 * AdminActions::parse_inputyesno()
3243 * Parse skinvar inputyesno
3245 * @param string $name
3246 * @param string $checkedval
3247 * @param string $tabindex
3248 * @param string $value1
3249 * @param string $value2
3250 * @param string $yesval
3251 * @param string $noval
3252 * @param string $isAdmin
3253 * @param string $templateName
3256 public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
3258 self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
3263 * AdminActions::parse_insertpluginfo()
3264 * Parse templatevar insertpluginfo
3266 public function parse_insertpluginfo($type)
3268 $option = Admin::$aOptions;
3272 return $option['pid'];
3275 return Entity::hsc($option['pfile']);
3282 * AdminActions::parse_insertpluginoptions()
3283 * Parse skinvar insertpluginoptions
3285 * @param string $templateName name of template
3288 public function parse_insertpluginoptions($templateName = '')
3290 $options = Admin::$aOptions;
3291 $template = array();
3292 $templats = array();
3294 if ( $templateName )
3296 $templates = Template::read($templateName);
3298 if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )
3300 $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
3304 $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";
3306 if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )
3308 $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
3312 $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";
3317 foreach ( $options as $option )
3319 $handler = new Actions($this->skintype, $template, $option);
3320 $parser = new PARSER(Actions::getDefinedActions(), $handler);
3322 if ( $prevPid != $option['pid'] )
3324 $prevPid = $option['pid'];
3325 $parser->parse($template['title']);
3327 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3328 if ( @$meta['access'] != 'hidden' )
3330 $parsed = $parser->parse($template['body']);
3337 * AdminActions::parse_insplugoptcontent()
3338 * Parse skinvar insplugoptcontent
3343 public function parse_insplugoptcontent()
3345 $option = Admin::$aOption;
3347 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3348 if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')
3351 listplug_plugOptionRow($option);
3358 * AdminActions::parse_iprangeinput()
3359 * Parse skinvar iprangeinput
3364 public function parse_iprangeinput()
3366 if ( requestVar('ip') )
3368 $iprangeVal = Entity::hsc(requestVar('ip'));
3369 echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";
3370 echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";
3371 echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
3372 echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
3373 echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";
3377 echo '<input name="iprange" value="custom" type="hidden" />' . "\n";
3378 echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";
3384 * AdminActions::parse_itemnavlist()
3385 * Parse skinvar itemnavlist
3390 public function parse_itemnavlist()
3392 global $CONF, $manager, $member;
3393 if ( $this->skintype == 'itemlist' )
3395 $blogid = intRequestVar('blogid');
3396 $blog =& $manager->getBlog($blogid);
3398 if ( postVar('start') )
3400 $start = intPostVar('start');
3407 // amount of items to show
3408 if ( postVar('amount') )
3410 $amount = intPostVar('amount');
3414 $amount = intval($CONF['DefaultListSize']);
3420 $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
3421 . " FROM %s, %s, %s"
3422 . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid;";
3424 $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
3426 if ( $this->skintype == 'itemlist' )
3428 $query .= 'and iblog = ' . $blogid;
3429 $template['now'] = $blog->getCorrectTime(time());
3431 // non-blog-admins can only edit/delete their own items
3432 if ( !$member->blogAdminRights($blogid) )
3434 $query .= ' and iauthor = ' . $member->getID();
3437 elseif ( $this->skintype == 'browseownitems' )
3439 $query .= 'and iauthor = ' . $member->getID();
3441 $template['now'] = time();
3444 // search through items
3445 $search = postVar('search');
3447 if ( !empty($search) )
3449 $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
3450 . ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
3451 . ' OR (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
3453 $query .= ' ORDER BY itime DESC'
3454 . " LIMIT {$start},{$amount}";
3456 $template['content'] = 'itemlist';
3458 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
3459 $navList->showBatchList('item', $query, 'table', $template);
3464 * AdminActions::parse_jstoolbaroptions()
3465 * Parse skinvar jstoolbaroptions
3470 public function parse_jstoolbaroptions()
3474 _SETTINGS_JSTOOLBAR_NONE,
3475 _SETTINGS_JSTOOLBAR_SIMPLE,
3476 _SETTINGS_JSTOOLBAR_FULL
3479 foreach ( $options as $option )
3481 $text = "<option value=\"%d\"%s>%s</option>\n";
3482 $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';
3483 echo sprintf($text, $i, $extra, $option);
3490 * AdminActions::parse_localeselectoptions()
3491 * Parse skinvar localeselectoptions
3496 public function parse_localeselectoptions()
3498 $locales = i18n::get_available_locale_list();
3499 $memid = intRequestVar('memberid');
3502 $mem = MEMBER::createFromID($memid);
3503 if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
3505 echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3509 echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3514 if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
3516 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
3519 foreach ( $locales as $locale )
3523 if ( $locale == $mem->getLocale() )
3525 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3529 echo "<option value=\"{$locale}\">{$locale}</option>\n";
3534 if ( $locale == i18n::get_current_locale() )
3536 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3540 echo "<option value=\"{$locale}\">{$locale}</option>\n";
3548 * AdminActions::parse_listplugplugoptionrow()
3549 * Parse templatevar listplugplugoptionrow
3551 * @param string $templateName name of template
3554 public function parse_listplugplugoptionrow($templateName = '')
3556 echo listplug_plugOptionRow(Admin::$aOptions, $templateName);
3561 * AdminActions::parse_mediadirwarning()
3562 * Parse skinvar mediadirwarning
3567 public function parse_mediadirwarning()
3570 if ( !is_dir($DIR_MEDIA) )
3572 echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";
3574 if ( !is_readable($DIR_MEDIA) )
3576 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";
3578 if ( !is_writeable($DIR_MEDIA) )
3580 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";
3586 * AdminActions::parse_movedistselect()
3587 * Parse skinvar movedistselect
3589 public function parse_movedistselect()
3591 $actionType = requestVar('action');
3592 switch ( $actionType )
3595 Admin::selectBlogCategory('destcatid');
3597 case 'batchcategory':
3598 Admin::selectBlog('destblogid');
3601 if ( $this->skintype == 'itemmove' )
3603 $query = "SELECT icat as result FROM %s WHERE inumber=%d;";
3604 $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
3605 $catid = quickQuery(sprintf($query, intRequestVar('itemid')));
3606 Admin::selectBlogCategory('catid', $catid, 10, 1);
3614 * AdminActions::parse_moveitemid()
3615 * Parse skinvar moveitemid
3620 public function parse_moveitemid()
3622 echo intRequestVar('itemid');
3627 * AdminActions::parse_newestcompare()
3628 * Parse skinvar newestcompare
3633 public function parse_newestcompare()
3636 $newestVersion = getLatestVersion();
3637 $newestCompare = str_replace('/', '.', $newestVersion);
3638 $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
3639 if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
3641 echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
3642 echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
3648 * AdminActions::parse_newmemberselect()
3649 * Parse skinvar newmemberselect
3651 * @param string $templateName name of template to use
3654 public function parse_newmemberselect($templateName = '')
3656 $blogid = intRequestVar('blogid');
3658 $query = "SELECT tmember FROM %s WHERE tblog=%d;";
3659 $query = sprintf($query, sql_table('team'), (integer) $blogid);
3660 $res = sql_query($query);
3663 while ( $tmember = sql_fetch_object($res) )
3665 $tmem[] = intval($tmember->tmember);
3668 $query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
3669 $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
3671 $template['name'] = 'memberid';
3672 $template['tabindex'] = 10000;
3673 Showlist($query, 'select', $template, $templateName);
3678 * AdminActions::parse_newpluginlist()
3679 * Parse skinvar newpluginlist
3684 public function parse_newpluginlist()
3686 $candidates = $this->newPlugCandidates;
3687 foreach ( $candidates as $name )
3689 echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";
3695 * AdminActions::parse_outputspecialdirs()
3696 * Parse skinvar outputspecialdirs
3698 * @param string $type type of setting for directory
3701 public function parse_outputspecialdirs($type)
3706 global $DIR_NUCLEUS;
3707 echo Entity::hsc($DIR_NUCLEUS);
3711 echo Entity::hsc($DIR_MEDIA);
3718 * AdminActions::parse_passrequestvars()
3719 * Parse skinvar passrequestvars
3724 public function parse_passrequestvars()
3726 $oldaction = postVar('oldaction');
3727 if ( ($oldaction != 'logout')
3728 && ($oldaction != 'login')
3730 && !postVar('customaction') )
3738 * AdminActions::parse_pluginextras()
3739 * Parse skinvar pluginextras
3741 * @param string $type type of plugin context
3744 public function parse_pluginextras($type = 'global')
3750 $id = intRequestVar('memberid');
3751 $mem = MEMBER::createFromID($id);
3753 'MemberSettingsFormExtras',
3760 $id = intRequestVar('blogid');
3761 $blg = $manager->getBlog($id);
3763 'BlogSettingsFormExtras',
3771 'GeneralSettingsFormExtras',
3781 * AdminActions::parse_pluginhelp()
3782 * Parse skinvar pluginhelp
3787 public function parse_pluginhelp()
3789 global $manager, $DIR_PLUGINS;
3790 $plugid = intGetVar('plugid');
3791 $plugName = getPluginNameFromPid($plugid);
3792 $plug =& $manager->getPlugin($plugName);
3794 if ( $plug->supportsFeature('HelpPage') > 0 )
3796 $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
3797 if ( @file_exists($helpfile . 'php') )
3799 @include($helpfile . 'php');
3802 elseif ( @file_exists($helpfile . 'html') )
3804 @include($helpfile . 'html');
3808 echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";
3809 echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";
3814 * AdminActions::parse_pluginlistlist()
3815 * Parse skinvar pluginlistlist
3817 * @param string $templateName name of template to use
3820 public function parse_pluginlistlist($templateName = '')
3822 $query = "SELECT * FROM %s ORDER BY porder ASC;";
3823 $query = sprintf($query, sql_table('plugin'));
3824 $template['content'] = 'pluginlist';
3825 $template['tabindex'] = 10;
3826 Showlist($query, 'table', $template, $templateName);
3831 * AdminActions::parse_pluginoptions()
3832 * Parse skinvar pluginoptions
3834 * @param string $type type of plugin option
3837 public function parse_pluginoptions($type = 'global')
3842 $id = intRequestVar('memberid');
3845 $id = intRequestVar('blogid');
3848 $id = intRequestVar('catid');
3851 Admin::insertPluginOptions($type, $id);
3856 * AdminActions::parse_qmenuaddselect()
3857 * Parse skinvar qmanuaddselect
3859 * @param string $templateName name of template to use
3862 public function parse_qmenuaddselect($templateName = '')
3865 $showAll = requestVar('showall');
3866 if ( $member->isAdmin() && ($showAll == 'yes') )
3868 // Super-Admins have access to all blogs! (no add item support though)
3869 $query = 'SELECT bnumber as value, bname as text'
3870 . ' FROM ' . sql_table('blog')
3871 . ' ORDER BY bname';
3875 $query = 'SELECT bnumber as value, bname as text'
3876 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
3877 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
3878 . ' ORDER BY bname';
3880 $template['name'] = 'blogid';
3881 $template['tabindex'] = 15000;
3882 $template['extra'] = _QMENU_ADD_SELECT;
3883 $template['selected'] = -1;
3884 $template['shorten'] = 10;
3885 $template['shortenel'] = '';
3886 $template['javascript'] = 'onchange="return form.submit()"';
3887 Showlist($query, 'select', $template, $templateName);
3892 * AdminActions::parse_quickmenu()
3893 * Parse skinvar quickmenu
3895 * @param string $templateName name of template to use
3898 public function parse_quickmenu($templateName = '')
3901 $templates = array();
3902 $template = array();
3903 if ( !empty($templateName) )
3905 $templates = Template::read($templateName);
3907 $pluginExtras = array();
3911 'options' => &$pluginExtras
3914 if ( count($pluginExtras) > 0 )
3916 if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )
3918 $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
3922 $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';
3924 $handler = new Actions($this->skintype, $template, $this->objAdmin);
3925 $parser = new PARSER(Actions::getDefinedActions(), $handler);
3926 $parser->parse($template['title']);
3928 if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )
3930 $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
3934 $template['head'] = '<ul>';
3937 echo $template['head'];
3939 if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )
3941 $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
3945 $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';
3948 foreach ( $pluginExtras as $aInfo )
3951 'plugadminurl' => Entity::hsc($aInfo['url']),
3952 'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
3953 'plugadmintitle' => Entity::hsc($aInfo['title']),
3955 echo TEMPLATE::fill($template['body'], $data);
3957 if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
3959 $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
3963 $template['foot'] = '</ul>';
3965 echo $template['foot'];
3971 * AdminActions::parse_requestblogid()
3972 * Parse skinvar requestblogid
3977 public function parse_requestblogid()
3979 echo intRequestVar('blogid');
3984 * AdminActions::parse_requestiprange()
3985 * Parse skinvar requestiprange
3990 public function parse_requestiprange()
3992 if ( requestVar('iprange') )
3994 echo Entity::hsc(requestVar('iprange'));
3996 elseif ( requestVar('ip') )
3998 echo Entity::hsc(requestVar('ip'));
4004 * AdminActions::parse_selectlocaladminskinfiles()
4005 * Parse skinvar selectlocaladminskinfiles
4010 public function parse_selectlocaladminskinfiles()
4012 global $DIR_ADMINSKINS, $manager;
4013 $candidates = SkinImport::searchForCandidates($DIR_ADMINSKINS);
4014 foreach ( $candidates as $skinname => $skinfile )
4016 $html = Entit::hsc($skinfile);
4017 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4023 * AdminActions::parse_selectlocalskinfiles()
4024 * Parse skinvar selectlocalskinfiles
4029 public function parse_selectlocalskinfiles()
4032 $candidates = SkinImport::searchForCandidates($DIR_SKINS);
4033 foreach ( $candidates as $skinname => $skinfile )
4035 $html = Entity::hsc($skinfile);
4036 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4042 * AdminActions::parse_skineditallowedlist()
4043 * Parse skinvar skineditallowedlist
4045 * @param string $type type of skin
4046 * @param string $templateName name of template
4049 public function parse_skineditallowedlist($type, $templateName = '')
4054 $query = "SELECT bshortname, bname FROM %s";
4056 'content' => 'shortblognames'
4058 $query = sprintf($query, sql_table('blog'));
4059 Showlist($query, 'table', $show, $templateName);
4062 $query = "SELECT tdname as name, tddesc as description FROM %s";
4064 'content' => 'shortnames'
4066 $query = sprintf($query, sql_table('template_desc'));
4067 Showlist($query, 'table', $show, $templateName);
4074 * AdminActions::parse_skinielist()
4075 * Parse skinvar skinielist
4077 * @param string $type type of skin
4078 * @param string $templateName name of template to use
4081 public function parse_skinielist($type, $templateName = '')
4083 $templates = array();
4084 if ( $templateName )
4086 $templates = Template::read($templateName);
4088 if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
4090 $template = $templates['SKINIE_EXPORT_LIST'];
4094 $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
4095 . "<td><%expdesc%></td>\n"
4101 $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
4102 while ( $skinObj = sql_fetch_object($res) )
4105 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
4106 'expid' => 'skinexp' . $skinObj->sdnumber,
4107 'expname' => Entity::hsc($skinObj->sdname),
4108 'expdesc' => Entity::hsc($skinObj->sddesc),
4110 echo TEMPLATE::fill($template, $data);
4114 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
4115 while ($templateObj = sql_fetch_object($res)) {
4117 'typeid' => 'template[' . $templateObj->tdnumber . ']',
4118 'expid' => 'templateexp' . $templateObj->tdnumber,
4119 'expname' => Entity::hsc($templateObj->tdname),
4120 'expdesc' => Entity::hsc($templateObj->tddesc),
4122 echo TEMPLATE::fill($template, $data);
4130 * AdminActions::parse_skinoverview()
4131 * Parse skinvar skinoverview
4133 * @param string $templateName name of template to use
4136 public function parse_skinoverview($templateName = '')
4138 $query = "SELECT * FROM %s ORDER BY sdname";
4139 $query = sprintf($query, sql_table('skin_desc'));
4141 $template['content'] = 'skinlist';
4142 $template['tabindex'] = 10;
4143 $template['friendly_names'] = Skin::getFriendlyNames('Actions');
4145 Showlist($query, 'table', $template, $templateName);
4150 * AdminActions::parse_skintypehelp()
4151 * Check editing skintypehelp
4156 public function parse_skintypehelp()
4158 $nowSkinType = strtolower(trim(requestVar('type')));
4159 $regularType = array(
4170 if ( in_array($nowSkinType, $regularType) )
4172 help('skinpart' . $nowSkinType);
4176 help('skinpartspecial');
4182 * AdminActions::parse_specialskinlist()
4183 * Parse skinvar specialskinlist
4185 * @param string $templateName name of template to use
4188 public function parse_specialskinlist($templateName = '')
4190 $templates = array();
4191 if ( $templateName )
4193 $templates = Template::read($templateName);
4205 $skinid = intRequestVar('skinid');
4206 $query = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
4207 $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
4209 $res = sql_query($query);
4210 if ( $res && sql_num_rows($res) > 0 )
4213 if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
4215 $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
4219 $template['head'] = "<ul>\n";
4221 echo TEMPLATE::fill($template['head'], $data);
4222 if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )
4224 $template['body'] = $templates['SPECIALSKINLIST_BODY'];
4228 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&skinid=<%skinid%>'
4229 . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
4230 . 'action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
4233 while ( $row = sql_fetch_assoc($res) )
4236 'tabindex' => $tabstart++,
4237 'skinid' => $skinid,
4238 'skintype' => Entity::hsc(strtolower($row['stype']))
4240 echo TEMPLATE::fill($template['body'], $data);
4243 if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
4245 $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
4249 $template['foot'] = "</ul>\n";
4251 echo TEMPLATE::fill($template['foot'], $data);
4257 * AdminActions::parse_sprinttext()
4260 * @param string $which
4261 * @param string $val
4264 public function parse_sprinttext($which, $val)
4266 if ( !defined($which) )
4272 $base = constant($which);
4275 if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
4277 if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
4279 $met = 'parse_' . $matchies[0];
4283 $arg = trim($args[0], '()');
4284 $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
4287 if ( method_exists($this, $met) )
4289 $value = call_user_func(array(&$this, $met), $arg);
4293 if ( !isset($value) || empty($value) )
4297 echo sprintf($base, $value);
4302 * AdminActions::parse_systemsettings()
4303 * Parse skinvar systemsettings
4305 * @param string $type type of settings for system
4306 * @param string $templateName name of template to use
4309 public function parse_systemsettings($type = 'phpinfo', $templateName = '')
4311 global $member, $CONF, $nucleus;
4313 $member->isAdmin() or Admin::disallow();
4315 $enable = _ADMIN_SYSTEMOVERVIEW_ENABLE;
4316 $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
4323 case 'sqlserverinfo':
4324 echo sql_get_server_info();
4326 case 'sqlclientinfo':
4327 echo sql_get_client_info();
4329 case 'magicquotesgpc':
4330 echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
4332 case 'magicquotesruntime':
4333 echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';
4335 case 'registerglobals':
4336 echo ini_get('register_globals') ? 'On' : 'Off';
4339 $templates = array();
4340 if ( $templateName )
4342 $templates = Template::read($templateName);
4344 if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )
4346 $template = $templates['SYSTEMINFO_GDSETTINGS'];
4350 $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";
4353 $gdinfo = gd_info();
4355 foreach ( $gdinfo as $key => $value )
4357 if ( is_bool($value) )
4359 $value = $value ? $enable : $disable;
4363 $value = Entity::hsc($value);
4369 echo TEMPLATE::fill($template, $data);
4374 phpinfo(INFO_MODULES);
4375 $im = ob_get_contents();
4377 echo ( i18n::strpos($im, 'mod_rewrite') !== FALSE ) ? $enable : $disable;
4379 case 'nucleusversion':
4380 echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
4382 case 'nucleuspatchlevel':
4383 echo getNucleusPatchLevel();
4389 echo $CONF['ItemURL'];
4391 case 'alertonheaderssent':
4392 echo $CONF['alertOnHeadersSent'] ? $enable : $disable;
4394 case 'nucleuscodename':
4395 if ( $nucleus['codename'] != '' )
4397 echo ' "' . $nucleus['codename'] . '"';
4400 case 'versioncheckurl':
4401 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4408 * AdminActions::parse_templateoverview()
4409 * Parse skinvar templateoverview
4411 * @param string $templateName name of template to use
4414 public function parse_templateoverview($templateName = '')
4416 $query = "SELECT * FROM %s ORDER BY tdname";
4417 $query = sprintf($query, sql_table('template_desc'));
4418 $template['content'] = 'templatelist';
4419 $template['tabindex'] = 10;
4420 Showlist($query, 'table', $template, $templateName);
4425 * AdminActions::parse_ticket()
4431 public function parse_ticket()
4434 $manager->addTicketHidden();
4439 * AdminActions::parse_versioncheckurl()
4440 * Parse skinvar versioncheckurl
4445 public function parse_versioncheckurl()
4447 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4452 * AdminActions::parse_yrbloglist()
4453 * Parse skinvar yrbloglist
4455 * @param string $templateName name of template to use
4458 public function parse_yrbloglist($templateName = '')
4461 $showAll = requestVar('showall');
4463 if ( $member->isAdmin() && ($showAll == 'yes') )
4465 // Super-Admins have access to all blogs! (no add item support though)
4466 $query = "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
4468 . " ORDER BY bnumber";
4469 $query = sprintf($query, sql_table('blog'));
4473 $query = "SELECT bnumber, bname, tadmin, burl, bshortname"
4475 . " WHERE tblog=bnumber and tmember=%d"
4476 . " ORDER BY bnumber";
4477 $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
4480 $template['content'] = 'bloglist';
4481 $template['superadmin'] = $member->isAdmin();
4483 $amount = Showlist($query, 'table', $template, $templateName);
4485 if ( ($showAll != 'yes') && ($member->isAdmin()) )
4487 $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
4489 $total = quickQuery($query);
4490 if ( $total > $amount )
4492 echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
4498 echo _OVERVIEW_NOBLOGS;
4500 elseif( $amount != 0 )
4502 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
4504 $query = "SELECT ititle, inumber, bshortname"
4506 . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1';
4507 $query = sprintf($query. sql_table('item'), sql_table('blog'), (integer) $member->getID());
4509 $template['content'] = 'draftlist';
4511 $amountdrafts = Showlist($query, 'table', $template, $templateName);
4512 if ( $amountdrafts == 0 )
4514 echo _OVERVIEW_NODRAFTS;
4521 * AdminActions::checkCondition()
4522 * Checks conditions for if statements
4524 * @param string $field type of <%if%>
4525 * @param string $name property of field
4526 * @param string $value value of property
4527 * @return boolean condition
4529 protected function checkCondition($field, $name='', $value = '')
4531 global $CONF, $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
4542 $blog =& $manager->getBlog($blogid);
4546 $blogid = getBlogIDFromCatID($catid);
4548 $blog =& $manager->getBlog($blogid);
4550 elseif ( intRequestVar('catid') )
4552 $catid = intRequestVar('catid');
4553 $blogid = getBlogIDFromCatID($catid);
4555 $blog =& $manager->getBlog($blogid);
4562 $condition = ($blog && $this->ifCategory($name, $value));
4565 $condition = ($blog && ($blog->getSetting($name) == $value));
4568 $condition = $member->isLoggedIn();
4571 $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
4574 $condition = $member->isLoggedIn() && $this->ifAdmin($name);
4577 $condition = $member->isLoggedIn() && $member->isAdmin();
4579 case 'allowloginedit':
4580 $condition = $member->isLoggedIn() && ($CONF['AllowLoginEdit'] || $member->isAdmin());
4583 $condition = ($itemidnext != '');
4586 $condition = ($itemidprev != '');
4588 case 'archiveprevexists':
4589 $condition = ($archiveprevexists == true);
4591 case 'archivenextexists':
4592 $condition = ($archivenextexists == true);
4595 $condition = (($name == $this->skintype) || ($name == requestVar('action')));
4598 $condition = $this->ifHasPlugin($name, $value);
4601 $condition = ($this->objAdmin->action == $name);
4603 case 'adminoldaction':
4604 $condition = ($this->objAdmin->action == $name);
4606 case 'addresschange':
4607 $condition = ($this->ifAddresscange());
4609 case 'bechangepass':
4610 $condition = ($this->beChangePassword());
4612 case 'skincandidates':
4613 $condition = ($this->ifSkincandidates());
4616 $condition = requestVar('nameclashes');
4618 case 'existsnewplugin':
4619 $condition = ($this->existsNewPlugin());
4622 $condition = (boolean) ($member->getAutosave() == $value);
4625 $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
4632 * Actions::_ifHasPlugin()
4633 * hasplugin,PlugName
4634 * -> checks if plugin exists
4635 * hasplugin,PlugName,OptionName
4636 * -> checks if the option OptionName from plugin PlugName is not set to 'no'
4637 * hasplugin,PlugName,OptionName=value
4638 * -> checks if the option OptionName from plugin PlugName is set to value
4640 * @param string $name name of plugin
4641 * @param string $value
4644 private function ifHasPlugin($name, $value)
4648 // (pluginInstalled method won't write a message in the actionlog on failure)
4649 if ( $manager->pluginInstalled("NP_{$name}") )
4651 $plugin =& $manager->getPlugin("NP_{$name}");
4652 if ( $plugin != NULL )
4660 list($name2, $value2) = preg_split('#=#', $value, 2);
4661 if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
4665 else if ( $plugin->getOption($name2) == $value2 )
4676 * Actions::beChangePassword()
4681 private function beChangePassword()
4683 return intRequestVar('bNeedsPasswordChange');
4687 * Actions::ifSkincandidates()
4688 * Checks if a plugin exists and call its doIf function
4693 private function ifSkincandidates()
4696 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
4697 return (count($candidates) > 0);
4701 * Actions::ifPlugin()
4702 * Checks if a plugin exists and call its doIf function
4704 private function ifPlugin($name, $key = '', $value = '')
4708 $plugin =& $manager->getPlugin("NP_{$name}");
4714 $params = func_get_args();
4715 array_shift($params);
4717 return call_user_func_array(array(&$plugin, 'doIf'), $params);
4721 * Different checks for a category
4723 private function ifCategory($name = '', $value='')
4725 global $blog, $catid;
4727 // when no parameter is defined, just check if a category is selected
4728 if (($name != 'catname' && $name != 'catid') || ($value == ''))
4730 return $blog->isValidCategory($catid);
4733 // check category name
4734 if ( $name == 'catname' )
4736 $value = $blog->getCategoryIdFromName($value);
4737 if ($value == $catid)
4739 return $blog->isValidCategory($catid);
4743 // check category id
4744 if (($name == 'catid') && ($value == $catid))
4746 return $blog->isValidCategory($catid);
4753 * Checks if a member is on the team of a blog and return his rights
4755 private function ifOnTeam($blogName = '')
4757 global $blog, $member, $manager;
4759 // when no blog found
4760 if ( ($blogName == '') && !is_object($blog) )
4765 // explicit blog selection
4766 if ($blogName != '')
4768 $blogid = getBlogIDFromName($blogName);
4771 if (($blogName == '') || !$manager->existsBlogID($blogid))
4774 $blogid = $blog->getID();
4776 return $member->teamRights($blogid);
4780 * Checks if a member is admin of a blog
4782 private function ifAdmin($blogName = '')
4784 global $blog, $member, $manager;
4786 // when no blog found
4787 if (($blogName == '') && (!is_object($blog)))
4792 // explicit blog selection
4793 if ($blogName != '')
4795 $blogid = getBlogIDFromName($blogName);
4798 if (($blogName == '') || !$manager->existsBlogID($blogid))
4801 $blogid = $blog->getID();
4804 return $member->isBlogAdmin($blogid);
4808 * Check e-Mail address is changed
4810 private function ifAddresscange()
4812 $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");
4817 $info = MEMBER::getActivationInfo($key);
4822 $mem = MEMBER::createFromId($info->vmember);
4827 if ( $info->vtype == 'addresschange' )
4835 * AdminActions::customHelp()
4836 * shows a link to custom help file
4838 * @param integer $id
4839 * @param string $tplName
4840 * @param string $url
4841 * @param string $iconURL
4842 * @param string $alt
4843 * @param string $title
4847 private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4849 echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
4853 * AdminActions::customHelpHtml()
4855 * @param integer $id
4856 * @param string $tplName
4857 * @param string $url
4858 * @param string $iconURL
4859 * @param string $alt
4860 * @param string $title
4861 * @param string $onclick
4862 * @return string anchor element with help uri
4864 private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4866 $templates = array();
4869 $templates = Template::read($tplName);
4871 if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
4873 $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
4877 $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';
4880 if ( empty($iconURL) )
4883 $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
4885 if ( function_exists('getimagesize') )
4887 $size = getimagesize($iconURL);
4888 $width = 'width="' . $size[0] . '" ';
4889 $height = 'height="' . $size[1] . '" ';
4892 'iconurl' => $iconURL,
4894 'height' => $height,
4895 'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
4896 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
4898 $icon = TEMPLATE::fill($template, $data);
4899 $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
4900 return $help . $icon;
4904 * AdminActions::input_yesno
4907 * @param $checkedval
4914 * @param $templateName
4917 private function input_yesno($name,
4928 $templates = array();
4929 if ( $templateName )
4931 $templates = Template::read($templateName);
4934 if ( $name == 'admin' )
4936 if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
4938 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
4942 $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
4943 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
4944 . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
4945 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
4950 if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
4952 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
4956 if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
4958 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
4961 if ( !isset($template) )
4963 $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
4964 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
4965 . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
4966 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
4971 $id = Entity::hsc($name);
4972 $id = str_replace('[', '-', $id);
4973 $id = str_replace(']', '-', $id);
4974 $id1 = $id . Entity::hsc($value1);
4975 $id2 = $id . Entity::hsc($value2);
4977 'name' => Entity::hsc($name),
4978 'yesval' => Entity::hsc($value1),
4979 'noval' => Entity::hsc($value2),
4982 'yesvaltext' => $yesval,
4983 'novaltext' => $noval,
4984 'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
4985 'nocheckedval' => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
4986 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
4991 return Template::fill($template, $dat);
4995 echo TEMPLATE::fill($template, $dat);