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


PHP fatal函数代码示例

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


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

示例1: main

 public static function main($argv)
 {
     global $coach;
     list($tid) = $argv;
     if ($tid) {
         if (!get_alt_col('teams', 'team_id', $tid, 'name')) {
             fatal('Invalid team');
         }
         $team = new Team($tid);
         $ALLOW_EDIT = is_object($coach) && ($team->owned_by_coach_id == $coach->coach_id || $coach->mayManageObj(T_OBJ_TEAM, $tid)) && !$team->is_retired;
         # Show team action boxes?
     } else {
         $team = null;
         $ALLOW_EDIT = false;
     }
     if ($ALLOW_EDIT && isset($_POST['action']) && isset($_POST['pid'])) {
         $pid = (int) $_POST['pid'];
         switch ($_POST['action']) {
             case 'delete':
                 status(self::delete((int) $pid));
                 break;
             case 'new':
             case 'edit':
                 status(self::edit((int) $pid, $_POST['title'], $_POST['about']));
                 break;
         }
     }
     self::printList($team, $ALLOW_EDIT);
     return true;
 }
开发者ID:nicholasmr,项目名称:obblm,代码行数:30,代码来源:class_cemetery.php

示例2: __construct

 /**
  * Constructor
  */
 public function __construct($conf = array())
 {
     // ldap extension is needed
     if (!function_exists('ldap_connect')) {
         fatal("To use the LDAP authenticator, you need PHP with LDAP support.");
     }
     // Defaults, override in config
     $default_conf['server'] = '';
     $default_conf['port'] = 389;
     $default_conf['usertree'] = '';
     $default_conf['grouptree'] = '';
     $default_conf['userfilter'] = '(&(uid=%{user})(objectClass=posixAccount))';
     $default_conf['groupfilter'] = '(&(objectClass=posixGroup)(memberUID=%{uid}))';
     $default_conf['version'] = 3;
     $default_conf['starttls'] = 0;
     $default_conf['referrals'] = 0;
     $default_conf['deref'] = LDAP_DEREF_NEVER;
     $default_conf['binddn'] = '';
     $default_conf['bindpw'] = '';
     $default_conf['userscope'] = 'sub';
     $default_conf['groupscope'] = 'sub';
     $default_conf['groupkey'] = 'cn';
     $default_conf['debug'] = 0;
     foreach ($conf as $key => $val) {
         if (array_key_exists($key, $default_conf)) {
             $default_conf[$key] = $val;
         }
     }
     // Set configuration
     $this->conf = $default_conf;
 }
开发者ID:pexner,项目名称:munkireport-php,代码行数:34,代码来源:authLDAP.php

示例3: login_do_http_auth

