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


PHP die_miserable_death函数代码示例

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


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

示例1: load_translation_text

/**
 * Loads all the language translation into an array for quick lookup.
 *
 * <b>Note:</b> There is no need to call this manually.  It will be invoked by
 * {@link translate()} the first time it is called.
 */
function load_translation_text()
{
    global $lang_file, $translations, $basedir, $PUBLIC_ACCESS_FULLNAME, $fullname;
    $translations = array();
    if (strlen($basedir)) {
        $lang_file_2 = "{$basedir}/{$lang_file}";
        if (file_exists($lang_file_2)) {
            $lang_file = $lang_file_2;
        }
    }
    if (!file_exists($lang_file)) {
        die_miserable_death("Cannot find language file: {$lang_file}");
    }
    $fp = fopen($lang_file, "r");
    if (!$fp) {
        die_miserable_death("Could not open language file: {$lang_file}");
    }
    while (!feof($fp)) {
        $buffer = fgets($fp, 4096);
        $buffer = trim($buffer);
        //  stripslashes may cause problems with Japanese translations
        // if so, we may have to make this configurable.
        if (get_magic_quotes_runtime()) {
            $buffer = stripslashes($buffer);
        }
        if (substr($buffer, 0, 1) == "#" || strlen($buffer) == 0) {
            continue;
        }
        $pos = strpos($buffer, ":");
        $abbrev = substr($buffer, 0, $pos);
        $abbrev = trim($abbrev);
        $trans = substr($buffer, $pos + 1);
        $trans = trim($trans);
        $translations[$abbrev] = $trans;
        //echo "Abbrev: $abbrev<br />Trans: $trans<br />\n";
    }
    fclose($fp);
    $PUBLIC_ACCESS_FULLNAME = translate("Public Access");
    if ($fullname == "Public Access") {
        $fullname = $PUBLIC_ACCESS_FULLNAME;
    }
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:48,代码来源:translate.php

示例2: doDbSanityCheck

function doDbSanityCheck()
{
    global $db_database, $db_host, $db_login;
    $dieMsgStr = 'Error finding WebCalendar tables in database "' . $db_database . '" using db login "' . $db_login . '" on db server "' . $db_host . '".<br /><br />
Have you created the database tables as specified in the
<a href="docs/WebCalendar-SysAdmin.html" ' . '  target="other">WebCalendar System Administrator\'s Guide</a>?';
    $res = @dbi_execute('SELECT COUNT( cal_value ) FROM webcal_config', array(), false, false);
    if ($res) {
        if ($row = dbi_fetch_row($res)) {
            // Found database. All is peachy.
            dbi_free_result($res);
        } else {
            // Error accessing table.
            // User has wrong db name or has not created tables.
            // Note: can't translate this since translate.php is not included yet.
            dbi_free_result($res);
            die_miserable_death($dieMsgStr);
        }
    } else {
        die_miserable_death($dieMsgStr);
    }
}
开发者ID:GetInTheGo,项目名称:JohnsonFinancialService,代码行数:22,代码来源:validate.php

示例3: doDbSanityCheck

function doDbSanityCheck()
{
    global $db_login, $db_host, $db_database;
    $res = @dbi_query("SELECT COUNT(cal_value) FROM webcal_config", false, false);
    if ($res) {
        if ($row = dbi_fetch_row($res)) {
            // Found database.  All is peachy.
            dbi_free_result($res);
        } else {
            // Error accessing table.
            // User has wrong db name or has not created tables.
            // Note: cannot translate this since we have not included
            // translate.php yet.
            dbi_free_result($res);
            die_miserable_death("Error finding WebCalendar tables in database '{$db_database}' " . "using db login '{$db_login}' on db server '{$db_host}'.<br/><br/>\n" . "Have you created the database tables as specified in the " . "<a href=\"docs/WebCalendar-SysAdmin.html\" target=\"other\">WebCalendar " . "System Administrator's Guide</a>?");
        }
    } else {
        // Error accessing table.
        // User has wrong db name or has not created tables.
        // Note: cannot translate this since we have not included translate.php yet.
        die_miserable_death("Error finding WebCalendar tables in database '{$db_database}' " . "using db login '{$db_login}' on db server '{$db_host}'.<br/><br/>\n" . "Have you created the database tables as specified in the " . "<a href=\"docs/WebCalendar-SysAdmin.html\" target=\"other\">WebCalendar " . "System Administrator's Guide</a>?");
    }
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:23,代码来源:validate.php

示例4: save_pref

function save_pref($prefs, $src)
{
    global $my_theme, $prefuser;
    while (list($key, $value) = each($prefs)) {
        if ($src == 'post') {
            $setting = substr($key, 5);
            $prefix = substr($key, 0, 5);
            if ($prefix != 'pref_') {
                continue;
            }
            // validate key name.  should start with "pref_" and not include
            // any unusual characters that might cause SQL injection
            if (!preg_match('/pref_[A-Za-z0-9_]+$/', $key)) {
                die_miserable_death(str_replace('XXX', $key, translate('Invalid setting name XXX.')));
            }
        } else {
            $setting = $key;
            $prefix = 'pref_';
        }
        //echo "Setting = $setting, key = $key, prefix = $prefix<br />\n";
        if (strlen($setting) > 0 && $prefix == 'pref_') {
            if ($setting == 'THEME' && $value != 'none') {
                $my_theme = strtolower($value);
            }
            $sql = 'DELETE FROM webcal_user_pref WHERE cal_login = ? ' . 'AND cal_setting = ?';
            dbi_execute($sql, array($prefuser, $setting));
            if (strlen($value) > 0) {
                $setting = strtoupper($setting);
                $sql = 'INSERT INTO webcal_user_pref ' . '( cal_login, cal_setting, cal_value ) VALUES ' . '( ?, ?, ? )';
                if (!dbi_execute($sql, array($prefuser, $setting, $value))) {
                    $error = 'Unable to update preference: ' . dbi_error() . '<br /><br /><span class="bold">SQL:</span>' . $sql;
                    break;
                }
            }
        }
    }
}
开发者ID:GetInTheGo,项目名称:JohnsonFinancialService,代码行数:37,代码来源:pref.php

示例5: get_wc_path

function get_wc_path($filename)
{
    if (preg_match('/(.*)security_audit.php/', __FILE__, $matches)) {
        $fileLoc = $matches[1] . $filename;
        return $fileLoc;
    } else {
        // Oops. This file is not named security_audit.php
        die_miserable_death('Crap! Someone renamed security_audit.php');
    }
}
开发者ID:rhertzog,项目名称:lcs,代码行数:10,代码来源:security_audit.php

示例6: getValue

function getValue($name, $format = '', $fatal = false)
{
    global $settings;
    $val = getPostValue($name);
    if (!isset($val)) {
        $val = getGetValue($name);
    }
    // for older PHP versions...
    if (!isset($val) && get_magic_quotes_gpc() == 1 && !empty($GLOBALS[$name])) {
        $val = $GLOBALS[$name];
    }
    if (!isset($val)) {
        return '';
    }
    if (!empty($format) && !preg_match('/^' . $format . '$/', $val)) {
        // does not match
        if ($fatal) {
            if ($settings['mode'] == 'dev') {
                $error_str = ' "' . $val . '"';
            } else {
                $error_str = '';
            }
            die_miserable_death(translate('Fatal Error') . ': ' . translate('Invalid data format for') . ' ' . $name . $error_str);
        }
        // ignore value
        return '';
    }
    preventHacking($name, $val);
    return $val;
}
开发者ID:GetInTheGo,项目名称:JohnsonFinancialService,代码行数:30,代码来源:formvars.php

示例7: translate

<?php

/* $Id: admin_handler.php,v 1.7.4.3 2005/11/29 15:28:25 cknudsen Exp $ */
include_once 'includes/init.php';
$error = "";
if (!$is_admin) {
    $error = translate("You are not authorized");
}
if ($error == "") {
    while (list($key, $value) = each($HTTP_POST_VARS)) {
        $setting = substr($key, 6);
        // validate key name.  should start with "admin_" and not include
        // any unusual characters that might cause SQL injection
        if (!preg_match('/admin_[A-Za-z0-9_]+$/', $key)) {
            die_miserable_death('Invalid admin setting name "' . $key . '"');
        }
        if (strlen($setting) > 0) {
            $sql = "DELETE FROM webcal_config WHERE cal_setting = '{$setting}'";
            if (!dbi_query($sql)) {
                $error = translate("Error") . ": " . dbi_error() . "<br /><br /><span style=\"font-weight:bold;\">SQL:</span> {$sql}";
                break;
            }
            if (strlen($value) > 0) {
                $sql = "INSERT INTO webcal_config " . "( cal_setting, cal_value ) VALUES " . "( '{$setting}', '{$value}' )";
                if (!dbi_query($sql)) {
                    $error = translate("Error") . ": " . dbi_error() . "<br /><br /><span style=\"font-weight:bold;\">SQL:</span> {$sql}";
                    break;
                }
            }
        }
    }
开发者ID:rohcehlam,项目名称:rflow,代码行数:31,代码来源:admin_handler.php

示例8: unset

        $_SERVER['PHP_AUTH_PW'] = $_SERVER['PHP_AUTH_USER'] = '';
        unset($_SERVER['PHP_AUTH_USER']);
        unset($_SERVER['PHP_AUTH_PW']);
        header('WWW-Authenticate: Basic realm="' . $appStr . '"');
        header('HTTP/1.0 401 Unauthorized');
        exit;
    }
}
load_global_settings();
load_user_preferences();
$WebCalendar->setLanguage();
// Load user name, etc.
user_load_variables($login, '');
// Make sure the have privileges to access the activity log
if (!$is_admin || access_is_enabled() && !access_can_access_function(ACCESS_ACTIVITY_LOG)) {
    die_miserable_death(print_not_auth(2));
}
$charset = empty($LANGUAGE) ? 'iso-8859-1' : translate('charset');
// This should work ok with RSS, may need to hardcode fallback value.
$lang = languageToAbbrev($LANGUAGE == 'Browser-defined' || $LANGUAGE == 'none' ? $lang : $LANGUAGE);
if ($lang == 'en') {
    $lang = 'en-us';
}
//the RSS 2.0 default.
$appStr = generate_application_name();
$descr = $appStr . ' - ' . translate('Activity Log');
// header ( 'Content-type: application/rss+xml');
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="' . $charset . '"?>
<rss version="2.0" xml:lang="' . $lang . '">
  <channel>
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:rss_activity_log.php

示例9: load_translation_text

function load_translation_text()
{
    global $lang_file, $settings, $translation_loaded, $translations;
    if ($translation_loaded) {
        // No need to run this twice.
        return;
    }
    $eng_file = 'translations/English-US.txt';
    $lang_cache = substr($lang_file, strrpos($lang_file, '/') + 1);
    $lang_file_2 = '';
    if (defined('__WC_BASEDIR')) {
        if (!file_exists($lang_file)) {
            $lang_file_2 = __WC_BASEDIR . '/' . $lang_file;
        }
        if (file_exists($lang_file_2)) {
            $lang_file = $lang_file_2;
        }
        if (!file_exists($lang_file)) {
            $lang_file = 'translations/' . $lang_cache;
        }
    }
    if (!file_exists($lang_file)) {
        $lang_file = $eng_file;
    }
    if (!file_exists($lang_file)) {
        die_miserable_death('Cannot find language file: ' . $lang_file);
    }
    $cached_base_file = $cached_file = $cachedir = '';
    $can_save = false;
    if (!file_exists($eng_file)) {
        $eng_file = '../' . $eng_file;
    }
    // Check for 'cachedir' in settings. If found, then we will save
    // the parsed translation file there as a serialized array.
    // Ensure we use the proper cachedir name.
    if (!empty($settings['cachedir']) && is_dir($settings['cachedir'])) {
        $cachedir = $settings['cachedir'];
    } else {
        if (!empty($settings['db_cachedir']) && is_dir($settings['db_cachedir'])) {
            $cachedir = $settings['db_cachedir'];
        }
    }
    if (!empty($cachedir) && function_exists('file_get_contents')) {
        $cached_base_file = $cached_file = $cachedir . '/translations/';
        $cached_base_file .= 'English-US.txt';
        $cached_file .= $lang_cache;
        $cache_tran_dir = dirname($cached_file);
        if (!is_dir($cache_tran_dir)) {
            @mkdir($cache_tran_dir, 0777);
            @chmod($cache_tran_dir, 0777);
            /*
                 // Do we really want to die if we can't save the cache file?
                 // Or should we just run without it?
                 if ( ! is_dir ( $cache_tran_dir ) )
                   die_miserable_death ( 'Error creating translation cache directory: "'
                      . $cache_tran_dir
                      . '"<br /><br />Please check the permissions of the directory: "'
                      . $cachedir . '"' );
            */
        }
        $can_save = is_writable($cache_tran_dir);
    }
    $new_install = !strstr($_SERVER['SCRIPT_NAME'], 'install/index.php');
    $translations = array();
    // First set default $translations[]
    // by reading the base English-US.txt file or it's cache.
    if (empty($cached_base_file)) {
        read_trans_file($eng_file);
    } else {
        if (!file_exists($cached_base_file) || filemtime($eng_file) > filemtime($cached_base_file)) {
            read_trans_file($eng_file, $cached_base_file);
        } else {
            // Cache is newer.
            $translations = unserialize(file_get_contents($cached_base_file));
        }
    }
    // Then, if language is not English,
    // read in the user's language file to overwrite the array.
    // This will ensure that any << MISSING >> phrases at least have a default.
    if ($lang_file !== $eng_file) {
        if (empty($cached_file)) {
            read_trans_file($lang_file);
        } else {
            if (!file_exists($cached_file) || filemtime($lang_file) > filemtime($cached_file)) {
                read_trans_file($lang_file, $cached_file);
            } else {
                // Cache is newer.
                $translations = unserialize(file_get_contents($cached_file));
            }
        }
    }
    $translation_loaded = true;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:93,代码来源:translate.php

示例10: dbi_execute

                    $layerid += $row[0];
                }
                dbi_execute('INSERT INTO webcal_user_layers ( cal_layerid, cal_login,
        cal_layeruser, cal_color, cal_dups ) VALUES ( ?, ?, ?, ?, ? )', array($layerid, $login, $nid, $layercolor, 'N'));
                $layer_found = true;
            }
        }
    }
    // Add entry in UAC access table for new admin and remove for old admin.
    // First delete any record for this user/nuc combo.
    dbi_execute('DELETE FROM webcal_access_user WHERE cal_login = ?
    AND cal_other_user = ?', array($nadmin, $nid));
    if (!dbi_execute('INSERT INTO webcal_access_user ( cal_login,
    cal_other_user, cal_can_view, cal_can_edit, cal_can_approve, cal_can_invite,
    cal_can_email, cal_see_time_only ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ? )', array($nadmin, $nid, 511, 511, 511, 'Y', 'Y', 'N'))) {
        die_miserable_death(translate('Database error') . ': ' . dbi_error());
    }
}
if (!empty($reload)) {
    $data = array();
    $calUser = $nid;
    $overwrite = true;
    $type = 'remoteics';
    // We will check ics first.
    $data = parse_ical($nurl, $type);
    // TODO it may be a vcs file.
    // if ( count ( $data ) == 0 ) {
    // $data = parse_vcal ( $nurl );
    // }
    // We may be processing an hCalendar.
    // $data sometimes has a count of 1 but is not a valid array.
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:edit_remotes_handler.php

示例11: assert_handler

function assert_handler($script, $line, $msg = '')
{
    if (empty($msg)) {
        $msg = 'Assertion failed<br />' . "\n";
    }
    $trace = function_exists('debug_backtrace') ? assert_backtrace() : basename($script) . ': ' . $line . ' ' . $msg;
    $msg .= (function_exists('debug_backtrace') ? '<b>Stack Trace:</b><br /><br />' : '') . '<blockquote><tt>' . nl2br($trace) . '</tt></blockquote>';
    if (function_exists('die_miserable_death')) {
        die_miserable_death($msg);
    } else {
        echo '<html><head><title>WebCalendar Error</title></head>
  <body><h2>WebCalendar Error</h2><p>' . $msg . '</p></body></html>
';
        exit;
    }
}
开发者ID:rhertzog,项目名称:lcs,代码行数:16,代码来源:assert.php

示例12: VALUES

            if (!dbi_execute('INSERT INTO webcal_blob ( cal_blob_id, cal_id,
      cal_login, cal_name, cal_description, cal_size, cal_mime_type, cal_type,
      cal_mod_date, cal_mod_time, cal_blob )
      VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )', array($nextid, $id, $login, $filename, $description, $filesize, $mimetype, 'A', date('Ymd'), date('His'), NULL))) {
                $error = db_error();
            } else {
                if (!dbi_update_blob('webcal_blob', 'cal_blob', "cal_blob_id = {$nextid}", $data)) {
                    $error = db_error();
                } else {
                    // success!  redirect to view event page
                    activity_log($id, $login, $login, LOG_ATTACHMENT, $filename);
                    do_redirect("view_entry.php?id={$id}");
                }
            }
        } else {
            die_miserable_death('Unsupported type');
            // programmer error
        }
    }
    if (!empty($error)) {
        print_header();
        echo print_error($error);
        echo print_trailer();
        exit;
    }
}
print_header();
?>
<h2><?php 
echo $title;
?>
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:docadd.php

