Example #1
0
 public static function addAds($uid)
 {
     if (!$uid) {
         return false;
     }
     $model = new Ads();
     $thekeyid = zmf::filterInput($_POST['Ads']['id']);
     $attachid = zmf::filterInput($_POST['Ads']['attachid'], 't', 1);
     $intoData = $_POST['Ads'];
     $intoData['attachid'] = $attachid;
     $intoData['status'] = 1;
     $intoData['uid'] = $uid;
     if (isset($intoData['start_time'])) {
         $intoData['start_time'] = strtotime($intoData['start_time']);
     }
     if (isset($intoData['expired_time'])) {
         $intoData['expired_time'] = strtotime($intoData['expired_time']);
     }
     $model->attributes = $intoData;
     if ($model->validate()) {
         if ($model->updateByPk($thekeyid, $intoData)) {
             zmf::delFCache("notSaveAds{$uid}");
             if ($attachid) {
                 Attachments::model()->updateAll(array('status' => Posts::STATUS_DELED), "logid={$thekeyid} AND uid={$uid} AND classify='ads'");
                 Attachments::model()->updateAll(array('status' => Posts::STATUS_PASSED), "id={$attachid}");
             }
             return true;
         } else {
             $info = $_POST['Ads'];
         }
     } else {
         $info = $_POST['Ads'];
     }
     return $info;
 }
Example #2
0
 public function responseAction()
 {
     $id = $this->_request->getParam('id', 0);
     if (!$id) {
         $this->_redirect('/ads/categories-list/');
     }
     $ads = new Ads();
     $ad = $ads->find($id)->current();
     if (!$ad) {
         $this->_redirect('/ads/categories-list/');
     }
     $form = new AdsResponseForm();
     $form->getSubForm('ads_responses')->getElement('ad_id')->setValue($id);
     if (Standart_Main::buttonPressed('doResponse')) {
         if ($form->isValid($_POST)) {
             $values = $form->getValues();
             $akismetData = array('user_ip' => $_SERVER['REMOTE_ADDR'], 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'comment_type' => 'comment', 'comment_author' => $values['ads_responses']['name'], 'comment_author_email' => $values['ads_responses']['email'], 'comment_content' => $values['ads_responses']['content']);
             $akismet = new Zend_Service_Akismet(Zend_Registry::get('config')->akismet->apiKey, Zend_Registry::get('config')->host->default);
             if ($akismet->isSpam($akismetData)) {
                 $values['ads_responses']['is_spam'] = 1;
                 $this->view->message(Standart_Main::translate('adsResponseIsSpam'), 'error');
             }
             $adsResponses = new Ads_Responses();
             $adsResponses->insert($values['ads_responses']);
             $this->_redirect('/ads/response/id/' . $id . '/');
         } else {
             $this->view->message(Standart_Main::translate('invalidFormData'), 'error');
         }
     }
     $this->view->form = $form;
 }
Example #3
0
 public function addAds(Ads $ad)
 {
     if (!$this instanceof AdsStore) {
         die('Нельзя использовать этот метод в конструкторе классов');
     }
     $this->ads[$ad->getId()] = $ad;
 }
 public function addAds(Ads $add)
 {
     // добавляет объекты в массив хранилища
     if (!$this instanceof AdsStore) {
         die('Нельзя использовать этот метод в конструкторе классов');
     }
     $this->ads[$add->getid()] = $add;
 }
Example #5
0
 public function run()
 {
     $ads = Ads::model()->find(array('condition' => 'block_id=:block_id and status=1', 'params' => array(':block_id' => $this->block_id)));
     if ($ads && !YII_DEBUG) {
         echo '<div class="clearfix"></div>';
         echo '<div id="ads' . $ads->block_id . '">';
         echo $ads->content;
         echo '</div>';
         echo '<div class="clearfix"></div>';
     } else {
         if ($ads && YII_DEBUG) {
             echo '<div class="clearfix"></div>';
             echo '<div id="ads' . $ads->block_id . '" class="debug" style="width:200px;height:200px;background-color: #cdc;">';
             echo '</div>';
             echo '<div class="clearfix"></div>';
         }
     }
     /*if($ads && $this->block_id == 2){
                $content = str_replace(array("\n","\r"), '', $ads->content);
                $js = "$(document).ready(function(){
                     var els = $('.org_item').length;
                     var randomEls = Math.floor((Math.random() * els) + 1);
                     console.log(randomEls)
                     $('.org_item').eq(randomEls-1).after('<div id=\"ads2\" class=\"ads2\"></div>');
                });";
                Yii::app()->getClientScript()->registerScript('ads_' . $this->block_id, $js, CClientScript::POS_END);
     
             }*/
 }
