OSDN Git Service

言語ファイル、及び出力部分修正(ADMIN.php, showlist.php)
[nucleus-jp/nucleus-jp-ancient.git] / 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'>".sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments())."</a>";\r
369                         }\r
370                         else {\r
371                                 echo "<br />"._LIST_ITEM_NOCONTENT;\r
372                         }\r
373                         echo    "<br /><a href='index.php?action=itemmove&amp;itemid=$current->inumber'>"._LISTS_MOVE."</a>";\r
374                         echo    "<br /><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a>";\r
375                         echo "</td>";\r
376                         break;\r
377         }\r
378 }\r
379 \r
380 // for batch operations: generates the index numbers for checkboxes\r
381 function listplug_nextBatchId() {\r
382         static $id = 0;\r
383         return $id++;\r
384 }\r
385 \r
386 function listplug_table_commentlist($template, $type) {\r
387         switch($type) {\r
388                 case 'HEAD':\r
389                         echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
390                         break;\r
391                 case 'BODY':\r
392                         $current = $template['current'];\r
393                         $current->ctime = strtotime($current->ctime);   // string -> unix timestamp\r
394 \r
395                         echo '<td>';\r
396                         echo date("Y-m-d@H:i",$current->ctime);\r
397                         echo '<br />';\r
398                         if ($current->mname)\r
399                                 echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;\r
400                         else\r
401                                 echo htmlspecialchars($current->cuser);\r
402                         if ($current->cmail != '') {\r
403                                 echo '<br />';\r
404                                 echo htmlspecialchars($current->cmail);\r
405                         }\r
406                         if ($current->cemail != '') {\r
407                                 echo '<br />';\r
408                                 echo htmlspecialchars($current->cemail);\r
409                         }\r
410                         echo '</td>';\r
411 \r
412                         $current->cbody = strip_tags($current->cbody);\r
413                         $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));\r
414 \r
415                         echo '<td>';\r
416                         $id = listplug_nextBatchId();\r
417                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';\r
418                         echo '<label for="batch',$id,'">';\r
419                         echo $current->cbody;\r
420                         echo '</label>';\r
421                         echo '</td>';\r
422 \r
423                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&amp;commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";\r
424                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&amp;commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";\r
425                         if ($template['canAddBan'])\r
426                                 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
427                         break;\r
428         }\r
429 }\r
430 \r
431 \r
432 function listplug_table_bloglist($template, $type) {\r
433         switch($type) {\r
434                 case 'HEAD':\r
435                         echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";\r
436                         break;\r
437                 case 'BODY':\r
438                         $current = $template['current'];\r
439 \r
440                         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
441                         echo "<td><a href='index.php?action=createitem&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";\r
442                         echo "<td><a href='index.php?action=itemlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";\r
443                         echo "<td><a href='index.php?action=blogcommentlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";\r
444                         echo "<td><a href='index.php?action=bookmarklet&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";\r
445 \r
446                         if ($current->tadmin == 1) {\r
447                                 echo "<td><a href='index.php?action=blogsettings&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";\r
448                                 echo "<td><a href='index.php?action=banlist&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";\r
449                         }\r
450 \r
451                         if ($template['superadmin']) {\r
452                                 echo "<td><a href='index.php?action=deleteblog&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";\r
453                         }\r
454 \r
455 \r
456 \r
457                         break;\r
458         }\r
459 }\r
460 \r
461 function listplug_table_shortblognames($template, $type) {\r
462         switch($type) {\r
463                 case 'HEAD':\r
464                         echo "<th>" . _EBLOG_SHORTNAME . "</th><th>" . _EBLOG_NAME. "</th>";\r
465                         break;\r
466                 case 'BODY':\r
467                         $current = $template['current'];\r
468 \r
469                         echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';\r
470                         echo '<td>' , htmlspecialchars($current->bname) , '</td>';\r
471 \r
472                         break;\r
473         }\r
474 }\r
475 \r
476 function listplug_table_shortnames($template, $type) {\r
477         switch($type) {\r
478                 case 'HEAD':\r
479                         echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";\r
480                         break;\r
481                 case 'BODY':\r
482                         $current = $template['current'];\r
483 \r
484                         echo '<td>' , htmlspecialchars($current->name) , '</td>';\r
485                         echo '<td>' , htmlspecialchars($current->description) , '</td>';\r
486 \r
487                         break;\r
488         }\r
489 }\r
490 \r
491 \r
492 function listplug_table_categorylist($template, $type) {\r
493         switch($type) {\r
494                 case 'HEAD':\r
495                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";\r
496                         break;\r
497                 case 'BODY':\r
498                         $current = $template['current'];\r
499 \r
500                         echo '<td>';\r
501                         $id = listplug_nextBatchId();\r
502                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';\r
503                         echo '<label for="batch',$id,'">';\r
504                         echo htmlspecialchars($current->cname);\r
505                         echo '</label>';\r
506                         echo '</td>';\r
507 \r
508                         echo '<td>', htmlspecialchars($current->cdesc), '</td>';\r
509                         echo "<td><a href='index.php?action=categorydelete&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
510                         echo "<td><a href='index.php?action=categoryedit&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
511 \r
512                         break;\r
513         }\r
514 }\r
515 \r
516 \r
517 function listplug_table_templatelist($template, $type) {\r
518         global $manager;\r
519         switch($type) {\r
520                 case 'HEAD':\r
521                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
522                         break;\r
523                 case 'BODY':\r
524                         $current = $template['current'];\r
525 \r
526                         echo "<td>" , htmlspecialchars($current->tdname), "</td>";\r
527                         echo "<td>" , htmlspecialchars($current->tddesc), "</td>";\r
528                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
529 \r
530                         $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));\r
531                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";\r
532                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
533 \r
534                         break;\r
535         }\r
536 }\r
537 \r
538 function listplug_table_skinlist($template, $type) {\r
539         global $CONF, $DIR_SKINS, $manager;\r
540         switch($type) {\r
541                 case 'HEAD':\r
542                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
543                         break;\r
544                 case 'BODY':\r
545                         $current = $template['current'];\r
546 \r
547                         echo '<td>';\r
548 \r
549                         // use a special style for the default skin\r
550                         if ($current->sdnumber == $CONF['BaseSkin']) {\r
551                                 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';\r
552                         } else {\r
553                                 echo htmlspecialchars($current->sdname);\r
554                         }\r
555 \r
556                         echo '<br /><br />';\r
557                         echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);\r
558                         echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);\r
559                         if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);\r
560 \r
561                         // add preview image when present\r
562                         if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))\r
563                         {\r
564                                 echo '<br /><br />';\r
565 \r
566                                 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');\r
567                                 if ($hasEnlargement)\r
568                                         echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';\r
569 \r
570                                 $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));\r
571                                 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';\r
572 \r
573                                 if ($hasEnlargement)\r
574                                         echo '</a>';\r
575 \r
576                                 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))\r
577                                 {\r
578                                         $url         = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';\r
579                                         $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));\r
580                                         echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';\r
581                                 }\r
582 \r
583 \r
584                         }\r
585 \r
586                         echo "</td>";\r
587 \r
588 \r
589                         echo "<td>" , htmlspecialchars($current->sddesc);\r
590                                 // show list of defined parts\r
591                                 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');\r
592                                 $types = array();\r
593                                 while ($o = mysql_fetch_object($r))\r
594                                         array_push($types,$o->stype);\r
595                                 if (sizeof($types) > 0) {\r
596                                         $friendlyNames = SKIN::getFriendlyNames();\r
597                                         for ($i=0;$i<sizeof($types);$i++) {\r
598                                                 $type = $types[$i];\r
599                                                 if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {\r
600                                                         $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
601                                                 } else {\r
602                                                         $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
603                                                 }\r
604                                         }\r
605                                         echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';\r
606                                 }\r
607                         echo "</td>";\r
608                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
609 \r
610                         $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));\r
611                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";\r
612                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
613 \r
614                         break;\r
615         }\r
616 }\r
617 \r
618 function listplug_table_draftlist($template, $type) {\r
619         switch($type) {\r
620                 case 'HEAD':\r
621                         echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";\r
622                         break;\r
623                 case 'BODY':\r
624                         $current = $template['current'];\r
625 \r
626                         echo '<td>', htmlspecialchars($current->bshortname) , '</td>';\r
627                         echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';\r
628                         echo "<td><a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";\r
629                         echo "<td><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";\r
630 \r
631                         break;\r
632         }\r
633 }\r
634 \r
635 \r
636 function listplug_table_actionlist($template, $type) {\r
637         switch($type) {\r
638                 case 'HEAD':\r
639                         echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';\r
640                         break;\r
641                 case 'BODY':\r
642                         $current = $template['current'];\r
643 \r
644                         echo '<td>' , htmlspecialchars($current->timestamp), '</td>';\r
645                         echo '<td>' , htmlspecialchars($current->message), '</td>';\r
646 \r
647                         break;\r
648         }\r
649 }\r
650 \r
651 function listplug_table_banlist($template, $type) {\r
652         switch($type) {\r
653                 case 'HEAD':\r
654                         echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';\r
655                         break;\r
656                 case 'BODY':\r
657                         $current = $template['current'];\r
658 \r
659                         echo '<td>' , htmlspecialchars($current->iprange) , '</td>';\r
660                         echo '<td>' , htmlspecialchars($current->reason) , '</td>';\r
661                         echo "<td><a href='index.php?action=banlistdelete&amp;blogid=", intval($current->blogid) , "&amp;iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";\r
662                         break;\r
663         }\r
664 }\r
665 \r
666 ?>