[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_plugins/list_new/ -> list_class.php (source)

   1  <?php
   2  /*
   3  +---------------------------------------------------------------+
   4  |       e107 website system
   5  |
   6  |       ©Steve Dunstan 2001-2002
   7  |       http://e107.org
   8  |       jalist@e107.org
   9  |
  10  |       Released under the terms and conditions of the
  11  |       GNU General Public License (http://gnu.org).
  12  |
  13  |        $Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list_class.php,v $
  14  |        $Revision: 1.14 $
  15  |        $Date: 2006/12/31 15:06:59 $
  16  |        $Author: e107coders $
  17  +---------------------------------------------------------------+
  18  */
  19  if (!defined('e107_INIT')) { exit; }
  20  
  21  global $sql, $rc, $list_pref, $sc_style, $tp, $list_shortcodes, $defaultarray;
  22  
  23  global $LIST_PAGE_NEW, $LIST_PAGE_RECENT, $LIST_MENU_NEW, $LIST_MENU_RECENT, $LIST_PAGE_NEW_START, $LIST_PAGE_RECENT_START, $LIST_MENU_NEW_START, $LIST_MENU_RECENT_START, $LIST_PAGE_NEW_END, $LIST_PAGE_RECENT_END, $LIST_MENU_NEW_END, $LIST_MENU_RECENT_END;
  24  global $LIST_ICON, $LIST_DATE, $LIST_HEADING, $LIST_AUTHOR, $LIST_CATEGORY, $LIST_INFO;
  25  global $LIST_DISPLAYSTYLE, $LIST_CAPTION, $LIST_STYLE_CAPTION, $LIST_STYLE_BODY;
  26  
  27  $listplugindir = e_PLUGIN."list_new/";
  28  
  29  //default sections (present in this list plugin)
  30  $defaultarray = array("news", "comment", "download", "members");
  31  
  32  //get language file
  33  $lan_file = $listplugindir."languages/".e_LANGUAGE.".php";
  34  include_once(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
  35  
  36  if (file_exists(THEME."list_template.php")) {
  37      require_once (THEME."list_template.php");
  38  } else {
  39      require_once ($listplugindir."list_template.php");
  40  }
  41  
  42  
  43  class listclass {
  44  
  45  	function getListPrefs()
  46      {
  47          global $sql,$eArrayStorage;
  48  
  49          //check preferences from database
  50          if (!is_object($sql)){ $sql = new db; }  
  51          $num_rows = $sql -> db_Select("core", "*", "e107_name='list' ");
  52          $row = $sql -> db_Fetch();
  53  
  54          //insert default preferences
  55          if (empty($row['e107_value'])) {
  56  
  57              $this -> getSections();
  58              $list_pref = $this -> getDefaultPrefs();
  59              $tmp = $eArrayStorage->WriteArray($list_pref);
  60  
  61              $sql -> db_Insert("core", "'list', '$tmp' ");
  62              $sql -> db_Select("core", "*", "e107_name='list' ");
  63          }
  64  
  65          $list_pref = $eArrayStorage->ReadArray($row['e107_value']);
  66          return $list_pref;
  67      }
  68  
  69  	function prepareSection($mode){
  70          global $list_pref;
  71  
  72          $len = strlen($mode) + 9;
  73          //get all sections to use
  74          foreach ($list_pref as $key => $value) {
  75              if(substr($key,-$len) == "_{$mode}_display" && $value == "1"){
  76                  $sections[] = substr($key,0,-$len);
  77              }
  78          }
  79  
  80          return $sections;
  81      }
  82  
  83  	function prepareSectionArray($mode, $sections){
  84          global $list_pref;
  85  
  86          //section reference
  87          for($i=0;$i<count($sections);$i++){
  88              if(isset($list_pref[$sections[$i]."_".$mode."_display"]) && $list_pref[$sections[$i]."_".$mode."_display"] == "1"){
  89                  $arr[$sections[$i]][0] = (isset($list_pref[$sections[$i]."_".$mode."_caption"]) ? $list_pref[$sections[$i]."_".$mode."_caption"] : "");
  90                  $arr[$sections[$i]][1] = (isset($list_pref[$sections[$i]."_".$mode."_display"]) ? $list_pref[$sections[$i]."_".$mode."_display"] : "");
  91                  $arr[$sections[$i]][2] = (isset($list_pref[$sections[$i]."_".$mode."_open"]) ? $list_pref[$sections[$i]."_".$mode."_open"] : "");
  92                  $arr[$sections[$i]][3] = (isset($list_pref[$sections[$i]."_".$mode."_author"]) ? $list_pref[$sections[$i]."_".$mode."_author"] : "");
  93                  $arr[$sections[$i]][4] = (isset($list_pref[$sections[$i]."_".$mode."_category"]) ? $list_pref[$sections[$i]."_".$mode."_category"] : "");
  94                  $arr[$sections[$i]][5] = (isset($list_pref[$sections[$i]."_".$mode."_date"]) ? $list_pref[$sections[$i]."_".$mode."_date"] : "");
  95                  $arr[$sections[$i]][6] = (isset($list_pref[$sections[$i]."_".$mode."_icon"]) ? $list_pref[$sections[$i]."_".$mode."_icon"] : "");
  96                  $arr[$sections[$i]][7] = (isset($list_pref[$sections[$i]."_".$mode."_amount"]) ? $list_pref[$sections[$i]."_".$mode."_amount"] : "");
  97                  $arr[$sections[$i]][8] = (isset($list_pref[$sections[$i]."_".$mode."_order"]) ? $list_pref[$sections[$i]."_".$mode."_order"] : "");
  98                  $arr[$sections[$i]][9] = $sections[$i];
  99              }
 100          }
 101          //sort array on order values set in preferences
 102          usort($arr, create_function('$e,$f','return $e[8]==$f[8]?0:($e[8]>$f[8]?1:-1);'));
 103  
 104          return $arr;
 105      }
 106  
 107  	function getDefaultSections(){
 108          global $sql, $sections, $titles, $defaultarray;
 109  
 110          //default always present sections
 111          for($i=0;$i<count($defaultarray);$i++){
 112              $sections[] = $defaultarray[$i];
 113              $titles[] = $defaultarray[$i];
 114          }
 115          return;
 116      }
 117  
 118      //content needs this to split each main parent into separate sections
 119  	function getContentSections($mode)
 120      {
 121          global $sql, $sections, $titles, $content_types, $content_name;
 122  
 123          if(!$content_install = $sql -> db_Select("plugin", "plugin_id", "plugin_path = 'content' AND plugin_installflag = '1' ")){
 124              return;
 125          }
 126          $datequery = " AND (content_datestamp=0 || content_datestamp < ".time().") AND (content_enddate=0 || content_enddate>".time().") ";
 127  
 128          //get main parent types
 129          if($mainparents = $sql -> db_Select("pcontent", "content_id, content_heading", "content_parent = '0' ".$datequery." ORDER BY content_heading"))
 130          {
 131              while($row = $sql -> db_Fetch())
 132              {
 133                  $content_types[] = "content_".$row['content_id'];
 134                  $content_name = 'content';
 135                  if($mode == "add")
 136                  {
 137                      $sections[] = "content_".$row['content_id'];
 138                      $titles[] = $content_name." : ".$row['content_heading'];
 139                  }
 140              }
 141          }        
 142          $content_types = array_unique($content_types);
 143  
 144          return;
 145      }
 146  
 147  	function getSections()
 148      {
 149          global $sql, $sections, $titles;
 150  
 151          $this -> getDefaultSections();
 152  
 153          require_once(e_HANDLER."file_class.php");
 154          $fl = new e_file;
 155          $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', '.bak');
 156          $iconlist = $fl->get_files(e_PLUGIN, "e_list\.php$", "standard", 1);
 157          foreach($iconlist as $icon)
 158          {
 159              $tmp = explode("/", $icon['path']);
 160              $tmp = array_reverse($tmp);
 161              $icon['fname'] = $tmp[1];
 162  
 163              if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$icon['fname']."' AND plugin_installflag = '1' "))
 164              {
 165                  if($icon['fname'] == "content")
 166                  {
 167                      $this -> getContentSections("add");
 168                  }
 169                  else
 170                  {
 171                      $sections[] = $icon['fname'];
 172                      $titles[] = $icon['fname'];
 173                  }
 174              }
 175          }
 176          return;
 177      }
 178  
 179  	function getDefaultPrefs()
 180      {
 181          global $sql, $sections, $titles, $defaultarray, $content_types, $tp;
 182  
 183          //section preferences
 184          for($i=0;$i<count($sections);$i++)
 185          {
 186              if(!in_array($sections[$i], $defaultarray))
 187              {
 188                  if(!in_array($sections[$i], $content_types))
 189                  {
 190                      if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($sections[$i], true)."' AND plugin_installflag = '1' "))
 191                      {
 192                          $list_pref["$sections[$i]_recent_menu_caption"]    = $sections[$i];
 193                          $list_pref["$sections[$i]_recent_page_caption"]    = $sections[$i];
 194                          $list_pref["$sections[$i]_new_menu_caption"]    = $sections[$i];
 195                          $list_pref["$sections[$i]_new_page_caption"]    = $sections[$i];
 196                      }
 197                  }
 198                  else
 199                  {
 200                      $list_pref["$sections[$i]_recent_menu_caption"]    = $titles[$i];
 201                      $list_pref["$sections[$i]_recent_page_caption"]    = $titles[$i];
 202                      $list_pref["$sections[$i]_new_menu_caption"]    = $titles[$i];
 203                      $list_pref["$sections[$i]_new_page_caption"]    = $titles[$i];
 204                  }
 205              }
 206              else
 207              {
 208                  $list_pref["$sections[$i]_recent_menu_caption"]    = $sections[$i];
 209                  $list_pref["$sections[$i]_recent_page_caption"]    = $sections[$i];
 210                  $list_pref["$sections[$i]_new_menu_caption"]    = $sections[$i];
 211                  $list_pref["$sections[$i]_new_page_caption"]    = $sections[$i];
 212              }
 213  
 214              $list_pref["$sections[$i]_recent_menu_display"]        = "1";
 215              $list_pref["$sections[$i]_recent_menu_open"]        = "0";
 216              $list_pref["$sections[$i]_recent_menu_author"]        = "0";
 217              $list_pref["$sections[$i]_recent_menu_category"]    = "0";
 218              $list_pref["$sections[$i]_recent_menu_date"]        = "1";
 219              $list_pref["$sections[$i]_recent_menu_amount"]        = "5";
 220              $list_pref["$sections[$i]_recent_menu_order"]        = ($i+1);
 221              $list_pref["$sections[$i]_recent_menu_icon"]        = "";
 222  
 223              $list_pref["$sections[$i]_recent_page_display"]        = "1";
 224              $list_pref["$sections[$i]_recent_page_open"]        = "1";
 225              $list_pref["$sections[$i]_recent_page_author"]        = "1";
 226              $list_pref["$sections[$i]_recent_page_category"]    = "1";
 227              $list_pref["$sections[$i]_recent_page_date"]        = "1";
 228              $list_pref["$sections[$i]_recent_page_amount"]        = "10";
 229              $list_pref["$sections[$i]_recent_page_order"]        = ($i+1);
 230              $list_pref["$sections[$i]_recent_page_icon"]        = "1";
 231  
 232              $list_pref["$sections[$i]_new_menu_display"]        = "1";
 233              $list_pref["$sections[$i]_new_menu_open"]            = "0";
 234              $list_pref["$sections[$i]_new_menu_author"]            = "0";
 235              $list_pref["$sections[$i]_new_menu_category"]        = "0";
 236              $list_pref["$sections[$i]_new_menu_date"]            = "1";
 237              $list_pref["$sections[$i]_new_menu_amount"]            = "5";
 238              $list_pref["$sections[$i]_new_menu_order"]            = ($i+1);
 239              $list_pref["$sections[$i]_new_menu_icon"]            = "1";
 240  
 241              $list_pref["$sections[$i]_new_page_display"]        = "1";
 242              $list_pref["$sections[$i]_new_page_open"]            = "1";
 243              $list_pref["$sections[$i]_new_page_author"]            = "1";
 244              $list_pref["$sections[$i]_new_page_category"]        = "1";
 245              $list_pref["$sections[$i]_new_page_date"]            = "1";
 246              $list_pref["$sections[$i]_new_page_amount"]            = "10";
 247              $list_pref["$sections[$i]_new_page_order"]            = ($i+1);
 248              $list_pref["$sections[$i]_new_page_icon"]            = "1";
 249          }
 250          
 251          //new menu preferences
 252          $list_pref['new_menu_caption']                = LIST_ADMIN_15;
 253          $list_pref['new_menu_icon_use']                = "1";
 254          $list_pref['new_menu_icon_default']            = "1";
 255          $list_pref['new_menu_char_heading']            = "20";
 256          $list_pref['new_menu_char_postfix']            = "...";
 257          $list_pref['new_menu_datestyle']            = "%d %b";
 258          $list_pref['new_menu_datestyletoday']        = "%H:%M";
 259          $list_pref['new_menu_showempty']            = "1";
 260          $list_pref['new_menu_openifrecords']        = "";
 261  
 262          //new page preferences
 263          $list_pref['new_page_caption']                = LIST_ADMIN_15;
 264          $list_pref['new_page_icon_use']                = "1";
 265          $list_pref['new_page_icon_default']            = "1";
 266          $list_pref['new_page_char_heading']            = "";
 267          $list_pref['new_page_char_postfix']            = "";
 268          $list_pref['new_page_datestyle']            = "%d %b";
 269          $list_pref['new_page_datestyletoday']        = "%H:%M";
 270          $list_pref['new_page_showempty']            = "1";
 271          $list_pref['new_page_colomn']                = "1";
 272          $list_pref['new_page_welcometext']            = LIST_ADMIN_16;
 273          $list_pref['new_page_timelapse']            = "1";
 274          $list_pref['new_page_timelapse_days']        = "30";
 275          $list_pref['new_page_openifrecords']        = "";
 276  
 277          //recent menu preferences
 278          $list_pref['recent_menu_caption']            = LIST_ADMIN_14;
 279          $list_pref['recent_menu_icon_use']            = "1";
 280          $list_pref['recent_menu_icon_default']        = "1";
 281          $list_pref['recent_menu_char_heading']        = "20";
 282          $list_pref['recent_menu_char_postfix']        = "...";
 283          $list_pref['recent_menu_datestyle']            = "%d %b";
 284          $list_pref['recent_menu_datestyletoday']    = "%H:%M";
 285          $list_pref['recent_menu_showempty']            = "";
 286          $list_pref['recent_menu_openifrecords']        = "";
 287  
 288          //recent page preferences
 289          $list_pref['recent_page_caption']            = LIST_ADMIN_14;
 290          $list_pref['recent_page_icon_use']            = "1";
 291          $list_pref['recent_page_icon_default']        = "1";
 292          $list_pref['recent_page_char_heading']        = "";
 293          $list_pref['recent_page_char_postfix']        = "";
 294          $list_pref['recent_page_datestyle']            = "%d %b";
 295          $list_pref['recent_page_datestyletoday']    = "%H:%M";
 296          $list_pref['recent_page_showempty']            = "";
 297          $list_pref['recent_page_colomn']            = "1";
 298          $list_pref['recent_page_welcometext']        = LIST_ADMIN_13;
 299          $list_pref['recent_page_openifrecords']        = "";
 300  
 301          return $list_pref;
 302      }
 303  
 304  	function show_section_list($arr, $mode, $max="")
 305      {
 306          global $tp, $listplugindir, $list_shortcodes, $sql, $list_pref, $defaultarray, $content_types, $content_name;
 307          global $LIST_ICON, $LIST_DATE, $LIST_HEADING, $LIST_AUTHOR, $LIST_CATEGORY, $LIST_INFO;
 308          global $LIST_DISPLAYSTYLE, $LIST_CAPTION, $LIST_STYLE_CAPTION, $LIST_STYLE_BODY;
 309          global $LIST_PAGE_NEW, $LIST_PAGE_RECENT, $LIST_MENU_NEW, $LIST_MENU_RECENT, $LIST_PAGE_NEW_START, $LIST_PAGE_RECENT_START, $LIST_MENU_NEW_START, $LIST_MENU_RECENT_START, $LIST_PAGE_NEW_END, $LIST_PAGE_RECENT_END, $LIST_MENU_NEW_END, $LIST_MENU_RECENT_END;
 310  
 311          $menu_installed = $sql -> db_Select("menus", "menu_id", "(menu_name = 'list_new_menu' || menu_name = 'list_recent_menu') AND menu_location != '0' AND menu_class REGEXP '".e_CLASS_REGEXP."' ");
 312          $LIST_DATA = "";
 313          $LIST_CAPTION = "";
 314  
 315          $this -> getContentSections("");
 316  
 317          //require is needed here instead of require_once, since both the menu and the page could be visible at the same time
 318          if(is_array($content_types) && in_array($arr[9], $content_types))
 319          {
 320              $file = $content_name;
 321              if(file_exists(e_PLUGIN.$file."/e_list.php"))
 322              {
 323                  global $contentmode;
 324                  $contentmode = $arr[9];
 325                  require(e_PLUGIN.$file."/e_list.php");
 326              }
 327          }
 328          else
 329          {
 330              $file = $arr[9];
 331              if(in_array($file, $defaultarray))
 332              {
 333                  require($listplugindir."section/list_".$file.".php");
 334              }
 335              else
 336              {
 337                  if(file_exists(e_PLUGIN.$file."/e_list.php"))
 338                  {
 339                      require(e_PLUGIN.$file."/e_list.php");
 340                  }
 341              }
 342          }
 343          $menutext = "";
 344          $start = "";
 345          $end = "";
 346          
 347          $LIST_ICON = "";
 348          $LIST_DATE = "";
 349          $LIST_HEADING = "";
 350          $LIST_AUTHOR = "";
 351          $LIST_CATEGORY = "";
 352          $LIST_INFO = "";
 353          //$LIST_CAPTION = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : "");
 354          //$LIST_CAPTION = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : "");
 355          //echo $list_pref["$arr_{$mode}_caption"];
 356  
 357          if(is_array($LIST_DATA)){            //if it is an array, data exists and data is not empty
 358              for($i=0;$i<count($LIST_DATA[$mode]);$i++)
 359              {                
 360                  $LIST_ICON        = $LIST_DATA[$mode][$i][0];
 361                  $LIST_HEADING    = $LIST_DATA[$mode][$i][1];
 362                  $LIST_AUTHOR    = $LIST_DATA[$mode][$i][2];
 363                  $LIST_CATEGORY    = $LIST_DATA[$mode][$i][3];
 364                  $LIST_DATE        = $LIST_DATA[$mode][$i][4];
 365                  $LIST_INFO        = $LIST_DATA[$mode][$i][5];
 366                  
 367                  if($mode == "recent_menu"){
 368                      global $sc_style;
 369                      $LIST_AUTHOR    = ($LIST_AUTHOR ? $sc_style['LIST_AUTHOR']['pre'].$LIST_AUTHOR.$sc_style['LIST_AUTHOR']['post'] : "");                    
 370                      $LIST_CATEGORY    = ($LIST_CATEGORY ? $sc_style['LIST_CATEGORY']['pre'].$LIST_CATEGORY.$sc_style['LIST_CATEGORY']['post'] : "");                    
 371                      $menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT);
 372                  
 373                  }elseif($mode == "new_menu"){
 374                      global $sc_style;
 375                      $LIST_AUTHOR    = ($LIST_AUTHOR ? $sc_style['LIST_AUTHOR']['pre'].$LIST_AUTHOR.$sc_style['LIST_AUTHOR']['post'] : "");                    
 376                      $LIST_CATEGORY    = ($LIST_CATEGORY ? $sc_style['LIST_CATEGORY']['pre'].$LIST_CATEGORY.$sc_style['LIST_CATEGORY']['post'] : "");                    
 377                      $menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW);
 378                  
 379                  }elseif($mode == "recent_page"){
 380                      $menutext .= $tp -> parseTemplate($LIST_PAGE_RECENT, FALSE, $list_shortcodes);
 381                  
 382                  }elseif($mode == "new_page"){
 383                      $menutext .= $tp -> parseTemplate($LIST_PAGE_NEW, FALSE, $list_shortcodes);
 384                  }
 385              }
 386          }elseif(!is_array($LIST_DATA) && $LIST_DATA != ""){
 387              $LIST_HEADING = $LIST_DATA;
 388              if($mode == "recent_menu"){
 389                  if($list_pref[$mode."_showempty"]){
 390                      $menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT);
 391                  }
 392              }elseif($mode == "new_menu"){
 393                  if($list_pref[$mode."_showempty"]){
 394                      $menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW);
 395                  }
 396              }elseif($mode == "recent_page"){
 397                  if($list_pref[$mode."_showempty"]){
 398                      $menutext .= $tp -> parseTemplate($LIST_PAGE_RECENT, FALSE, $list_shortcodes);
 399                  }
 400              }elseif($mode == "new_page"){
 401                  if($list_pref[$mode."_showempty"]){
 402                      $menutext .= $tp -> parseTemplate($LIST_PAGE_NEW, FALSE, $list_shortcodes);
 403                  }
 404  
 405              }
 406          }
 407  
 408          if($LIST_DATA != ""){
 409  
 410              //open sections if content exists ? yes if true, else use individual setting of section
 411              $LIST_DISPLAYSTYLE = ($list_pref[$mode."_openifrecords"] ? "" : $LIST_DISPLAYSTYLE);
 412  
 413              if($mode == "recent_menu"){
 414                  if($list_pref[$mode."_showempty"] || $menutext){
 415                      $start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT_START);
 416                      $end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT_END);
 417                  }
 418              
 419              }elseif($mode == "new_menu"){
 420                  if($list_pref[$mode."_showempty"] || $menutext){
 421                      $start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW_START);
 422                      $end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW_END);
 423                  }
 424              
 425              }elseif($mode == "recent_page"){
 426                  if($list_pref[$mode."_showempty"] || $menutext){
 427                      $start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_RECENT_START);
 428                      $end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_RECENT_END);
 429                  }
 430  
 431              }elseif($mode == "new_page"){
 432                  if($list_pref[$mode."_showempty"] || $menutext){
 433                      $start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_NEW_START);
 434                      $end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_NEW_END);
 435                  }
 436              }
 437              $text = $start.$menutext.$end;
 438          }else{
 439              $text = "";
 440          }
 441          return $text;
 442      }
 443  
 444  	function getlvisit(){
 445          global $qs, $list_pref;
 446  
 447          if(isset($qs[0]) && $qs[0] == "new"){
 448              if(isset($list_pref['new_page_timelapse']) && $list_pref['new_page_timelapse']){
 449                  if(isset($list_pref['new_page_timelapse_days']) && is_numeric($list_pref['new_page_timelapse_days']) && $list_pref['new_page_timelapse_days']){
 450                      $days = $list_pref['new_page_timelapse_days'];
 451                  }else{
 452                      $days = "30";
 453                  }
 454                  if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days){
 455                      $lvisit = time()-$qs[1]*86400;
 456                  }else{
 457                      $lvisit = USERLV;
 458                  }
 459              }else{
 460                  $lvisit = USERLV;
 461              }
 462          }else{
 463              $lvisit = USERLV;
 464          }
 465          return $lvisit;
 466      }
 467  
 468  	function getBullet($sectionicon, $mode)
 469      {
 470          global $list_pref, $listplugindir;
 471  
 472          $default_bullet = "";
 473  
 474          if($list_pref[$mode."_icon_default"])
 475          {
 476              if(file_exists(THEME."images/bullet2.gif"))
 477              {
 478                  $default_bullet = "<img src='".THEME."images/bullet2.gif' alt='' />";
 479              }
 480          }
 481  
 482          $icon_width = "8";
 483          $icon_height = "8";
 484          $style_pre = "";
 485  
 486          if($list_pref[$mode."_icon_use"]){
 487              if($sectionicon){
 488                  if(file_exists($listplugindir."images/".$sectionicon)){
 489                      $bullet = "<img src='".$listplugindir."images/".$sectionicon."' style='width:".$icon_width."px; height:".$icon_height."px; border:0; vertical-align:middle;' alt='' />";
 490                  }
 491              }
 492          }
 493          $bullet = (isset($bullet) ? $bullet : $default_bullet);
 494  
 495          return $bullet;
 496      }
 497  
 498  	function parse_heading($heading, $mode){
 499          global $list_pref;
 500          
 501          if($list_pref[$mode."_char_heading"] && strlen($heading) > $list_pref[$mode."_char_heading"]){
 502              $heading = substr($heading, 0, $list_pref[$mode."_char_heading"]).$list_pref[$mode."_char_postfix"];
 503          }
 504          return $heading;
 505      }
 506  
 507  	function getListDate($datestamp, $mode){
 508          global $list_pref;
 509          
 510          $datestamp += TIMEOFFSET;
 511  
 512          $todayarray = getdate();
 513          $current_day = $todayarray['mday'];
 514          $current_month = $todayarray['mon'];
 515          $current_year = $todayarray['year'];
 516  
 517          $thisday = date("d", $datestamp);
 518          $thismonth = date("m", $datestamp);
 519          $thisyear = date("Y", $datestamp);
 520  
 521          //check and use the today date style if day is today
 522          if($thisyear == $current_year){
 523              if($thismonth == $current_month){
 524                  if($thisday == $current_day){
 525                      $datepreftoday = $list_pref[$mode."_datestyletoday"];
 526                      $date = strftime($datepreftoday, $datestamp);
 527                      return $date;
 528                  }
 529              }
 530          }
 531  
 532          //else use default date style
 533          $datepref = $list_pref[$mode."_datestyle"];
 534          $date = strftime($datepref, $datestamp);
 535          return $date;
 536      }
 537  
 538  
 539      //##### FUNCTIONS BENEATH ARE ONLY USED IN THE ADMIN PAGE
 540  
 541  	function parse_headerrow_title($title){
 542          global $rs, $list_pref;
 543  
 544          $text = "<tr><td colspan='4' class='forumheader'>".$title."</td></tr>";
 545  
 546          return $text;
 547      }
 548  
 549  }
 550  
 551  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7