Example #6
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Ads the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Ads::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #7
0
 public function ad_error_check(Ads $add, $smarty)
 {
     $vars = $add->getvars();
     $errorsNumber = 0;
     foreach ($this->errors as $value) {
         if (empty($vars[$value])) {
             $smarty->assign('error_' . $value, true);
             $errorsNumber++;
         }
     }
     if ($errorsNumber) {
         $smarty->assign('error', 'Пожалуйста, заполните поле');
         return true;
     } else {
         return false;
     }
 }
Example #8
0
 public function ad_error_check(Ads $add, $smarty)
 {
     $vars = $add->getvars();
     $errorsNumber = 0;
     $err = array();
     foreach ($this->errors as $value) {
         if (empty($vars[$value])) {
             $err['fields'][] = $value;
             $errorsNumber++;
         }
     }
     if ($errorsNumber) {
         $err['status'] = true;
     } else {
         $err['status'] = false;
     }
     $err['all_fields'] = $this->errors;
     return $err;
 }
Example #9
0
 public function getOne($keyid, $return = '')
 {
     if (!$keyid) {
         return false;
     }
     $item = Ads::model()->findByPk($keyid);
     if ($return != '') {
         return $item[$return];
     }
     return $item;
 }
Example #10
0
 function __construct(array $row)
 {
     parent::__construct($row);
     $this->description = $row['description'];
     $this->email = $row['email'];
     $this->phone = $row['phone'];
     $this->private = $row['private'];
     $this->allow_mails = $row['allow_mails'];
     $this->location_id = $row['location_id'];
     $this->category_id = $row['category_id'];
 }
Example #11
0
File: page.php Project: anqh/anqh
 /**
  * Construct controller.
  */
 public function before()
 {
     parent::before();
     $this->auto_render = $this->_request_type === Controller::REQUEST_INITIAL;
     $this->history = $this->history && !$this->ajax;
     // Initialize Ads
     Ads::init();
     // Load the template
     if ($this->auto_render === true) {
         $this->view = View_Page::factory();
     }
 }
Example #12
0
 public function actionIndex()
 {
     $areas = Area::getTops();
     $flashArr = Ads::getAllByPo('twindex', 'flash', '', 5);
     if (!empty($flashArr)) {
         foreach ($flashArr as $k => $val) {
             $_imgurl = zmf::uploadDirs($val['cTime'], 'site', $val['classify'], 600) . $val['filePath'];
             $flashArr[$k]['imgurl'] = $_imgurl;
         }
     }
     $this->pageTitle = zmf::config('sitename');
     $data = array('areas' => $areas, 'flashs' => $flashArr, 'posts' => $posts);
     $this->render('/index/index', $data);
 }
Example #13
0
 private function renderHtml()
 {
     $smarty = $this->getSmarty();
     if ($this->render['ads']) {
         $ads = Ads::find('all', array('conditions' => array('start_date' => array('$between' => array(0, time())), '$or' => array('end_date' => array('$gte' => time(), '$is' => 0)), 'active' => 1)));
         $smarty->assign("ads", $ads);
         // assign ads
     }
     $smarty->assign("title", $this->render['title']);
     // assign current user object
     if ($this->uid) {
         $smarty->assign("user", $this->profile);
     }
     // assign current user object
     if (!empty($this->render['data'])) {
         // assign data
         foreach ($this->render['data'] as $k => $v) {
             $smarty->assign($k, $v);
         }
     }
     $smarty->assign("body", $smarty->fetch($this->getTemplate()));
     $smarty->display($this->getBase());
 }
 public function actionCheckAsRead()
 {
     $id = Yii::app()->request->getParam('id');
     $status = 'Error';
     $ads = Ads::model()->findByPk($id);
     if ($ads) {
         $ads->read_status = 1;
         if ($ads->save()) {
             $status = 'Ok';
         }
     }
     echo json_encode(array('status' => $status));
 }
 function __construct($ad)
 {
     parent::__construct($ad);
     $this->private = 0;
 }
