本文整理汇总了PHP中ext_Result::add_error方法的典型用法代码示例。如果您正苦于以下问题:PHP ext_Result::add_error方法的具体用法?PHP ext_Result::add_error怎么用?PHP ext_Result::add_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ext_Result
的用法示例。
在下文中一共展示了ext_Result::add_error方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendResult
static function sendResult($action, $success, $msg, $extra = array())
{
// show error-message
if (ext_isXHR()) {
$success = (bool) $success;
if ($success && ext_Result::count_errors() > 0) {
$success = false;
foreach (@$_SESSION['ext_error'] as $type) {
if (is_array($type)) {
foreach ($type as $error) {
$msg .= '<br />' . $error;
}
}
}
}
$result = array('action' => $action, 'message' => str_replace("'", "\\'", $msg), 'error' => str_replace("'", "\\'", $msg), 'success' => $success);
foreach ($extra as $key => $value) {
$result[$key] = $value;
}
$classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON';
$json = new $classname();
$jresult = $json->encode($result);
if (strtolower(extGetParam($_POST, 'requestType')) == 'xmlhttprequest') {
header("Content-type: text/html");
}
print $jresult;
ext_exit();
}
$messagetxt = '';
if ($extra != NULL) {
$msg .= " - " . $extra;
}
if ($msg != '') {
ext_Result::add_error($msg);
}
if (ext_Result::count_messages() < 1 && ext_Result::count_errors() < 1) {
return;
}
if (ext_Result::count_messages() > 0) {
$messagetxt .= '<h3>' . $GLOBALS["error_msg"]["message"] . ':</h3>';
foreach ($_SESSION['ext_message'] as $msgtype) {
foreach ($msgtype as $message) {
$messagetxt .= $message . '<br/>';
}
$messagetxt .= '<br /><hr /><br />';
}
ext_Result::empty_messages();
if (!empty($_REQUEST['extra'])) {
$messagetxt .= ' - ' . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES);
}
}
if (!empty($_SESSION['ext_error'])) {
$messagetxt .= '<h3>' . $GLOBALS["error_msg"]["error"] . ':</h3>';
foreach ($_SESSION['ext_error'] as $errortype) {
foreach ($errortype as $error) {
$messagetxt .= $error . '<br/>';
}
$messagetxt .= '<br /><hr /><br />';
}
ext_Result::empty_errors();
}
if (!empty($_REQUEST['extra'])) {
$messagetxt .= " - " . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES);
}
extHTML::loadExtJS();
show_header();
defined('EXPLORER_NOEXEC') or define('EXPLORER_NOEXEC', 1);
echo ext_scriptTag('', 'Ext.Msg.alert(\'Status\', \'' . $messagetxt . '\')');
//}
$GLOBALS['action'] = 'show_error';
}
示例2: chmod_recursive
function chmod_recursive($item, $mode)
{
// chmod file / dir
$ok = true;
if (@is_link($item) || @is_file($item)) {
$ok = @chmod($item, $mode);
if ($ok) {
ext_Result::add_message($GLOBALS['messages']['permchange'] . ' ' . $new_item);
} else {
ext_Result::add_error($GLOBALS['error_msg']['permchange'] . ' ' . $new_item);
}
} elseif (@is_dir($item)) {
if (($handle = @opendir($item)) === false) {
ext_Result::add_error(basename($item) . ": " . $GLOBALS["error_msg"]["opendir"]);
return false;
}
while (($file = readdir($handle)) !== false) {
if ($file == ".." || $file == ".") {
continue;
}
$new_item = $item . "/" . $file;
if (!@file_exists($new_item)) {
ext_Result::add_error(basename($item) . ": " . $GLOBALS["error_msg"]["readdir"]);
continue;
}
//if(!get_show_item($item, $new_item)) continue;
if (@is_dir($new_item)) {
$ok = chmod_recursive($new_item, $mode);
} else {
$ok = @chmod($new_item, $mode);
if ($ok) {
ext_Result::add_message($GLOBALS['messages']['permchange'] . ' ' . $new_item);
} else {
ext_Result::add_error($GLOBALS['error_msg']['permchange'] . ' ' . $new_item);
}
}
}
closedir($handle);
if (@is_dir($item)) {
$bin = decbin($mode);
// when we chmod a directory we must care for the permissions
// to prevent that the directory becomes not readable (when the "execute bits" are removed)
$bin = substr_replace($bin, '1', 2, 1);
// set 1st x bit to 1
$bin = substr_replace($bin, '1', 5, 1);
// set 2nd x bit to 1
$bin = substr_replace($bin, '1', 8, 1);
// set 3rd x bit to 1
$mode = bindec($bin);
}
$ok = @chmod($item, $mode);
if ($ok) {
ext_Result::add_message($GLOBALS['messages']['permchange'] . ' ' . $item);
} else {
ext_Result::add_error($GLOBALS['error_msg']['permchange'] . ' ' . $item);
}
}
return $ok;
}
示例3: sendResult
function sendResult($action, $success, $msg, $extra = array())
{
// show error-message
if (ext_isXHR()) {
$success = (bool) $success;
if ($success && ext_Result::count_errors() > 0) {
$success = false;
foreach (@$_SESSION['ext_error'] as $type) {
if (is_array($type)) {
foreach ($type as $error) {
$msg .= '<br >' . $error;
}
}
}
}
$result = array('action' => $action, 'message' => str_replace("'", "\\'", $msg), 'error' => str_replace("'", "\\'", $msg), 'success' => $success);
foreach ($extra as $key => $value) {
$result[$key] = $value;
}
$json = new ext_Json();
$jresult = $json->encode($result);
print $jresult;
ext_exit();
}
if ($extra != NULL) {
$msg .= " - " . $extra;
}
ext_Result::add_error($msg);
if (empty($_GET['error'])) {
session_write_close();
extRedirect(make_link("show_error", $GLOBALS["dir"], null, null, null, null, '&error=1&extra=' . urlencode($extra)));
} else {
show_header($GLOBALS["error_msg"]["error"]);
echo '<div class="quote">';
echo '<a href="#errors">' . ext_Result::count_errors() . ' ' . $GLOBALS["error_msg"]["error"] . '</a>, ';
echo '<a href="#messages">' . ext_Result::count_messages() . ' ' . $GLOBALS["error_msg"]["message"] . '</a><br />';
echo "</div>\n";
if (!empty($_SESSION['ext_message'])) {
echo "<a href=\"" . str_replace('&dir=', '&ignore=', make_link("list", '')) . "\">[ " . $GLOBALS["error_msg"]["back"] . " ]</a>";
echo "<div class=\"ext_message\"><a name=\"messages\"></a>\n\t\t\t\t\t\t<h3>" . $GLOBALS["error_msg"]["message"] . ":</strong>" . "</h3>\n";
foreach ($_SESSION['ext_message'] as $msgtype) {
foreach ($msgtype as $message) {
echo $message . "\n<br/>";
}
echo '<br /><hr /><br />';
}
ext_Result::empty_messages();
if (!empty($_REQUEST['extra'])) {
echo " - " . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES);
}
echo "</div>\n";
}
if (!empty($_SESSION['ext_error'])) {
echo "<div class=\"ext_error\"><a name=\"errors\"></a>\n\t\t\t\t\t\t<h3>" . $GLOBALS["error_msg"]["error"] . ":</strong>" . "</h3>\n";
foreach ($_SESSION['ext_error'] as $errortype) {
foreach ($errortype as $error) {
echo $error . "\n<br/>";
}
echo '<br /><hr /><br />';
}
ext_Result::empty_errors();
}
echo "<a href=\"" . str_replace('&dir=', '&ignore=', make_link("list", '')) . "\">" . $GLOBALS["error_msg"]["back"] . "</a>";
if (!empty($_REQUEST['extra'])) {
echo " - " . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES);
}
echo "</div>\n";
defined('EXPLORER_NOEXEC') or define('EXPLORER_NOEXEC', 1);
}
}