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


PHP handleError函数代码示例

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


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

示例1: ea_email_sent_shortcode

function ea_email_sent_shortcode()
{
    ob_start();
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Reading from superglobals
    $tCallerSkypeNameSg = esc_sql($_POST["skype_name"]);
    // ..verifying that the skype name exists
    if (verifyUserNameExists($tCallerSkypeNameSg) === false) {
        echo "<h3><i><b>Incorrect Skype name</b> - email not sent. Please go back and try again.</i></h3>";
        exit;
    }
    $tLengthNr = $_POST["length"];
    if (is_numeric($tLengthNr) === false) {
        handleError("Length variable was not numeric - possible SQL injection attempt");
    }
    // Setting up variables based on the superglobals
    $tCallerIdNr = getIdByUserName($tCallerSkypeNameSg);
    $tUniqueDbIdentifierSg = uniqid("id-", true);
    // http://php.net/manual/en/function.uniqid.php
    $tCallerDisplayNameSg = getDisplayNameById($tCallerIdNr);
    $tCallerEmailSg = getEmailById($tCallerIdNr);
    $tEmpathizerDisplayNameSg = getDisplayNameById(get_current_user_id());
    // If this is the first call: reduce the donation amount.
    $tAdjustedLengthNr = $tLengthNr;
    if (isFirstCall($tCallerIdNr) == true) {
        $tAdjustedLengthNr = $tAdjustedLengthNr - Constants::initial_call_minute_reduction;
    }
    $tRecDonationNr = (int) round(get_donation_multiplier() * $tAdjustedLengthNr);
    // Create the contents of the email message.
    $tMessageSg = "Hi " . $tCallerDisplayNameSg . ",\n\nThank you so much for your recent empathy call! Congratulations on contributing to a more empathic world. :)\n\nYou talked with: {$tEmpathizerDisplayNameSg}\nYour Skype session duration was: {$tLengthNr} minutes\nYour recommended contribution is: \${$tRecDonationNr}\n\nPlease follow this link to complete payment within 24 hours: " . getBaseUrl() . pages::donation_form . "?recamount={$tRecDonationNr}&dbToken={$tUniqueDbIdentifierSg}\n\nSee you next time!\n\nThe Empathy Team\n\nPS\nIf you have any feedback please feel free to reply to this email and tell us your ideas or just your experience!\n";
    // If the donation is greater than 0: send an email to the caller.
    if ($tRecDonationNr > 0) {
        ea_send_email($tCallerEmailSg, "Empathy App Payment", $tMessageSg);
        echo "<h3>Email successfully sent to caller.</h3>";
    } else {
        echo "<h4>No email sent: first time caller and call length was five minutes or less.</h4>";
    }
    // Add a new row to the db CallRecords table.
    db_insert(array(DatabaseAttributes::date_and_time => current_time('mysql', 1), DatabaseAttributes::recommended_donation => $tRecDonationNr, DatabaseAttributes::call_length => $tLengthNr, DatabaseAttributes::database_token => $tUniqueDbIdentifierSg, DatabaseAttributes::caller_id => $tCallerIdNr, DatabaseAttributes::empathizer_id => get_current_user_id()));
    $ob_content = ob_get_contents();
    //+++++++++++++++++++++++++++++++++++++++++
    ob_end_clean();
    return $ob_content;
}
开发者ID:Wizek,项目名称:EmpathyApp,代码行数:44,代码来源:email-sent_sc.php

示例2: rs2xls

/**
 * Exportiert eine MySQL Tabelle ins Excel format und sendet die Datei zum Browser
 * @param string $location Speicherort auf dem Server
 * @param string $filename Dateiname mit dem die Datei zum Download angeboten wird
 * @param mysql_result $mysql_result Resultobject von mysql_query
 */
function rs2xls($location, $filename, $mysql_result)
{
    $filename = str_replace(' ', '_', $filename);
    $filename = str_replace('ä', 'ae', $filename);
    $filename = str_replace('ö', 'oe', $filename);
    $filename = str_replace('ü', 'ue', $filename);
    $filename = str_replace('Ä', 'Ae', $filename);
    $filename = str_replace('Ö', 'Oe', $filename);
    $filename = str_replace('Ü', 'Ue', $filename);
    $xls =& new Spreadsheet_Excel_Writer($location);
    // Send HTTP headers to tell the browser what's coming
    // handleError( $xls->send( $filename));
    // Arbeitsblatt hinzufügen
    handleError($sheet =& $xls->addWorksheet('Tabelle1'));
    $printHeaders = true;
    $line = 0;
    while (($row = mysql_fetch_row($mysql_result)) !== false) {
        if ($printHeaders) {
            for ($i = 0; $i < count($row); $i++) {
                $column = ucwords(mysql_field_name($mysql_result, $i));
                handleError($sheet->write($line, $i, $column));
            }
            $line++;
            $printHeaders = false;
        }
        for ($i = 0; $i < count($row); $i++) {
            handleError($sheet->write($line, $i, $row[$i]));
        }
        $line++;
    }
    handleError($xls->close());
    return $filename;
}
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:39,代码来源:function_xls.inc.php