Example #16
0
 public function actionHitAd()
 {
     if (Rays::isAjax()) {
         $adId = (int) $_POST['adId'];
         $ad = Ads::get($adId);
         if ($ad !== null) {
             (new Counter())->increaseCounter($adId, Ads::ENTITY_TYPE);
             //Ad访问计数器
             /** TODO 刷广告访问监测机制 */
             $user = User::get($ad->userId);
             if ($user !== null) {
                 $wallet = $user->getWallet();
                 //访问一次挣一元钱
                 $wallet->addMoney(1);
             }
         }
     }
 }
Example #17
0
 public function getIndex($slug = '', $link_id = 0)
 {
     $debug = '';
     $bmStart = microtime(true);
     $perpage = intval(AppConfig::get('articles_per_page', 50));
     $branch_prefixes = explode(',', AppConfig::get('branch_prefixes'));
     $virtualPerpage = intval(AppConfig::get('virtual_per_page', 20));
     $page = Page::where('slug', '=', $slug)->cacheTags('pages')->remember(1440)->first();
     //$page = Page::where('slug', '=', Str::slug($slug))->first();
     if (count($page) > 0) {
         if ($filter_return = $this->authFilter($page->level)) {
             return $filter_return;
         }
         if ($page->redirect) {
             if (substr($page->redirect, 0, 1) == '{') {
                 $redir_arr = json_decode($page->redirect, true);
                 foreach ($redir_arr as $rlvl => $rslug) {
                     if (strpos($this->auth_lvl, $rlvl) !== false) {
                         return Redirect::to($rslug);
                     }
                 }
                 if (isset($redir_arr['def'])) {
                     return Redirect::to($redir_arr['def']);
                 }
             } else {
                 return Redirect::to($page->redirect);
             }
         }
         // get parameters from URL
         $page->category = Input::has('category') ? Input::get('category') : ($page->default_category ? $page->default_category : false);
         $page->section = Input::has('section') ? Input::get('section') : false;
         $page->keywordInput = $page->ddkeycol ? Input::get('keyword') : '';
         $page_vars = new stdClass();
         // separate slug into branch and section, if applicable
         $branch = $slug;
         if ($page->link_slug) {
             $branch = $page->link_slug;
         }
         $els = explode('/', $branch);
         if (in_array($els[0], $branch_prefixes) && count($els) > 1) {
             $branch = $els[0];
             if (!$page->section) {
                 $page->section = $els[1];
             }
         }
         $dta = normal::getTypes();
         // get list of categories, if there is a "ddlist"
         $categories = false;
         $normalized = false;
         if ($page->ddlist) {
             $fld = $page->ddlist;
             $catq = Link::where('branch', '=', $branch);
             if ($page->section) {
                 $catq->where('section', '=', $page->section);
             }
             if ($dtp = array_search($fld, $dta)) {
                 $catq->join('data', 'data.rec_id', '=', 'links.id')->where('data.table_name', '=', 'links')->where('data.type', '=', $dtp)->whereNull('data.deleted_at');
                 $fld = 'data_body';
                 $normalized = true;
             }
             $category_model = $catq->groupBy($fld)->whereRaw('trim(`' . $fld . '`) != ""')->cacheTags('links')->remember(1440)->get(array($fld));
             $categories = array('' => 'All');
             foreach ($category_model as $category_item) {
                 $categories[$category_item->{$fld}] = $category_item->{$fld};
             }
         }
         $links = false;
         $columns = false;
         // get list of links, specified by branch, section, category, state, and/or keyword
         if ($page->linkdef || $link_id && $page->detaildef) {
             // get column layout
             $columns = Listcolumns::where('def', '=', $link_id ? $page->detaildef : $page->linkdef)->cacheTags('links')->remember(1440)->orderBy('listorder')->get();
             $perlinkpage = intval(AppConfig::get('links_per_page', 50));
             $query = new Link();
             if ($link_id) {
                 $query = $query->where('id', '=', $link_id);
             } else {
                 if ($page->section) {
                     $query = $query->where('section', '=', $page->section);
                 }
                 if ($page->category) {
                     if ($normalized) {
                         $query = $query->join('data AS d', 'd.rec_id', '=', 'links.id')->where('d.table_name', '=', 'links')->where('d.type', '=', $dtp)->whereNull('d.deleted_at');
                     }
                     $query = $query->where(isset($fld) ? $fld : ($page->section ? 'category' : 'section'), '=', $page->category);
                 }
                 if ($page->state) {
                     $query = $query->where('state', '=', $page->state);
                 }
                 if ($page->keywordInput) {
                     if ($page->keywordInput == "by_date") {
                         $query = $query->join('data AS d', 'd.rec_id', '=', 'links.id')->where('d.table_name', '=', 'links')->where('d.type', '=', 7)->whereNull('d.deleted_at');
                         $month = Input::get('themonth');
                         $year = Input::get('theyear');
                         $pfx = $year . '-' . $month;
                         $start_date = $pfx . '-01';
                         $end_date = $pfx . '-' . cal_days_in_month(CAL_GREGORIAN, $month, $year);
                         $query = $query->whereRaw('d.`data_body`  BETWEEN ? AND ?', array($start_date, $end_date));
                         unset($page->keywordInput);
                         $page_vars->month = $month;
                         $page_vars->year = $year;
                     } else {
                         $query = $query->whereRaw('`' . $page->ddkeycol . '` RLIKE ?', array($page->keywordInput));
                     }
                 }
                 if (!$page->allowBroken) {
                     $query = $query->join('link_check', 'links.id', '=', 'link_check.id');
                     $query = $query->whereBetween('link_check.last_result', array('200', '399'));
                 }
             }
             $order = 'name';
             $orderdir = 'asc';
             if ($page->linkorder) {
                 $ordera = explode(',', $page->linkorder);
                 $order = $ordera[0];
                 if (count($ordera) > 1) {
                     $orderdir = $ordera[1];
                 }
                 if ($dtp = array_search($order, $dta)) {
                     $query = $query->join('data AS d2', 'd2.rec_id', '=', 'links.id')->where('d2.table_name', '=', 'links')->where('d2.type', '=', $dtp)->whereNull('d2.deleted_at');
                     $order = 'd2.data_body';
                 }
             }
             if ($page->where) {
                 $query = $query->whereRaw($page->where);
             }
             if ($page->remove_dupes) {
                 $query = $query->groupBy('name', 'url');
             }
             $links = $query->where('branch', '=', $branch)->select(array('links.*'))->orderBy($order, $orderdir)->cacheTags('links')->remember(1440)->paginate($perlinkpage);
             $ids = array();
             foreach ($links as $link) {
                 $ids[] = $link->id;
             }
             $xda = count($ids) ? Cache::tags('links')->remember('linkData|' . implode('-', $ids), 1440, function () use($ids) {
                 $xdata = Data::where('table_name', '=', 'links')->join('data_types', 'data_types.id', '=', 'data.type')->whereIn('rec_id', $ids)->whereNull('data_types.deleted_at')->cacheTags('data')->remember(10080)->get();
                 $xdda = array();
                 foreach ($xdata as $xrec) {
                     $xdda[$xrec->rec_id][$xrec->label] = $xrec->data_body;
                 }
                 return $xdda;
             }) : array();
             foreach ($links as $lid => $link) {
                 $id = $link->id;
                 if (isset($xda[$id])) {
                     foreach ($xda[$id] as $xid => $xdt) {
                         $links[$lid]->{$xid} = $xdt;
                     }
                 }
             }
         }
         $thumbs = false;
         if ($page->virtual_type) {
             $thumbs = Ad::where('type', '=', $page->virtual_type)->where('category', '=', $page->category)->orderBy('vorder', 'desc')->cacheTags('ads')->remember(1440)->paginate($virtualPerpage);
             foreach ($thumbs as $thumb) {
                 Ads::track($thumb, 3, $page->id);
             }
             // get list of categories
             $category_model = Ad::groupBy('category')->where('type', '=', $page->virtual_type)->cacheTags('ads')->remember(1440)->get(array('category'));
             $categories = array();
             foreach ($category_model as $category_item) {
                 $categories[$category_item->category] = $category_item->category;
             }
             //                $page->dname = 'Category';
         }
         // benchmarking the database access
         $bmEnd = microtime(true);
         $page->elapsed = $bmEnd - $bmStart;
         $page_vars->qstring = '';
         if ($page->pass_query == 'Y') {
             $qry = Input::query();
             $qry['mc_rnm'] = substr(time(), 2);
             if (count($qry)) {
                 $page_vars->qstring = '?' . http_build_query($qry);
             }
         }
         if ($page->randomize) {
             foreach (explode(',', $page->randomize) as $random_tag) {
                 $page_vars->{$random_tag} = mt_rand(10000, 99999);
             }
         }
         foreach (AppConfig::getAll() as $cfi => $cfd) {
             $page_vars->{$cfi} = $cfd;
         }
         $page_vars->nocache = NOCACHE_CODE;
         if (!$page->layout) {
             //                if ($_SERVER['REMOTE_ADDR'] == '108.47.107.194') {
             //                    $page->layout = 'template.layout2';
             //                } else {
             $page->layout = 'template.layout';
             //                }
         }
         // get data on child and parent pages
         $childpages = new Page();
         $P = clone $childpages->getConnection()->getPaginator();
         $P->setPageName('article');
         $childpages->getConnection()->setPaginator($P);
         $childpages = $childpages->join('article_pages', 'pages.id', '=', 'article_pages.page_id');
         $childpages = $childpages->where('article_pages.parent_id', '=', $page->id);
         $childpages = $childpages->whereNull('article_pages.deleted_at');
         $childpages = $childpages->orderBy('pageOrder');
         $childpages = $childpages->cacheTags('pages')->remember(1440);
         $childpages = $childpages->paginate($perpage);
         // pass ALL the data to the view
         return View::make('page.page')->with('dyn_layout', $page->layout)->with('page', $page)->with('childpages', $childpages)->with('categories', $categories)->with('links', $links)->with('link_id', $link_id)->with('thumbs', $thumbs)->with('columns', $columns)->with('top_banner', empty($slug))->with('debug', $debug)->with('parse_body', Display::format($page->body, $page_vars, false, false));
     } else {
         if (substr($slug, -5) == '.html') {
             $new_slug = substr($slug, 0, -5);
             $new_page = Page::where('slug', '=', $new_slug)->cacheTags('pages')->remember(1440)->first();
             if (count($new_page) > 0) {
                 return Redirect::to('/' . $new_slug, 301);
             }
         }
         $missing = new Missing();
         $missing->slug = $slug;
         $missing->referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "[none]";
         $missing->save();
         AppLog::alert('Page Not Found', 404, json_encode(array('slug' => $slug)));
         return Response::view('page.notfound', array('slug' => $slug), 404);
     }
 }