function login_do_http_auth()
{
    global $LOGIN_PASSWORD, $LOGIN_USERNAME;
    global $_SERVER;
    if ($_SERVER['REMOTE_USER']) {
        is_logged_in(true);
        return;
    }
    if (!$_SERVER['PHP_AUTH_USER']) {
        is_logged_in(false);
        return;
    }
    $status = authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
    if (!succeeds($status)) {
        is_logged_in(false);
        if (!fatal($status)) {
            if ($_SERVER['PHP_AUTH_USER']) {
                http_401();
            }
        } else {
            print "Error logging in: " . auth_error();
        }
    } else {
        $LOGIN_USERNAME = $_SERVER['PHP_AUTH_USER'];
        $LOGIN_PASSWORD = $_SERVER['PHP_AUTH_PW'];
        is_logged_in(true);
    }
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:28,代码来源:login.php

示例4: log

 static function log($category, $message)
 {
     require_once THRIFT_ROOT . '/Thrift.php';
     require_once THRIFT_ROOT . '/protocol/TBinaryProtocol.php';
     require_once THRIFT_ROOT . '/transport/TSocket.php';
     require_once THRIFT_ROOT . '/transport/TFramedTransport.php';
     require_once THRIFT_ROOT . '/packages/scribe/scribe.php';
     switch ($category) {
         case 'general':
         case 'accounts':
         case 'actions':
         case 'status':
         case 'security':
         case 'debug':
         case 'history':
         case 'regulation':
         case 'specials':
             break;
         default:
             fatal();
     }
     if (!is_string($message)) {
         if (is_array($message)) {
             if (!isset($message['ts'])) {
                 $message['ts'] = time();
             }
             if (!isset($message['client_ip'])) {
                 $message['client_ip'] = Utils::get_client_ip();
             }
             if (!isset($message['user_id']) && Auth::is_logged()) {
                 $message['user_id'] = Auth::get_user_id();
             }
             if (!isset($message['user_name']) && Auth::is_logged()) {
                 $message['user_name'] = Auth::get_user_name();
             }
             $oauth_client_id = Auth::get_oauth_client_id();
             if (!isset($message['oauth_client_id']) && !empty($oauth_client_id)) {
                 $message['oauth_client_id'] = $oauth_client_id;
             }
         }
         $message = json_encode($message);
     }
     try {
         $log_entry = new \LogEntry(array('category' => $category, 'message' => $message));
         $messages = array($log_entry);
         $socket = new \TSocket(SCRIBE_HOST, SCRIBE_PORT, FALSE);
         $transport = new \TFramedTransport($socket);
         $protocol = new \TBinaryProtocolAccelerated($transport, FALSE, FALSE);
         $client = new \scribeClient($protocol, $protocol);
         $transport->open();
         $client->send_log($messages);
         $transport->close();
     } catch (\TException $e) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:jedisct1,项目名称:PHP-OAuth2-Provider,代码行数:57,代码来源:class.scribe.inc.php

示例5: main

function main()
{
    $opts = getopt("cath");
    if (isset($opts['h']) || !isset($opts['a']) && !isset($opts['t'])) {
        usage();
    }
    if (isset($opts['a']) && isset($opts['t'])) {
        fatal("can't use -a and -t together");
    }
    $mode = isset($opts['t']) ? 'tx' : 'address';
    if (isset($opts['c'])) {
        switch ($mode) {
            case "tx":
                echo <<<'EOD'

DROP TABLE t_shortlinks;
CREATE TABLE t_shortlinks (
    shortcut bytea NOT NULL PRIMARY KEY,
    hash bytea NOT NULL REFERENCES transactions
);

ALTER TABLE public.t_shortlinks OWNER TO blockupdate;
GRANT SELECT ON TABLE t_shortlinks TO "www-data";

EOD;
                break;
            case "address":
                echo <<<'EOD'

DROP TABLE a_shortlinks;
CREATE TABLE a_shortlinks (
    shortcut bytea NOT NULL PRIMARY KEY,
    hash160 bytea NOT NULL REFERENCES keys
);

ALTER TABLE public.a_shortlinks OWNER TO blockupdate;
GRANT SELECT ON TABLE a_shortlinks TO "www-data";

EOD;
                break;
        }
    }
    $fh = fopen("php://stdin", "r");
    while ($line = trim(fgets($fh))) {
        $arr = explode(" ", $line);
        if ($mode == "tx") {
            $shortcut_hex = decodeBase58($arr[0]);
            $tx_hex = $arr[1];
            echo "INSERT INTO t_shortlinks(shortcut, hash) VALUES (decode('{$shortcut_hex}', 'hex'), decode('{$tx_hex}', 'hex'));\n";
        } elseif ($mode == "address") {
            $shortcut_hex = decodeBase58($arr[0]);
            $hash160_hex = addressToHash160($arr[1]);
            echo "INSERT INTO a_shortlinks(shortcut, hash160) VALUES (decode('{$shortcut_hex}', 'hex'), decode('{$hash160_hex}', 'hex'));\n";
        }
    }
}
开发者ID:blockexplorers,项目名称:blockexplorer,代码行数:56,代码来源:update_shortlinks.php

示例6: queues_set_qnostate

function queues_set_qnostate($exten, $qnostate)
{
    global $astman;
    // Update the settings in ASTDB
    if ($astman) {
        $astman->database_put("AMPUSER", $exten . "/queues/qnostate", $qnostate);
    } else {
        fatal("Cannot connect to Asterisk Manager with " . $amp_conf["AMPMGRUSER"] . "/" . $amp_conf["AMPMGRPASS"]);
    }
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:10,代码来源:hook_core.php

示例7: __call

 public function __call($method, $args)
 {
     if (!method_exists($this->base, $method)) {
         fatal('"%s" method does not exist.', $method);
     }
     if ($this->base instanceof View\Template) {
         return call_user_func_array([$this->base, $method], $args);
     }
     fatal('Class is not an instance of View\\Template');
 }
开发者ID:noikiy,项目名称:unity,代码行数:10,代码来源:View.php

示例8: load_image

function load_image($imagekey)
{
    if (1 !== preg_match('/[0-9a-f]{40}/', $imagekey)) {
        fatal('Invalid image key.');
    }
    $im = imagecreatefrompng("uploads/{$imagekey}.png");
    if (!$im) {
        fatal('Failed to load image.');
    }
    return $im;
}
开发者ID:p4-team,项目名称:ctf,代码行数:11,代码来源:common.php

示例9: get_original_url

 public function get_original_url()
 {
     if (!isset($_GET['url'])) {
         fatal("Proxy URL rewriter error: url GET parameter not found.");
     }
     $this->original_url = base64_decode($_GET['url'], TRUE);
     if (!is_string($this->original_url)) {
         fatal("Proxy URL rewriter error: url GET parameter is invalidly base64 encoded.");
     }
     $this->warnx("URL [{$this->original_url}]");
 }
开发者ID:laiello,项目名称:youtube-cache,代码行数:11,代码来源:youtube.php

示例10: __call

 public function __call($method, $args)
 {
     if (!isset($args[0])) {
         if (!isset($this->cache[$method])) {
             fatal('"%s" is not set.', $method);
         }
         return $this->cache[$method];
     }
     $this->cache[$method] = $args[0];
     return $this;
 }
开发者ID:noikiy,项目名称:unity,代码行数:11,代码来源:Config.php

示例11: replaceTextInFile

function replaceTextInFile($sFilepath, $dPairs)
{
    $s = file_get_contents($sFilepath);
    if (!$s) {
        echo "Could not read file {$sFilepath}";
        fatal(__LINE__);
    }
    foreach ($dPairs as $sFrom => $sTo) {
        $s = str_replace($sFrom, $sTo, $s);
    }
    file_put_contents($sFilepath, $s);
}
开发者ID:bcneb,项目名称:WebYep,代码行数:12,代码来源:make_release.php

示例12: load_conf

function load_conf()
{
    // Load default configuration
    require_once APP_ROOT . "config_default.php";
    if ((include_once APP_ROOT . "config.php") !== 1) {
        fatal(APP_ROOT . "config.php is missing!<br>\n\tUnfortunately, Munkireport does not work without it</p>");
    }
    // Convert auth_config to config item
    if (isset($auth_config)) {
        $conf['auth']['auth_config'] = $auth_config;
    }
    $GLOBALS['conf'] =& $conf;
}
开发者ID:kidistS,项目名称:munkireport-php,代码行数:13,代码来源:index.php

示例13: __construct

 public function __construct()
 {
     global $config;
     if (!file_exists($this->configFile)) {
         fatal("Could not open config file");
     }
     $json = file($this->configFile);
     if (!$json) {
         fatal("Could not open file: " . $this->configFile);
     }
     $config = json_decode($json);
     if (!$config) {
         fatal("Could not decode json string" . json_last_error_msg());
     }
 }
开发者ID:rustyeddy,项目名称:sandbox,代码行数:15,代码来源:Config.php

示例14: init

/**
 * Makes everything go.
 *
 * @return void
 */
function init($url)
{
    // process the request URL
    $manager = new PathManager($url);
    $route = $manager->build_route();
    $instance = $manager->controller_instance($route->controller);
    if ($instance === FALSE) {
        fatal("Fatal Error: Cannot find a controller called '{$route->controller}'.", 404);
    } elseif (method_exists($instance, $route->action) === FALSE) {
        fatal("Fatal Error: Controller '{$route->controller}' does not respond to action '{$route->action}'.", 404);
    }
    $action = $route->action;
    sys()->getData->add($route->params);
    $instance->{$action}($route->params);
    render($route);
}
开发者ID:allynbauer,项目名称:Condor,代码行数:21,代码来源:system_functions.php

示例15: getdbh

function getdbh()
{
    if (!isset($GLOBALS['dbh'])) {
        try {
            $GLOBALS['dbh'] = new PDO(conf('pdo_dsn'), conf('pdo_user'), conf('pdo_pass'), conf('pdo_opts'));
        } catch (PDOException $e) {
            fatal('Connection failed: ' . $e->getMessage());
        }
        // Set error mode
        $GLOBALS['dbh']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        // Store database name in config array
        if (preg_match('/.*dbname=([^;]+)/', conf('pdo_dsn'), $result)) {
            $GLOBALS['conf']['dbname'] = $result[1];
        }
    }
    return $GLOBALS['dbh'];
}
开发者ID:hymmm,项目名称:munkireport-php,代码行数:17,代码来源:site_helper.php


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