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;";
1228 $query = sprintf($query, sql_table('adminskin_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 ORDER BY sdname;";
1271 $query = sprintf($query, sql_table('adminskin_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;";
1291 $query = sprintf($query, sql_table('adminskin_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('adminskin'), "'" . 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
1900 * @param string $type type of anchor element for bookmarklet
1903 public function parse_bookmarkletadmin($type)
1907 $blogid = intRequestVar('blogid');
1909 if ( $type != 'regfile' )
1911 echo Entity::hsc(getBookmarklet($blogid));
1915 $url = 'index.php?action=regfile&blogid=' . intval($blogid);
1916 $url = $manager->addTicketToUrl($url);
1917 /* TODO: Shift-JIS is not always correct, I think... */
1918 echo Entity::hsc($url, 'SJIS');
1924 * AdminActions::parse_category()
1925 * Parse skinvar category
1927 * @param string $type name of setting for category
1930 public function parse_category($type = 'name')
1932 echo $this->parse_getcategory($type);
1937 * AdminActions::parse_categorysetting()
1938 * Parse skinvar categorysetting
1940 * @param string $type type in category setting
1943 public function parse_categorysetting($type)
1945 $catid = intRequestVar('catid');
1946 if ( $type == 'id' )
1951 $blogid = intRequestVar('blogid');
1952 $query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
1953 $query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
1954 $res = sql_query($query);
1955 $obj = sql_fetch_object($res);
1957 if ( $type != desc )
1959 echo Entity::hsc($obj->cdesc);
1963 echo Entity::hsc($obj->cname);
1970 * AdminActions::parse_codename()
1971 * Parse templatevar codename
1976 * TODO: is this need???
1978 public function parse_codename()
1981 echo $nucleus['codename'];
1986 * AdminActions::parse_commentnavlist()
1987 * Parse skinvar commentnavlist
1992 public function parse_commentnavlist()
1994 global $CONF, $manager, $member;
1997 if ( postVar('start') )
1999 $start = intPostVar('start');
2006 // amount of items to show
2007 if ( postVar('amount') )
2009 $amount = intPostVar('amount');
2013 $amount = (integer) $CONF['DefaultListSize'];
2019 $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
2021 . 'LEFT OUTER JOIN %s ON mnumber=cmember '
2023 $query = sprintf($query, sql_table('comment'), sql_table('member'));
2025 if ( $this->skintype == 'itemcommentlist' )
2027 $itemid = intRequestVar('itemid');
2028 $query .= " citem={$itemid}";
2029 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2031 $nonComments = _NOCOMMENTS;
2033 elseif ( $this->skintype == 'browseowncomments' )
2036 $query .= ' cmember=' . $member->getID();
2037 $template['canAddBan'] = 0;
2039 $nonComments = _NOCOMMENTS_YOUR;
2041 elseif ( $this->skintype == 'blogcommentlist' )
2044 $query .= ' cblog=' . intRequestVar('blogid');
2045 $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
2046 $bid = intRequestVar('blogid');
2047 $nonComments = _NOCOMMENTS_BLOG;
2050 $search = postVar('search');
2051 if ( !empty($search) )
2053 $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
2056 $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
2058 $template['content'] = 'commentlist';
2060 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
2061 $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
2066 * AdminActions::parse_configsettingsedit()
2067 * Parse skinvar configsettingsedit
2069 * @param string $type type of global configuration
2072 public function parse_configsettingsedit($type)
2077 case 'DefaultListSize':
2078 if ( !array_key_exists('DefaultListSize', $CONF) )
2080 $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
2081 $query = sprintf($query, sql_table('config'));
2083 $CONF['DefaultListSize'] = 10;
2085 elseif ( intval($CONF['DefaultListSize']) < 1 )
2087 $CONF['DefaultListSize'] = 10;
2089 echo intval($CONF['DefaultListSize']);
2091 case 'SessionCookie':
2092 $value = $CONF['SessionCookie'];
2093 $txt1 = _SETTINGS_COOKIESESSION;
2094 $txt2 = _SETTINGS_COOKIEMONTH;
2095 $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);
2098 $value = $CONF['URLMode'];
2099 $txt1 = _SETTINGS_URLMODE_NORMAL;
2100 $txt2 = _SETTINGS_URLMODE_PATHINFO;
2101 $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);
2104 if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )
2106 echo Entity::hsc($CONF[$type]);
2114 * AdminActions::parse_configsettingsyesno()
2115 * Parse skinvar configsettingsyesno
2117 * @param string $type type of global setting
2118 * @param integer $tabindex tabindex attribute of input element
2121 public function parse_configsettingsyesno($type, $tabindex)
2124 if ( array_key_exists($type, $CONF) )
2126 $this->parse_inputyesno($type, $CONF[$type], $tabindex);
2132 * AdminActions::parse_customhelplink()
2133 * Parse skinvar customhelplink
2135 * @param string $topic name of topic
2136 * @param string $tplName name of template
2137 * @param string $url string as URI
2138 * @param string $iconURL string as URI for icon
2139 * @param string $alt alternative text for image element
2140 * @param string $title title for anchor element
2143 public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
2145 $this->customHelp($topic, $url, $iconURL);
2150 * AdminActions::parse_date()
2151 * Parse skinvar date
2153 public function parse_date($format = 'c')
2155 global $CONF, $manager;
2156 echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
2161 * AdminActions::parse_defaultadminskintypes()
2162 * Parse skinvar defaultadminskintypes
2164 * @param string $tabindex index number for tabindex attribute of input element
2165 * @param string $templateName name of template
2168 public function parse_defaultadminskintypes($tabindex, $templateName = '')
2170 $templates = array();
2171 if ( $templateName )
2173 $templates = Template::read($templateName);
2176 $types = Skin::getFriendlyNames('AdminActions');
2179 if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )
2181 $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
2185 $template['head'] = "<ul>\n";
2188 echo $template['head'];
2190 if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )
2192 $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
2196 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
2197 . "<%name%></a> <%help%></li>\n";
2199 $handler = new Actions('template', $template, new ADMIN);
2200 $parser = new PARSER(Actions::getDefinedActions(), $handler);
2202 foreach ( $types as $type => $fName )
2204 $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);
2206 'tabindex' => $tabindex,
2207 'skintype' => $type,
2209 'help' => $helplink,
2210 'skinid' => intrequestVar('skinid'),
2212 $templateBody = Template::fill($template['body'], $data);
2213 $parser->parse($templateBody);
2216 if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )
2218 $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
2222 $template['foot'] = " </ul>\n";
2224 echo $template['foot'];
2229 * AdminActions::parse_defblogselect()
2230 * Parse skinvar defblogselect
2232 * @param string $templateName name of template
2235 public function parse_defblogselect($templateName = '')
2238 $query = "SELECT bname as text, bnumber as value FROM %s;";
2239 $query = sprintf($query, sql_table('blog'));
2240 $template['name'] = 'DefaultBlog';
2241 $template['selected'] = $CONF['DefaultBlog'];
2242 $template['tabindex'] = 10;
2243 Showlist($query, 'select', $template, $templateName);
2248 * AdminActions::parse_defcatselect()
2249 * Parse skinvar defcatselect
2251 * @param string $templateName name of template
2254 public function parse_defcatselect($templateName = '')
2257 $blogid = intRequestVar('blogid');
2258 $blog = $manager->getBlog($blogid);
2259 $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
2260 $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
2261 $template['name'] = 'defcat';
2262 $template['selected'] = $blog->getDefaultCategory();
2263 $template['tabindex'] = 110;
2264 Showlist($query, 'select', $template, $templateName);
2269 * AdminActions::parse_defskinselect()
2270 * Parse skinvar defskinselect
2272 * @param string $type type of skin
2273 * @param string $templateName name of template
2276 public function parse_defskinselect($type = 'blog', $templateName = '')
2279 $query = "SELECT sdname as text, sdnumber as value FROM %s;";
2280 $query = sprintf($query, sql_table('skin_desc'));
2282 $blogid = intRequestVar('blogid');
2287 $template['selected'] = $CONF['BaseSkin'];
2291 $blog = $manager->getBlog($blogid);
2292 $template['selected'] = $blog->getDefaultSkin();
2295 if ( $type != 'blog' )
2297 $nname = 'BaseSkin';
2304 $template['name'] = $nname;
2305 $template['tabindex'] = 50;
2306 Showlist($query, 'select', $template, $templateName);
2311 * AdminActions::parse_deletecomment()
2312 * Parse skinvar deletecomment
2314 * @param string $type type of infomation for comment
2317 public function parse_deletecomment($type = 'id')
2319 $commentid = intRequestVar('commentid');
2320 $comment = COMMENT::getComment($commentid);
2325 echo intRequestVar('commentid');
2328 if ( array_key_exists('member', $comment) && !empty($comment['member']) )
2330 echo $comment['member'];
2334 echo $comment['user'];
2338 $body = strip_tags($comment['body']);
2339 echo Entity::hsc(shorten($body, 300, '...'));
2345 * AdminActions::parse_deleteitembody()
2346 * Parse skinvar deleteitembody
2351 public function parse_deleteitembody()
2354 $itemid = intRequestVar('itemid');
2355 $item =& $manager->getItem($itemid, 1, 1);
2356 $body = strip_tags($item['body']);
2357 echo Entity::hsc(shorten($body, 300, '...'));
2362 * AdminActions::parse_deleteitemid()
2363 * Parse skinvar deleteitemid
2368 public function parse_deleteitemid()
2370 echo (integer) intRequestVar('itemid');
2375 * AdminActions::parse_deleteitemtitle()
2376 * Parse skinvar deleteitemtitle
2381 public function parse_deleteitemtitle()
2384 $itemid = intRequestVar('itemid');
2385 $item =& $manager->getItem($itemid, 1, 1);
2386 echo Entity::hsc(strip_tags($item['title']));
2391 * AdminActions::parse_editadminskin()
2392 * Parse skinvar editadminskin
2394 * @param string $type type of skin setting
2397 public function parse_editadminskin($type = 'id')
2399 $skinid = intRequestVar('skinid');
2400 $skin = new Skin($skinid);
2404 echo intRequestVar('skinid');
2407 echo Entity::hsc($skin->getName());
2410 echo Entity::hsc($skin->getDescription());
2413 echo Entity::hsc($skin->getContentType());
2416 echo Entity::hsc($skin->getIncludePrefix());
2419 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2427 * AdminActions::parse_editadminskintype()
2428 * Parse skinvar editadminskintype
2430 * @param string $type name of skin type
2433 public function parse_editadminskintype($type = 'id')
2435 global $CONF, $manager, $member;
2436 $skinid = intRequestVar('skinid');
2437 $skin = new Skin($skinid);
2438 $fNames = Skin::getFriendlyNames();
2439 $sType = strtolower(trim(requestVar('type')));
2444 echo intRequestVar('skinid');
2447 echo Entity::hsc($skin->getName());
2450 echo Entity::hsc($skin->getDescription());
2453 echo Entity::hsc($skin->getContentType());
2456 echo Entity::hsc($skin->getContent($sType));
2459 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2460 echo Entity::hsc($skinType);
2463 echo Entity::hsc($sType);
2466 echo Entity::hsc($skin->getIncludePrefix());
2469 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2470 echo Entity::hsc($incMode);
2479 * AdminActions::parse_editadmintemplateinfo()
2480 * Parse skinvar editadmintemplateinfo
2482 * @param string $type type of skin template
2483 * @param string $description description of template
2484 * @param string $name name of stemplate
2485 * @param string $tabindex index number for tabindex attribute of input element
2486 * @param string $big
2487 * @param string $tplt
2489 public function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2492 $templateid = intRequestVar('templateid');
2493 $templatename = Template::getNameFromId($templateid);
2494 $templatedescription = Template::getDesc($templateid);
2495 $template =& Template::read($templatename);
2499 echo intval($templateid);
2502 echo Entity::hsc($templatename);
2505 echo Entity::hsc($templatedescription);
2507 case 'extratemplate':
2509 $pluginfields = array();
2511 'AdminTemplateExtraFields',
2513 'fields' => &$pluginfields
2519 $tmplt = Template::read($description);
2521 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2523 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2529 . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2531 foreach ( $pluginfields as $pfkey => $pfvalue )
2534 'explugtplname' => Entity::hsc($pfkey)
2536 echo TEMPLATE::fill($base, $data);
2537 foreach ( $pfvalue as $pffield => $pfdesc )
2539 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2544 $desc = defined($description) ? constant($description) : $description;
2545 $name = defined($name) ? constant($name) : $name;
2546 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2553 * AdminActions::parse_editcomment()
2554 * Parse skinvar editcomment
2556 * @param string $type type of comment setting
2559 public function parse_editcomment($type = 'id')
2562 $commentid = intRequestVar('commentid');
2563 $comment = COMMENT::getComment($commentid);
2565 $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
2570 echo intRequestVar('commentid');
2573 if (array_key_exists('member', $comment) && !empty($comment['member']) )
2575 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
2579 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
2583 echo date("Y-m-d @ H:i", $comment['timestamp']);
2586 $comment['body'] = str_replace('<br />', '', $comment['body']);
2587 $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
2588 echo $comment['body'];
2590 echo $comment[$type];
2597 * AdminActions::parse_editdesturl()
2598 * Parse skinvar editdesturl
2600 public function parse_editdesturl()
2602 if ( requestVar('desturl') )
2604 echo Entity::hsc(requestVar('desturl'));
2610 * AdminActions::parse_editmemberlist()
2611 * Parse skinvar editmemberlist
2613 * @param string $templateName name of template
2616 public function parse_editmemberlist($templateName = '')
2619 // show list of members with actions
2620 $query = 'SELECT * FROM '.sql_table('member');
2621 $template['content'] = 'memberlist';
2622 $template['tabindex'] = 10;
2624 $batch = new Batch('member');
2625 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
2630 * AdminActions::parse_editmember()
2631 * Parse skinvar editmember
2633 * @param string $type type of information for member
2634 * @return string $tempateName name of template to use
2637 public function parse_editmember($type = 'id', $templateName = '')
2639 global $CONF, $manager, $member;
2640 $memberid = intRequestVar('memberid');
2641 $mem = MEMBER::createFromID($memberid);
2646 echo intRequestVar('memberid');
2649 if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
2651 echo Entity::hsc($mem->getDisplayName());
2655 $dispName = Entity::hsc($mem->getDisplayName());
2656 if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
2658 echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
2667 echo Entity::hsc($mem->getRealName());
2670 echo Entity::hsc($mem->getEmail());
2673 echo Entity::hsc($mem->getURL());
2676 $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
2679 $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
2682 echo Entity::hsc($mem->getNotes());
2685 $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
2694 * AdminActions::parse_editpluginfo()
2695 * Parse skinvar editpluginfo
2697 * @param string $type type of plugin info
2700 public function parse_editpluginfo($type)
2702 $pid = intRequestVar('plugid');
2709 echo Entity::hsc(getPluginNameFromPid($pid));
2716 * AdminActions::parse_editplugoptionslist()
2717 * Parse skinvar editplugoptionslist
2719 * @param string $templateName name of template
2722 public function parse_editplugoptionslist($templateName = '')
2726 $pid = intRequestVar('plugid');
2727 $aOptions = array();
2730 $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";
2731 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
2732 $resource = sql_query($query);
2734 while ( $o = sql_fetch_object($resource) )
2736 array_push($aOIDs, $o->oid);
2737 $aOptions[$o->oid] = array(
2740 'value' => $o->odef,
2741 'name' => $o->oname,
2742 'description' => $o->odesc,
2743 'type' => $o->otype,
2744 'typeinfo' => $o->oextra,
2749 // fill out actual values
2750 if ( count($aOIDs) > 0 )
2752 $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
2753 $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
2755 $result = sql_query($query);
2757 while ( $o = sql_fetch_object($result) )
2759 $aOptions[$o->oid]['value'] = $o->ovalue;
2765 'PrePluginOptionsEdit',
2767 'context' => 'global',
2769 'options' => &$aOptions
2773 $template['content'] = 'plugoptionlist';
2774 $amount = Showlist($aOptions, 'table', $template, $templateName);
2777 echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
2783 * AdminActions::parse_editskin()
2784 * Parse skinvar editskin
2786 * @param string $type type of skin
2789 public function parse_editskin($type = 'id')
2791 $skinid = intRequestVar('skinid');
2792 $skin = new SKIN($skinid);
2796 echo intRequestVar('skinid');
2799 echo Entity::hsc($skin->getName());
2802 echo Entity::hsc($skin->getDescription());
2805 echo Entity::hsc($skin->getContentType());
2808 echo Entity::hsc($skin->getIncludePrefix());
2811 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2819 * AdminActions::parse_editskintype()
2820 * Parse skinvar editskintype
2822 * @param string $type name of type for skin type
2825 public function parse_editskintype($type = 'id')
2827 global $CONF, $manager, $member;
2828 $skinid = intRequestVar('skinid');
2829 $skin = new SKIN($skinid);
2830 $fNames = SKIN::getFriendlyNames('Actions');
2831 $sType = strtolower(trim(requestVar('type')));
2836 echo intRequestVar('skinid');
2839 echo Entity::hsc($skin->getName());
2842 echo Entity::hsc($skin->getDescription());
2845 echo Entity::hsc($skin->getContentType());
2848 echo Entity::hsc($skin->getContent($sType));
2851 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2852 echo Entity::hsc($skinType);
2855 echo Entity::hsc($sType);
2858 echo Entity::hsc($skin->getIncludePrefix());
2861 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2862 echo Entity::hsc($incMode);
2871 * AdminActions::parse_edittemplateinfo()
2872 * Parse skinvar edittemplateinfo
2874 * @param string $type name of type for skin
2875 * @param string $description description for skin
2876 * @param string $name name of skin
2877 * @param string $help
2878 * @param string $tabindex index value for tabindex attribute of input element
2879 * @param string $big
2880 * @param string $tplt name of template
2882 public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2885 $templateid = intRequestVar('templateid');
2886 $templatename = TEMPLATE::getNameFromId($templateid);
2887 $templatedescription = TEMPLATE::getDesc($templateid);
2888 $template =& $manager->getTemplate($templatename);
2892 echo intval($templateid);
2895 echo Entity::hsc($templatename);
2898 echo Entity::hsc($templatedescription);
2900 case 'extratemplate':
2902 $pluginfields = array();
2904 'TemplateExtraFields',
2906 'fields' => &$pluginfields
2912 $tmplt = Template::read($description);
2914 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2916 $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2920 $base = "</tr><tr>\n"
2921 . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2923 foreach ( $pluginfields as $pfkey => $pfvalue )
2926 'explugtplname' => Entity::hsc($pfkey)
2928 echo TEMPLATE::fill($base, $data);
2929 foreach ( $pfvalue as $pffield => $pfdesc )
2931 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2936 $desc = defined($description) ? constant($description) : $description;
2937 $name = defined($name) ? constant($name) : $name;
2938 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2945 * AdminActions::parse_eventformextra()
2946 * Parse skinvar eventformextra
2948 * @param string $type name of type for event form extra
2951 public function parse_eventformextra($type = 'activation')
2957 $key = requestVar('ackey');
2960 Admin::error(_ERROR_ACTIVATE);
2962 $info = MEMBER::getActivationInfo($key);
2965 Admin::error(_ERROR_ACTIVATE);
2967 $mem = MEMBER::createFromId($info->vmember);
2970 Admin::error(_ERROR_ACTIVATE);
2973 'type' => 'activation',
2977 case 'membermailform-notloggedin':
2979 'type' => 'membermailform-notloggedin',
2983 $manager->notify('FormExtra', $data);
2988 * AdminActions::parse_extrahead()
2989 * Parse skinvar extrahead
2991 public function parse_extrahead()
2994 $extrahead = Admin::extrahead;
2998 'extrahead' => &$extrahead,
2999 'action' => Admin::action
3007 * AdminActions::parse_getblogsetting()
3008 * Parse skinvar getblogsetting
3010 public function parse_getblogsetting($which)
3018 elseif ( $bid = intRequestVar('blogid') )
3021 $b = $manager->getBlog($bid);
3031 return Entity::hsc($b->getID());
3034 return Entity::hsc($b->getURL());
3037 return Entity::hsc($b->getName());
3040 return Entity::hsc($b->getDescription());
3043 return Entity::hsc($b->getShortName());
3045 case 'notifyaddress':
3046 return Entity::hsc($b->getNotifyAddress());
3049 return Entity::hsc($b->getMaxComments());
3052 return Entity::hsc($b->getUpdateFile());
3055 return Entity::hsc($b->getTimeOffset());
3062 * AdminActions::parse_geteditpluginfo()
3063 * Parse skinvar geteditpluginfo
3065 * @param string $type name of setting for edit plugin info
3068 public function parse_geteditpluginfo($type)
3070 $pid = intRequestVar('plugid');
3077 return Entity::hsc(getPluginNameFromPid($pid));
3084 * AdminActions::parse_getmember()
3085 * Parse skinvar getmember
3086 * (includes a member info thingie)
3088 * @param string $what name of setting for member
3091 public function parse_getmember($what)
3093 global $memberinfo, $member;
3094 // 1. only allow the member-details-page specific variables on member pages
3095 if ( $this->skintype == 'member' )
3100 return Entity::hsc($memberinfo->getDisplayName());
3103 return Entity::hsc($memberinfo->getRealName());
3106 return Entity::hsc($memberinfo->getNotes());
3109 return Entity::hsc($memberinfo->getURL());
3112 return Entity::hsc($memberinfo->getEmail());
3115 return Entity::hsc($memberinfo->getID());
3119 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3120 if ( $member->isLoggedIn() )
3125 return $member->getDisplayName();
3127 case 'yourrealname':
3128 return $member->getRealName();
3131 return $member->getNotes();
3134 return $member->getURL();
3137 return $member->getEmail();
3140 return $member->getID();
3148 * AdminActions::parse_headmessage()
3149 * Parse skinvar headmessage
3154 public function parse_headmessage()
3156 if ( !empty(Admin::$headMess) )
3158 echo '<p>' . _MESSAGE . ': ' . Entity::hsc(Admin::$headMess) . "</p>\n";
3164 * AdminActions::parse_helplink()
3165 * Parse skinvar helplink
3167 * @param string $topic name of topic for help
3170 public function parse_helplink($topic = '')
3172 if ( empty($topic) )
3181 * AdminActions::parse_helpplugname()
3182 * Parse skinvar helpplugname
3187 public function parse_helpplugname()
3189 $plugid = intGetVar('plugid');
3190 Entity::hsc(getPluginNameFromPid($plugid));
3195 * AdminActions::parse_ilistaddnew()
3196 * Parse skinvar ilistaddnew
3201 public function parse_ilistaddnew()
3203 $blogid = intRequestVar('blogid');
3204 if ( intPostVar('start') == 0 )
3206 echo '<p><a href="index.php?action=createitem&blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";
3212 * AdminActions::parse_importskininfo()
3213 * Parse skinvar importskininfo
3215 * @param string $type name of information for imported skin
3218 public function parse_importskininfo($type)
3223 echo Entity::hsc(requestVar('skininfo'));
3226 $dataArr = requestArray('skinnames');
3227 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3230 $dataArr = requestArray('tpltnames');
3231 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3234 $dataArr = requestArray('skinclashes');
3235 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3238 $dataArr = requestArray('tpltclashes');
3239 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3242 echo Entity::hsc(requestVar('skinfile'));
3245 echo Entity::hsc(requestVar('mode'));
3252 * AdminActions::parse_inputyesno()
3253 * Parse skinvar inputyesno
3255 * @param string $name
3256 * @param string $checkedval
3257 * @param string $tabindex
3258 * @param string $value1
3259 * @param string $value2
3260 * @param string $yesval
3261 * @param string $noval
3262 * @param string $isAdmin
3263 * @param string $templateName
3266 public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
3268 self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
3273 * AdminActions::parse_insertpluginfo()
3274 * Parse templatevar insertpluginfo
3276 public function parse_insertpluginfo($type)
3278 $option = Admin::$aOptions;
3282 return $option['pid'];
3285 return Entity::hsc($option['pfile']);
3292 * AdminActions::parse_insertpluginoptions()
3293 * Parse skinvar insertpluginoptions
3295 * @param string $templateName name of template
3298 public function parse_insertpluginoptions($templateName = '')
3300 $options = Admin::$aOptions;
3301 $template = array();
3302 $templats = array();
3304 if ( $templateName )
3306 $templates = Template::read($templateName);
3308 if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )
3310 $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
3314 $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";
3316 if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )
3318 $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
3322 $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";
3327 foreach ( $options as $option )
3329 $handler = new Actions($this->skintype, $template, $option);
3330 $parser = new PARSER(Actions::getDefinedActions(), $handler);
3332 if ( $prevPid != $option['pid'] )
3334 $prevPid = $option['pid'];
3335 $parser->parse($template['title']);
3337 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3338 if ( @$meta['access'] != 'hidden' )
3340 $parsed = $parser->parse($template['body']);
3347 * AdminActions::parse_insplugoptcontent()
3348 * Parse skinvar insplugoptcontent
3353 public function parse_insplugoptcontent()
3355 $option = Admin::$aOption;
3357 $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3358 if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')
3361 listplug_plugOptionRow($option);
3368 * AdminActions::parse_iprangeinput()
3369 * Parse skinvar iprangeinput
3374 public function parse_iprangeinput()
3376 if ( requestVar('ip') )
3378 $iprangeVal = Entity::hsc(requestVar('ip'));
3379 echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";
3380 echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";
3381 echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
3382 echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
3383 echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";
3387 echo '<input name="iprange" value="custom" type="hidden" />' . "\n";
3388 echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";
3394 * AdminActions::parse_itemnavlist()
3395 * Parse skinvar itemnavlist
3400 public function parse_itemnavlist()
3402 global $CONF, $manager, $member;
3403 if ( $this->skintype == 'itemlist' )
3405 $blogid = intRequestVar('blogid');
3406 $blog =& $manager->getBlog($blogid);
3408 if ( postVar('start') )
3410 $start = intPostVar('start');
3417 // amount of items to show
3418 if ( postVar('amount') )
3420 $amount = intPostVar('amount');
3424 $amount = intval($CONF['DefaultListSize']);
3430 $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
3431 . " FROM %s, %s, %s"
3432 . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid;";
3434 $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
3436 if ( $this->skintype == 'itemlist' )
3438 $query .= 'and iblog = ' . $blogid;
3439 $template['now'] = $blog->getCorrectTime(time());
3441 // non-blog-admins can only edit/delete their own items
3442 if ( !$member->blogAdminRights($blogid) )
3444 $query .= ' and iauthor = ' . $member->getID();
3447 elseif ( $this->skintype == 'browseownitems' )
3449 $query .= 'and iauthor = ' . $member->getID();
3451 $template['now'] = time();
3454 // search through items
3455 $search = postVar('search');
3457 if ( !empty($search) )
3459 $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
3460 . ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
3461 . ' OR (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
3463 $query .= ' ORDER BY itime DESC'
3464 . " LIMIT {$start},{$amount}";
3466 $template['content'] = 'itemlist';
3468 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
3469 $navList->showBatchList('item', $query, 'table', $template);
3474 * AdminActions::parse_jstoolbaroptions()
3475 * Parse skinvar jstoolbaroptions
3480 public function parse_jstoolbaroptions()
3484 _SETTINGS_JSTOOLBAR_NONE,
3485 _SETTINGS_JSTOOLBAR_SIMPLE,
3486 _SETTINGS_JSTOOLBAR_FULL
3489 foreach ( $options as $option )
3491 $text = "<option value=\"%d\"%s>%s</option>\n";
3492 $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';
3493 echo sprintf($text, $i, $extra, $option);
3500 * AdminActions::parse_localeselectoptions()
3501 * Parse skinvar localeselectoptions
3506 public function parse_localeselectoptions()
3508 $locales = i18n::get_available_locale_list();
3509 $memid = intRequestVar('memberid');
3512 $mem = MEMBER::createFromID($memid);
3513 if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
3515 echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3519 echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3524 if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
3526 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
3529 foreach ( $locales as $locale )
3533 if ( $locale == $mem->getLocale() )
3535 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3539 echo "<option value=\"{$locale}\">{$locale}</option>\n";
3544 if ( $locale == i18n::get_current_locale() )
3546 echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3550 echo "<option value=\"{$locale}\">{$locale}</option>\n";
3558 * AdminActions::parse_listplugplugoptionrow()
3559 * Parse templatevar listplugplugoptionrow
3561 * @param string $templateName name of template
3564 public function parse_listplugplugoptionrow($templateName = '')
3566 echo listplug_plugOptionRow(Admin::$aOptions, $templateName);
3571 * AdminActions::parse_mediadirwarning()
3572 * Parse skinvar mediadirwarning
3577 public function parse_mediadirwarning()
3580 if ( !is_dir($DIR_MEDIA) )
3582 echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";
3584 if ( !is_readable($DIR_MEDIA) )
3586 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";
3588 if ( !is_writeable($DIR_MEDIA) )
3590 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";
3596 * AdminActions::parse_movedistselect()
3597 * Parse skinvar movedistselect
3599 public function parse_movedistselect()
3601 $actionType = requestVar('action');
3602 switch ( $actionType )
3605 Admin::selectBlogCategory('destcatid');
3607 case 'batchcategory':
3608 Admin::selectBlog('destblogid');
3611 if ( $this->skintype == 'itemmove' )
3613 $query = "SELECT icat as result FROM %s WHERE inumber=%d;";
3614 $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
3615 $catid = quickQuery(sprintf($query, intRequestVar('itemid')));
3616 Admin::selectBlogCategory('catid', $catid, 10, 1);
3624 * AdminActions::parse_moveitemid()
3625 * Parse skinvar moveitemid
3630 public function parse_moveitemid()
3632 echo intRequestVar('itemid');
3637 * AdminActions::parse_newestcompare()
3638 * Parse skinvar newestcompare
3643 public function parse_newestcompare()
3646 $newestVersion = getLatestVersion();
3647 $newestCompare = str_replace('/', '.', $newestVersion);
3648 $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
3649 if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
3651 echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
3652 echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
3658 * AdminActions::parse_newmemberselect()
3659 * Parse skinvar newmemberselect
3661 * @param string $templateName name of template to use
3664 public function parse_newmemberselect($templateName = '')
3666 $blogid = intRequestVar('blogid');
3668 $query = "SELECT tmember FROM %s WHERE tblog=%d;";
3669 $query = sprintf($query, sql_table('team'), (integer) $blogid);
3670 $res = sql_query($query);
3673 while ( $tmember = sql_fetch_object($res) )
3675 $tmem[] = intval($tmember->tmember);
3678 $query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
3679 $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
3681 $template['name'] = 'memberid';
3682 $template['tabindex'] = 10000;
3683 Showlist($query, 'select', $template, $templateName);
3688 * AdminActions::parse_newpluginlist()
3689 * Parse skinvar newpluginlist
3694 public function parse_newpluginlist()
3696 $candidates = $this->newPlugCandidates;
3697 foreach ( $candidates as $name )
3699 echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";
3705 * AdminActions::parse_outputspecialdirs()
3706 * Parse skinvar outputspecialdirs
3708 * @param string $type type of setting for directory
3711 public function parse_outputspecialdirs($type)
3716 global $DIR_NUCLEUS;
3717 echo Entity::hsc($DIR_NUCLEUS);
3721 echo Entity::hsc($DIR_MEDIA);
3728 * AdminActions::parse_passrequestvars()
3729 * Parse skinvar passrequestvars
3734 public function parse_passrequestvars()
3736 $oldaction = postVar('oldaction');
3737 if ( ($oldaction != 'logout')
3738 && ($oldaction != 'login')
3740 && !postVar('customaction') )
3748 * AdminActions::parse_pluginextras()
3749 * Parse skinvar pluginextras
3751 * @param string $type type of plugin context
3754 public function parse_pluginextras($type = 'global')
3760 $id = intRequestVar('memberid');
3761 $mem = MEMBER::createFromID($id);
3763 'MemberSettingsFormExtras',
3770 $id = intRequestVar('blogid');
3771 $blg = $manager->getBlog($id);
3773 'BlogSettingsFormExtras',
3781 'GeneralSettingsFormExtras',
3791 * AdminActions::parse_pluginhelp()
3792 * Parse skinvar pluginhelp
3797 public function parse_pluginhelp()
3799 global $manager, $DIR_PLUGINS;
3800 $plugid = intGetVar('plugid');
3801 $plugName = getPluginNameFromPid($plugid);
3802 $plug =& $manager->getPlugin($plugName);
3804 if ( $plug->supportsFeature('HelpPage') > 0 )
3806 $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
3807 if ( @file_exists($helpfile . 'php') )
3809 @include($helpfile . 'php');
3812 elseif ( @file_exists($helpfile . 'html') )
3814 @include($helpfile . 'html');
3818 echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";
3819 echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";
3824 * AdminActions::parse_pluginlistlist()
3825 * Parse skinvar pluginlistlist
3827 * @param string $templateName name of template to use
3830 public function parse_pluginlistlist($templateName = '')
3832 $query = "SELECT * FROM %s ORDER BY porder ASC;";
3833 $query = sprintf($query, sql_table('plugin'));
3834 $template['content'] = 'pluginlist';
3835 $template['tabindex'] = 10;
3836 Showlist($query, 'table', $template, $templateName);
3841 * AdminActions::parse_pluginoptions()
3842 * Parse skinvar pluginoptions
3844 * @param string $type type of plugin option
3847 public function parse_pluginoptions($type = 'global')
3852 $id = intRequestVar('memberid');
3855 $id = intRequestVar('blogid');
3858 $id = intRequestVar('catid');
3861 Admin::insertPluginOptions($type, $id);
3866 * AdminActions::parse_qmenuaddselect()
3867 * Parse skinvar qmanuaddselect
3869 * @param string $templateName name of template to use
3872 public function parse_qmenuaddselect($templateName = '')
3875 $showAll = requestVar('showall');
3876 if ( $member->isAdmin() && ($showAll == 'yes') )
3878 // Super-Admins have access to all blogs! (no add item support though)
3879 $query = 'SELECT bnumber as value, bname as text'
3880 . ' FROM ' . sql_table('blog')
3881 . ' ORDER BY bname';
3885 $query = 'SELECT bnumber as value, bname as text'
3886 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
3887 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
3888 . ' ORDER BY bname';
3890 $template['name'] = 'blogid';
3891 $template['tabindex'] = 15000;
3892 $template['extra'] = _QMENU_ADD_SELECT;
3893 $template['selected'] = -1;
3894 $template['shorten'] = 10;
3895 $template['shortenel'] = '';
3896 $template['javascript'] = 'onchange="return form.submit()"';
3897 Showlist($query, 'select', $template, $templateName);
3902 * AdminActions::parse_quickmenu()
3903 * Parse skinvar quickmenu
3905 * @param string $templateName name of template to use
3908 public function parse_quickmenu($templateName = '')
3911 $templates = array();
3912 $template = array();
3913 if ( !empty($templateName) )
3915 $templates = Template::read($templateName);
3917 $pluginExtras = array();
3921 'options' => &$pluginExtras
3924 if ( count($pluginExtras) > 0 )
3926 if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )
3928 $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
3932 $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';
3934 $handler = new Actions($this->skintype, $template, $this->objAdmin);
3935 $parser = new PARSER(Actions::getDefinedActions(), $handler);
3936 $parser->parse($template['title']);
3938 if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )
3940 $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
3944 $template['head'] = '<ul>';
3947 echo $template['head'];
3949 if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )
3951 $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
3955 $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';
3958 foreach ( $pluginExtras as $aInfo )
3961 'plugadminurl' => Entity::hsc($aInfo['url']),
3962 'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
3963 'plugadmintitle' => Entity::hsc($aInfo['title']),
3965 echo TEMPLATE::fill($template['body'], $data);
3967 if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
3969 $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
3973 $template['foot'] = '</ul>';
3975 echo $template['foot'];
3981 * AdminActions::parse_requestblogid()
3982 * Parse skinvar requestblogid
3987 public function parse_requestblogid()
3989 echo intRequestVar('blogid');
3994 * AdminActions::parse_requestiprange()
3995 * Parse skinvar requestiprange
4000 public function parse_requestiprange()
4002 if ( requestVar('iprange') )
4004 echo Entity::hsc(requestVar('iprange'));
4006 elseif ( requestVar('ip') )
4008 echo Entity::hsc(requestVar('ip'));
4014 * AdminActions::parse_selectlocaladminskinfiles()
4015 * Parse skinvar selectlocaladminskinfiles
4020 public function parse_selectlocaladminskinfiles()
4022 global $DIR_ADMINSKINS, $manager;
4023 $candidates = SkinImport::searchForCandidates($DIR_ADMINSKINS);
4024 foreach ( $candidates as $skinname => $skinfile )
4026 $html = Entit::hsc($skinfile);
4027 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4033 * AdminActions::parse_selectlocalskinfiles()
4034 * Parse skinvar selectlocalskinfiles
4039 public function parse_selectlocalskinfiles()
4042 $candidates = SkinImport::searchForCandidates($DIR_SKINS);
4043 foreach ( $candidates as $skinname => $skinfile )
4045 $html = Entity::hsc($skinfile);
4046 echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4052 * AdminActions::parse_skineditallowedlist()
4053 * Parse skinvar skineditallowedlist
4055 * @param string $type type of skin
4056 * @param string $templateName name of template
4059 public function parse_skineditallowedlist($type, $templateName = '')
4064 $query = "SELECT bshortname, bname FROM %s";
4066 'content' => 'shortblognames'
4068 $query = sprintf($query, sql_table('blog'));
4069 Showlist($query, 'table', $show, $templateName);
4072 $query = "SELECT tdname as name, tddesc as description FROM %s";
4074 'content' => 'shortnames'
4076 $query = sprintf($query, sql_table('template_desc'));
4077 Showlist($query, 'table', $show, $templateName);
4084 * AdminActions::parse_skinielist()
4085 * Parse skinvar skinielist
4087 * @param string $type type of skin
4088 * @param string $templateName name of template to use
4091 public function parse_skinielist($type, $templateName = '')
4093 $templates = array();
4094 if ( $templateName )
4096 $templates = Template::read($templateName);
4098 if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
4100 $template = $templates['SKINIE_EXPORT_LIST'];
4104 $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
4105 . "<td><%expdesc%></td>\n"
4111 $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
4112 while ( $skinObj = sql_fetch_object($res) )
4115 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
4116 'expid' => 'skinexp' . $skinObj->sdnumber,
4117 'expname' => Entity::hsc($skinObj->sdname),
4118 'expdesc' => Entity::hsc($skinObj->sddesc),
4120 echo TEMPLATE::fill($template, $data);
4124 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
4125 while ($templateObj = sql_fetch_object($res)) {
4127 'typeid' => 'template[' . $templateObj->tdnumber . ']',
4128 'expid' => 'templateexp' . $templateObj->tdnumber,
4129 'expname' => Entity::hsc($templateObj->tdname),
4130 'expdesc' => Entity::hsc($templateObj->tddesc),
4132 echo TEMPLATE::fill($template, $data);
4140 * AdminActions::parse_skinoverview()
4141 * Parse skinvar skinoverview
4143 * @param string $templateName name of template to use
4146 public function parse_skinoverview($templateName = '')
4148 $query = "SELECT * FROM %s ORDER BY sdname";
4149 $query = sprintf($query, sql_table('skin_desc'));
4151 $template['content'] = 'skinlist';
4152 $template['tabindex'] = 10;
4153 $template['friendly_names'] = Skin::getFriendlyNames('Actions');
4155 Showlist($query, 'table', $template, $templateName);
4160 * AdminActions::parse_skintypehelp()
4161 * Check editing skintypehelp
4166 public function parse_skintypehelp()
4168 $nowSkinType = strtolower(trim(requestVar('type')));
4169 $regularType = array(
4180 if ( in_array($nowSkinType, $regularType) )
4182 help('skinpart' . $nowSkinType);
4186 help('skinpartspecial');
4192 * AdminActions::parse_specialskinlist()
4193 * Parse skinvar specialskinlist
4195 * @param string $templateName name of template to use
4198 public function parse_specialskinlist($templateName = '')
4200 $templates = array();
4201 if ( $templateName )
4203 $templates = Template::read($templateName);
4215 $skinid = intRequestVar('skinid');
4216 $query = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
4217 $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
4219 $res = sql_query($query);
4220 if ( $res && sql_num_rows($res) > 0 )
4223 if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
4225 $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
4229 $template['head'] = "<ul>\n";
4231 echo TEMPLATE::fill($template['head'], $data);
4232 if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )
4234 $template['body'] = $templates['SPECIALSKINLIST_BODY'];
4238 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&skinid=<%skinid%>'
4239 . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
4240 . 'action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
4243 while ( $row = sql_fetch_assoc($res) )
4246 'tabindex' => $tabstart++,
4247 'skinid' => $skinid,
4248 'skintype' => Entity::hsc(strtolower($row['stype']))
4250 echo TEMPLATE::fill($template['body'], $data);
4253 if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
4255 $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
4259 $template['foot'] = "</ul>\n";
4261 echo TEMPLATE::fill($template['foot'], $data);
4267 * AdminActions::parse_sprinttext()
4270 * @param string $which
4271 * @param string $val
4274 public function parse_sprinttext($which, $val)
4276 if ( !defined($which) )
4282 $base = constant($which);
4285 if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
4287 if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
4289 $met = 'parse_' . $matchies[0];
4293 $arg = trim($args[0], '()');
4294 $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
4297 if ( method_exists($this, $met) )
4299 $value = call_user_func(array(&$this, $met), $arg);
4303 if ( !isset($value) || empty($value) )
4307 echo sprintf($base, $value);
4312 * AdminActions::parse_systemsettings()
4313 * Parse skinvar systemsettings
4315 * @param string $type type of settings for system
4316 * @param string $templateName name of template to use
4319 public function parse_systemsettings($type = 'phpinfo', $templateName = '')
4321 global $member, $CONF, $nucleus;
4323 $member->isAdmin() or Admin::disallow();
4325 $enable = _ADMIN_SYSTEMOVERVIEW_ENABLE;
4326 $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
4333 case 'sqlserverinfo':
4334 echo sql_get_server_info();
4336 case 'sqlclientinfo':
4337 echo sql_get_client_info();
4339 case 'magicquotesgpc':
4340 echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
4342 case 'magicquotesruntime':
4343 echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';
4345 case 'registerglobals':
4346 echo ini_get('register_globals') ? 'On' : 'Off';
4349 $templates = array();
4350 if ( $templateName )
4352 $templates = Template::read($templateName);
4354 if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )
4356 $template = $templates['SYSTEMINFO_GDSETTINGS'];
4360 $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";
4363 $gdinfo = gd_info();
4365 foreach ( $gdinfo as $key => $value )
4367 if ( is_bool($value) )
4369 $value = $value ? $enable : $disable;
4373 $value = Entity::hsc($value);
4379 echo TEMPLATE::fill($template, $data);
4384 phpinfo(INFO_MODULES);
4385 $im = ob_get_contents();
4387 echo (strstr($im, 'mod_rewrite') != '') ? $enable : $disable;
4389 case 'nucleusversion':
4390 echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
4392 case 'nucleuspatchlevel':
4393 echo getNucleusPatchLevel();
4399 echo $CONF['ItemURL'];
4401 case 'alertonheaderssent':
4402 echo $CONF['alertOnHeadersSent'] ? $enable : $disable;
4404 case 'nucleuscodename':
4405 if ( $nucleus['codename'] != '' )
4407 echo ' "' . $nucleus['codename'] . '"';
4410 case 'versioncheckurl':
4411 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4418 * AdminActions::parse_templateoverview()
4419 * Parse skinvar templateoverview
4421 * @param string $templateName name of template to use
4424 public function parse_templateoverview($templateName = '')
4426 $query = "SELECT * FROM %s ORDER BY tdname";
4427 $query = sprintf($query, sql_table('template_desc'));
4428 $template['content'] = 'templatelist';
4429 $template['tabindex'] = 10;
4430 Showlist($query, 'table', $template, $templateName);
4435 * AdminActions::parse_text()
4438 * FIXME: is this really needed?
4440 * @param string $which constant vallue
4443 public function parse_text($which)
4445 if ( defined($which) )
4447 echo constant($which);
4453 * AdminActions::parse_ticket()
4459 public function parse_ticket()
4462 $manager->addTicketHidden();
4467 * AdminActions::parse_versioncheckurl()
4468 * Parse skinvar versioncheckurl
4473 public function parse_versioncheckurl()
4475 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4480 * AdminActions::parse_yrbloglist()
4481 * Parse skinvar yrbloglist
4483 * @param string $templateName name of template to use
4486 public function parse_yrbloglist($templateName = '')
4489 $showAll = requestVar('showall');
4491 if ( $member->isAdmin() && ($showAll == 'yes') )
4493 // Super-Admins have access to all blogs! (no add item support though)
4494 $query = "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
4496 . " ORDER BY bnumber";
4497 $query = sprintf($query, sql_table('blog'));
4501 $query = "SELECT bnumber, bname, tadmin, burl, bshortname"
4503 . " WHERE tblog=bnumber and tmember=%d"
4504 . " ORDER BY bnumber";
4505 $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
4508 $template['content'] = 'bloglist';
4509 $template['superadmin'] = $member->isAdmin();
4511 $amount = Showlist($query, 'table', $template, $templateName);
4513 if ( ($showAll != 'yes') && ($member->isAdmin()) )
4515 $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
4517 $total = quickQuery($query);
4518 if ( $total > $amount )
4520 echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
4526 echo _OVERVIEW_NOBLOGS;
4528 elseif( $amount != 0 )
4530 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
4532 $query = "SELECT ititle, inumber, bshortname"
4534 . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1';
4535 $query = sprintf($query. sql_table('item'), sql_table('blog'), (integer) $member->getID());
4537 $template['content'] = 'draftlist';
4539 $amountdrafts = Showlist($query, 'table', $template, $templateName);
4540 if ( $amountdrafts == 0 )
4542 echo _OVERVIEW_NODRAFTS;
4549 * AdminActions::checkCondition()
4550 * Checks conditions for if statements
4552 * @param string $field type of <%if%>
4553 * @param string $name property of field
4554 * @param string $value value of property
4555 * @return boolean condition
4557 protected function checkCondition($field, $name='', $value = '')
4559 global $CONF, $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
4570 $blog =& $manager->getBlog($blogid);
4574 $blogid = getBlogIDFromCatID($catid);
4576 $blog =& $manager->getBlog($blogid);
4578 elseif ( intRequestVar('catid') )
4580 $catid = intRequestVar('catid');
4581 $blogid = getBlogIDFromCatID($catid);
4583 $blog =& $manager->getBlog($blogid);
4590 $condition = ($blog && $this->ifCategory($name, $value));
4593 $condition = ($blog && ($blog->getSetting($name) == $value));
4596 $condition = $member->isLoggedIn();
4599 $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
4602 $condition = $member->isLoggedIn() && $this->ifAdmin($name);
4605 $condition = $member->isLoggedIn() && $member->isAdmin();
4607 case 'allowloginedit':
4608 $condition = $member->isLoggedIn() && ($CONF['AllowLoginEdit'] || $member->isAdmin());
4611 $condition = ($itemidnext != '');
4614 $condition = ($itemidprev != '');
4616 case 'archiveprevexists':
4617 $condition = ($archiveprevexists == true);
4619 case 'archivenextexists':
4620 $condition = ($archivenextexists == true);
4623 $condition = (($name == $this->skintype) || ($name == requestVar('action')));
4626 $condition = $this->ifHasPlugin($name, $value);
4629 $condition = ($this->objAdmin->action == $name);
4631 case 'adminoldaction':
4632 $condition = ($this->objAdmin->action == $name);
4634 case 'addresschange':
4635 $condition = ($this->ifAddresscange());
4637 case 'bechangepass':
4638 $condition = ($this->beChangePassword());
4640 case 'skincandidates':
4641 $condition = ($this->ifSkincandidates());
4644 $condition = requestVar('nameclashes');
4646 case 'existsnewplugin':
4647 $condition = ($this->existsNewPlugin());
4650 $condition = (boolean) ($member->getAutosave() == $value);
4653 $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
4660 * Actions::_ifHasPlugin()
4661 * hasplugin,PlugName
4662 * -> checks if plugin exists
4663 * hasplugin,PlugName,OptionName
4664 * -> checks if the option OptionName from plugin PlugName is not set to 'no'
4665 * hasplugin,PlugName,OptionName=value
4666 * -> checks if the option OptionName from plugin PlugName is set to value
4668 * @param string $name name of plugin
4669 * @param string $value
4672 private function ifHasPlugin($name, $value)
4676 // (pluginInstalled method won't write a message in the actionlog on failure)
4677 if ( $manager->pluginInstalled("NP_{$name}") )
4679 $plugin =& $manager->getPlugin("NP_{$name}");
4680 if ( $plugin != NULL )
4688 list($name2, $value2) = preg_split('#=#', $value, 2);
4689 if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
4693 else if ( $plugin->getOption($name2) == $value2 )
4704 * Actions::beChangePassword()
4709 private function beChangePassword()
4711 return intRequestVar('bNeedsPasswordChange');
4715 * Actions::ifSkincandidates()
4716 * Checks if a plugin exists and call its doIf function
4721 private function ifSkincandidates()
4724 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
4725 return (count($candidates) > 0);
4729 * Actions::ifPlugin()
4730 * Checks if a plugin exists and call its doIf function
4732 private function ifPlugin($name, $key = '', $value = '')
4736 $plugin =& $manager->getPlugin("NP_{$name}");
4742 $params = func_get_args();
4743 array_shift($params);
4745 return call_user_func_array(array(&$plugin, 'doIf'), $params);
4749 * Different checks for a category
4751 private function ifCategory($name = '', $value='')
4753 global $blog, $catid;
4755 // when no parameter is defined, just check if a category is selected
4756 if (($name != 'catname' && $name != 'catid') || ($value == ''))
4758 return $blog->isValidCategory($catid);
4761 // check category name
4762 if ( $name == 'catname' )
4764 $value = $blog->getCategoryIdFromName($value);
4765 if ($value == $catid)
4767 return $blog->isValidCategory($catid);
4771 // check category id
4772 if (($name == 'catid') && ($value == $catid))
4774 return $blog->isValidCategory($catid);
4781 * Checks if a member is on the team of a blog and return his rights
4783 private function ifOnTeam($blogName = '')
4785 global $blog, $member, $manager;
4787 // when no blog found
4788 if ( ($blogName == '') && !is_object($blog) )
4793 // explicit blog selection
4794 if ($blogName != '')
4796 $blogid = getBlogIDFromName($blogName);
4799 if (($blogName == '') || !$manager->existsBlogID($blogid))
4802 $blogid = $blog->getID();
4804 return $member->teamRights($blogid);
4808 * Checks if a member is admin of a blog
4810 private function ifAdmin($blogName = '')
4812 global $blog, $member, $manager;
4814 // when no blog found
4815 if (($blogName == '') && (!is_object($blog)))
4820 // explicit blog selection
4821 if ($blogName != '')
4823 $blogid = getBlogIDFromName($blogName);
4826 if (($blogName == '') || !$manager->existsBlogID($blogid))
4829 $blogid = $blog->getID();
4832 return $member->isBlogAdmin($blogid);
4836 * Check e-Mail address is changed
4838 private function ifAddresscange()
4840 $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");
4845 $info = MEMBER::getActivationInfo($key);
4850 $mem = MEMBER::createFromId($info->vmember);
4855 if ( $info->vtype == 'addresschange' )
4863 * AdminActions::customHelp()
4864 * shows a link to custom help file
4866 * @param integer $id
4867 * @param string $tplName
4868 * @param string $url
4869 * @param string $iconURL
4870 * @param string $alt
4871 * @param string $title
4875 private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4877 echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
4881 * AdminActions::customHelpHtml()
4883 * @param integer $id
4884 * @param string $tplName
4885 * @param string $url
4886 * @param string $iconURL
4887 * @param string $alt
4888 * @param string $title
4889 * @param string $onclick
4890 * @return string anchor element with help uri
4892 private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4894 $templates = array();
4897 $templates = Template::read($tplName);
4899 if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
4901 $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
4905 $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';
4908 if ( empty($iconURL) )
4911 $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
4913 if ( function_exists('getimagesize') )
4915 $size = getimagesize($iconURL);
4916 $width = 'width="' . $size[0] . '" ';
4917 $height = 'height="' . $size[1] . '" ';
4920 'iconurl' => $iconURL,
4922 'height' => $height,
4923 'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
4924 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
4926 $icon = TEMPLATE::fill($template, $data);
4927 $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
4928 return $help . $icon;
4932 * AdminActions::input_yesno
4935 * @param $checkedval
4942 * @param $templateName
4945 private function input_yesno($name,
4956 $templates = array();
4957 if ( $templateName )
4959 $templates = Template::read($templateName);
4962 if ( $name == 'admin' )
4964 if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
4966 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
4970 $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
4971 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
4972 . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
4973 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
4978 if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
4980 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
4984 if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
4986 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
4989 if ( !isset($template) )
4991 $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
4992 . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
4993 . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
4994 . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
4999 $id = Entity::hsc($name);
5000 $id = str_replace('[', '-', $id);
5001 $id = str_replace(']', '-', $id);
5002 $id1 = $id . Entity::hsc($value1);
5003 $id2 = $id . Entity::hsc($value2);
5005 'name' => Entity::hsc($name),
5006 'yesval' => Entity::hsc($value1),
5007 'noval' => Entity::hsc($value2),
5010 'yesvaltext' => $yesval,
5011 'novaltext' => $noval,
5012 'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
5013 'nocheckedval' => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
5014 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
5019 return Template::fill($template, $dat);
5023 echo TEMPLATE::fill($template, $dat);