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


PHP Filter::text方法代码示例

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


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

示例1: order_act

 public function order_act()
 {
     if ($this->checkOnline()) {
         $ship_id = Filter::int(Req::args('ship_id'));
         // 发货库房位置 ID
         $address_id = Filter::int(Req::args('address_id'));
         // 地址
         $payment_id = Filter::int(Req::args('payment_id'));
         // 支付ID
         $prom_id = Filter::int(Req::args('prom_id'));
         // 去掉
         $is_invoice = Filter::int(Req::args('is_invoice'));
         //
         $invoice_type = Filter::int(Req::args('invoice_type'));
         //
         $invoice_title = Filter::text(Req::args('invoice_title'));
         //
         $user_remark = Filter::txt(Req::args('user_remark'));
         $voucher_id = Filter::int(Req::args('voucher'));
         //非普通促销信息
         // $type = Req::args("type");  // 去掉
         $id = Filter::int(Req::args('id'));
         $product_id = Req::args('product_id');
         $buy_num = Req::args('buy_num');
         if (!$address_id || !$payment_id || $is_invoice == 1 && $invoice_title == '') {
             // product_id  产品ID列表 处理
             if (is_array($product_id)) {
                 foreach ($product_id as $key => $val) {
                     $product_id[$key] = Filter::int($val);
                 }
                 $product_id = implode('-', $product_id);
             } else {
                 $product_id = Filter::int($product_id);
             }
             $data = Req::args();
             $data['is_invoice'] = $is_invoice;
             if (!$address_id) {
                 $data['msg'] = array('fail', "必需选择收货地址,才能确认订单。");
             } else {
                 if (!$payment_id) {
                     $data['msg'] = array('fail', "必需选择支付方式,才能确认订单。");
                 } else {
                     $data['msg'] = array('fail', "索要发票,必需写明发票抬头。");
                 }
             }
             // type 类型
             // 下面代码没有使用
             //if ($type == null)
             //    $this->redirect("order", false, $data);
             //else {
             unset($data['act']);
             Req::args('pid', $product_id);
             Req::args('id', $id);
             unset($_GET['act']);
             //     Req::args('type', $type);
             Req::args('msg', $data['msg']);
             $this->redirect("/simple/order", true, Req::args());
             //$this->redirect("/simple/order_info", true, Req::args());
             //}
             exit;
         }
         //地址信息
         $address_model = new Model('address');
         $address = $address_model->where("id={$address_id} and user_id=" . $this->user['id'])->find();
         if (!$address) {
             $data = Req::args();
             $data['msg'] = array('fail', "选择的地址信息不正确!");
             $this->redirect("order", false, $data);
             exit;
         }
         //if(!$payment_id)$this->redirect("order",false,Req::args());
         if ($this->getModule()->checkToken('order')) {
             //订单类型: 0普通订单 1团购订单 2限时抢购 3捆绑促销
             $order_type = 0;
             $model = new Model('');
             //团购处理
             // 这部分去掉
             /*
             if($type=="groupbuy"){
                 $product_id = Filter::int($product_id[0]);
                 $num = $buy_num[0];
                 $item = $model->table("groupbuy as gb")->join("left join goods as go on gb.goods_id=go.id left join products as pr on pr.id=$product_id")->fields("*,pr.id as product_id,pr.spec")->where("gb.id=$id")->find();
                 $order_products = $this->packGroupbuyProducts($item,$num);
             
                 $groupbuy = $model->table("groupbuy")->where("id=$id")->find();
                 unset($groupbuy['description']);
                 $data['prom'] = serialize($groupbuy);
                 $data['prom_id'] = $id;
                 $order_type = 1;
             
             }
               if($order_type==0){
                 $order_products = $this->cart[$ship_id]['products'];
                 $data['prom_id'] = $prom_id;
             }
             */
             // 购物车
             //$cart = Cart::getCart();
             $cart_info = $this->cart_inst->all();
             //商品总金额,重量,积分计算
//.........这里部分代码省略.........
开发者ID:sammychan1981,项目名称:quanpin,代码行数:101,代码来源:simple.php

示例2: withdraw_act

 public function withdraw_act()
 {
     $id = Filter::int(Req::args('id'));
     $status = intval(Req::args('status'));
     $re_note = Filter::text(Req::args('re_note'));
     $model = new Model('withdraw as wd');
     $obj = $model->fields("wd.*,cu.balance")->join("left join customer as cu on wd.user_id = cu.user_id")->where("wd.id={$id} and wd.status=0")->find();
     if ($obj) {
         if ($obj['amount'] <= $obj['balance']) {
             $model->table('withdraw')->data(array('status' => $status, 're_note' => $re_note))->where("id={$id}")->update();
             if ($status == 1) {
                 $model->table('customer')->data(array('balance' => "`balance`-" . $obj['amount']))->where('user_id=' . $obj['user_id'])->update();
                 Log::balance(0 - $obj['amount'], $obj['user_id'], '提现到' . $obj['type_name'] . ',账号:' . $obj['account'], 3, $this->manager['id']);
             }
             echo "<script>parent.close_dialog();</script>";
         } else {
             echo "<script>alert('提现金额大于了余额。')</script>";
         }
         //扣除账户里的余额
     }
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:21,代码来源:customer.php

示例3: array

<?php

require_once './../../global.php';
include_once TEMPLATE_PATH . '/site/helper/format.php';
// get submitted data
$title = Filter::text($_POST['txtTitle']);
$pitch = Filter::formattedText($_POST['txtPitch']);
$specs = Filter::text($_POST['txtSpecs']);
$rules = Filter::text($_POST['txtRules']);
$deadline = Filter::text($_POST['txtDeadline']);
$private = Filter::text($_POST['chkPrivate']);
// validate data
if (empty($title)) {
    $json = array('error' => 'You must provide a project title.');
    exit(json_encode($json));
}
if (empty($pitch)) {
    $json = array('error' => 'You must provide a project pitch.');
    exit(json_encode($json));
}
// must be valid deadline or empty
$formattedDeadline = strtotime($deadline);
if ($formattedDeadline === false && $deadline != '') {
    $json = array('error' => 'Deadline must be a valid date or empty.');
    exit(json_encode($json));
}
// format deadline for MYSQL
$formattedDeadline = $formattedDeadline != '' ? date("Y-m-d H:i:s", $formattedDeadline) : null;
// format private
$private = empty($private) ? 0 : 1;
// create the project
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:project.process.php

示例4: json_encode

<?php

require_once "../../global.php";
$email = Filter::email($_POST['email']);
$name = Filter::text($_POST['name']);
// must provide valid email
if (empty($email)) {
    $json = array('error' => 'You must provide a valid email address.');
    exit(json_encode($json));
}
// save consent
$consent = new Consent(array('email' => $email, 'name' => $name));
$consent->save();
// email confirmation
$body = '<p>You have consented to participate in a Georgia Tech research study looking at how people collaborate online.</p>';
if (!empty($name)) {
    $body .= "<p>Additionally, you have requested that we use your real name if we refer to you in our publications.</p>";
}
$body .= '<p>The consent form is available for viewing and printing at <a href="http://www.scribd.com/doc/66688220/Adult-Web-Consent-Testing?secret_password=4nzp5x09db318hcu9e2">this link</a>. Please retain a copy for your records.</p>';
$body .= '<p>If you have any questions or concerns, please contact the research team at <a href="mailto:' . CONTACT_EMAIL . '">' . CONTACT_EMAIL . '</a>. Thank you for your participation!</p>';
$body .= '<p>-- <a href="http://pipeline.cc.gatech.edu/">The Pipeline team</a> at Georgia Tech</p>';
$newEmail = array('to' => $email, 'subject' => 'Georgia Tech study consent form', 'message' => $body);
Email::send($newEmail);
// send us back
Session::setMessage("Consent form complete! Please register an account.");
$json = array('success' => '1', 'successUrl' => Url::register($email));
echo json_encode($json);
开发者ID:malimu,项目名称:Pipeline,代码行数:27,代码来源:consent.process.php

示例5: mb_detect_order

             }
             //Format Leader, if empty or an invalid name is given, don't enter in anyone
             if (!empty($line[4])) {
                 $leaderId = User::loadByUsername(Filter::alphanum($line[4]));
                 //***need to change with Chloe's updated user filter***
                 if (empty($leaderId)) {
                     $leaderId = Session::getUserID();
                 }
             } else {
                 //$leaderId = NULL;
                 $leaderId = Session::getUserID();
             }
         }
         //Create Task Record
         $title = Filter::text($line[0]);
         $description = Filter::text(iconv(mb_detect_encoding($line[1], mb_detect_order(), true), "UTF-8", $line[1]));
         $task = new Task(array('creator_id' => Session::getUserID(), 'leader_id' => $leaderId, 'project_id' => $projectId, 'title' => $title, 'description' => $description, 'status' => 1, 'deadline' => $deadline, 'num_needed' => $numberOfPeople));
         array_push($taskArray, $task);
         //Increment row in file
         $row++;
     }
     fclose($handle);
 }
 //Save each task to the database if no errors are found
 if ($errorFound == 1) {
     $errorString = "<strong><span class='bad'>Your CSV file was not uploaded.</span></strong><br/>" . $errorString;
     $json = array("error" => $errorString);
     exit(json_encode($json));
 } else {
     foreach ($taskArray as $task) {
         $task->save();
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:adminUtilities.process.php

示例6: array

<?php

require_once "../../global.php";
$action = Filter::text($_POST['action']);
if ($action == 'edit') {
    // assign POST data to variables
    $username = Filter::text($_GET['un']);
    $pw = Filter::text($_POST['txtPassword']);
    $pw2 = Filter::text($_POST['txtConfirmPassword']);
    $email = Filter::email($_POST['txtEmail']);
    $name = Filter::text($_POST['txtName']);
    $month = Filter::text($_POST['selBirthMonth']);
    $year = Filter::text($_POST['selBirthYear']);
    $sex = Filter::text($_POST['selGender']);
    $location = Filter::text($_POST['txtLocation']);
    $biography = Filter::formattedText($_POST['txtBiography']);
    $user = User::loadByUsername($username);
    // make sure user exists
    if ($user === null) {
        $json = array('error' => 'That user does not exist.');
        exit(json_encode($json));
    }
    // new passwords provided?
    if ($pw != "" || $pw2 != "") {
        // do the passwords match?
        if ($pw != $pw2) {
            $json = array('error' => 'Sorry, your new passwords do not match.');
            exit(json_encode($json));
        }
    }
    // validate email address
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:user.process.php

示例7: array

<?php

require_once "../../global.php";
$user = User::load(Session::getUserID());
$action = Filter::text($_POST['action']);
if ($action == 'theme') {
    // get the new theme
    $themeID = Filter::numeric($_POST['themeID']);
    $theme = Theme::load($themeID);
    // validate the theme
    if (empty($theme)) {
        $json = array('error' => 'That theme does not exist.');
        exit(json_encode($json));
    }
    // save the new theme
    $user->setThemeID($theme->getID());
    $user->save();
    // send us back
    Session::setMessage("Theme changed.");
    $json = array('success' => '1');
    echo json_encode($json);
} elseif ($action == 'notification') {
    $notificationType = Filter::alphanum($_POST['notificationType']);
    $notificationValue = Filter::alphanum($_POST['notificationValue']);
    // convert checkbox value to database-friendly 1 or 0
    $value = $notificationValue == 'notify' ? 1 : 0;
    // figure out which User setter to use based on notification type
    switch ($notificationType) {
        case 'chkCommentTaskLeading':
            $user->setNotifyCommentTaskLeading($value);
            break;
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:settings.process.php

示例8: sendChat

function sendChat($pageId)
{
    $from = $_SESSION['username'];
    $to = Filter::text($_POST['to']);
    $message = $_POST['message'];
    $_SESSION['openChatBoxes'][$to] = date('Y-m-d H:i:s', time());
    $fromUsername = User::load($from)->getUsername();
    $messagesan = sanitize($message);
    if (!isset($_SESSION['chatHistory'][$to])) {
        $_SESSION['chatHistory'][$to] = '';
    }
    $_SESSION['chatHistory'][$to] .= <<<EOD
\t\t\t\t\t   {
\t\t\t"s": "1",
\t\t\t"f": "{$fromUsername}",
\t\t\t"m": "{$messagesan}"
\t   },
EOD;
    unset($_SESSION['tsChatBoxes'][$to]);
    $chat = new Chat(array('sender' => mysql_real_escape_string($from), 'recipient' => mysql_real_escape_string($to), 'message' => mysql_real_escape_string($messagesan), 'sent' => '2013-05-03 12:02:48'));
    $chat->save();
    $newId = $chat->getID();
    if (empty($_SESSION['openChatBoxes']["{$pageId}"])) {
        $_SESSION['openChatBoxes']["{$pageId}"] = $newId;
    } else {
        if ($newId - 1 == $_SESSION['openChatBoxes']["{$pageId}"]) {
            $_SESSION['openChatBoxes']["{$pageId}"] = $newId;
        }
    }
    echo formatParagraphs($messagesan, true);
    exit(0);
}
开发者ID:malimu,项目名称:Pipeline,代码行数:32,代码来源:chat.php

示例9: header

<?php

require_once "../../global.php";
$userName = Filter::text($_GET['un']);
$user = User::loadByUsername($userName);
// make sure user exists
if ($user === null) {
    header('Location: ' . Url::error());
    exit;
}
$events = Event::getUserEvents($user->getID(), 10);
//$tasks = Task::getByUserID($user->getID(), null, false);
$projects = ProjectUser::getProjectsByUserID($user->getID());
$soup = new Soup();
$soup->set('user', $user);
$soup->set('events', $events);
//$soup->set('tasks', $tasks);
$soup->set('projects', $projects);
$soup->render('site/page/user');
开发者ID:malimu,项目名称:Pipeline,代码行数:19,代码来源:user_c.php

示例10: json_encode

<?php

require_once "../../global.php";
require_once TEMPLATE_PATH . '/site/helper/format.php';
$subject = Filter::text($_POST['subject']);
$body = Filter::formattedText($_POST['body']);
if (empty($subject) || empty($body)) {
    $json = array('error' => 'You must provide a subject and body for the email.');
    exit(json_encode($json));
}
$massEmailAddresses = User::getMassEmailAddresses();
$newEmail = array('to' => SMTP_FROM_EMAIL, 'subject' => '[' . PIPELINE_NAME . '] ' . $subject, 'message' => $body, 'bcc' => $massEmailAddresses);
$sendEmail = Email::send($newEmail);
if (!$sendEmail !== true) {
    $json = array('error' => $sendEmail);
    exit(json_encode($json));
}
$numMassEmails = formatCount(count($massEmailAddresses), 'user', 'users');
// send us back
Session::setMessage("Your mass email was sent to " . $numMassEmails . ".");
$json = array('success' => '1');
echo json_encode($json);
开发者ID:malimu,项目名称:Pipeline,代码行数:22,代码来源:admin.process.php

示例11: Event

    } else {
        $discussion->setLocked(true);
        $eventTypeID = 'lock_discussion';
        $successMessage = 'You locked the discussion.';
    }
    $discussion->save();
    // log it
    $logEvent = new Event(array('event_type_id' => $eventTypeID, 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $discussion->getID()));
    $logEvent->save();
    // send us back
    Session::setMessage($successMessage);
    $json = array('success' => '1');
    echo json_encode($json);
} elseif ($action == 'create') {
    // get additional POST variables
    $title = Filter::text($_POST['title']);
    $message = Filter::formattedText($_POST['message']);
    $cat = Filter::numeric($_POST['cat']);
    // validate
    if ($title == '') {
        $json = array('error' => 'You must provide a title.');
        exit(json_encode($json));
    } elseif ($message == '') {
        $json = array('error' => 'You must provide some text for the message.');
        exit(json_encode($json));
    }
    if ($cat == '') {
        $cat = null;
    }
    // create discussion
    $discussion = new Discussion(array('creator_id' => Session::getUserID(), 'project_id' => $project->getID(), 'title' => $title, 'message' => $message, 'category' => $cat));
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:discussion.process.php

示例12: exit

         exit("unavailable");
     }
     break;
 case "register":
     // assign POST data to variables
     //	$code = 	 Filter::alphanum($_POST['code']);
     $uname = Filter::text($_POST['uname']);
     $pw = Filter::text($_POST['pw']);
     $pw2 = Filter::text($_POST['pw2']);
     $email = Filter::email($_POST['email']);
     $name = Filter::text($_POST['name']);
     $month = Filter::text($_POST['month']);
     $year = Filter::text($_POST['year']);
     $sex = Filter::text($_POST['sex']);
     $location = Filter::text($_POST['location']);
     $biography = Filter::text($_POST['biography']);
     // make sure username is provided
     if ($uname == "") {
         $json = array('error' => 'You must provide a unique username to register.');
         exit(json_encode($json));
     }
     // make sure username doesn't exist
     $un = User::loadByUsername($uname);
     if ($un != null) {
         $json = array('error' => 'Sorry, that username is already taken. Please try another one.');
         exit(json_encode($json));
     }
     // username blacklist
     $blacklist = array("process", "------", "administrator", "create", "new", "admin", "edit", "delete", "invite", "tasks", "people", "basics", "activity");
     foreach ($blacklist as $b) {
         if ($uname == $b) {
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:register.process.php

示例13: header

if ($project == null) {
    header('Location: ' . Url::error());
    exit;
}
// if private project, limit access to invited users, members, and admins
// and exclude banned members
if ($project->getPrivate()) {
    if (!Session::isAdmin() && !$project->isCreator(Session::getUserID())) {
        if (!$project->isInvited(Session::getUserID()) && !$project->isMember(Session::getUserID()) && !$project->isTrusted(Session::getUserID()) || ProjectUser::isBanned(Session::getUserID(), $project->getID())) {
            header('Location: ' . Url::error());
            exit;
        }
    }
}
// get category, if exists
$c = isset($_GET['cat']) ? Filter::text($_GET['cat']) : null;
switch ($c) {
    case 'basics':
        $cat = BASICS_ID;
        break;
    case 'tasks':
        $cat = TASKS_ID;
        break;
    case 'people':
        $cat = PEOPLE_ID;
        break;
    case 'activity':
        $cat = ACTIVITY_ID;
        break;
    default:
        $cat = null;
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:discussion_new_c.php

示例14: header

<?php

require_once "../../global.php";
$fileID = Filter::numeric($_GET['fi']);
$fileName = Filter::text($_GET['fn']);
$upload = Upload::load($fileID);
if ($upload == null || $fileName != $upload->getOriginalName() || $upload->getDeleted() == true) {
    header('Location: ' . Url::error());
    exit;
}
$fileURL = Url::uploads() . '/' . $upload->getStoredName();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header('Content-Type: ' . $upload->getMime() . '"');
header('Content-Disposition: attachment; filename="' . $upload->getOriginalName() . '"');
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . $upload->getSize());
readfile($fileURL);
开发者ID:malimu,项目名称:Pipeline,代码行数:21,代码来源:download_c.php

示例15: header

<?php

require_once "../../global.php";
$slug = Filter::text($_GET['slug']);
$filter = Filter::text($_GET['filter']);
$project = Project::getProjectFromSlug($slug);
// kick us out if slug invalid
if ($project == null) {
    header('Location: ' . Url::error());
    exit;
}
// if private project, limit access to invited users, members, and admins
// and exclude banned members
if ($project->getPrivate()) {
    if (!Session::isAdmin() && !$project->isCreator(Session::getUserID())) {
        if (!$project->isInvited(Session::getUserID()) && !$project->isMember(Session::getUserID()) && !$project->isTrusted(Session::getUserID()) || ProjectUser::isBanned(Session::getUserID(), $project->getID())) {
            header('Location: ' . Url::error());
            exit;
        }
    }
}
$projectID = $project->getID();
// page number, if any
if (empty($_GET['page'])) {
    $page = 1;
} else {
    $page = Filter::numeric($_GET['page']);
}
define('EVENTS_PER_PAGE', 10);
// how many events per page
switch ($filter) {
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:activity_c.php


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