本文整理汇总了PHP中raiseError函数的典型用法代码示例。如果您正苦于以下问题:PHP raiseError函数的具体用法?PHP raiseError怎么用?PHP raiseError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了raiseError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorNative
function errorNative()
{
$err = parent::errorNative();
error_log("PGSQL error: {$err}", 0);
error_log("in query: " . substr($this->last_query, 0, 254), 0);
global $debug;
if ($debug) {
raiseError("SQL error: {$err} in \n " . $this->last_query);
} else {
raiseError("SQL error!");
}
/*
echo "<p><b>SQL error: $err</b> in <br>";
echo $this->last_query . "</p>";
exit;
*/
/*
global $sqlDebug;
if($sqlDebug) {
echo "<p><b>SQL error: $err</b> in <br>";
echo $this->last_query . "</p>";
}
*/
//return $err;
}
示例2: userDbSelect
function userDbSelect($fields)
{
if ($fields['username']) {
$query = sprintf("SELECT * FROM sotf_users WHERE username='%s'", $fields['username']);
$raw = $this->userdb->getRow($query);
if (count($raw) > 0) {
$data['username'] = $raw['username'];
$data['userid'] = $raw['id'];
}
return $data;
}
if ($fields['userid']) {
$query = sprintf("SELECT * FROM sotf_users WHERE id='%s'", $fields['userid']);
$raw = $this->userdb->getRow($query);
if (count($raw) > 0) {
$data['username'] = $raw['username'];
$data['userid'] = $raw['id'];
//$data['realname'] = $raw['realname'];
$data['language'] = $raw['language'];
$data['email'] = $raw['email'];
}
return $data;
}
raiseError("bad usage: userDbSelect");
}
示例3: cacheIcon
/** static, this places the icon into the www/tmp, so that you can refer to
it with <img src=, returns true if there is an icon for this object */
function cacheIcon($id)
{
global $cachedir;
$cacheTimeout = 2 * 60;
// 2 minutes
if (!$id) {
raiseError("missing id");
}
$fname = "{$cachedir}/" . $id . '.png';
if (is_readable($fname)) {
$stat = stat($fname);
if (time() - $stat['mtime'] <= $cacheTimeout) {
return true;
}
}
$icon = sotf_Blob::findBlob($id, 'icon');
if (!$icon) {
return false;
}
// TODO: cache cleanup!
////debug("cache: ". filesize($fname) ."==" . strlen($icon));
if (is_readable($fname) && filesize($fname) == strlen($icon)) {
return true;
}
debug("cached icon for", $id);
sotf_Utils::save($fname, $icon);
return true;
}
示例4: raiseError
/**
* Returns the indexth item in the collection.
*
* @param integer
* @return object Node
* @access public
*/
function &item($index)
{
if (!array_key_exists($index, $this->_list)) {
raiseError('myDOM error: index is negative, or greater than the allowed value');
}
return $this->_list[$index];
}
示例5: getTableCode
function getTableCode($tablename)
{
$tc = $this->tableCodes[$tablename];
if (!$tc) {
raiseError("no table code for table {$tablename}");
}
return $tc;
}
示例6: errorNative
function errorNative()
{
$err = parent::errorNative();
//error_log("PGSQL error: $err",0);
//error_log("in query: " . substr($this->last_query,0,254) ,0);
if (!$this->silent) {
raiseError("SQL error!", "{$err} in \n " . $this->last_query);
}
return $err;
}
示例7: listProgrammes
function listProgrammes($start, $hitsPerPage)
{
$sql = "SELECT p.*, r.role_id FROM sotf_contacts c, sotf_object_roles r, sotf_programmes p WHERE c.id = '{$this->id}' AND c.id=r.contact_id AND r.object_id = p.id";
$res = $this->db->limitQuery($sql, $start, $hitsPerPage);
if (DB::isError($res)) {
raiseError($res);
}
while (DB_OK === $res->fetchInto($item)) {
$list[] = $item;
}
return $list;
}
示例8: listAll
/** returns a list of all such objects: can be slow!!
* @method static listAll
*/
function listAll()
{
global $db;
$sql = "SELECT * FROM sotf_nodes ORDER BY name";
$res = $db->getAll($sql);
if (DB::isError($res)) {
raiseError($res);
}
$slist = array();
foreach ($res as $st) {
$slist[] = new sotf_Node($st['id'], $st);
}
return $slist;
}
示例9: get
function get($variable_name)
{
if (isset($this->vars[$variable_name])) {
return $this->vars[$variable_name];
}
$query = "SELECT value FROM sotf_vars WHERE name='{$variable_name}'";
$result = $this->db->getOne($query);
if (DB::isError($result)) {
raiseError($result->getMessage());
}
debug("getvar", "{$variable_name}={$result}");
$this->vars[$variable_name] = $result;
return $result;
}
示例10: set
/** Sets the value of a persistent variable. */
function set($name, $val)
{
$name = sotf_Utils::magicQuotes($name);
$val = sotf_Utils::magicQuotes($val);
if (isset($this->vars[$name])) {
$update = 1;
}
$this->vars[$name] = $val;
if ($update) {
$result = $this->db->query("UPDATE {$this->table} SET value='{$val}' WHERE name='{$name}'");
} else {
$result = $this->db->query("INSERT INTO {$this->table} (name,value) VALUES('{$name}', '{$val}')");
}
if (DB::isError($result)) {
raiseError($result);
}
debug("setvar", "{$name}={$val}");
}
示例11: getFileInDir
function getFileInDir($dir, $filename)
{
if (empty($filename)) {
raiseError("Filename is empty");
}
if (!($path = realpath($dir . '/' . $filename))) {
debug("no such file", $dir . '/' . $filename);
raiseError("no_such_file");
}
/* TODO: this does not work under WIndows, because of / and \ differences
if(!strstr($path, $dir)) {
debug("path", $path);
debug("dir", $dir);
raiseError("Attempt to break out directory");
}
*/
return $path;
}
示例12: load
/** static */
function load($id)
{
global $db;
if (empty($id)) {
raiseError("empty id for user prefs");
}
$data = $db->getOne("SELECT prefs FROM sotf_user_prefs WHERE id = '{$id}'");
if (empty($data)) {
$prefs = new sotf_UserPrefs();
$prefs->id = $id;
} else {
$prefs = unserialize($data);
if ($prefs === FALSE) {
raiseError("Could not unserialize user preferences");
}
}
return $prefs;
}
示例13: getFileInDir
function getFileInDir($dir, $filename)
{
if (empty($filename)) {
raiseError("Filename is empty");
}
if (!($path = realpath($dir . '/' . $filename))) {
debug("no such file", $dir . '/' . $filename);
raiseError("no_such_file");
}
/* TODO: this does not work under WIndows, because of / and \ differences */
$dirP = str_replace('\\', '/', $dir);
$pathP = str_replace('\\', '/', $pathP);
debug("DIRP", $dirP);
if (!preg_match("|^{$dirP}|", $path)) {
debug("path", $path);
debug("dir", $dir);
raiseError("Attempt to break out directory", $path);
}
return $path;
}
示例14: listProgrammes
/** list programmes */
function listProgrammes($start, $hitsPerPage, $onlyPublished = true)
{
$id = $this->id;
$sql = "SELECT * FROM sotf_programmes WHERE series_id = '{$id}' ";
if ($onlyPublished) {
$sql .= " AND published='t' ";
}
$sql .= " ORDER BY entry_date DESC,track ASC";
if (!$start) {
$start = 0;
}
$res = $this->db->limitQuery($sql, $start, $hitsPerPage);
if (DB::isError($res)) {
raiseError($res);
}
while (DB_OK === $res->fetchInto($item)) {
$list[] = new sotf_Programme($item['id'], $item);
}
return $list;
}
示例15: raiseError
* Authors: András Micsik, Máté Pataki, Tamás Déri
* at MTA SZTAKI DSD, http://dsd.sztaki.hu
*/
require "init.inc.php";
//$smarty->assign("OKURL", $_SERVER['PHP_SELF'] . "?id=" . rawurlencode($id));
$id = sotf_Utils::getParameter('id');
if ($id) {
$db->begin();
$smarty->assign('ID', $id);
$prg =& $repository->getObject($id);
if (!$prg) {
raiseError("no_such_object", $id);
}
if (!$prg->getBool('published')) {
if (!hasPerm($prg->id, 'change')) {
raiseError("not_published_yet", $id);
exit;
}
$smarty->assign("UNPUBLISHED", 1);
}
$page->setTitle($prg->get('title'));
// general data
$prgData = $prg->getAll();
$prgData['icon'] = sotf_Blob::cacheIcon($id);
$smarty->assign('PRG_DATA', $prgData);
// station data
$station = $prg->getStation();
$smarty->assign('STATION_DATA', $station->getAllWithIcon());
// series data
$series = $prg->getSeries();
if ($series) {