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


PHP Functions::setResponse方法代码示例

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


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

示例1: checkRights

 public static function checkRights($page, $action, $token)
 {
     loadClass('status');
     loadClass('token');
     loadClass('action');
     loadClass('right');
     loadClass('customer');
     if (is_null($action)) {
         Functions::setResponse(400);
     }
     $pagename = str_replace('.php', '', basename($page));
     $actionName = $pagename . '-' . $action;
     $whereClause = 'name=:name';
     $params = array(array('id' => ':name', 'value' => $actionName));
     $result = Action::search($whereClause, $params);
     if (!count($result)) {
         echo 'Please update actions and rights!';
         Functions::setResponse(500);
     }
     $action = $result[0];
     define('LOGGED_OUT_STATUS', 'standard');
     $loggedOut = false;
     if (is_null($token) || strtolower($token) == 'none') {
         $loggedOut = true;
     } else {
         $whereClause = 'value=:value';
         $params = array(array('id' => ':value', 'value' => $token));
         $result = Token::search($whereClause, $params);
         if (!count($result)) {
             Functions::setResponse(498);
         } else {
             $token = $result[0];
             $customer = new Customer($token->get('customerId'));
             $status = new Status($customer->get('statusId'));
         }
     }
     if ($loggedOut) {
         $whereClause = 'name=:name';
         $params = array(array('id' => ':name', 'value' => LOGGED_OUT_STATUS));
         $result = Status::search($whereClause, $params);
         if (!count($result)) {
             Functions::setResponse(500);
         }
         $status = $result[0];
     }
     $whereClause = 'action_id=:action_id AND status_id=:status_id';
     $params = array(array('id' => ':action_id', 'value' => $action->get('id')), array('id' => ':status_id', 'value' => $status->get('id')));
     $result = Right::search($whereClause, $params);
     if (!count($result)) {
         Functions::setResponse(401);
     }
     if ($result[0]->get('right') == 'deny') {
         Functions::setResponse(401);
     }
 }
开发者ID:Babaritech,项目名称:babar2,代码行数:55,代码来源:functions.class.php

示例2: deleteDrink

function deleteDrink($id)
{
    if (is_null($id)) {
        Functions::setResponse(400);
    }
    try {
        $c = new Drink($id);
        $c->delete();
        return true;
    } catch (RuntimeException $e) {
        Functions::setResponse(404);
    }
}
开发者ID:Babaritech,项目名称:babar2,代码行数:13,代码来源:drink.php

示例3: deleteStatus

function deleteStatus($id)
{
    if (is_null($id)) {
        Functions::setResponse(400);
    }
    try {
        $s = new Status($id);
        $s->delete();
        return true;
    } catch (RuntimeException $e) {
        Functions::setResponse(404);
    }
}
开发者ID:Babaritech,项目名称:babar2,代码行数:13,代码来源:status.php

示例4: getSQLTableName

 public static function getSQLTableName($tableName)
 {
     $tables = array('action' => 'actions', 'customer' => 'customers', 'status' => 'status', 'drink' => 'drinks', 'entry' => 'entries', 'right' => 'rights', 'sell' => 'sells', 'token' => 'tokens', 'totalentries' => 'total_entries', 'totalsells' => 'total_sells', 'balance' => 'balances', 'effectiveright' => 'effective_rights', 'favdrink' => 'favdrinks');
     if (isset($tables[$tableName])) {
         return $tables[$tableName];
     } else {
         if (DEBUG) {
             echo 'Fatal error : Unable to load the table name for class ' . $className . ' !';
         }
         Functions::setResponse(500);
     }
     return;
 }
开发者ID:Babaritech,项目名称:babar2,代码行数:13,代码来源:fields.class.php

示例5: reportSqlBugIfExists

 public static function reportSqlBugIfExists($errorArray)
 {
     if ($errorArray[0] == '0000') {
         return;
     }
     $message = 'SQL_STATE : ' . $errorArray[0] . "\n<br />";
     $message .= 'Error code : ' . $errorArray[1] . "\n<br />\n<br />";
     $message .= $errorArray[2];
     if (DEBUG) {
         echo $message;
     }
     Functions::setResponse(500);
 }
开发者ID:Babaritech,项目名称:babar2,代码行数:13,代码来源:model.class.php

示例6: getCustomerHistory

function getCustomerHistory($id)
{
    if (is_null($id)) {
        Functions::setResponse(400);
    }
    try {
        $c = new Customer($id);
        $whereClause = 'customer_id = :cid';
        $params = array(array('id' => ':cid', 'value' => $id, 'type' => PDO::PARAM_INT));
        return Entry::search($whereClause, $params);
    } catch (RuntimeException $e) {
        if (!isset($c)) {
            Functions::setResponse(404);
        }
    }
}
开发者ID:Babaritech,项目名称:babar2,代码行数:16,代码来源:entry.php

示例7: searchRight

function searchRight($actionId, $statusId)
{
    if (is_null($actionId) || is_null($statusId)) {
        Functions::setResponse(400);
    }
    $whereClause = 'action_id=:action_id AND status_id=:status_id';
    $params = array(array('id' => ':action_id', 'value' => $actionId), array('id' => ':status_id', 'value' => $statusId));
    $result = Right::search($whereClause, $params);
    if (!count($result)) {
        Functions::setResponse(404);
    }
    return $result[0];
}
开发者ID:Babaritech,项目名称:babar2,代码行数:13,代码来源:right.php

示例8: getFavDrink

function getFavDrink($id)
{
    if (is_null($id)) {
        Functions::setResponse(400);
    }
    $whereClause = 'customer_id = :cid';
    $params = array(array('id' => ':cid', 'value' => $cid));
    $result = FavDrink::search($whereClause, $params);
    return count($result) ? $result[0] : null;
}
开发者ID:Babaritech,项目名称:babar2,代码行数:10,代码来源:customer.php

示例9: loadClass

loadClass('right');
loadClass('action');
loadClass('status');
/* Load SQL Views */
/* <controller> */
/* <functions> */
if (isset($_GET['name'], $_GET['checked'])) {
    $name = explode('-', $_GET['name']);
    $right = $_GET['checked'] == 'true' ? 'allow' : 'deny';
    $st = $name[1];
    $ac = $name[3];
    $whereClause = 'action_id = :ac AND status_id = :st';
    $params = array(array('id' => ':ac', 'value' => $ac), array('id' => ':st', 'value' => $st));
    $result = Right::search($whereClause, $params);
    if (!count($result)) {
        Functions::setResponse(404);
    }
    $ri = $result[0];
    $ri->set('right', $right);
    $ri->save();
}
$rights = Right::searchForAll();
$actions = Action::searchForAll();
$status = Status::searchForAll();
$aArr = array();
$sArr = array();
$rArr = array();
foreach ($actions as $a) {
    $aArr[$a->get('id')] = $a->get('name');
    $rArr[$a->get('id')] = array();
}
开发者ID:Babaritech,项目名称:babar2,代码行数:31,代码来源:_right_handle.php


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