本文整理汇总了PHP中_error函数的典型用法代码示例。如果您正苦于以下问题:PHP _error函数的具体用法?PHP _error怎么用?PHP _error使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: global_controller
private function global_controller($filepath){
if(file_exists($filepath)){
include $filepath; $incname=ROUTE_C;
if (class_exists($incname)) { return new $incname; }
else{ _error('The "'.$incname.'" class does not exist.','...'); exit(); }
}else{ _error('Module or Controller does not exist.','Please verify that the path is correct.'); exit(); }
}
示例2: show_error
/**
show error-message and terminate
*/
function show_error($error, $extra = NULL)
{
_error($error . " : " . $extra);
// we do not know whether the language module was already loaded
$errmsg = isset($GLOBALS["error_msg"]) ? $GLOBALS["error_msg"]["error"] : "ERROR";
$backmsg = isset($GLOBALS["error_msg"]) ? $GLOBALS["error_msg"]["back"] : "BACK";
show_header($errmsg);
?>
<center>
<h2><?php
echo $errmsg;
?>
</h2>
<?php
echo $error;
?>
<h3> <a href="javascript:window.history.back()"><?php
echo $backmsg;
?>
</a><h3>
<?php
if ($extra != NULL) {
echo " - " . $extra;
}
?>
</center>
<?php
show_footer();
exit;
}
示例3: __construct
public function __construct($name, $read_cb = null)
{
$pipes_folder = JAXL_CWD . '/.jaxl/pipes';
if (!is_dir($pipes_folder)) {
mkdir($pipes_folder);
}
$this->ev = new JAXLEvent();
$this->name = $name;
$this->read_cb = $read_cb;
$pipe_path = $this->get_pipe_file_path();
if (!file_exists($pipe_path)) {
posix_mkfifo($pipe_path, $this->perm);
$this->fd = fopen($pipe_path, 'r+');
if (!$this->fd) {
_error("unable to open pipe");
} else {
_debug("pipe opened using path {$pipe_path}");
_notice("Usage: \$ echo 'Hello World!' > {$pipe_path}");
$this->client = new JAXLSocketClient();
$this->client->connect($this->fd);
$this->client->set_callback(array(&$this, 'on_data'));
}
} else {
_error("pipe with name {$name} already exists");
}
}
示例4: _query
function _query($query, $step)
{
$result = mysql_query($query);
if (!$result) {
_error("Query failed : " . mysql_error(), $step);
} else {
return $result;
}
}
示例5: tpl
protected function tpl($module = 'admin', $template = 'index')
{
$file = G_SYSTEM . 'modules/' . $module . '/tpl/' . $template . '.tpl.php';
if (file_exists($file)) {
return $file;
} elseif (defined("G_IN_ADMIN")) {
_message("没有找到<font color='red'>" . $module . "</font>模块下的<font color='red'>" . $template . ".tpl.php</font>文件!");
} else {
_error('template message', 'The "' . $module . '.' . $template . '" template file does not exist');
}
}
示例6: connect
public function connect($ip, $port = 1080)
{
$this->ip = $ip;
$this->port = $port;
$sock_path = $this->_sock_path();
if ($this->client->connect($sock_path)) {
_debug("established connection to {$sock_path}");
return true;
} else {
_error("unable to connect {$sock_path}");
return false;
}
}
示例7: login
function login()
{
if (isset($_SESSION["s_user"])) {
if (!user_activate($_SESSION["s_user"], $_SESSION["s_pass"])) {
_debug("Failed to activate user " . $_SESSION['s_user']);
logout();
}
} else {
if (isset($_POST["p_pass"])) {
$p_pass = $_POST["p_pass"];
} else {
$p_pass = "";
}
if (isset($_POST["p_user"])) {
// Check Login
if (!user_activate(stripslashes($_POST["p_user"]), md5(stripslashes($p_pass)))) {
_error("failed to authenticate user " . $_POST["p_user"]);
logout();
}
// authentication sucessfull
_debug("user '" . $_POST["p_user"] . "' successfully authenticated");
// set language
$_SESSION['language'] = qx_request("lang", "en");
return;
} else {
// Ask for Login
show_header($GLOBALS["messages"]["actlogin"]);
echo "<CENTER><BR><TABLE width=\"300\"><TR><TD colspan=\"2\" class=\"header\" nowrap><B>";
echo $GLOBALS["messages"]["actloginheader"] . "</B></TD></TR>\n<FORM name=\"login\" action=\"";
echo make_link("login", NULL, NULL) . "\" method=\"post\">\n";
echo "<TR><TD>" . $GLOBALS["messages"]["miscusername"] . ":</TD><TD align=\"right\">";
echo "<INPUT name=\"p_user\" type=\"text\" size=\"25\"></TD></TR>\n";
echo "<TR><TD>" . $GLOBALS["messages"]["miscpassword"] . ":</TD><TD align=\"right\">";
echo "<INPUT name=\"p_pass\" type=\"password\" size=\"25\"></TD></TR>\n";
//Select box and auto language detection array
echo "<TR><TD>" . gettext("Detected Language:<br />(Change if needed)") . "</TD><TD align=\"right\">";
include './_lang/_info.php';
echo "<TR><TD colspan=\"2\" align=\"right\"><INPUT type=\"submit\" value=\"";
echo $GLOBALS["messages"]["btnlogin"] . "\"></TD></TR>\n</FORM></TABLE><BR></CENTER>\n";
?>
<script language="JavaScript1.2" type="text/javascript">
<!--
if(document.login) document.login.p_user.focus();
// -->
</script><?php
show_footer();
exit;
}
}
}
示例8: __construct
public function __construct($name, $perm = 0600)
{
$this->name = $name;
$this->perm = $perm;
$pipe_path = $this->get_pipe_file_path();
if (!file_exists($pipe_path)) {
posix_mkfifo($pipe_path, $this->perm);
$this->fd = fopen($pipe_path, 'r+');
if (!$this->fd) {
_error("unable to open pipe");
}
stream_set_blocking($this->fd, false);
// watch for incoming data on pipe
JAXLLoop::watch($this->fd, array('read' => array(&$this, 'on_read_ready')));
} else {
_error("pipe with name {$name} already exists");
}
}
示例9: doPOST
function doPOST()
{
// FIXME This should be done at apache level probably...
$this->allowFromKey();
// $p = $this->assertNotEmpty('p');
$action = $this->assertNotEmpty('action');
$graph = $this->assertNotEmpty('graph');
// $type = $this->assertNotEmpty('type');
if ($action == 'put') {
$json = $this->assertNotEmpty('json');
$json = json_decode(base64_decode($json));
switch (json_last_error()) {
case JSON_ERROR_DEPTH:
$error = ' - Maximum stack depth exceeded';
break;
case JSON_ERROR_CTRL_CHAR:
$error = ' - Unexpected control character found';
break;
case JSON_ERROR_SYNTAX:
$error = ' - Syntax error, malformed JSON';
break;
case JSON_ERROR_NONE:
default:
$error = '';
}
if ($error) {
_error('Broken JSON: ' . $error);
}
$ntriples = jsonld_normalize($json, array('format' => 'application/nquads'));
$this->parameters['data'] = $ntriples;
//put_ntriples($ntriples, $graph);
//$output = $ntriples;
//header("HTTP/1.1 " . 200, true, 200);
return $this->_doPUT();
} else {
if ($action == 'delete') {
return $this->doDELETE();
}
}
//
exit(0);
// Die happy
}
示例10: _assign
<?php
if (isset($attributes['code'])) {
if ($arrProperty = $oPropertyManager->getProperty($attributes['code'])) {
_assign("arrProperty", $arrProperty);
} else {
_error("ENoPropertyFound", "No property found with this code");
}
} else {
_error("ENoPropertyGiven", "No property given to edit");
}
_display("admin/dspPropertyForm.tpl");
示例11: _assign
<?php
$arrLanguages = $oLanguageManager->getLanguages();
$arrImages = $ogGalleryManager->getImages($attributes['gallery']);
$intLanguageID = $oLanguage->getID();
_assign("intLanguageID", $intLanguageID);
_assign("arrImages", $arrImages);
_assign("arrLanguages", $arrLanguages);
if (!empty($attributes['gallery'])) {
if ($ogGalleryManager->checkGallery($attributes['gallery'])) {
_display("admin/dspGallery.tpl");
} else {
_error("EGalleryNotExists", "Gallery not exists");
}
} else {
_error("EGalleryNotGiven", "Gallery not given");
}
示例12: Group
<?php
$tmpoGroup = new Group();
if (!empty($attributes['id'])) {
if (!($tmpoGroup = $oSecurityManager->getGroupByID($attributes['id']))) {
_error("ENoGroupFound", "No security group with ID={$attributes['id']} found");
}
}
if (isset($attributes['fCode'])) {
$tmpoGroup->setCode($attributes['fCode']);
}
if (isset($attributes['fName'])) {
$tmpoGroup->setName($attributes['fName']);
}
if (isset($attributes['fDescription'])) {
$tmpoGroup->setDescription($attributes['fDescription']);
}
if (isset($attributes['fHomePage'])) {
$tmpoGroup->setHomePage($attributes['fHomePage']);
}
_assign("tmpoGroup", $tmpoGroup);
_display("admin/dspGroupForm.tpl");
示例13: _message
<?php
$galleryPath = $fusebox['pathGalleries'] . $attributes['gallery'] . "/";
$thumbsPath = $galleryPath . $fusebox['folderThumbs'] . "/";
if (!empty($attributes['gallery']) && !empty($attributes['image'])) {
if ($strImageFileName = $ogGalleryManager->getImageFileName($attributes['gallery'], $attributes['image'])) {
if ($ogGalleryManager->deleteImage($attributes['gallery'], $attributes['image'])) {
if (file_exists($galleryPath . $strImageFileName)) {
if (!unlink($galleryPath . $strImageFileName)) {
_message("MGalleryImageFileRemained", "Gallery image file remained on disk");
}
}
if (file_exists($thumbsPath . $strImageFileName)) {
if (!unlink($thumbsPath . $strImageFileName)) {
_message("MGalleryThumbFileRemained", "Gallery image thumbnail file remained on disk");
}
}
$ogGalleryManager->setGalleryUpdatedDate($attributes['gallery']);
_message("MGalleryImageDeleted", "Gallery image deleted");
} else {
_warning("WGalleryImageNotDeleted", "Gallery image not deleted");
}
} else {
_warning("WGalleryImageNotFound", "Gallery image not found");
}
} else {
_error("EGalleryImageNotGiven", "Gallery image not given to delete");
}
示例14: uploadCover
/**
* Upload cover image.
*
* @param Request $request
*
* @return AJAX
*/
function uploadCover(Request $request)
{
if ($request->isMethod('POST')) {
$rules = $this->_getCoverRules();
$messages = $this->_getCoverMessages();
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return file_pong(['messages' => $validator->errors()->first()], _error(), 403);
}
if ($request->file('__file')->isValid()) {
$avatar = $request->file('__file');
$storagePath = config('frontend.coversFolder');
$mediumSizeW = (int) config('frontend.coverMediumW');
$mediumSizeH = (int) config('frontend.coverMediumH');
$mediumName = generate_filename($storagePath, $avatar->getClientOriginalExtension(), ['prefix' => 'cover_', 'suffix' => "_{$mediumSizeW}x{$mediumSizeH}"]);
$avatar->move($storagePath, $mediumName);
$image = ImageIntervention::make($storagePath . '/' . $mediumName)->orientate();
$image->fit($mediumSizeW, $mediumSizeH, function ($constraint) {
$constraint->upsize();
});
$image->save();
$userProfile = user()->userProfile;
if (is_null($userProfile)) {
$userProfile = new UserProfile();
$userProfile->user_id = user()->id;
} else {
$avatarImg = unserialize($userProfile->cover_image);
if (isset($avatarImg[$mediumSizeW])) {
delete_file($storagePath . '/' . $avatarImg[$mediumSizeW]);
}
}
$userProfile->cover_image = serialize(array($mediumSizeW => $mediumName));
$userProfile->save();
return file_pong(['cover_medium' => $storagePath . '/' . $mediumName]);
}
return file_pong(['messages' => _t('opps')], _error(), 403);
}
}
示例15: connect
/**
* @param string | resource $socket_path
*/
public function connect($socket_path)
{
if (gettype($socket_path) == "string") {
$path_parts = explode(":", $socket_path);
$this->transport = $path_parts[0];
$this->host = substr($path_parts[1], 2, strlen($path_parts[1]));
if (sizeof($path_parts) == 3) {
$this->port = $path_parts[2];
}
_info("trying " . $socket_path);
if ($this->stream_context) {
$this->fd = @stream_socket_client($socket_path, $this->errno, $this->errstr, $this->timeout, STREAM_CLIENT_CONNECT, $this->stream_context);
} else {
$this->fd = @stream_socket_client($socket_path, $this->errno, $this->errstr, $this->timeout);
}
} else {
$this->fd =& $socket_path;
}
if ($this->fd) {
_debug("connected to " . $socket_path . "");
stream_set_blocking($this->fd, $this->blocking);
// watch descriptor for read/write events
JAXLLoop::watch($this->fd, array('read' => array(&$this, 'on_read_ready')));
return true;
} else {
_error("unable to connect " . $socket_path . " with error no: " . $this->errno . ", error str: " . $this->errstr . "");
$this->disconnect();
return false;
}
}