Absolut Engine PHP Cross Reference Web Portal Systems

Source: /admin/classarticles.php - 885 lines - 34113 bytes - Summary - Text - Print

   1  <?
   2  /**

   3   * @package absolutengine

   4   */
   5  /** Article class for handling all article-related functions

   6   */
   7  class CArticles extends CEngine
   8  {
   9  
  10     function CArticles()
  11     {
  12     $this->indent=""; $this->ID=""; $this->title=""; $this->beginning=""; $this->text="";
  13     $this->adate=""; $this->atime=""; $this->imagesetID=""; $this->filesetID="";
  14     $this->priority=""; $this->status=""; $this->articlenumber="";
  15     $this->CEngine();
  16     }
  17  
  18     /** Loop through the sections and generate a section list

  19      * @access public

  20      * @param int $type type of section list to be displayed - 0 public list, 1 links using UL, 2 dropdown menu using &nbsp, 3 checkboxes below each other;

  21      * @param boolean $order - 0 order by priority, 1 order alphabetically

  22      * @param boolean $override - override current section filtering 0 do nothing, 1 override and show

  23      * @param string $attribute - ID or class attribute

  24      */
  25     function LoopThroughSectionList($parentsectionID,$type=0,$order=0,$override=0,$attribute="")
  26     {
  27     if (!$order) $orderby="priority DESC";
  28     else $orderby="section";
  29     $this->DBQuery("SELECT * FROM ".$this->table[0]." WHERE parentsectionID='".$parentsectionID."' ORDER BY ".$orderby);
  30     $found=$this->rowsnumber;
  31     if ($found AND $type<2)
  32        {
  33        if (!$attribute) echo '<ul class="sectionlist">';
  34        else echo '<ul ',$attribute,'>';
  35        }
  36     elseif ($found AND $type>=2 AND $parentsectionID<>0)
  37        {
  38        $this->indent=$this->indent+4;
  39        }
  40     while ($this->DBGetRow())
  41           {
  42           $temp=$this->outcome;
  43           $sectionID=$this->access["ID"];
  44           $section=$this->access["section"];
  45           $filename=$this->access["filename"];
  46           if ($type<2) echo '<li>';
  47           if ($type==3) echo '<label></label>';
  48           if ($type==0)
  49              {
  50              echo '<a href="';
  51              if ($this->cleanurls==2 AND $filename) echo $filename;
  52              else echo 'showsection.php?sectionID=',$sectionID;
  53              echo '">',$section,'</a>';
  54              }
  55           elseif ($type==1)
  56              {
  57              echo '<a href="managersection.php?&username=',$this->username,'&session=',$this->session,'&sectionID=',$sectionID,'" title="ID: ',$sectionID,'">';
  58              echo $section;
  59              echo '</a>';
  60              $this->DBQuery("SELECT ID FROM ".$this->table[0]." WHERE parentsectionID='".$parentsectionID."' ORDER BY priority DESC LIMIT 1");
  61              $this->DBGetRow();
  62              if ($sectionID<>$this->access["ID"])
  63                 {
  64                 echo ' <a href="modify.php?command=32&username=',$this->username,'&session=',$this->session,'&sectionID=',$sectionID,'&direction=3"><img src="images/top.gif" class="noborder" alt=""></a>';
  65                 echo ' <a href="modify.php?command=32&username=',$this->username,'&session=',$this->session,'&sectionID=',$sectionID,'&direction=1"><img src="images/up.gif" class="noborder" alt=""></a>';
  66                 }
  67              $this->DBQuery("SELECT ID FROM ".$this->table[0]." WHERE parentsectionID='".$parentsectionID."' ORDER BY priority ASC LIMIT 1");
  68              $this->DBGetRow();
  69              if ($sectionID<>$this->access["ID"])
  70                 {
  71                 echo ' <a href="modify.php?command=32&username=',$this->username,'&session=',$this->session,'&sectionID=',$sectionID,'&direction=2"><img src="images/down.gif" class="noborder" alt=""></a>';
  72                 echo ' <a href="modify.php?command=32&username=',$this->username,'&session=',$this->session,'&sectionID=',$sectionID,'&direction=4"><img src="images/bottom.gif" class="noborder" alt=""></a>';
  73                 }
  74              echo ' <a href="modify.php?command=30&username=',$this->username,'&session=',$this->session,'&sectionID=',$sectionID,'" onclick="return confirm(\'',$this->textbasic[53],'\')"><img src="images/x.gif" class="noborder" alt=""></a>';
  75              }
  76           elseif ($type==2 AND ($sectionID<>$this->sectionID OR $override))
  77              {
  78              echo '<option value="',$sectionID,'"';
  79              if ($this->articleID)
  80                 {
  81                 $this->DBQuery("SELECT * FROM ".$this->table[9]." WHERE articleID='".$this->articleID."' AND sectionID='".$sectionID."'");
  82                 if ($this->rowsnumber) echo ' selected="selected"';
  83                 }
  84              elseif ($this->sectionID AND !is_array($this->sectionID))
  85                 {
  86                 $this->DBQuery("SELECT * FROM ".$this->table[0]." WHERE parentsectionID='".$sectionID."' AND ID='".$this->sectionID."'");
  87                 if ($this->rowsnumber) echo ' selected="selected"';
  88                 if ($override AND $sectionID==$this->sectionID) echo ' selected="selected"';
  89                 }
  90              elseif ($this->sectionID AND is_array($this->sectionID))
  91                 {
  92                 foreach ($this->sectionID as $value)
  93                         {
  94                         if ($sectionID==$value) echo ' selected="selected"';
  95                         }
  96                 }
  97              echo '>';
  98              for ($i=0;$i<$this->indent;$i++)
  99                  {
 100                  echo '&nbsp;';
 101                  }
 102              echo $section;
 103              echo '</option>';
 104              }
 105           elseif ($type==3 AND $sectionID<>$this->sectionID)
 106              {
 107              for ($i=0;$i<$this->indent;$i++)
 108                  {
 109                  echo '&nbsp;';
 110                  }
 111              echo '<input type="checkbox" name="sectionID[]" id="sectionID[',$sectionID,']" value="',$sectionID,'"';
 112              if ($this->articleID)
 113                 {
 114                 $this->DBQuery("SELECT * FROM ".$this->table[9]." WHERE articleID='".$this->articleID."' AND sectionID='".$sectionID."'");
 115                 if ($this->rowsnumber) echo ' checked="checked"';
 116                 }
 117              elseif ($this->sectionID AND !is_array($this->sectionID))
 118                 {
 119                 $this->DBQuery("SELECT * FROM ".$this->table[0]." WHERE parentsectionID='".$sectionID."' AND ID='".$this->sectionID."'");
 120                 if ($this->rowsnumber) echo ' checked="checked"';
 121                 }
 122              elseif ($this->sectionID AND is_array($this->sectionID))
 123                 {
 124                 foreach ($this->sectionID as $value)
 125                         {
 126                         if ($sectionID==$value) echo ' checked="checked"';
 127                         }
 128                 }
 129              echo ' /><label for="sectionID[',$sectionID,']" class="nofloat">';
 130              echo $section;
 131              echo '</label><br class="clear" />';
 132              }
 133           $this->LoopThroughSectionList($sectionID,$type,$order,$override);
 134           if ($type<2) echo '</li>';
 135           $this->outcome=$temp;
 136           }
 137     if ($found AND $type<2)
 138        {
 139        echo '</ul>';
 140        }
 141     elseif ($found AND $type>=2)
 142        {
 143        $this->indent=$this->indent-4;
 144        }
 145     }
 146  
 147     /** Retrieve parent section for the section

 148      * @access public

 149      * @param int $sectionID ID of section

 150      * @return int $parentsectionID ID of parent section above section

 151      */
 152     function GetParentSection($sectionID=0)
 153     {
 154     if (!$sectionID) $sectionID=$this->sectionID;
 155     $this->DBQuery("SELECT parentsectionID FROM ".$this->table[0]." WHERE ID='".$sectionID."'");
 156     $this->DBGetRow();
 157     return $this->access["parentsectionID"];
 158     }
 159  
 160     function GetTopSection($sectionID=0)
 161     {
 162     if (!$sectionID) $sectionID=$this->sectionID;
 163     $this->DBQuery("SELECT parentsectionID FROM ".$this->table[0]." WHERE ID='".$sectionID."'");
 164     $this->DBGetRow();
 165     $parentsectionID=$this->access["parentsectionID"];
 166     if ($parentsectionID<>0)
 167        {
 168        $sectionID=$this->GetTopSection($parentsectionID);
 169        }
 170     return $sectionID;
 171     }
 172  
 173     /** Retrieve sections for the article

 174      * @access public

 175      * @param int $articleID ID of article

 176      */
 177     function GetArticleSections($articleID=0)
 178     {
 179     if (!$articleID) $articleID=$this->articleID;
 180     $this->DBQuery("SELECT sec.ID AS ID,section,parentsectionID,priority,filename FROM ".$this->table[9]." AS artsec LEFT JOIN ".$this->table[0]." AS sec ON artsec.sectionID=sec.ID WHERE artsec.articleID='".$articleID."'");
 181     }
 182  
 183     /** Retrieves section

 184      * @access public

 185      */
 186     function GetSection($settings)
 187     {
 188     $this->DBQuery("SELECT * FROM ".$this->table[0]." WHERE ID='".$settings["sectionID"]."'");
 189     }
 190  
 191     /** Print section name

 192      * @access public

 193      */
 194     function GetSectionName()
 195     {
 196     echo $this->access["section"];
 197     }
 198  
 199     /** Print section name

 200      * @access public

 201      * @deprecated from v1.71 DO NOT USE! This function is obsolete and will be deleted in next version

 202      * Function has been replaced by GetSectionName()

 203      * @see GetSectionName()

 204      */
 205     function GetArticleSection()
 206     {
 207     $this->GetSectionName();
 208     }
 209  
 210     /** Return section ID

 211      * @access public

 212      */
 213     function GetSectionID()
 214     {
 215     return $this->access["ID"];
 216     }
 217  
 218     /** Return parent sectionID of section

 219      * @access public

 220      */
 221     function GetParentSectionID()
 222     {
 223     return $this->access["ID"];
 224     }
 225  
 226     /** Return articleID describing section

 227      * @access public

 228      */
 229     function GetSectionArticleID()
 230     {
 231     return $this->access["articleID"];
 232     }
 233  
 234     /** Return filename of section

 235      * @access public

 236      */
 237     function GetSectionFilename()
 238     {
 239     return $this->access["filename"];
 240     }
 241  
 242     /** Return priority of section

 243      * @access public

 244      */
 245     function GetSectionPriority()
 246     {
 247     return $this->access["priority"];
 248     }
 249  
 250     /** Retrieve articles from database

 251      * @access public

 252      * function accepts two styles of parameters due to backward compatibility

 253      * OLD STYLE (v1.70) is deprecated, use only new style with $settings array

 254      * @param array $settings array of parameters, see below:

 255      * "articlenumber"=>int number of articles to list

 256      * "offset"=>int offset to show articles from

 257      * "fromdate"=>string articles to be shown from date (date format in settings.php)

 258      * "todate"=>string articles to be shown up to date (date format as in settings.php)

 259      * "authorID"=>string articles written by author ID (comma delimited list for multiple values)

 260      * "sectionID"=>string articles in section ID (comma delimited list for multiple values)

 261      * "priority"=>boolean 0,1

 262      * "status"=>boolean 0,1

 263      * "articleID"=>int ID of article to be displayed

 264      * "order"=>string use MySQL format ("adate DESC, atime DESC, priority DESC" etc.)

 265      * EXCLUSION: !X = !4 - will exclude author/section with ID 4 if used in authorID or sectionID

 266      *

 267      * This will list latest 10 articles with priority 1

 268      * <code>

 269      * <?

 270      * $settings=array(

 271      *                "articlenumber"=>10,

 272      *                "priority"=>1

 273      *                );

 274      * $aepublic->GetArchive($settings);

 275      * .

 276      * .

 277      * .

 278      * ?>

 279      * </code>

 280      * This will list 10 articles starting from 5th result from January 1st 2004 to January 31st 2004 in section 5 and 14

 281      * Please note that date format matches date format in settings.php, for the example below it is "DD.MM.YYYY" - you always need to match date format as set in settings.php!

 282      * <code>

 283      * <?

 284      * $settings=array(

 285      *                "articlenumber"=>10,

 286      *                "offset"=>5,

 287      *                "fromdate"=>"01.01.2004",

 288      *                "todate"=>"31.01.2004",

 289      *                "sectionID"=>"5,14"

 290      *                );

 291      * $aepublic->GetArchive($settings);

 292      * .

 293      * .

 294      * .

 295      * ?>

 296      * </code>

 297      * This will list latest 50 articles written by authors with ID 2 and 10 and put under section ID 5 and 8, but NOT section ID 7

 298      * Result is sorted by from the oldest to the newest articles

 299      * <code>

 300      * <?

 301      * $settings=array(

 302      *                "articlenumber"=>50,

 303      *                "authorID"=>"2,10",

 304      *                "sectionID"=>"5,8,!7",

 305      *                "order"=>"adate ASC, atime ASC"

 306      *                );

 307      * $aepublic->GetArchive($settings);

 308      * .

 309      * .

 310      * .

 311      * ?>

 312      * </code>

 313      */
 314     function GetArchive($settings=10,$adate=0,$sectionID="all",$authorID="all",$priority="all",$articleID=0)
 315     {
 316     $condition="1"; $join="";
 317     // Due to backward compatiblity issues, we need to test and retrieve number of parameters

 318     $number=func_num_args();
 319     // if old style is used

 320     if (is_int($settings) OR $number>1)
 321        {
 322        if (!$adate) $condition.=" AND adate<='".date("Y-m-d")."'";
 323        if ($settings==="all") $settings=999999999;
 324        if ($sectionID<>"all") $condition.=" AND sec.sectionID='".$sectionID."'";
 325        if ($authorID<>"all") $condition.=" AND authorID='".$authorID."'";
 326        if ($priority<>"all") $condition.=" AND art.priority='".$priority."'";
 327        $condition.=" AND art.status='1'";
 328        if ($articleID) $condition=" art.ID='".$articleID."'";
 329        $order="adate DESC, atime DESC, priority DESC";
 330        $limit=$settings;
 331        }
 332     // if new style is used

 333     elseif (is_array($settings))
 334        {
 335        if (isset($settings["fromdate"])) $condition.=" AND art.adate>='".$this->DateConversion($settings["fromdate"])."'";
 336        if (isset($settings["todate"])) $condition.=" AND art.adate<='".$this->DateConversion($settings["todate"])."'";
 337        else $condition.=" AND art.adate<='".date("Y-m-d")."'";
 338        // multiple authorID can be entered separated by commas

 339        if (isset($settings["authorID"]))
 340           {
 341           $joinnumber="";
 342           $authors=explode(",",$settings["authorID"]);
 343           if (is_array($authors))
 344              {
 345              foreach ($authors as $authorID)
 346                      {
 347                      if (strpos($authorID,"!")===FALSE)
 348                         {
 349                         $condition.=" AND art".$joinnumber.".authorID='".$authorID."'";
 350                         }
 351                      else
 352                         {
 353                         $authorID=str_replace("!","",$authorID);
 354                         $condition.=" AND art".$joinnumber.".authorID<>'".$authorID."'";
 355                         }
 356                      if (!$joinnumber)
 357                         {
 358                         $joinnumber=2;
 359                         }
 360                      else
 361                         {
 362                         $join.=" LEFT JOIN ae_articlesections AS sec".$joinnumber." ON art.ID=sec".$joinnumber.".articleID";
 363                         $joinnumber++;
 364                         }
 365                      }
 366              }
 367           }
 368        // multiple sectionID can be entered separated by commas

 369        if (isset($settings["sectionID"]))
 370           {
 371           $joinnumber="";
 372           $sections=explode(",",$settings["sectionID"]);
 373           foreach ($sections as $sectionID)
 374                   {
 375                   if (strpos($sectionID,"!")===FALSE)
 376                      {
 377                      $condition.=" AND sec".$joinnumber.".sectionID='".$sectionID."'";
 378                      }
 379                   else
 380                      {
 381                      $sectionID=str_replace("!","",$sectionID);
 382                      $condition.=" AND sec".$joinnumber.".sectionID<>'".$sectionID."'";
 383                      }
 384                   if (!$joinnumber)
 385                         {
 386                         $joinnumber=2;
 387                         }
 388                      else
 389                        {
 390                         $join.=" LEFT JOIN ".$this->table[0]." AS sec".$joinnumber." ON art.ID=sec".$joinnumber.".articleID";
 391                         $joinnumber++;
 392                         }
 393                   }
 394           }
 395        if (isset($settings["priority"])) $condition.=" AND art.priority='".$settings["priority"]."'";
 396        if (isset($settings["status"])) $condition.=" AND art.status='".$settings["status"]."'";
 397        else $condition.=" AND art.status='1'";
 398        if (isset($settings["order"])) $order=$settings["order"];
 399        else $order="adate DESC, atime DESC, priority DESC";
 400        if (isset($settings["articlenumber"])) $limit=$settings["articlenumber"];
 401        else $limit=9999999;
 402        if (isset($settings["offset"]) AND isset($settings["articlenumber"])) $limit=$settings["offset"].",".$settings["articlenumber"];
 403        if (isset($settings["articleID"])) $condition=" art.ID='".$settings["articleID"]."'";
 404        }
 405     $this->DBQuery("SELECT * FROM ".$this->table[3]." AS art LEFT JOIN ".$this->table[9]." AS sec ON art.ID=sec.articleID ".$join." WHERE ".$condition." GROUP BY art.ID ORDER BY ".$order." LIMIT ".$limit);
 406     }
 407  
 408     /** Search articles in database

 409      * @access public

 410      * function accepts two styles of parameters due to backward compatibility

 411      * OLD STYLE (v1.70) is deprecated, use only new style with $settings array

 412      * @param array $settings array of parameters, see below:

 413      * "query"=>string text to find

 414      * "searchin"=>string where the search should be made: title,beginning,text (comma delimited list for multiple values)

 415      * "style"=>string should the search be fulltext (fulltext) or just free match (anypart)

 416      * "articlenumber"=>int number of articles to list

 417      * "offset"=>int offset to show articles from

 418      * "fromdate"=>string articles to be shown from date (date format in settings.php)

 419      * "todate"=>string articles to be shown up to date (date format as in settings.php)

 420      * "authorID"=>string articles written by author ID (comma delimited list for multiple values)

 421      * "sectionID"=>string articles in section ID (comma delimited list for multiple values)

 422      * "priority"=>boolean 0,1

 423      * "status"=>boolean 0,1

 424      * "articleID"=>int ID of article to be displayed

 425      * "order"=>string use MySQL format ("adate DESC, atime DESC, priority DESC" etc.)

 426      * EXCLUSION: !X = !4 - will exclude author/section with ID 4 if used in authorID or sectionID

 427      */
 428     function SearchArchive($settings,$articlenumber=10,$adate=0)
 429     {
 430     $condition="1"; $join="";
 431     // Due to backward compatiblity issues, we need to test and retrieve number of parameters

 432     $number=func_num_args();
 433     // if old style is used

 434     if (is_string($settings) OR $number>1)
 435        {
 436        $condition="(title LIKE '%".$settings."%' OR beginning LIKE '%".$settings."%' OR text LIKE '%".$settings."%')";
 437        if (!$adate) $condition.=" AND adate<='".date("Y-m-d")."'";
 438        if ($articlenumber==="all") $articlenumber=999999999;
 439        $order="priority DESC, adate DESC, atime DESC";
 440        $limit=$articlenumber;
 441        }
 442     // if new style is used

 443     elseif (is_array($settings))
 444        {
 445        $condition.=" AND (0";
 446        if (isset($settings["searchin"]))
 447           {
 448           $searchins=explode(",",$settings["searchin"]);
 449           foreach ($searchins as $searchin)
 450                   {
 451                   if (strpos($searchin,"!")===FALSE)
 452                      {
 453                      if ($settings["style"]=="anypart") $condition.=" OR art.".$searchin." LIKE '%".$settings["query"]."%'";
 454                      elseif ($settings["style"]=="fulltext") $condition.=" OR MATCH(art.".$searchin.") AGAINST ('".$settings["query"]."')";
 455                      }
 456                   else
 457                      {
 458                      $searchin=str_replace("!","",$searchin);
 459                      if ($settings["style"]=="anypart") $condition.=" OR art.".$searchin." LIKE '%".$settings["query"]."%'";
 460                      elseif ($settings["style"]=="fulltext") $condition.=" OR MATCH(art.".$searchin.") AGAINST (-'".$settings["query"]."')";
 461                      }
 462                   }
 463           }
 464        $condition.=") ";
 465        if (isset($settings["fromdate"])) $condition.=" AND art.adate>='".$this->DateConversion($settings["fromdate"])."'";
 466        if (isset($settings["todate"])) $condition.=" AND art.adate<='".$this->DateConversion($settings["todate"])."'";
 467        else $condition.=" AND art.adate<='".date("Y-m-d")."'";
 468        // multiple authorID can be entered separated by commas

 469        if (isset($settings["authorID"]))
 470           {
 471           $joinnumber="";
 472           $authors=explode(",",$settings["authorID"]);
 473           if (is_array($authors))
 474              {
 475              foreach ($authors as $authorID)
 476                      {
 477                      if (strpos($authorID,"!")===FALSE)
 478                         {
 479                         $condition.=" AND art".$joinnumber.".authorID='".$authorID."'";
 480                         }
 481                      else
 482                         {
 483                         $authorID=str_replace("!","",$authorID);
 484                         $condition.=" AND art".$joinnumber.".authorID<>'".$authorID."'";
 485                         }
 486                      if (!$joinnumber)
 487                         {
 488                         $joinnumber=2;
 489                         }
 490                      else
 491                         {
 492                         $join.=" LEFT JOIN ae_articlesections AS sec".$joinnumber." ON art.ID=sec".$joinnumber.".articleID";
 493                         $joinnumber++;
 494                         }
 495                      }
 496              }
 497           }
 498        // multiple sectionID can be entered separated by commas

 499        if (isset($settings["sectionID"]))
 500           {
 501           $joinnumber="";
 502           $sections=explode(",",$settings["sectionID"]);
 503           foreach ($sections as $sectionID)
 504                   {
 505                   if (strpos($sectionID,"!")===FALSE)
 506                      {
 507                      $condition.=" AND sec".$joinnumber.".sectionID='".$sectionID."'";
 508                      }
 509                   else
 510                      {
 511                      $sectionID=str_replace("!","",$sectionID);
 512                      $condition.=" AND sec".$joinnumber.".sectionID<>'".$sectionID."'";
 513                      }
 514                   if (!$joinnumber)
 515                         {
 516                         $joinnumber=2;
 517                         }
 518                      else
 519                         {
 520                         $join.=" LEFT JOIN ae_articlesections AS sec".$joinnumber." ON art.ID=sec".$joinnumber.".articleID";
 521                         $joinnumber++;
 522                         }
 523                   }
 524           }
 525        if (isset($settings["priority"])) $condition.=" AND art.priority='".$settings["priority"]."'";
 526        if (isset($settings["status"])) $condition.=" AND art.status='".$settings["status"]."'";
 527        else $condition.=" AND art.status='1'";
 528        if (isset($settings["order"])) $order=$settings["order"];
 529        else $order="adate DESC, atime DESC, priority DESC";
 530        if (isset($settings["articlenumber"])) $limit=$settings["articlenumber"];
 531        else $limit=9999999;
 532        if (isset($settings["offset"]) AND isset($settings["articlenumber"])) $limit=$settings["offset"].",".$settings["articlenumber"];
 533        if (isset($settings["articleID"])) $condition=" art.ID='".$settings["articleID"]."'";
 534        }
 535     $this->DBQuery("SELECT * FROM ".$this->table[3]." AS art LEFT JOIN ".$this->table[9]." AS sec ON art.ID=sec.articleID ".$join." WHERE ".$condition." GROUP BY art.ID ORDER BY ".$order." LIMIT ".$limit);
 536     }
 537  
 538     /** Retrieve article content

 539      * @access public

 540      */
 541     function GetArticle()
 542     {
 543     $this->articleID=$this->access["ID"];
 544     $this->title=stripslashes($this->access["title"]);
 545     $this->beginning=stripslashes($this->access["beginning"]);
 546     $this->summary=stripslashes($this->access["text"]);
 547     $this->summary=str_replace("<br>","\n",$this->summary);
 548     $this->summary=str_replace("<br/>","\n",$this->summary);
 549     $this->summary=str_replace("<br />","\n",$this->summary);
 550     $this->summary=str_replace("\n"," ",$this->summary);
 551     $this->summary=strip_tags($this->summary);
 552     @$dotposition=strpos($this->summary,". ",180);
 553     if ($dotposition===FALSE) $dotposition=300;
 554     $this->summary=substr($this->summary,0,$dotposition+1);
 555     $this->text=stripslashes($this->access["text"]);
 556     $this->authorID=$this->access["authorID"];
 557     $this->adate=$this->access["adate"];
 558     $this->adate=$this->DateConversion($this->adate,2);
 559     $this->atime=$this->access["atime"];
 560     $this->imagesetID=$this->access["imagesetID"];
 561     $this->filesetID=$this->access["filesetID"];
 562     $this->priority=$this->access["priority"];
 563     $this->status=$this->access["status"];
 564     $this->filename=$this->access["filename"];
 565     }
 566  
 567     /** Update number of views for article

 568      * @access public

 569      * @param int $articleID

 570      */
 571     function UpdateArticleStats($articleID=0)
 572     {
 573     if (!$articleID) $articleID=$this->articleID;
 574     $this->DBQuery("UPDATE ".$this->table[4]." SET views=views+1 WHERE articleID='".$articleID."'");
 575     }
 576  
 577     /** Return ID of article

 578      * @access public

 579      * @return int articleID ID of article

 580      */
 581     function GetArticleID()
 582     {
 583     return $this->articleID;
 584     }
 585  
 586     /** Print title of article

 587      * @access public

 588      */
 589     function GetArticleTitle()
 590     {
 591     echo $this->title;
 592     }
 593  
 594     /** Print beginning of article

 595      * @deprecated from v1.71

 596      * @access public

 597      * Beginning will not be supported in future

 598      * @see GetArticleSummary()

 599      * @see GetArticleText()

 600      */
 601     function GetArticleBeginning()
 602     {
 603     $this->beginning=nl2br($this->beginning);
 604     echo $this->beginning;
 605     }
 606  
 607     /** Print summary for article (e.g. first few sentences of the text)

 608      * @access public

 609      * Use instead of GetArticleBeginning()

 610      * Function searches first 180 characters of text of the article for a dot.

 611      * If found it then creates summary text (few sentences) until that position

 612      * If not found, it takes first 300 characters of text as a summary

 613      * @todo: Allow for changing the length of summary as well as symbol that is being searched for

 614      */
 615     function GetArticleSummary()
 616     {
 617     echo $this->summary;
 618     }
 619  
 620     /** Print text of article

 621      * @access public

 622      */
 623     function GetArticleText()
 624     {
 625     echo $this->text;
 626     }
 627  
 628     /** Print date of publishing of article

 629      * @access public

 630      */
 631     function GetArticleDate()
 632     {
 633     echo $this->adate;
 634     }
 635  
 636     /** Print time of publishing of article

 637      * @access public

 638      */
 639     function GetArticleTime()
 640     {
 641     echo $this->atime;
 642     }
 643  
 644     /** Return filename of article

 645      * @access public

 646      * @return string filename filename of article

 647      */
 648     function GetArticleFilename()
 649     {
 650     return $this->filename;
 651     }
 652  
 653     /** Retrieve information about author

 654      * @access public

 655      * @param int $authorID ID of author

 656      */
 657     function GetArticleAuthor($authorID=0)
 658     {
 659     if (!$authorID) $authorID=$this->authorID;
 660     $temp=$this->outcome;
 661     $this->DBQuery("SELECT fullname,email,otherinfo,photo FROM ".$this->table[5]." WHERE ID='".$authorID."'");
 662     $this->DBGetRow();
 663     $this->author=$this->access["fullname"];
 664     $this->email=$this->access["email"];
 665     $this->otherinfo=$this->access["otherinfo"];
 666     $this->photo=$this->access["photo"];
 667     $this->outcome=$temp;
 668     }
 669  
 670     /** Return ID of author

 671      * @access public

 672      */
 673     function GetAuthorID()
 674     {
 675     return $this->authorID;
 676     }
 677  
 678     /** Print name of author

 679      * @access public

 680      */
 681     function GetAuthorName()
 682     {
 683     echo $this->author;
 684     }
 685  
 686     /** Print email of author

 687      * @access public

 688      */
 689     function GetAuthorEmail()
 690     {
 691     echo $this->email;
 692     }
 693  
 694     /** Print extended information about author

 695      * @access public

 696      */
 697     function GetAuthorInfo()
 698     {
 699     echo $this->otherinfo;
 700     }
 701  
 702     /** Retrieve image set / DEPRECATED

 703      * @access public

 704      * @deprecated from v1.71 DO NOT USE! This function is obsolete and will be deleted in next version

 705      * Function has been replaced by GetArticleImageSet()

 706      * @see GetArticleImageSet()

 707      */
 708     function GetArticleImages($before="",$after="",$number=10,$link=0,$imagenumber=0)
 709     {
 710     $temp=$this->outcome;
 711     $this->GetArticleImageSet();
 712     $i=0;
 713     while ($this->DBGetRow())
 714           {
 715           if ($i==$number) break;
 716           if (!$link) echo $before,'<img src="',$this->pathimages,$this->GetImageThumbnail(),'" alt="',$this->access["description"],'" />',$after;
 717           elseif ($link==1 AND !$this->cleanurls) echo $before,'<a href="showarticle.php?articleID=',$this->GetArticleID(),'"><img src="',$this->pathimages,$this->GetImageThumbnail(),'" alt="',$this->access["description"],'" /></a>',$after;
 718           elseif ($link==1 AND $this->cleanurls) echo $before,'<a href="',$this->access["filename"],'"><img src="',$this->pathimages,$this->GetImageThumbnail(),'" alt="',$this->access["description"],'" /></a>',$after;
 719           elseif ($link==2) echo $before,'<a href="',$this->pathimages,$this->access["filename"],'"><img src="',$this->pathimages,$this->GetImageThumbnail(),'" alt="',$this->access["description"],'" /></a>',$after;
 720           $i++;
 721           }
 722     $this->outcome=$temp;
 723     }
 724  
 725     /** Replace image tags / DEPRECATED

 726      * @access public

 727      * @deprecated from v1.71 DO NOT USE! This function is obsolete and will be deleted in next version

 728      * Function does not have replacement for now - SORRY

 729      * @todo Possibly some sophisticated image replacing in future

 730      */
 731     function ReplaceImageTags($replace=0,$link=1)
 732     {
 733     }
 734  
 735     /** Replace file tags / DEPRECATED

 736      * @access public

 737      * @deprecated from v1.71 DO NOT USE! This function is obsolete and will be deleted in next version

 738      * Function does not have replacement for now - SORRY

 739      * @todo Possibly some sophisticated image replacing in future

 740      */
 741     function ReplaceFileTags($replace=0)
 742     {
 743     }
 744  
 745     /** Retrieve image set

 746      * @access public

 747      * @param int imagesetID ID of image set

 748      */
 749     function GetArticleImageSet($imagesetID=0)
 750     {
 751     if (!$imagesetID) $imagesetID=$this->imagesetID;
 752     $this->DBQuery("SELECT sets.description AS setdescription,filename,images.description AS description,authorID FROM ".$this->table[1]." AS images LEFT JOIN ".$this->table[13]." AS sets ON images.imagesetID=sets.ID WHERE sets.ID='".$imagesetID."' ORDER BY images.ID");
 753     }
 754  
 755     /** Return imagename

 756      * @access public

 757      */
 758     function GetImageName()
 759     {
 760     return $this->access["filename"];
 761     }
 762  
 763     /** Return thumbnail name for image

 764      * @access public

 765      */
 766     function GetImageThumbnail()
 767     {
 768     return $this->GetThumbnailName($this->access["filename"]);
 769     }
 770  
 771     /** Return image description

 772      * @access public

 773      */
 774     function GetImageDescription()
 775     {
 776     return $this->access["description"];
 777     }
 778  
 779     /** Return imageset description

 780      * @access public

 781      */
 782     function GetImageSetDescription()
 783     {
 784     return $this->access["setdescription"];
 785     }
 786  
 787     /** Retrieve file set / DEPRECATED

 788      * @access public

 789      * @deprecated from v1.71 DO NOT USE! This function is obsolete and will be deleted in next version

 790      * Function has been replaced by GetArticleFileSet()

 791      * @see GetArticleFileSet()

 792      */
 793     function GetArticleFiles()
 794     {
 795     $temp=$this->outcome;
 796     $this->GetArticleFileSet();
 797     $this->outcome=$temp;
 798     }
 799  
 800     /** Retrieve file set

 801      * @access public

 802      * @param int filesetID ID of file set

 803      */
 804     function GetArticleFileSet($filesetID=0)
 805     {
 806     if (!$filesetID) $filesetID=$this->filesetID;
 807     $this->DBQuery("SELECT sets.description AS setdescription,filename,authorID FROM ".$this->table[2]." AS files LEFT JOIN ".$this->table[12]." AS sets ON files.filesetID=sets.ID WHERE sets.ID='".$filesetID."' ORDER BY files.ID");
 808     }
 809  
 810     /** Return filename

 811      * @access public

 812      */
 813     function GetFileName()
 814     {
 815     return $this->access["filename"];
 816     }
 817  
 818     /** Return fileset description

 819      * @access public

 820      */
 821     function GetFileSetDescription()
 822     {
 823     return $this->access["setdescription"];
 824     }
 825  
 826     /** Print article stats/number of views

 827      * @access public

 828      */
 829     function GetArticleStats($articleID=0)
 830     {
 831     if (!$articleID) $articleID=$this->articleID;
 832     $this->DBQuery("SELECT views FROM ".$this->table[4]." WHERE articleID='".$articleID."'");
 833     $this->DBGetRow();
 834     echo $this->access["views"];
 835     }
 836  
 837     /** If syndication module is active, test whether article is syndicated on the current

 838      * website, if yes continue with displaying in related articles, otherwise skip

 839      * @access private

 840      */
 841     function TestSyndication($articleID)
 842     {
 843     if (!SYNDICATION) return;
 844     $this->DBQuery("SELECT * FROM ".$this->table[0]." WHERE section='".$this->server."'");
 845     if (!$this->rowsnumber) exit;
 846     $this->DBGetRow();
 847     $topsectionID=$this->access["ID"];
 848     $this->DBQuery("SELECT sectionID FROM ".$this->table[3]." AS articles LEFT JOIN ".$this->table[9]." AS articlesections ON articles.ID=articlesections.articleID WHERE articles.ID='".$articleID."'");
 849     while ($this->DBGetRow())
 850           {
 851           $temp=$this->outcome;
 852           $sectionID=$this->access["sectionID"];
 853           $articletopsectionID=$this->GetTopSection($sectionID);
 854           if ($topsectionID==$articletopsectionID)
 855              {
 856              $this->outcome=$temp;
 857              return 1;
 858              }
 859           $this->outcome=$temp;
 860           }
 861     return 0;
 862     }
 863  
 864     /** Retrieve related articles for article $articleID

 865      * @access public

 866      */
 867     function GetRelatedArchive($articleID)
 868     {
 869     $this->DBQuery("SELECT DISTINCT rel.relatedID AS articleID,art.* FROM ".$this->table[7]." AS rel LEFT JOIN ".$this->table[3]." AS art ON relatedID=art.ID LEFT JOIN ".$this->table[9]." AS sec ON art.ID=sec.articleID WHERE rel.articleID='".$articleID."'");
 870     }
 871  
 872     /** Get related article / DEPRECATED

 873      * @access public

 874      * @deprecated from v1.71 DO NOT USE! This function is obsolete and will be deleted in next version

 875      * Function has been replaced by GetArticle()

 876      * @see GetArticle()

 877      */
 878     function GetRelatedArticle()
 879     {
 880     $this->GetArticle();
 881     }
 882  
 883  }
 884  
 885  ?>

title

Description

title

Description

title

Description

title

title

Body