当前位置: 首页>>代码示例>>PHP>>正文


PHP Ad::get_one方法代码示例

本文整理汇总了PHP中Ad::get_one方法的典型用法代码示例。如果您正苦于以下问题:PHP Ad::get_one方法的具体用法?PHP Ad::get_one怎么用?PHP Ad::get_one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ad的用法示例。


在下文中一共展示了Ad::get_one方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
开发者ID:noverkill,项目名称:classified-ads-script,代码行数:31,代码来源:ad-report.php

示例2: isset

<?php

/**
 * Classified-ads-script
 * 
 * @copyright  Copyright (c) Szilard Szabo
 * @license    GPL v3
 * @package    Frontend
 */
include "./admin/include/common.php";
$g_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$g_code = isset($_GET['code']) ? trim(strip_tags($_GET['code'])) : '';
$ad = Ad::get_one($g_id, array('code' => $g_code, 'active' => 1));
$ad_exists = isset($ad['id']);
if ($ad_exists && isset($_POST['extension'])) {
    $success = true;
    $errors = array();
    $p_extension = (int) $_POST['extension'];
    if ($p_extension < 1) {
        $success = false;
        array_push($errors, "Please enter extension.");
    }
    if ($p_extension != '' && !preg_match('/^[0-9]{0,10}$/', $p_extension)) {
        $success = false;
        array_push($errors, "The format of extension is incorrect.");
    }
    if ($success) {
        Ad::update($g_id, array('extend' => $p_extension), $g_code);
    }
}
include "./templates/ad-extension.php";
开发者ID:noverkill,项目名称:classified-ads-script,代码行数:31,代码来源:ad-extension.php

示例3: array_push

        array_push($errors, "No region selected.");
    }
    if ($p_region != '' && !preg_match('/^[0-9]{0,10}$/', $p_region)) {
        $success = false;
        array_push($errors, "The region is incorrect.");
    }
    if ('' != $p_webpage && 0 !== strpos($p_webpage, 'http://')) {
        $p_webpage = 'http://' . $p_webpage;
    }
    if ($p_webpage != '' && !preg_match('/^((http|https):\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}((:[0-9]{1,5})?\\/.*)?$/i', $p_webpage)) {
        $success = false;
        array_push($errors, "The format of webpage address is incorrect.");
    }
    if (isset($p_picture) && isset($p_picture['name']) && $p_picture['name'] != '') {
        list($postedon_year, $postedon_month, $postedon_day) = explode('-', $ad['postedon']);
        $picture_path = "{$upload_path}/{$postedon_year}/{$postedon_month}/{$postedon_day}/picture";
        $thumb_path = "{$upload_path}/{$postedon_year}/{$postedon_month}/{$postedon_day}/thumb";
        include "./admin/include/picture-upload.php";
    } else {
        $p_picture = '';
    }
    if ($success) {
        $fields = array('name' => $p_name, 'telephone' => $p_telephone, 'title' => $p_title, 'description' => $p_description, 'category' => $p_category, 'price' => $p_price, 'city' => $p_city, 'region' => $p_region, 'webpage' => $p_webpage, $g_code);
        if ($p_picture != '' || $p_del_picture > 0) {
            $fields['picture'] = $p_picture;
        }
        Ad::update($g_id, $fields);
        $ad = Ad::get_one($g_id);
    }
}
include "./templates/ad-modification.php";
开发者ID:noverkill,项目名称:classified-ads-script,代码行数:31,代码来源:ad-modification.php

示例4: array

<?php

/**
 * Classified-ads-script
 * 
 * @copyright  Copyright (c) Szilard Szabo
 * @license    GPL v3
 * @package    Frontend
 */
include "./admin/include/common.php";
$g_id = $_GET['id'];
$ad = Ad::get_one($g_id, array("active" => 1));
$exists = isset($ad['id']);
include "./templates/ad-print.php";
开发者ID:noverkill,项目名称:classified-ads-script,代码行数:14,代码来源:ad-print.php


注:本文中的Ad::get_one方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。