[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/include/ -> plugin_internal.inc.php (source)

   1  <?php # $Id: plugin_internal.inc.php 1864 2007-08-21 16:49:44Z garvinhicking $
   2  # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
   3  # All rights reserved.  See LICENSE file for licensing details
   4  
   5  if (IN_serendipity !== true) {
   6      die ("Don't hack!");
   7  }
   8  
   9  if (defined('S9Y_FRAMEWORK_PLUGIN_INTERNAL')) {
  10      return;
  11  }
  12  @define('S9Y_FRAMEWORK_PLUGIN_INTERNAL', true);
  13  
  14  class serendipity_calendar_plugin extends serendipity_plugin {
  15      var $title = CALENDAR;
  16  
  17      function introspect(&$propbag)
  18      {
  19          $propbag->add('name',        CALENDAR);
  20          $propbag->add('description', QUICKJUMP_CALENDAR);
  21          $propbag->add('configuration', array('beginningOfWeek', 'enableExtEvents', 'category'));
  22          $propbag->add('stackable',     false);
  23          $propbag->add('author',        'Serendipity Team');
  24          $propbag->add('version',       '1.1');
  25          $propbag->add('groups',        array('FRONTEND_VIEWS'));
  26      }
  27  
  28      function introspect_config_item($name, &$propbag)
  29      {
  30          switch($name) {
  31              case 'beginningOfWeek':
  32                  $options = array();
  33                  for ( $i = 1; $i <= 7; $i++ ) {
  34                      $options[] = serendipity_formatTime('%A', mktime(0,0,0,3,$i-1,2004));
  35                  }
  36  
  37                  $propbag->add('type',        'select');
  38                  $propbag->add('select_values', $options);
  39                  $propbag->add('name',        CALENDAR_BEGINNING_OF_WEEK);
  40                  $propbag->add('description', CALENDAR_BOW_DESC);
  41                  $propbag->add('default',     1);
  42                  break;
  43  
  44              case 'enableExtEvents':
  45                  $propbag->add('type',        'boolean');
  46                  $propbag->add('name',        CALENDAR_ENABLE_EXTERNAL_EVENTS);
  47                  $propbag->add('description', CALENDAR_EXTEVENT_DESC);
  48                  $propbag->add('default',     false);
  49                  break;
  50  
  51              // Event Calendar: Support category!
  52              case 'category':
  53                  $categories = array('all' => ALL_CATEGORIES);
  54                  $cats       = serendipity_fetchCategories();
  55  
  56                  if (is_array($cats)) {
  57                      $cats = serendipity_walkRecursive($cats, 'categoryid', 'parentid', VIEWMODE_THREADED);
  58                      foreach($cats as $cat) {
  59                          $categories[$cat['categoryid']] = str_repeat(' . ', $cat['depth']) . $cat['category_name'];
  60                      }
  61                  }
  62  
  63                  $propbag->add('type',         'select');
  64                  $propbag->add('name',         CATEGORIES_PARENT_BASE);
  65                  $propbag->add('description',  CATEGORIES_PARENT_BASE_DESC);
  66                  $propbag->add('select_values', $categories);
  67                  $propbag->add('default',      'all');
  68                  break;
  69  
  70              default:
  71                  return false;
  72          }
  73          return true;
  74      }
  75  
  76      function generate_content(&$title)
  77      {
  78          global $serendipity;
  79  
  80          $title = $this->title;
  81  
  82          // Usage of serendipity_serverOffsetHour is as follow:
  83          // * Whenever a date to display needs to be set, apply the timezone offset
  84          // * Whenever we USE the date anywhere in the database, subtract the timezone offset
  85          // * Whenever we DISPLAY the date, we do not apply additional timezone addition to it.
  86  
  87          if (!isset($serendipity['GET']['calendarZoom'])) {
  88              if (!isset($serendipity['range'])) {
  89                  $serendipity['GET']['calendarZoom'] = serendipity_serverOffsetHour(time());
  90              } else {
  91                  $serendipity['GET']['calendarZoom'] = serendipity_serverOffsetHour($serendipity['range'][0]);
  92              }
  93          }
  94  
  95  
  96          $month = date('m', serendipity_serverOffsetHour($serendipity['GET']['calendarZoom'], true));
  97          $year  = date('Y', serendipity_serverOffsetHour($serendipity['GET']['calendarZoom'], true));
  98  
  99          $bow = (int)$this->get_config('beginningOfWeek', 1);
 100          // Check for faulty input, is so - run the default
 101          if ($bow > 6) {
 102              $bow = 1;
 103          }
 104  
 105          // Catch faulty month
 106          $month = (int)$month;
 107          if ($month < 1) {
 108              $month = 1;
 109          }
 110  
 111          switch($serendipity['calendar']) {
 112              default:
 113              case 'gregorian':
 114                  // How many days does the month have?
 115                  $ts              = strtotime($year . '-' . sprintf('%02d', $month) . '-01');
 116                  $now             = serendipity_serverOffsetHour(time());
 117                  $nrOfDays        = date('t', $ts);
 118                  $firstDayWeekDay = date('w', $ts);
 119                  $firstts = $ts;
 120                  $endts = mktime(0, 0, 0, $month + 1, 1, $year);
 121  
 122                  break;
 123  
 124              case 'persian-utf8':
 125  
 126                  require_once  S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
 127  
 128                  list(,$jy, $jm, $jd) = $serendipity['uriArguments'];
 129  
 130                  if( isset($jd) && $jd ){
 131                      list ( $gy, $gm, $gd ) = p2g ($jy, $jm, $jd);
 132                  }elseif( isset($jm) && $jm ){
 133                      list ( $gy, $gm, $gd ) = p2g ( $jy, $jm, 1);
 134                  }else{
 135                      $gy = $year;
 136                      $gm = $month;
 137                      $gd = (int) date('d');
 138                  }
 139  
 140                  list ( $year, $month, $day ) = g2p ($gy, $gm, $gd);
 141  
 142                  // How many days does the month have?
 143                  $ts              = strtotime($gy . '-' . sprintf('%02d', $gm) . '-' . sprintf('%02d', $gd));
 144                  $now             = serendipity_serverOffsetHour(time());
 145                  $nrOfDays = persian_strftime_utf('%m', $ts);
 146                  $j_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
 147                  if ($year%4 == 3 && $nrOfDays == 12) $nrOfDays = $j_days_in_month[(int)$nrOfDays]+1;
 148                  else $nrOfDays = $j_days_in_month[(int)$nrOfDays];
 149  
 150                  // Calculate first timestamp of the month
 151                  list ($firstgy, $firstgm, $firstgd ) = p2g ( $year, $month, 1);
 152                  $firstts = mktime (0, 0, 0, $firstgm, $firstgd, $firstgy);
 153  
 154                  // Calculate first persian day, week day name
 155                  $firstDayWeekDay = date('w', $firstts);
 156  
 157                  // Calculate end timestamp of the month
 158                  list ( $end_year, $end_month, $end_day ) = p2g ($year, $month+1, 1);
 159                  $endts = mktime(0, 0, 0, $end_month, $end_day, $end_year);
 160                  break;
 161          } // end switch
 162  
 163          // Calculate the first day of the week, based on the beginning of the week ($bow)
 164          if ($bow > $firstDayWeekDay) {
 165              $firstDayWeekDay = $firstDayWeekDay + 7 - $bow;
 166          } elseif ( $bow < $firstDayWeekDay ) {
 167              $firstDayWeekDay = $firstDayWeekDay - $bow;
 168          } else {
 169              $firstDayWeekDay = 0;
 170          }
 171  
 172          // Calculate the number of next/previous month
 173          if ($month > 1) {
 174              $previousMonth = $month-1;
 175              $previousYear  = $year;
 176          } else {
 177              $previousMonth = 12;
 178              $previousYear  = $year-1;
 179          }
 180  
 181          if ($month < 12) {
 182              $nextMonth = $month+1;
 183              $nextYear  = $year;
 184          } else {
 185              $nextMonth = 1;
 186              $nextYear  = $year+1;
 187          }
 188  
 189          // Get first and last entry
 190          $minmax = serendipity_db_query("SELECT MAX(timestamp) AS max, MIN(timestamp) AS min FROM {$serendipity['dbPrefix']}entries");
 191          if (!is_array($minmax) || !is_array($minmax[0]) || $minmax[0]['min'] < 1 || $minmax[0]['max'] < 1) {
 192              // If no entry is available yet, allow scrolling a year back and forth
 193              $minmax = array(
 194                          '0' => array(
 195                                   'min' => mktime(0, 0, 0, 1, 1, date('Y', $now) - 1),
 196                                   'max' => mktime(0, 0, 0, 1, 1, date('Y', $now) + 1)
 197                                 )
 198                              );
 199          }
 200  
 201          // Find out about diary entries
 202          $add_query   = '';
 203          $base_query  = '';
 204          $cond = array();
 205          $cond['and']     = "WHERE e.timestamp  >= " . serendipity_serverOffsetHour($firstts, true) . "
 206                                AND e.timestamp  <= " . serendipity_serverOffsetHour($endts, true) . "
 207                                    " . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e.timestamp  <= " . serendipity_db_time() : '') . "
 208                                AND e.isdraft     = 'false'";
 209  
 210          serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('noCache' => false, 'noSticky' => false, 'source' => 'calendar'));
 211  
 212          // Event Calendar
 213          $cat = $this->get_config('category', 'all');
 214          if ($cat != 'all') {
 215              $catid = (int)$cat;
 216          } elseif (isset($serendipity['GET']['category'])) {
 217              $catid = (int)$serendipity['GET']['category'];
 218          } else {
 219              $catid = false;
 220          }
 221          
 222          if ($catid) {
 223              $base_query   = 'C' . $catid;
 224              $add_query    = '/' . $base_query;
 225              $querystring = "SELECT timestamp
 226                                FROM {$serendipity['dbPrefix']}category c,
 227                                     {$serendipity['dbPrefix']}entrycat ec,
 228                                     {$serendipity['dbPrefix']}entries e
 229                                     {$cond['joins']}
 230                                     {$cond['and']}
 231                                 AND e.id          = ec.entryid
 232                                 AND c.categoryid  = ec.categoryid
 233                                 AND (" . serendipity_getMultiCategoriesSQL($catid) . ")";
 234          }
 235  
 236          if (!isset($querystring)) {
 237              $querystring = "SELECT id, timestamp
 238                                FROM {$serendipity['dbPrefix']}entries e
 239                                {$cond['joins']}
 240                                {$cond['and']}";
 241          }
 242  
 243          $rows = serendipity_db_query($querystring);
 244  
 245          switch($serendipity['calendar']) {
 246              default:
 247              case 'gregorian':
 248                  $activeDays = array();
 249                  if (is_array($rows)) {
 250                      foreach ($rows as $row) {
 251                          $row['timestamp'] = serendipity_serverOffsetHour($row['timestamp']);
 252                          $activeDays[date('j', $row['timestamp'])] = $row['timestamp'];
 253                      }
 254                  }
 255                  $today_day   = date('j', $now);
 256                  $today_month = date('m', $now);
 257                  $today_year  = date('Y', $now);
 258                  break;
 259  
 260              case 'persian-utf8':
 261                  $activeDays = array();
 262                  if (is_array($rows)) {
 263                      foreach ($rows as $row) {
 264                          $row['timestamp'] = serendipity_serverOffsetHour($row['timestamp']);
 265                          $activeDays[(int) persian_date_utf('j', $row['timestamp'])] = $row['timestamp'];
 266                      }
 267                  }
 268                  $today_day   = persian_date_utf('j', $now);
 269                  $today_month = persian_date_utf('m', $now);
 270                  $today_year  = persian_date_utf('Y', $now);
 271                  break;
 272  
 273          } // end switch
 274  
 275          $externalevents = array();
 276          if (serendipity_db_bool($this->get_config('enableExtEvents', false))) {
 277              serendipity_plugin_api::hook_event('frontend_calendar', $externalevents, array('Month' => $month, 'Year' => $year,
 278                                                                                             'TS' => $ts, 'EndTS' => $endts));
 279          }
 280  
 281          // Print the calendar
 282          $currDay     = 1;
 283          $nrOfRows    = ceil(($nrOfDays+$firstDayWeekDay)/7);
 284          for ($x = 0; $x < 6; $x++) {
 285              // Break out if we are out of days
 286              if ($currDay > $nrOfDays) {
 287                  break;
 288              }
 289              // Prepare row
 290              for ($y = 0; $y < 7; $y++) {
 291                  $cellProps = array();
 292                  $printDay = '';
 293                  $link = '';
 294  
 295                  if ($x == 0) {
 296                      $cellProps['FirstRow'] = 1;
 297                  }
 298                  if ($y == 0) {
 299                      $cellProps['FirstInRow'] = 1;
 300                  }
 301                  if ($y == 6) {
 302                      $cellProps['LastInRow'] = 1;
 303                  }
 304                  if ($x == $nrOfRows-1) {
 305                      $cellProps['LastRow'] = 1;
 306                  }
 307  
 308                  // If it's not a blank day, we print the day
 309                  if (($x > 0 || $y >= $firstDayWeekDay) && $currDay <= $nrOfDays) {
 310                      $printDay = $currDay;
 311  
 312                      if ($today_day == $currDay && $today_month == $month && $today_year == $year) {
 313                          $cellProps['Today'] = 1;
 314                      }
 315  
 316                      if (isset($externalevents[$currDay])) {
 317                          if (isset($externalevents[$currDay]['Class'])) {
 318                              $cellProps[$externalevents[$currDay]['Class']] = 1;
 319                          }
 320                          if (isset($externalevents[$currDay]['Title'])) {
 321                              $cellProps['Title'] = htmlspecialchars($externalevents[$currDay]['Title']);
 322                          }
 323                          if (isset($externalevents[$currDay]['Extended'])) {
 324                              foreach($externalevents[$currDay]['Extended'] as $ext_key => $ext_val) {
 325                                  $cellProps[$ext_key] = $ext_val;
 326                              }
 327                          }
 328                      }
 329  
 330                      if (isset($activeDays[$currDay]) && $activeDays[$currDay] > 1) {
 331                          $cellProps['Active'] = 1;
 332                          $cellProps['Link']   = serendipity_archiveDateUrl(sprintf('%4d/%02d/%02d', $year, $month, $currDay) . $add_query );
 333                      }
 334                      $currDay++;
 335                  }
 336                  $smartyRows[$x]['days'][] = array('name' => $printDay,
 337                                                    'properties' => $cellProps,
 338                                                    'classes' => implode(' ', array_keys($cellProps)));
 339              } // end for
 340          } // end for
 341  
 342          $serendipity['smarty']->assign_by_ref('plugin_calendar_weeks', $smartyRows);
 343  
 344          $dow = array();
 345          for ($i = 1; $i <= 7; $i++) {
 346              $dow[] = array('date' => mktime(0, 0, 0, 3, $bow + $i - 1, 2004));
 347          }
 348          $serendipity['smarty']->assign_by_ref('plugin_calendar_dow', $dow);
 349  
 350          $plugin_calendar_data = array('month_date'   => $ts,
 351              'uri_previous' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $previousYear, $previousMonth). $add_query),
 352              'uri_month'    => serendipity_archiveDateUrl(sprintf('%04d/%02d', $year, $month) . $add_query),
 353              'uri_next'     => serendipity_archiveDateUrl(sprintf('%04d/%02d',$nextYear, $nextMonth) . $add_query),
 354              'minScroll'    => $minmax[0]['min'],
 355              'maxScroll'    => $minmax[0]['max']);
 356          $serendipity['smarty']->assign_by_ref('plugin_calendar_head', $plugin_calendar_data);
 357          echo serendipity_smarty_fetch('CALENDAR', 'plugin_calendar.tpl');
 358  
 359      } // end function
 360  } // end class
 361  
 362  class serendipity_quicksearch_plugin extends serendipity_plugin {
 363      var $title = QUICKSEARCH;
 364  
 365      function introspect(&$propbag)
 366      {
 367          $propbag->add('name',          QUICKSEARCH);
 368          $propbag->add('description',   SEARCH_FOR_ENTRY);
 369          $propbag->add('stackable',     false);
 370          $propbag->add('author',        'Serendipity Team');
 371          $propbag->add('version',       '1.0');
 372          $propbag->add('groups',        array('FRONTEND_ENTRY_RELATED'));
 373      }
 374  
 375      function generate_content(&$title)
 376      {
 377          global $serendipity;
 378  
 379          $title = $this->title;
 380  ?>
 381  <form id="searchform" action="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile']; ?>" method="get">
 382      <div>
 383          <input type="hidden"  name="serendipity[action]" value="search" />
 384          <input alt="<?php echo QUICKSEARCH; ?>" type="text"   id="serendipityQuickSearchTermField" name="serendipity[searchTerm]" size="13" />
 385      </div>
 386      <div id="LSResult" style="display: none;"><div id="LSShadow"></div></div>
 387  </form>
 388  <?php
 389          serendipity_plugin_api::hook_event('quicksearch_plugin', $serendipity);
 390      }
 391  }
 392  
 393  class serendipity_archives_plugin extends serendipity_plugin {
 394      var $title = ARCHIVES;
 395  
 396      function introspect(&$propbag)
 397      {
 398          $propbag->add('name',          ARCHIVES);
 399          $propbag->add('description',   BROWSE_ARCHIVES);
 400          $propbag->add('stackable',     true);
 401          $propbag->add('author',        'Serendipity Team');
 402          $propbag->add('version',       '1.0');
 403          $propbag->add('configuration', array('title', 'frequency', 'count', 'show_count'));
 404          $propbag->add('groups',        array('FRONTEND_VIEWS'));
 405      }
 406  
 407      function introspect_config_item($name, &$propbag)
 408      {
 409          switch($name) {
 410              case 'title':
 411                  $propbag->add('type',        'string');
 412                  $propbag->add('name',        TITLE);
 413                  $propbag->add('description', TITLE_FOR_NUGGET);
 414                  $propbag->add('default',     ARCHIVES);
 415                  break;
 416  
 417              case 'count' :
 418                  $propbag->add('type', 'string');
 419                  $propbag->add('name', ARCHIVE_COUNT);
 420                  $propbag->add('description', ARCHIVE_COUNT_DESC);
 421                  $propbag->add('default', 3);
 422                  break;
 423  
 424              case 'frequency' :
 425                  $propbag->add('type', 'select');
 426                  $propbag->add('name', ARCHIVE_FREQUENCY);
 427                  $propbag->add('select_values', array('months' => MONTHS, 'weeks' => WEEKS, 'days' => DAYS));
 428                  $propbag->add('description', ARCHIVE_FREQUENCY_DESC);
 429                  $propbag->add('default', 'months');
 430                  break;
 431  
 432              case 'show_count':
 433                  $propbag->add('type',        'boolean');
 434                  $propbag->add('name',        CATEGORY_PLUGIN_SHOWCOUNT);
 435                  $propbag->add('description', '');
 436                  $propbag->add('default',     false);
 437                  break;
 438  
 439              default:
 440                  return false;
 441          }
 442          return true;
 443      }
 444  
 445      function generate_content(&$title)
 446      {
 447          global $serendipity;
 448  
 449          $title = $this->get_config('title', $this->title);
 450  
 451          $ts = mktime(0, 0, 0, date('m'), 1);
 452  
 453          $add_query = '';
 454          if (isset($serendipity['GET']['category'])) {
 455              $base_query   = 'C' . (int)$serendipity['GET']['category'];
 456              $add_query    = '/' . $base_query;
 457          }
 458  
 459          $max_x = $this->get_config('count', 3);
 460          $show_count = serendipity_db_bool($this->get_config('show_count', false));
 461          $freq = $this->get_config('frequency', 'months');
 462  
 463          for($x = 0; $x < $max_x; $x++) {
 464              $current_ts = $ts;
 465              switch($freq) {
 466                  case 'months' :
 467                      switch($serendipity['calendar']) {
 468                          default:
 469                          case 'gregorian':
 470                              $linkStamp = date('Y/m', $ts);
 471                              $ts_title = serendipity_formatTime("%B %Y", $ts, false);
 472                              $ts = mktime(0, 0, 0, date('m', $ts)-1, 1, date('Y', $ts)); // Must be last in 'case' statement
 473                              break;
 474                          case 'persian-utf8':
 475                              require_once  S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
 476                              $linkStamp = persian_date_utf('Y/m', $ts);
 477                              $ts_title = serendipity_formatTime("%B %Y", $ts, false);
 478                              $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts)-1, 1, persian_date_utf('Y', $ts)); // Must be last in 'case' statement
 479                              break;
 480                      }
 481                      break;
 482                  case 'weeks' :
 483                      switch($serendipity['calendar']) {
 484                          default:
 485                          case 'gregorian':
 486                              $linkStamp = date('Y/\WW', $ts);
 487                              $ts_title = WEEK . ' '. date('W, Y', $ts);
 488                              $ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts)-7, date('Y', $ts));
 489                              break;
 490                          case 'persian-utf8':
 491                              require_once  S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
 492                              $linkStamp = persian_date_utf('Y/\WW', $ts);
 493                              $ts_title = WEEK . ' '. persian_date_utf('W، Y', $ts);
 494                              $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts), persian_date_utf('d', $ts)-7, persian_date_utf('Y', $ts));
 495                              break;
 496                      }
 497                      break;
 498                  case 'days' :
 499                      switch($serendipity['calendar']) {
 500                          default:
 501                          case 'gregorian':
 502                              $linkStamp = date('Y/m/d', $ts);
 503                              $ts_title = serendipity_formatTime("%B %e. %Y", $ts, false);
 504                              $ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts)-1, date('Y', $ts)); // Must be last in 'case' statement
 505                              break;
 506                          case 'persian-utf8':
 507                              require_once  S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
 508                              $linkStamp = persian_date_utf('Y/m/d', $ts);
 509                              $ts_title = serendipity_formatTime("%e %B %Y", $ts, false);
 510                              $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts), persian_date_utf('d', $ts)-1, persian_date_utf('Y', $ts)); // Must be last in 'case' statement
 511                              break;
 512                      }
 513                      break;
 514              }
 515              $link = serendipity_rewriteURL(PATH_ARCHIVES . '/' . $linkStamp . $add_query . '.html', 'serendipityHTTPPath');
 516  
 517              $html_count = '';
 518              if ($show_count) {
 519                  switch($freq) {
 520                      case 'months':
 521                          $end_ts = $current_ts + (date('t', $current_ts) * 24 * 60 * 60) - 1;
 522                          break;
 523                      case 'weeks':
 524                          $end_ts = $current_ts + (7 * 24 * 60 * 60) - 1;
 525                          break;
 526                      case 'days':
 527                          $end_ts = $current_ts + (24 * 60 * 60) - 1;
 528                          break;
 529                  }
 530  
 531                  $ec = serendipity_fetchEntries(
 532                      array($current_ts, $end_ts),
 533                      false,
 534                      '',
 535                      false,
 536                      false,
 537                      'timestamp DESC',
 538                      '',
 539                      false,
 540                      true,
 541                      'count(e.id) AS orderkey',
 542                      '',
 543                      'single'
 544                  );
 545  
 546                  if (is_array($ec)) {
 547                      if (empty($ec['orderkey'])) {
 548                          $ec['orderkey'] = '0';
 549                      }
 550                      $html_count .= ' (' . $ec['orderkey'] . ')';
 551                  }
 552              }
 553  
 554              echo '<a href="' . $link . '" title="' . $ts_title . '">' . $ts_title . $html_count . '</a><br />' . "\n";
 555  
 556          }
 557  
 558          echo '<a href="'. $serendipity['serendipityHTTPPath'] .'">' . RECENT . '</a><br />' . "\n";
 559          echo '<a href="'. serendipity_rewriteURL(PATH_ARCHIVE . $add_query) .'">' . OLDER . '</a>'. "\n";
 560      }
 561  }
 562  
 563  class serendipity_topreferrers_plugin extends serendipity_plugin {
 564      var $title = TOP_REFERRER;
 565  
 566      function introspect(&$propbag)
 567      {
 568          $propbag->add('name',          TOP_REFERRER);
 569          $propbag->add('description',   SHOWS_TOP_SITES);
 570          $propbag->add('stackable',     false);
 571          $propbag->add('author',        'Serendipity Team');
 572          $propbag->add('version',       '1.0');
 573          $propbag->add('configuration', array('limit', 'use_links', 'interval'));
 574          $propbag->add('groups',        array('STATISTICS'));
 575      }
 576  
 577      function introspect_config_item($name, &$propbag)
 578      {
 579          switch($name) {
 580              case 'limit':
 581                  $propbag->add('type',        'string');
 582                  $propbag->add('name',        LIMIT_TO_NUMBER);
 583                  $propbag->add('description', LIMIT_TO_NUMBER);
 584                  $propbag->add('default',     10);
 585                  break;
 586  
 587          case 'interval':
 588              $propbag->add('type',        'string');
 589              $propbag->add('name',        ARCHIVE_FREQUENCY);
 590          $propbag->add('description', ARCHIVE_FREQUENCY_DESC);
 591                  $propbag->add('default',     7);
 592                  break;
 593  
 594              case 'use_links':
 595                  $propbag->add('type',        'tristate');
 596                  $propbag->add('name',        INSTALL_TOP_AS_LINKS);
 597                  $propbag->add('description', INSTALL_TOP_AS_LINKS_DESC);
 598                  $propbag->add('default',     false);
 599                  break;
 600  
 601              default:
 602                  return false;
 603          }
 604          return true;
 605      }
 606  
 607      function generate_content(&$title)
 608      {
 609          global $serendipity;
 610  
 611          $title = $this->title;
 612  
 613          // get local configuration (default, true, false)
 614          $use_links = $this->get_config('use_links', 'default');
 615          // get global configuration (true, false)
 616          $global_use_link = serendipity_get_config_var('top_as_links', false, true);
 617  
 618          // if local configuration say to use global default, do so
 619          if ($use_links == 'default') {
 620              $use_links = serendipity_db_bool($global_use_link);
 621          } else {
 622              $use_links = serendipity_db_bool($use_links);
 623          }
 624  
 625          echo serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
 626      }
 627  }
 628  
 629  class serendipity_topexits_plugin extends serendipity_plugin {
 630      var $title = TOP_EXITS;
 631  
 632      function introspect(&$propbag)
 633      {
 634          $propbag->add('name',          TOP_EXITS);
 635          $propbag->add('description',   SHOWS_TOP_EXIT);
 636          $propbag->add('stackable',     false);
 637          $propbag->add('author',        'Serendipity Team');
 638          $propbag->add('version',       '1.0');
 639          $propbag->add('configuration', array('limit', 'use_links', 'interval'));
 640          $propbag->add('groups',        array('STATISTICS'));
 641      }
 642  
 643      function introspect_config_item($name, &$propbag)
 644      {
 645          switch($name) {
 646              case 'limit':
 647                  $propbag->add('type',        'string');
 648                  $propbag->add('name',        LIMIT_TO_NUMBER);
 649                  $propbag->add('description', LIMIT_TO_NUMBER);
 650                  $propbag->add('default',     10);
 651                  break;
 652  
 653              case 'interval':
 654                  $propbag->add('type',        'string');
 655                  $propbag->add('name',        ARCHIVE_FREQUENCY);
 656                  $propbag->add('description', ARCHIVE_FREQUENCY_DESC);
 657                  $propbag->add('default',     7);
 658                  break;
 659  
 660              case 'use_links':
 661                  $propbag->add('type',        'tristate');
 662                  $propbag->add('name',        INSTALL_TOP_AS_LINKS);
 663                  $propbag->add('description', INSTALL_TOP_AS_LINKS_DESC);
 664                  $propbag->add('default',     true);
 665                  break;
 666  
 667              default:
 668                  return false;
 669          }
 670          return true;
 671      }
 672  
 673      function generate_content(&$title)
 674      {
 675          global $serendipity;
 676  
 677          $title = $this->title;
 678  
 679          // get local configuration (default, true, false)
 680          $use_links = $this->get_config('use_links', 'default');
 681          // get global configuration (true, false)
 682          $global_use_link = serendipity_get_config_var('top_as_links', false, true);
 683  
 684          // if local configuration say to use global default, do so
 685          if ($use_links == 'default') {
 686              $use_links = serendipity_db_bool($global_use_link);
 687          } else {
 688              $use_links = serendipity_db_bool($use_links);
 689          }
 690  
 691          echo serendipity_displayTopExits($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
 692      }
 693  }
 694  
 695  class serendipity_syndication_plugin extends serendipity_plugin {
 696      var $title = SYNDICATE_THIS_BLOG;
 697  
 698      function introspect(&$propbag)
 699      {
 700          $propbag->add('name',          SYNDICATION);
 701          $propbag->add('description',   SHOWS_RSS_BLAHBLAH);
 702          $propbag->add('stackable',     true);
 703          $propbag->add('author',        'Serendipity Team');
 704          $propbag->add('version',       '1.4');
 705          $propbag->add('configuration', array(
 706                                          'title',
 707                                          'fullfeed',
 708                                          'show_0.91',
 709                                          'show_1.0',
 710                                          'show_2.0',
 711                                          'show_2.0c',
 712                                          'show_atom0.3',
 713                                          'show_atom1.0',
 714                                          'show_opml1.0',
 715                                          'show_feedburner',
 716                                          'seperator',
 717                                          'show_mail',
 718                                          'field_managingEditor',
 719                                          'field_webMaster',
 720                                          'field_ttl',
 721                                          'field_pubDate',
 722                                          'seperator',
 723                                          'iconURL',
 724                                          'bannerURL',
 725                                          'bannerWidth',
 726                                          'bannerHeight',
 727                                          'seperator',
 728                                          'fb_id',
 729                                          'fb_title',
 730                                          'fb_alt',
 731                                          'fb_img',
 732                                         )
 733          );
 734          $propbag->add('groups',        array('FRONTEND_VIEWS'));
 735      }
 736  
 737      function introspect_config_item($name, &$propbag)
 738      {
 739          switch($name) {
 740              case 'title':
 741                  $propbag->add('type',        'string');
 742                  $propbag->add('name',        TITLE);
 743                  $propbag->add('description', TITLE_FOR_NUGGET);
 744                  $propbag->add('default',     SYNDICATE_THIS_BLOG);
 745                  break;
 746  
 747              case 'fullfeed':
 748                  $radio['value'][] = 'false';
 749                  $radio['desc'][]  = NO;
 750  
 751                  $radio['value'][] = 'true';
 752                  $radio['desc'][]  = YES;
 753  
 754                  $radio['value'][] = 'client';
 755                  $radio['desc'][]  = 'Client';
 756  
 757                  $propbag->add('type',        'radio');
 758                  $propbag->add('name',        SYNDICATION_PLUGIN_FULLFEED);
 759                  $propbag->add('description', '');
 760                  $propbag->add('default',     false);
 761                  $propbag->add('radio_per_row', '3');
 762                  $propbag->add('radio',        $radio);
 763                  break;
 764  
 765              case 'show_0.91':
 766                  $propbag->add('type',        'boolean');
 767                  $propbag->add('name',        SYNDICATION_PLUGIN_091);
 768                  $propbag->add('description', '');
 769                  $propbag->add('default',     'true');
 770                  break;
 771  
 772              case 'show_1.0':
 773                  $propbag->add('type',        'boolean');
 774                  $propbag->add('name',        SYNDICATION_PLUGIN_10);
 775                  $propbag->add('description', '');
 776                  $propbag->add('default',     'true');
 777                  break;
 778  
 779              case 'show_2.0':
 780                  $propbag->add('type',        'boolean');
 781                  $propbag->add('name',        SYNDICATION_PLUGIN_20);
 782                  $propbag->add('description', '');
 783                  $propbag->add('default',     'true');
 784                  break;
 785  
 786              case 'show_2.0c':
 787                  $propbag->add('type',        'boolean');
 788                  $propbag->add('name',        SYNDICATION_PLUGIN_20c);
 789                  $propbag->add('description', '');
 790                  $propbag->add('default',     'true');
 791                  break;
 792  
 793              case 'show_atom0.3':
 794                  $propbag->add('type',        'boolean');
 795                  $propbag->add('name',        SYNDICATION_PLUGIN_ATOM03);
 796                  $propbag->add('description', '');
 797                  $propbag->add('default',     'false');
 798                  break;
 799  
 800              case 'show_atom1.0':
 801                  $propbag->add('type',        'boolean');
 802                  $propbag->add('name',        sprintf(SYNDICATION_PLUGIN_GENERIC_FEED, 'Atom 1.0'));
 803                  $propbag->add('description', '');
 804                  $propbag->add('default',     'true');
 805                  break;
 806  
 807              case 'show_opml1.0':
 808                  $propbag->add('type',        'boolean');
 809                  $propbag->add('name',        sprintf(SYNDICATION_PLUGIN_GENERIC_FEED, 'OPML 1.0'));
 810                  $propbag->add('description', '');
 811                  $propbag->add('default',     'false');
 812                  break;
 813  
 814              case 'show_feedburner':
 815                  $radio = array();
 816                  $radio['value'][] = 'false';
 817                  $radio['desc'][]  = NO;
 818  
 819                  $radio['value'][] = 'true';
 820                  $radio['desc'][]  = YES;
 821  
 822                  $radio['value'][] = 'force';
 823                  $radio['desc'][]  = FORCE;
 824  
 825                  $propbag->add('type',        'radio');
 826                  $propbag->add('radio_per_row', '3');
 827                  $propbag->add('radio',       $radio);
 828                  $propbag->add('name',        sprintf(SYNDICATION_PLUGIN_GENERIC_FEED, 'FeedBurner'));
 829                  $propbag->add('description', '');
 830                  $propbag->add('default',     'false');
 831                  break;
 832  
 833              case 'seperator':
 834                  $propbag->add('type',        'seperator');
 835                  break;
 836  
 837              case 'show_mail':
 838                  $propbag->add('type',        'boolean');
 839                  $propbag->add('name',        SYNDICATION_PLUGIN_SHOW_MAIL);
 840                  $propbag->add('description', '');
 841                  $propbag->add('default',     false);
 842                  break;
 843  
 844              case 'field_managingEditor':
 845                  $propbag->add('type',        'string');
 846                  $propbag->add('name',        SYNDICATION_PLUGIN_MANAGINGEDITOR);
 847                  $propbag->add('description', SYNDICATION_PLUGIN_MANAGINGEDITOR_DESC);
 848                  $propbag->add('default',     '');
 849                  break;
 850  
 851              case 'field_webMaster':
 852                  $propbag->add('type',        'string');
 853                  $propbag->add('name',        SYNDICATION_PLUGIN_WEBMASTER);
 854                  $propbag->add('description', SYNDICATION_PLUGIN_WEBMASTER_DESC);
 855                  $propbag->add('default',     '');
 856                  break;
 857  
 858              case 'field_ttl':
 859                  $propbag->add('type',        'string');
 860                  $propbag->add('name',        SYNDICATION_PLUGIN_TTL);
 861                  $propbag->add('description', SYNDICATION_PLUGIN_TTL_DESC);
 862                  $propbag->add('default',     '');
 863                  break;
 864  
 865              case 'field_pubDate':
 866                  $propbag->add('type',        'boolean');
 867                  $propbag->add('name',        SYNDICATION_PLUGIN_PUBDATE);
 868                  $propbag->add('description', SYNDICATION_PLUGIN_PUBDATE_DESC);
 869                  $propbag->add('default',     true);
 870                  break;
 871  
 872              case 'iconURL':
 873                  $propbag->add('type',        'string');
 874                  $propbag->add('name',        XML_IMAGE_TO_DISPLAY);
 875                  $propbag->add('description', '');
 876                  $propbag->add('default',     'img/xml.gif');
 877                  break;
 878  
 879              case 'bannerURL':
 880                  $propbag->add('type',        'string');
 881                  $propbag->add('name',        SYNDICATION_PLUGIN_BANNERURL);
 882                  $propbag->add('description', SYNDICATION_PLUGIN_BANNERURL_DESC);
 883                  $propbag->add('default',     '');
 884                  break;
 885  
 886              case 'bannerWidth':
 887                  $propbag->add('type',        'string');
 888                  $propbag->add('name',        SYNDICATION_PLUGIN_BANNERWIDTH);
 889                  $propbag->add('description', SYNDICATION_PLUGIN_BANNERWIDTH_DESC);
 890                  $propbag->add('default',     '');
 891                  break;
 892  
 893              case 'bannerHeight':
 894                  $propbag->add('type',        'string');
 895                  $propbag->add('name',        SYNDICATION_PLUGIN_BANNERHEIGHT);
 896                  $propbag->add('description', SYNDICATION_PLUGIN_BANNERHEIGHT_DESC);
 897                  $propbag->add('default',     '');
 898                  break;
 899  
 900              case 'fb_id':
 901                  $propbag->add('type',        'string');
 902                  $propbag->add('name',        SYNDICATION_PLUGIN_FEEDBURNERID);
 903                  $propbag->add('description', SYNDICATION_PLUGIN_FEEDBURNERID_DESC);
 904                  $propbag->add('default',     '');
 905                  break;
 906  
 907              case 'fb_img':
 908                  $propbag->add('type',        'string');
 909                  $propbag->add('name',        SYNDICATION_PLUGIN_FEEDBURNERIMG);
 910                  $propbag->add('description', SYNDICATION_PLUGIN_FEEDBURNERIMG_DESC);
 911                  $propbag->add('default',     'fbapix.gif');
 912                  break;
 913  
 914              case 'fb_title':
 915                  $propbag->add('type',        'string');
 916                  $propbag->add('name',        SYNDICATION_PLUGIN_FEEDBURNERTITLE);
 917                  $propbag->add('description', SYNDICATION_PLUGIN_FEEDBURNERTITLE_DESC);
 918                  $propbag->add('default',     '');
 919                  break;
 920  
 921              case 'fb_alt':
 922                  $propbag->add('type',        'string');
 923                  $propbag->add('name',        SYNDICATION_PLUGIN_FEEDBURNERALT);
 924                  $propbag->add('description', SYNDICATION_PLUGIN_FEEDBURNERALT_DESC);
 925                  $propbag->add('default',     '');
 926                  break;
 927  
 928  
 929              default:
 930                  return false;
 931          }
 932          return true;
 933      }
 934  
 935      function generate_content(&$title)
 936      {
 937          global $serendipity;
 938  
 939          $title = $this->get_config('title');
 940          $icon  = serendipity_getTemplateFile($this->get_config('iconURL', 'img/xml.gif'));
 941  
 942          if (serendipity_db_bool($this->get_config('show_0.91', true))) {
 943  ?>
 944          <div style="padding-bottom: 2px;">
 945              <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
 946              <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss', 'serendipityHTTPPath') ?>">RSS 0.91 feed</a>
 947          </div>
 948  <?php
 949          }
 950  
 951          if (serendipity_db_bool($this->get_config('show_1.0', true))) {
 952  ?>
 953          <div style="padding-bottom: 2px;">
 954              <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss1', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
 955              <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss1', 'serendipityHTTPPath') ?>">RSS 1.0 feed</a>
 956          </div>
 957  <?php
 958          }
 959  
 960          if (serendipity_db_bool($this->get_config('show_2.0', true))) {
 961  ?>
 962          <div style="padding-bottom: 2px;">
 963              <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss2', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
 964              <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss2', 'serendipityHTTPPath') ?>">RSS 2.0 feed</a>
 965          </div>
 966  <?php
 967          }
 968  
 969          if (serendipity_db_bool($this->get_config('show_atom0.3', true))) {
 970  ?>
 971          <div style="padding-bottom: 2px;">
 972              <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom03.xml', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="ATOM/XML" style="border: 0px" /></a>
 973              <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom03.xml', 'serendipityHTTPPath') ?>">ATOM 0.3 feed</a>
 974          </div>
 975  <?php
 976          }
 977  
 978          if (serendipity_db_bool($this->get_config('show_atom1.0', true))) {
 979  ?>
 980          <div style="padding-bottom: 2px;">
 981              <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom10.xml', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="ATOM/XML" style="border: 0px" /></a>
 982              <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom10.xml', 'serendipityHTTPPath') ?>">ATOM 1.0 feed</a>
 983          </div>
 984  <?php
 985          }
 986  
 987          if (serendipity_db_bool($this->get_config('show_2.0c', true))) {
 988  ?>
 989          <div style="padding-bottom: 2px;">
 990              <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/comments.rss2', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
 991              <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/comments.rss2', 'serendipityHTTPPath') ?>"><span style="white-space: nowrap">RSS 2.0 <?php echo COMMENTS; ?></span></a>
 992          </div>
 993  <?php
 994          }
 995  
 996          if (serendipity_db_bool($this->get_config('show_opml1.0', false))) {
 997  ?>
 998          <div style="padding-bottom: 2px;">
 999              <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/opml.xml', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
1000              <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/opml.xml', 'serendipityHTTPPath') ?>">OPML 1.0 feed</a>
1001          </div>
1002  <?php
1003          }
1004  
1005          if (serendipity_db_bool($this->get_config('show_feedburner', false)) || $this->get_config('show_feedburner', false) === 'force') {
1006              $alt = $this->get_config('fb_alt');
1007              $url = 'http://feeds.feedburner.com/' . $this->get_config('fb_id');
1008              $img = $this->get_config('fb_img');
1009              if (strlen($img) == 0) {
1010                  $img = 'http://feeds.feedburner.com/~fc/'.$this->get_config('fb_id').'?bg=99CCFF&amp;fg=444444&amp;anim=0';
1011              }
1012  ?>
1013          <div style="padding-bottom: 2px;">
1014              <a href="<?php echo $url; ?>"<?php if (strlen($alt) > 0) echo " title=\"$alt\""; ?>><img src="<?php echo $img; ?>" alt="" style="border:0"/></a>
1015              <?php
1016              $mytitle = $this->get_config('fb_title');
1017              if (strlen($mytitle) > 0) { ?>
1018              <a href="<?php echo $url; ?>"><?php echo $mytitle; ?></a>
1019              <?php } ?>
1020          </div>
1021  <?php
1022          }
1023      }
1024  
1025      function generate_rss_fields(&$title, &$description, &$entries) {
1026          global $serendipity;
1027          // Check for a logo to use for an RSS feed. Can either be set by configuring the
1028          // syndication plugin OR by just placing a rss_banner.png file in the template directory.
1029          // If both is not set, we will display our happy own branding. :-)
1030  
1031          $bag    = new serendipity_property_bag;
1032          $this->introspect($bag);
1033          $additional_fields = array();
1034  
1035          if ($this->get_config('bannerURL') != '') {
1036              $img   = $this->get_config('bannerURL');
1037              $w     = $this->get_config('bannerWidth');
1038              $h     = $this->get_config('bannerHeight');
1039          } elseif (($banner = serendipity_getTemplateFile('img/rss_banner.png', 'serendipityPath'))) {
1040              $img = serendipity_getTemplateFile('img/rss_banner.png', 'baseURL');
1041              $i = getimagesize($banner);
1042              $w = $i[0];
1043              $h = $i[1];
1044          } else {
1045              $img = serendipity_getTemplateFile('img/s9y_banner_small.png', 'baseURL');
1046              $w = 100;
1047              $h = 21;
1048          }
1049  
1050          $additional_fields['image'] = <<<IMAGE
1051  <image>
1052          <url>$img</url>
1053          <title>RSS: $title - $description</title>
1054          <link>{$serendipity['baseURL']}</link>
1055          <width>$w</width>
1056          <height>$h</height>
1057      </image>
1058  IMAGE;
1059  
1060          $additional_fields['image_atom1.0'] = <<<IMAGE
1061  <icon>$img</icon>
1062  IMAGE;
1063  
1064          $additional_fields['image_rss1.0_channel'] = '<image rdf:resource="' . $img . '" />';
1065          $additional_fields['image_rss1.0_rdf'] = <<<IMAGE
1066  <image rdf:about="$img">
1067          <url>$img</url>
1068          <title>RSS: $title - $description</title>
1069          <link>{$serendipity['baseURL']}</link>
1070          <width>$w</width>
1071          <height>$h</height>
1072      </image>
1073  IMAGE;
1074  
1075          // Now, if set, stitch together any fields that have been configured in the syndication plugin.
1076          // First, do some sanity checks
1077          $additional_fields['channel'] = '';
1078          foreach($bag->get('configuration') AS $bag_index => $bag_value) {
1079              if (preg_match('|^field_(.*)$|', $bag_value, $match)) {
1080                  $bag_content = $this->get_config($bag_value);
1081  
1082                  switch($match[1]) {
1083                      case 'pubDate':
1084                          if (serendipity_db_bool($bag_content)) {
1085                              $bag_content = gmdate('D, d M Y H:i:s \G\M\T', serendipity_serverOffsetHour($entries[0]['last_modified']));
1086                          } else {
1087                              $bag_content = '';
1088                          }
1089                          break;
1090  
1091                      // Each new RSS-field which needs rewrite of its content should get its own case here.
1092  
1093                      default:
1094                          break;
1095                  }
1096  
1097                  if ($bag_content != '') {
1098                      $additional_fields['channel'] .= '<' . $match[1] . '>' . $bag_content . '</' . $match[1] . '>' . "\n";
1099                  }
1100  
1101              }
1102          }
1103  
1104          return $additional_fields;
1105      }
1106  }
1107  
1108  class serendipity_superuser_plugin extends serendipity_plugin {
1109      var $title = SUPERUSER;
1110  
1111      function introspect(&$propbag)
1112      {
1113          $propbag->add('name',          SUPERUSER);
1114          $propbag->add('description',   ALLOWS_YOU_BLAHBLAH);
1115          $propbag->add('stackable',     false);
1116          $propbag->add('author',        'Serendipity Team');
1117          $propbag->add('version',       '1.0');
1118          $propbag->add('configuration', array('https'));
1119          $propbag->add('groups',        array('FRONTEND_FEATURES'));
1120      }
1121  
1122      function generate_content(&$title)
1123      {
1124          global $serendipity;
1125  
1126          $title = $this->title;
1127          if ($this->get_config('https', 'false') == 'true') {
1128              $base = str_replace('http://', 'https://', $serendipity['baseURL']);
1129          } else {
1130              $base = $serendipity['serendipityHTTPPath'];
1131          }
1132  
1133          $link = $base . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] .'?/' : '') . PATH_ADMIN;
1134          $text = (($_SESSION['serendipityAuthedUser'] === true) ? SUPERUSER_OPEN_ADMIN : SUPERUSER_OPEN_LOGIN);
1135          echo '<a rel="nofollow" href="' . $link . '" title="'. $text .'">'. $text .'</a>';
1136      }
1137  
1138      function introspect_config_item($name, &$propbag)
1139      {
1140          switch($name) {
1141              case 'https':
1142                  $propbag->add('type',        'boolean');
1143                  $propbag->add('name',        PLUGIN_SUPERUSER_HTTPS);
1144                  $propbag->add('description', PLUGIN_SUPERUSER_HTTPS_DESC);
1145                  $propbag->add('default',     'false');
1146                  break;
1147  
1148              default:
1149                  return false;
1150          }
1151          return true;
1152      }
1153  }
1154  
1155  class serendipity_plug_plugin extends serendipity_plugin {
1156      var $title = POWERED_BY;
1157  
1158      function introspect(&$propbag)
1159      {
1160          $propbag->add('name',          POWERED_BY);
1161          $propbag->add('description',   ADVERTISES_BLAHBLAH);
1162          $propbag->add('stackable',     true);
1163          $propbag->add('author',        'Serendipity Team');
1164          $propbag->add('version',       '1.0');
1165          $propbag->add('configuration', array(
1166                                          'image',
1167                                          'text'));
1168          $propbag->add('groups',        array('FRONTEND_VIEWS'));
1169      }
1170  
1171      function introspect_config_item($name, &$propbag)
1172      {
1173          switch($name) {
1174              case 'image':
1175                  $propbag->add('type',        'boolean');
1176                  $propbag->add('name',        POWERED_BY_SHOW_IMAGE);
1177                  $propbag->add('description', POWERED_BY_SHOW_IMAGE_DESC);
1178                  $propbag->add('default',     'true');
1179                  break;
1180  
1181              case 'text':
1182                  $propbag->add('type',        'boolean');
1183                  $propbag->add('name',        POWERED_BY_SHOW_TEXT);
1184                  $propbag->add('description', POWERED_BY_SHOW_TEXT_DESC);
1185                  $propbag->add('default',     'false');
1186                  break;
1187              default:
1188                  return false;
1189          }
1190          return true;
1191      }
1192  
1193      function generate_content(&$title)
1194      {
1195          global $serendipity;
1196  
1197          $title = $this->title;
1198  ?>
1199  <div class="serendipityPlug">
1200  <?php if ( $this->get_config('image', 'true') == 'true' ) { ?>
1201      <a title="<?php echo $title ?> Serendipity" href="http://www.s9y.org/"><img src="<?php echo serendipity_getTemplateFile('img/s9y_banner_small.png') ?>" alt="Serendipity PHP Weblog" style="border: 0px" /></a>
1202  <?php } ?>
1203  <?php if ( $this->get_config('text', 'false') == 'true' ) { ?>
1204      <div>
1205          <a title="<?php echo $title ?> Serendipity" href="http://www.s9y.org/">Serendipity PHP Weblog</a>
1206      </div>
1207  <?php } ?>
1208  </div>
1209  <?php
1210      }
1211  }
1212  
1213  class serendipity_html_nugget_plugin extends serendipity_plugin {
1214      var $title = HTML_NUGGET;
1215  
1216      function introspect(&$propbag)
1217      {
1218          $this->title = $this->get_config('title', $this->title);
1219          $subtitle    = $this->get_config('backend_title', '');
1220          if (!empty($subtitle)) {
1221              $desc    = '(' . $subtitle . ') ' . HOLDS_A_BLAHBLAH;
1222          } else {
1223              $desc        = HOLDS_A_BLAHBLAH;
1224          }
1225  
1226          $propbag->add('name',          HTML_NUGGET);
1227          $propbag->add('description',   $desc);
1228          $propbag->add('stackable',     true);
1229          $propbag->add('author',        'Serendipity Team');
1230          $propbag->add('version',       '1.0');
1231          $propbag->add('configuration', array(
1232                                          'title',
1233                                          'backend_title',
1234                                          'content',
1235                                          'markup',
1236                                          'show_where'
1237                                         )
1238          );
1239          $propbag->add('groups',        array('FRONTEND_VIEWS'));
1240  
1241          $this->protected = TRUE; // If set to TRUE, only allows the owner of the plugin to modify its configuration
1242      }
1243  
1244      function introspect_config_item($name, &$propbag)
1245      {
1246          switch($name) {
1247              case 'title':
1248                  $propbag->add('type',        'string');
1249                  $propbag->add('name',        TITLE);
1250                  $propbag->add('description', TITLE_FOR_NUGGET);
1251                  $propbag->add('default',     '');
1252                  break;
1253  
1254              case 'backend_title':
1255                  $propbag->add('type',        'string');
1256                  $propbag->add('name',        BACKEND_TITLE);
1257                  $propbag->add('description', BACKEND_TITLE_FOR_NUGGET);
1258                  $propbag->add('default',     '');
1259                  break;
1260  
1261              case 'content':
1262                  $propbag->add('type',        'html');
1263                  $propbag->add('name',        CONTENT);
1264                  $propbag->add('description', THE_NUGGET);
1265                  $propbag->add('default',     '');
1266                  break;
1267  
1268              case 'markup':
1269                  $propbag->add('type',        'boolean');
1270                  $propbag->add('name',        DO_MARKUP);
1271                  $propbag->add('description', DO_MARKUP_DESCRIPTION);
1272                  $propbag->add('default',     'true');
1273                  break;
1274  
1275              case 'show_where':
1276                  $select = array('extended' => PLUGIN_ITEM_DISPLAY_EXTENDED, 'overview' => PLUGIN_ITEM_DISPLAY_OVERVIEW, 'both' => PLUGIN_ITEM_DISPLAY_BOTH);
1277                  $propbag->add('type',        'select');
1278                  $propbag->add('select_values', $select);
1279                  $propbag->add('name',        PLUGIN_ITEM_DISPLAY);
1280                  $propbag->add('description', '');
1281                  $propbag->add('default',     'both');
1282                  break;
1283  
1284              default:
1285                  return false;
1286          }
1287          return true;
1288      }
1289  
1290      function generate_content(&$title)
1291      {
1292          global $serendipity;
1293  
1294          $title = $this->get_config('title');
1295          $show_where = $this->get_config('show_where', 'both');
1296  
1297          if ($show_where == 'extended' && (!isset($serendipity['GET']['id']) || !is_numeric($serendipity['GET']['id']))) {
1298              return false;
1299          } else if ($show_where == 'overview' && isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id'])) {
1300              return false;
1301          }
1302  
1303          if ($this->get_config('markup', 'true') == 'true') {
1304              $entry = array('html_nugget' => $this->get_config('content'));
1305              serendipity_plugin_api::hook_event('frontend_display', $entry);
1306              echo $entry['html_nugget'];
1307          } else {
1308              echo $this->get_config('content');
1309          }
1310  
1311          if (serendipity_userLoggedIn()) {
1312              $is_plugin_owner    = ($this->serendipity_owner == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'));
1313  
1314              if ($is_plugin_owner) {
1315                  echo '<div class="serendipity_edit_nugget"><a href="' . $serendipity['baseURL'] . '/serendipity_admin.php?serendipity[adminModule]=plugins&amp;serendipity[plugin_to_conf]=' . htmlentities($this->instance) . '">' . EDIT . '</a></div>';
1316              }
1317          }
1318      }
1319  }
1320  
1321  class serendipity_categories_plugin extends serendipity_plugin {
1322      var $title = CATEGORIES;
1323  
1324      function introspect(&$propbag) {
1325          global $serendipity;
1326  
1327          $propbag->add('name',        CATEGORIES);
1328          $propbag->add('description', CATEGORY_PLUGIN_DESC);
1329          $propbag->add('stackable',     true);
1330          $propbag->add('author',        'Serendipity Team');
1331          $propbag->add('version',       '2.02');
1332          $propbag->add('configuration', array('title', 'authorid', 'parent_base', 'hide_parent', 'image', 'sort_order', 'sort_method', 'allow_select', 'hide_parallel', 'show_count', 'smarty'));
1333          $propbag->add('groups',        array('FRONTEND_VIEWS'));
1334      }
1335  
1336      function introspect_config_item($name, &$propbag)
1337      {
1338          global $serendipity;
1339          switch($name) {
1340              case 'title':
1341                  $propbag->add('type',        'string');
1342                  $propbag->add('name',        TITLE);
1343                  $propbag->add('description', TITLE_FOR_NUGGET);
1344                  $propbag->add('default',     CATEGORIES);
1345                  break;
1346  
1347              case 'authorid':
1348                  $row_authors = serendipity_db_query("SELECT realname, authorid FROM {$serendipity['dbPrefix']}authors");
1349                  $authors     = array('all' => ALL_AUTHORS, 'login' => CURRENT_AUTHOR);
1350                  if (is_array($row_authors)) {
1351                      foreach($row_authors as $row) {
1352                          $authors[$row['authorid']] = $row['realname'];
1353                      }
1354                  }
1355  
1356                  $propbag->add('type',         'select');
1357                  $propbag->add('name',         CATEGORIES_TO_FETCH);
1358                  $propbag->add('description',  CATEGORIES_TO_FETCH_DESC);
1359                  $propbag->add('select_values', $authors);
1360                  $propbag->add('default',     'all');
1361                  break;
1362  
1363              case 'parent_base':
1364                  $categories = array('all' => ALL_CATEGORIES);
1365                  $cats       = serendipity_fetchCategories();
1366  
1367                  if (is_array($cats)) {
1368                      $cats = serendipity_walkRecursive($cats, 'categoryid', 'parentid', VIEWMODE_THREADED);
1369                      foreach($cats as $cat) {
1370                          $categories[$cat['categoryid']] = str_repeat(' . ', $cat['depth']) . $cat['category_name'];
1371                      }
1372                  }
1373  
1374                  $propbag->add('type',         'select');
1375                  $propbag->add('name',         CATEGORIES_PARENT_BASE);
1376                  $propbag->add('description',  CATEGORIES_PARENT_BASE_DESC);
1377                  $propbag->add('select_values', $categories);
1378                  $propbag->add('default',      'all');
1379                  break;
1380  
1381              case 'hide_parent':
1382                  $propbag->add('type',         'boolean');
1383                  $propbag->add('name',         CATEGORIES_HIDE_PARENT);
1384                  $propbag->add('description',  CATEGORIES_HIDE_PARENT_DESC);
1385                  $propbag->add('default',      false);
1386                  break;
1387  
1388              case 'hide_parallel':
1389                  $propbag->add('type',         'boolean');
1390                  $propbag->add('name',         CATEGORIES_HIDE_PARALLEL);
1391                  $propbag->add('description',  CATEGORIES_HIDE_PARALLEL_DESC);
1392                  $propbag->add('default',      false);
1393                  break;
1394  
1395              case 'allow_select':
1396                  $propbag->add('type',         'boolean');
1397                  $propbag->add('name',         CATEGORIES_ALLOW_SELECT);
1398                  $propbag->add('description',  CATEGORIES_ALLOW_SELECT_DESC);
1399                  $propbag->add('default',      true);
1400                  break;
1401  
1402              case 'sort_order':
1403                  $select = array();
1404                  $select['category_name']        = CATEGORY;
1405                  $select['category_description'] = DESCRIPTION;
1406                  $select['categoryid']           = 'ID';
1407                  $select['none']                 = NONE;
1408                  $propbag->add('type',         'select');
1409                  $propbag->add('name',         SORT_ORDER);
1410                  $propbag->add('description',  '');
1411                  $propbag->add('select_values', $select);
1412                  $propbag->add('default',     'category_name');
1413                  break;
1414  
1415              case 'sort_method':
1416                  $select = array();
1417                  $select['ASC'] = SORT_ORDER_ASC;
1418                  $select['DESC'] = SORT_ORDER_DESC;
1419                  $propbag->add('type',         'select');
1420                  $propbag->add('name',         SORT_ORDER);
1421                  $propbag->add('description',  '');
1422                  $propbag->add('select_values', $select);
1423                  $propbag->add('default',     'ASC');
1424                  break;
1425  
1426              case 'image':
1427                  $propbag->add('type',         'string');
1428                  $propbag->add('name',         XML_IMAGE_TO_DISPLAY);
1429                  $propbag->add('description',  XML_IMAGE_TO_DISPLAY_DESC);
1430                  $propbag->add('default',     serendipity_getTemplateFile('img/xml.gif'));
1431                  break;
1432  
1433              case 'smarty':
1434                  $propbag->add('type',        'boolean');
1435                  $propbag->add('name',        CATEGORY_PLUGIN_TEMPLATE);
1436                  $propbag->add('description', CATEGORY_PLUGIN_TEMPLATE_DESC);
1437                  $propbag->add('default',     false);
1438                  break;
1439  
1440              case 'show_count':
1441                  $propbag->add('type',        'boolean');
1442                  $propbag->add('name',        CATEGORY_PLUGIN_SHOWCOUNT);
1443                  $propbag->add('description', '');
1444                  $propbag->add('default',     false);
1445                  break;
1446  
1447              default:
1448                  return false;
1449          }
1450          return true;
1451      }
1452  
1453      function generate_content(&$title) {
1454          global $serendipity;
1455  
1456          $title = $this->get_config('title');
1457          $smarty = serendipity_db_bool($this->get_config('smarty', false));
1458  
1459          $which_category = $this->get_config('authorid');
1460          $sort = $this->get_config('sort_order');
1461          if ($sort == 'none') {
1462              $sort = '';
1463          } else {
1464              $sort .= ' ' . $this->get_config('sort_method');
1465          }
1466          $is_form = serendipity_db_bool($this->get_config('allow_select'));
1467          if ($which_category === "login") {
1468              $which_category = (int)$serendipity['authorid'];
1469              if ($which_category === 0) {
1470                  $which_category = -1; // Set to -1 for anonymous authors to get a proper match.
1471              }
1472          }
1473  
1474          $categories = serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category, '', $sort, 'read');
1475  
1476          $cat_count = array();
1477          if (serendipity_db_bool($this->get_config('show_count'))) {
1478              $cat_sql        = "SELECT c.categoryid, c.category_name, count(e.id) as postings
1479                                              FROM {$serendipity['dbPrefix']}entrycat ec,
1480                                                   {$serendipity['dbPrefix']}category c,
1481                                                   {$serendipity['dbPrefix']}entries e
1482                                              WHERE ec.categoryid = c.categoryid
1483                                                AND ec.entryid = e.id
1484                                                AND e.isdraft = 'false'
1485                                                    " . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e.timestamp  <= " . serendipity_db_time() : '') . "
1486                                              GROUP BY c.categoryid, c.category_name
1487                                              ORDER BY postings DESC";
1488              $category_rows  = serendipity_db_query($cat_sql);
1489              if (is_array($category_rows)) {
1490                  foreach($category_rows AS $cat) {
1491                      $cat_count[$cat['categoryid']] = $cat['postings'];
1492                  }
1493              }
1494  
1495          }
1496  
1497          $html       = '';
1498  
1499          if (!$smarty && $is_form) {
1500              $html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage" method="post">
1501                <div id="serendipity_category_form_content">';
1502          }
1503          if (!$smarty) {
1504              $html .= '<ul id="serendipity_categories_list" style="list-style: none; margin: 0px; padding: 0px">';
1505          }
1506  
1507          $image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
1508          $image = (($image == "'none'" || $image == 'none') ? '' : $image);
1509  
1510          $use_parent  = $this->get_config('parent_base');
1511          $hide_parent = serendipity_db_bool($this->get_config('hide_parent'));
1512          $parentdepth = 0;
1513  
1514          $hide_parallel = serendipity_db_bool($this->get_config('hide_parallel'));
1515          $hidedepth     = 0;
1516  
1517          if (is_array($categories) && count($categories)) {
1518              $categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
1519              foreach ($categories as $cid => $cat) {
1520                  // Hide parents not wanted
1521                  if ($use_parent && $use_parent != 'all') {
1522                      if ($parentdepth == 0 && $cat['parentid'] != $use_parent && $cat['categoryid'] != $use_parent) {
1523                          unset($categories[$cid]);
1524                          continue;
1525                      } else {
1526                          if ($hide_parent && $cat['categoryid'] == $use_parent) {
1527                              unset($categories[$cid]);
1528                              continue;
1529                          }
1530  
1531                          if ($cat['depth'] < $parentdepth) {
1532                              $parentdepth = 0;
1533                              unset($categories[$cid]);
1534                              continue;
1535                          }
1536  
1537                          if ($parentdepth == 0) {
1538                              $parentdepth = $cat['depth'];
1539                          }
1540                      }
1541                  }
1542  
1543                  // Hide parents outside of our tree
1544                  if ($hide_parallel && $serendipity['GET']['category']) {
1545                      if ($hidedepth == 0 && $cat['parentid'] != $serendipity['GET']['category'] && $cat['categoryid'] != $serendipity['GET']['category']) {
1546                          continue;
1547                      } else {
1548                          if ($cat['depth'] < $hidedepth) {
1549                              $hidedepth = 0;
1550                              unset($categories[$cid]);
1551                              continue;
1552                          }
1553  
1554                          if ($hidedepth == 0) {
1555                              $hidedepth = $cat['depth'];
1556                          }
1557                      }
1558                  }
1559  
1560                  $categories[$cid]['feedCategoryURL'] = serendipity_feedCategoryURL($cat, 'serendipityHTTPPath');
1561                  $categories[$cid]['categoryURL']     = serendipity_categoryURL($cat, 'serendipityHTTPPath');
1562                  $categories[$cid]['paddingPx']       = $cat['depth']*6;
1563  
1564                  if (!empty($cat_count[$cat['categoryid']])) {
1565                      $categories[$cid]['true_category_name'] = $cat['category_name'];
1566                      $categories[$cid]['category_name'] .= ' (' . $cat_count[$cat['categoryid']] . ')';
1567                  }
1568  
1569                  if (!$smarty) {
1570                      $html .= '<li style="display: block;">';
1571  
1572                      if ($is_form) {
1573                          $html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiCat][]" value="' . $cat['categoryid'] . '" />';
1574                      }
1575  
1576                      if ( !empty($image) ) {
1577                          $html .= '<a class="serendipity_xml_icon" href="'. $categories[$cid]['feedCategoryURL'] .'"><img src="'. $image .'" alt="XML" style="border: 0px" /></a> ';
1578                      }
1579                      $html .= '<a href="'. $categories[$cid]['categoryURL'] .'" title="'. htmlspecialchars($cat['category_description']) .'" style="padding-left: '. $categories[$cid]['paddingPx'] .'px">'. htmlspecialchars($categories[$cid]['category_name']) .'</a>';
1580                      $html .= '</li>' . "\n";
1581                  }
1582              }
1583          }
1584  
1585          if (!$smarty) {
1586              $html .= '</ul>';
1587          }
1588  
1589          if (!$smarty && $is_form) {
1590              $html .= '<div class="category_submit"><br /><input type="submit" name="serendipity[isMultiCat]" value="' . GO . '" /></div>';
1591          }
1592  
1593          if (!$smarty) {
1594              $html .= sprintf(
1595                  '<div class="category_link_all"><br /><a href="%s" title="%s">%s</a></div>',
1596  
1597                  $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?frontpage',
1598                  ALL_CATEGORIES,
1599                  ALL_CATEGORIES
1600              );
1601          }
1602  
1603          if (!$smarty && $is_form) {
1604              $html .= '</div></form>';
1605          }
1606  
1607          if (!$smarty) {
1608              echo $html;
1609          } else {
1610              $plugin_categories_data = array(
1611                  'is_form'           => $is_form,
1612                  'category_image'    => $image,
1613                  'form_url'          => $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage',
1614                  'categories'        => is_array($categories) ? $categories : array()
1615              );
1616              $serendipity['smarty']->assign($plugin_categories_data);
1617              echo serendipity_smarty_fetch('CATEGORIES', 'plugin_categories.tpl');
1618          }
1619      }
1620  }
1621  
1622  class serendipity_authors_plugin extends serendipity_plugin {
1623      var $title = AUTHORS;
1624  
1625      function introspect(&$propbag) {
1626          global $serendipity;
1627  
1628          $propbag->add('name',        AUTHORS);
1629          $propbag->add('description', AUTHOR_PLUGIN_DESC);
1630          $propbag->add('stackable',     true);
1631          $propbag->add('author',        'Serendipity Team');
1632          $propbag->add('version',       '2.01');
1633          $propbag->add('configuration', array('image', 'allow_select', 'title', 'showartcount', 'mincount'));
1634          $propbag->add('groups',        array('FRONTEND_VIEWS'));
1635      }
1636  
1637      function introspect_config_item($name, &$propbag)
1638      {
1639          global $serendipity;
1640          switch($name) {
1641              case 'title':
1642                  $propbag->add('type',          'string');
1643                  $propbag->add('name',          TITLE);
1644                  $propbag->add('description',   TITLE);
1645                  $propbag->add('default',       AUTHORS);
1646                  break;
1647  
1648              case 'allow_select':
1649                  $propbag->add('type',         'boolean');
1650                  $propbag->add('name',         AUTHORS_ALLOW_SELECT);
1651                  $propbag->add('description',  AUTHORS_ALLOW_SELECT_DESC);
1652                  $propbag->add('default',      true);
1653                  break;
1654  
1655              case 'image':
1656                  $propbag->add('type',         'string');
1657                  $propbag->add('name',         XML_IMAGE_TO_DISPLAY);
1658                  $propbag->add('description',  XML_IMAGE_TO_DISPLAY_DESC);
1659                  $propbag->add('default',     serendipity_getTemplateFile('img/xml.gif'));
1660                  break;
1661  
1662              case 'showartcount':
1663                  $propbag->add('type',         'boolean');
1664                  $propbag->add('name',         AUTHORS_SHOW_ARTICLE_COUNT);
1665                  $propbag->add('description',  AUTHORS_SHOW_ARTICLE_COUNT_DESC);
1666                  $propbag->add('default',      false);
1667                  break;
1668  
1669              case 'mincount':
1670                  $propbag->add('type',         'string');
1671                  $propbag->add('name',         PLUGIN_AUTHORS_MINCOUNT);
1672                  $propbag->add('description',  '');
1673                  $propbag->add('default',      '');
1674                  break;
1675  
1676              default:
1677                  return false;
1678          }
1679          return true;
1680      }
1681  
1682      function generate_content(&$title) {
1683          global $serendipity;
1684  
1685          $title = $this->get_config('title', $this->title);
1686  
1687          $sort = $this->get_config('sort_order');
1688          if ($sort == 'none') {
1689              $sort = '';
1690          } else {
1691              $sort .= ' ' . $this->get_config('sort_method');
1692          }
1693          $is_form  = serendipity_db_bool($this->get_config('allow_select'));
1694          $is_count = serendipity_db_bool($this->get_config('showartcount'));
1695          $mincount = (int)$this->get_config('mincount');
1696          $authors  = serendipity_fetchUsers(null, null, $is_count);
1697          $html       = '';
1698  
1699          if ($is_form) {
1700              $html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage" method="post"><div>';
1701          }
1702  
1703          $image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
1704          $image = (($image == "'none'" || $image == 'none') ? '' : $image);
1705  
1706          if (is_array($authors) && count($authors)) {
1707              foreach ($authors as $auth) {
1708  
1709                  if ($is_count) {
1710                      if ($auth['artcount'] < $mincount) {
1711                          continue;
1712                      }
1713                      $entrycount = " ({$auth['artcount']})";
1714                  } else {
1715                      $entrycount = "";
1716                  }
1717  
1718                  $html .= '<div style="padding-bottom: 2px;">';
1719  
1720                  if ($is_form) {
1721                      $html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiAuth][]" value="' . $auth['authorid'] . '" />';
1722                  }
1723  
1724                  if ( !empty($image) ) {
1725                      $html .= '<a class="serendipity_xml_icon" href="'. serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') .'"><img src="'. $image .'" alt="XML" style="border: 0px" /></a> ';
1726                  }
1727                  $html .= '<a href="'. serendipity_authorURL($auth, 'serendipityHTTPPath') .'" title="'. htmlspecialchars($auth['realname']) .'">'. htmlspecialchars($auth['realname']) . $entrycount . '</a>';
1728                  $html .= '</div>' . "\n";
1729              }
1730          }
1731  
1732          if ($is_form) {
1733              $html .= '<br /><input type="submit" name="serendipity[isMultiAuth]" value="' . GO . '" /><br />';
1734          }
1735  
1736          $html .= sprintf(
1737              '<br /><a href="%s" title="%s">%s</a>',
1738  
1739              $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'],
1740              ALL_AUTHORS,
1741              ALL_AUTHORS
1742          );
1743  
1744          if ($is_form) {
1745              $html .= '</div></form>';
1746          }
1747          print $html;
1748      }
1749  }
1750  
1751  /* vim: set sts=4 ts=4 expandtab : */


Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics