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


PHP terminate函数代码示例

本文整理汇总了PHP中terminate函数的典型用法代码示例。如果您正苦于以下问题:PHP terminate函数的具体用法?PHP terminate怎么用?PHP terminate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: togglestate

function togglestate()
{
    global $apx, $db, $set;
    $id = (int) $_REQUEST['id'];
    $status = (int) $_REQUEST['status'];
    if (!$id) {
        terminate();
    }
    $open = $apx->session->get('news_cat_open');
    $open = array_map('intval', dash_unserialize($open));
    if (!is_array($open)) {
        $open = array();
    }
    if ($status) {
        if (!in_array($id, $open)) {
            $open[] = $id;
        }
    } else {
        $index = array_search($id, $open);
        if ($index !== false) {
            unset($open[$index]);
        }
    }
    $apx->session->set('news_cat_open', dash_serialize($open));
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:25,代码来源:admin_ajax.php

示例2: display

 /**
  * Displays the text for clear Ajax output.
  *
  * @param string $outstream	The text to output
  *
  * @return Bengine_Game_Account_Ajax
  */
 protected function display($outstream)
 {
     if (!$this->silence) {
         terminate($outstream);
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:14,代码来源:Ajax.php

示例3: _sendRemoteRequest

 /**
  * Sends a remote request.
  *
  * @param string $url		Universe url
  * @param string $username	Username
  * @param string $email		E-Mail address
  *
  * @return Bengine_Comm_Controller_Password
  */
 protected function _sendRemoteRequest($url, $username, $email)
 {
     $url .= Core::getLang()->getOpt("langcode") . "/password/request";
     $request = new Recipe_HTTP_Request($url, "Curl");
     $request->getSession()->setRequestType("POST")->setPostArgs(array("username" => $username, "email" => $email));
     terminate($request->getResponse());
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:17,代码来源:Password.php

示例4: requestParser

 /**
  *
  */
 public function requestParser($template)
 {
     if (!user_allowed_to('backup works')) {
         return $template;
     }
     $merged_post_get = array_merge($_GET, $_POST);
     if (!isset($merged_post_get['module']) || $merged_post_get['module'] != 'backup') {
         return $template;
     }
     $input_filter = array('backup_name' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => '~^[a-zA-Z0-9_\\-]+(|\\.zip)$~ui')), 'backup_description' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => '~^[a-zA-Z0-9_\\s\\-а-яА-Я.:;"]+$~ui')), 'action' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => '~^(create|restore|delete|download)+$~ui')), 'result' => array('filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => '~^[a-zA-Z_]+$~ui')));
     $_INPUT = get_filtered_input($input_filter);
     $result_text = 'Неизвестное действие';
     $result_class = 'backup_result_bad';
     switch ($_INPUT['action']) {
         case 'create':
             if ($_INPUT['backup_name'] == '') {
                 popup_message_add('Некорректное имя файла', JCMS_MESSAGE_ERROR);
                 break;
             }
             // force extension
             if (substr($_INPUT['backup_name'], -4) != '.zip') {
                 $_INPUT['backup_name'] .= '.zip';
             }
             if (($result = $this->createBackup($_INPUT['backup_name'], $_INPUT['backup_description'])) === true) {
                 popup_message_add('Резервная копия создана', JCMS_MESSAGE_OK);
             } else {
                 popup_message_add('Не удалось создать резервную копию', JCMS_MESSAGE_ERROR);
             }
             terminate('', 'Location: ./?module=backup&action=manage', 302);
             break;
         case 'restore':
             if (($result = $this->restoreBackup($_INPUT['backup_name'])) === true) {
                 popup_message_add('Резервная копия восстановлена', JCMS_MESSAGE_OK);
             } else {
                 popup_message_add('Не удалось восстановить резервную копию (' . $result . ')', JCMS_MESSAGE_ERROR);
             }
             terminate('', 'Location: ./?module=backup&action=manage', 302);
             break;
         case 'delete':
             if ($this->deleteBackup($_INPUT['backup_name'])) {
                 popup_message_add('Резервная копия удалена', JCMS_MESSAGE_OK);
             } else {
                 popup_message_add('Не удалось удалить резервную копию (' . $result . ')', JCMS_MESSAGE_ERROR);
             }
             terminate('', 'Location: ./?module=backup&action=manage', 302);
             break;
         case 'download':
             header('HTTP/1.1 200 OK');
             header('Content-Length: ' . filesize(__DIR__ . '/data/' . $_INPUT['backup_name']));
             header('Content-Type: octet/stream');
             header('Content-Transfer-Encoding: 8bit');
             header('Content-Disposition: attachment; filename*=UTF-8\'\'' . str_replace('+', '%20', urlencode(iconv('windows-1251', 'utf-8', $_INPUT['backup_name']))) . '');
             readfile(__DIR__ . '/data/' . $_INPUT['backup_name']);
             exit;
             break;
     }
     return $template;
 }