示例3: hasObjectRights

 function hasObjectRights(&$hasRight, $method, $giveError = FALSE)
 {
     hasAdminRights($isAdm);
     $hasRight->objectRight = $isAdm;
     if (!$hasRight && $giveError) {
         handleError($lll["permission_denied"]);
     }
 }
开发者ID:alencarmo,项目名称:OCF,代码行数:8,代码来源:controlpanel.php

示例4: hasObjectRights

 function hasObjectRights(&$hasRight, $method, $giveError = FALSE)
 {
     global $lll;
     hasAdminRights($isAdm);
     $hasRight->objectRight = ($method == "modify" || $method == "load") && $isAdm;
     if (!$hasRight->objectRight && $giveError) {
         handleError($lll["permission_denied"]);
     }
 }
开发者ID:alencarmo,项目名称:OCF,代码行数:9,代码来源:settings.php

示例5: execute

 /**
  * execute
  *
  * @return void
  */
 public function execute()
 {
     if ($this->validate()) {
         try {
             $this->{$this->_params['action']}();
         } catch (Exception $e) {
             handleError($e->getMessage(), $e->getCode());
         }
     }
 }
开发者ID:Helioviewer-Project,项目名称:api,代码行数:15,代码来源:SolarEvents.php

示例6: hasObjectRights

 function hasObjectRights(&$hasRight, $method, $giveError = FALSE)
 {
     global $lll;
     hasAdminRights($isAdm);
     $hasRight->objectRight = $isAdm && $method == "modify" || $method == "load";
     $hasRight->generalRight = TRUE;
     if (!$hasRight->objectRight && $giveError) {
         handleError($lll["permission_denied"]);
     }
     return ok;
 }
开发者ID:alencarmo,项目名称:OCF,代码行数:11,代码来源:notification.php

示例7: hasObjectRights

 function hasObjectRights(&$hasRight, $method, $giveError = FALSE)
 {
     global $lll;
     parent::hasObjectRights($hasRight, $method, $giveError);
     if ($method == "modify") {
         $hasRight->generalRight = FALSE;
     }
     if ($hasRight->objectRight == TRUE && $method == "modify" && $this->disableModify()) {
         $hasRight->objectRight = FALSE;
     }
     if (!$hasRight->objectRight && $giveError) {
         handleError($lll["permission_denied"]);
     }
 }
开发者ID:alencarmo,项目名称:OCF,代码行数:14,代码来源:userfield.php

示例8: hasObjectRights

 function hasObjectRights(&$hasRight, $method, $giveError = FALSE)
 {
     global $lll;
     hasAdminRights($isAdm);
     $hasRight->generalRight = TRUE;
     if ($method == "delete") {
         $hasRight->generalRight = FALSE;
         $hasRight->objectRight = $isAdm && $this->isFixField() === FALSE;
     } else {
         $hasRight->objectRight = $method == "load" || $isAdm;
     }
     if (!$hasRight->objectRight && $giveError) {
         handleError($lll["permission_denied"]);
     }
 }
开发者ID:alencarmo,项目名称:OCF,代码行数:15,代码来源:customfield.php

示例9: serveFileFromZIP

function serveFileFromZIP($baseDir, $zipName, $fileName)
{
    $zip = new ZipArchive();
    if ($zip->open($baseDir . $zipName) !== TRUE) {
        handleError("Could not open ZIP file '{$zipName}'");
    }
    $contents = $zip->getStream($fileName);
    if ($contents === FALSE) {
        $zip->close();
        handleError("Could not find file '{$fileName}' in ZIP file '{$zipName}'");
    }
    $fileSize = $zip->statName($fileName)['size'];
    header('Content-Length: ' . $fileSize);
    header('Content-Type: text/plain');
    fpassthru($contents);
    fclose($contents);
    $zip->close();
    exit;
}
开发者ID:ultimate-pa,项目名称:benchexec,代码行数:19,代码来源:serveFileFromZIP.php