Example #18
0
/**
* ZCNCMS
* 广告
* php>=5.0
* @author LEI
* @version 1.1.2
* @time 20111004
*/
//初始化
$pagetitle = '广告';
$topTitle = '';
$where = '';
//功能部分
include WEB_MOD . 'ads.class.php';
include WEB_MOD . 'adflash.class.php';
$ads = new Ads();
$adflash = new Adflash();
$templatefile = '';
$classinfo = '';
//
//classid
if (isset($classid)) {
    $classid = intval($classid);
}
if (isset($id)) {
    $id = intval($id);
}
switch ($a) {
    case 'list':
    default:
        //list
Example #19
0
        <?php 
echo Ads::get_instance()->render('site_skin');
?>
        <div class="container-fluid">
            <div class="row blizzardwatch-row blizzardwatch-row-space">
	            <div class="col-md-12 header-ad-container">
                    <?php 
if (!wp_is_mobile()) {
    ?>
                    <a href="/"><img class="site-logo" src="/wp-content/themes/blizzardwatch/static/img/blizzard-watch.png" /></a>
                    <?php 
}
?>
                    <?php 
echo '<div id="bw-top-a">';
echo Ads::get_instance()->render('top_banner');
echo '</div>';
?>
	            </div>
            </div>
        </div>

        <div class="container-fluid" style="margin-top: -15px;">
	        <div class="row blizzardwatch-row header-tablet-row">
                <?php 
if (wp_is_mobile()) {
    ?>
                    <div style="width: 100px; float: left; margin-left: 5px;">
                        <a href="/"><img class="site-logo" src="/wp-content/themes/blizzardwatch/static/img/blizzard-watch.png" /></a>
                                    </div>
                    <div style="width: 200px; float: right; margin-top: 10px;">
Example #20
0
<?php

$topads = Ads::getAllByPo($position, $type, $uid);
if (!empty($topads)) {
    Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/common/js/jquery.SuperSlide.2.1.1.js", CClientScript::POS_HEAD);
    ?>
<div id="slideBox" class="slideBox">
        <div class="hd">
            <ul>
                <?php 
    if (!empty($topads)) {
        ?>
                <?php 
        foreach ($topads as $key => $tmp) {
            ?>
    
                <li><?php 
            echo $key + 1;
            ?>
</li>
                <?php 
        }
        ?>
                           
                <?php 
    }
    ?>
            </ul>
        </div>
        <div class="bd">
                <ul>
Example #21
0
<?php

$topads = Ads::getAllByPo('sidebtn', 'img', '', 1);
if ($topads) {
    $_imgurl = zmf::uploadDirs($topads[0]['cTime'], 'site', $topads[0]['classify'], 'origin') . $topads[0]['filePath'];
    echo "<div class='col-xs-12 col-sm-12' style='margin-bottom:15px;'><img src='{$_imgurl}' class='img-responsive'/></div>";
}
?>
<div class="clearfix"></div>
<?php 
if ($type == 'travel') {
    ?>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('创建行程', array('travel/create'), array('class' => 'btn btn-success btn-block'));
    ?>
</div>
<?php 
} else {
    ?>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('写游记', array('posts/create'), array('class' => 'btn btn-success btn-block'));
    ?>
</div>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('我要提问', array('question/create'), array('class' => 'btn btn-default btn-block'));
    ?>
</div>
<?php 
Example #22
0
File: page.php Project: anqh/core
    /**
     * Render page.
     *
     * @return  string
     */
    public function render()
    {
        ob_start();
        ?>

<!doctype html>
<html lang="<?php 
        echo $this->language;
        ?>
">

<?php 
        echo $this->_head();
        ?>

<body id="<?php 
        echo $this->id;
        ?>
" class="<?php 
        echo $this->class;
        ?>
">


	<!-- HEADER -->

	<?php 
        echo $this->_header();
        ?>

	<!-- /HEADER -->


	<?php 
        echo Ads::slot(Ads::TOP);
        ?>


	<!-- CONTENT -->

	<?php 
        echo $this->_content();
        ?>

	<!-- /CONTENT -->


	<!-- FOOTER -->

	<?php 
        echo $this->_footer();
        ?>

	<!-- /FOOTER -->


	<?php 
        echo $this->_foot();
        ?>

</body>

</html>

<?php 
        return ob_get_clean();
    }
Example #23
0
 public static function userProfile($input)
 {
     $cleanInput = DB::clean($input);
     $id = $cleanInput['id'];
     //$user = self::checkLoginStatus();
     $output = ['browserTitle' => 'Användarprofil', 'page' => 'user.profile.twig', 'ads' => Ads::getUserAds($id), 'user' => Self::getUser($id)];
     return $output;
 }
Example #24
0
 public function testUnarchive()
 {
     $response = Ads::unarchive()->setSelectionCriteria((new IdsCriteria())->setIds([self::DEFAULT_AD]))->sendRequest(self::$connection);
     $ads = $response->getResult('UnarchiveResults');
     $this->assertEquals(self::DEFAULT_AD, $ads[0]->Id);
 }
Example #25
0
* ZCNCMS
* 广告
* php>=5.0
* @author LEI
* @version 1.1.2
* @time 20111004
*/
//初始化
$pagetitle = '广告管理';
$pagepower = 'ads';
//基本部分
require 'checkpower.inc.php';
//功能部分
include WEB_MOD . 'ads.class.php';
include WEB_MOD . 'ads_class.class.php';
$ads = new Ads();
$ads_class = new Ads_class();
include WEB_INC . 'file.class.php';
include WEB_INC . 'string.class.php';
switch ($a) {
    case 'list':
    default:
        //list
        $pageListNum = 12;
        //每页显示
        $totalPage = 0;
        //总页数
        $page = isset($page) ? (int) $page : 1;
        $start = ($page - 1) * $pageListNum;
        $List = $ads->GetList(array('id', 'classid', 'title'), $start, $pageListNum, '', 'id desc');
        include WEB_INC . "page.class.php";
Example #26
0
 public function actionDelUploadImg($_attachid = '')
 {
     if (!empty($_attachid)) {
         $attachid = $_attachid;
     } else {
         $attachid = zmf::filterInput($_POST['attachid'], 't', 1);
     }
     //$attachid=tools::jieMi($attachid);
     if (!Yii::app()->request->isAjaxRequest) {
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if (Yii::app()->user->isGuest) {
         $this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
     }
     $info = Attachments::getOne($attachid);
     if (!$info) {
         $this->jsonOutPut(0, Yii::t('default', 'pagenotexists'));
     }
     if ($info['uid'] != Yii::app()->user->id and !$admin) {
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if ($info['classify'] == 'coverimg') {
         $model = new Posts();
     } elseif ($info['classify'] == 'columns') {
         $model = new Columns();
     } elseif ($info['classify'] == 'ads') {
         $model = new Ads();
     }
     $dirs = zmf::uploadDirs($info['logid'], 'app', $info['classify']);
     if (empty($dirs)) {
         $this->jsonOutPut(0, Yii::t('default', 'unkownerror'));
     }
     foreach ($dirs as $dir) {
         $filePath = $dir . '/' . $info['filePath'];
         //$this->delItem($attchid, $filePath);
         @unlink($filePath);
     }
     if (Attachments::model()->deleteByPk($attachid)) {
         zmf::delFCache("attach{$attachid}");
         if (isset($model)) {
             $model->updateAll(array('attachid' => 0), 'id=:id', array(':id' => $info['logid']));
         }
         if ($admin) {
             $this->jsonOutPut(1, '操作成功!');
         } else {
             $this->jsonOutPut(1, '操作成功!');
         }
     } else {
         $this->jsonOutPut(0, '操作失败');
     }
 }
Example #27
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Ads $value A Ads object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Ads $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Example #28
0
 function widget($args, $instance)
 {
     echo Ads::get_instance()->render('lower_sidebar_three');
 }
Example #29
0
<?php

/**
 * The sidebar
 */
echo Ads::get_instance()->render('upper_sidebar');
get_template_part('templates/sidebar', 'social');
?>
<div style="text-align: center; margin-top: 15px;"><a href="https://www.patreon.com/blizzardwatch"><img src="http://cdn.blizzardwatch.com/wp-content/uploads/2015/04/patreon-logo.png" style="width: 300px;" /><p style="margin-top: 7px;">Support Blizzard Watch on Patreon</p></a></div>
<?php 
wp_reset_query();
dynamic_sidebar('left-sidebar');
?>

Example #30
0
File: page.php Project: anqh/anqh
    /**
     * Render page.
     *
     * @return  string
     */
    public function render()
    {
        ob_start();
        ?>

<!doctype html>
<html lang="<?php 
        echo $this->language;
        ?>
">

<?php 
        echo $this->_head();
        ?>

<body id="<?php 
        echo $this->id;
        ?>
" class="<?php 
        echo $this->class;
        ?>
">

<?php 
        echo $this->_google_analytics();
        ?>

<?php 
        echo $this->_mainmenu();
        ?>


<!-- ADS -->

<?php 
        echo Ads::slot(Ads::TOP);
        ?>

<!-- /ADS -->


<!-- CONTENT -->

<?php 
        echo $this->_title();
        ?>

<?php 
        if ($top = $this->content(self::COLUMN_TOP)) {
            ?>
<div class="content <?php 
            echo Arr::get($this->_content_class, self::COLUMN_TOP);
            ?>
">
	<div class="container">
		<div class="row">

<?php 
            echo $top;
            ?>

		</div>
	</div>
</div>
<?php 
        }
        ?>

<div class="content <?php 
        echo Arr::get($this->_content_class, self::COLUMN_CENTER);
        ?>
">
	<div class="container">
		<div class="row">

<?php 
        echo $this->content(self::COLUMN_LEFT);
        echo $this->content(self::COLUMN_CENTER);
        echo $this->content(self::COLUMN_RIGHT);
        ?>

		</div>
	</div>
</div>

<?php 
        if ($bottom = $this->content(self::COLUMN_BOTTOM)) {
            ?>
<div class="content <?php 
            echo Arr::get($this->_content_class, self::COLUMN_BOTTOM);
            ?>
">
	<div class="container">
		<div class="row">

<?php 
            echo $bottom;
            ?>

		</div>
	</div>
</div>
<?php 
        }
        ?>

<!-- /CONTENT -->


<footer id="footer" class="dark content">
	<div class="container">

<?php 
        echo $this->_footer();
        ?>

	</div>
</footer><!-- #footer -->

<?php 
        echo $this->_foot();
        ?>

<!-- <?php 
        echo $this->_statistics();
        ?>
 -->

</body>

</html>

<?php 
        return ob_get_clean();
    }