开发者ID:kzotoff,项目名称:JuliaCMS,代码行数:61,代码来源:func.php

示例5: showLoginBox

 /**
  * Popup login box
  *
  * @access  public
  * @return  void
  */
 function showLoginBox()
 {
     $realm = $GLOBALS['app']->Registry->fetch('realm', 'Settings');
     header('WWW-Authenticate: Basic realm="' . $realm . '"');
     header('HTTP/1.0 401 Unauthorized');
     // This code is only executed if the user hits the cancel button
     // or in some browsers user enters wrong data 3 times.
     $data = _t('GLOBAL_ERROR_ACCESS_DENIED');
     terminate($data, 401);
 }
开发者ID:juniortux,项目名称:jaws,代码行数:16,代码来源:HTTPAuth.php

示例6: Referrer

 /**
  * Redirect to referrer page
  *
  * @access  public
  * @return  void
  */
 static function Referrer()
 {
     if (isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) {
         $url = $_SERVER['HTTP_REFERER'];
     } else {
         $url = $GLOBALS['app']->getSiteURL('/');
     }
     $data = null;
     terminate($data, 302, $url);
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:16,代码来源:Header.php

示例7: getObj

function getObj(&$query, $ERR_NODATA = false, $ERR_MANYDATA = false)
{
    if ($query->num_rows == 0) {
        //NO
        $ERR_NODATA ? terminate(ERR::QUERY_NORESULT, $ERR_NODATA) : terminate(ERR::QUERY_NORESULT);
    } else {
        if ($query->num_rows == 1) {
            return $query->fetch_object();
        } else {
            $ERR_MANYDATA ? terminate(ERR::QUERY_RESULT_LENGTH, $ERR_MANYDATA) : terminate(ERR::QUERY_RESULT_LENGTH);
        }
    }
}
开发者ID:aleksailic,项目名称:smart-alarm-server,代码行数:13,代码来源:connect.inc.php

示例8: handle_error

function handle_error($errno, $errstr, $errfile, $errline, $errcontext)
{
    // timestamp for the error entry
    $dt = date("Y-m-d H:i:s");
    // Make log entries
    $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
    $error_msg = array("DT" => $dt, "E_NO" => $errno, "T" => $errortype, "E" => $errstr, "F" => $errfile, "L" => $errline);
    //$error_msg = "[$dt] $errortype[$errno] $errstr in $errfile at $errline";
    errorLog("{$error_msg}\n");
    //Critical errors
    $critical_errors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_USER_ERROR);
    if (in_array($errno, $critical_errors)) {
        error_log($error_msg, 1, "smsgyan@innoz.in");
        terminate($error_msg);
    }
}
开发者ID:superego546,项目名称:SMSGyan,代码行数:16,代码来源:main_functions.php

示例9: processRequest

/**
 * Includes the appropriate php script
 * to process the request
 *
 * @param string $http_verb the HTTP verb
 * @param array $parameters the list of parameters passed with the request
 */
