[ Index ]
 

Code source de PHP NUKE 7.9

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

title

Body

[fermer]

/admin/modules/ -> blocks.php (source)

   1  <?php
   2  
   3  /************************************************************************/

   4  /* PHP-NUKE: Web Portal System                                          */

   5  /* ===========================                                          */

   6  /*                                                                      */

   7  /* Copyright (c) 2005 by Francisco Burzi                                */

   8  /* http://phpnuke.org                                                   */

   9  /*                                                                      */

  10  /* This program is free software. You can redistribute it and/or modify */

  11  /* it under the terms of the GNU General Public License as published by */

  12  /* the Free Software Foundation; either version 2 of the License.       */

  13  /************************************************************************/

  14  
  15  if (!defined('ADMIN_FILE')) {
  16      die ("Access Denied");
  17  }
  18  
  19  global $prefix, $db, $admin_file;
  20  $aid = substr("$aid", 0,25);
  21  $row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'"));
  22  if ($row['radminsuper'] == 1) {
  23  
  24      /*********************************************************/

  25      /* Blocks Functions                                      */

  26      /*********************************************************/

  27  
  28  	function BlocksAdmin() {
  29          global $bgcolor2, $bgcolor4, $prefix, $db, $currentlang, $multilingual, $admin_file;
  30          include ("header.php");
  31          GraphicAdmin();
  32          OpenTable();
  33          echo "<center><font class=\"title\"><b>"._BLOCKSADMIN."</b></font></center>";
  34          CloseTable();
  35          echo "<br>";
  36          OpenTable();
  37          echo "<br><table border=\"1\" width=\"100%\"><tr>"
  38          ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._TITLE."</b></td>"
  39          ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._POSITION."</b></td>"
  40          ."<td align=\"center\" bgcolor=\"$bgcolor2\" colspan=\"2\"><b>"._WEIGHT."</b></td>"
  41          ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._TYPE."</b></td>"
  42          ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._STATUS."</b></td>"
  43          ."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._VIEW."</b></td>";
  44          if ($multilingual == 1) {
  45              echo "<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._LANGUAGE."</b></td>";
  46          }
  47          echo "<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._FUNCTIONS."</b></tr>";
  48          $result = $db->sql_query("select bid, bkey, title, url, bposition, weight, active, blanguage, blockfile, view from ".$prefix."_blocks order by bposition, weight");
  49          while ($row = $db->sql_fetchrow($result)) {
  50              $bid = intval($row['bid']);
  51              $bkey = filter($row['bkey'], "nohtml");
  52              $title = filter($row['title'], "nohtml");
  53              $url = filter($row['url'], "nohtml");
  54              $bposition = filter($row['bposition'], "nohtml");
  55              $weight = intval($row['weight']);
  56              $active = intval($row['active']);
  57              $blanguage = $row['blanguage'];
  58              $blockfile = filter($row['blockfile'], "nohtml");
  59              $view = intval($row['view']);
  60              $weight1 = $weight - 1;
  61              $weight3 = $weight + 1;
  62              $row_res = $db->sql_fetchrow($db->sql_query("select bid from ".$prefix."_blocks where weight='$weight1' AND bposition='$bposition'"));
  63              $bid1 = intval($row_res['bid']);
  64              $con1 = "$bid1";
  65              $row_res2 = $db->sql_fetchrow($db->sql_query("select bid from ".$prefix."_blocks where weight='$weight3' AND bposition='$bposition'"));
  66              $bid2 = intval($row_res2['bid']);
  67              $con2 = "$bid2";
  68              echo "<tr>"
  69              ."<td align=\"center\">$title</td>";
  70              if ($bposition == "l") {
  71                  $bposition = "<img src=\"images/center_r.gif\" border=\"0\" alt=\""._LEFTBLOCK."\" title=\""._LEFTBLOCK."\" hspace=\"5\"> "._LEFT."";
  72              } elseif ($bposition == "r") {
  73                  $bposition = ""._RIGHT." <img src=\"images/center_l.gif\" border=\"0\" alt=\""._RIGHTBLOCK."\" title=\""._RIGHTBLOCK."\" hspace=\"5\">";
  74              } elseif ($bposition == "c") {
  75                  $bposition = "<img src=\"images/center_l.gif\" border=\"0\" alt=\""._CENTERBLOCK."\" title=\""._CENTERBLOCK."\">&nbsp;"._CENTERUP."&nbsp;<img src=\"images/center_r.gif\" border=\"0\" alt=\""._CENTERBLOCK."\" title=\""._CENTERBLOCK."\">";
  76              } elseif ($bposition == "d") {
  77                  $bposition = "<img src=\"images/center_l.gif\" border=\"0\" alt=\""._CENTERBLOCK."\" title=\""._CENTERBLOCK."\">&nbsp;"._CENTERDOWN."&nbsp;<img src=\"images/center_r.gif\" border=\"0\" alt=\""._CENTERBLOCK."\" title=\""._CENTERBLOCK."\">";
  78              }
  79              echo "<td align=\"center\">$bposition</td>"
  80              ."<td align=\"center\">"
  81              ."&nbsp;$weight&nbsp;</td><td align=\"center\">";
  82              if ($con1) {
  83                  echo"<a href=\"".$admin_file.".php?op=BlockOrder&amp;weight=$weight&amp;bidori=$bid&amp;weightrep=$weight1&amp;bidrep=$con1\"><img src=\"images/up.gif\" alt=\""._BLOCKUP."\" title=\""._BLOCKUP."\" border=\"0\" hspace=\"3\"></a>";
  84              }
  85              if ($con2) {
  86                  echo "<a href=\"".$admin_file.".php?op=BlockOrder&amp;weight=$weight&amp;bidori=$bid&amp;weightrep=$weight3&amp;bidrep=$con2\"><img src=\"images/down.gif\" alt=\""._BLOCKDOWN."\" title=\""._BLOCKDOWN."\" border=\"0\" hspace=\"3\"></a>";
  87              }
  88              echo"</td>";
  89              if (empty($bkey)) {
  90                  if (empty($url)) {
  91                      $type = "HTML";
  92                  } elseif (!empty($url)) {
  93                      $type = "RSS/RDF";
  94                  }
  95                  if (!empty($blockfile)) {
  96                      $type = _BLOCKFILE2;
  97                  }
  98              } elseif (!empty($bkey)) {
  99                  $type = _BLOCKSYSTEM;
 100              }
 101              echo "<td align=\"center\">$type</td>";
 102              $block_act = $active;
 103              if ($active == 1) {
 104                  $active = "<img src=\"images/active.gif\" alt=\""._ACTIVE."\" title=\""._ACTIVE."\" border=\"0\" width=\"16\" height=\"16\">";
 105                  $change = "<img src=\"images/inactive.gif\" alt=\""._DEACTIVATE."\" title=\""._DEACTIVATE."\" border=\"0\" width=\"16\" height=\"16\">";
 106              } elseif ($active == 0) {
 107                  $active = "<img src=\"images/inactive.gif\" alt=\""._INACTIVE."\" title=\""._INACTIVE."\" border=\"0\" width=\"16\" height=\"16\">";
 108                  $change = "<img src=\"images/active.gif\" alt=\""._ACTIVATE."\" title=\""._ACTIVATE."\" border=\"0\" width=\"16\" height=\"16\">";
 109              }
 110              echo "<td align=\"center\">$active</td>";
 111              if ($view == 0) {
 112                  $who_view = _MVALL;
 113              } elseif ($view == 1) {
 114                  $who_view = _MVUSERS;
 115              } elseif ($view == 2) {
 116                  $who_view = _MVADMIN;
 117              } elseif ($view == 3) {
 118                  $who_view = _MVANON;
 119              }
 120              echo "<td align=\"center\">$who_view</td>";
 121              if ($multilingual == 1) {
 122                  if (empty($blanguage)) {
 123                      $blanguage = _ALL;
 124                  } else {
 125                      $blanguage = ucfirst($blanguage);
 126                  }
 127                  echo "<td align=\"center\">$blanguage</td>";
 128              }
 129              echo "<td align=\"center\"><font class=\"content\">&nbsp;<a href=\"".$admin_file.".php?op=BlocksEdit&amp;bid=$bid\"><img src=\"images/edit.gif\" alt=\""._EDIT."\" title=\""._EDIT."\" border=\"0\" width=\"17\" height=\"17\"></a>  <a href=\"".$admin_file.".php?op=ChangeStatus&amp;bid=$bid\">$change</a>  ";
 130              if ($bkey == "") {
 131                  echo "<a href=\"".$admin_file.".php?op=BlocksDelete&amp;bid=$bid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a>  ";
 132              } elseif (!empty($bkey)) {
 133                  echo "<img src=\"images/delete_x.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"> ";
 134              }
 135              echo "<a href=\"".$admin_file.".php?op=block_show&bid=$bid\"><img src=\"images/view.gif\" alt=\""._SHOW."\" title=\""._SHOW."\" border=\"0\" width=\"17\" height=\"17\"></a></font>&nbsp;</td></tr>";
 136          }
 137          echo "</table>"
 138          ."<br><br>"
 139          ."<center>[ <a href=\"".$admin_file.".php?op=fixweight\">"._FIXBLOCKS."</a> ]</center><br>";
 140          CloseTable();
 141          echo "<br>";
 142          OpenTable();
 143          echo "<center><font class=\"option\"><b>"._ADDNEWBLOCK."</b></font></center><br><br>"
 144          ."<form action=\"".$admin_file.".php\" method=\"post\">"
 145          ."<table border=\"0\" width=\"100%\">"
 146          ."<tr><td>"._TITLE.":</td><td><input type=\"text\" name=\"title\" size=\"30\" maxlength=\"60\"></td></tr>"
 147          ."<tr><td>"._RSSFILE.":</td><td><input type=\"text\" name=\"url\" size=\"30\" maxlength=\"200\">&nbsp;&nbsp;"
 148          ."<select name=\"headline\">"
 149          ."<option name=\"headline\" value=\"0\" selected>"._CUSTOM."</option>";
 150          $res3 = $db->sql_query("select hid, sitename from ".$prefix."_headlines");
 151          while ($row_res3 = $db->sql_fetchrow($res3)) {
 152              $hid = intval($row_res3['hid']);
 153              $htitle = filter($row_res3['sitename'], "nohtml");
 154              echo "<option name=\"headline\" value=\"$hid\">$htitle</option>";
 155          }
 156          echo "</select>&nbsp;[ <a href=\"".$admin_file.".php?op=HeadlinesAdmin\">Setup</a> ]<br><font class=\"tiny\">";
 157          echo ""._SETUPHEADLINES."</font></td></tr>"
 158          ."<tr><td>"._FILENAME.":</td><td>"
 159          ."<select name=\"blockfile\">"
 160          ."<option name=\"blockfile\" value=\"\" selected>"._NONE."</option>";
 161          $blocksdir = dir("blocks");
 162          while($func=$blocksdir->read()) {
 163              if(substr($func, 0, 6) == "block-") {
 164                  $blockslist .= "$func ";
 165              }
 166          }
 167          closedir($blocksdir->handle);
 168          $blockslist = explode(" ", $blockslist);
 169          sort($blockslist);
 170          for ($i=0; $i < sizeof($blockslist); $i++) {
 171              if(!empty($blockslist[$i])) {
 172                  $bl = ereg_replace("block-","",$blockslist[$i]);
 173                  $bl = ereg_replace(".php","",$bl);
 174                  $bl = ereg_replace("_"," ",$bl);
 175                  $result2 = $db->sql_query("select * from ".$prefix."_blocks where blockfile='$blockslist[$i]'");
 176                  $numrows = $db->sql_numrows($result2);
 177                  if ($numrows == 0) {
 178                      echo "<option value=\"$blockslist[$i]\">$bl</option>\n";
 179                  }
 180              }
 181          }
 182          echo "</select>&nbsp;&nbsp;<font class=\"tiny\">"._FILEINCLUDE."</font></td></tr>"
 183          ."<tr><td>"._CONTENT.":</td><td><textarea name=\"content\" cols=\"70\" rows=\"15\"></textarea><br><font class=\"tiny\">"._IFRSSWARNING."</font></td></tr>"
 184          ."<tr><td>"._POSITION.":</td><td><select name=\"bposition\"><option name=\"bposition\" value=\"l\">"._LEFT."</option>"
 185          ."<option name=\"bposition\" value=\"c\">"._CENTERUP."</option>"
 186          ."<option name=\"bposition\" value=\"d\">"._CENTERDOWN."</option>"
 187          ."<option name=\"bposition\" value=\"r\">"._RIGHT."</option></select></td></tr>";
 188          if ($multilingual == 1) {
 189              echo "<tr><td>"._LANGUAGE.":</td><td>"
 190              ."<select name=\"blanguage\">";
 191              $handle=opendir('language');
 192              while ($file = readdir($handle)) {
 193                  if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
 194                      $langFound = $matches[1];
 195                      $languageslist .= "$langFound ";
 196                  }
 197              }
 198              closedir($handle);
 199              $languageslist = explode(" ", $languageslist);
 200              sort($languageslist);
 201              for ($i=0; $i < sizeof($languageslist); $i++) {
 202                  if($languageslist[$i]!="") {
 203                      echo "<option value=\"$languageslist[$i]\" ";
 204                      if($languageslist[$i]==$currentlang) echo "selected";
 205                      echo ">".ucfirst($languageslist[$i])."</option>\n";
 206                  }
 207              }
 208              echo "<option value=\"\">"._ALL."</option></select></td></tr>";
 209          } else {
 210              echo "<input type=\"hidden\" name=\"blanguage\" value=\"\">";
 211          }
 212          echo "<tr><td>"._ACTIVATE2."</td><td><input type=\"radio\" name=\"active\" value=\"1\" checked>"._YES." &nbsp;&nbsp;"
 213          ."<input type=\"radio\" name=\"active\" value=\"0\">"._NO."</td></tr>"
 214          ."<tr><td>"._EXPIRATION.":</td><td><input type=\"text\" name=\"expire\" size=\"4\" maxlength=\"3\" value=\"0\"> "._DAYS."</td></tr>"
 215          ."<tr><td>"._AFTEREXPIRATION.":</td><td><select name=\"action\">"
 216          ."<option name=\"action\" value=\"d\">"._DEACTIVATE."</option>"
 217          ."<option name=\"action\" value=\"r\">"._DELETE."</option></select></td></tr>"
 218          ."<tr><td>"._REFRESHTIME.":</td><td><select name=\"refresh\">"
 219          ."<option name=\"refresh\" value=\"1800\">1/2 "._HOUR."</option>"
 220          ."<option name=\"refresh\" value=\"3600\" selected>1 "._HOUR."</option>"
 221          ."<option name=\"refresh\" value=\"18000\">5 "._HOURS."</option>"
 222          ."<option name=\"refresh\" value=\"36000\">10 "._HOURS."</option>"
 223          ."<option name=\"refresh\" value=\"86400\">24 "._HOURS."</option></select>&nbsp;<font class=\"tiny\">"._ONLYHEADLINES."</font></td></tr>"
 224          ."<tr><td>"._VIEWPRIV."</td><td><select name=\"view\">"
 225          ."<option value=\"0\" >"._MVALL."</option>"
 226          ."<option value=\"1\" >"._MVUSERS."</option>"
 227          ."<option value=\"2\" >"._MVADMIN."</option>"
 228          ."<option value=\"3\" >"._MVANON."</option>"
 229          ."</select></td></tr><tr><td nowrap>"
 230          .""._SUBVISIBLE."</td><td><input type=\"radio\" name=\"subscription\" value=\"0\" checked>"._YES." &nbsp;&nbsp;<input type=\"radio\" name=\"subscription\" value=\"1\">"._NO.""
 231          ."</td></tr></table><br><br>"
 232          ."<input type=\"hidden\" name=\"op\" value=\"BlocksAdd\">"
 233          ."<input type=\"submit\" value=\""._CREATEBLOCK."\"></form>";
 234          CloseTable();
 235          include ("footer.php");
 236      }
 237  
 238  	function block_show($bid) {
 239          global $prefix, $db, $admin_file;
 240          include ("header.php");
 241          GraphicAdmin();
 242          title(""._BLOCKSADMIN."");
 243          OpenTable();
 244          echo "<br><center>";
 245          $bid = intval($bid);
 246          $row = $db->sql_fetchrow($db->sql_query("select bid, bkey, title, content, url, active, bposition, blockfile from ".$prefix."_blocks where bid='$bid'"));
 247          $bid = intval($row['bid']);
 248          $bkey = filter($row['bkey'], "nohtml");
 249          $title = filter($row['title'], "nohtml");
 250          $content = filter($row['content']);
 251          $url = filter($row['url'], "nohtml");
 252          $active = intval($row['active']);
 253          $bposition = filter($row['bposition'], "nohtml");
 254          $blockfile = filter($row['blockfile'], "nohtml");
 255          if ($bkey == "main") {
 256              mainblock();
 257          } elseif ($bkey == "admin") {
 258              adminblock();
 259          } elseif ($bkey == "modules") {
 260              modules_block();
 261          } elseif ($bkey == "category") {
 262              category();
 263          } elseif ($bkey == "userbox") {
 264              userblock();
 265          } elseif (empty($bkey)) {
 266              if (empty($url)) {
 267                  if (empty($blockfile)) {
 268                      if ($bposition == "c") {
 269                          themecenterbox($title, $content);
 270                      } else {
 271                          themesidebox($title, $content);
 272                      }
 273                  } else {
 274                      if ($bposition == "c") {
 275                          blockfileinc($title, $blockfile, 1);
 276                      } else {
 277                          blockfileinc($title, $blockfile);
 278                      }
 279                  }
 280              } else {
 281                  headlines($bid);
 282              }
 283          }
 284          echo "</center>";
 285          CloseTable();
 286          echo "<br>";
 287          OpenTable();
 288          if ($active == 1) {
 289              $act_chg = _DEACTIVATE;
 290          } elseif ($active == 0) {
 291              $act_chg = _ACTIVATE;
 292          }
 293          echo "<center><font class=\"option\"><b>"._BLOCKSADMIN.": "._FUNCTIONS."</b></font><br><br>"
 294          ."[ <a href=\"".$admin_file.".php?op=ChangeStatus&bid=$bid\">$act_chg</a> | <a href=\"".$admin_file.".php?op=BlocksEdit&bid=$bid\">"._EDIT."</a> | ";
 295          if (empty($bkey)) {
 296              echo "<a href=\"".$admin_file.".php?op=BlocksDelete&bid=$bid\">"._DELETE."</a> | ";
 297          } else {
 298              echo ""._DELETE." | ";
 299          }
 300          echo "<a href=\"".$admin_file.".php?op=BlocksAdmin\">"._BLOCKSADMIN."</a> ]</center>";
 301          CloseTable();
 302          include ("footer.php");
 303      }
 304  
 305  	function fixweight() {
 306          global $prefix, $db, $admin_file;
 307          $leftpos = "l";
 308          $rightpos = "r";
 309          $centerpos = "c";
 310          $result = $db->sql_query("select bid from ".$prefix."_blocks where bposition='$leftpos' order by weight ASC");
 311          $weight = 0;
 312          while ($row = $db->sql_fetchrow($result)) {
 313              $bid = intval($row['bid']);
 314              $weight++;
 315              $db->sql_query("update ".$prefix."_blocks set weight='$weight' where bid='$bid'");
 316          }
 317          $result2 = $db->sql_query("select bid from ".$prefix."_blocks where bposition='$rightpos' order by weight ASC");
 318          $weight = 0;
 319          while ($row2 = $db->sql_fetchrow($result2)) {
 320              $bid = intval($row2['bid']);
 321              $weight++;
 322              $db->sql_query("update ".$prefix."_blocks set weight='$weight' where bid='$bid'");
 323          }
 324          $result3 = $db->sql_query("select bid from ".$prefix."_blocks where bposition='$centerpos' order by weight ASC");
 325          $weight = 0;
 326          while ($row3 = $db->sql_fetchrow($result3)) {
 327              $bid = intval($row3['bid']);
 328              $weight++;
 329              $db->sql_query("update ".$prefix."_blocks set weight='$weight' where bid='$bid'");
 330          }
 331          Header("Location: ".$admin_file.".php?op=BlocksAdmin");
 332      }
 333  
 334  	function BlockOrder ($weightrep,$weight,$bidrep,$bidori) {
 335          global $prefix, $db, $admin_file;
 336          $bidrep = intval($bidrep);
 337          $bidori = intval($bidori);
 338          $result = $db->sql_query("update ".$prefix."_blocks set weight='$weight' where bid='$bidrep'");
 339          $result2 = $db->sql_query("update ".$prefix."_blocks set weight='$weightrep' where bid='$bidori'");
 340          Header("Location: ".$admin_file.".php?op=BlocksAdmin");
 341      }
 342  
 343  	function rssfail() {
 344          include ("header.php");
 345          GraphicAdmin();
 346          OpenTable();
 347          echo "<center><font class=\"title\"><b>"._BLOCKSADMIN."</b></font></center>";
 348          CloseTable();
 349          echo "<br>";
 350          OpenTable();
 351          echo "<center><b>"._RSSFAIL."</b><br><br>"
 352          .""._RSSTRYAGAIN."<br><br>"
 353          .""._GOBACK."</center>";
 354          CloseTable();
 355          include ("footer.php");
 356          die;
 357      }
 358  
 359  	function BlocksAdd($title, $content, $url, $bposition, $active, $refresh, $headline, $blanguage, $blockfile, $view, $expire, $action, $subscription) {
 360          global $prefix, $db, $admin_file;
 361          if ($headline != 0) {
 362              $row = $db->sql_fetchrow($db->sql_query("select sitename, headlinesurl from ".$prefix."_headlines where hid='$headline'"));
 363              $title = filter($row['sitename'], "nohtml", 1);
 364              $url = filter($row['headlinesurl'], "nohtml", 1);
 365          }
 366          $row2 = $db->sql_fetchrow($db->sql_query("SELECT weight FROM ".$prefix."_blocks WHERE bposition='$bposition' ORDER BY weight DESC"));
 367          $weight = intval($row2['weight']);
 368          $weight++;
 369          $title = filter($title, "nohtml", 1);
 370          $content = filter($content, "", 1);
 371          $bkey = "";
 372          $btime = "";
 373          if (!empty($blockfile)) {
 374              $url = "";
 375              if (empty($title)) {
 376                  $title = ereg_replace("block-","",$blockfile);
 377                  $title = ereg_replace(".php","",$title);
 378                  $title = ereg_replace("_"," ",$title);
 379              }
 380          }
 381          if (!empty($url)) {
 382              $btime = time();
 383              if (!ereg("http://",$url)) {
 384                  $url = "http://$url";
 385              }
 386              $rdf = parse_url($url);
 387              $fp = fsockopen($rdf['host'], 80, $errno, $errstr, 15);
 388              if (!$fp) {
 389                  rssfail();
 390                  exit;
 391              }
 392              if ($fp) {
 393                  fputs($fp, "GET " . $rdf['path'] . "?" . $rdf['query'] . " HTTP/1.0\r\n");
 394                  fputs($fp, "HOST: " . $rdf['host'] . "\r\n\r\n");
 395                  $string = "";
 396                  while(!feof($fp)) {
 397                      $pagetext = fgets($fp,228);
 398                      $string .= chop($pagetext);
 399                  }
 400                  fputs($fp,"Connection: close\r\n\r\n");
 401                  fclose($fp);
 402                  $items = explode("</item>",$string);
 403                  $content = "<font class=\"content\">";
 404                  for ($i=0;$i<10;$i++) {
 405                      $link = ereg_replace(".*<link>","",$items[$i]);
 406                      $link = ereg_replace("</link>.*","",$link);
 407                      $title2 = ereg_replace(".*<title>","",$items[$i]);
 408                      $title2 = ereg_replace("</title>.*","",$title2);
 409                      if ($items[$i] == "" AND $cont != 1) {
 410                          $content = "";
 411                      } else {
 412                          if (strcmp($link,$title2) AND !empty($items[$i])) {
 413                              $cont = 1;
 414                              $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"$link\" target=\"new\">$title2</a><br>\n";
 415                          }
 416                      }
 417                  }
 418              }
 419          }
 420          $content = filter($content, "", 1);
 421          if (($content == "") AND ($blockfile == "")) {
 422              rssfail();
 423          } else {
 424              if ($expire == "") {
 425                  $expire = 0;
 426              }
 427              if ($expire != 0) {
 428                  $expire = time() + ($expire * 86400);
 429              }
 430              $db->sql_query("insert into ".$prefix."_blocks values (NULL, '$bkey', '$title', '$content', '$url', '$bposition', '$weight', '$active', '$refresh', '$btime', '$blanguage', '$blockfile', '$view', '$expire', '$action', '$subscription')");
 431              Header("Location: ".$admin_file.".php?op=BlocksAdmin");
 432          }
 433      }
 434  
 435  	function BlocksEdit($bid) {
 436          global $bgcolor2, $bgcolor4, $prefix, $db, $multilingual, $admin_file, $AllowableHTML;
 437          include ("header.php");
 438          GraphicAdmin();
 439          OpenTable();
 440          echo "<center><font class=\"title\"><b>"._EDITBLOCK."</b></font></center>";
 441          CloseTable();
 442          echo "<br>";
 443          $bid = intval($bid);
 444          $row = $db->sql_fetchrow($db->sql_query("select bkey, title, content, url, bposition, weight, active, refresh, blanguage, blockfile, view, expire, action, subscription from ".$prefix."_blocks where bid='$bid'"));
 445          $bkey = filter($row['bkey'], "nohtml");
 446          $title = filter($row['title'], "nohtml");
 447          $content = filter($row[content]);
 448          $url = filter($row['url'], "nohtml");
 449          $bposition = filter($row['bposition'], "nohtml");
 450          $weight = intval($row['weight']);
 451          $active = intval($row['active']);
 452          $refresh = intval($row['refresh']);
 453          $blanguage = $row['blanguage'];
 454          $blockfile = filter($row['blockfile'], "nohtml");
 455          $view = intval($row['view']);
 456          $expire = intval($row['expire']);
 457          $action = intval($row['action']);
 458          $subscription = intval($row['subscription']);
 459          if ($url != "") {
 460              $type = _RSSCONTENT;
 461          } elseif ($blockfile != "") {
 462              $type = _BLOCKFILE;
 463          }
 464          OpenTable();
 465          echo "<center><font class=\"option\"><b>"._BLOCK.": $title $type</b></font></center><br><br>"
 466          ."<form action=\"".$admin_file.".php\" method=\"post\">"
 467          ."<table border=\"0\" width=\"100%\">"
 468          ."<tr><td>"._TITLE.":</td><td><input type=\"text\" name=\"title\" size=\"30\" maxlength=\"60\" value=\"$title\"></td></tr>";
 469          if ($blockfile != "") {
 470              echo "<tr><td>"._FILENAME.":</td><td>"
 471              ."<select name=\"blockfile\">";
 472              $blocksdir = dir("blocks");
 473              while($func=$blocksdir->read()) {
 474                  if(substr($func, 0, 6) == "block-") {
 475                      $blockslist .= "$func ";
 476                  }
 477              }
 478              closedir($blocksdir->handle);
 479              $blockslist = explode(" ", $blockslist);
 480              sort($blockslist);
 481              for ($i=0; $i < sizeof($blockslist); $i++) {
 482                  if($blockslist[$i]!="") {
 483                      $bl = ereg_replace("block-","",$blockslist[$i]);
 484                      $bl = ereg_replace(".php","",$bl);
 485                      $bl = ereg_replace("_"," ",$bl);
 486                      echo "<option value=\"$blockslist[$i]\" ";
 487                      if ($blockfile == $blockslist[$i]) { echo "selected"; }
 488                      echo ">$bl</option>\n";
 489                  }
 490              }
 491              echo "</select>&nbsp;&nbsp;<font class=\"tiny\">"._FILEINCLUDE."</font></td></tr>";
 492          } else {
 493              if ($url != "") {
 494                  echo "<tr><td>"._RSSFILE.":</td><td><input type=\"text\" name=\"url\" size=\"30\" maxlength=\"200\" value=\"$url\">&nbsp;&nbsp;<font class=\"tiny\">"._ONLYHEADLINES."</font></td></tr>";
 495              } else {
 496                  echo "<tr><td>"._CONTENT.":</td><td><textarea name=\"content\" cols=\"70\" rows=\"15\">$content</textarea></td></tr>";
 497              }
 498          }
 499          $oldposition = $bposition;
 500          echo "<input type=\"hidden\" name=\"oldposition\" value=\"$oldposition\">";
 501          $sel1 = $sel2 = $sel3 = $sel4 = "";
 502          if ($bposition == "l") {
 503              $sel1 = "selected";
 504          } elseif ($bposition == "c") {
 505              $sel2 = "selected";
 506          } elseif ($bposition == "r") {
 507              $sel3 = "selected";
 508          } elseif ($bposition == "d") {
 509              $sel4 = "selected";
 510          }
 511          echo "<tr><td>"._POSITION.":</td><td><select name=\"bposition\">"
 512          ."<option name=\"bposition\" value=\"l\" $sel1>"._LEFT."</option>"
 513          ."<option name=\"bposition\" value=\"c\" $sel2>"._CENTERUP."</option>"
 514          ."<option name=\"bposition\" value=\"d\" $sel4>"._CENTERDOWN."</option>"
 515          ."<option name=\"bposition\" value=\"r\" $sel3>"._RIGHT."</option></select></td></tr>";
 516          if ($multilingual == 1) {
 517              echo "<tr><td>"._LANGUAGE.":</td><td>"
 518              ."<select name=\"blanguage\">";
 519              $handle=opendir('language');
 520              while ($file = readdir($handle)) {
 521                  if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
 522                      $langFound = $matches[1];
 523                      $languageslist .= "$langFound ";
 524                  }
 525              }
 526              closedir($handle);
 527              $languageslist = explode(" ", $languageslist);
 528              sort($languageslist);
 529              for ($i=0; $i < sizeof($languageslist); $i++) {
 530                  if($languageslist[$i]!="") {
 531                      echo "<option value=\"$languageslist[$i]\" ";
 532                      if($languageslist[$i]==$blanguage) echo "selected";
 533                      echo ">".ucfirst($languageslist[$i])."</option>\n";
 534                  }
 535              }
 536              if ($blanguage != "") {
 537                  $sel3 = "";
 538              } else {
 539                  $sel3 = "selected";
 540              }
 541              echo "<option value=\"\" $sel3>"._ALL."</option></select></td></tr>";
 542          } else {
 543              echo "<input type=\"hidden\" name=\"blanguage\" value=\"\">";
 544          }
 545          if ($active == 1) {
 546              $sel1 = "checked";
 547              $sel2 = "";
 548          } elseif ($active == 0) {
 549              $sel1 = "";
 550              $sel2 = "checked";
 551          }
 552          if ($expire != 0) {
 553              $oldexpire = $expire;
 554              $expire = intval(($expire - time()) / 3600);
 555              $exp_day = $expire / 24;
 556              $expire = "<input type=\"hidden\" name=\"expire\" value=\"$oldexpire\"><b>$expire "._HOURS." (".substr($exp_day,0,5)." "._DAYS.")</b> <input type='text' name='moretime' size='4'> "._MOREDAYS."";
 557          } else {
 558              $expire = "<input type=\"text\" name=\"expire\" value=\"0\" size=\"4\" maxlength=\"3\"> "._DAYS."";
 559          }
 560          if ($action == "d") {
 561              $selact1 = "selected";
 562              $selact2 = "";
 563          } elseif ($action == "r") {
 564              $selact1 = "";
 565              $selact2 = "selected";
 566          }
 567          echo "<tr><td>"._ACTIVATE2."</td><td><input type=\"radio\" name=\"active\" value=\"1\" $sel1>"._YES." &nbsp;&nbsp;"
 568          ."<input type=\"radio\" name=\"active\" value=\"0\" $sel2>"._NO."</td></tr>"
 569          ."<tr><td>"._EXPIRATION.":</td><td>$expire</td></tr>"
 570          ."<tr><td>"._AFTEREXPIRATION.":</td><td><select name=\"action\">"
 571          ."<option name=\"action\" value=\"d\" $selact1>"._DEACTIVATE."</option>"
 572          ."<option name=\"action\" value=\"r\" $selact2>"._DELETE."</option></select></td></tr>";
 573          if ($url != "") {
 574              $sel1 = $sel2 = $sel3 = $sel4 = $sel5 = "";
 575              if ($refresh == 1800) {
 576                  $sel1 = "selected";
 577              } elseif ($refresh == 3600) {
 578                  $sel2 = "selected";
 579              } elseif ($refresh == 18000) {
 580                  $sel3 = "selected";
 581              } elseif ($refresh == 36000) {
 582                  $sel4 = "selected";
 583              } elseif ($refresh == 86400) {
 584                  $sel5 = "selected";
 585              }
 586              echo "<tr><td>"._REFRESHTIME.":</td><td><select name=\"refresh\"><option name=\"refresh\" value=\"1800\" $sel1>1/2 "._HOUR."</option>"
 587              ."<option name=\"refresh\" value=\"3600\" $sel2>1 "._HOUR."</option>"
 588              ."<option name=\"refresh\" value=\"18000\" $sel3>5 "._HOURS."</option>"
 589              ."<option name=\"refresh\" value=\"36000\" $sel4>10 "._HOURS."</option>"
 590              ."<option name=\"refresh\" value=\"86400\" $sel5>24 "._HOURS."</option></select>&nbsp;<font class=\"tiny\">"._ONLYHEADLINES."</font>";
 591          }
 592          $sel1 = $sel2 = $sel3 = $sel4 = "";
 593          if ($view == 0) {
 594              $sel1 = "selected";
 595          } elseif ($view == 1) {
 596              $sel2 = "selected";
 597          } elseif ($view == 2) {
 598              $sel3 = "selected";
 599          } elseif ($view == 3) {
 600              $sel4 = "selected";
 601          }
 602          if ($subscription == 1) {
 603              $sub_c1 = "";
 604              $sub_c2 = "checked";
 605          } else {
 606              $sub_c1 = "checked";
 607              $sub_c2 = "";
 608          }
 609          echo "</td></tr><tr><td>"._VIEWPRIV."</td><td><select name=\"view\">"
 610          ."<option value=\"0\" $sel1>"._MVALL."</option>"
 611          ."<option value=\"1\" $sel2>"._MVUSERS."</option>"
 612          ."<option value=\"2\" $sel3>"._MVADMIN."</option>"
 613          ."<option value=\"3\" $sel4>"._MVANON."</option>"
 614          ."</select></td></tr><tr><td nowrap>"
 615          .""._SUBVISIBLE."</td><td><input type='radio' name='subscription' value='0' $sub_c1> "._YES."&nbsp;&nbsp;<input type='radio' name='subscription' value='1' $sub_c2> "._NO.""
 616          ."</td></tr></table><br><br>"
 617          ."<input type=\"hidden\" name=\"bid\" value=\"$bid\">"
 618          ."<input type=\"hidden\" name=\"bkey\" value=\"$bkey\">"
 619          ."<input type=\"hidden\" name=\"weight\" value=\"$weight\">"
 620          ."<input type=\"hidden\" name=\"op\" value=\"BlocksEditSave\">"
 621          ."<input type=\"submit\" value=\""._SAVEBLOCK."\"></form>";
 622          CloseTable();
 623          include ("footer.php");
 624      }
 625  
 626  	function SortWeight($bposition) {
 627          global $prefix, $db;
 628          $numbers = 1;
 629          $number_two = 1;
 630          $result = $db->sql_query("SELECT bid,weight FROM ".$prefix."_blocks WHERE bposition='$bposition' ORDER BY weight");
 631          while ($row = $db->sql_fetchrow($result)) {
 632              $bid = intval($row['bid']);
 633              $weight = intval($row['weight']);
 634              $result2 = $db->sql_query("update ".$prefix."_blocks set weight='$numbers' where bid='$bid'");
 635              $numbers++;
 636          }
 637          if ($bposition == l) {
 638              $position_two = "r";
 639          } else {
 640              $position_two = "l";
 641          }
 642          $result_two = $db->sql_query("SELECT bid,weight FROM ".$prefix."_blocks WHERE bposition='$position_two' ORDER BY weight");
 643          while ($row_two = $db->sql_fetchrow($result_two)) {
 644              $bid2 = intval($row_two['bid']);
 645              $weight = intval($row_two['weight']);
 646              $result_two2 = $db->sql_query("update ".$prefix."_blocks set weight='$number_two' where bid='$bid2'");
 647              $number_two++;
 648          }
 649          return $numbers;
 650      }
 651  
 652  	function BlocksEditSave($bid, $bkey, $title, $content, $url, $oldposition, $bposition, $active, $refresh, $weight, $blanguage, $blockfile, $view, $expire, $action, $subscription, $moretime) {
 653          global $prefix, $db, $admin_file;
 654          if (!empty($moretime)) {
 655              $moretime = $moretime * 86400;
 656              $expire = $moretime + $expire;
 657          }
 658          if (!empty($url)) {
 659              $bkey = "";
 660              $btime = time();
 661              if (!ereg("http://",$url)) {
 662                  $url = "http://$url";
 663              }
 664              $rdf = parse_url($url);
 665              $fp = fsockopen($rdf['host'], 80, $errno, $errstr, 15);
 666              if (!$fp) {
 667                  rssfail();
 668                  exit;
 669              }
 670              if ($fp) {
 671                  fputs($fp, "GET " . $rdf['path'] . "?" . $rdf['query'] . " HTTP/1.0\r\n");
 672                  fputs($fp, "HOST: " . $rdf['host'] . "\r\n\r\n");
 673                  $string    = "";
 674                  while(!feof($fp)) {
 675                      $pagetext = fgets($fp,300);
 676                      $string .= chop($pagetext);
 677                  }
 678                  fputs($fp,"Connection: close\r\n\r\n");
 679                  fclose($fp);
 680                  $items = explode("</item>",$string);
 681                  $content = "<font class=\"content\">";
 682                  for ($i=0;$i<10;$i++) {
 683                      $link = ereg_replace(".*<link>","",$items[$i]);
 684                      $link = ereg_replace("</link>.*","",$link);
 685                      $title2 = ereg_replace(".*<title>","",$items[$i]);
 686                      $title2 = ereg_replace("</title>.*","",$title2);
 687                      if ($items[$i] == "" AND $cont != 1) {
 688                          $content = "";
 689                      } else {
 690                          if (strcmp($link,$title2) AND $items[$i] != "") {
 691                              $cont = 1;
 692                              $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"$link\" target=\"new\">$title2</a><br>\n";
 693                          }
 694                      }
 695                  }
 696              }
 697              if ($oldposition != $bposition) {
 698                  $result = $db->sql_query("select bid from ".$prefix."_blocks where weight>='$weight' AND bposition='$bposition'");
 699                  $fweight = $weight;
 700                  $oweight = $weight;
 701                  while ($row = $db->sql_fetchrow($result)) {
 702                      $nbid = intval($row['bid']);
 703                      $weight++;
 704                      $db->sql_query("update ".$prefix."_blocks set weight='$weight' where bid='$nbid'");
 705                  }
 706                  $result2 = $db->sql_query("select bid from ".$prefix."_blocks where weight>'$oweight' AND bposition='$oldposition'");
 707                  while ($row2 = $db->sql_fetchrow($result2)) {
 708                      $obid = intval($row2['bid']);
 709                      $db->sql_query("update ".$prefix."_blocks set weight='$oweight' where bid='$obid'");
 710                      $oweight++;
 711                  }
 712                  $row3 = $db->sql_fetchrow($db->sql_query("select weight from ".$prefix."_blocks where bposition='$bposition' order by weight DESC limit 0,1"));
 713                  $lastw = $row3['weight'];
 714                  if ($lastw <= $fweight) {
 715                      $lastw++;
 716                      $db->sql_query("update ".$prefix."_blocks set title='$title', content='$content', bposition='$bposition', weight='$lastw', active='$active', refresh='$refresh', blanguage='$blanguage', blockfile='$blockfile', view='$view', subscription='$subscription' where bid='$bid'");
 717                  } else {
 718                      $db->sql_query("update ".$prefix."_blocks set title='$title', content='$content', bposition='$bposition', weight='$fweight', active='$active', refresh='$refresh', blanguage='$blanguage', blockfile='$blockfile', view='$view', subscription='$subscription' where bid='$bid'");
 719                  }
 720              } else {
 721                  $db->sql_query("update ".$prefix."_blocks set bkey='$bkey', title='$title', content='$content', url='$url', bposition='$bposition', weight='$weight', active='$active', refresh='$refresh', blanguage='$blanguage', blockfile='$blockfile', view='$view', subscription='$subscription' where bid='$bid'");
 722              }
 723              Header("Location: ".$admin_file.".php?op=BlocksAdmin");
 724          } else {
 725              $title = filter($title, "nohtml", 1);
 726              $content = filter($content, "", 1);
 727              if ($oldposition != $bposition) {
 728                  $result5 = $db->sql_query("select bid from ".$prefix."_blocks where weight>='$weight' AND bposition='$bposition'");
 729                  $fweight = $weight;
 730                  $oweight = $weight;
 731                  while ($row5 = $db->sql_fetchrow($result5)) {
 732                      $nbid = intval($row5['bid']);
 733                      $weight++;
 734                      $db->sql_query("update ".$prefix."_blocks set weight='$weight' where bid='$nbid'");
 735                  }
 736                  $result6 = $db->sql_query("select bid from ".$prefix."_blocks where weight>'$oweight' AND bposition='$oldposition'");
 737                  while ($row6 = $db->sql_fetchrow($result6)) {
 738                      $obid = intval($row6['bid']);
 739                      $db->sql_query("update ".$prefix."_blocks set weight='$oweight' where bid='$obid'");
 740                      $oweight++;
 741                  }
 742                  $row7 = $db->sql_fetchrow($db->sql_query("select weight from ".$prefix."_blocks where bposition='$bposition' order by weight DESC limit 0,1"));
 743                  $lastw = $row7['weight'];
 744                  if ($lastw <= $fweight) {
 745                      $lastw++;
 746                      $db->sql_query("update ".$prefix."_blocks set title='$title', content='$content', bposition='$bposition', weight='$lastw', active='$active', refresh='$refresh', blanguage='$blanguage', blockfile='$blockfile', view='$view', subscription='$subscription' where bid='$bid'");
 747                  } else {
 748                      $db->sql_query("update ".$prefix."_blocks set title='$title', content='$content', bposition='$bposition', weight='$fweight', active='$active', refresh='$refresh', blanguage='$blanguage', blockfile='$blockfile', view='$view', subscription='$subscription' where bid='$bid'");
 749                  }
 750              } else {
 751                  if (empty($expire)) {
 752                      $expire = 0;
 753                  }
 754                  if ($expire != 0 AND $expire <= 999) {
 755                      $expire = time() + ($expire * 86400);
 756                  }
 757                  $result8 = $db->sql_query("update ".$prefix."_blocks set bkey='$bkey', title='$title', content='$content', url='$url', bposition='$bposition', weight='$weight', active='$active', refresh='$refresh', blanguage='$blanguage', blockfile='$blockfile', view='$view', expire='$expire', action='$action', subscription='$subscription' where bid='$bid'");
 758              }
 759              Header("Location: ".$admin_file.".php?op=BlocksAdmin");
 760          }
 761      }
 762  
 763  	function ChangeStatus($bid, $ok=0) {
 764          global $prefix, $db, $admin_file;
 765          $bid = intval($bid);
 766          $row = $db->sql_fetchrow($db->sql_query("select active from ".$prefix."_blocks where bid='$bid'"));
 767          $active = intval($row['active']);
 768          if (($ok) OR ($active == 1)) {
 769              if ($active == 0) {
 770                  $active = 1;
 771              } elseif ($active == 1) {
 772                  $active = 0;
 773              }
 774              $result2 = $db->sql_query("update ".$prefix."_blocks set active='$active' where bid='$bid'");
 775              Header("Location: ".$admin_file.".php?op=BlocksAdmin");
 776          } else {
 777              $row3 = $db->sql_fetchrow($db->sql_query("select title, content from ".$prefix."_blocks where bid='$bid'"));
 778              $title = filter($row3['title'], "nohtml");
 779              $content = filter($row3['content']);
 780              include ("header.php");
 781              GraphicAdmin();
 782              echo "<br>";
 783              OpenTable();
 784              echo "<center><font class=\"option\"><b>"._BLOCKACTIVATION."</b></font></center>";
 785              CloseTable();
 786              echo "<br>";
 787              OpenTable();
 788              if (!empty($content)) {
 789                  echo "<center>"._BLOCKPREVIEW." <i>$title</i><br><br>";
 790                  themesidebox($title, $content);
 791              } else {
 792                  echo "<center><i>$title</i><br><br>";
 793              }
 794              echo "<br>"._WANT2ACTIVATE."<br><br>"
 795              ."[ <a href=\"".$admin_file.".php?op=BlocksAdmin\">"._NO."</a> | <a href=\"".$admin_file.".php?op=ChangeStatus&amp;bid=$bid&amp;ok=1\">"._YES."</a> ]"
 796              ."</center>";
 797              CloseTable();
 798              include ("footer.php");
 799          }
 800      }
 801  
 802  	function BlocksDelete($bid, $ok=0) {
 803          global $prefix, $db, $admin_file;
 804          $bid = intval($bid);
 805          if ($ok) {
 806              $row = $db->sql_fetchrow($db->sql_query("select bposition, weight from ".$prefix."_blocks where bid='$bid'"));
 807              $bposition = filter($row['bposition'], "nohtml");
 808              $weight = intval($row['weight']);
 809              $result2 = $db->sql_query("select bid from ".$prefix."_blocks where weight>'$weight' AND bposition='$bposition'");
 810              while ($row2 = $db->sql_fetchrow($result2)) {
 811                  $nbid = intval($row2['bid']);
 812                  $db->sql_query("update ".$prefix."_blocks set weight='$weight' where bid='$nbid'");
 813                  $weight++;
 814              }
 815              $db->sql_query("delete from ".$prefix."_blocks where bid='$bid'");
 816              Header("Location: ".$admin_file.".php?op=BlocksAdmin");
 817          } else {
 818              $row3 = $db->sql_fetchrow($db->sql_query("select title from ".$prefix."_blocks where bid='$bid'"));
 819              $title = $row3['title'];
 820              include ("header.php");
 821              GraphicAdmin();
 822              OpenTable();
 823              echo "<center><font class=\"title\"><b>"._BLOCKSADMIN."</b></font></center>";
 824              CloseTable();
 825              echo "<br>";
 826              OpenTable();
 827              echo "<center>"._ARESUREDELBLOCK." <i>$title</i>?";
 828              echo "<br><br>[ <a href=\"".$admin_file.".php?op=BlocksAdmin\">"._NO."</a> | <a href=\"".$admin_file.".php?op=BlocksDelete&amp;bid=$bid&amp;ok=1\">"._YES."</a> ]</center>";
 829              CloseTable();
 830              include ("footer.php");
 831          }
 832      }
 833  
 834  	function HeadlinesAdmin() {
 835          global $bgcolor1, $bgcolor2, $prefix, $db, $admin_file;
 836          include  ("header.php");
 837          GraphicAdmin();
 838          OpenTable();
 839          echo "<center><font class=\"title\"><b>"._HEADLINESADMIN."</b></font></center>";
 840          CloseTable();
 841          echo "<br>";
 842          OpenTable();
 843          echo "<form action=\"".$admin_file.".php\" method=\"post\">"
 844          ."<table border=\"1\" width=\"100%\" align=\"center\"><tr>"
 845          ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._SITENAME."</b></td>"
 846          ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._URL."</b></td>"
 847          ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._FUNCTIONS."</b></td><tr>";
 848          $result = $db->sql_query("select hid, sitename, headlinesurl from ".$prefix."_headlines order by hid");
 849          while ($row = $db->sql_fetchrow($result)) {
 850              $hid = intval($row['hid']);
 851              $sitename = filter($row['sitename'], "nohtml");
 852              $headlinesurl = filter($row['headlinesurl'], "nohtml");
 853              echo "<td bgcolor=\"$bgcolor1\" align=\"center\">$sitename</td>"
 854              ."<td bgcolor=\"$bgcolor1\" align=\"center\"><a href=\"$headlinesurl\" target=\"new\">$headlinesurl</a></td>"
 855              ."<td bgcolor=\"$bgcolor1\" align=\"center\">[ <a href=\"".$admin_file.".php?op=HeadlinesEdit&amp;hid=$hid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=HeadlinesDel&amp;hid=$hid&amp;ok=0\">"._DELETE."</a> ]</td><tr>";
 856          }
 857          echo "</form></td></tr></table>";
 858          CloseTable();
 859          echo "<br>";
 860          OpenTable();
 861          echo "<font class=\"option\"><b>"._ADDHEADLINE."</b></font><br><br>"
 862          ."<font class=\"content\">"
 863          ."<form action=\"".$admin_file.".php\" method=\"post\">"
 864          ."<table border=\"0\" width=\"100%\"><tr><td>"
 865          .""._SITENAME.":</td><td><input type=\"text\" name=\"xsitename\" size=\"31\" maxlength=\"30\"></td></tr><tr><td>"
 866          .""._RSSFILE.":</td><td><input type=\"text\" name=\"headlinesurl\" size=\"50\" maxlength=\"200\"></td></tr><tr><td>"
 867          ."</td></tr></table>"
 868          ."<input type=\"hidden\" name=\"op\" value=\"HeadlinesAdd\">"
 869          ."<input type=\"submit\" value=\""._ADD."\">"
 870          ."</form>";
 871          CloseTable();
 872          include ("footer.php");
 873      }
 874  
 875  	function HeadlinesEdit($hid) {
 876          global $prefix, $db, $admin_file;
 877          include  ("header.php");
 878          GraphicAdmin();
 879          OpenTable();
 880          echo "<center><font class=\"title\"><b>"._HEADLINESADMIN."</b></font></center>";
 881          CloseTable();
 882          echo "<br>";
 883          $row = $db->sql_fetchrow($db->sql_query("select sitename, headlinesurl from ".$prefix."_headlines where hid='$hid'"));
 884          $xsitename = filter($row['sitename'], "nohtml");
 885          $headlinesurl = filter($row['headlinesurl'], "nohtml");
 886          OpenTable();
 887          echo "<center><font class=\"option\"><b>"._EDITHEADLINE."</b></font></center>
 888      <form action=\"".$admin_file.".php\" method=\"post\">
 889      <input type=\"hidden\" name=\"hid\" value=\"$hid\">
 890      <table border=\"0\" width=\"100%\"><tr><td>
 891      "._SITENAME.":</td><td><input type=\"text\" name=\"xsitename\" size=\"31\" maxlength=\"30\" value=\"$xsitename\"></td></tr><tr><td>
 892      "._RSSFILE.":</td><td><input type=\"text\" name=\"headlinesurl\" size=\"50\" maxlength=\"200\" value=\"$headlinesurl\"></td></tr><tr><td>
 893      </select></td></tr></table>
 894      <input type=\"hidden\" name=\"op\" value=\"HeadlinesSave\">
 895      <input type=\"submit\" value=\""._SAVECHANGES."\">
 896      </form>";
 897          CloseTable();
 898          include ("footer.php");
 899      }
 900  
 901  	function HeadlinesSave($hid, $xsitename, $headlinesurl) {
 902          global $prefix, $db, $admin_file;
 903          $hid = intval($hid);
 904          $xsitename = filter($xsitename, "nohtml", 1);
 905          $headlinesurl = filter($headlinesurl, "nohtml", 1);
 906          $xsitename = ereg_replace(" ", "", $xsitename);
 907          $db->sql_query("update ".$prefix."_headlines set sitename='$xsitename', headlinesurl='$headlinesurl' where hid='$hid'");
 908          Header("Location: ".$admin_file.".php?op=HeadlinesAdmin");
 909      }
 910  
 911  	function HeadlinesAdd($xsitename, $headlinesurl) {
 912          global $prefix, $db, $admin_file;
 913          $xsitename = filter($xsitename, "nohtml", 1);
 914          $headlinesurl = filter($headlinesurl, "nohtml", 1);
 915          $xsitename = ereg_replace(" ", "", $xsitename);
 916          $db->sql_query("insert into ".$prefix."_headlines values (NULL, '$xsitename', '$headlinesurl')");
 917          Header("Location: ".$admin_file.".php?op=HeadlinesAdmin");
 918      }
 919  
 920  	function HeadlinesDel($hid, $ok=0) {
 921          global $prefix, $db, $admin_file;
 922          $hid = intval($hid);
 923          if($ok==1) {
 924              $db->sql_query("delete from ".$prefix."_headlines where hid='$hid'");
 925              Header("Location: ".$admin_file.".php?op=HeadlinesAdmin");
 926          } else {
 927              include ("header.php");
 928              GraphicAdmin();
 929              OpenTable();
 930              echo "<center><br>";
 931              echo "<font class=\"option\">";
 932              echo "<b>"._SURE2DELHEADLINE."</b></font><br><br>";
 933          }
 934          echo "[ <a href=\"".$admin_file.".php?op=HeadlinesDel&amp;hid=$hid&amp;ok=1\">"._YES."</a> | <a href=\"".$admin_file.".php?op=HeadlinesAdmin\">"._NO."</a> ]<br><br>";
 935          CloseTable();
 936          include ("footer.php");
 937      }
 938  
 939      switch($op) {
 940  
 941          case "BlocksAdmin":
 942          BlocksAdmin();
 943          break;
 944  
 945          case "BlocksAdd":
 946          BlocksAdd($title, $content, $url, $bposition, $active, $refresh, $headline, $blanguage, $blockfile, $view, $expire, $action, $subscription);
 947          break;
 948  
 949          case "BlocksEdit":
 950          BlocksEdit($bid);
 951          break;
 952  
 953          case "BlocksEditSave":
 954          BlocksEditSave($bid, $bkey, $title, $content, $url, $oldposition, $bposition, $active, $refresh, $weight, $blanguage, $blockfile, $view, $expire, $action, $subscription, $moretime);
 955          break;
 956  
 957          case "ChangeStatus":
 958          ChangeStatus($bid, $ok, $de);
 959          break;
 960  
 961          case "BlocksDelete":
 962          BlocksDelete($bid, $ok);
 963          break;
 964  
 965          case "BlockOrder":
 966          BlockOrder ($weightrep,$weight,$bidrep,$bidori);
 967          break;
 968  
 969          case "HeadlinesDel":
 970          HeadlinesDel($hid, $ok);
 971          break;
 972  
 973          case "HeadlinesAdd":
 974          HeadlinesAdd($xsitename, $headlinesurl);
 975          break;
 976  
 977          case "HeadlinesSave":
 978          HeadlinesSave($hid, $xsitename, $headlinesurl);
 979          break;
 980  
 981          case "HeadlinesAdmin":
 982          HeadlinesAdmin();
 983          break;
 984  
 985          case "HeadlinesEdit":
 986          HeadlinesEdit($hid);
 987          break;
 988  
 989          case "fixweight":
 990          fixweight();
 991          break;
 992  
 993          case "block_show":
 994          block_show($bid);
 995          break;
 996  
 997      }
 998  
 999  } else {
1000      echo "Access Denied";
1001  }
1002  
1003  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7