showlist.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
00004  * Copyright (C) 2002-2007 The Nucleus Group
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  * (see nucleus/documentation/index.html#license for more info)
00011  */
00022 // can take either an array of objects, or an SQL query
00023 function showlist($query, $type, $template) {
00024 
00025         if (is_array($query)) {
00026                 if (sizeof($query) == 0)
00027                         return 0;
00028 
00029                 call_user_func('listplug_' . $type, $template, 'HEAD');
00030 
00031                 foreach ($query as $currentObj) {
00032                         $template['current'] = $currentObj;
00033                         call_user_func('listplug_' . $type, $template, 'BODY');
00034                 }
00035 
00036                 call_user_func('listplug_' . $type, $template, 'FOOT');
00037 
00038                 return sizeof($query);
00039 
00040         } else {
00041                 $res = sql_query($query);
00042 
00043                 // don't do anything if there are no results
00044                 $numrows = mysql_num_rows($res);
00045                 if ($numrows == 0)
00046                         return 0;
00047 
00048                 call_user_func('listplug_' . $type, $template, 'HEAD');
00049 
00050                 while($template['current'] = mysql_fetch_object($res))
00051                         call_user_func('listplug_' . $type, $template, 'BODY');
00052 
00053                 call_user_func('listplug_' . $type, $template, 'FOOT');
00054 
00055                 mysql_free_result($res);
00056 
00057                 // return amount of results
00058                 return $numrows;
00059         }
00060 }
00061 
00062 function listplug_select($template, $type) {
00063         switch($type) {
00064                 case 'HEAD':
00065                         echo '<select name="' . ifset($template['name']) . '" tabindex="' . ifset($template['tabindex']) . '" ' . ifset($template['javascript']) . '>';
00066 
00067                         // add extra row if needed
00068                         if (ifset($template['extra'])) {
00069                                 echo '<option value="', ifset($template['extraval']), '">', $template['extra'], '</option>';
00070                         }
00071 
00072                         break;
00073                 case 'BODY':
00074                         $current = $template['current'];
00075 
00076                         echo '<option value="' . htmlspecialchars($current->value) . '"';
00077                         if ($template['selected'] == $current->value)
00078                                 echo ' selected="selected" ';
00079                         if (isset($template['shorten']) && $template['shorten'] > 0) {
00080                                 echo ' title="'. htmlspecialchars($current->text).'"';
00081                                 $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);
00082                         }
00083                         echo '>' . htmlspecialchars($current->text) . '</option>';
00084                         break;
00085                 case 'FOOT':
00086                         echo '</select>';
00087                         break;
00088         }
00089 }
00090 
00091 function listplug_table($template, $type) {
00092         switch($type) {
00093                 case 'HEAD':
00094                         echo "<table>";
00095                         echo "<thead><tr>";
00096                         // print head
00097                         call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');
00098                         echo "</tr></thead><tbody>";
00099                         break;
00100                 case 'BODY':
00101                         // print tabletype specific thingies
00102                         echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";
00103                         call_user_func("listplug_table_" . $template['content'] , $template,  'BODY');
00104                         echo "</tr>";
00105                         break;
00106                 case 'FOOT':
00107                         call_user_func("listplug_table_" . $template['content'] , $template,  'FOOT');
00108                         echo "</tbody></table>";
00109                         break;
00110         }
00111 }
00112 
00113 function listplug_table_memberlist($template, $type) {
00114         switch($type) {
00115                 case 'HEAD':
00116                         echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;
00117                         help('superadmin');
00118                         echo "</th><th>" . _LIST_MEMBER_LOGIN;
00119                         help('canlogin');
00120                         echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";
00121                         break;
00122                 case 'BODY':
00123                         $current = $template['current'];
00124 
00125                         echo '<td>';
00126                         $id = listplug_nextBatchId();
00127                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';
00128                         echo '<label for="batch',$id,'">';
00129                         echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
00130                         echo '</label>';
00131                         echo '</td>';
00132                         echo '<td>', htmlspecialchars($current->mrealname), '</td>';
00133                         echo "<td><a href='", htmlspecialchars($current->murl), "' tabindex='", $template['tabindex'] , "'>", htmlspecialchars($current->murl), "</a></td>";
00134                         echo '<td>', ($current->madmin ? _YES : _NO),'</td>';
00135                         echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';
00136                         echo "<td><a href='index.php?action=memberedit&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
00137                         echo "<td><a href='index.php?action=memberdelete&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
00138                         break;
00139         }
00140 }
00141 
00142 function listplug_table_teamlist($template, $type) {
00143         global $manager;
00144         switch($type) {
00145                 case 'HEAD':
00146                         echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;
00147                         help('teamadmin');
00148                         echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
00149                         break;
00150                 case 'BODY':
00151                         $current = $template['current'];
00152 
00153                         echo '<td>';
00154                         $id = listplug_nextBatchId();
00155                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';
00156                         echo '<label for="batch',$id,'">';
00157                         echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
00158                         echo '</label>';
00159                         echo '</td>';
00160                         echo '<td>', htmlspecialchars($current->mrealname), '</td>';
00161                         echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';
00162                         echo "<td><a href='index.php?action=teamdelete&amp;memberid=$current->tmember&amp;blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
00163 
00164                         $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);
00165                         $url = $manager->addTicketToUrl($url);
00166                         echo "<td><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";
00167                         break;
00168         }
00169 }
00170 
00171 function listplug_table_pluginlist($template, $type) {
00172         global $manager;
00173         switch($type) {
00174                 case 'HEAD':
00175                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';
00176                         echo '<th style="white-space:nowrap">'._LISTS_ACTIONS.'</th>';
00177                         break;
00178                 case 'BODY':
00179                         $current = $template['current'];
00180 
00181                         $plug =& $manager->getPlugin($current->pfile);
00182                         if ($plug) {
00183                                 echo '<td>';
00184                                         echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';
00185                                         echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';
00186                                         echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';
00187                                         if ($plug->getURL())
00188                                         echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';
00189                                 echo '</td>';
00190                                 echo '<td>';
00191                                         echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
00192                                         if (sizeof($plug->getEventList()) > 0) {
00193                                                 echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));
00194                                                 // check the database to see if it is up-to-date and notice the user if not
00195                                         }
00196                                         if (!$plug->subscribtionListIsUptodate()) {
00197                                                 echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';
00198                                         }
00199                                         if (sizeof($plug->getPluginDep()) > 0)
00200                                                 echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));
00201                                 echo '</td>';
00202                         } else {
00203                                 echo '<td colspan="2">Error: plugin file <b>',htmlspecialchars($current->pfile),'.php</b> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)</td>';
00204                         }
00205                         echo '<td>';
00206 
00207                                 $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';
00208                                 $url = $manager->addTicketToUrl($baseUrl . 'pluginup');
00209                                 echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";
00210                                 $url = $manager->addTicketToUrl($baseUrl . 'plugindown');
00211                                 echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";
00212                                 echo "<br /><a href='index.php?action=plugindelete&amp;plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";
00213                                 if ($plug && ($plug->hasAdminArea() > 0))
00214                                         echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";
00215                                 if ($plug && ($plug->supportsFeature('HelpPage') > 0))
00216                                         echo "<br /><a href='index.php?action=pluginhelp&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";
00217                                 if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)
00218                                         echo "<br /><a href='index.php?action=pluginoptions&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";
00219                         echo '</td>';
00220                         break;
00221         }
00222 }
00223 
00224 function listplug_table_plugoptionlist($template, $type) {
00225         global $manager;
00226         switch($type) {
00227                 case 'HEAD':
00228                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';
00229                         break;
00230                 case 'BODY':
00231                         $current = $template['current'];
00232                         listplug_plugOptionRow($current);
00233                         break;
00234                 case 'FOOT':
00235                         ?>
00236                         <tr>
00237                                 <th colspan="2"><?php echo _PLUGS_SAVE?></th>
00238                         </tr><tr>
00239                                 <td><?php echo _PLUGS_SAVE?></td>
00240                                 <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>
00241                         </tr>
00242                         <?php                   break;
00243         }
00244 }
00245 
00246 function listplug_plugOptionRow($current) {
00247         $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';
00248         // retreive the optionmeta
00249         $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
00250 
00251         // only if it is not a hidden option write the controls to the page
00252         if (@$meta['access'] != 'hidden') {
00253                 echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
00254                 echo '<td>';
00255                 switch($current['type']) {
00256                         case 'yesno':
00257                                 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
00258                                 break;
00259                         case 'password':
00260                                 echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
00261                                 break;
00262                         case 'select':
00263                                 echo '<select name="'.htmlspecialchars($varname).'">';
00264                                 $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
00265                                 $aOptions = explode('|', $aOptions);
00266                                 for ($i=0; $i<(count($aOptions)-1); $i+=2) {
00267                                         echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';
00268                                         if ($aOptions[$i+1] == $current['value'])
00269                                                 echo ' selected="selected"';
00270                                         echo '>'.htmlspecialchars($aOptions[$i]).'</option>';
00271                                 }
00272                                 echo '</select>';
00273                                 break;
00274                         case 'textarea':
00275                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
00276                                 echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';
00277                                 if (@$meta['access'] == 'readonly') {
00278                                         echo ' readonly="readonly"';
00279                                 }
00280                                 echo '>',htmlspecialchars($current['value']),'</textarea>';
00281                                 break;
00282                         case 'text':
00283                         default:
00284                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
00285 
00286                                 echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';
00287                                 if (@$meta['datatype'] == 'numerical') {
00288                                         echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
00289                                 }
00290                                 if (@$meta['access'] == 'readonly') {
00291                                         echo ' readonly="readonly"';
00292                                 }
00293                                 echo ' />';
00294                 }
00295                 echo @$current['extra'];
00296                 echo '</td>';
00297         }
00298 }
00299 
00300 function listplug_table_itemlist($template, $type) {
00301         $cssclass = null;
00302 
00303         switch($type) {
00304                 case 'HEAD':
00305                         echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";
00306                         break;
00307                 case 'BODY':
00308                         $current = $template['current'];
00309                         $current->itime = strtotime($current->itime);   // string -> unix timestamp
00310 
00311                         if ($current->idraft == 1)
00312                                 $cssclass = "class='draft'";
00313 
00314                         // (can't use offset time since offsets might vary between blogs)
00315                         if ($current->itime > $template['now'])
00316                                 $cssclass = "class='future'";
00317 
00318                         echo "<td $cssclass>",_LIST_ITEM_BLOG,' ', htmlspecialchars($current->bshortname);
00319                         echo "    <br />",_LIST_ITEM_CAT,' ', htmlspecialchars($current->cname);
00320                         echo "    <br />",_LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname);
00321                         echo "    <br />",_LIST_ITEM_DATE," " . date("Y-m-d",$current->itime);
00322                         echo "<br />",_LIST_ITEM_TIME," " . date("H:i",$current->itime);
00323                         echo "</td>";
00324                         echo "<td $cssclass>";
00325 
00326                         $id = listplug_nextBatchId();
00327 
00328                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';
00329                         echo '<label for="batch',$id,'">';
00330                         echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";
00331                         echo '</label>';
00332                         echo "<br />";
00333 
00334 
00335                         $current->ibody = strip_tags($current->ibody);
00336                         $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));
00337 
00338                         echo "$current->ibody</td>";
00339                         echo "<td  style=\"white-space:nowrap\" $cssclass>";
00340                         echo    "<a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a>";
00341                         echo    "<br /><a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>"._LISTS_COMMENTS."</a>";
00342                         echo    "<br /><a href='index.php?action=itemmove&amp;itemid=$current->inumber'>"._LISTS_MOVE."</a>";
00343                         echo    "<br /><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a>";
00344                         echo "</td>";
00345                         break;
00346         }
00347 }
00348 
00349 // for batch operations: generates the index numbers for checkboxes
00350 function listplug_nextBatchId() {
00351         static $id = 0;
00352         return $id++;
00353 }
00354 
00355 function listplug_table_commentlist($template, $type) {
00356         switch($type) {
00357                 case 'HEAD':
00358                         echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
00359                         break;
00360                 case 'BODY':
00361                         $current = $template['current'];
00362                         $current->ctime = strtotime($current->ctime);   // string -> unix timestamp
00363 
00364                         echo '<td>';
00365                         echo date("Y-m-d@H:i",$current->ctime);
00366                         echo '<br />';
00367                         if ($current->mname)
00368                                 echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;
00369                         else
00370                                 echo htmlspecialchars($current->cuser);
00371                         if ($current->cmail != '') {
00372                                 echo '<br />';
00373                                 echo htmlspecialchars($current->cmail);
00374                         }
00375                         if ($current->cemail != '') {
00376                                 echo '<br />';
00377                                 echo htmlspecialchars($current->cemail);
00378                         }
00379                         echo '</td>';
00380 
00381                         $current->cbody = strip_tags($current->cbody);
00382                         $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));
00383 
00384                         echo '<td>';
00385                         $id = listplug_nextBatchId();
00386                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';
00387                         echo '<label for="batch',$id,'">';
00388                         echo $current->cbody;
00389                         echo '</label>';
00390                         echo '</td>';
00391 
00392                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&amp;commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";
00393                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&amp;commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";
00394                         if ($template['canAddBan'])
00395                                 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>";
00396                         break;
00397         }
00398 }
00399 
00400 
00401 function listplug_table_bloglist($template, $type) {
00402         switch($type) {
00403                 case 'HEAD':
00404                         echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";
00405                         break;
00406                 case 'BODY':
00407                         $current = $template['current'];
00408 
00409                         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>";
00410                         echo "<td><a href='index.php?action=createitem&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";
00411                         echo "<td><a href='index.php?action=itemlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";
00412                         echo "<td><a href='index.php?action=blogcommentlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";
00413                         echo "<td><a href='index.php?action=bookmarklet&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";
00414 
00415                         if ($current->tadmin == 1) {
00416                                 echo "<td><a href='index.php?action=blogsettings&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";
00417                                 echo "<td><a href='index.php?action=banlist&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";
00418                         }
00419 
00420                         if ($template['superadmin']) {
00421                                 echo "<td><a href='index.php?action=deleteblog&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";
00422                         }
00423 
00424 
00425 
00426                         break;
00427         }
00428 }
00429 
00430 function listplug_table_shortblognames($template, $type) {
00431         switch($type) {
00432                 case 'HEAD':
00433                         echo "<th>" . _NAME . "</th><th>" . _NAME. "</th>";
00434                         break;
00435                 case 'BODY':
00436                         $current = $template['current'];
00437 
00438                         echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';
00439                         echo '<td>' , htmlspecialchars($current->bname) , '</td>';
00440 
00441                         break;
00442         }
00443 }
00444 
00445 function listplug_table_shortnames($template, $type) {
00446         switch($type) {
00447                 case 'HEAD':
00448                         echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";
00449                         break;
00450                 case 'BODY':
00451                         $current = $template['current'];
00452 
00453                         echo '<td>' , htmlspecialchars($current->name) , '</td>';
00454                         echo '<td>' , htmlspecialchars($current->description) , '</td>';
00455 
00456                         break;
00457         }
00458 }
00459 
00460 
00461 function listplug_table_categorylist($template, $type) {
00462         switch($type) {
00463                 case 'HEAD':
00464                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
00465                         break;
00466                 case 'BODY':
00467                         $current = $template['current'];
00468 
00469                         echo '<td>';
00470                         $id = listplug_nextBatchId();
00471                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';
00472                         echo '<label for="batch',$id,'">';
00473                         echo htmlspecialchars($current->cname);
00474                         echo '</label>';
00475                         echo '</td>';
00476 
00477                         echo '<td>', htmlspecialchars($current->cdesc), '</td>';
00478                         echo "<td><a href='index.php?action=categorydelete&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
00479                         echo "<td><a href='index.php?action=categoryedit&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
00480 
00481                         break;
00482         }
00483 }
00484 
00485 
00486 function listplug_table_templatelist($template, $type) {
00487         global $manager;
00488         switch($type) {
00489                 case 'HEAD':
00490                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
00491                         break;
00492                 case 'BODY':
00493                         $current = $template['current'];
00494 
00495                         echo "<td>" , htmlspecialchars($current->tdname), "</td>";
00496                         echo "<td>" , htmlspecialchars($current->tddesc), "</td>";
00497                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
00498 
00499                         $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));
00500                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
00501                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
00502 
00503                         break;
00504         }
00505 }
00506 
00507 function listplug_table_skinlist($template, $type) {
00508         global $CONF, $DIR_SKINS, $manager;
00509         switch($type) {
00510                 case 'HEAD':
00511                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
00512                         break;
00513                 case 'BODY':
00514                         $current = $template['current'];
00515 
00516                         echo '<td>';
00517 
00518                         // use a special style for the default skin
00519                         if ($current->sdnumber == $CONF['BaseSkin']) {
00520                                 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';
00521                         } else {
00522                                 echo htmlspecialchars($current->sdname);
00523                         }
00524 
00525                         echo '<br /><br />';
00526                         echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);
00527                         echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);
00528                         if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);
00529 
00530                         // add preview image when present
00531                         if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))
00532                         {
00533                                 echo '<br /><br />';
00534 
00535                                 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
00536                                 if ($hasEnlargement)
00537                                         echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="View larger">';
00538 
00539                                 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="Preview for \'',htmlspecialchars($current->sdname),'\' skin" />';
00540 
00541                                 if ($hasEnlargement)
00542                                         echo '</a>';
00543 
00544                                 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
00545                                 {
00546                                         echo '<br /><a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'readme.html" title="More info on the \'',htmlspecialchars($current->sdname),'\' skin">Readme</a>';
00547                                 }
00548 
00549 
00550                         }
00551 
00552                         echo "</td>";
00553 
00554 
00555                         echo "<td>" , htmlspecialchars($current->sddesc);
00556                                 // show list of defined parts
00557                                 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
00558                                 $types = array();
00559                                 while ($o = mysql_fetch_object($r))
00560                                         array_push($types,$o->stype);
00561                                 if (sizeof($types) > 0) {
00562                                         $friendlyNames = SKIN::getFriendlyNames();
00563                                         for ($i=0;$i<sizeof($types);$i++) {
00564                                                 $type = $types[$i];
00565                                                 if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
00566                                                         $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>";
00567                                                 } else {
00568                                                         $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>";
00569                                                 }
00570                                         }
00571                                         echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
00572                                 }
00573                         echo "</td>";
00574                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
00575 
00576                         $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
00577                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
00578                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
00579 
00580                         break;
00581         }
00582 }
00583 
00584 function listplug_table_draftlist($template, $type) {
00585         switch($type) {
00586                 case 'HEAD':
00587                         echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
00588                         break;
00589                 case 'BODY':
00590                         $current = $template['current'];
00591 
00592                         echo '<td>', htmlspecialchars($current->bshortname) , '</td>';
00593                         echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';
00594                         echo "<td><a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";
00595                         echo "<td><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";
00596 
00597                         break;
00598         }
00599 }
00600 
00601 
00602 function listplug_table_actionlist($template, $type) {
00603         switch($type) {
00604                 case 'HEAD':
00605                         echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';
00606                         break;
00607                 case 'BODY':
00608                         $current = $template['current'];
00609 
00610                         echo '<td>' , htmlspecialchars($current->timestamp), '</td>';
00611                         echo '<td>' , htmlspecialchars($current->message), '</td>';
00612 
00613                         break;
00614         }
00615 }
00616 
00617 function listplug_table_banlist($template, $type) {
00618         switch($type) {
00619                 case 'HEAD':
00620                         echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';
00621                         break;
00622                 case 'BODY':
00623                         $current = $template['current'];
00624 
00625                         echo '<td>' , htmlspecialchars($current->iprange) , '</td>';
00626                         echo '<td>' , htmlspecialchars($current->reason) , '</td>';
00627                         echo "<td><a href='index.php?action=banlistdelete&amp;blogid=", intval($current->blogid) , "&amp;iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";
00628                         break;
00629         }
00630 }
00631 
00632 ?>



Generated on Wed Jun 25 17:25:59 2008 by  doxygen 1.5.5