2 class AdminActions extends BaseActions
8 /* FIXME: this is really needed or not */
12 * AdminActions::$page_action_names
13 * list of whole action names with which this class can deal
15 static private $page_action_names = array(
25 'adminskineditallowedlist',
28 'adminspecialskinlist',
29 'admintemplateoverview',
30 'allowedadminskinactions',
50 'configsettingsyesno',
52 'defaultadminskintypes',
62 'editadmintemplateinfo',
71 'editplugoptionslist',
82 'insertpluginoptions',
86 'languageselectoptions',
87 'listplugplugoptionrow',
104 'selectlocaladminskinfiles',
105 'selectlocalskinfiles',
106 'skineditallowedlist',
118 'adminstyleselectoptions',
119 /* FIXME: typo of adminstylesheets */
121 'adminskinselectoptions'
122 /* FIXME: lack entries. need to be review
123 * parse_banlistdeletedlist
126 * parse_customhelplink
128 * parse_insertpluginfo
129 * parse_insplugoptcontent
135 * AdminActions::$page_type_friendly_names
136 * friendly name for wrapped page types
138 static private $page_type_friendly_names = array(
139 'actionlog' => _ADM_SKPRT_ACTIONLOG,
140 'activate' => _ADM_SKPRT_ACTIVATE,
141 'activatesetpwd' => _ADM_SKPRT_ACTIVATESETPWD,
142 'addnewlog' => _ADM_SKPRT_ADDNEWLOG,
143 'adminerrorpage' => _ADM_SKPRT_ADMINERRORPAGE,
144 'adminskindelete' => _ADM_SKPRT_ADMINSKINDELETE,
145 'adminskinedit' => _ADM_SKPRT_ADMINSKINEDIT,
146 'adminskinedittype' => _ADM_SKPRT_ADMINSKINEDITTYPE,
147 'adminskiniedoimport' => _ADM_SKPRT_ADMINSKINIEDOIMPORT,
148 'adminskinieimport' => _ADM_SKPRT_ADMINSKINIEIMPORT,
149 'adminskinieoverview' => _ADM_SKPRT_ADMINSKINIEOVERVIEW,
150 'adminskinoverview' => _ADM_SKPRT_ADMINSKINOVERVIEW,
151 'adminskinremovetype' => _ADM_SKPRT_ADMINSKINREMOVETYPE,
152 'admintemplatedelete' => _ADM_SKPRT_ADMINTEMPLATEDELETE,
153 'admintemplateedit' => _ADM_SKPRT_ADMINTEMPLATEEDIT,
154 'admintemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW,
155 'backupoverview' => _ADM_SKPRT_BACKUPOVERVIEW,
156 'backuprestore' => _ADM_SKPRT_BACKUPRESTORE,
157 'banlist' => _ADM_SKPRT_BANLIST,
158 'banlistdelete' => _ADM_SKPRT_BANLISTDELETE,
159 'banlistdeleteconfirm' => _ADM_SKPRT_BANLISTDELETECONFIRM,
160 'banlistnew' => _ADM_SKPRT_BANLISTNEW,
161 'batchcategory' => _ADM_SKPRT_BATCHCATEGORY,
162 'batchcomment' => _ADM_SKPRT_BATCHCOMMENT,
163 'batchdelete' => _ADM_SKPRT_BATCHDELETE,
164 'batchitem' => _ADM_SKPRT_BATCHITEM,
165 'batchmember' => _ADM_SKPRT_BATCHMEMBER,
166 'batchmove' => _ADM_SKPRT_BATCHMOVE,
167 'batchteam' => _ADM_SKPRT_BATCHTEAM,
168 'blogcommentlist' => _ADM_SKPRT_BLOGCOMMENTLIST,
169 'blogselectbox' => _ADM_SKPRT_BLOGSELECTBOX,
170 'blogsettings' => _ADM_SKPRT_BLOGSETTINGS,
171 'bookmarklet' => _ADM_SKPRT_BOOKMARKLET,
172 'browseowncomments' => _ADM_SKPRT_BROWSEOWNCOMMENTS,
173 'browseownitems' => _ADM_SKPRT_BROWSEOWNITEMS,
174 'categorydelete' => _ADM_SKPRT_CATEGORYDELETE,
175 'categoryedit' => _ADM_SKPRT_CATEGORYEDIT,
176 'commentdelete' => _ADM_SKPRT_COMMENTDELETE,
177 'commentedit' => _ADM_SKPRT_COMMENTEDIT,
178 'createitem' => _ADM_SKPRT_CREATEITEM,
179 'createnewlog' => _ADM_SKPRT_CREATENEWLOG,
180 'deleteblog' => _ADM_SKPRT_DELETEBLOG,
181 'editmembersettings' => _ADM_SKPRT_EDITMEMBERSETTINGS,
182 'insertpluginoptions' => _ADM_SKPRT_INSERTPLUGINO,
183 'itemcommentlist' => _ADM_SKPRT_ITEMCOMMENTLIST,
184 'itemdelete' => _ADM_SKPRT_ITEMDELETE,
185 'itemedit' => _ADM_SKPRT_ITEMEDIT,
186 'itemlist' => _ADM_SKPRT_ITEMLIST,
187 'itemmove' => _ADM_SKPRT_ITEMMOVE,
188 'manage' => _ADM_SKPRT_MANAGE,
189 'manageteam' => _ADM_SKPRT_MANAGETEAM,
190 'memberdelete' => _ADM_SKPRT_MEMBERDELETE,
191 'overview' => _ADM_SKPRT_OVERVIEW,
192 'pagefoot' => _ADM_SKPRT_PAGEFOOT,
193 'pagehead' => _ADM_SKPRT_PAGEHEAD,
194 'plugindelete' => _ADM_SKPRT_PLUGINDELETE,
195 'pluginhelp' => _ADM_SKPRT_PLUGINHELP,
196 'pluginlist' => _ADM_SKPRT_PLUGINLIST,
197 'pluginoptions' => _ADM_SKPRT_PLUGINOPTIONS,
198 'settingsedit' => _ADM_SKPRT_SETTINGSEDIT,
199 'showlogin' => _ADM_SKPRT_SHOWLOGIN,
200 'skindelete' => _ADM_SKPRT_SKINDELETE,
201 'skinedit' => _ADM_SKPRT_SKINEDIT,
202 'skinedittype' => _ADM_SKPRT_SKINEDITTYPE,
203 'skiniedoimport' => _ADM_SKPRT_SKINIEDOIMPORT,
204 'skinieimport' => _ADM_SKPRT_SKINIEIMPORT,
205 'skinieoverview' => _ADM_SKPRT_SKINIEOVERVIEW,
206 'skinoverview' => _ADM_SKPRT_SKINOVERVIEW,
207 'skinremovetype' => _ADM_SKPRT_SKINREMOVETYPE,
208 'systemoverview' => _ADM_SKPRT_SYSTEMOVERVIEW,
209 'teamdelete' => _ADM_SKPRT_TEAMDELETE,
210 'templatedelete' => _ADM_SKPRT_TEMPLATEDELETE,
211 'templateedit' => _ADM_SKPRT_TEMPLATEEDIT,
212 'templateoverview' => _ADM_SKPRT_TEMPLATEOVERVIEW,
213 'usermanagement' => _ADM_SKPRT_USERMANAGEMENT,
217 * AdminActions::get_allowed_actions_for_type()
220 * @param string $type page type
221 * @return array allowed actions for the page type
223 static public function get_allowed_actions_for_type($type)
225 $default_actions = array(
242 $extra_actions = array();
246 /* NOTE: admin actions */
248 $extra_actions = array(
253 $extra_actions = array(
258 case 'activatesetpwd':
259 $extra_actions = array(
263 $extra_actions = array(
269 case 'adminerrorpage':
270 $extra_actions = array(
273 case 'adminskindelete':
274 $extra_actions = array(
278 case 'adminskinedit':
279 $extra_actions = array(
281 'defaultadminskintypes',
282 'adminspecialskinlist',
285 case 'adminskinedittype':
286 $extra_actions = array(
289 'allowedadminskinactions',
290 'adminskineditallowedlist',
293 case 'adminskiniedoimport':
294 $extra_actions = array(
298 case 'adminskinieimport':
299 $extra_actions = array(
303 case 'adminskinieoverview':
304 $extra_actions = array(
305 'selectlocaladminskinfiles',
309 case 'adminskinoverview':
310 $extra_actions = array(
314 case 'adminskinremovetype':
315 $extra_actions = array(
319 case 'admintemplateedit':
320 $extra_actions = array(
321 'editadmintemplateinfo',
324 case 'admintemplateoverview':
325 $extra_actions = array(
326 'admintemplateoverview',
329 case 'backupoverview':
330 $extra_actions = array(
333 case 'backuprestore':
334 $extra_actions = array(
338 $extra_actions = array(
344 case 'banlistdelete':
345 $extra_actions = array(
350 case 'banlistdeleteconfirm':
351 $extra_actions = array(
352 'banlistdeletedlist',
357 $extra_actions = array(
363 case 'batchcategory':
364 $extra_actions = array(
370 $extra_actions = array(
376 $extra_actions = array(
382 $extra_actions = array(
388 $extra_actions = array(
394 $extra_actions = array(
403 $extra_actions = array(
409 case 'blogcommentlist':
410 $extra_actions = array(
416 case 'blogselectbox':
417 $extra_actions = array(
422 $extra_actions = array(
437 $extra_actions = array(
441 case 'browseowncomments':
442 $extra_actions = array(
446 case 'browseownitems':
447 $extra_actions = array(
451 case 'categorydelete':
452 $extra_actions = array(
458 $extra_actions = array(
464 case 'commentdelete':
465 $extra_actions = array(
470 $extra_actions = array(
475 $extra_actions = array(
490 $extra_actions = array(
496 $extra_actions = array(
501 case 'editmembersettings':
502 $extra_actions = array(
504 'languageselectoptions',
505 'adminskinselectoptions',
509 case 'insertpluginoptions':
510 $extra_actions = array(
511 'insertpluginoptions',
514 case 'itemcommentlist':
515 $extra_actions = array(
521 $extra_actions = array(
528 $extra_actions = array(
545 $extra_actions = array(
552 $extra_actions = array(
558 $extra_actions = array(
562 $extra_actions = array(
571 $extra_actions = array(
576 $extra_actions = array(
581 $extra_actions = array(
589 $extra_actions = array(
603 $extra_actions = array(
608 $extra_actions = array(
614 $extra_actions = array(
619 case 'pluginoptions':
620 $extra_actions = array(
622 'editplugoptionslist',
626 $extra_actions = array(
629 'configsettingsedit',
630 'languageselectoptions',
631 'configsettingsyesno',
634 'adminstyleselectoptions',
640 $extra_actions = array(
646 $extra_actions = array(
651 $extra_actions = array(
657 $extra_actions = array(
660 'allowedskinactions',
661 'skineditallowedlist',
662 'skineditallowedlist',
665 case 'skiniedoimport':
666 $extra_actions = array(
671 $extra_actions = array(
675 case 'skinieoverview':
676 $extra_actions = array(
677 'selectlocalskinfiles',
682 $extra_actions = array(
686 case 'skinremovetype':
687 $extra_actions = array(
691 case 'systemoverview':
692 $extra_actions = array(
697 $extra_actions = array(
703 case 'templatedelete':
704 $extra_actions = array(
709 $extra_actions = array(
713 case 'templateoverview':
714 $extra_actions = array(
718 case 'usermanagement':
719 $extra_actions = array(
725 $extra_actions = array(
736 'selectlocaladminskinfiles',
743 return array_merge($default_actions, $extra_actions);
747 * AdminActions::get_defined_actions()
748 * Returns an array with the actions that are defined
749 * in the AdminActions class
754 static public function get_page_action_names()
756 return self::$page_action_names;
760 * AdminActions::get_page_type_friendly_names()
764 * @return array list of friendly names for page actions
766 static public function get_page_type_friendly_names()
768 return self::$page_type_friendly_names;
772 * Actions::__construct()
773 * Constructor for a new Actions object
775 * @param string $type
778 public function __construct($type)
780 $this->BaseActions();
781 $this->skintype = $type;
788 * @param object $skin an instance of Skin class
791 public function setSkin(&$skin)
793 $this->skin =& $skin;
798 * Actions::setParser()
801 * @param object $parser an instance of Parser class
804 public function setParser(&$parser)
806 $this->parser =& $parser;
811 * AdminActions::parse_actionloglist()
812 * Parse skinvar actionloglist
814 * @param string $templateName name of template to use
817 public function parse_actionloglist($templateName = '')
819 $query = "SELECT * FROM %s ORDER BY timestamp DESC";
820 $query = sprintf($query, sql_table('actionlog'));
822 $template['content'] = 'actionlist';
823 $amount = skinableShowlist($query, 'table', $template, $templateName);
829 * AdminActions::parse_activationmessage()
830 * Parse skinvar activationmessage
832 * @param string $type type of message
833 * @param string $templateName name of template to use
836 public function parse_activationmessage($type, $templateName = '')
838 global $CONF, $manager;
842 if ( !empty($templateName))
844 $template = skinableTEMPLATE::read($templateName);
847 $key = postVar('ackey');
850 $this->objAdmin->error(_ERROR_ACTIVATE);
853 $info = MEMBER::getActivationInfo($key);
856 $this->objAdmin->error(_ERROR_ACTIVATE);
859 $mem = MEMBER::createFromId($info->vmember);
862 $this->objAdmin->error(_ERROR_ACTIVATE);
864 switch ( $info->vtype )
867 if ( array_key_exists('ACTIVATE_FORGOT_TITLE', $template) && !empty($template['ACTIVATE_FORGOT_TITLE']) )
869 $title = $template['ACTIVATE_FORGOT_TITLE'];
873 $title = _ACTIVATE_FORGOT_TITLE;
875 if ( array_key_exists('ACTIVATE_FORGOT_TEXT', $template) && !empty($template['ACTIVATE_FORGOT_TEXT']) )
877 $text = $template['ACTIVATE_FORGOT_TEXT'];
881 $text = _ACTIVATE_FORGOT_TEXT;
885 if ( array_key_exists('ACTIVATE_REGISTER_TITLE', $template) && !empty($template['ACTIVATE_REGISTER_TITLE']) )
887 $title = $template['ACTIVATE_REGISTER_TITLE'];
891 $title = _ACTIVATE_REGISTER_TITLE;
893 if ( array_key_exists('ACTIVATE_REGISTER_TEXT', $template) && !empty($template['ACTIVATE_REGISTER_TEXT']) )
895 $text = $template['ACTIVATE_REGISTER_TEXT'];
899 $text = _ACTIVATE_REGISTER_TEXT;
902 case 'addresschange':
903 if ( array_key_exists('ACTIVATE_CHANGE_TITLE', $template) && !empty($template['ACTIVATE_CHANGE_TITLE']) )
905 $title = $template['ACTIVATE_CHANGE_TITLE'];
909 $title = _ACTIVATE_CHANGE_TITLE;
911 if (array_key_exists('ACTIVATE_CHANGE_TEXT', $template) && !empty($template['ACTIVATE_CHANGE_TEXT']))
913 $text = $template['ACTIVATE_CHANGE_TEXT'];
917 $text = _ACTIVATE_CHANGE_TEXT;
922 'memberName' => Entity::hsc($mem->getDisplayName()),
923 'realName' => Entity::hsc($mem->getRealName()),
928 echo TEMPLATE::fill($title, $aVars);
931 echo TEMPLATE::fill($text, $aVars);
934 echo Entity::hsc($key);
941 * Actions::parse_addtickettourl()
942 * Parse skinvar addtickettourl
944 * @param string $url URI for ticket
947 public function parse_addtickettourl($url)
950 $url = $manager->addTicketToUrl($url);
951 echo Entity::hsc($url);
956 * Actions::parse_adminbanlist()
957 * Parse skinvar adminbanlist
959 * @param string $templateName name of template to use
962 public function parse_adminbanlist($templateName = '')
964 $blogid = intRequestVar('blogid');
966 $query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";
967 $query = sprintf($query, sql_table('ban'), (integer) $blogid);
969 $template['content'] = 'banlist';
971 $amount = Showlist($query, 'table', $template, $templateName);
981 * Actions::parse_adminbatchaction()
982 * Parse skinvar adminbatchaction
987 public function parse_adminbatchaction()
989 echo Entity::hsc(requestVar('batchaction'));
994 * Actions::parse_adminbatchlist()
995 * Parse skinvar adminbatchlist
997 * @param string $templateName name of template to use
1000 public function parse_adminbatchlist($templateName = '')
1003 $templates = array();
1004 if ( !empty($templateName) )
1006 $templates = Template::read($templateName);
1008 if ( isset($templates['ADMIN_BATCHLIST']) || !empty($templates['ADMIN_BATCHLIST']) )
1010 $template = $templates['ADMIN_BATCHLIST'];
1014 $template = '<li><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b>'
1015 . '<%batchlisttype%> <b><%batchid%></b>...'
1016 . '<b><%batchlistmsg%></b></li>' . "\n";
1019 $selected = requestIntArray('batch');
1020 $action = requestVar('batchaction');
1022 switch ( $this->skintype )
1025 $batchlisttype = _BATCH_ONITEM;
1026 $deleteaction = 'deleteOneItem';
1027 $moveaction = 'moveOneItem';
1028 $destid = intRequestVar('destcatid');
1030 case 'batchcomment':
1031 $batchlisttype = _BATCH_ONCOMMENT;
1032 $deleteaction = 'deleteOneComment';
1035 $batchlisttype = _BATCH_ONMEMBER;
1036 $deleteaction = 'deleteOneMember';
1037 $setadminsql = sql_table('member') . ' SET madmin = 1 WHERE mnumber = ';
1038 $unsetchksql = 'SELECT * FROM ' . sql_table('member') . ' WHERE madmin = 1 AND mcanlogin = 1';
1039 $unsetupsql = sql_table('member') . ' SET madmin = 0 WHERE mnumber = ';
1040 $unseterrmsg = _ERROR_ATLEASTONEADMIN;
1043 $blogid = intRequestVar('blogid');
1044 $batchlisttype = _BATCH_ONTEAM;
1045 $deleteaction = 'deleteOneTeamMember';
1046 $setadminsql = sql_table('team') . ' SET tadmin = 1 WHERE tblog = ' . $blogid . ' AND tmember = ';
1047 $unsetchksql = 'SELECT * FROM ' . sql_table('team') . ' WHERE tadmin = 1 AND tblog = ' . $blogid;
1048 $unseterrmsg = _ERROR_ATLEASTONEBLOGADMIN;
1049 $unsetupsql = sql_table('team') . ' SET tadmin = 0 WHERE tblog = ' . $blogid . ' AND tmember = ';
1051 case 'batchcategory':
1052 $batchlisttype = _BATCH_ONCATEGORY;
1053 $deleteaction = 'deleteOneCategory';
1054 $moveaction = 'moveOneCategory';
1055 $destid = intRequestVar('destblogid');
1059 // walk over all selectedids and perform action
1060 foreach ( $selected as $selectedid )
1063 $selectedid = intval($selectedid);
1067 if ( $this->skintype != 'batchteam' )
1069 $error = $this->objAdmin->$deleteaction($selectedid);
1073 $error = $this->objAdmin->deleteOneTeamMember($blogid, $selectedid);
1077 $error = $this->objAdmin->$moveaction($selectedid, $destid);
1081 sql_query('UPDATE ' . $setadminsql . $selectedid);
1085 // there should always remain at least one super-admin
1086 $r = sql_query($unsetchksql);
1087 if ( sql_num_rows($r) < 2 )
1089 $error = $unseterrmsg;
1093 sql_query('UPDATE ' . $unsetupsql . $selectedid);
1097 $error = _BATCH_UNKNOWN . Entity::hsc($action);
1100 'batchid' => $selectedid,
1101 'batchlisttype' => Entity::hsc($batchlisttype),
1102 'adminbatchaction' => Entity::hsc($action),
1103 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,
1105 $handler = new Actions('template', $template, new ADMIN);
1106 $parser = new Parser($handler);
1109 $parser->parse($template);
1110 $template = ob_get_contents();
1113 echo TEMPLATE::fill($template, $data);
1119 * Actions::parse_adminbloglink()
1120 * Parse skinvar adminbloglink
1122 * @param string $templateName name of template to use
1125 public function parse_adminbloglink($templateName = '')
1128 $blogid = intRequestVar('blogid');
1129 $blog =& $manager->getBlog($blogid);
1130 $templates = array();
1132 if ( !empty($templateName) )
1134 $templates = Template::read($templateName);
1137 if ( isset($templates['ADMIN_BLOGLINK']) || !empty($templates['ADMIN_BLOGLINK']) )
1139 $template = $templates['ADMIN_BLOGLINK'];
1143 $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
1147 'url' => Entity::hsc($blog->getURL()),
1148 'adminbloglinktitle' => _BLOGLIST_TT_VISIT,
1149 'blogname' => Entity::hsc($blog->getName())
1152 echo TEMPLATE::fill($template, $data);
1157 * Actions::parse_adminerrormesg()
1158 * Parse skinvar adminerrormesg
1163 public function parse_adminerrormesg()
1168 if ( requestVar('errormessage') )
1170 $message = requestVar('errormessage');
1172 elseif ( cookieVar($CONF['CookiePrefix'] . 'errormessage') )
1174 $message = cookieVar($CONF['CookiePrefix'] . 'errormessage');
1176 elseif ( $this->objAdmin->sessionVar($CONF['CookiePrefix'] . 'errormessage') )
1178 $message = $this->objAdmin->sessionVar($CONF['CookiePrefix'] . 'errormessage');
1180 echo Entity::hsc($message);
1185 * Actions::parse_adminparsedinclude()
1186 * Parse skinvar adminparsedinclude
1188 * @param string $filename name of file
1191 public function parse_adminparsedinclude($filename)
1193 // check current level
1194 if ( $this->level > 3)
1196 // max. depth reached (avoid endless loop)
1199 $skin = new Skin($this->skintype->id);
1200 $file = $this->getIncludeFileName($filename);
1202 if ( !$skin->isValid && !file_exists($file) )
1207 $contents = $skin->getContent($filename);
1211 if ( !file_exists($file) )
1215 $contents = file_get_contents($file);
1216 if ( empty($contents) )
1221 $this->level = $this->level + 1;
1222 // parse file contents
1223 $this->parser->parse($contents);
1225 $this->level = $this->level - 1;
1230 * Actions::parse_adminskineditallowedlist()
1231 * Parse skinvar adminskineditallowedlist
1233 * @param string $type template/blog
1234 * @param string $templateName name of template to use
1237 public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
1241 /* TODO: blog seems not to be used */
1243 $query = "SELECT bshortname, bname FROM %s";
1244 $query = sprintf($query, sql_table('blog'));
1246 'content' => 'shortblognames'
1250 $query = "SELECT tdname as name, tddesc as description FROM %s;";
1251 $query = sprintf($query, sql_table('admintemplate_desc'));
1253 'content' => 'shortnames'
1257 Showlist($query, 'table', $show, $templateName);
1262 * Actions::parse_adminskinielist()
1263 * Parse skinvar adminskinielist
1265 * @param string $type skin/template
1266 * @param string $templateName name of template to use
1269 public function parse_adminskinielist($type, $templateName = '')
1271 $templates = array();
1272 if ( $templateName )
1274 $templates = Template::read($templateName);
1276 if ( isset($templates['SKINIE_EXPORT_LIST']) && !empty($templates['SKINIE_EXPORT_LIST']) )
1278 $template = $templates['SKINIE_EXPORT_LIST'];
1282 $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
1283 . "<td><%expdesc%></td>\n"
1289 $query = "SELECT * FROM %s;";
1290 $query = sprintf($query, sql_table('adminskin_desc'));
1291 $res = sql_query($query);
1293 while ( $skinObj = sql_fetch_object($res) )
1296 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
1297 'expid' => 'skinexp' . $skinObj->sdnumber,
1298 'expname' => Entity::hsc($skinObj->sdname),
1299 'expdesc' => Entity::hsc($skinObj->sddesc),
1301 echo TEMPLATE::fill($template, $data);
1305 $query = "SELECT * FROM %s;";
1306 $query = sprintf($query, sql_table('admintemplate_desc'));
1307 $res = sql_query($query);
1308 while ( $templateObj = sql_fetch_object($res) )
1311 'typeid' => 'template[' . $templateObj->tdnumber . ']',
1312 'expid' => 'templateexp' . $templateObj->tdnumber,
1313 'expname' => Entity::hsc($templateObj->tdname),
1314 'expdesc' => Entity::hsc($templateObj->tddesc),
1316 echo TEMPLATE::fill($template, $data);
1324 * Actions::parse_adminskinoverview()
1325 * Parse skinvar adminskinoverview
1327 * @param string $templateName name of template to use
1330 public function parse_adminskinoverview($templateName = '')
1332 $query = "SELECT * FROM %s ORDER BY sdname;";
1333 $query = sprintf($query, sql_table('adminskin_desc'));
1335 $template['content'] = 'adminskinlist';
1336 $template['tabindex'] = 10;
1337 Showlist($query, 'table', $template, $templateName);
1342 * Actions::parse_adminskinselectoptions()
1343 * Parse skinvar adminskinselectoptions
1348 public function parse_adminskinselectoptions()
1351 $query = "SELECT sdname as text, sdnumber as value FROM %s;";
1352 $query = sprintf($query, sql_table('adminskin_desc'));
1354 $template['name'] = 'adminskin';
1355 $template['selected'] = $CONF['DefaultAdminSkin'];
1356 $template['tabindex'] = 110;
1357 Showlist($query, 'select', $template, '');
1362 * Actions::parse_adminspecialskinlist()
1363 * Parse skinvar adminspecialskinlist
1365 * @param string $templateName name of template to use
1367 public function parse_adminspecialskinlist($templateName = '')
1369 $templates = array();
1370 if ( $templateName )
1372 $templates = Template::read($templateName);
1375 $nType = Skin::getAdminskinDefaultTypes();
1376 $skinid = intRequestVar('skinid');
1378 $query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";
1379 $query = sprintf($query, sql_table('adminskin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
1381 $res = sql_query($query);
1382 if ( $res && sql_num_rows($res) > 0 )
1385 if ( isset($templates['ADMIN_SPECIALSKINLIST_HEAD']) && !empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
1387 $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
1391 $template['head'] = "<ul>\n";
1393 echo TEMPLATE::fill($template['head'], $data);
1394 if ( isset($templates['ADMIN_SPECIALSKINLIST_BODY']) && !empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
1396 $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
1400 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>'
1401 . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
1402 . 'action=adminskinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
1405 while ( $row = sql_fetch_assoc($res) )
1408 'tabindex' => $tabstart++,
1409 'skinid' => $skinid,
1410 'skintype' => Entity::hsc(strtolower($row['stype']))
1412 echo TEMPLATE::fill($template['body'], $data);
1416 if ( isset($templates['ADMIN_SPECIALSKINLIST_FOOT']) && !empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
1418 $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
1422 $template['foot'] = "<ul>\n";
1424 echo TEMPLATE::fill($template['foot'], $data);
1430 * Actions::parse_adminstylesheets()
1431 * Parse skinvar adminstylesheets
1436 public function parse_adminstylesheets()
1439 $includePrefix = $this->skintype->includePrefix;
1441 if ( strlen($includePrefix) > 0 )
1443 $styleURL = Entity::hsc($CONF['AdminURL']) . 'adminskins/' . $includePrefix . 'admin_' . $CONF['AdminCSS'] . '.css';
1447 $styleURL = Entity::hsc($CONF['AdminURL']) . 'styles/admin_' . $CONF['AdminCSS'] . '.css';
1454 * Actions::parse_adminstyleselectoptions()
1455 * Parse skinvar adminstyleselectoptions
1460 public function parse_adminstyleselectoptions()
1462 global $CONF, $manager, $DIR_NUCLEUS;
1463 if ( strlen($this->skintype->includePrefix) > 0 )
1465 $scndir = $DIR_NUCLEUS . 'adminskins/' . $this->skintype->includePrefix;
1469 $scndir = $DIR_NUCLEUS . 'styles/';
1471 $files = scandir($scndir);
1473 foreach ( $files as $file )
1475 if ( !preg_match("#^admin_(.*)\.css$#", $file, $matches) )
1480 $name = $matches[1];
1481 $opts = '<option value="' . $name . '"';
1482 if ( $name != $CONF['AdminCSS'] )
1484 $opts .= "<option value=\"{$name}\">{$name}</option>\n";
1488 $opts .= "<option value=\"{$name}\" selected=\"selected\">{$name}</option>\n";
1496 * Actions::parse_admintemplateoverview()
1497 * Parse skinvar admintemplateoverview
1499 * @param string $templateName name of template to use
1502 public function parse_admintemplateoverview($templateName = '')
1504 $query = "SELECT * FROM %s ORDER BY tdname;";
1505 $query = sprintf($query, sql_table('admintemplate_desc'));
1507 $template['content'] = 'admintemplatelist';
1508 $template['tabindex'] = 10;
1510 Showlist($query, 'table', $template, $templateName);
1515 * Actions::parse_allowedadminskinactions()
1516 * Parse skinvar allowedadminskinactions
1521 public function parse_allowedadminskinactions()
1523 global $DIR_ADMINSKINS;
1524 $skinType = strtolower(trim(requestVar('type')));
1525 $actions = Skin::getAllowedActionsForType($skinType);
1528 while ( $current = array_shift($actions) )
1530 // skip deprecated vars
1531 if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')
1536 echo helplink("adminskinvar-{$current}") . "$current</a>\n";
1537 // echo "<a href=\"{$DIR_ADMINSKINS}documentation/help.html#{$current}\" onclick=\"if (event && event.preventDefault) event.preventDefault(); return help(this.href);\">{$current}</a>\n";
1539 if ( count($actions) != 0 )
1548 * Actions::parse_allowedskinactions()
1549 * Parse skinvar allowedskinactions
1554 public function parse_allowedskinactions()
1556 $skinType = strtolower(trim(requestVar('type')));
1557 $actions = SKIN::getAllowedActionsForType($skinType);
1560 while ( $current = array_shift($actions) )
1562 // skip deprecated vars
1563 if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )
1568 /* TODO: alternative function should be used or not? */
1569 echo helplink("skinvar-{$current}") . "$current</a>\n";
1571 if ( count($actions) != 0 )
1580 * Action::parse_banlistdeletedlist()
1581 * Parse skinvar banlistdeletedlist
1583 * @param string $templateName name of template to use
1586 public function parse_banlistdeletedlist($templateName = '')
1589 $templates = array();
1591 if ( $templateName )
1593 $templates = Template::read($templateName);
1595 if ( isset($templates['BANLIST_DELETED_LIST']) && !empty($templates['BANLIST_DELETED_LIST']) )
1597 $template = $templates['BANLIST_DELETED_LIST'];
1601 $template = "<li><%blogname%></li>\n";
1603 $deleted = requestArray('delblogs');
1604 foreach ( $deleted as $delblog )
1606 $blog =& $manager->getBlog($delblog);
1608 Entity::hsc($blog->getName())
1610 TEMPLATE::fill($template, $data);
1616 * Actions::parse_batchdeletelist()
1617 * Parse skinvar batchdeletelist
1622 public function parse_batchdeletelist()
1624 $selected = requestIntArray('batch');
1627 foreach ( $selected as $select )
1629 echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
1631 // add hidden vars for team & comment
1632 if ( requestVar('action') == 'batchteam' )
1634 echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";
1636 if ( requestVar('action') == 'batchcomment' )
1638 echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";
1644 * Actions::parse_batchdeletetype()
1645 * Parse skinvar batchdeletetype
1650 public function parse_batchdeletetype()
1652 echo Entity::hsc(requestVar('action'));
1657 * Actions::parse_batchmovebtn()
1658 * Parse skinvar batchmovebtn
1663 public function parse_batchmovebtn()
1665 $actionType = requestVar('action');
1666 switch ( $actionType )
1671 case 'batchcategory':
1679 * Actions::parse_batchmovelist()
1680 * Parse skinvar batchmovelist
1685 public function parse_batchmovelist()
1687 $selected = requestIntArray('batch');
1688 foreach ( $selected as $select )
1690 echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";
1696 * Actions::parse_batchmovetitle()
1697 * Parse skinvar batchmovetitle
1702 public function parse_batchmovetitle()
1704 $actionType = requestVar('action');
1705 switch ( $actionType )
1710 case 'batchcategory':
1711 echo _MOVECAT_TITLE;
1718 * Actions::parse_batchmovetype()
1719 * Parse skinvar batchmovetype
1724 public function parse_batchmovetype()
1726 echo Entity::hsc(requestVar('action'));
1731 * Actions::parse_blogcatlist()
1732 * Parse skinvar blogcatlist
1737 public function parse_blogcatlist()
1740 $blogid = intRequestVar('blogid');
1741 $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
1742 $query = sprintf($query, sql_table('category'), (integer) $blogid);
1744 $template['content'] = 'categorylist';
1745 $template['tabindex'] = 200;
1747 $batch = new Batch('member');
1748 $batch->showlist($query, 'table', $template);
1753 * Actions::parse_blognotifysetting()
1754 * Parse skinvar blognotifysetting
1759 public function parse_blognotifysetting($type)
1762 $blogid = intRequestVar('blogid');
1763 $blog = $manager->getBlog($blogid);
1768 if ( !$blog->notifyOnComment() )
1774 if ( !$blog->notifyOnVote() )
1780 if ( !$blog->notifyOnNewItem() )
1786 echo ' checked="checked"';
1791 * AdminAction::parse_blogselectbox()
1792 * Parse skinvar blogselectbox
1797 public function parse_blogselectbox()
1801 $selectData = requestVar('selectData');
1802 $mode = $selectData['mode'];
1803 $name = Entity::hsc($selectData['name']);
1804 $tabindex = Entity::hsc($selectData['tabindex']);
1805 $aBlogIds = array_map('intval', $selectData['aBlogIds']);
1806 $showNewCat = intval($selectData['showNewCat']);
1807 $selected = intval($selectData['selected']);
1809 echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
1811 // 1. select blogs (we'll create optiongroups)
1812 // (only select those blogs that have the user on the team)
1813 $queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
1814 $queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
1815 $blogs = sql_query($queryBlogs);
1817 if ( $mode == 'category' )
1819 if ( sql_num_rows($blogs) > 1 )
1823 while ( $oBlog = sql_fetch_object($blogs) )
1825 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1827 echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\>\n";
1830 // show selection to create new category when allowed/wanted
1833 // check if allowed to do so
1834 if ( $member->blogAdminRights($oBlog->bnumber) )
1836 echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
1840 // 2. for each category in that blog
1841 $catQueriy = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
1842 $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
1843 $categories = sql_query(sprintf($catQueriy));
1844 while ( $oCat = sql_fetch_object($categories) )
1846 if ( $oCat->catid == $selected )
1848 $selectText = ' selected="selected" ';
1854 echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . Entity::hsc($oCat->cname) . "</option>\n";
1857 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1866 while ( $oBlog = sql_fetch_object($blogs) )
1868 echo '<option value="' . $oBlog->bnumber . '"';
1869 if ( $oBlog->bnumber == $selected )
1871 echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . Entity::hsc($oBlog->bname) . "</option>\n";
1875 echo '<option value="' . $oBlog->bnumber . '">' . Entity::hsc($oBlog->bname) . "</option>\n";
1884 * Actions::parse_blogsetting()
1885 * Parse skinvar blogsetting
1887 * @param string $which name of weblog setting
1890 public function parse_blogsetting($which)
1892 echo $this->parse_getblogsetting($which);
1897 * Actions::parse_blogsettingyesno()
1898 * Parse skinvar blogsettingyesno
1900 * @param string $type type of weblog setting
1901 * @param string $templateName name of template to use
1904 public function parse_blogsettingyesno($type, $templateName = '')
1908 $blogid = intRequestVar('blogid');
1909 $blog = $manager->getBlog($blogid);
1913 case 'convertbreaks':
1914 $checkedval = $blog->convertBreaks();
1917 case 'allowpastposting':
1918 $checkedval = $blog->allowPastPosting();
1922 $checkedval = $blog->commentsEnabled();
1926 $checkedval = $blog->isPublic();
1930 $checkedval = $blog->emailRequired();
1934 $checkedval = $blog->getSearchable();
1938 $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName);
1943 * Actions::parse_blogteamlist()
1944 * Parse skinvar blogteamlist
1946 * @param string $templateName name of template to use
1949 public function parse_blogteamlist($templateName = '')
1952 $blogid = intRequestVar('blogid');
1953 $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "
1955 . "WHERE tmember=mnumber AND tblog= %d";
1956 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1958 $template['content'] = 'teamlist';
1959 $template['tabindex'] = 10;
1961 $batch = new Batch('team');
1962 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
1967 * Actions::parse_blogteammembers()
1968 * Parse skinvar blogteammembers
1973 public function parse_blogteammembers()
1975 $blogid = intRequestVar('blogid');
1976 $query = "SELECT mname, mrealname "
1978 . "WHERE mnumber=tmember AND tblog=%d;";
1979 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1980 $res = sql_query($query);
1981 $memberNames = array();
1982 while ($o = sql_fetch_object($res)) {
1983 $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
1985 echo implode(',', $memberNames);
1989 * Actions::parse_blogtime()
1990 * Parse skinvar blogtime
1992 * @param string $type type of time
1993 * @param string $format format for time expression
1994 * @param integer $offset offset of time
1997 public function parse_blogtime($type, $format = '%H:%M', $offset = 0)
2001 if ( $type != 'blogtime' )
2003 /* return server time */
2004 $timestamp = time() + $offset;
2008 $bid = intRequestVar('blogid');
2009 $b = $manager->getBlog($bid);
2010 $timestamp = $b->getCorrectTime() + $offset;
2013 echo i18n::formatted_datetime($format, $timestamp);
2018 * Actions::parse_bookmarkletadmin()
2019 * Parse skinvar bookmarkletadmin
2021 * @param string $type type of anchor element for bookmarklet
2024 public function parse_bookmarkletadmin($type)
2028 $blogid = intRequestVar('blogid');
2030 if ( $type != 'regfile' )
2032 echo Entity::hsc(getBookmarklet($blogid));
2036 $url = 'index.php?action=regfile&blogid=' . intval($blogid);
2037 $url = $manager->addTicketToUrl($url);
2038 /* TODO: Shift-JIS is not always correct, I think... */
2039 echo Entity::hsc($url, 'SJIS');
2045 * Actions::parse_category()
2046 * Parse skinvar category
2048 * @param string $type name of setting for category
2051 public function parse_category($type = 'name')
2053 echo $this->parse_getcategory($type);
2058 * Actions::parse_categorysetting()
2059 * Parse skinvar categorysetting
2061 * @param string $type type in category setting
2064 public function parse_categorysetting($type)
2066 $catid = intRequestVar('catid');
2067 if ( $type == 'id' )
2072 $blogid = intRequestVar('blogid');
2073 $query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
2074 $query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
2075 $res = sql_query($query);
2076 $obj = sql_fetch_object($res);
2078 if ( $type != desc )
2080 echo Entity::hsc($obj->cdesc);
2084 echo Entity::hsc($obj->cname);
2091 * Actions::parse_codename()
2092 * Parse templatevar codename
2097 * TODO: is this need???
2099 public function parse_codename()
2102 echo $nucleus['codename'];
2107 * Actions::parse_commentnavlist()
2108 * Parse skinvar commentnavlist
2113 public function parse_commentnavlist()
2115 global $CONF, $manager, $member;
2118 if ( postVar('start') )
2120 $start = intPostVar('start');
2127 // amount of items to show
2128 if ( postVar('amount') )
2130 $amount = intPostVar('amount');
2134 $amount = (integer) $CONF['DefaultListSize'];
2140 $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
2142 . 'LEFT OUTER JOIN %s ON mnumber=cmember '
2144 $query = sprintf($query, sql_table('comment'), sql_table('member'));
2146 if ( $this->skintype == 'itemcommentlist' )
2148 $itemid = intRequestVar('itemid');
2149 $query .= " citem={$itemid}";
2150 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2152 $nonComments = _NOCOMMENTS;
2154 elseif ( $this->skintype == 'browseowncomments' )
2157 $query .= ' cmember=' . $member->getID();
2158 $template['canAddBan'] = 0;
2160 $nonComments = _NOCOMMENTS_YOUR;
2162 elseif ( $this->skintype == 'blogcommentlist' )
2165 $query .= ' cblog=' . intRequestVar('blogid');
2166 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2167 $bid = intRequestVar('blogid');
2168 $nonComments = _NOCOMMENTS_BLOG;
2171 $search = postVar('search');
2172 if ( !empty($search) )
2174 $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
2177 $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
2179 $template['content'] = 'commentlist';
2181 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
2182 $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
2187 * Actions::parse_configsettingsedit()
2188 * Parse skinvar configsettingsedit
2190 * @param string $type type of global configuration
2193 public function parse_configsettingsedit($type)
2198 case 'DefaultListSize':
2199 if ( !array_key_exists('DefaultListSize', $CONF) )
2201 $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
2202 $query = sprintf($query, sql_table('config'));
2204 $CONF['DefaultListSize'] = 10;
2206 elseif ( intval($CONF['DefaultListSize']) < 1 )
2208 $CONF['DefaultListSize'] = 10;
2210 echo intval($CONF['DefaultListSize']);
2212 case 'SessionCookie':
2213 $value = $CONF['SessionCookie'];
2214 $txt1 = _SETTINGS_COOKIESESSION;
2215 $txt2 = _SETTINGS_COOKIEMONTH;
2216 $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);
2219 $value = $CONF['URLMode'];
2220 $txt1 = _SETTINGS_URLMODE_NORMAL;
2221 $txt2 = _SETTINGS_URLMODE_PATHINFO;
2222 $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);
2225 if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )
2227 echo Entity::hsc($CONF[$type]);
2235 * Actions::parse_configsettingsyesno()
2236 * Parse skinvar configsettingsyesno
2238 * @param string $type type of global setting
2239 * @param integer $tabindex tabindex attribute of input element
2242 public function parse_configsettingsyesno($type, $tabindex)
2245 if ( array_key_exists($type, $CONF) )
2247 $this->parse_inputyesno($type, $CONF[$type], $tabindex);
2253 * Actions::parse_customhelplink()
2254 * Parse skinvar customhelplink
2256 * @param string $topic name of topic
2257 * @param string $tplName name of template
2258 * @param string $url string as URI
2259 * @param string $iconURL string as URI for icon
2260 * @param string $alt alternative text for image element
2261 * @param string $title title for anchor element
2264 public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
2266 $this->customHelp($topic, $url, $iconURL);
2271 * Actions::parse_date()
2272 * Parse skinvar date
2274 public function parse_date($format = 'c')
2276 global $CONF, $manager;
2277 echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
2282 * Actions::parse_defaultadminskintypes()
2283 * Parse skinvar defaultadminskintypes
2285 * @param string $tabindex index number for tabindex attribute of input element
2286 * @param string $templateName name of template
2289 public function parse_defaultadminskintypes($tabindex, $templateName = '')
2291 $templates = array();
2292 if ( $templateName )
2294 $templates = Template::read($templateName);
2297 $types = Skin::getAdminskinDefaultTypeFriendlyNames();
2300 if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )
2302 $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
2306 $template['head'] = "<ul>\n";
2309 echo $template['head'];
2311 if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )
2313 $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
2317 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
2318 . "<%name%></a> <%help%></li>\n";
2320 $handler = new Actions('template', $template, new ADMIN);
2321 $parser = new PARSER(Actions::getDefinedActions(), $handler);
2323 foreach ( $types as $type => $fName )
2325 $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);
2327 'tabindex' => $tabindex,
2328 'skintype' => $type,
2330 'help' => $helplink,
2331 'skinid' => intrequestVar('skinid'),
2333 $templateBody = Template::fill($template['body'], $data);
2334 $parser->parse($templateBody);
2337 if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )
2339 $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
2343 $template['foot'] = " </ul>\n";
2345 echo $template['foot'];
2350 * Actions::parse_defblogselect()
2351 * Parse skinvar defblogselect
2353 * @param string $templateName name of template
2356 public function parse_defblogselect($templateName = '')
2359 $query = "SELECT bname as text, bnumber as value FROM %s;";
2360 $query = sprintf($query, sql_table('blog'));
2361 $template['name'] = 'DefaultBlog';
2362 $template['selected'] = $CONF['DefaultBlog'];
2363 $template['tabindex'] = 10;
2364 Showlist($query, 'select', $template, $templateName);
2369 * Actions::parse_defcatselect()
2370 * Parse skinvar defcatselect
2372 * @param string $templateName name of template
2375 public function parse_defcatselect($templateName = '')
2378 $blogid = intRequestVar('blogid');
2379 $blog = $manager->getBlog($blogid);
2380 $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
2381 $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
2382 $template['name'] = 'defcat';
2383 $template['selected'] = $blog->getDefaultCategory();
2384 $template['tabindex'] = 110;
2385 Showlist($query, 'select', $template, $templateName);
2390 * Actions::parse_defskinselect()
2391 * Parse skinvar defskinselect
2393 * @param string $type type of skin
2394 * @param string $templateName name of template
2397 public function parse_defskinselect($type = 'blog', $templateName = '')
2400 $query = "SELECT sdname as text, sdnumber as value FROM %s;";
2401 $query = sprintf($query, sql_table('skin_desc'));
2403 $blogid = intRequestVar('blogid');
2408 $template['selected'] = $CONF['BaseSkin'];
2412 $blog = $manager->getBlog($blogid);
2413 $template['selected'] = $blog->getDefaultSkin();
2416 if ( $type != 'blog' )
2418 $nname = 'BaseSkin';
2425 $template['name'] = $nname;
2426 $template['tabindex'] = 50;
2427 Showlist($query, 'select', $template, $templateName);
2432 * AdminActions::parse_deletecomment()
2433 * Parse skinvar deletecomment
2435 * @param string $type type of infomation for comment
2438 public function parse_deletecomment($type = 'id')
2440 $commentid = intRequestVar('commentid');
2441 $comment = COMMENT::getComment($commentid);
2446 echo intRequestVar('commentid');
2449 if ( array_key_exists('member', $comment) && !empty($comment['member']) )
2451 echo $comment['member'];
2455 echo $comment['user'];
2459 $body = strip_tags($comment['body']);
2460 echo Entity::hsc(shorten($body, 300, '...'));
2466 * Actions::parse_deleteitembody()
2467 * Parse skinvar deleteitembody
2472 public function parse_deleteitembody()
2475 $itemid = intRequestVar('itemid');
2476 $item =& $manager->getItem($itemid, 1, 1);
2477 $body = strip_tags($item['body']);
2478 echo Entity::hsc(shorten($body, 300, '...'));
2483 * Actions::parse_deleteitemid()
2484 * Parse skinvar deleteitemid
2489 public function parse_deleteitemid()
2491 echo (integer) intRequestVar('itemid');
2496 * Actions::parse_deleteitemtitle()
2497 * Parse skinvar deleteitemtitle
2502 public function parse_deleteitemtitle()
2505 $itemid = intRequestVar('itemid');
2506 $item =& $manager->getItem($itemid, 1, 1);
2507 echo Entity::hsc(strip_tags($item['title']));
2512 * Actions::parse_editadminskin()
2513 * Parse skinvar editadminskin
2515 * @param string $type type of skin setting
2518 public function parse_editadminskin($type = 'id')
2520 $skinid = intRequestVar('skinid');
2521 $skin = new Skin($skinid);
2525 echo intRequestVar('skinid');
2528 echo Entity::hsc($skin->getName());
2531 echo Entity::hsc($skin->getDescription());
2534 echo Entity::hsc($skin->getContentType());
2537 echo Entity::hsc($skin->getIncludePrefix());
2540 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2548 * Actions::parse_editadminskintype()
2549 * Parse skinvar editadminskintype
2551 * @param string $type name of skin type
2554 public function parse_editadminskintype($type = 'id')
2556 global $CONF, $manager, $member;
2557 $skinid = intRequestVar('skinid');
2558 $skin = new Skin($skinid);
2559 $fNames = Skin::getFriendlyNames();
2560 $sType = strtolower(trim(requestVar('type')));
2565 echo intRequestVar('skinid');
2568 echo Entity::hsc($skin->getName());
2571 echo Entity::hsc($skin->getDescription());
2574 echo Entity::hsc($skin->getContentType());
2577 echo Entity::hsc($skin->getContent($sType));
2580 $skinType = isset($fNames[$sType]) ? $fNames[$sType] : ucfirst($sType);
2581 echo Entity::hsc($skinType);
2584 echo Entity::hsc($sType);
2587 echo Entity::hsc($skin->getIncludePrefix());
2590 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2591 echo Entity::hsc($incMode);
2600 * Actions::parse_editadmintemplateinfo()
2601 * Parse skinvar editadmintemplateinfo
2603 * @param string $type type of skin template
2604 * @param string $description description of template
2605 * @param string $name name of stemplate
2606 * @param string $tabindex index number for tabindex attribute of input element
2607 * @param string $big
2608 * @param string $tplt
2610 public function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2613 $templateid = intRequestVar('templateid');
2614 $templatename = Template::getNameFromId($templateid);
2615 $templatedescription = Template::getDesc($templateid);
2616 $template =& Template::read($templatename);
2620 echo intval($templateid);
2623 echo Entity::hsc($templatename);
2626 echo Entity::hsc($templatedescription);
2628 case 'extratemplate':
2630 $pluginfields = array();
2632 'AdminTemplateExtraFields',
2634 'fields' => &$pluginfields
2640 $tmplt = Template::read($description);
2642 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2644 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2650 . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2652 foreach ( $pluginfields as $pfkey => $pfvalue )
2655 'explugtplname' => Entity::hsc($pfkey)
2657 echo TEMPLATE::fill($base, $data);
2658 foreach ( $pfvalue as $pffield => $pfdesc )
2660 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2665 $desc = defined($description) ? constant($description) : $description;
2666 $name = defined($name) ? constant($name) : $name;
2667 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2674 * Actions::parse_editcomment()
2675 * Parse skinvar editcomment
2677 * @param string $type type of comment setting
2680 public function parse_editcomment($type = 'id')
2683 $commentid = intRequestVar('commentid');
2684 $comment = COMMENT::getComment($commentid);
2686 $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
2691 echo intRequestVar('commentid');
2694 if (array_key_exists('member', $comment) && !empty($comment['member']) )
2696 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
2700 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
2704 echo date("Y-m-d @ H:i", $comment['timestamp']);
2707 $comment['body'] = str_replace('<br />', '', $comment['body']);
2708 $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
2709 echo $comment['body'];
2711 echo $comment[$type];
2718 * Actions::parse_editdesturl()
2719 * Parse skinvar editdesturl
2721 public function parse_editdesturl()
2723 if ( requestVar('desturl') )
2725 echo Entity::hsc(requestVar('desturl'));
2731 * Actions::parse_editmemberlist()
2732 * Parse skinvar editmemberlist
2734 * @param string $templateName name of template
2737 public function parse_editmemberlist($templateName = '')
2740 // show list of members with actions
2741 $query = 'SELECT * FROM '.sql_table('member');
2742 $template['content'] = 'memberlist';
2743 $template['tabindex'] = 10;
2745 $batch = new Batch('member');
2746 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
2751 * AdminActions::parse_editmember()
2752 * Parse skinvar editmember
2754 * @param string $type type of information for member
2755 * @return string $tempateName name of template to use
2758 public function parse_editmember($type = 'id', $templateName = '')
2760 global $CONF, $manager, $member;
2761 $memberid = intRequestVar('memberid');
2762 $mem = MEMBER::createFromID($memberid);
2767 echo intRequestVar('memberid');
2770 if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
2772 echo Entity::hsc($mem->getDisplayName());
2776 $dispName = Entity::hsc($mem->getDisplayName());
2777 if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
2779 echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
2788 echo Entity::hsc($mem->getRealName());
2791 echo Entity::hsc($mem->getEmail());
2794 echo Entity::hsc($mem->getURL());
2797 $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
2800 $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
2803 echo Entity::hsc($mem->getNotes());
2806 $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
2815 * Actions::parse_editpluginfo()
2816 * Parse skinvar editpluginfo
2818 * @param string $type type of plugin info
2821 public function parse_editpluginfo($type)
2823 $pid = intRequestVar('plugid');
2830 echo Entity::hsc(getPluginNameFromPid($pid));
2837 * Actions::parse_editplugoptionslist()
2838 * Parse skinvar editplugoptionslist
2840 * @param string $templateName name of template
2843 public function parse_editplugoptionslist($templateName = '')
2847 $pid = intRequestVar('plugid');
2848 $aOptions = array();
2851 $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";
2852 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
2853 $resource = sql_query($query);
2855 while ( $o = sql_fetch_object($resource) )
2857 array_push($aOIDs, $o->oid);
2858 $aOptions[$o->oid] = array(
2861 'value' => $o->odef,
2862 'name' => $o->oname,
2863 'description' => $o->odesc,
2864 'type' => $o->otype,
2865 'typeinfo' => $o->oextra,
2870 // fill out actual values
2871 if ( count($aOIDs) > 0 )
2873 $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
2874 $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
2876 $result = sql_query($query);
2878 while ( $o = sql_fetch_object($result) )
2880 $aOptions[$o->oid]['value'] = $o->ovalue;
2886 'PrePluginOptionsEdit',
2888 'context' => 'global',
2890 'options' => &$aOptions
2894 $template['content'] = 'plugoptionlist';
2895 $amount = Showlist($aOptions, 'table', $template, $templateName);
2898 echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
2904 * Actions::parse_editskin()
2905 * Parse skinvar editskin
2907 * @param string $type type of skin
2910 public function parse_editskin($type = 'id')
2912 $skinid = intRequestVar('skinid');
2913 $skin = new SKIN($skinid);
2917 echo intRequestVar('skinid');
2920 echo Entity::hsc($skin->getName());
2923 echo Entity::hsc($skin->getDescription());
2926 echo Entity::hsc($skin->getContentType());
2929 echo Entity::hsc($skin->getIncludePrefix());
2932 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2940 * Actions::parse_editskintype()
2941 * Parse skinvar editskintype
2943 * @param string $type name of type for skin type
2946 public function parse_editskintype($type = 'id')
2948 global $CONF, $manager, $member;
2949 $skinid = intRequestVar('skinid');
2950 $skin = new SKIN($skinid);
2951 $fNames = SKIN::getFriendlyNames();
2952 $sType = strtolower(trim(requestVar('type')));
2957 echo intRequestVar('skinid');
2960 echo Entity::hsc($skin->getName());
2963 echo Entity::hsc($skin->getDescription());
2966 echo Entity::hsc($skin->getContentType());
2969 echo Entity::hsc($skin->getContent($sType));
2972 $skinType = isset($fNames[$sType]) ? $fNames[$sType] : ucfirst($sType);
2973 echo Entity::hsc($skinType);
2976 echo Entity::hsc($sType);
2979 echo Entity::hsc($skin->getIncludePrefix());
2982 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2983 echo Entity::hsc($incMode);
2992 * Actions::parse_edittemplateinfo()
2993 * Parse skinvar edittemplateinfo
2995 * @param string $type name of type for skin
2996 * @param string $description description for skin
2997 * @param string $name name of skin
2998 * @param string $help
2999 * @param string $tabindex index value for tabindex attribute of input element
3000 * @param string $big
3001 * @param string $tplt name of template
3003 public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
3006 $templateid = intRequestVar('templateid');
3007 $templatename = TEMPLATE::getNameFromId($templateid);
3008 $templatedescription = TEMPLATE::getDesc($templateid);
3009 $template =& $manager->getTemplate($templatename);
3013 echo intval($templateid);
3016 echo Entity::hsc($templatename);
3019 echo Entity::hsc($templatedescription);
3021 case 'extratemplate':
3023 $pluginfields = array();
3025 'TemplateExtraFields',
3027 'fields' => &$pluginfields
3033 $tmplt = Template::read($description);
3035 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
3037 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
3041 $base = "</tr><tr>\n"
3042 . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
3044 foreach ( $pluginfields as $pfkey => $pfvalue )
3047 'explugtplname' => Entity::hsc($pfkey)
3049 echo TEMPLATE::fill($base, $data);
3050 foreach ( $pfvalue as $pffield => $pfdesc )
3052 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
3057 $desc = defined($description) ? constant($description) : $description;
3058 $name = defined($name) ? constant($name) : $name;
3059 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
3066 * Actions::parse_eventformextra()
3067 * Parse skinvar eventformextra
3069 * @param string $type name of type for event form extra
3072 public function parse_eventformextra($type = 'activation')
3078 $key = requestVar('ackey');
3081 $this->objAdmin->error(_ERROR_ACTIVATE);
3083 $info = MEMBER::getActivationInfo($key);
3086 $this->objAdmin->error(_ERROR_ACTIVATE);
3088 $mem = MEMBER::createFromId($info->vmember);
3091 $this->objAdmin->error(_ERROR_ACTIVATE);
3094 'type' => 'activation',
3098 case 'membermailform-notloggedin':
3100 'type' => 'membermailform-notloggedin',
3104 $manager->notify('FormExtra', $data);
3109 * Actions::parse_extrahead()
3110 * Parse skinvar extrahead
3112 public function parse_extrahead()
3115 $extrahead = $this->objAdmin->extrahead;
3119 'extrahead' => &$extrahead,
3120 'action' => $this->objAdmin->action
3128 * AdminActions::parse_getblogsetting()
3129 * Parse skinvar getblogsetting
3131 public function parse_getblogsetting($which)
3139 elseif ( $bid = intRequestVar('blogid') )
3142 $b = $manager->getBlog($bid);
3152 return Entity::hsc($b->getID());
3155 return Entity::hsc($b->getURL());
3158 return Entity::hsc($b->getName());
3161 return Entity::hsc($b->getDescription());
3164 return Entity::hsc($b->getShortName());
3166 case 'notifyaddress':
3167 return Entity::hsc($b->getNotifyAddress());
3170 return Entity::hsc($b->getMaxComments());
3173 return Entity::hsc($b->getUpdateFile());
3176 return Entity::hsc($b->getTimeOffset());
3183 * Actions::parse_geteditpluginfo()
3184 * Parse skinvar geteditpluginfo
3186 * @param string $type name of setting for edit plugin info
3189 public function parse_geteditpluginfo($type)
3191 $pid = intRequestVar('plugid');
3198 return Entity::hsc(getPluginNameFromPid($pid));
3205 * Actions::parse_getmember()
3206 * Parse skinvar getmember
3207 * (includes a member info thingie)
3209 * @param string $what name of setting for member
3212 public function parse_getmember($what)
3214 global $memberinfo, $member;
3215 // 1. only allow the member-details-page specific variables on member pages
3216 if ( $this->skintype == 'member' )
3221 return Entity::hsc($memberinfo->getDisplayName());
3224 return Entity::hsc($memberinfo->getRealName());
3227 return Entity::hsc($memberinfo->getNotes());
3230 return Entity::hsc($memberinfo->getURL());
3233 return Entity::hsc($memberinfo->getEmail());
3236 return Entity::hsc($memberinfo->getID());
3240 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3241 if ( $member->isLoggedIn() )
3246 return $member->getDisplayName();
3248 case 'yourrealname':
3249 return $member->getRealName();
3252 return $member->getNotes();
3255 return $member->getURL();
3258 return $member->getEmail();
3261 return $member->getID();
3269 * Actions::parse_headmessage()
3270 * Parse skinvar headmessage
3275 public function parse_headmessage()
3277 if ( !empty($this->objAdmin->headMess) )
3279 echo '<p>' . _MESSAGE . ': ' . Entity::hsc($this->objAdmin->headMess) . "</p>\n";
3285 * Actions::parse_helplink()
3286 * Parse skinvar helplink
3288 * @param string $topic name of topic for help
3291 public function parse_helplink($topic = '')
3293 if ( empty($topic) )
3302 * Actions::parse_helpplugname()
3303 * Parse skinvar helpplugname
3308 public function parse_helpplugname()
3310 $plugid = intGetVar('plugid');
3311 Entity::hsc(getPluginNameFromPid($plugid));
3316 * Actions::parse_ilistaddnew()
3317 * Parse skinvar ilistaddnew
3322 public function parse_ilistaddnew()
3324 $blogid = intRequestVar('blogid');
3325 if ( intPostVar('start') == 0 )
3327 echo '<p><a href="index.php?action=createitem&blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";
3333 * Actions::parse_importskininfo()
3334 * Parse skinvar importskininfo
3336 * @param string $type name of information for imported skin
3339 public function parse_importskininfo($type)
3344 echo Entity::hsc(requestVar('skininfo'));
3347 $dataArr = requestArray('skinnames');
3348 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3351 $dataArr = requestArray('tpltnames');
3352 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3355 $dataArr = requestArray('skinclashes');
3356 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3359 $dataArr = requestArray('tpltclashes');
3360 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3363 echo Entity::hsc(requestVar('skinfile'));
3366 echo Entity::hsc(requestVar('mode'));
3373 * Actions::parse_inputyesno()
3374 * Parse skinvar inputyesno
3376 * @param string $name
3377 * @param string $checkedval
3378 * @param string $tabindex
3379 * @param string $value1
3380 * @param string $value2
3381 * @param string $yesval
3382 * @param string $noval
3383 * @param string $isAdmin
3384 * @param string $templateName
3387 public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
3389 self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
3394 * Actions::parse_insertpluginfo()
3395 * Parse templatevar insertpluginfo
3397 public function parse_insertpluginfo($type)
3399 $option = $this->objAdmin;
3403 return $option['pid'];
3406 return Entity::hsc($option['pfile']);
3413 * Actions::parse_insertpluginoptions()
3414 * Parse skinvar insertpluginoptions
3416 * @param string $templateName name of template
3419 public function parse_insertpluginoptions($templateName = '')
3421 $options = $this->objAdmin->aOptions;
3422 $template = array();
3423 $templats = array();
3425 if ( $templateName )
3427 $templates = Template::read($templateName);
3429 if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )
3431 $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
3435 $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";
3437 if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )
3439 $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
3443 $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";
3448 foreach ( $options as $option )
3450 $handler = new Actions($this->skintype, $template, $option);
3451 $parser = new PARSER(Actions::getDefinedActions(), $handler);
3453 if ( $prevPid != $option['pid'] )
3455 $prevPid = $option['pid'];
3456 $parser->parse($template['title']);
3458 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3459 if ( @$meta['access'] != 'hidden' )
3461 $parsed = $parser->parse($template['body']);
3468 * Actions::parse_insplugoptcontent()
3469 * Parse skinvar insplugoptcontent
3474 public function parse_insplugoptcontent()
3476 $option = $this->objAdmin->aOption;
3478 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3479 if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')
3482 listplug_plugOptionRow($option);
3489 * Actions::parse_iprangeinput()
3490 * Parse skinvar iprangeinput
3495 public function parse_iprangeinput()
3497 if ( requestVar('ip') )
3499 $iprangeVal = Entity::hsc(requestVar('ip'));
3500 echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";
3501 echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";
3502 echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
3503 echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
3504 echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";
3508 echo '<input name="iprange" value="custom" type="hidden" />' . "\n";
3509 echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";
3515 * Actions::parse_itemnavlist()
3516 * Parse skinvar itemnavlist
3521 public function parse_itemnavlist()
3523 global $CONF, $manager, $member;
3524 if ( $this->skintype == 'itemlist' )
3526 $blogid = intRequestVar('blogid');
3527 $blog =& $manager->getBlog($blogid);
3529 if ( postVar('start') )
3531 $start = intPostVar('start');
3538 // amount of items to show
3539 if ( postVar('amount') )
3541 $amount = intPostVar('amount');
3545 $amount = intval($CONF['DefaultListSize']);
3551 $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
3552 . " FROM %s, %s, %s"
3553 . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid;";
3555 $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
3557 if ( $this->skintype == 'itemlist' )
3559 $query .= 'and iblog = ' . $blogid;
3560 $template['now'] = $blog->getCorrectTime(time());
3562 // non-blog-admins can only edit/delete their own items
3563 if ( !$member->blogAdminRights($blogid) )
3565 $query .= ' and iauthor = ' . $member->getID();
3568 elseif ( $this->skintype == 'browseownitems' )
3570 $query .= 'and iauthor = ' . $member->getID();
3572 $template['now'] = time();
3575 // search through items
3576 $search = postVar('search');
3578 if ( !empty($search) )
3580 $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
3581 . ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
3582 . ' OR (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
3584 $query .= ' ORDER BY itime DESC'
3585 . " LIMIT {$start},{$amount}";
3587 $template['content'] = 'itemlist';
3589 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
3590 $navList->showBatchList('item', $query, 'table', $template);
3595 * Actions::parse_jstoolbaroptions()
3596 * Parse skinvar jstoolbaroptions
3601 public function parse_jstoolbaroptions()
3605 _SETTINGS_JSTOOLBAR_NONE,
3606 _SETTINGS_JSTOOLBAR_SIMPLE,
3607 _SETTINGS_JSTOOLBAR_FULL
3610 foreach ( $options as $option )
3612 $text = "<option value=\"%d\"%s>%s</option>\n";
3613 $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';
3614 echo sprintf($text, $i, $extra, $option);
3621 * Actions::parse_localeselectoptions()
3622 * Parse skinvar localeselectoptions
3627 public function parse_localeselectoptions()
3629 $locales = i18n::get_available_locale_list();
3630 $memid = intRequestVar('memberid');
3633 $mem = MEMBER::createFromID($memid);
3634 if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
3636 echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3640 echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3645 if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
3647 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
3650 foreach ( $locales as $locale )
3654 if ( $locale == $mem->getLocale() )
3656 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3660 echo "<option value=\"{$locale}\">{$locale}</option>\n";
3665 if ( $locale == i18n::get_current_locale() )
3667 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3671 echo "<option value=\"{$locale}\">{$locale}</option>\n";
3679 * Actions::parse_listplugplugoptionrow()
3680 * Parse templatevar listplugplugoptionrow
3682 * @param string $templateName name of template
3685 public function parse_listplugplugoptionrow($templateName = '')
3687 $option = $this->objAdmin;
3688 echo listplug_plugOptionRow($option, $templateName);
3693 * Actions::parse_mediadirwarning()
3694 * Parse skinvar mediadirwarning
3699 public function parse_mediadirwarning()
3702 if ( !is_dir($DIR_MEDIA) )
3704 echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";
3706 if ( !is_readable($DIR_MEDIA) )
3708 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";
3710 if ( !is_writeable($DIR_MEDIA) )
3712 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";
3718 * Actions::parse_movedistselect()
3719 * Parse skinvar movedistselect
3721 public function parse_movedistselect()
3723 $actionType = requestVar('action');
3724 switch ( $actionType )
3727 $this->objAdmin->selectBlogCategory('destcatid');
3729 case 'batchcategory':
3730 $this->objAdmin->selectBlog('destblogid');
3733 if ( $this->skintype == 'itemmove' )
3735 $query = "SELECT icat as result FROM %s WHERE inumber=%d;";
3736 $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
3737 $catid = quickQuery(sprintf($query, intRequestVar('itemid')));
3738 $this->objAdmin->selectBlogCategory('catid', $catid, 10, 1);
3746 * Actions::parse_moveitemid()
3747 * Parse skinvar moveitemid
3752 public function parse_moveitemid()
3754 echo intRequestVar('itemid');
3759 * Actions::parse_newestcompare()
3760 * Parse skinvar newestcompare
3765 public function parse_newestcompare()
3768 $newestVersion = getLatestVersion();
3769 $newestCompare = str_replace('/', '.', $newestVersion);
3770 $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
3771 if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
3773 echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
3774 echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
3780 * Actions::parse_newmemberselect()
3781 * Parse skinvar newmemberselect
3783 * @param string $templateName name of template to use
3786 public function parse_newmemberselect($templateName = '')
3788 $blogid = intRequestVar('blogid');
3790 $query = "SELECT tmember FROM %s WHERE tblog=%d;";
3791 $query = sprintf($query, sql_table('team'), (integer) $blogid);
3792 $res = sql_query($query);
3795 while ( $tmember = sql_fetch_object($res) )
3797 $tmem[] = intval($tmember->tmember);
3800 $query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
3801 $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
3803 $template['name'] = 'memberid';
3804 $template['tabindex'] = 10000;
3805 Showlist($query, 'select', $template, $templateName);
3810 * Actions::parse_newpluginlist()
3811 * Parse skinvar newpluginlist
3816 public function parse_newpluginlist()
3818 $candidates = $this->newPlugCandidates;
3819 foreach ( $candidates as $name )
3821 echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";
3827 * Actions::parse_outputspecialdirs()
3828 * Parse skinvar outputspecialdirs
3830 * @param string $type type of setting for directory
3833 public function parse_outputspecialdirs($type)
3838 global $DIR_NUCLEUS;
3839 echo Entity::hsc($DIR_NUCLEUS);
3843 echo Entity::hsc($DIR_MEDIA);
3850 * Actions::parse_passrequestvars()
3851 * Parse skinvar passrequestvars
3856 public function parse_passrequestvars()
3858 $oldaction = postVar('oldaction');
3859 if ( ($oldaction != 'logout')
3860 && ($oldaction != 'login')
3861 && $this->objAdmin->passvar
3862 && !postVar('customaction') )
3870 * Actions::parse_pluginextras()
3871 * Parse skinvar pluginextras
3873 * @param string $type type of plugin context
3876 public function parse_pluginextras($type = 'global')
3882 $id = intRequestVar('memberid');
3883 $mem = MEMBER::createFromID($id);
3885 'MemberSettingsFormExtras',
3892 $id = intRequestVar('blogid');
3893 $blg = $manager->getBlog($id);
3895 'BlogSettingsFormExtras',
3903 'GeneralSettingsFormExtras',
3913 * Actions::parse_pluginhelp()
3914 * Parse skinvar pluginhelp
3919 public function parse_pluginhelp()
3921 global $manager, $DIR_PLUGINS;
3922 $plugid = intGetVar('plugid');
3923 $plugName = getPluginNameFromPid($plugid);
3924 $plug =& $manager->getPlugin($plugName);
3926 if ( $plug->supportsFeature('HelpPage') > 0 )
3928 $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
3929 if ( @file_exists($helpfile . 'php') )
3931 @include($helpfile . 'php');
3934 elseif ( @file_exists($helpfile . 'html') )
3936 @include($helpfile . 'html');
3940 echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";
3941 echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";
3946 * Actions::parse_pluginlistlist()
3947 * Parse skinvar pluginlistlist
3949 * @param string $templateName name of template to use
3952 public function parse_pluginlistlist($templateName = '')
3954 $query = "SELECT * FROM %s ORDER BY porder ASC;";
3955 $query = sprintf($query, sql_table('plugin'));
3956 $template['content'] = 'pluginlist';
3957 $template['tabindex'] = 10;
3958 Showlist($query, 'table', $template, $templateName);
3963 * Actions::parse_pluginoptions()
3964 * Parse skinvar pluginoptions
3966 * @param string $type type of plugin option
3969 public function parse_pluginoptions($type = 'global')
3974 $id = intRequestVar('memberid');
3977 $id = intRequestVar('blogid');
3980 $id = intRequestVar('catid');
3983 $this->objAdmin->_insertPluginOptions($type, $id);
3988 * Actions::parse_qmenuaddselect()
3989 * Parse skinvar qmanuaddselect
3991 * @param string $templateName name of template to use
3994 public function parse_qmenuaddselect($templateName = '')
3997 $showAll = requestVar('showall');
3998 if ( $member->isAdmin() && ($showAll == 'yes') )
4000 // Super-Admins have access to all blogs! (no add item support though)
4001 $query = 'SELECT bnumber as value, bname as text'
4002 . ' FROM ' . sql_table('blog')
4003 . ' ORDER BY bname';
4007 $query = 'SELECT bnumber as value, bname as text'
4008 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
4009 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
4010 . ' ORDER BY bname';
4012 $template['name'] = 'blogid';
4013 $template['tabindex'] = 15000;
4014 $template['extra'] = _QMENU_ADD_SELECT;
4015 $template['selected'] = -1;
4016 $template['shorten'] = 10;
4017 $template['shortenel'] = '';
4018 $template['javascript'] = 'onchange="return form.submit()"';
4019 Showlist($query, 'select', $template, $templateName);
4024 * Actions::parse_quickmenu()
4025 * Parse skinvar quickmenu
4027 * @param string $templateName name of template to use
4030 public function parse_quickmenu($templateName = '')
4033 $templates = array();
4034 $template = array();
4035 if ( !empty($templateName) )
4037 $templates = Template::read($templateName);
4039 $pluginExtras = array();
4043 'options' => &$pluginExtras
4046 if ( count($pluginExtras) > 0 )
4048 if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )
4050 $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
4054 $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';
4056 $handler = new Actions($this->skintype, $template, $this->objAdmin);
4057 $parser = new PARSER(Actions::getDefinedActions(), $handler);
4058 $parser->parse($template['title']);
4060 if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )
4062 $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
4066 $template['head'] = '<ul>';
4069 echo $template['head'];
4071 if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )
4073 $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
4077 $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';
4080 foreach ( $pluginExtras as $aInfo )
4083 'plugadminurl' => Entity::hsc($aInfo['url']),
4084 'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
4085 'plugadmintitle' => Entity::hsc($aInfo['title']),
4087 echo TEMPLATE::fill($template['body'], $data);
4089 if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
4091 $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
4095 $template['foot'] = '</ul>';
4097 echo $template['foot'];
4103 * Actions::parse_requestblogid()
4104 * Parse skinvar requestblogid
4109 public function parse_requestblogid()
4111 echo intRequestVar('blogid');
4116 * Actions::parse_requestiprange()
4117 * Parse skinvar requestiprange
4122 public function parse_requestiprange()
4124 if ( requestVar('iprange') )
4126 echo Entity::hsc(requestVar('iprange'));
4128 elseif ( requestVar('ip') )
4130 echo Entity::hsc(requestVar('ip'));
4136 * Actions::parse_selectlocaladminskinfiles()
4137 * Parse skinvar selectlocaladminskinfiles
4142 public function parse_selectlocaladminskinfiles()
4144 global $DIR_ADMINSKINS, $manager;
4145 $candidates = SkinImport::searchForCandidates($DIR_ADMINSKINS);
4146 foreach ( $candidates as $skinname => $skinfile )
4148 $html = Entit::hsc($skinfile);
4149 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4155 * Actions::parse_selectlocalskinfiles()
4156 * Parse skinvar selectlocalskinfiles
4161 public function parse_selectlocalskinfiles()
4164 $candidates = SkinImport::searchForCandidates($DIR_SKINS);
4165 foreach ( $candidates as $skinname => $skinfile )
4167 $html = Entity::hsc($skinfile);
4168 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4174 * Actions::parse_skineditallowedlist()
4175 * Parse skinvar skineditallowedlist
4177 * @param string $type type of skin
4178 * @param string $templateName name of template
4181 public function parse_skineditallowedlist($type, $templateName = '')
4186 $query = "SELECT bshortname, bname FROM %s";
4188 'content' => 'shortblognames'
4190 $query = sprintf($query, sql_table('blog'));
4191 Showlist($query, 'table', $show, $templateName);
4194 $query = "SELECT tdname as name, tddesc as description FROM %s";
4196 'content' => 'shortnames'
4198 $query = sprintf($query, sql_table('template_desc'));
4199 Showlist($query, 'table', $show, $templateName);
4206 * Actions::parse_skinfile()
4207 * Inserts an url relative to the skindir (useful when doing import/export)
4209 * e.g. <skinfile(default/myfile.sth)>
4211 * @param string $filename file name for skin
4214 public function parse_skinfile($filename)
4217 * TODO: we should decide to use different directory or default $DIR_SKINS
4218 $base = NP_SkinableAdmin::getAdminSkinURL();
4219 $pref = PARSER::getProperty('IncludePrefix');
4220 echo $base . $pref . $filename;
4222 $pref = PARSER::getProperty('IncludePrefix');
4223 echo $pref . $filename;
4228 * Actions::parse_skinielist()
4229 * Parse skinvar skinielist
4231 * @param string $type type of skin
4232 * @param string $templateName name of template to use
4235 public function parse_skinielist($type, $templateName = '')
4237 $templates = array();
4238 if ( $templateName )
4240 $templates = Template::read($templateName);
4242 if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
4244 $template = $templates['SKINIE_EXPORT_LIST'];
4248 $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
4249 . "<td><%expdesc%></td>\n"
4255 $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
4256 while ( $skinObj = sql_fetch_object($res) )
4259 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
4260 'expid' => 'skinexp' . $skinObj->sdnumber,
4261 'expname' => Entity::hsc($skinObj->sdname),
4262 'expdesc' => Entity::hsc($skinObj->sddesc),
4264 echo TEMPLATE::fill($template, $data);
4268 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
4269 while ($templateObj = sql_fetch_object($res)) {
4271 'typeid' => 'template[' . $templateObj->tdnumber . ']',
4272 'expid' => 'templateexp' . $templateObj->tdnumber,
4273 'expname' => Entity::hsc($templateObj->tdname),
4274 'expdesc' => Entity::hsc($templateObj->tddesc),
4276 echo TEMPLATE::fill($template, $data);
4284 * Actions::parse_skinoverview()
4285 * Parse skinvar skinoverview
4287 * @param string $templateName name of template to use
4290 public function parse_skinoverview($templateName = '')
4292 $query = "SELECT * FROM %s ORDER BY sdname";
4293 $query = sprintf($query, sql_table('skin_desc'));
4295 $template['content'] = 'skinlist';
4296 $template['tabindex'] = 10;
4298 Showlist($query, 'table', $template, $templateName);
4303 * Actions::parse_skintypehelp()
4304 * Check editing skintypehelp
4309 public function parse_skintypehelp()
4311 $nowSkinType = strtolower(trim(requestVar('type')));
4312 $regularType = array(
4323 if ( in_array($nowSkinType, $regularType) )
4325 help('skinpart' . $nowSkinType);
4329 help('skinpartspecial');
4335 * Actions::parse_specialskinlist()
4336 * Parse skinvar specialskinlist
4338 * @param string $templateName name of template to use
4341 public function parse_specialskinlist($templateName = '')
4343 $templates = array();
4344 if ( $templateName )
4346 $templates = Template::read($templateName);
4358 $skinid = intRequestVar('skinid');
4359 $query = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
4360 $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
4362 $res = sql_query($query);
4363 if ( $res && sql_num_rows($res) > 0 )
4366 if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
4368 $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
4372 $template['head'] = "<ul>\n";
4374 echo TEMPLATE::fill($template['head'], $data);
4375 if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )
4377 $template['body'] = $templates['SPECIALSKINLIST_BODY'];
4381 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&skinid=<%skinid%>'
4382 . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
4383 . 'action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
4386 while ( $row = sql_fetch_assoc($res) )
4389 'tabindex' => $tabstart++,
4390 'skinid' => $skinid,
4391 'skintype' => Entity::hsc(strtolower($row['stype']))
4393 echo TEMPLATE::fill($template['body'], $data);
4396 if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
4398 $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
4402 $template['foot'] = "</ul>\n";
4404 echo TEMPLATE::fill($template['foot'], $data);
4410 * Actions::parse_sprinttext()
4413 * @param string $which
4414 * @param string $val
4417 public function parse_sprinttext($which, $val)
4419 if ( !defined($which) )
4425 $base = constant($which);
4428 if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
4430 if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
4432 $met = 'parse_' . $matchies[0];
4436 $arg = trim($args[0], '()');
4437 $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
4440 if ( method_exists($this, $met) )
4442 $value = call_user_func(array(&$this, $met), $arg);
4446 if ( !isset($value) || empty($value) )
4450 echo sprintf($base, $value);
4455 * Actions::parse_systemsettings()
4456 * Parse skinvar systemsettings
4458 * @param string $type type of settings for system
4459 * @param string $templateName name of template to use
4462 public function parse_systemsettings($type = 'phpinfo', $templateName = '')
4464 global $member, $CONF, $nucleus;
4466 $member->isAdmin() or $this->objAdmin->disallow();
4468 $enable = _ADMIN_SYSTEMOVERVIEW_ENABLE;
4469 $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
4476 case 'sqlserverinfo':
4477 echo sql_get_server_info();
4479 case 'sqlclientinfo':
4480 echo sql_get_client_info();
4482 case 'magicquotesgpc':
4483 echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
4485 case 'magicquotesruntime':
4486 echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';
4488 case 'registerglobals':
4489 echo ini_get('register_globals') ? 'On' : 'Off';
4492 $templates = array();
4493 if ( $templateName )
4495 $templates = Template::read($templateName);
4497 if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )
4499 $template = $templates['SYSTEMINFO_GDSETTINGS'];
4503 $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";
4506 $gdinfo = gd_info();
4508 foreach ( $gdinfo as $key => $value )
4510 if ( is_bool($value) )
4512 $value = $value ? $enable : $disable;
4516 $value = Entity::hsc($value);
4522 echo TEMPLATE::fill($template, $data);
4527 phpinfo(INFO_MODULES);
4528 $im = ob_get_contents();
4530 echo (strstr($im, 'mod_rewrite') != '') ? $enable : $disable;
4532 case 'nucleusversion':
4533 echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
4535 case 'nucleuspatchlevel':
4536 echo getNucleusPatchLevel();
4542 echo $CONF['ItemURL'];
4544 case 'alertonheaderssent':
4545 echo $CONF['alertOnHeadersSent'] ? $enable : $disable;
4547 case 'nucleuscodename':
4548 if ( $nucleus['codename'] != '' )
4550 echo ' "' . $nucleus['codename'] . '"';
4553 case 'versioncheckurl':
4554 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4561 * Actions::parse_templateoverview()
4562 * Parse skinvar templateoverview
4564 * @param string $templateName name of template to use
4567 public function parse_templateoverview($templateName = '')
4569 $query = "SELECT * FROM %s ORDER BY tdname";
4570 $query = sprintf($query, sql_table('template_desc'));
4571 $template['content'] = 'templatelist';
4572 $template['tabindex'] = 10;
4573 Showlist($query, 'table', $template, $templateName);
4578 * AdminActions::parse_ticket()
4584 public function parse_ticket()
4587 $manager->addTicketHidden();
4592 * Actions::parse_versioncheckurl()
4593 * Parse skinvar versioncheckurl
4598 public function parse_versioncheckurl()
4600 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4605 * Actions::parse_yrbloglist()
4606 * Parse skinvar yrbloglist
4608 * @param string $templateName name of template to use
4611 public function parse_yrbloglist($templateName = '')
4614 $showAll = requestVar('showall');
4616 if ( $member->isAdmin() && ($showAll == 'yes') )
4618 // Super-Admins have access to all blogs! (no add item support though)
4619 $query = "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
4621 . " ORDER BY bnumber";
4622 $query = sprintf($query, sql_table('blog'));
4626 $query = "SELECT bnumber, bname, tadmin, burl, bshortname"
4628 . " WHERE tblog=bnumber and tmember=%d"
4629 . " ORDER BY bnumber";
4630 $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
4633 $template['content'] = 'bloglist';
4634 $template['superadmin'] = $member->isAdmin();
4636 $amount = Showlist($query, 'table', $template, $templateName);
4638 if ( ($showAll != 'yes') && ($member->isAdmin()) )
4640 $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
4642 $total = quickQuery($query);
4643 if ( $total > $amount )
4645 echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
4651 echo _OVERVIEW_NOBLOGS;
4653 elseif( $amount != 0 )
4655 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
4657 $query = "SELECT ititle, inumber, bshortname"
4659 . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1';
4660 $query = sprintf($query. sql_table('item'), sql_table('blog'), (integer) $member->getID());
4662 $template['content'] = 'draftlist';
4664 $amountdrafts = Showlist($query, 'table', $template, $templateName);
4665 if ( $amountdrafts == 0 )
4667 echo _OVERVIEW_NODRAFTS;
4674 * Actions::customHelp()
4675 * shows a link to custom help file
4677 * @param integer $id
4678 * @param string $tplName
4679 * @param string $url
4680 * @param string $iconURL
4681 * @param string $alt
4682 * @param string $title
4686 private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4688 echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
4692 * Actions::customHelpHtml()
4694 * @param integer $id
4695 * @param string $tplName
4696 * @param string $url
4697 * @param string $iconURL
4698 * @param string $alt
4699 * @param string $title
4700 * @param string $onclick
4701 * @return string anchor element with help uri
4703 private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4705 $templates = array();
4708 $templates = Template::read($tplName);
4710 if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
4712 $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
4716 $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';
4719 if ( empty($iconURL) )
4722 $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
4724 if ( function_exists('getimagesize') )
4726 $size = getimagesize($iconURL);
4727 $width = 'width="' . $size[0] . '" ';
4728 $height = 'height="' . $size[1] . '" ';
4731 'iconurl' => $iconURL,
4733 'height' => $height,
4734 'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
4735 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
4737 $icon = TEMPLATE::fill($template, $data);
4738 $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
4739 return $help . $icon;
4743 * Actions::input_yesno
4746 * @param $checkedval
4753 * @param $templateName
4756 private function input_yesno($name,
4767 $templates = array();
4768 if ( $templateName )
4770 $templates = Template::read($templateName);
4773 if ( $name == 'admin' )
4775 if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
4777 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
4781 $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
4782 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
4783 . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
4784 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
4789 if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
4791 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
4795 if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
4797 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
4800 if ( !isset($template) )
4802 $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
4803 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
4804 . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
4805 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
4810 $id = Entity::hsc($name);
4811 $id = str_replace('[', '-', $id);
4812 $id = str_replace(']', '-', $id);
4813 $id1 = $id . Entity::hsc($value1);
4814 $id2 = $id . Entity::hsc($value2);
4816 'name' => Entity::hsc($name),
4817 'yesval' => Entity::hsc($value1),
4818 'noval' => Entity::hsc($value2),
4821 'yesvaltext' => $yesval,
4822 'novaltext' => $noval,
4823 'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
4824 'nocheckedval' => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
4825 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
4830 return Template::fill($template, $dat);
4834 echo TEMPLATE::fill($template, $dat);
4840 * AdminActions::parse_text()
4843 * FIXME: is this really needed?
4845 * @param string $which constant vallue
4848 public function parse_text($which)
4850 if ( defined($which) )
4852 echo constant($which);