本文整理汇总了PHP中Output::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::error方法的具体用法?PHP Output::error怎么用?PHP Output::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: permission
private function permission($rule = 0, $permission = null)
{
$OUTPUT = new Output();
if ($rule > 1 && $this->role < $rule) {
// Something About the logic here is not working.
if (!is_null($permission) && is_array($this->permissions)) {
if (!in_array($permission, $this->permissions)) {
$OUTPUT->error(1, "Insufficient Priveleges");
}
} else {
$OUTPUT->error(1, "Insufficient Priveleges");
}
}
}
示例2: id
function id($id)
{
$OUTPUT = new Output();
// save to array of ids that have been looked up thus far
// look up permissions and check if user is a member of any groups that have permissions
$OUTPUT->error(3, "Insufficient Document Level Privleges");
// if document does not exist in this collection, add it to the collection
}
示例3: curl
static function curl($base, $path, $params, $auth_head = null, $basic = null)
{
// Build Curl Function
$curl = curl_init();
$headr = array();
$headr[] = 'Content-length: 0';
$headr[] = 'Content-type: application/json';
if (!is_null($auth_head)) {
if (!is_null($basic) && $basic) {
$headr[] = 'Authorization: Basic ' . $auth_head;
} else {
$headr[] = 'Authorization: Bearer ' . $auth_head;
}
}
curl_setopt($curl, CURLOPT_URL, Helper::buildURL($base, $path, $params));
curl_setopt($curl, CURLOPT_HTTPHEADER, $headr);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
// curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$rest = curl_exec($curl);
// TODO: Check if this works, if not, try a post request with get_file_contents ($context)
if ($rest === false) {
// curl failed
$out = json_decode(file_get_contents(Helper::buildURL($base, $path, $params)), true);
$OUTPUT = new Output();
$OUTPUT->error(2, curl_error($curl));
} else {
$out = json_decode($rest, true);
if (is_null($out) || isset($out["error"])) {
$out = json_decode(file_get_contents(Helper::buildURL($base, $path, $params)), true);
}
}
if (is_null($out) || isset($out["error"])) {
$OUTPUT->error(1, "Unable to retrieve information from API", $out);
}
return $out;
}
示例4: Output
function __construct($id = null)
{
if (!is_null($id)) {
if ($this->valid_id($id)) {
session_id($id);
} else {
$OUTPUT = new Output();
$OUTPUT->error(2, "Session_id is invalid");
}
}
if (!$this->session_active()) {
session_start();
}
$this->id = session_id();
}
示例5: parse
public function parse()
{
$executor = StepExecutor::getInstance();
$matches = array();
while ($line = fgets($this->_file)) {
$line = str_replace("\n", '', $line);
if (preg_match(self::STEP_PATTERN, $line, $matches) == 1) {
list($full, $step, $args) = $matches;
try {
$result = $executor->call($step, $args);
if (S_SUCCESS === $result) {
Output::success($line);
} elseif (S_PENDING === $result) {
Output::pending($line);
}
} catch (Exception $ex) {
Output::error($ex);
}
} else {
Output::println($line);
}
}
}
示例6: check
protected function check($r)
{
$user = Session::isLogged();
$api = Session::isLoggedApi();
if (Session::Has(Session::rights_key)) {
$rights = Session::Get(Session::rights_key);
} else {
$rights = array();
}
if ($user || $api) {
if (Session::Has(self::userid)) {
$userid = Session::Get(self::userid);
} else {
$userid = false;
}
if (Session::Has(self::apiid)) {
$apiid = Session::Get(self::apiid);
} else {
$apiid = false;
}
Output::success(array("user" => $userid, "api" => $apiid, "rights" => $rights, "next" => Session::nextCheck()));
}
Output::error("Not loggied in");
}
示例7: Output
<?php
include_once '/var/www/html/Lux/Core/Helper.php';
$OUTPUT = new Output();
$OUTPUT->error(5, "This Error was generated as a test");
示例8: Db
<?php
include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Users");
$RULES = new Rules(1);
$OUTPUT = new Output();
$REQUEST = new Request();
$document = $collection->findOne(array('$or' => array(array("system_info.user" => $REQUEST->get("user")), array("system_info.email" => $REQUEST->get("user")))));
if (!is_null($document) && isset($document["system_info"]["email"])) {
$password = bin2hex(openssl_random_pseudo_bytes(8));
$hash = password_hash($password, PASSWORD_DEFAULT);
$collection->update($document["_id"], array('$set' => array("system_info.hash" => $hash)));
$to = $document["system_info"]["email"];
$subject = 'Email Verification';
$message = "A password reset link was sent to your email address. Your new password is {$password}";
$headers = 'From: no-reply@' . $_SERVER["HTTP_HOST"] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
$OUTPUT->success(0, "Password Reset Email Sent");
} else {
$OUTPUT->error(1, "Username/Email was not found in the system");
}
示例9: errorHandler
/**
* Error handler
* @access public
* @static
* @param int $pCode
* @param string $pMsg
* @param string $pFile
* @param string $pLine
*/
public static function errorHandler($pCode, $pMsg, $pFile, $pLine)
{
switch ($pCode) {
case E_WARNING:
case E_USER_WARNING:
$priority = PEAR_LOG_WARNING;
break;
case E_NOTICE:
case E_USER_NOTICE:
$priority = PEAR_LOG_NOTICE;
break;
case E_ERROR:
case E_USER_ERROR:
$priority = PEAR_LOG_ERR;
break;
default:
$priority = PEAR_LOG_INFO;
}
$tmp = $pMsg . ' in ' . $pFile . ' at line ' . $pLine;
self::setLog($tmp, $priority);
if (ProjectConfiguration::getConfig('is_debug')) {
Output::error($tmp);
Output::backtrace();
}
}
示例10: array
if (!empty($_POST['apk'])) {
try {
$uploadData = array('data' => file_get_contents($_POST['apk']), 'mimeType' => 'application/octet-stream', 'uploadType' => 'multipart');
//https://almanapp.nl/uploader/apks/nl-almanapp-almanappinbedrijf-release.apk
$apkupload_result = $service->edits_apks->upload($package, $transaction_id, $uploadData);
Output::info("APK (url:{$_POST['apk']}) is added to the page");
if (!empty($_POST['changes'])) {
Output::info("Changes have been ommited for now");
// $listing = new Google_Service_AndroidPublisher_ApkListing();
// $listing->setRecentChanges($_POST['changes']);
// $listing->setLanguage($lang);
// Output::info("Changes has been updated to: ",$_POST['changes']);
// $result = $service->edits_apklistings->patch($package,$transaction_id,$apkupload_result->getVersionCode(), $lang,$listing);
}
} catch (Google_Service_Exception $e) {
Output::error(sprintf("%s: %s: ERROR:", "APK Upload", $_POST['apk']), $e->getErrors());
}
}
$result = $service->edits->commit($package, $transaction_id);
Output::success("Changes have been done");
/**
* @param Google_Service_AndroidPublisher $service
* @param $package string
* @param $transaction_id int
* @param $lang string
* @param $type string
* @param $url string
* @return Google_Service_AndroidPublisher_ImagesUploadResponse|null
*/
function uploadNewImage(Google_Service_AndroidPublisher $service, $package, $transaction_id, $lang, $type, $url)
{
示例11: Db
<?php
include_once '/var/www/html/Lux/Core/Helper.php';
$DB = new Db("System");
$collection = $DB->selectCollection("Accounts");
$OUTPUT = new Output();
$REQUEST = new Request();
$db2 = new Db("Auth");
$OUTPUT = new Output();
$clients = $db2->selectCollection("Clients");
$client_id = $REQUEST->get("client_id");
$redirect_uri = $REQUEST->get("redirect_uri");
$client_secret = $REQUEST->get("client_secret");
$client_doc = $clients->findOne(array("client_id" => $client_id, "client_secret" => $client_secret, "redirect_uri" => array('$elemMatch' => array('$in' => array($redirect_uri)))));
// get Password and Username from $REQUEST
// /client_id /redirect_uri /client_secret /code /grant_type:authorization_code
if ($REQUEST->get("grant_type") != "authorization_code") {
$OUTPUT->error(1, "Grant_type must equal authorization code in this context");
}
// find where there is a match
$uDoc = $collection->findOne(array('system_info.OAuth_clients' => array('$elemMatch' => array('$in' => array(array("client_id" => $REQUEST->get("client_id"), "code" => $REQUEST->get("code")))))));
if (is_null($uDoc)) {
$OUTPUT->error(1, "This code is either invalid or has already been redeemed");
}
$lAT = bin2hex(openssl_random_pseudo_bytes(16));
$document = $collection->update(array('_id' => $uDoc["_id"]), array('$pull' => array('system_info.OAuth_clients' => array("client_id" => $REQUEST->get("client_id"), "code" => $REQUEST->get("code")))), array('multiple' => false, 'upsert' => true));
$document = $collection->update(array('_id' => $uDoc["_id"]), array('$addToSet' => array('system_info.OAuth_clients' => array("client_id" => $REQUEST->get("client_id"), "access_token" => $lAT))), array('multiple' => false, 'upsert' => true));
$OUTPUT->success(1, array("access_token" => $lAT));
die;
示例12: array
#!/usr/bin/env php
<?php
require_once __DIR__ . '/init.php';
$cli_params = Helper::parseCommandLineArgs($argv);
if (empty($cli_params['options']['config'])) {
$cli_params['options']['config'] = __DIR__ . DIRECTORY_SEPARATOR . 'config.ini';
}
$config = array();
if (file_exists($cli_params['options']['config'])) {
$config = parse_ini_file($cli_params['options']['config']);
}
$config = array_replace($config, $cli_params['options']);
//command line overrides everything
Helper::setConfig($config);
if (!Helper::checkConfigEnough()) {
Output::error('mmp: could not find config file "' . $cli_params['options']['config'] . '"');
exit(1);
}
$controller = Helper::getController($cli_params['command']['name'], $cli_params['command']['args']);
if ($controller !== false) {
$controller->runStrategy();
} else {
Output::error('mmp: unknown command "' . $cli_params['command']['name'] . '"');
Helper::getController('help')->runStrategy();
exit(1);
}
示例13: Db
$DB = new Db("SocialNetwork");
$OUTPUT = new Output();
$collection = $DB->selectCollection("Notifications");
$REQUEST = new Request();
$RULES = new Rules(1, "social");
$permitted = array("subject", "body", "attachment", "attachment[]");
// to || thread
$update = Helper::updatePermitted($REQUEST, $permitted);
$update = Helper::subDocUpdate($update, "message");
// if thread id is not set, query for the thread and create a new one if none exists
// get the thread id
// find the last message on that thread (if one exists)
// create a document that references the last document and the thread_id
if (!$REQUEST->avail("thread")) {
$doc = $collection->findAndModify(array("reciepients" => $REQUEST->get("to"), "reciepients" => $RULES->getId(), "root" => true), array('$setOnInsert' => array("creator" => $RULES->getId())));
$thread = $doc["_id"];
} else {
$thread = $REQUEST->get("thread");
}
$root = $collection->find($thread);
if (is_null($root)) {
$OUTPUT->error(1, "The thread_id provided appears to be invalid");
}
$last = $collection->findOne(array('$query' => array("root" => $thread), '$orderBy' => array('$natural' => -1)));
$update["root"] = $thread;
$update["previous"] = $last["_id"];
$new = $collection->insert($update);
$OUTPUT->success(1, $new);
?>
示例14: main
/**
* The main entry point method.
*/
public function main()
{
if (file_exists($this->config_file)) {
$this->options = parse_ini_file($this->config_file);
}
$this->options = array_replace($this->options, $this->params);
//task params overrides everything
Helper::setConfig($this->options);
$controller = Helper::getController($this->action, $this->action_options);
if ($controller !== false) {
$controller->runStrategy();
} else {
Output::error('mmp: unknown command "' . $this->action . '"');
Helper::getController('help')->runStrategy();
exit(1);
}
}
示例15: initVersionTable
static function initVersionTable()
{
$engine = self::get("versiontable-engine");
if (!in_array($engine, array("MyISAM", "InnoDB"))) {
Output::error('mmp: wrong engine for versiontable "' . $engine . '"');
exit(1);
}
$db = self::getDbObject();
$tbl = self::get('versiontable');
$rev = self::getCurrentVersion();
$db->query("DROP TABLE IF EXISTS `{$tbl}`");
$db->query("CREATE TABLE `{$tbl}` (`rev` BIGINT(20) UNSIGNED, PRIMARY KEY(`rev`)) ENGINE={$engine}");
$db->query("TRUNCATE `{$tbl}`");
$db->query("INSERT INTO `{$tbl}` VALUES({$rev})");
}