本文整理汇总了PHP中do_error函数的典型用法代码示例。如果您正苦于以下问题:PHP do_error函数的具体用法?PHP do_error怎么用?PHP do_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: audit
function audit($basic, $extra, $support, $field)
{
$our_array = array();
$query = "SELECT * FROM `{$support}`";
$result = mysql_query($query) or do_error($query, mysql_error(), basename(__FILE__), __LINE__);
//
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$our_array[$row['id']] = TRUE;
}
$query = "SELECT * FROM `{$basic}` ";
// 8/11/08
$result = mysql_query($query) or do_error($query, mysql_error(), basename(__FILE__), __LINE__);
// in_types_id
$header = FALSE;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
if (!array_key_exists($row[$field], $our_array)) {
if (!$header) {
print "<br /><h3>{$extra} {$GLOBALS['mysql_prefix']}{$basic}</h3>";
$header = TRUE;
}
print "Table '{$support}' missing index {$row[$field]}. Called for in '{$basic}' record id: {$row['id']} <br />\n ";
}
// end while()
}
print $header ? "" : "<BR /><h3>Table {$basic}{$extra} OK for '{$field}' </h3><BR />";
}
示例2: authorize
function authorize()
{
global $globals, $db;
if (empty($_GET['code'])) {
do_error(_('acceso denegado'), false, false);
}
try {
$this->client->setAccessToken($this->client->authenticate());
if (!($access_token = $this->client->getAccessToken())) {
do_error(_('acceso denegado'), false, false);
}
$response = $this->gplus->people->get('me');
$this->uid = $response['id'];
$this->username = User::get_valid_username($response['displayName']);
} catch (Exception $e) {
do_error(_('error de conexión a') . " {$this->service} (authorize2)", false, false);
}
$db->transaction();
if (!$this->user_exists()) {
$this->url = $response['url'];
$this->names = $response['displayName'];
$this->avatar = $response['image']['url'];
$this->store_user();
}
$this->store_auth();
$db->commit();
$this->user_login();
}
示例3: user_exists
function user_exists()
{
global $db, $current_user;
if ($this->uid) {
$sql = "select user_id, token, secret from auths where service='{$this->service}' and uid = {$this->uid}";
} else {
$sql = "select user_id, token, secret from auths where service='{$this->service}' and name = '{$this->username}'";
}
$res = $db->get_row($sql);
if ($res) {
$this->id = $res->user_id;
$this->token = $res->token;
$this->secret = $res->secret;
$this->user = new User($this->id);
if ($current_user->user_id && $current_user->user_id != $this->id) {
if (!$this->user->disabled()) {
do_error(_('cuenta asociada a otro usuario') . ': ' . $this->user->username, false, false);
}
// We read again, the previous user is another one, already disabled
$this->user = new User($current_user->user_id);
$this->id = $this->id = $current_user->user_id;
} elseif (!$this->user->id || $this->user->disabled()) {
do_error(_('usuario deshabilitado'), false, false);
}
} else {
if ($current_user->user_id) {
$this->user = new User($current_user->user_id);
$this->id = $current_user->user_id;
} else {
$this->user = new User();
}
}
return $this->id;
}
示例4: get_stat_type_type
function get_stat_type_type($value)
{
$stat_type = "Not Used";
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}stats_type` WHERE `st_id` = {$value}";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
if (mysql_num_rows($result) != 0) {
$row = stripslashes_deep(mysql_fetch_assoc($result));
$stat_type = $row['stat_type'];
}
return $stat_type;
}
示例5: get_variable
function get_variable($which)
{
/* get variable from db settings table, returns FALSE if absent */
global $variables;
if (empty($variables)) {
$result = mysql_query("SELECT * FROM `{$GLOBALS['mysql_prefix']}settings`") or do_error("get_variable(n:{$name})::mysql_query()", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
if (!(mysql_affected_rows($result) == 1)) {
return FALSE;
}
$row = stripslashes_deep(mysql_fetch_assoc($result));
return $row['value'];
}
}
示例6: module_tabs_exist
function module_tabs_exist($name)
{
$query = "SELECT COUNT(*) FROM `{$GLOBALS['mysql_prefix']}modules`";
$result = mysql_query($query);
$num_rows = @mysql_num_rows($result);
if ($num_rows) {
$query_exists = "SELECT * FROM `{$GLOBALS['mysql_prefix']}modules` WHERE `mod_name`=\"{$name}\"";
$result_exists = mysql_query($query_exists) or do_error($query_exists, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
$num_rows = mysql_num_rows($result_exists);
if ($num_rows != 0) {
return 1;
} else {
return 0;
}
} else {
return 0;
}
}
示例7: authorize
function authorize()
{
global $globals, $db;
$oauth_token = clean_input_string($_GET['oauth_token']);
$request_token_secret = $_COOKIE['oauth_token_secret'];
if (!empty($oauth_token) && !empty($request_token_secret)) {
$this->oauth->setToken($oauth_token, $request_token_secret);
try {
$access_token_info = $this->oauth->getAccessToken($this->access_token_url);
} catch (Exception $e) {
do_error(_('error de conexión a') . " {$this->service}", false, false);
}
} else {
do_error(_('acceso denegado'), false, false);
}
$this->token = $access_token_info['oauth_token'];
$this->secret = $access_token_info['oauth_token_secret'];
$this->uid = $access_token_info['user_id'];
$this->username = User::get_valid_username($access_token_info['screen_name']);
if (!$this->user_exists()) {
$this->oauth->setToken($access_token_info['oauth_token'], $access_token_info['oauth_token_secret']);
try {
$data = $this->oauth->fetch($this->credentials_url);
} catch (Exception $e) {
do_error(_('error de conexión a') . " {$this->service}", false, false);
}
if ($data) {
$response_info = $this->oauth->getLastResponse();
$response = json_decode($response_info);
$this->url = $response->url;
$this->names = $response->name;
$this->avatar = $response->profile_image_url;
}
$db->transaction();
$this->store_user();
} else {
$db->transaction();
}
$this->store_auth();
$db->commit();
$this->user_login();
}
示例8: get_modules
function get_modules($calling_file)
{
global $handle;
$query = "SELECT COUNT(*) FROM `{$GLOBALS['mysql_prefix']}modules`";
$result = mysql_query($query);
$num_rows = @mysql_num_rows($result);
if ($num_rows) {
$query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}modules` WHERE `mod_status`=1 AND `affecting_files` LIKE '%{$calling_file}%'";
$result2 = mysql_query($query2) or do_error('mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$numb_rows = @mysql_num_rows($result2);
while ($row2 = stripslashes_deep(mysql_fetch_assoc($result2))) {
$name = $row2['mod_name'];
$status = $row2['mod_status'];
$inc_path = "./modules/" . $name . "/helper.php";
$display = "get_display_" . $name;
include $inc_path;
$display($calling_file);
}
}
}
示例9: do_gt
function do_gt($user)
{
$ret_array = array();
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}remote_devices` WHERE `user` = '{$user}'";
// read location data from incoming table
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
if ($result) {
while ($row = @mysql_fetch_assoc($result)) {
$id = $row['user'];
$ret_array[0] = $id;
$lat = $row['lat'];
$ret_array[1] = $lat;
$lng = $row['lng'];
$ret_array[2] = $lng;
$time = $row['time'];
$ret_array[3] = $time;
}
// end while
} else {
print "-error 1";
}
return $ret_array;
}
示例10: ringf
function ringf()
{
$coords = array();
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}responder`";
$result = mysql_query($query) or do_error($query, mysql_error(), basename(__FILE__), __LINE__);
$row = stripslashes_deep(mysql_fetch_assoc($result));
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
print $row['id'];
print " ";
print $row['ring_fence'];
print "<br />";
if ($row['ring_fence'] != NULL && $row['ring_fence'] > 0) {
$query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}lines` WHERE `id` = {$row['ring_fence']}";
$result2 = mysql_query($query2) or do_error($query2, mysql_error(), basename(__FILE__), __LINE__);
$row2 = stripslashes_deep(mysql_fetch_assoc($result2));
extract($row2);
$points = explode(";", $line_data);
for ($i = 0; $i < count($points); $i++) {
$coords[] = explode(",", $points[$i]);
}
}
}
dump($coords);
}
示例11: popup_ticket
function popup_ticket($id, $print = 'false', $search = FALSE)
{
/* 7/9/09 - show specified ticket */
global $istest, $iw_width;
if ($istest) {
print "GET<br />\n";
dump($_GET);
print "POST<br />\n";
dump($_POST);
}
if ($id == '' or $id <= 0 or !check_for_rows("SELECT * FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE id='{$id}'")) {
/* sanity check */
print "Invalid Ticket ID: '{$id}'<BR />";
return;
}
$restrict_ticket = get_variable('restrict_user_tickets') == 1 && !is_administrator() ? " AND owner={$_SESSION['user_id']}" : "";
$query = "SELECT *,UNIX_TIMESTAMP(problemstart) AS problemstart,UNIX_TIMESTAMP(problemend) AS problemend,UNIX_TIMESTAMP(date) AS date,UNIX_TIMESTAMP(updated) AS updated, `{$GLOBALS['mysql_prefix']}ticket`.`description` AS `tick_descr` FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE ID='{$id}' {$restrict_ticket}";
// 8/12/09
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
if (!mysql_num_rows($result)) {
//no tickets? print "error" or "restricted user rights"
print "<FONT CLASS=\"warn\">No such ticket or user access to ticket is denied</FONT>";
exit;
}
$row = stripslashes_deep(mysql_fetch_assoc($result));
?>
<TABLE BORDER="0" ID = "outer" ALIGN="left">
<?php
print "<TD ALIGN='left'>";
print "<TABLE ID='theMap' BORDER=0><TR CLASS='odd' ><TD ALIGN='center'>\n\t\t<DIV ID='map' STYLE='WIDTH:" . get_variable('map_width') . "px; HEIGHT: " . get_variable('map_height') . "PX'></DIV>\n\t\t</TD></TR>";
// 11/29/08
print "<FORM NAME='sv_form' METHOD='post' ACTION=''><INPUT TYPE='hidden' NAME='frm_lat' VALUE=" . $row['lat'] . ">";
// 2/11/09
print "<INPUT TYPE='hidden' NAME='frm_lng' VALUE=" . $row['lng'] . "></FORM>";
print "<TR ID='pointl1' CLASS='print_TD' STYLE = 'display:none;'>\n\t\t<TD ALIGN='center'><B>Range:</B> <SPAN ID='range'></SPAN> <B>Brng</B>: \n\t\t\t<SPAN ID='brng'></SPAN></TD></TR>\n\n\t\t<TR ID='pointl2' CLASS='print_TD' STYLE = 'display:none;'>\n\t\t\t<TD ALIGN='center'><B>Lat:</B> <SPAN ID='newlat'></SPAN>\n\t\t\t <B>Lng:</B> <SPAN ID='newlng'></SPAN> <B>NGS:</B> <SPAN ID = 'newusng'></SPAN></TD></TR>\n";
print "</TABLE>\n";
print "</TD></TR>";
print "<TR CLASS='odd' ><TD COLSPAN='2' CLASS='print_TD'>";
$lat = $row['lat'];
$lng = $row['lng'];
print "</TABLE>\n";
?>
<SCRIPT SRC='../js/usng.js' TYPE='text/javascript'></SCRIPT>
<SCRIPT SRC="../js/graticule.js" type="text/javascript"></SCRIPT>
<SCRIPT>
function isNull(val) { // checks var stuff = null;
return val === null;
}
var the_grid;
var grid = false;
function doGrid() {
if (grid) {
map.removeOverlay(the_grid);
grid = false;
}
else {
the_grid = new LatLonGraticule();
map.addOverlay(the_grid);
grid = true;
}
}
String.prototype.trim = function () { // 9/14/08
return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
String.prototype.parseDeg = function() {
if (!isNaN(this)) return Number(this); // signed decimal degrees without NSEW
var degLL = this.replace(/^-/,'').replace(/[NSEW]/i,''); // strip off any sign or compass dir'n
var dms = degLL.split(/[^0-9.,]+/); // split out separate d/m/s
for (var i in dms) if (dms[i]=='') dms.splice(i,1); // remove empty elements (see note below)
switch (dms.length) { // convert to decimal degrees...
case 3: // interpret 3-part result as d/m/s
var deg = dms[0]/1 + dms[1]/60 + dms[2]/3600; break;
case 2: // interpret 2-part result as d/m
var deg = dms[0]/1 + dms[1]/60; break;
case 1: // decimal or non-separated dddmmss
if (/[NS]/i.test(this)) degLL = '0' + degLL; // - normalise N/S to 3-digit degrees
var deg = dms[0].slice(0,3)/1 + dms[0].slice(3,5)/60 + dms[0].slice(5)/3600; break;
default: return NaN;
}
if (/^-/.test(this) || /[WS]/i.test(this)) deg = -deg; // take '-', west and south as -ve
return deg;
}
Number.prototype.toRad = function() { // convert degrees to radians
return this * Math.PI / 180;
}
Number.prototype.toDeg = function() { // convert radians to degrees (signed)
return this * 180 / Math.PI;
}
Number.prototype.toBrng = function() { // convert radians to degrees (as bearing: 0...360)
return (this.toDeg()+360) % 360;
}
function brng(lat1, lon1, lat2, lon2) {
lat1 = lat1.toRad(); lat2 = lat2.toRad();
//.........这里部分代码省略.........
示例12: _
echo '<div id="newswrap">' . "\n";
echo '<div class="topheading"><h2>' . _('noticias más comentadas') . '</h2></div>';
$link = new Link();
// Use memcache if available
if ($globals['memcache_host'] && get_current_page() < 4) {
$memcache_key = 'topcommented_' . $from . '_' . get_current_page();
}
if (!($memcache_key && ($rows = memcache_mget($memcache_key . 'rows')) && ($links = memcache_mget($memcache_key)))) {
// It's not in memcache
if ($time_link) {
$rows = min(100, $db->get_var("SELECT count(*) FROM links WHERE {$time_link}"));
} else {
$rows = min(100, $db->get_var("SELECT count(*) FROM links"));
}
if ($rows == 0) {
do_error(_('no hay noticias seleccionadas'), 500);
}
$links = $db->get_results("{$sql} LIMIT {$offset},{$page_size}");
if ($memcache_key) {
memcache_madd($memcache_key . 'rows', $rows, 1800);
memcache_madd($memcache_key, $links, 1800);
}
}
if ($links) {
foreach ($links as $dblink) {
$link->id = $dblink->link_id;
$link->read();
$link->print_summary('short');
}
}
do_pages($rows, $page_size);
示例13: count_facilities
function count_facilities()
{
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}facilities`";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$facilities_no = mysql_affected_rows();
return $facilities_no;
}
示例14: intval
<?php
// The source code packaged with this file is Free Software, Copyright (C) 2011 by
// Ricardo Galli <gallir at gmail dot com>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
$globals['force_ssl'] = False;
// We open the bar always as http to allow loading no https pages
include mnminclude . 'html1.php';
$url_args = $globals['path'];
$id = intval($globals['path'][1]);
if (!$id > 0 || !($link = Link::from_db($id))) {
do_error(_('enlace no encontrado'), 404);
}
// Mark as read, add click if necessary
$link->add_click();
if ($globals['https'] && !preg_match('/^https:/', $link->url)) {
redirect($link->url);
die;
}
$link->title = text_to_summary($link->title, 80);
// From libs/html1.php do_header()
header('Content-Type: text/html; charset=utf-8');
$globals['security_key'] = get_security_key();
setcookie('k', $globals['security_key'], 0, $globals['base_url']);
// From libks/link.php print_summary()
$link->is_votable();
$link->permalink = $link->get_permalink();
示例15: get_buttons
function get_buttons($user_id)
{
// 5/3/11
if (isset($_SESSION['viewed_groups'])) {
$regs_viewed = explode(",", $_SESSION['viewed_groups']);
}
$query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type`= 4 AND `resource_id` = '{$user_id}' ORDER BY `group`";
// 5/3/11
$result2 = mysql_query($query2) or do_error($query2, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$al_buttons = "";
while ($row2 = stripslashes_deep(mysql_fetch_assoc($result2))) {
// 5/3/11
if (!empty($regs_viewed)) {
if (in_array($row2['group'], $regs_viewed)) {
$al_buttons .= "<DIV style='display: block;'><INPUT TYPE='checkbox' CHECKED name='frm_group[]' VALUE='{$row2['group']}'></INPUT>" . get_groupname($row2['group']) . " </DIV>";
} else {
$al_buttons .= "<DIV style='display: block;'><INPUT TYPE='checkbox' name='frm_group[]' VALUE='{$row2['group']}'></INPUT>" . get_groupname($row2['group']) . " </DIV>";
}
} else {
$al_buttons .= "<DIV style='display: block;'><INPUT TYPE='checkbox' CHECKED name='frm_group[]' VALUE='{$row2['group']}'></INPUT>" . get_groupname($row2['group']) . " </DIV>";
}
}
return $al_buttons;
}