本文整理汇总了PHP中addError函数的典型用法代码示例。如果您正苦于以下问题:PHP addError函数的具体用法?PHP addError怎么用?PHP addError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProduct
function getProduct($productID, $db_handle)
{
try {
$statement_handle = $db_handle->prepare("SELECT * FROM products WHERE productID=(:productID)");
if (ALL_PRODUCTS == $productID) {
$statement_handle->bindParam(':productID', ALL_PRODUCTS);
} else {
$statement_handle->bindParam(':productID', $productID);
}
$statement_handle->execute();
} catch (PDOException $e) {
clearAndInitErrors();
addError($e->getMessage());
}
$db_handle = null;
return $statement_handle->fetchAll();
displayErrors();
}
示例2: add
public function add()
{
if ($_POST) {
$dbName = substr(BASEURL2, 0, -1);
$name = 'topBanner' . $dbName;
//Processing the SiteImage.
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '1024';
$config['max_width'] = '0';
$config['max_height'] = '0';
$config['file_name'] = $name;
$config['overwrite'] = TRUE;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('banner')) {
addError(getTxt('FailMoveFile') . $this->upload->display_errors());
} else {
$uploaddata = $this->upload->data();
$ext = $uploaddata['file_ext'];
//Delete any other files.
$this->deleteOthers($name, $ext);
addSuccess(getTxt('SiteSuccessfullyEdited'));
}
}
$data = $this->StyleData;
$this->load->view('banner/add', $data);
}
示例3: run
public static function run($input)
{
if (!$input) {
$input = $_REQUEST;
}
if (!count($input)) {
return false;
}
self::$input = $input;
//die(print_r(self::$data));
$passed = true;
foreach (self::$data as $fieldName => &$field) {
foreach ($field['rules'] as &$rule) {
$func = $rule['rule'];
if (method_exists(__CLASS__, $func)) {
if (isset($rule['vars'])) {
$rule['passed'] = (int) call_user_func(array('MG_Validation', $func), $fieldName, $rule['vars']);
} else {
$rule['passed'] = (int) call_user_func(array('MG_Validation', $func), $fieldName);
}
} else {
$rule['passed'] = (int) call_user_func($func, self::$input[$fieldName]);
}
if (!$rule['passed']) {
addError(str_replace("%", $field['friendlyName'], MG_Lang::translate('validation_' . $rule['rule'])));
$passed = 0;
$field['passed'] = 0;
}
}
}
return $passed;
}
示例4: MDB2Error
function MDB2Error($MDB2Object, $msg = "")
{
if (PEAR::isError($MDB2Object)) {
addError($msg . "<br>" . $MDB2Object->getMessage());
if (EC_DEBUG) {
addError($MDB2Object->getUserinfo());
}
show_errors();
die;
}
}
示例5: deleteall
function deleteall()
{
$params = Core::Request();
$problemModel = $this->loadmodel('SearchModel');
if ($problemModel->query("DELETE FROM `problems`")) {
$data['msg'] = addSuccess(lang('history has been deleted.'));
} else {
$data['msg'] = addError(lang('Unsuccess delete this history.'));
}
$this->index();
}
示例6: setRating
function setRating($objId, $rating, $remoteData = array())
{
global $db, $page, $user;
// checks
if (!is_numeric($rating) || $rating < $this->minValue || $rating > $this->maxValue) {
addError("invalid or empty rating");
return;
}
if (!empty($remoteData)) {
// this rating comes from another node...
// TODO
} elseif ($page->loggedIn()) {
// local rating from registered user
$this->find($objId, $user->id);
$this->set('rate', $rating);
$this->set('host', getHostName());
$this->set('entered', $this->db->getTimestampTz());
if ($this->exists()) {
// change existing rating
$this->update();
} else {
// new rating
$this->set('prog_id', $objId);
$this->set('user_id', $user->id);
$this->set('user_node_id', 0);
$this->create();
}
} else {
// anonymous rating
// TODO: if there was a rating request from the same host within x minutes, then reject
$key = $page->getAuthKey();
if ($key) {
$this->findAnon($objId, $key);
$this->set('rate', $rating);
$this->set('host', getHostName());
$this->set('entered', $this->db->getTimestampTz());
if ($this->exists()) {
// change existing rating
$this->update();
} else {
// new rating
$this->set('prog_id', $objId);
$this->set('auth_key', $key);
$this->create();
}
} else {
addError($page->getlocalized("cannot_rate_no_authkey"));
// or $this->set('problem', 'no_auth_key');
return;
}
}
$this->updateInstant($objId);
}
示例7: getTopTopics
function getTopTopics($maxHits)
{
$res = $this->db->limitQuery("SELECT tc.* FROM sotf_topics_counter tc, sotf_topic_tree_defs td WHERE tc.topic_id=td.id AND td.supertopic != 0 AND total > 0 ORDER BY total DESC", 0, $maxHits);
if (DB::isError($res)) {
addError($res);
return array();
}
while (DB_OK === $res->fetchInto($item)) {
$item['name'] = $this->getTopicName($item['topic_id']);
$list[] = $item;
}
return $list;
}
示例8: delete
function delete($post)
{
//pre($post);exit;
$office = $this->loadmodel('OfficeModel');
$office->id = $post['params'];
if ($office->Delete()) {
$data['msg'] = addSuccess(lang('1 office has been deleted.'));
} else {
$data['msg'] = addError(lang('Unsuccess delete this office.'));
}
$data['title'] = lang('Management office');
$data['header'] = lang('Management office');
$this->data = $data;
$this->index();
$office->All();
$data['office'] = $office->variables;
}
示例9: delete
function delete($post)
{
//pre($post);exit;
$kinerja = $this->loadmodel('KinerjaModel');
$kinerja->id = $post['params'];
if ($kinerja->Delete()) {
$data['msg'] = addSuccess(lang('1 kinerja has been deleted.'));
} else {
$data['msg'] = addError(lang('Unsuccess delete this kinerja.'));
}
$data['title'] = lang('Management kinerja');
$data['header'] = lang('Management kinerja');
$this->data = $data;
$this->index();
$kinerja->All();
$data['kinerja'] = $kinerja->variables;
}
示例10: call
function call($url, $method, $params)
{
// xmlrpc encode parameters
for ($i = 0; $i < count($params); $i++) {
if (get_class($params[$i]) != 'xmlrpcval') {
$params[$i] = xmlrpc_encoder($params[$i]);
}
}
// send request
$message = new xmlrpcmsg($method, $params);
if ($this->debug) {
// $this->display_xml($message->serialize());
print "<PRE>" . htmlentities($message->serialize()) . "</PRE>\n";
//("XML-RPC message:\n $message->serialize()",0);
}
$addr = parse_url($url);
$client = new xmlrpc_client($url, $addr['host'], $addr['port'], $this->connTimeout, $this->recvTimeout);
if ($this->debug) {
$client->setDebug(1);
}
debug("XML-RPC", "call to " . $url);
$response = $client->send($message);
if ($this->debug) {
print "<PRE>" . htmlentities($response->serialize()) . "</PRE>\n";
}
// process response
//debug("XML-RPC Response", $response->serialize());
if (!$response) {
addError("No response: probably host is unreachable");
} elseif ($response->faultCode() > 0) {
// there was an error
addError("Error response: " . $response->faultCode() . " " . $response->faultString());
} else {
$retval = $response->value();
if ($retval) {
$retval = xmlrpc_decoder($retval);
}
//debug("Response", $retval);
return $retval;
}
return NULL;
}
示例11: check_database
function check_database($password)
{
//Field validation succeeded. Validate against database
$username = $this->input->post('username');
//query the database
$result = $this->users->login($username, $password);
if ($result) {
foreach ($result as $row) {
//Set the SESSION
fetch_session();
$_SESSION['username'] = $username;
$_SESSION['user_auth'] = $row->authority;
addSuccess(getTxt('LogInSuccess'));
}
return TRUE;
} else {
addError(getTxt('Incorrect'));
return false;
}
}
示例12: doAction
function doAction($action)
{
$forwardpage = "";
$forward = true;
$loggedin = isUserLoggedIn();
if (!$loggedin && strcmp($action, "login") != 0 && strcmp($action, "register") != 0 && strcmp($action, "getTags") != 0) {
addError("fatal", "user.unathorized");
outputJSON("error");
} else {
if (strcmp($action, "login") == 0) {
login();
} else {
if (strcmp($action, "logout") == 0) {
logout();
} else {
if (strcmp($action, "isLoggedIn") == 0) {
isLoggedIn();
} else {
if (strcmp($action, "register") == 0) {
register();
} else {
if (strcmp($action, "addquestion") == 0) {
addQuestion();
} else {
if (strcmp($action, "getTags") == 0) {
getTags();
} else {
if (strcmp($action, "getquestions") == 0) {
getQuestions();
}
}
}
}
}
}
}
}
}
示例13: validateArray
/**
* Validate an array
*
* @param array $array
* @param string $message
* @param integer/null $lowerLimit
* @param integer/null $upperLimit
* @return boolean
*
* @author Liviu
* @since May 07, 2009
*/
function validateArray($array, $message = null, $lowerLimit = null, $upperLimit = null)
{
if (!is_array($array)) {
$message != null ? addError($message) : null;
return false;
}
if (is_array($array) and $lowerLimit != null and count($array) < $lowerLimit) {
$message != null ? addError($message) : null;
return false;
}
if (is_array($array) and $upperLimit != null and count($array) > $upperLimit) {
$message != null ? addError($message) : null;
return false;
}
return true;
}
示例14: isset
if (isset($_POST['flubber_submit'])) {
$username = isset($_POST['flubber_username']) ? $_POST['flubber_username'] : "";
$password = isset($_POST['flubber_password']) ? $_POST['flubber_password'] : "";
if ($username == "") {
addError("login.username.missing");
}
if ($password == "") {
addError("login.password.missing");
}
if (getErrorCount() > 0) {
$forwardpage = "views\\index.php";
} else {
if (validate($username, $password) == true) {
$_SESSION['username'] = $username;
if (isset($_SESSION['current_url'])) {
$curl = $_SESSION['current_url'];
unset($_SESSION['current_url']);
doAction("redirect", $curl);
} else {
doAction("home");
}
$forward = false;
} else {
addError("login.account.invalid");
$forwardpage = "views\\index.php";
}
}
} else {
$_SESSION['current_url'] = currentURL();
$forwardpage = "views/index.php";
}
示例15: delete
function delete($post)
{
$jurnal = $this->loadmodel('JurnalModel');
$jurnal->id_jurnal = $post['params'];
$jurnal->Find();
$filepath = $jurnal->variables['filepath'];
$filetext = $jurnal->variables['filetext'];
if ($jurnal->Delete()) {
if (!empty($filepath) && file_exists(FILE_PATH . $filepath)) {
$unlink = unlink(FILE_PATH . $filepath);
}
if (!empty($filetext) && file_exists(FILE_DIR . 'xml' . DS . $filetext)) {
$unlink = unlink(FILE_DIR . 'xml' . DS . $filetext);
}
$data['msg'] = addSuccess(lang('1 jurnal has been deleted.'));
} else {
$data['msg'] = addError(lang('Unsuccess delete this jurnal.'));
}
$data['title'] = lang('Management jurnal');
$data['header'] = lang('Management jurnal');
$data['layout'] = 'adminhtml';
$this->data = $data;
$this->index();
$jurnal->All();
$data['jurnal'] = $jurnal->variables;
}