示例10: prepare_items

 function prepare_items()
 {
     //
     global $wpdb;
     $tTableNameSg = getCallRecordTableName();
     $tQuerySg = "SELECT * FROM {$tTableNameSg}";
     // Setup of ordering.
     // (At present we don't use the GET params for this, but maybe in the future)
     $tOrderBySg = !empty($_GET["orderby"]) ? esc_sql($_GET["orderby"]) : 'DESC';
     $tOrderSg = !empty($_GET["order"]) ? esc_sql($_GET["order"]) : DatabaseAttributes::id;
     if (!empty($tOrderBySg) && !empty($tOrderSg)) {
         $tQuerySg .= ' ORDER BY ' . $tOrderSg . ' ' . $tOrderBySg;
     }
     $tTotalNrOfItemsNr = $wpdb->query($tQuerySg);
     $tNumberOfItemsPerPageNr = Constants::record_rows_display_max;
     $tPagedSg = '';
     if (isset($_GET["paged"])) {
         $tPagedSg = $_GET["paged"];
     }
     if (empty($tPagedSg) === false) {
         if (is_numeric($tPagedSg) === false) {
             handleError("Page number contained non-numeric characters, possible SQL injection attempt");
         }
     }
     // Limiting the range of results returned.
     // (We don't want to display all the rows one a single page)
     // Documenation for MySQL "LIMIT":
     // http://www.w3schools.com/php/php_mysql_select_limit.asp
     if (empty($tPagedSg) || !is_numeric($tPagedSg) || $tPagedSg <= 0) {
         $tPagedSg = 1;
     }
     $tTotalNrOfPagesNr = ceil($tTotalNrOfItemsNr / $tNumberOfItemsPerPageNr);
     if (!empty($tPagedSg) && !empty($tNumberOfItemsPerPageNr)) {
         $tNumberOfItemsOffsetNr = ($tPagedSg - 1) * $tNumberOfItemsPerPageNr;
         $tQuerySg .= ' LIMIT ' . (int) $tNumberOfItemsPerPageNr . ' OFFSET ' . (int) $tNumberOfItemsOffsetNr;
     }
     $this->set_pagination_args(array("total_items" => $tTotalNrOfItemsNr, "total_pages" => $tTotalNrOfPagesNr, "per_page" => $tNumberOfItemsPerPageNr));
     // Updating the data available for this class; this data will later be
     // rendered for the user
     $tColumnsAr = $this->get_columns();
     $this->_column_headers = array($tColumnsAr, array(), array());
     $this->items = $wpdb->get_results($tQuerySg);
 }
开发者ID:Wizek,项目名称:EmpathyApp,代码行数:43,代码来源:Call_Records_Table.php

示例11: getRankedStats

function getRankedStats()
{
    global $apiKey, $playerID, $playerServer;
    $url = 'https://' . $playerServer . '.api.pvp.net/api/lol/' . $playerServer . '/v1.3/stats/by-summoner/' . $playerID . '/ranked?season=SEASON2015&api_key=' . $apiKey;
    $response = file_get_contents($url);
    if (requestFailed($response, $url)) {
        $error = error_get_last();
        $error = $error['message'];
        $errorCode = substr($error, strpos($error, "/1.1") + 5, 3);
        handleError($errorCode, $url, "champions on ranked");
        return;
    }
    $rankedStats = json_decode($response);
    $championsPlayed = $rankedStats->champions;
    $url = 'https://global.api.pvp.net/api/lol/static-data/' . $playerServer . '/v1.2/champion?champData=image&api_key=' . $apiKey;
    $response = file_get_contents($url);
    if (requestFailed($response, $url)) {
        $error = error_get_last();
        $error = $error['message'];
        $errorCode = substr($error, strpos($error, "/1.1") + 5, 3);
        handleError($errorCode, $url, "champions");
        return;
    }
    $champions = json_decode($response)->data;
    $playerChampions = array();
    foreach ($champions as $key => $champion) {
        foreach ($championsPlayed as $key => $championPlayed) {
            if ($championPlayed->id == $champion->id) {
                $champ = new Champion();
                $champ->name = $champion->name;
                $champ->id = $champion->id;
                $champ->title = $champion->title;
                $champ->image = $champion->image->full;
                $champ->stats = $championPlayed->stats;
                array_push($playerChampions, $champ);
                break;
            }
        }
    }
    usort($playerChampions, "sortChamps");
    echo json_encode($playerChampions);
}
开发者ID:ja-bravo,项目名称:League-of-Legends-stats-viewer,代码行数:42,代码来源:setChampions.php