示例13: dbi_clear_cache

function dbi_clear_cache()
{
    global $db_connection_info;
    if (empty($db_connection_info['cachedir'])) {
        return 0;
    }
    $cnt = 0;
    $fd = @opendir($db_connection_info['cachedir']);
    if (empty($fd)) {
        dbi_fatal_error(translate('Error opening cache dir') . ': ' . $db_connection_info['cachedir']);
    }
    $b = 0;
    $errcnt = 0;
    $errstr = '';
    while (false !== ($file = readdir($fd))) {
        if (preg_match('/^\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S+.dat$/', $file)) {
            // echo 'Deleting ' . $file . '<br />';
            $cnt++;
            $fullpath = $db_connection_info['cachedir'] . '/' . $file;
            $b += filesize($fullpath);
            if (!@unlink($fullpath)) {
                $errcnt++;
                $errstr .= '<!-- ' . translate('Error') . ': ' . str_replace('XXX', translate('delete'), translate('Could not XXX file')) . " {$file}. -->\n";
                // TODO: log this somewhere???
            }
        }
    }
    if ($errcnt > 10) {
        // They don't have correct permissions set.
        die_miserable_death("Error removing temporary file.<br/><br/>The permissions for the following directory do not support the db_cachedir option in includes/settings.php:<br/><blockquote>" . $db_connection_info['cachedir'] . "</blockquote>", 'dbCacheError');
    }
    return $cnt;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:33,代码来源:dbi4php.php

示例14: transmit_header

    //end if ( $repType )
}
function transmit_header($mime, $file)
{
    // header ( 'Content-Type: application/octet-stream' );
    header('Content-Type: ' . $mime);
    header('Content-Disposition: attachment; filename="' . $file . '"');
    header('Pragma: private');
    header('Cache-control: private, must-revalidate');
}
/* ********************************** */
/*              Let's go              */
/* ********************************** */
$format = getValue('format');
if ($format != 'ical' && $format != 'vcal' && $format != 'pilot-csv' && $format != 'pilot-text') {
    die_miserable_death('Invalid format "' . htmlspecialchars($format) . '"');
}
$id = getValue('id', '-?[0-9]+', true);
$use_all_dates = getPostValue('use_all_dates');
if (strtolower($use_all_dates) != 'y') {
    $use_all_dates = '';
}
$include_layers = getPostValue('include_layers');
if (strtolower($include_layers) != 'y') {
    $include_layers = '';
}
$include_deleted = getPostValue('include_deleted');
if (strtolower($include_deleted) != 'y') {
    $include_deleted = '';
}
$cat_filter = getPostValue('cat_filter');
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:export_handler.php

示例15: require_valide_referring_url

/**
 * Require a valid HTT_REFERER value in the HTTP header.  This will
 * prevent XSRF (cross-site request forgery).
 *
 * For example, suppose a * a "bad guy" sends an email with a link that
 * would delete an event in webcalendar to the admin.  If the admin user
 * clicks on that link we don't want to actually delete the event.
 */
function require_valide_referring_url()
{
    global $SERVER_URL;
    if (empty($_SERVER['HTTP_REFERER'])) {
        // Missing the REFERER value
        //die_miserable_death ( translate ( 'Invalid referring URL' ) );
        // Unfortunately, some version of MSIE do not send this info.
        return true;
    }
    if (!preg_match("@{$SERVER_URL}@i", $_SERVER['HTTP_REFERER'])) {
        // Gotcha.  URL of referring page is not the same as our server.
        // This can be an instance of XSRF.
        // (This may also happen when more than address is used for your server.
        // However, you're not supposed to do that with this version of
        // WebCalendar anyhow...)
        die_miserable_death(translate('Invalid referring URL'));
    }
}
开发者ID:GetInTheGo,项目名称:JohnsonFinancialService,代码行数:26,代码来源:functions.php


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