本文整理汇总了PHP中Ad::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Ad::exists方法的具体用法?PHP Ad::exists怎么用?PHP Ad::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ad
的用法示例。
在下文中一共展示了Ad::exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<?php
/**
* Classified-ads-script
*
* @copyright Copyright (c) Szilard Szabo
* @license GPL v3
* @package Frontend
*/
include "./admin/include/common.php";
include "Pager/Pager.php";
$r_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$r_remove = isset($_REQUEST['remove']) ? 1 : 0;
if (USER::is_logged_in()) {
$user_id = USER::get_id();
if ($r_id > 0 && Ad::exists($r_id, array('active' => 1))) {
if (!Favourite::exists($user_id, $r_id)) {
Favourite::add($user_id, $r_id);
} else {
if ($r_remove > 0) {
Favourite::delete($user_id, $r_id);
}
}
}
$rpp = 15;
$tct = Favourite::count($user_id);
if ($tct > 0) {
$pager_options = array('mode' => 'Sliding', 'perPage' => $rpp, 'delta' => 2, 'totalItems' => $tct);
$pager = @Pager::factory($pager_options);
list($from, $to) = $pager->getOffsetByPageId();
$ads = Favourite::get_all($user_id, $from - 1 . ", {$rpp}");
示例2: isset
<?php
/**
* Classified-ads-script
*
* @copyright Copyright (c) Szilard Szabo
* @license GPL v3
* @package Frontend
*/
include "./admin/include/common.php";
$r_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$exists = Ad::exists($r_id, array("active" => 1));
if ($exists) {
$ad = Ad::get_one($r_id);
if (isset($_POST['send']) && User::is_logged_in()) {
$success = true;
$errors = array();
$p_message = strip_tags($_POST['message']);
if ($p_message == '') {
$success = false;
array_push($errors, "Please enter your message.");
}
if ($p_message != '' && !preg_match('/^[\\s\\S]{0,200}$/u', $p_message)) {
$success = false;
array_push($errors, "The message must be no more than 200 character long.");
}
if ($success) {
$userid = USER::get_id();
$username = USER::get_name();
$adid = $r_id;
$report = $p_message;
示例3: array
<?php
/**
* Classified-ads-script
*
* @copyright Copyright (c) Szilard Szabo
* @license GPL v3
* @package Frontend
*/
include "./admin/include/common.php";
include "./admin/include/thumb.php";
$panels = array();
$g_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$g_code = isset($_GET['code']) ? trim(strip_tags($_GET['code'])) : '';
$exists = Ad::exists($g_id, array("code" => $g_code, "active" => 1));
if ($exists) {
Ad::delete($g_id, array("code" => $g_code));
}
include "./templates/ad-removal.php";