OSDN Git Service

定数名修正(nucleus/language/english.php)
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / showlist.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2009 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12 /**
13  * Functions to create lists of things inside the admin are
14  *
15  * @license http://nucleuscms.org/license.txt GNU General Public License
16  * @copyright Copyright (C) 2002-2009 The Nucleus Group
17  * @version $Id$
18  * @version $NucleusJP: showlist.php,v 1.7.2.3 2007/12/03 00:01:48 kmorimatsu Exp $
19  */
20
21
22 // can take either an array of objects, or an SQL query\r
23 function showlist($query, $type, $template) {\r
24 \r
25         if (is_array($query)) {\r
26                 if (sizeof($query) == 0)\r
27                         return 0;\r
28 \r
29                 call_user_func('listplug_' . $type, $template, 'HEAD');\r
30 \r
31                 foreach ($query as $currentObj) {\r
32                         $template['current'] = $currentObj;\r
33                         call_user_func('listplug_' . $type, $template, 'BODY');\r
34                 }\r
35 \r
36                 call_user_func('listplug_' . $type, $template, 'FOOT');\r
37 \r
38                 return sizeof($query);\r
39 \r
40         } else {\r
41                 $res = sql_query($query);\r
42 \r
43                 // don't do anything if there are no results\r
44                 $numrows = mysql_num_rows($res);\r
45                 if ($numrows == 0)\r
46                         return 0;\r
47 \r
48                 call_user_func('listplug_' . $type, $template, 'HEAD');\r
49 \r
50                 while($template['current'] = mysql_fetch_object($res))\r
51                         call_user_func('listplug_' . $type, $template, 'BODY');\r
52 \r
53                 call_user_func('listplug_' . $type, $template, 'FOOT');\r
54 \r
55                 mysql_free_result($res);\r
56 \r
57                 // return amount of results\r
58                 return $numrows;\r
59         }\r
60 }\r
61 \r
62 function listplug_select($template, $type) {\r
63         switch($type) {\r
64                 case 'HEAD':\r
65                         echo '<select name="' . ifset($template['name']) . '" tabindex="' . ifset($template['tabindex']) . '" ' . ifset($template['javascript']) . '>';\r
66 \r
67                         // add extra row if needed\r
68                         if (ifset($template['extra'])) {\r
69                                 echo '<option value="', ifset($template['extraval']), '">', $template['extra'], '</option>';\r
70                         }\r
71 \r
72                         break;\r
73                 case 'BODY':\r
74                         $current = $template['current'];\r
75 \r
76                         echo '<option value="' . htmlspecialchars($current->value) . '"';\r
77                         if ($template['selected'] == $current->value)\r
78                                 echo ' selected="selected" ';\r
79                         if (isset($template['shorten']) && $template['shorten'] > 0) {\r
80                                 echo ' title="'. htmlspecialchars($current->text).'"';\r
81                                 $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);\r
82                         }\r
83                         echo '>' . htmlspecialchars($current->text) . '</option>';\r
84                         break;\r
85                 case 'FOOT':\r
86                         echo '</select>';\r
87                         break;\r
88         }\r
89 }\r
90 \r
91 function listplug_table($template, $type) {\r
92         switch($type) {\r
93                 case 'HEAD':\r
94                         echo "<table>";\r
95                         echo "<thead><tr>";\r
96                         // print head\r
97                         call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');\r
98                         echo "</tr></thead><tbody>";\r
99                         break;\r
100                 case 'BODY':\r
101                         // print tabletype specific thingies\r
102                         echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";\r
103                         call_user_func("listplug_table_" . $template['content'] , $template,  'BODY');\r
104                         echo "</tr>";\r
105                         break;\r
106                 case 'FOOT':\r
107                         call_user_func("listplug_table_" . $template['content'] , $template,  'FOOT');\r
108                         echo "</tbody></table>";\r
109                         break;\r
110         }\r
111 }\r
112 \r
113 function listplug_table_memberlist($template, $type) {\r
114         switch($type) {\r
115                 case 'HEAD':\r
116                         echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;\r
117                         help('superadmin');\r
118                         echo "</th><th>" . _LIST_MEMBER_LOGIN;\r
119                         help('canlogin');\r
120                         echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";\r
121                         break;\r
122                 case 'BODY':\r
123                         $current = $template['current'];\r
124 \r
125                         echo '<td>';\r
126                         $id = listplug_nextBatchId();\r
127                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';\r
128                         echo '<label for="batch',$id,'">';\r
129                         echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";\r
130                         echo '</label>';\r
131                         echo '</td>';\r
132                         echo '<td>', htmlspecialchars($current->mrealname), '</td>';\r
133                         echo "<td><a href='", htmlspecialchars($current->murl), "' tabindex='", $template['tabindex'] , "'>", htmlspecialchars($current->murl), "</a></td>";\r
134                         echo '<td>', ($current->madmin ? _YES : _NO),'</td>';\r
135                         echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';\r
136                         echo "<td><a href='index.php?action=memberedit&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
137                         echo "<td><a href='index.php?action=memberdelete&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
138                         break;\r
139         }\r
140 }\r
141 \r
142 function listplug_table_teamlist($template, $type) {\r
143         global $manager;\r
144         switch($type) {\r
145                 case 'HEAD':\r
146                         echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;\r
147                         help('teamadmin');\r
148                         echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";\r
149                         break;\r
150                 case 'BODY':\r
151                         $current = $template['current'];\r
152 \r
153                         echo '<td>';\r
154                         $id = listplug_nextBatchId();\r
155                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';\r
156                         echo '<label for="batch',$id,'">';\r
157                         echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";\r
158                         echo '</label>';\r
159                         echo '</td>';\r
160                         echo '<td>', htmlspecialchars($current->mrealname), '</td>';\r
161                         echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';\r
162                         echo "<td><a href='index.php?action=teamdelete&amp;memberid=$current->tmember&amp;blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
163 \r
164                         $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);\r
165                         $url = $manager->addTicketToUrl($url);\r
166                         echo "<td><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";\r
167                         break;\r
168         }\r
169 }\r
170 \r
171 function listplug_table_pluginlist($template, $type) {\r
172         global $manager;\r
173         switch($type) {\r
174                 case 'HEAD':\r
175                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';\r
176                         echo '<th style="white-space:nowrap">'._LISTS_ACTIONS.'</th>';\r
177                         break;\r
178                 case 'BODY':\r
179                         $current = $template['current'];\r
180 \r
181                         $plug =& $manager->getPlugin($current->pfile);\r
182                         if ($plug) {\r
183                                 echo '<td>';\r
184                                         echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';\r
185                                         echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';\r
186                                         echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';\r
187                                         if ($plug->getURL())\r
188                                         echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';\r
189                                 echo '</td>';\r
190                                 echo '<td>';\r
191                                         echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());\r
192                                         if (sizeof($plug->getEventList()) > 0) {\r
193                                                 echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));\r
194                                                 // check the database to see if it is up-to-date and notice the user if not\r
195                                         }\r
196                                         if (!$plug->subscribtionListIsUptodate()) {\r
197                                                 echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';\r
198                                         }\r
199                                         if (sizeof($plug->getPluginDep()) > 0) {\r
200                                                 echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));\r
201                                         }\r
202 // <add by shizuki>\r
203                                 // check dependency require\r
204                                 $req = array();\r
205                                 $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));\r
206                                 while($o = mysql_fetch_object($res)) {\r
207                                         $preq =& $manager->getPlugin($o->pfile);\r
208                                         if ($plug) {\r
209                                                 $depList = $preq->getPluginDep();\r
210                                                 foreach ($depList as $depName) {\r
211                                                         if ($current->pfile == $depName) {\r
212                                                                 $req[] = $o->pfile;\r
213                                                         }\r
214                                                 }\r
215                                         }\r
216                                 }\r
217                                 if (count($req) > 0) {\r
218                                         echo '<h4 class="plugin_dependreq_title">' . _LIST_PLUGS_DEPREQ . "</h4>\n";\r
219                                         echo '<p class="plugin_dependreq_text">';\r
220                                         echo htmlspecialchars(implode(', ', $req), ENT_QUOTES);\r
221                                         echo "</p>\n";\r
222                                 }\r
223 // </add by shizuki>\r
224                                 echo '</td>';\r
225                         } else {\r
226                                 echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, htmlspecialchars($current->pfile, ENT_QUOTES)) . '</td>';\r
227                         }\r
228                         echo '<td>';\r
229 \r
230                                 $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';\r
231                                 $url = $manager->addTicketToUrl($baseUrl . 'pluginup');\r
232                                 echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";\r
233                                 $url = $manager->addTicketToUrl($baseUrl . 'plugindown');\r
234                                 echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";\r
235                                 echo "<br /><a href='index.php?action=plugindelete&amp;plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";\r
236                                 if ($plug && ($plug->hasAdminArea() > 0))\r
237                                         echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";\r
238                                 if ($plug && ($plug->supportsFeature('HelpPage') > 0))\r
239                                         echo "<br /><a href='index.php?action=pluginhelp&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";\r
240                                 if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)\r
241                                         echo "<br /><a href='index.php?action=pluginoptions&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";\r
242                         echo '</td>';\r
243                         break;\r
244         }\r
245 }\r
246 \r
247 function listplug_table_plugoptionlist($template, $type) {\r
248         global $manager;\r
249         switch($type) {\r
250                 case 'HEAD':\r
251                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';\r
252                         break;\r
253                 case 'BODY':\r
254                         $current = $template['current'];\r
255                         listplug_plugOptionRow($current);\r
256                         break;\r
257                 case 'FOOT':\r
258                         ?>\r
259                         <tr>\r
260                                 <th colspan="2"><?php echo _PLUGS_SAVE?></th>\r
261                         </tr><tr>\r
262                                 <td><?php echo _PLUGS_SAVE?></td>\r
263                                 <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>\r
264                         </tr>\r
265                         <?php                   break;\r
266         }\r
267 }\r
268 \r
269 function listplug_plugOptionRow($current) {\r
270         $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';\r
271         // retreive the optionmeta\r
272         $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);\r
273 \r
274         // only if it is not a hidden option write the controls to the page\r
275         if (@$meta['access'] != 'hidden') {\r
276                 echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';\r
277                 echo '<td>';\r
278                 switch($current['type']) {\r
279                         case 'yesno':\r
280                                 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');\r
281                                 break;\r
282                         case 'password':\r
283                                 echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';\r
284                                 break;\r
285                         case 'select':\r
286                                 echo '<select name="'.htmlspecialchars($varname).'">';\r
287                                 $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);\r
288                                 $aOptions = explode('|', $aOptions);\r
289                                 for ($i=0; $i<(count($aOptions)-1); $i+=2) {\r
290                                         echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';\r
291                                         if ($aOptions[$i+1] == $current['value'])\r
292                                                 echo ' selected="selected"';\r
293                                         echo '>'.htmlspecialchars($aOptions[$i]).'</option>';\r
294                                 }\r
295                                 echo '</select>';\r
296                                 break;\r
297                         case 'textarea':\r
298                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);\r
299                                 echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';\r
300                                 if (@$meta['access'] == 'readonly') {\r
301                                         echo ' readonly="readonly"';\r
302                                 }\r
303                                 echo '>',htmlspecialchars($current['value']),'</textarea>';\r
304                                 break;\r
305                         case 'text':\r
306                         default:\r
307                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);\r
308 \r
309                                 echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';\r
310                                 if (@$meta['datatype'] == 'numerical') {\r
311                                         echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';\r
312                                 }\r
313                                 if (@$meta['access'] == 'readonly') {\r
314                                         echo ' readonly="readonly"';\r
315                                 }\r
316                                 echo ' />';\r
317                 }\r
318                 echo @$current['extra'];\r
319                 echo '</td>';\r
320         }\r
321 }\r
322 \r
323 function listplug_table_itemlist($template, $type) {\r
324         $cssclass = null;\r
325 \r
326         switch($type) {\r
327                 case 'HEAD':\r
328                         echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";\r
329                         break;\r
330                 case 'BODY':\r
331                         $current = $template['current'];\r
332                         $current->itime = strtotime($current->itime);   // string -> unix timestamp\r
333 \r
334                         if ($current->idraft == 1)\r
335                                 $cssclass = "class='draft'";\r
336 \r
337                         // (can't use offset time since offsets might vary between blogs)\r
338                         if ($current->itime > $template['now'])\r
339                                 $cssclass = "class='future'";\r
340 \r
341                         echo "<td $cssclass>",_LIST_ITEM_BLOG,' ', htmlspecialchars($current->bshortname);\r
342                         echo "    <br />",_LIST_ITEM_CAT,' ', htmlspecialchars($current->cname);\r
343                         echo "    <br />",_LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname);\r
344                         echo "    <br />",_LIST_ITEM_DATE," " . date("Y-m-d",$current->itime);\r
345                         echo "<br />",_LIST_ITEM_TIME," " . date("H:i",$current->itime);\r
346                         echo "</td>";\r
347                         echo "<td $cssclass>";\r
348 \r
349                         $id = listplug_nextBatchId();\r
350 \r
351                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';\r
352                         echo '<label for="batch',$id,'">';\r
353                         echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";\r
354                         echo '</label>';\r
355                         echo "<br />";\r
356 \r
357 \r
358                         $current->ibody = strip_tags($current->ibody);\r
359                         $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));\r
360 \r
361                         $COMMENTS = new COMMENTS($current->inumber);\r
362                         echo "$current->ibody</td>";\r
363                         echo "<td  style=\"white-space:nowrap\" $cssclass>";\r
364                         echo    "<a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a>";\r
365                         // evaluate amount of comments for the item\r
366                         $camount = $COMMENTS->amountComments();\r
367                         if ($camount>0) {\r
368                                 echo    "<br /><a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>"._LISTS_COMMENTS;\r
369                                 echo '(' . $COMMENTS->amountComments() . ')'."</a>";\r
370                         }\r
371                         else {\r
372                                 echo "<br />"._TEMPLATE_CNONE;\r
373                         }\r
374                         echo    "<br /><a href='index.php?action=itemmove&amp;itemid=$current->inumber'>"._LISTS_MOVE."</a>";\r
375                         echo    "<br /><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a>";\r
376                         echo "</td>";\r
377                         break;\r
378         }\r
379 }\r
380 \r
381 // for batch operations: generates the index numbers for checkboxes\r
382 function listplug_nextBatchId() {\r
383         static $id = 0;\r
384         return $id++;\r
385 }\r
386 \r
387 function listplug_table_commentlist($template, $type) {\r
388         switch($type) {\r
389                 case 'HEAD':\r
390                         echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
391                         break;\r
392                 case 'BODY':\r
393                         $current = $template['current'];\r
394                         $current->ctime = strtotime($current->ctime);   // string -> unix timestamp\r
395 \r
396                         echo '<td>';\r
397                         echo date("Y-m-d@H:i",$current->ctime);\r
398                         echo '<br />';\r
399                         if ($current->mname)\r
400                                 echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;\r
401                         else\r
402                                 echo htmlspecialchars($current->cuser);\r
403                         if ($current->cmail != '') {\r
404                                 echo '<br />';\r
405                                 echo htmlspecialchars($current->cmail);\r
406                         }\r
407                         if ($current->cemail != '') {\r
408                                 echo '<br />';\r
409                                 echo htmlspecialchars($current->cemail);\r
410                         }\r
411                         echo '</td>';\r
412 \r
413                         $current->cbody = strip_tags($current->cbody);\r
414                         $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));\r
415 \r
416                         echo '<td>';\r
417                         $id = listplug_nextBatchId();\r
418                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';\r
419                         echo '<label for="batch',$id,'">';\r
420                         echo $current->cbody;\r
421                         echo '</label>';\r
422                         echo '</td>';\r
423 \r
424                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&amp;commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";\r
425                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&amp;commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";\r
426                         if ($template['canAddBan'])\r
427                                 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=banlistnewfromitem&amp;itemid=$current->citem&amp;ip=", htmlspecialchars($current->cip), "' title='", htmlspecialchars($current->chost), "'>"._LIST_COMMENT_BANIP."</a></td>";\r
428                         break;\r
429         }\r
430 }\r
431 \r
432 \r
433 function listplug_table_bloglist($template, $type) {\r
434         switch($type) {\r
435                 case 'HEAD':\r
436                         echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";\r
437                         break;\r
438                 case 'BODY':\r
439                         $current = $template['current'];\r
440 \r
441                         echo "<td title='blogid:$current->bnumber shortname:$current->bshortname'><a href='$current->burl'><img src='images/globe.gif' width='13' height='13' alt='". _BLOGLIST_TT_VISIT."' /></a> " . htmlspecialchars($current->bname) . "</td>";\r
442                         echo "<td><a href='index.php?action=createitem&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";\r
443                         echo "<td><a href='index.php?action=itemlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";\r
444                         echo "<td><a href='index.php?action=blogcommentlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";\r
445                         echo "<td><a href='index.php?action=bookmarklet&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";\r
446 \r
447                         if ($current->tadmin == 1) {\r
448                                 echo "<td><a href='index.php?action=blogsettings&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";\r
449                                 echo "<td><a href='index.php?action=banlist&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";\r
450                         }\r
451 \r
452                         if ($template['superadmin']) {\r
453                                 echo "<td><a href='index.php?action=deleteblog&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";\r
454                         }\r
455 \r
456 \r
457 \r
458                         break;\r
459         }\r
460 }\r
461 \r
462 function listplug_table_shortblognames($template, $type) {\r
463         switch($type) {\r
464                 case 'HEAD':\r
465                         echo "<th>" . _EBLOG_SHORTNAME . "</th><th>" . _EBLOG_NAME. "</th>";\r
466                         break;\r
467                 case 'BODY':\r
468                         $current = $template['current'];\r
469 \r
470                         echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';\r
471                         echo '<td>' , htmlspecialchars($current->bname) , '</td>';\r
472 \r
473                         break;\r
474         }\r
475 }\r
476 \r
477 function listplug_table_shortnames($template, $type) {\r
478         switch($type) {\r
479                 case 'HEAD':\r
480                         echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";\r
481                         break;\r
482                 case 'BODY':\r
483                         $current = $template['current'];\r
484 \r
485                         echo '<td>' , htmlspecialchars($current->name) , '</td>';\r
486                         echo '<td>' , htmlspecialchars($current->description) , '</td>';\r
487 \r
488                         break;\r
489         }\r
490 }\r
491 \r
492 \r
493 function listplug_table_categorylist($template, $type) {\r
494         switch($type) {\r
495                 case 'HEAD':\r
496                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";\r
497                         break;\r
498                 case 'BODY':\r
499                         $current = $template['current'];\r
500 \r
501                         echo '<td>';\r
502                         $id = listplug_nextBatchId();\r
503                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';\r
504                         echo '<label for="batch',$id,'">';\r
505                         echo htmlspecialchars($current->cname);\r
506                         echo '</label>';\r
507                         echo '</td>';\r
508 \r
509                         echo '<td>', htmlspecialchars($current->cdesc), '</td>';\r
510                         echo "<td><a href='index.php?action=categorydelete&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
511                         echo "<td><a href='index.php?action=categoryedit&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
512 \r
513                         break;\r
514         }\r
515 }\r
516 \r
517 \r
518 function listplug_table_templatelist($template, $type) {\r
519         global $manager;\r
520         switch($type) {\r
521                 case 'HEAD':\r
522                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
523                         break;\r
524                 case 'BODY':\r
525                         $current = $template['current'];\r
526 \r
527                         echo "<td>" , htmlspecialchars($current->tdname), "</td>";\r
528                         echo "<td>" , htmlspecialchars($current->tddesc), "</td>";\r
529                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
530 \r
531                         $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));\r
532                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";\r
533                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
534 \r
535                         break;\r
536         }\r
537 }\r
538 \r
539 function listplug_table_skinlist($template, $type) {\r
540         global $CONF, $DIR_SKINS, $manager;\r
541         switch($type) {\r
542                 case 'HEAD':\r
543                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
544                         break;\r
545                 case 'BODY':\r
546                         $current = $template['current'];\r
547 \r
548                         echo '<td>';\r
549 \r
550                         // use a special style for the default skin\r
551                         if ($current->sdnumber == $CONF['BaseSkin']) {\r
552                                 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';\r
553                         } else {\r
554                                 echo htmlspecialchars($current->sdname);\r
555                         }\r
556 \r
557                         echo '<br /><br />';\r
558                         echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);\r
559                         echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);\r
560                         if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);\r
561 \r
562                         // add preview image when present\r
563                         if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))\r
564                         {\r
565                                 echo '<br /><br />';\r
566 \r
567                                 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');\r
568                                 if ($hasEnlargement)\r
569                                         echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';\r
570 \r
571                                 $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));\r
572                                 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';\r
573 \r
574                                 if ($hasEnlargement)\r
575                                         echo '</a>';\r
576 \r
577                                 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))\r
578                                 {\r
579                                         $url         = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';\r
580                                         $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));\r
581                                         echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';\r
582                                 }\r
583 \r
584 \r
585                         }\r
586 \r
587                         echo "</td>";\r
588 \r
589 \r
590                         echo "<td>" , htmlspecialchars($current->sddesc);\r
591                                 // show list of defined parts\r
592                                 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');\r
593                                 $types = array();\r
594                                 while ($o = mysql_fetch_object($r))\r
595                                         array_push($types,$o->stype);\r
596                                 if (sizeof($types) > 0) {\r
597                                         $friendlyNames = SKIN::getFriendlyNames();\r
598                                         for ($i=0;$i<sizeof($types);$i++) {\r
599                                                 $type = $types[$i];\r
600                                                 if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {\r
601                                                         $types[$i] = '<li>' . helpHtml('skinpart'.$type) . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";\r
602                                                 } else {\r
603                                                         $types[$i] = '<li>' . helpHtml('skinpartspecial') . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";\r
604                                                 }\r
605                                         }\r
606                                         echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';\r
607                                 }\r
608                         echo "</td>";\r
609                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
610 \r
611                         $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));\r
612                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";\r
613                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
614 \r
615                         break;\r
616         }\r
617 }\r
618 \r
619 function listplug_table_draftlist($template, $type) {\r
620         switch($type) {\r
621                 case 'HEAD':\r
622                         echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";\r
623                         break;\r
624                 case 'BODY':\r
625                         $current = $template['current'];\r
626 \r
627                         echo '<td>', htmlspecialchars($current->bshortname) , '</td>';\r
628                         echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';\r
629                         echo "<td><a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";\r
630                         echo "<td><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";\r
631 \r
632                         break;\r
633         }\r
634 }\r
635 \r
636 \r
637 function listplug_table_actionlist($template, $type) {\r
638         switch($type) {\r
639                 case 'HEAD':\r
640                         echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';\r
641                         break;\r
642                 case 'BODY':\r
643                         $current = $template['current'];\r
644 \r
645                         echo '<td>' , htmlspecialchars($current->timestamp), '</td>';\r
646                         echo '<td>' , htmlspecialchars($current->message), '</td>';\r
647 \r
648                         break;\r
649         }\r
650 }\r
651 \r
652 function listplug_table_banlist($template, $type) {\r
653         switch($type) {\r
654                 case 'HEAD':\r
655                         echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';\r
656                         break;\r
657                 case 'BODY':\r
658                         $current = $template['current'];\r
659 \r
660                         echo '<td>' , htmlspecialchars($current->iprange) , '</td>';\r
661                         echo '<td>' , htmlspecialchars($current->reason) , '</td>';\r
662                         echo "<td><a href='index.php?action=banlistdelete&amp;blogid=", intval($current->blogid) , "&amp;iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";\r
663                         break;\r
664         }\r
665 }\r
666 \r
667 ?>