function processRequest($http_verb, $parameters)
{
    if ($http_verb == "GET" && $parameters[0] == "parking" && $parameters[1] == "zone") {
        include "parking/zone.php";
    } else {
        if ($http_verb == "GET" && $parameters[0] == "parking" && $parameters[1] == "id") {
            include "parking/id.php";
        } else {
            if ($http_verb == "POST" && $parameters[0] == "parking" && $parameters[1] == "add") {
                include "parking/add.php";
            } else {
                if ($http_verb == "GET" && $parameters[0] == "feature" && $parameters[1] == "list") {
                    include "feature/list.php";
                } else {
                    terminate("unrecognized request");
                }
            }
        }
    }
}
开发者ID:soranoc,项目名称:GeoSmartCityPark,代码行数:27,代码来源:api.php

示例10: login_logout

CMS login/logout routines. Note that it doesn't intersect auth module
*/
function login_logout()
{
    // display login page instead any content, if requested
    if (isset($_GET['login']) && (!isset($_SESSION['CMS_AUTH_USER']) || $_SESSION['CMS_AUTH_USER'] == '')) {
        readfile('lib/login.html');
        terminate();
    }
    // check login/password if any
    if (isset($_POST['action']) && $_POST['action'] == 'checklogin') {
        if (@$_POST['userlogin'] == 'admin' && @$_POST['userpassword'] == CMS_ADMIN_PASSWORD) {
            $_SESSION['CMS_AUTH_USER'] = 'admin';
        }
    }
    // or logout?
    if (isset($_GET['logout'])) {
        $_SESSION['CMS_AUTH_USER'] = '';
        unset($_SESSION['CMS_AUTH_USER']);
        terminate('', 'Location: ./', 302);
开发者ID:kzotoff,项目名称:JuliaCMS,代码行数:20,代码来源:security.php

示例11: AJAXHandler

        return $template;
    }
    /**
	 *
	 */
    function AJAXHandler()
    {
        if (!user_allowed_to('manage files')) {
            terminate('Forbidden', '', 403);
        }
        // also suck something from config
        $userfiles_dirs = $this->getDirectoriesDescription();
        $response = 'bad request';
        switch ($_GET['action']) {
            case 'edit_elem':
                // check input
                if (!isset($_GET['file'])) {
                    return 'file not set';
                }
                $filename = $_GET['file'];
                // check extension
                if (!($alias = array_search($this->getUserFolderParams($filename), $userfiles_dirs))) {
                    return 'bad extension';
                }
                // some directories are not editable
                if (in_array($alias, array('files', 'images'))) {
                    return 'not editable content';
                }
                $content = file_get_contents($filename);
                $xml = new DOMDocument('1.0', 'utf-8');
                $xml->preserveWhiteSpace = true;
                $xml->formatOutput = true;
                $root = $xml->createElement('root');
                $root->appendChild($xml->createElement('category'))->nodeValue = $alias;
                $root->appendChild($xml->createElement('filename'))->nodeValue = $filename;
                $root->appendChild($xml->createElement('content'))->appendChild($xml->createCDATASection($content));
                $response = XSLTransform($xml->saveXML($root), __DIR__ . '/edit_form.xsl');
开发者ID:kzotoff,项目名称:JuliaCMS,代码行数:37,代码来源:func.php

示例12: array

<?php

// maybe allow some more leeway?
$mandatoryParameters = array('name', 'slots', 'openedFrom', 'closedAt', 'entrance', 'exit', 'walking', 'payment', 'latitude', 'longitude', 'features');
// checking that no parameter is missing
for ($i = 0; $i < count($mandatoryParameters); $i++) {
    if (!isset($_POST[$mandatoryParameters[$i]])) {
        terminate("missing parameter " . $mandatoryParameters[$i]);
    }
}
$name = $_POST['name'];
$slots = $_POST['slots'];
$openingHour = $_POST['openedFrom'];
$closingHour = $_POST['closedAt'];
$entrance = $_POST['entrance'];
$exit = $_POST['exit'];
$walking = $_POST['walking'];
$payment = $_POST['payment'];
$lat = $_POST['latitude'];
$lng = $_POST['longitude'];
$features = $_POST['features'];
$tmp = explode(',', $entrance);
$city = trim($tmp[sizeof($tmp) - 1], " ");
// default values
if (empty($openingHour)) {
    $openingHour = '00:00:00';
}
if (empty($closingHour)) {
    $closingHour = '23:59:59';
}
if (empty($slots)) {
开发者ID:soranoc,项目名称:GeoSmartCityPark,代码行数:31,代码来源:add.php

示例13: commentsGetAttached

 /**
  * Sends attached file to output
  *
  * @param array $input parameters
  * @param array $return metadata parameters
  * @param resource $DB database connection to use
  * @return string 'OK' or some error text
  */
 public static function commentsGetAttached($input, &$return_metadata, $DB)
 {
     // check ID first
     if (($object_id = $input['row_id']) == '') {
         $return_metadata = array('status' => 'ERROR');
         terminate('', 'Bad row ID', 400);
     }
     // check if comment exists
     if ($DB->querySingle("select count(*) from comments where id = '{$object_id}'") == '0') {
         $return_metadata = array('status' => 'ERROR');
         terminate('', 'No comment with this ID', 404);
     }
     // check if file was attached and exists now
     $attached_name = trim($DB->querySingle("select attached_name from comments where id = '{$object_id}'"));
     if ($attached_name == '') {
         terminate('', 'No file attached to this comment', 404);
     }
     $attached_full_name = self::COMMENTS_ATTACHED_DIR . $object_id;
     if (!file_exists($attached_full_name)) {
         terminate('', 'File missing', 500);
     }
     // send file type, according to file internal contents
     $output_name = str_replace('+', '%20', urlencode($attached_name));
     file_to_output($attached_full_name, array('Content-Disposition: attachment; filename="' . $output_name . '"', 'Content-Transfer-Encoding: binary', 'Expires: 0', 'Cache-Control: must-revalidate'));
     exit;
 }
开发者ID:kzotoff,项目名称:JuliaCMS,代码行数:34,代码来源:api.php

示例14: get_key

 /**
  * Fetch the encryption key
  *
  * Returns it as MD5 in order to have an exact-length 128 bit key.
  * Mcrypt is sensitive to keys that are not the correct length
  *
  * @param	string
  * @return	string
  */
 public function get_key($key = '')
 {
     if ($key === '') {
         if ($this->encryption_key !== '') {
             return $this->encryption_key;
         }
         $key = config_item('encryption_key');
         if (!strlen($key)) {
             terminate('In order to use the encryption class requires that you set an encryption key in your config file.');
         }
     }
     return md5($key);
 }
开发者ID:SkullaCode,项目名称:skullaframe,代码行数:22,代码来源:Encrypt.php

示例15: Fatal

 /**
  * Prints a Fatal Error
  *
  * @access  public
  * @param   string  $message            Error message
  * @param   int     $backtrace          Log trace back level
  * @param   int     $http_response_code HTTP response code
  * @return  void
  */
 static function Fatal($message, $backtrace = 0, $http_response_code = 500)
 {
     // Set Headers
     header('Content-Type: text/html; charset=utf-8');
     header('Cache-Control: no-cache, must-revalidate');
     header('Pragma: no-cache');
     if ($backtrace >= 0) {
         $backtrace++;
         $GLOBALS['log']->Log(JAWS_ERROR_FATAL, $message, $backtrace);
     }
     //Get content
     $content = file_get_contents(JAWS_PATH . 'gadgets/ControlPanel/Templates/FatalError.html');
     $content = str_replace('{{message}}', $message, $content);
     jaws()->http_response_code($http_response_code);
     terminate($content, $http_response_code, '', false);
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:25,代码来源:Error.php


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