示例12: genericGet

 /**
  * @return put return description here..
  * @param param :  parameter passed to function
  * @desc genericGet($key,$compareField,$returnField,$table) :  put function description here ...
  */
 function genericGet($key, $compareField, $returnField, $table)
 {
     global $db;
     // Query to get $returnfield data based on $key
     $query = "select {$returnField} from {$table} where {$compareField}='{$key}'";
     $thisDatabaseQuery = new databaseQuery();
     $thisDatabaseQuery->setSqlQuery($query);
     $thisDatabaseQuery->executeQuery();
     $result = $thisDatabaseQuery->getResultSet();
     if ($result == false) {
         handleError("A Database Error Occured ", $db->ErrorMsg(), $_SERVER['PHP_SELF'], 'y', 'y');
     } else {
         if ($result->RowCount() == 0) {
             return "";
         } else {
             if ($result->RowCount() > 0) {
                 return $result->fields[$returnField];
             }
         }
     }
 }
开发者ID:juddy,项目名称:GIP,代码行数:26,代码来源:databaseUtils.class.php

示例13: setSummoner

function setSummoner($summonerName, $server)
{
    global $apiKey, $playerID, $name, $iconID, $level, $playerServer, $rankedLeague, $rankedTier;
    $playerServer = $server;
    $summonerName = str_replace(' ', '', $summonerName);
    // So if the user has spaces in it, it works.
    $url = 'https://' . $server . '.api.pvp.net/api/lol/' . $server . '/v1.4/summoner/by-name/' . $summonerName . '?api_key=' . $apiKey;
    $response = @file_get_contents($url);
    if (requestFailed($response, $url)) {
        $error = error_get_last();
        $error = $error['message'];
        $errorCode = substr($error, strpos($error, "/1.1") + 5, 3);
        handleError($errorCode, $url, "name and playerID");
        return;
    }
    $stats = json_decode($response)->{$summonerName};
    $playerID = $stats->id;
    $name = $stats->name;
    $iconID = $stats->profileIconId;
    $level = $stats->summonerLevel;
    $url = 'https://' . $playerServer . '.api.pvp.net/api/lol/' . $playerServer . '/v2.5/league/by-summoner/' . $playerID . '?api_key=' . $apiKey;
    $response = @file_get_contents($url);
    if (requestFailed($response, $url)) {
        $error = error_get_last();
        $error = $error['message'];
        $errorCode = substr($error, strpos($error, "/1.1") + 5, 3);
        if ($errorCode == "404" || $errorCode == "503") {
            handleError(405, $url, "league and tier");
        } else {
            handleError($errorCode, $url, "league and tier");
        }
        return;
    }
    $league = json_decode($response)->{$playerID};
    $rankedLeague = $league[0]->name;
    $rankedTier = $league[0]->tier;
}
开发者ID:ja-bravo,项目名称:League-of-Legends-stats-viewer,代码行数:37,代码来源:functions.php

示例14: dbError

/**
 * @param mysqli $db
 * @param string $error
 * @param int $code
 * @param string $status
 */
function dbError($db, $error = "Database error", $code = 500, $status = "Server error")
{
    $dberror = $db->error;
    $db->rollback();
    $db->close();
    handleError($error . ': ' . $dberror);
}
开发者ID:pdvrieze,项目名称:ProcessManager,代码行数:13,代码来源:common.php

示例15: handleError

}
/* do checks */
require_once $_SESSION['settings']['cpassman_dir'] . '/sources/checks.php';
if (!checkUser($_SESSION['user_id'], $_SESSION['key'], "items")) {
    $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
    //not allowed page
    handleError('Not allowed to ...', 110);
    exit;
}
//check for session
if (isset($_POST['PHPSESSID'])) {
    session_id($_POST['PHPSESSID']);
} elseif (isset($_GET['PHPSESSID'])) {
    session_id($_GET['PHPSESSID']);
} else {
    handleError('No Session was found.');
}
// HTTP headers for no cache etc
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if (isset($_POST["type_upload"]) && $_POST["type_upload"] == "upload_profile_photo") {
    $targetDir = $_SESSION['settings']['cpassman_dir'] . '/includes/avatars';
} else {
    $targetDir = $_SESSION['settings']['path_to_files_folder'];
}
$cleanupTargetDir = true;
// Remove old files
$maxFileAge = 5 * 3600;
开发者ID:chansolo,项目名称:TeamPass,代码行数:31,代码来源:upload.files.php


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