[ PHPXref.com ] [ Generated: Sun Jul 20 19:31:32 2008 ] [ phpAdsNew 2.0.8 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/admin/ -> zone-include.php (source)

   1  <?php // $Revision: 2.0.2.9 $
   2  
   3  /************************************************************************/
   4  /* phpAdsNew 2                                                          */
   5  /* ===========                                                          */
   6  /*                                                                      */
   7  /* Copyright (c) 2000-2006 by the phpAdsNew developers                  */
   8  /* For more information visit: http://www.phpadsnew.com                 */
   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  
  16  
  17  // Include required files
  18  require  ("config.php");
  19  require  ("lib-statistics.inc.php");
  20  require  ("lib-zones.inc.php");
  21  
  22  
  23  // Register input variables
  24  phpAds_registerGlobal ('action', 'zonetype', 'what', 'submit',
  25                         'showbanners', 'showcampaigns', 'hideinactive');
  26  
  27  
  28  // Security check
  29  phpAds_checkAccess(phpAds_Admin+phpAds_Affiliate);
  30  
  31  
  32  
  33  /*********************************************************/
  34  /* Affiliate interface security                          */
  35  /*********************************************************/
  36  
  37  if (phpAds_isUser(phpAds_Affiliate))
  38  {
  39      $result = phpAds_dbQuery("
  40          SELECT
  41              affiliateid
  42          FROM
  43              ".$phpAds_config['tbl_zones']."
  44          WHERE
  45              zoneid = '$zoneid'
  46          ") or phpAds_sqlDie();
  47      $row = phpAds_dbFetchArray($result);
  48      
  49      if ($row["affiliateid"] == '' || phpAds_getUserID() != $row["affiliateid"] || !phpAds_isAllowed(phpAds_LinkBanners))
  50      {
  51          phpAds_PageHeader("1");
  52          phpAds_Die ($strAccessDenied, $strNotAdmin);
  53      }
  54      else
  55      {
  56          $affiliateid = $row["affiliateid"];
  57      }
  58  }
  59  
  60  
  61  
  62  /*********************************************************/
  63  /* Process submitted form                                */
  64  /*********************************************************/
  65  
  66  if (isset($zoneid) && $zoneid != '')
  67  {
  68      if (isset($action) && $action == 'toggle')
  69      {
  70          // Update zonetype
  71          $result = phpAds_dbQuery("
  72              SELECT
  73                  *
  74              FROM
  75                  ".$phpAds_config['tbl_zones']."
  76              WHERE
  77                  zoneid = '".$zoneid."'
  78          ") or phpAds_sqlDie();
  79          
  80          if ($row = phpAds_dbFetchArray($result))
  81          {
  82              if ($row['zonetype'] != $zonetype)
  83              {
  84                  $res = phpAds_dbQuery("
  85                      UPDATE
  86                          ".$phpAds_config['tbl_zones']."
  87                      SET
  88                          zonetype = ".$zonetype.",
  89                          what = ''
  90                      WHERE
  91                          zoneid = '".$zoneid."'
  92                  ") or phpAds_sqlDie();
  93              }
  94          }
  95          
  96          if ($zonetype == phpAds_ZoneBanners)
  97          {
  98              if (isset($bannerid) && $bannerid != '')
  99              {
 100                  phpAds_ToggleBannerInZone ($bannerid, $zoneid);
 101              }
 102          }
 103          
 104          if ($zonetype == phpAds_ZoneCampaign)
 105          {
 106              if (isset($campaignid) && $campaignid != '')
 107              {
 108                  phpAds_ToggleCampaignInZone ($campaignid, $zoneid);
 109              }
 110          }
 111          
 112          header ("Location: zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&clientid=".$clientid."&campaignid=".$campaignid);
 113          exit;
 114      }
 115      
 116      if (isset($action) && $action == 'set')
 117      {
 118          if (!isset($what)) $what = '';
 119          
 120          if ($zonetype == phpAds_ZoneBanners)
 121          {
 122              if (isset($bannerid) && is_array($bannerid))
 123              {
 124                  for ($i=0;$i<sizeof($bannerid);$i++)
 125                      $bannerid[$i] = 'bannerid:'.$bannerid[$i];
 126                  
 127                  $what .= implode (',', $bannerid);
 128              }
 129          }
 130          
 131          if ($zonetype == phpAds_ZoneCampaign)
 132          {
 133              if (isset($clientid) && is_array($clientid))
 134              {
 135                  for ($i=0;$i<sizeof($clientid);$i++)
 136                      $clientid[$i] = 'clientid:'.$clientid[$i];
 137                  
 138                  $what .= implode (',', $clientid);
 139              }
 140          }
 141          
 142          if (isset($zonetype))
 143          {
 144              $res = phpAds_dbQuery("
 145                  UPDATE
 146                      ".$phpAds_config['tbl_zones']."
 147                  SET
 148                      what = '$what',
 149                      zonetype = $zonetype
 150                  WHERE
 151                      zoneid=$zoneid
 152              ") or phpAds_sqlDie();
 153          }
 154          
 155          // Rebuild Cache
 156          if (!defined('LIBVIEWCACHE_INCLUDED'))  include (phpAds_path.'/libraries/deliverycache/cache-'.$phpAds_config['delivery_caching'].'.inc.php');
 157          
 158          phpAds_cacheDelete('what=zone:'.$zoneid);
 159          
 160          header ("Location: zone-probability.php?affiliateid=".$affiliateid."&zoneid=".$zoneid);
 161          exit;
 162      }
 163  }
 164  
 165  
 166  
 167  /*********************************************************/
 168  /* Get preferences                                       */
 169  /*********************************************************/
 170  
 171  if (!isset($hideinactive))
 172  {
 173      if (isset($Session['prefs']['zone-include.php']['hideinactive']))
 174          $hideinactive = $Session['prefs']['zone-include.php']['hideinactive'];
 175      else
 176          $hideinactive = ($phpAds_config['gui_hide_inactive'] == 't');
 177  }
 178  
 179  if (!isset($showbanners))
 180  {
 181      if (isset($Session['prefs']['zone-include.php']['showbanners']))
 182          $showbanners = $Session['prefs']['zone-include.php']['showbanners'];
 183      else
 184          $showbanners = ($phpAds_config['gui_show_matching'] == 't');
 185  }
 186  
 187  if (!isset($showcampaigns))
 188  {
 189      if (isset($Session['prefs']['zone-include.php']['showcampaigns']))
 190          $showcampaigns = $Session['prefs']['zone-include.php']['showcampaigns'];
 191      else
 192          $showcampaigns = ($phpAds_config['gui_show_parents'] == 't');
 193  }
 194  
 195  
 196  
 197  /*********************************************************/
 198  /* HTML framework                                        */
 199  /*********************************************************/
 200  
 201  if (isset($Session['prefs']['affiliate-zones.php']['listorder']))
 202      $navorder = $Session['prefs']['affiliate-zones.php']['listorder'];
 203  else
 204      $navorder = '';
 205  
 206  if (isset($Session['prefs']['affiliate-zones.php']['orderdirection']))
 207      $navdirection = $Session['prefs']['affiliate-zones.php']['orderdirection'];
 208  else
 209      $navdirection = '';
 210  
 211  
 212  // Get other zones
 213  $res = phpAds_dbQuery("
 214      SELECT
 215          *
 216      FROM
 217          ".$phpAds_config['tbl_zones']."
 218      WHERE
 219          affiliateid = '".$affiliateid."'
 220          ".phpAds_getZoneListOrder ($navorder, $navdirection)."
 221  ");
 222  
 223  while ($row = phpAds_dbFetchArray($res))
 224  {
 225      phpAds_PageContext (
 226          phpAds_buildZoneName ($row['zoneid'], $row['zonename']),
 227          "zone-include.php?affiliateid=".$affiliateid."&zoneid=".$row['zoneid'],
 228          $zoneid == $row['zoneid']
 229      );
 230  }
 231  
 232  if (phpAds_isUser(phpAds_Admin))
 233  {
 234      phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid='.$affiliateid, 'images/icon-affiliate.gif');
 235      phpAds_PageShortcut($strZoneHistory, 'stats-zone-history.php?affiliateid='.$affiliateid.'&zoneid='.$zoneid, 'images/icon-statistics.gif');
 236      
 237      
 238      $extra  = "<form action='zone-modify.php'>";
 239      $extra .= "<input type='hidden' name='zoneid' value='$zoneid'>";
 240      $extra .= "<input type='hidden' name='affiliateid' value='$affiliateid'>";
 241      $extra .= "<input type='hidden' name='returnurl' value='zone-include.php'>";
 242      $extra .= "<br><br>";
 243      $extra .= "<b>$strModifyZone</b><br>";
 244      $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
 245      $extra .= "<img src='images/icon-duplicate-zone.gif' align='absmiddle'>&nbsp;<a href='zone-modify.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&duplicate=true&returnurl=zone-include.php'>$strDuplicate</a><br>";
 246      $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
 247      $extra .= "<img src='images/icon-move-zone.gif' align='absmiddle'>&nbsp;$strMoveTo<br>";
 248      $extra .= "<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>";
 249      $extra .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 250      $extra .= "<select name='moveto' style='width: 110;'>";
 251      
 252      $res = phpAds_dbQuery("SELECT * FROM ".$phpAds_config['tbl_affiliates']." WHERE affiliateid <> '".$affiliateid."'") or phpAds_sqlDie();
 253      while ($row = phpAds_dbFetchArray($res))
 254          $extra .= "<option value='".$row['affiliateid']."'>".phpAds_buildAffiliateName($row['affiliateid'], $row['name'])."</option>";
 255      
 256      $extra .= "</select>&nbsp;<input type='image' src='images/".$phpAds_TextDirection."/go_blue.gif'><br>";
 257      $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
 258      $extra .= "<img src='images/icon-recycle.gif' align='absmiddle'>&nbsp;<a href='zone-delete.php?affiliateid=$affiliateid&zoneid=$zoneid&returnurl=affiliate-zones.php'".phpAds_DelConfirm($strConfirmDeleteZone).">$strDelete</a><br>";
 259      $extra .= "</form>";
 260      
 261      
 262      phpAds_PageHeader("4.2.3.3", $extra);
 263          echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;".phpAds_getAffiliateName($affiliateid);
 264          echo "&nbsp;<img src='images/".$phpAds_TextDirection."/caret-rs.gif'>&nbsp;";
 265          echo "<img src='images/icon-zone.gif' align='absmiddle'>&nbsp;<b>".phpAds_getZoneName($zoneid)."</b><br><br><br>";
 266          phpAds_ShowSections(array("4.2.3.2", "4.2.3.6", "4.2.3.3", "4.2.3.4", "4.2.3.5"));
 267  }
 268  else
 269  {
 270      if (phpAds_isAllowed(phpAds_EditZone)) $sections[] = "2.1.2";
 271      if (phpAds_isAllowed(phpAds_EditZone)) $sections[] = "2.1.6";
 272      $sections[] = "2.1.3";
 273      $sections[] = "2.1.4";
 274      $sections[] = "2.1.5";
 275      
 276      phpAds_PageHeader("2.1.3");
 277          echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;".phpAds_getAffiliateName($affiliateid);
 278          echo "&nbsp;<img src='images/".$phpAds_TextDirection."/caret-rs.gif'>&nbsp;";
 279          echo "<img src='images/icon-zone.gif' align='absmiddle'>&nbsp;<b>".phpAds_getZoneName($zoneid)."</b><br><br><br>";
 280          phpAds_ShowSections($sections);
 281  }
 282  
 283  
 284  
 285  
 286  /*********************************************************/
 287  /* Main code                                             */
 288  /*********************************************************/
 289  
 290  function phpAds_showZoneCampaign ($width, $height, $what, $delivery)
 291  {
 292      global $affiliateid, $zoneid;
 293      global $phpAds_config, $showbanners, $hideinactive;
 294      global $strName, $strID, $strDescription, $strUntitled, $phpAds_TextAlignRight, $phpAds_TextAlignLeft;
 295      global $strEdit, $strCheckAllNone, $strSaveChanges, $strShowBanner;
 296      global $strNoCampaignsToLink, $strMatchingBanners, $strSelectCampaignToLink;
 297      global $strHideInactiveCampaigns, $strInactiveCampaignsHidden, $strShowAll;
 298      global $strHideMatchingBanners, $strShowMatchingBanners;
 299      global $tabindex;
 300      
 301      $what_array = explode(",",$what);
 302      for ($k=0; $k < count($what_array); $k++)
 303      {
 304          if (substr($what_array[$k],0,9)=="clientid:")
 305          {
 306              $clientid = substr($what_array[$k],9);
 307              $clientids[$clientid] = true;
 308          }
 309      }
 310      
 311      // Fetch all campaigns
 312      $res = phpAds_dbQuery("
 313          SELECT
 314              *
 315          FROM
 316              ".$phpAds_config['tbl_clients']."
 317          WHERE
 318              parent > 0
 319      ") or phpAds_sqlDie();
 320      
 321      while ($row = phpAds_dbFetchArray($res))
 322          $campaigns[$row['clientid']] = $row;
 323      
 324      $compact = (phpAds_dbNumRows($res) > $phpAds_config['gui_link_compact_limit']);
 325      
 326      
 327      // Fetch all banners which can be linked
 328      $query = "
 329          SELECT
 330              *
 331          FROM
 332              ".$phpAds_config['tbl_banners']."
 333          ";
 334      
 335      if ($delivery != phpAds_ZoneText)
 336      {
 337          if ($width != -1 && $height != -1)
 338              $query .= "WHERE width = $width AND height = $height AND contenttype != 'txt'";
 339          elseif ($width != -1)
 340              $query .= "WHERE width = $width AND contenttype != 'txt'";
 341          elseif ($height != -1)
 342              $query .= "WHERE height = $height AND contenttype != 'txt'";
 343          else
 344              $query .= "WHERE contenttype != 'txt'";
 345      }
 346      else
 347      {
 348          $query .= "WHERE contenttype = 'txt'";
 349      }
 350      
 351      $query .= "
 352          ORDER BY
 353              bannerid";
 354      
 355      $res = phpAds_dbQuery($query);
 356      
 357      while ($row = phpAds_dbFetchArray($res))
 358      {
 359          $campaigns[$row['clientid']]['banners'][$row['bannerid']] = $row;
 360      }
 361      
 362      
 363      
 364      if (!$compact)
 365      {
 366          echo "<form name='zonetypeselection' method='post' action='zone-include.php'>";
 367          echo "<input type='hidden' name='zoneid' value='".$GLOBALS['zoneid']."'>";
 368          echo "<input type='hidden' name='affiliateid' value='".$GLOBALS['affiliateid']."'>";
 369          echo "<input type='hidden' name='zonetype' value='".phpAds_ZoneCampaign."'>";
 370          echo "<input type='hidden' name='action' value='set'>";
 371      }
 372      else
 373      {
 374          echo "<br>".$strSelectCampaignToLink."<br><br>";
 375          echo "<table cellpadding='0' cellspacing='0' border='0'><tr>";
 376          
 377          echo "<form name='zonetypeselection' method='get' action='zone-include.php'>";
 378          echo "<input type='hidden' name='zoneid' value='".$GLOBALS['zoneid']."'>";
 379          echo "<input type='hidden' name='affiliateid' value='".$GLOBALS['affiliateid']."'>";
 380          echo "<input type='hidden' name='zonetype' value='".phpAds_ZoneCampaign."'>";
 381          
 382          echo "<td><img src='images/icon-client.gif' align='absmiddle'>&nbsp;";
 383          echo "<select name='clientid' onChange='this.form.submit();' tabindex='".($tabindex++)."'>";
 384          
 385          if (!isset($GLOBALS['clientid']) || $GLOBALS['clientid'] == '')
 386              echo "<option value='' selected></option>";
 387          
 388          // Fetch all campaigns
 389          $res = phpAds_dbQuery("
 390              SELECT
 391                  *
 392              FROM
 393                  ".$phpAds_config['tbl_clients']."
 394              WHERE
 395                  parent = 0
 396          ") or phpAds_sqlDie();
 397          
 398          while ($row = phpAds_dbFetchArray($res))
 399          {
 400              if (isset($GLOBALS['clientid']) && $GLOBALS['clientid'] == $row['clientid'])
 401                  echo "<option value='".$row['clientid']."' selected>[id".$row['clientid']."] ".$row['clientname']."</option>";
 402              else
 403                  echo "<option value='".$row['clientid']."'>[id".$row['clientid']."] ".$row['clientname']."</option>";
 404          }
 405          
 406          echo "</select>";
 407          echo "</td></form>";
 408          
 409          if (isset($GLOBALS['clientid']) && $GLOBALS['clientid'] != '')
 410          {
 411              echo "<form name='zonetypeselection' method='get' action='zone-include.php'>";
 412              echo "<input type='hidden' name='zoneid' value='".$GLOBALS['zoneid']."'>";
 413              echo "<input type='hidden' name='affiliateid' value='".$GLOBALS['affiliateid']."'>";
 414              echo "<input type='hidden' name='clientid' value='".$GLOBALS['clientid']."'>";
 415              echo "<input type='hidden' name='zonetype' value='".phpAds_ZoneCampaign."'>";
 416              echo "<input type='hidden' name='action' value='toggle'>";
 417              echo "<td>&nbsp;&nbsp;<img src='images/caret-r.gif' align='absmiddle'>&nbsp;&nbsp;";
 418              echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;";
 419              echo "<select name='campaignid' tabindex='".($tabindex++)."'>";
 420              
 421              // Fetch all campaigns
 422              $res = phpAds_dbQuery("
 423                  SELECT
 424                      *
 425                  FROM
 426                      ".$phpAds_config['tbl_clients']."
 427                  WHERE
 428                      parent = ".$GLOBALS['clientid']."
 429              ") or phpAds_sqlDie();
 430              
 431              while ($row = phpAds_dbFetchArray($res))
 432              {
 433                  if (!isset($clientids[$row['clientid']]) || $clientids[$row['clientid']] != true)
 434                      echo "<option value='".$row['clientid']."'>[id".$row['clientid']."] ".$row['clientname']." (".(isset($campaigns[$row['clientid']]['banners']) ? count($campaigns[$row['clientid']]['banners']) : 0).")</option>";
 435              }
 436              
 437              echo "</select>";
 438              echo "&nbsp;<input type='image' src='images/".$GLOBALS['phpAds_TextDirection']."/go_blue.gif' border='0' tabindex='".($tabindex++)."'>";
 439              echo "</td></form>";
 440          }
 441          
 442          echo "</tr></table>";
 443          echo "<br><br>";
 444      }
 445      
 446      
 447      // Header
 448      echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>";
 449      echo "<tr height='25'>";
 450      echo "<td height='25' width='40%'><b>&nbsp;&nbsp;$strName</b></td>";
 451      echo "<td height='25'><b>$strID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
 452      echo "<td height='25'>&nbsp;</td>";
 453      echo "</tr>";
 454      
 455      echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
 456      
 457      $i = 0;
 458      $checkedall = true;
 459      $inactivehidden = 0;
 460      
 461      if (!$compact && phpAds_dbNumRows($res) == 0)
 462      {
 463          echo "<tr bgcolor='#F6F6F6'><td colspan='3' height='25'>&nbsp;&nbsp;".$strNoCampaignsToLink."</td></tr>";
 464      }
 465      else
 466      {
 467          foreach (array_keys($campaigns) as $ckey)
 468          {
 469              $campaign = $campaigns[$ckey];
 470              
 471              $linkedrow = (isset($clientids[$campaign['clientid']]) && $clientids[$campaign['clientid']] == true);
 472              
 473              if ($compact)
 474                  $showrow = $linkedrow;
 475              else
 476                  $showrow = ($hideinactive == false || $hideinactive == true && ($campaign['active'] == 't' || $linkedrow));
 477              
 478              if (!$compact && !$showrow) $inactivehidden++;
 479              
 480              if ($showrow)
 481              {
 482                  if ($i > 0) echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
 483                  echo "<tr height='25' ".($i%2==0?"bgcolor='#F6F6F6'":"").">";
 484                  
 485                  // Begin row
 486                  echo "<td height='25'>";
 487                  echo "&nbsp;&nbsp;";
 488                  
 489                  if (!$compact)
 490                  {
 491                      // Show checkbox
 492                      if (isset($clientids[$campaign['clientid']]) && $clientids[$campaign['clientid']] == true)
 493                          echo "<input type='checkbox' name='clientid[]' value='".$campaign['clientid']."' checked onclick='reviewall();' tabindex='".($tabindex++)."'>"; 
 494                      else
 495                      {
 496                          echo "<input type='checkbox' name='clientid[]' value='".$campaign['clientid']."' onclick='reviewall();' tabindex='".($tabindex++)."'>"; 
 497                          $checkedall = false;
 498                      }
 499                  }
 500                  else
 501                  {
 502                      echo "<a href='zone-include.php?affiliateid=".$GLOBALS['affiliateid']."&zoneid=".$GLOBALS['zoneid']."&campaignid=".$campaign['clientid']."&zonetype=".phpAds_ZoneCampaign."&action=toggle'>";
 503                      echo "<img src='images/caret-l.gif' border='0' align='absmiddle'></a>";
 504                  }
 505                  
 506                  // Space
 507                  echo "&nbsp;&nbsp;";
 508                  
 509                  
 510                  // Banner icon
 511                  if ($campaign['active'] == 't')
 512                      echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;";
 513                  else
 514                      echo "<img src='images/icon-campaign-d.gif' align='absmiddle'>&nbsp;";
 515                  
 516                  
 517                  // Name
 518                  if (phpAds_isUser(phpAds_Admin))
 519                  {
 520                      echo "<a href='campaign-edit.php?clientid=".$campaign['parent']."&campaignid=".$campaign['clientid']."'>";
 521                      echo phpAds_breakString ($campaign['clientname'], '60')."</a>";
 522                  }
 523                  else
 524                      echo phpAds_breakString ($campaign['clientname'], '60');
 525                  
 526                  echo "</td>";
 527                  
 528                  
 529                  // ID
 530                  echo "<td height='25'>".$campaign['clientid']."</td>";
 531                  
 532                  // Edit
 533                  echo "<td height='25'>";
 534                  if ($showbanners)
 535                      echo "&nbsp;";
 536                  else
 537                      echo str_replace ('{count}', isset($campaign['banners']) ? count($campaign['banners']) : 0, $strMatchingBanners);
 538                  echo "</td>";
 539                  
 540                  // End row
 541                  echo "</tr>";
 542                  
 543                  
 544                  if ($showbanners && isset($campaign['banners']))
 545                  {
 546                      reset ($campaign['banners']);
 547                      while (list ($bannerid, $banner) = each ($campaign['banners']))
 548                      {
 549                          $name = $strUntitled;
 550                          if (isset($banner['alt']) && $banner['alt'] != '') $name = $banner['alt'];
 551                          if (isset($banner['description']) && $banner['description'] != '') $name = $banner['description'];
 552                          
 553                          $name = phpAds_breakString ($name, '60');
 554                          
 555                          
 556                          echo "<tr height='1'>";
 557                          echo "<td ".($i%2==0?"bgcolor='#F6F6F6'":"")."><img src='images/spacer.gif' width='1' height='1'></td>";
 558                          echo "<td colspan='3' bgcolor='#888888'><img src='images/break-el.gif' height='1' width='100%'></td>";
 559                          echo "</tr>";
 560                          
 561                          echo "<tr height='25' ".($i%2==0?"bgcolor='#F6F6F6'":"")."><td height='25'>";
 562                          echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 563                          if (!$compact) echo "&nbsp;&nbsp;";
 564                          
 565                          // Banner icon
 566                          if ($campaign['active'] == 't' && $banner['active'] == 't')
 567                          {
 568                              if ($banner['storagetype'] == 'html')
 569                                  echo "<img src='images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
 570                              elseif ($banner['storagetype'] == 'url')
 571                                  echo "<img src='images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
 572                              elseif ($banner['storagetype'] == 'txt')
 573                                  echo "<img src='images/icon-banner-text.gif' align='absmiddle'>&nbsp;";
 574                              else
 575                                  echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
 576                          }
 577                          else
 578                          {
 579                              if ($banner['storagetype'] == 'html')
 580                                  echo "<img src='images/icon-banner-html-d.gif' align='absmiddle'>&nbsp;";
 581                              elseif ($banner['storagetype'] == 'url')
 582                                  echo "<img src='images/icon-banner-url-d.gif' align='absmiddle'>&nbsp;";
 583                              elseif ($banner['storagetype'] == 'txt')
 584                                  echo "<img src='images/icon-banner-text-d.gif' align='absmiddle'>&nbsp;";
 585                              else
 586                                  echo "<img src='images/icon-banner-stored-d.gif' align='absmiddle'>&nbsp;";
 587                          }
 588                          
 589                          
 590                          // Name
 591                          if (phpAds_isUser(phpAds_Admin))
 592                          {
 593                              echo "<a href='banner-edit.php?clientid=".$campaign['parent']."&campaignid=".$campaign['clientid']."&bannerid=".$banner['bannerid']."'>";
 594                              echo $name."</a>";
 595                          }
 596                          else
 597                              echo $name;
 598                          
 599                          echo "</td>";
 600                          
 601                          
 602                          // ID
 603                          echo "<td height='25'>".$banner['bannerid']."</td>";
 604                          
 605                          // Show banner
 606                          if ($banner['contenttype'] == 'txt')
 607                          {
 608                              $width    = 300;
 609                              $height = 200;
 610                          }
 611                          else
 612                          {
 613                              $width  = $banner['width'] + 64;
 614                              $height = $banner['bannertext'] ? $banner['height'] + 90 : $banner['height'] + 64;
 615                          }
 616                          
 617                          echo "<td height='25' align='".$phpAds_TextAlignRight."'>";
 618                          echo "<a href='banner-htmlpreview.php?bannerid=$bannerid' target='_new' ";
 619                          echo "onClick=\"return openWindow('banner-htmlpreview.php?bannerid=".$banner['bannerid']."', '', 'status=no,scrollbars=no,resizable=no,width=".$width.",height=".$height."');\">";
 620                          echo "<img src='images/icon-zoom.gif' align='absmiddle' border='0'>&nbsp;".$strShowBanner."</a>&nbsp;&nbsp;";
 621                          echo "</td>";
 622                      }
 623                  }
 624                  
 625                  
 626                  $i++;
 627              }
 628          }
 629      }
 630      
 631      if (!$compact)
 632      {
 633          echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
 634          echo "<tr ".($i%2==0?"bgcolor='#F6F6F6'":"")."><td height='25'>";
 635          echo "&nbsp;&nbsp;<input type='checkbox' name='checkall' value=''".($checkedall == true ? ' checked' : '')." onclick='toggleall();' tabindex='".($tabindex++)."'>";
 636          echo "&nbsp;&nbsp;<b>".$strCheckAllNone."</b>";
 637          echo "</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
 638      }
 639      
 640      echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
 641      echo "<tr><td height='25' align='".$phpAds_TextAlignLeft."' nowrap>";
 642      
 643      if (!$compact)
 644      {
 645          if ($hideinactive == true)
 646          {
 647              echo "&nbsp;&nbsp;<img src='images/icon-activate.gif' align='absmiddle' border='0'>";
 648              echo "&nbsp;<a href='zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&zonetype=".phpAds_ZoneCampaign."&hideinactive=0'>".$strShowAll."</a>";
 649              echo "&nbsp;&nbsp;|&nbsp;&nbsp;".$inactivehidden." ".$strInactiveCampaignsHidden;
 650          }
 651          else
 652          {
 653              echo "&nbsp;&nbsp;<img src='images/icon-hideinactivate.gif' align='absmiddle' border='0'>";
 654              echo "&nbsp;<a href='zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&zonetype=".phpAds_ZoneCampaign."&hideinactive=1'>".$strHideInactiveCampaigns."</a>";
 655          }
 656      }
 657      
 658      echo "</td><td colspan='2' align='".$phpAds_TextAlignRight."' nowrap>";
 659      
 660      if ($showbanners == true)
 661      {
 662          echo "&nbsp;&nbsp;<img src='images/icon-banner-stored-d.gif' align='absmiddle' border='0'>";
 663          echo "&nbsp;<a href='zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&zonetype=".phpAds_ZoneCampaign."&showbanners=0'>".$strHideMatchingBanners."</a>";
 664      }
 665      else
 666      {
 667          echo "&nbsp;&nbsp;<img src='images/icon-banner-stored.gif' align='absmiddle' border='0'>";
 668          echo "&nbsp;<a href='zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&zonetype=".phpAds_ZoneCampaign."&showbanners=1'>".$strShowMatchingBanners."</a>";
 669      }
 670      
 671      echo "&nbsp;&nbsp;</td></tr>";
 672      echo "</table>";
 673      echo "<br><br>";
 674      echo "<br><br>";
 675      
 676      if (!$compact)
 677      {
 678          echo "<input type='submit' name='submit' value='$strSaveChanges' tabindex='".($tabindex++)."'>";
 679          echo "</form>";
 680      }
 681  }
 682  
 683  
 684  
 685  function phpAds_showZoneBanners ($width, $height, $what, $zonetype, $delivery)
 686  {
 687      global $phpAds_config, $showcampaigns, $hideinactive, $affiliateid, $zoneid;
 688      global $strName, $strID, $strUntitled, $strDescription, $phpAds_TextAlignRight, $phpAds_TextAlignLeft;
 689      global $strEdit, $strCheckAllNone, $strShowBanner;
 690      global $strNoBannersToLink, $strSaveChanges, $strSelectBannerToLink, $strInactiveBannersHidden;
 691      global $strShowParentCampaigns, $strHideParentCampaigns, $strHideInactiveBanners, $strShowAll;
 692      global $tabindex;
 693      
 694      if ($zonetype == phpAds_ZoneBanners)
 695      {
 696          // Determine selected banners
 697          $what_array = explode(",",$what);
 698          for ($k=0; $k < count($what_array); $k++)
 699          {
 700              if (substr($what_array[$k],0,9)=="bannerid:")
 701              {
 702                  $bannerid = substr($what_array[$k],9);
 703                  $bannerids[$bannerid] = true;
 704              }
 705          }
 706      }
 707      elseif ($zonetype == phpAds_ZoneCampaign)
 708      {
 709          // Determine selected campaigns
 710          $clientids = array();
 711          $what_array = explode(",",$what);
 712          for ($k=0; $k < count($what_array); $k++)
 713          {
 714              if (substr($what_array[$k],0,9)=="clientid:")
 715              {
 716                  $clientid = substr($what_array[$k],9);
 717                  $clientids[] = 'clientid = '.$clientid;
 718              }
 719          }
 720          
 721          // Determine banners owned by selected campaigns
 722          if (count($clientids))
 723          {
 724              $res = phpAds_dbQuery("
 725                  SELECT
 726                      bannerid
 727                  FROM
 728                      ".$phpAds_config['tbl_banners']."
 729                  WHERE
 730                      ".implode (' OR ', $clientids)."
 731              ");
 732              
 733              while ($row = phpAds_dbFetchArray($res))
 734                  $bannerids[$row['bannerid']] = true;
 735          }
 736          else
 737              $bannerids = array();
 738      }
 739      else
 740      {
 741          $bannerids = array();
 742      }
 743      
 744      // Fetch all campaigns
 745      $res = phpAds_dbQuery("
 746          SELECT
 747              *
 748          FROM
 749              ".$phpAds_config['tbl_clients']."
 750          WHERE
 751              parent > 0
 752      ") or phpAds_sqlDie();
 753      
 754      while ($row = phpAds_dbFetchArray($res))
 755          $campaigns[$row['clientid']] = $row;
 756      
 757      
 758      // Fetch all banners which can be linked
 759      $query = "
 760          SELECT
 761              *
 762          FROM
 763              ".$phpAds_config['tbl_banners']."
 764          ";
 765      
 766      if ($delivery != phpAds_ZoneText)
 767      {
 768          if ($width != -1 && $height != -1)
 769              $query .= "WHERE width = $width AND height = $height AND contenttype != 'txt'";
 770          elseif ($width != -1)
 771              $query .= "WHERE width = $width AND contenttype != 'txt'";
 772          elseif ($height != -1)
 773              $query .= "WHERE height = $height AND contenttype != 'txt'";
 774          else
 775              $query .= "WHERE contenttype != 'txt'";
 776      }
 777      else
 778      {
 779          $query .= "WHERE contenttype = 'txt'";
 780      }
 781      
 782      $query .= "
 783          ORDER BY
 784              bannerid";
 785      
 786      $res = phpAds_dbQuery($query);
 787      $compact = (phpAds_dbNumRows($res) > $phpAds_config['gui_link_compact_limit']);
 788      
 789      while ($row = phpAds_dbFetchArray($res))
 790      {
 791          $campaigns[$row['clientid']]['banners'][$row['bannerid']] = $row;
 792      }
 793      
 794      $inactivehidden = 0;
 795      
 796      
 797      
 798      if (!$compact)
 799      {
 800          echo "<form name='zonetypeselection' method='post' action='zone-include.php'>";
 801          echo "<input type='hidden' name='zoneid' value='".$GLOBALS['zoneid']."'>";
 802          echo "<input type='hidden' name='affiliateid' value='".$GLOBALS['affiliateid']."'>";
 803          echo "<input type='hidden' name='zonetype' value='".phpAds_ZoneBanners."'>";
 804          echo "<input type='hidden' name='action' value='set'>";
 805      }
 806      else
 807      {
 808          echo "<br>".$strSelectBannerToLink."<br><br>";
 809          echo "<table cellpadding='0' cellspacing='0' border='0'><tr>";
 810          
 811          echo "<form name='zonetypeselection' method='get' action='zone-include.php'>";
 812          echo "<input type='hidden' name='zoneid' value='".$GLOBALS['zoneid']."'>";
 813          echo "<input type='hidden' name='affiliateid' value='".$GLOBALS['affiliateid']."'>";
 814          echo "<input type='hidden' name='zonetype' value='".phpAds_ZoneBanners."'>";
 815          
 816          echo "<td><img src='images/icon-client.gif' align='absmiddle'>&nbsp;";
 817          echo "<select name='clientid' onChange='this.form.submit();' tabindex='".($tabindex++)."'>";
 818          
 819          if (!isset($GLOBALS['clientid']) || $GLOBALS['clientid'] == '')
 820              echo "<option value='' selected></option>";
 821          
 822          // Fetch all campaigns
 823          $res = phpAds_dbQuery("
 824              SELECT
 825                  *
 826              FROM
 827                  ".$phpAds_config['tbl_clients']."
 828              WHERE
 829                  parent = 0
 830          ") or phpAds_sqlDie();
 831          
 832          while ($row = phpAds_dbFetchArray($res))
 833          {
 834              if (isset($GLOBALS['clientid']) && $GLOBALS['clientid'] == $row['clientid'])
 835                  echo "<option value='".$row['clientid']."' selected>[id".$row['clientid']."] ".$row['clientname']."</option>";
 836              else
 837                  echo "<option value='".$row['clientid']."'>[id".$row['clientid']."] ".$row['clientname']."</option>";
 838          }
 839          
 840          echo "</select>";
 841          echo "</td></form>";
 842          
 843          if (isset($GLOBALS['clientid']) && $GLOBALS['clientid'] != '')
 844          {
 845              echo "<form name='zonetypeselection' method='get' action='zone-include.php'>";
 846              echo "<input type='hidden' name='zoneid' value='".$GLOBALS['zoneid']."'>";
 847              echo "<input type='hidden' name='affiliateid' value='".$GLOBALS['affiliateid']."'>";
 848              echo "<input type='hidden' name='clientid' value='".$GLOBALS['clientid']."'>";
 849              echo "<input type='hidden' name='zonetype' value='".phpAds_ZoneBanners."'>";
 850              echo "<td>&nbsp;&nbsp;<img src='images/caret-r.gif' align='absmiddle'>&nbsp;&nbsp;";
 851              echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;";
 852              echo "<select name='campaignid' onChange='this.form.submit();' tabindex='".($tabindex++)."'>";
 853              
 854              if (!isset($GLOBALS['campaignid']) || $GLOBALS['campaignid'] == '')
 855                  echo "<option value='' selected></option>";
 856              
 857              // Fetch all campaigns
 858              $res = phpAds_dbQuery("
 859                  SELECT
 860                      *
 861                  FROM
 862                      ".$phpAds_config['tbl_clients']."
 863                  WHERE
 864                      parent = ".$GLOBALS['clientid']."
 865              ") or phpAds_sqlDie();
 866              
 867              while ($row = phpAds_dbFetchArray($res))
 868              {
 869                  if (isset($GLOBALS['campaignid']) && $GLOBALS['campaignid'] == $row['clientid'])
 870                      echo "<option value='".$row['clientid']."' selected>[id".$row['clientid']."] ".$row['clientname']."</option>";
 871                  else
 872                      echo "<option value='".$row['clientid']."'>[id".$row['clientid']."] ".$row['clientname']."</option>";
 873              }
 874              
 875              echo "</select>";
 876              echo "</td></form>";
 877              
 878              if (isset($GLOBALS['campaignid']) && $GLOBALS['campaignid'] != '')
 879              {
 880                  echo "<form name='zonetypeselection' method='get' action='zone-include.php'>";
 881                  echo "<input type='hidden' name='zoneid' value='".$GLOBALS['zoneid']."'>";
 882                  echo "<input type='hidden' name='affiliateid' value='".$GLOBALS['affiliateid']."'>";
 883                  echo "<input type='hidden' name='clientid' value='".$GLOBALS['clientid']."'>";
 884                  echo "<input type='hidden' name='campaignid' value='".$GLOBALS['campaignid']."'>";
 885                  echo "<input type='hidden' name='zonetype' value='".phpAds_ZoneBanners."'>";
 886                  echo "<input type='hidden' name='action' value='toggle'>";
 887                  echo "<td>&nbsp;&nbsp;<img src='images/caret-r.gif' align='absmiddle'>&nbsp;&nbsp;";
 888                  echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
 889                  echo "<select name='bannerid' tabindex='".($tabindex++)."'>";
 890                  
 891                  // Fetch all banners which can be linked
 892                  $query = "
 893                      SELECT
 894                          bannerid,
 895                          clientid,
 896                          alt,
 897                          description,
 898                          active,
 899                          storagetype
 900                      FROM
 901                          ".$phpAds_config['tbl_banners']."
 902                      WHERE
 903                          clientid = ".$GLOBALS['campaignid']."
 904                  ";
 905                  
 906                  if ($delivery != phpAds_ZoneText)
 907                  {
 908                      if ($width != -1 && $height != -1)
 909                          $query .= "AND width = $width AND height = $height";
 910                      elseif ($width != -1)
 911                          $query .= "AND width = $width";
 912                      elseif ($height != -1)
 913                          $query .= "AND height = $height";
 914                  }
 915                  else
 916                  {
 917                      $query .= "AND contenttype = 'txt'";
 918                  }
 919                  
 920                  $query .= "
 921                      ORDER BY
 922                          bannerid";
 923                  
 924                  $res = phpAds_dbQuery($query);
 925                  
 926                  while ($row = phpAds_dbFetchArray($res))
 927                  {
 928                      if (!isset($bannerids[$row['bannerid']]) || $bannerids[$row['bannerid']] != true)
 929                      {
 930                          $name = $strUntitled;
 931                          if (isset($row['alt']) && $row['alt'] != '') $name = $row['alt'];
 932                          if (isset($row['description']) && $row['description'] != '') $name = $row['description'];
 933                          
 934                          echo "<option value='".$row['bannerid']."'>[id".$row['bannerid']."] ".$name."</option>";
 935                      }
 936                  }
 937                  
 938                  echo "</select>";
 939                  echo "&nbsp;<input type='image' src='images/".$GLOBALS['phpAds_TextDirection']."/go_blue.gif' border='0' tabindex='".($tabindex++)."'>";
 940                  echo "</td></form>";
 941              }
 942          }
 943          
 944          echo "</tr></table>";
 945          echo "<br><br>";
 946      }
 947      
 948      // Header
 949      echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>";
 950      echo "<tr height='25'>";
 951      echo "<td height='25' width='40%'><b>&nbsp;&nbsp;$strName</b></td>";
 952      echo "<td height='25'><b>$strID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
 953      echo "<td height='25'>&nbsp;</td>";
 954      echo "</tr>";
 955      
 956      echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
 957      
 958      $i = 0;
 959      $checkedall = true;
 960      
 961      if (!$compact && phpAds_dbNumRows($res) == 0)
 962      {
 963          echo "<tr bgcolor='#F6F6F6'><td colspan='3' height='25'>&nbsp;&nbsp;".$strNoBannersToLink."</td></tr>";
 964      }
 965      else
 966      {
 967          foreach (array_keys($campaigns) as $ckey)
 968          {
 969              $campaign = $campaigns[$ckey];
 970              
 971              if (isset($campaign['banners']) && is_array($campaign['banners']) && count($campaign['banners']))
 972              {
 973                  $banners = $campaign['banners'];
 974                  
 975                  $activebanners = 0;
 976                  foreach (array_keys($banners) as $bkey)
 977                  {
 978                      $banner = $banners[$bkey];
 979                      
 980                      $linkedrow = (isset($bannerids[$banner['bannerid']]) && $bannerids[$banner['bannerid']] == true);
 981                      
 982                      if ($compact)
 983                          $showrow = $linkedrow;
 984                      else
 985                          $showrow = ($hideinactive == false || $hideinactive == true && ($banner['active'] == 't' && $campaign['active'] == 't' || $linkedrow));
 986                      
 987                      if ($showrow) $activebanners++;
 988                  }
 989                  
 990                  
 991                  if ($showcampaigns && $activebanners)
 992                  {
 993                      if ($i > 0) echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
 994                      echo "<tr height='25' ".($i%2==0?"bgcolor='#F6F6F6'":"").">";
 995                      
 996                      // Begin row
 997                      echo "<td height='25'>";
 998                      echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
 999                      if (!$compact) echo "&nbsp;&nbsp;";
1000                      
1001                      // Banner icon
1002                      if ($campaign['active'] == 't')
1003                          echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;";
1004                      else
1005                          echo "<img src='images/icon-campaign-d.gif' align='absmiddle'>&nbsp;";
1006                      
1007                      
1008                      // Name
1009                      if (phpAds_isUser(phpAds_Admin))
1010                      {
1011                          echo "<a href='campaign-edit.php?clientid=".$campaign['parent']."&campaignid=".$campaign['clientid']."'>";
1012                          echo phpAds_breakString ($campaign['clientname'], '60')."</a>";
1013                      }
1014                      else
1015                          echo phpAds_breakString ($campaign['clientname'], '60');
1016                      
1017                      echo "</td>";
1018                      
1019                      
1020                      // ID
1021                      echo "<td height='25'>".$campaign['clientid']."</td>";
1022                      echo "<td>&nbsp;</td></tr>";
1023                  }
1024                  
1025                  foreach (array_keys($banners) as $bkey)
1026                  {
1027                      $banner = $banners[$bkey];
1028                      
1029                      $linkedrow = (isset($bannerids[$banner['bannerid']]) && $bannerids[$banner['bannerid']] == true);
1030                      
1031                      if ($compact)
1032                          $showrow = $linkedrow;
1033                      else
1034                          $showrow = ($hideinactive == false || $hideinactive == true && ($banner['active'] == 't' && $campaign['active'] == 't' || $linkedrow));
1035                      
1036                      if (!$compact && !$showrow) $inactivehidden++;
1037                      
1038                      if ($showrow)
1039                      {
1040                          $name = $strUntitled;
1041                          if (isset($banner['alt']) && $banner['alt'] != '') $name = $banner['alt'];
1042                          if (isset($banner['description']) && $banner['description'] != '') $name = $banner['description'];
1043                          
1044                          $name = phpAds_breakString ($name, '60');
1045                          
1046                          
1047                          if (!$showcampaigns)
1048                          {
1049                              if ($i > 0) echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
1050                          }
1051                          else
1052                          {
1053                              echo "<tr height='1'>";
1054                              echo "<td ".($i%2==0?"bgcolor='#F6F6F6'":"")."><img src='images/spacer.gif' width='1' height='1'></td>";
1055                              echo "<td colspan='3' bgcolor='#888888'><img src='images/break-el.gif' height='1' width='100%'></td>";
1056                              echo "</tr>";
1057                          }
1058                          
1059                          
1060                          echo "<tr height='25' ".($i%2==0?"bgcolor='#F6F6F6'":"").">";
1061                          
1062                          // Begin row
1063                          echo "<td height='25'>";
1064                          echo "&nbsp;&nbsp;";
1065                          
1066                          // Show checkbox
1067                          if (!$compact)
1068                          {
1069                              if (isset($bannerids[$banner['bannerid']]) && $bannerids[$banner['bannerid']] == true)
1070                                  echo "<input type='checkbox' name='bannerid[]' value='".$banner['bannerid']."' checked onclick='reviewall();' tabindex='".($tabindex++)."'>"; 
1071                              else
1072                              {
1073                                  echo "<input type='checkbox' name='bannerid[]' value='".$banner['bannerid']."' onclick='reviewall();' tabindex='".($tabindex++)."'>"; 
1074                                  $checkedall = false;
1075                              }
1076                          }
1077                          else
1078                          {
1079                              echo "<a href='zone-include.php?affiliateid=".$GLOBALS['affiliateid']."&zoneid=".$GLOBALS['zoneid']."&bannerid=".$banner['bannerid']."&zonetype=".phpAds_ZoneBanners."&action=toggle'>";
1080                              echo "<img src='images/caret-l.gif' border='0' align='absmiddle'></a>";
1081                          }
1082                          
1083                          // Space
1084                          echo "&nbsp;&nbsp;";
1085                          if ($showcampaigns) echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
1086                          
1087                          // Banner icon
1088                          if ($campaign['active'] == 't' && $banner['active'] == 't')
1089                          {
1090                              if ($banner['storagetype'] == 'html')
1091                                  echo "<img src='images/icon-banner-html.gif' align='absmiddle'>&nbsp;";
1092                              elseif ($banner['storagetype'] == 'url')
1093                                  echo "<img src='images/icon-banner-url.gif' align='absmiddle'>&nbsp;";
1094                              elseif ($banner['storagetype'] == 'txt')
1095                                  echo "<img src='images/icon-banner-text.gif' align='absmiddle'>&nbsp;";
1096                              else
1097                                  echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;";
1098                          }
1099                          else
1100                          {
1101                              if ($banner['storagetype'] == 'html')
1102                                  echo "<img src='images/icon-banner-html-d.gif' align='absmiddle'>&nbsp;";
1103                              elseif ($banner['storagetype'] == 'url')
1104                                  echo "<img src='images/icon-banner-url-d.gif' align='absmiddle'>&nbsp;";
1105                              elseif ($banner['storagetype'] == 'txt')
1106                                  echo "<img src='images/icon-banner-text-d.gif' align='absmiddle'>&nbsp;";
1107                              else
1108                                  echo "<img src='images/icon-banner-stored-d.gif' align='absmiddle'>&nbsp;";
1109                          }
1110                          
1111                          // Name
1112                          if (phpAds_isUser(phpAds_Admin))
1113                          {
1114                              echo "<a href='banner-edit.php?clientid=".$campaign['parent']."&campaignid=".$campaign['clientid']."&bannerid=".$banner['bannerid']."'>";
1115                              echo $name."</a></td>";
1116                          }
1117                          else
1118                              echo $name;
1119                          
1120                          // ID
1121                          echo "<td height='25'>".$banner['bannerid']."</td>";
1122                          
1123                          // Show banner
1124                          if ($banner['contenttype'] == 'txt')
1125                          {
1126                              $width    = 300;
1127                              $height = 200;
1128                          }
1129                          else
1130                          {
1131                              $width  = $banner['width'] + 64;
1132                              $height = $banner['bannertext'] ? $banner['height'] + 90 : $banner['height'] + 64;
1133                          }
1134                          
1135                          echo "<td height='25' align='".$phpAds_TextAlignRight."'>";
1136                          echo "<a href='banner-htmlpreview.php?bannerid=".$banner['bannerid']."' target='_new' ";
1137                          echo "onClick=\"return openWindow('banner-htmlpreview.php?bannerid=".$banner['bannerid']."', '', 'status=no,scrollbars=no,resizable=no,width=".$width.",height=".$height."');\">";
1138                          echo "<img src='images/icon-zoom.gif' align='absmiddle' border='0'>&nbsp;".$strShowBanner."</a>&nbsp;&nbsp;";
1139                          echo "</td>";
1140                          
1141                          // End row
1142                          echo "</tr>";
1143                          
1144                          
1145                          if (!$showcampaigns) $i++;
1146                      }
1147                  }
1148                  
1149                  if ($showcampaigns && $activebanners) $i++;
1150              }
1151          }
1152      }
1153      
1154      if (!$compact)
1155      {
1156          echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break-l.gif' height='1' width='100%'></td></tr>";
1157          echo "<tr ".($i%2==0?"bgcolor='#F6F6F6'":"")."><td height='25'>";
1158          echo "&nbsp;&nbsp;<input type='checkbox' name='checkall' value=''".($checkedall == true ? ' checked' : '')." onclick='toggleall();' tabindex='".($tabindex++)."'>";
1159          echo "&nbsp;&nbsp;<b>".$strCheckAllNone."</b>";
1160          echo "</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
1161      }
1162      
1163      echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
1164      echo "<tr><td height='25' align='".$phpAds_TextAlignLeft."' nowrap>";
1165      
1166      if (!$compact)
1167      {
1168          if ($hideinactive == true)
1169          {
1170              echo "&nbsp;&nbsp;<img src='images/icon-activate.gif' align='absmiddle' border='0'>";
1171              echo "&nbsp;<a href='zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&zonetype=".phpAds_ZoneBanners."&hideinactive=0'>".$strShowAll."</a>";
1172              echo "&nbsp;&nbsp;|&nbsp;&nbsp;".$inactivehidden." ".$strInactiveBannersHidden;
1173          }
1174          else
1175          {
1176              echo "&nbsp;&nbsp;<img src='images/icon-hideinactivate.gif' align='absmiddle' border='0'>";
1177              echo "&nbsp;<a href='zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&zonetype=".phpAds_ZoneBanners."&hideinactive=1'>".$strHideInactiveBanners."</a>";
1178          }
1179      }
1180      
1181      echo "</td><td colspan='2' align='".$phpAds_TextAlignRight."' nowrap>";
1182      
1183      if ($showcampaigns == true)
1184      {
1185          echo "&nbsp;&nbsp;<img src='images/icon-campaign-d.gif' align='absmiddle' border='0'>";
1186          echo "&nbsp;<a href='zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&zonetype=".phpAds_ZoneBanners."&showcampaigns=0'>".$strHideParentCampaigns."</a>";
1187      }
1188      else
1189      {
1190          echo "&nbsp;&nbsp;<img src='images/icon-campaign.gif' align='absmiddle' border='0'>";
1191          echo "&nbsp;<a href='zone-include.php?affiliateid=".$affiliateid."&zoneid=".$zoneid."&zonetype=".phpAds_ZoneBanners."&showcampaigns=1'>".$strShowParentCampaigns."</a>";
1192      }
1193      
1194      echo "&nbsp;&nbsp;</td></tr>";
1195      
1196      
1197      echo "</table>";
1198      
1199      echo "<br><br>";
1200      echo "<br><br>";
1201      
1202      if (!$compact)
1203      {
1204          echo "<input type='submit' name='submit' value='$strSaveChanges' tabindex='".($tabindex++)."'>";
1205          echo "</form>";
1206      }
1207  }
1208  
1209  
1210  
1211  /*********************************************************/
1212  /* Main code                                             */
1213  /*********************************************************/
1214  
1215  ?>
1216  
1217  <script language='Javascript'>
1218  <!--
1219      function toggleall()
1220      {
1221          allchecked = false;
1222          
1223          for (var i=0; i<document.zonetypeselection.elements.length; i++)
1224          {
1225              if (document.zonetypeselection.elements[i].name == 'bannerid[]' ||
1226                  document.zonetypeselection.elements[i].name == 'clientid[]')
1227              {
1228                  if (document.zonetypeselection.elements[i].checked == false)
1229                  {
1230                      allchecked = true;
1231                  }
1232              }
1233          }
1234          
1235          for (var i=0; i<document.zonetypeselection.elements.length; i++)
1236          {
1237              if (document.zonetypeselection.elements[i].name == 'bannerid[]' ||
1238                  document.zonetypeselection.elements[i].name == 'clientid[]')
1239              {
1240                  document.zonetypeselection.elements[i].checked = allchecked;
1241              }
1242          }
1243      }
1244      
1245      function reviewall()
1246      {
1247          allchecked = true;
1248          
1249          for (var i=0; i<document.zonetypeselection.elements.length; i++)
1250          {
1251              if (document.zonetypeselection.elements[i].name == 'bannerid[]' ||
1252                  document.zonetypeselection.elements[i].name == 'clientid[]')
1253              {
1254                  if (document.zonetypeselection.elements[i].checked == false)
1255                  {
1256                      allchecked = false;
1257                  }
1258              }
1259          }
1260          
1261                  
1262          document.zonetypeselection.checkall.checked = allchecked;
1263      }    
1264  //-->
1265  </script>
1266  
1267  <?php
1268  
1269  if (isset($zoneid) && $zoneid != '')
1270  {
1271      $res = phpAds_dbQuery("
1272          SELECT
1273              *
1274          FROM
1275              ".$phpAds_config['tbl_zones']."
1276          WHERE
1277              zoneid = '$zoneid'
1278          ") or phpAds_sqlDie();
1279      
1280      if (phpAds_dbNumRows($res))
1281      {
1282          $zone = phpAds_dbFetchArray($res);
1283      }
1284  }
1285  
1286  // Set the default zonetype
1287  if (!isset($zonetype) || $zonetype == '')
1288      $zonetype = $zone['zonetype'];
1289  
1290  $tabindex = 1;
1291  
1292  
1293  echo "<form name='zonetypes' method='post' action='zone-include.php'>";
1294  echo "<input type='hidden' name='zoneid' value='".$zoneid."'>";
1295  echo "<input type='hidden' name='affiliateid' value='".$affiliateid."'>";
1296  
1297  echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
1298  echo "<tr><td height='25' colspan='3'><b>".$strSelectZoneType."</b></td></tr>";
1299  echo "<tr><td height='25'>";
1300  
1301  echo "<select name='zonetype' onChange='this.form.submit();' accesskey='".$keyList."' tabindex='".($tabindex++)."'>";
1302      echo "<option value='".phpAds_ZoneCampaign."'".(($zonetype == phpAds_ZoneCampaign) ? " selected" : "").">".$strCampaignSelection."</option>";
1303      echo "<option value='".phpAds_ZoneBanners."'".(($zonetype == phpAds_ZoneBanners) ? " selected" : "").">".$strBannerSelection."</option>";
1304      echo "<option value='".phpAds_ZoneRaw."'".(($zonetype == phpAds_ZoneRaw) ? " selected" : "").">".$strRawQueryString."</option>";
1305  echo "</select>";
1306  echo "&nbsp;<input type='image' src='images/".$phpAds_TextDirection."/go_blue.gif' border='0'>";
1307  
1308  echo "</td></tr>";
1309  echo "</table>";
1310  phpAds_ShowBreak();
1311  echo "</form>";
1312  echo "<br>";
1313  
1314  
1315  
1316  if ($zonetype == phpAds_ZoneCampaign)
1317  {
1318      phpAds_showZoneCampaign($zone["width"], $zone["height"], $zone["what"], $zone['delivery']);
1319  }
1320  
1321  if ($zonetype == phpAds_ZoneBanners)
1322  {
1323      phpAds_showZoneBanners($zone["width"], $zone["height"], $zone["what"], $zone["zonetype"], $zone['delivery']);
1324  }
1325  
1326  if ($zonetype == phpAds_ZoneRaw)
1327  {
1328      echo "<form name='zonetypeselection' method='post' action='zone-include.php'>";
1329      echo "<input type='hidden' name='zoneid' value='".$zoneid."'>";
1330      echo "<input type='hidden' name='affiliateid' value='".$affiliateid."'>";
1331      echo "<input type='hidden' name='zonetype' value='$zonetype'>";
1332      echo "<input type='hidden' name='action' value='set'>";
1333      
1334      echo "<textarea cols='50' rows='16' name='what' style='width:600px;' tabindex='".($tabindex++)."'>".(isset($zone['what']) ? $zone['what'] : '')."</textarea>";
1335      
1336      echo "<br><br>";
1337      echo "<br><br>";
1338      
1339      echo "<input type='submit' name='submit' value='$strSaveChanges' tabindex='".($tabindex++)."'>";
1340      echo "</form>";
1341  }
1342  
1343  
1344  
1345  /*********************************************************/
1346  /* Store preferences                                     */
1347  /*********************************************************/
1348  
1349  $Session['prefs']['zone-include.php']['hideinactive'] = $hideinactive;
1350  $Session['prefs']['zone-include.php']['showbanners'] = $showbanners;
1351  $Session['prefs']['zone-include.php']['showcampaigns'] = $showcampaigns;
1352  
1353  phpAds_SessionDataStore();
1354  
1355  
1356  
1357  /*********************************************************/
1358  /* HTML framework                                        */
1359  /*********************************************************/
1360  
1361  phpAds_PageFooter();
1362  
1363  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]