[ Index ]

PHP Cross Reference of Nucleus CMS 3.64

title

Body

[close]

/nucleus3.64/nucleus/libs/ -> showlist.php (source)

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


Generated: Mon May 2 16:14:08 2011 Cross-referenced by PHPXref 0.7.1