<?php
require ('authentication_manager.php');
?>
<style type="text/css">
<!--
.column__ { margin-bottom:10px; line-height:39px; text-align:left; clear:both; background-color:#ECECEC; }
.li_ad { font-size:12px; color:#000099; text-decoration:underline; }
-->
</style>
<?php

/* 编辑广告 */
/* 162100源码 - 162100.com */

$text = $text__ = $err = '';
  $_GET['mode'] = $web['sitemode'];
  if ($m_arr = @glob('./inc/css/*', GLOB_ONLYDIR)) {
    foreach ($m_arr as $m_f) {
      $base_index_mode = basename($m_f);
	  $title = @file_get_contents($m_f.'/title.txt');
      if (file_exists('./inc/css/'.$base_index_mode.'/index.php') && file_exists('./inc/css/'.$base_index_mode.'/list.php') && file_exists('./inc/css/'.$base_index_mode.'/article.php')) {
       $text .= '<div class="column__"><a href="index.php?mode='.$base_index_mode.'" target="_blank">'.$base_index_mode.' ['.$title.']</a> 的广告编辑：</div>'.get_ad_po($base_index_mode).'';
      } else {
        $text__ .= '<div class="column__">'.substr($base_index_mode, 0, 1).'*** ['.$title.'] 该风格尚未安装，请<a href="http://wpa.qq.com/msgrd?v=3&uin=184830962&site=qq&menu=yes" target="_blank">QQ联系程序作者</a>定制</div>';
      }
      unset($base_index_mode, $title);
    }
  } else {
    $err .= '没有任何模板，也无法进行广告管理！';
  }


echo $text,$text__, $err;

function get_ad_po($mode) {
  $ad_arr = array(
  'ad_index_top' => '首页顶部广告位',
  'ad_index_middle' => '首页腰部广告位',
  'ad_index_bottom' => '首页底部广告位',
  'ad_index_side' => '首页侧部广告位',
  'ad_index_logoside' => '首页LOGO旁边广告位',
  'ad_list_top' => '列表页顶部广告位',
  'ad_list_middle' => '列表页腰部广告位',
  'ad_list_bottom' => '列表底部广告位',
  'ad_list_side' => '列表侧部广告位',
  'ad_list_logoside' => '列表LOGO旁边广告位',
  'ad_article_top' => '内容页顶部广告位',
  'ad_article_middle' => '内容页腰部广告位',
  'ad_article_bottom' => '内容页底部广告位',
  'ad_article_side' => '内容页侧部广告位',
  'ad_article_logoside' => '内容页LOGO旁边广告位',
  'ad_article_text_top' => '内容页文章内容中顶部广告位',
  'ad_article_text_bottom' => '内容页文章内容中底部广告位',
 );
  $text = '';
  if ($ads = @glob('inc/css/'.$mode.'/ad_*.txt')) {
    foreach ($ads as $ad) {
      $ad_name = basename($ad, '.txt');
      $text .= '
<a class="li_ad" href="?get=modify&type=editor&otherfile='.get_en_url($ad).'">'.$ad_arr[$ad_name].'</a><br /> ';
      unset($ad_name);
    }
  } else {
    $text .= '没有广告位';
  }
  return $text;

}


?>
