本文整理汇总了PHP中Error::display方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::display方法的具体用法?PHP Error::display怎么用?PHP Error::display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
private static function show($error_message, $hidden_message)
{
$error_view_path = getcwd() . "/system/Pages/error.php";
if (file_exists($error_view_path)) {
include $error_view_path;
} else {
Error::display('VIEW_NOT_FOUND');
}
}
示例2: form
public function form($id = 0)
{
$data = array();
if ($id > 0) {
$memoir = $this->memoir->get(array('id' => $id, 'user_id' => $this->user['id']));
if ($memoir) {
$this->_render('Memoir/form', array('memoir' => $memoir));
} else {
Error::display('NOT_FOUND');
}
} else {
$this->_render('Memoir/form', $data);
}
}
示例3: read
/**
* Read lines from file
*
* @param $name
* @param mixed|string $code
* @return mixed
*/
public function read($name, $code = LANGUAGE_CODE)
{
/** lang file */
$file = APPPATH . "Language" . DIRECTORY_SEPARATOR . "{$code}" . DIRECTORY_SEPARATOR . "{$name}.php";
/** check if is readable */
if (is_readable($file)) {
/** require file */
return include $file;
} else {
/** display error */
echo Error::display("Could not load language file '{$code}/{$name}.php'");
die;
}
}
示例4: model
public function model($model)
{
$model_path = MODELS_PATH . ucfirst($model) . ".php";
if (file_exists($model_path)) {
/* If the model exists, the model will be included and instantiated.
* That instance is passed into a new property of a the caller class.
* The property name will be the same as model name.
*/
include_once $model_path;
$this->caller->{$model} = new $model();
} else {
Error::display('MODEL_NOT_FOUND', "The model '" . ucfirst($model) . "' was not found!");
}
}
示例5: show
/**
* Get lang for views.
*
* @param string $value this is "word" value from language file
* @param string $name name of file with language
* @param string $code optional, language code
*
* @return string
*/
public static function show($value, $name, $code = LANGUAGE_CODE)
{
/** lang file */
$fileLanguage = DIR_LANGUAGE . $path . '/' . $cod . '.php';
/** check if is readable */
if (is_readable($fileLanguage)) {
/** require file */
$array = (include $fileLanguage);
} else {
/** display error */
echo Error::display("Could not load language file '{$code}/{$name}.php'");
die;
}
if (!empty($array[$value])) {
return $array[$value];
} else {
return $value;
}
}
示例6: initialize
public static function initialize()
{
$valid = false;
/* Get the king instance to parse the url to controller, method and parameters.
*/
$king = self::getInstance();
/* Validate the if the controller class based in the url exists.
* If exists, then we include that controller class.
*/
$controller_class = ucfirst($king->getController()) . "Controller";
$controller_path = CONTROLLERS_PATH . $controller_class . ".php";
if (file_exists($controller_path)) {
include_once $controller_path;
/* Initialise the controller class.
*/
$class = new $controller_class();
/* Check if the method exist in the controller class and has the required parameters.
* If it exists, then we call that method and pass the parameters.
*/
$method = $king->getMethod() ? $king->getMethod() : "index";
if (method_exists($class, $method)) {
$classMethod = new ReflectionMethod($class, $method);
if (sizeof($king->getParameters()) >= $classMethod->getNumberOfRequiredParameters()) {
/* Call the Shield class and then checks if the request is secure.
*/
if (Shield::protect()) {
$valid = true;
call_user_func_array(array($class, $method), $king->getParameters());
} else {
Error::display('UNDER_ATTACK');
}
}
}
}
/* Return an error if its an invalid path.
*/
if (!$valid) {
Error::display('NOT_FOUND', "Something is WRONG in the Castle class, the path or controller was not found.");
}
}
示例7: clean_catalog_proc
/**
* clean catalog procedure
*
* Removes local songs that no longer exist.
*/
public function clean_catalog_proc()
{
if (!Core::is_readable($this->path)) {
// First sanity check; no point in proceeding with an unreadable
// catalog root.
debug_event('catalog', 'Catalog path:' . $this->path . ' unreadable, clean failed', 1);
Error::add('general', T_('Catalog Root unreadable, stopping clean'));
Error::display('general');
return 0;
}
$dead_total = 0;
$stats = self::get_stats($this->id);
foreach (array('video', 'song') as $media_type) {
$total = $stats[$media_type . 's'];
// UGLY
if ($total == 0) {
continue;
}
$chunks = floor($total / 10000);
$dead = array();
foreach (range(0, $chunks) as $chunk) {
$dead = array_merge($dead, $this->_clean_chunk($media_type, $chunk, 10000));
}
$dead_count = count($dead);
// The AlmightyOatmeal sanity check
// Never remove everything; it might be a dead mount
if ($dead_count >= $total) {
debug_event('catalog', 'All files would be removed. Doing nothing.', 1);
Error::add('general', T_('All files would be removed. Doing nothing'));
continue;
}
if ($dead_count) {
$dead_total += $dead_count;
$sql = "DELETE FROM `{$media_type}` WHERE `id` IN " . '(' . implode(',', $dead) . ')';
$db_results = Dba::write($sql);
}
}
return $dead_total;
}
示例8: update_remote_catalog
/**
* update_remote_catalog
*
* Pulls the data from a remote catalog and adds any missing songs to the
* database.
*/
public function update_remote_catalog($type = 0)
{
set_time_limit(0);
$remote_handle = $this->connect();
if (!$remote_handle) {
return false;
}
// Get the song count, etc.
$remote_catalog_info = $remote_handle->info();
// Tell 'em what we've found, Johnny!
printf(T_('%u remote catalog(s) found (%u songs)'), $remote_catalog_info['catalogs'], $remote_catalog_info['songs']);
flush();
// Hardcoded for now
$step = 500;
$current = 0;
$total = $remote_catalog_info['songs'];
while ($total > $current) {
$start = $current;
$current += $step;
try {
$songs = $remote_handle->send_command('songs', array('offset' => $start, 'limit' => $step));
} catch (Exception $e) {
Error::add('general', $e->getMessage());
Error::display('general');
flush();
}
// Iterate over the songs we retrieved and insert them
foreach ($songs as $data) {
if ($this->check_remote_song($data['song'])) {
debug_event('remote_catalog', 'Skipping existing song ' . $data['song']['url'], 5);
} else {
$data['song']['catalog'] = $this->id;
$data['song']['file'] = preg_replace('/ssid=.*?&/', '', $data['song']['url']);
if (!Song::insert($data['song'])) {
debug_event('remote_catalog', 'Insert failed for ' . $data['song']['self']['id'], 1);
Error::add('general', T_('Unable to Insert Song - %s'), $data['song']['title']);
Error::display('general');
flush();
}
}
}
}
// end while
echo "<p>" . T_('Completed updating remote catalog(s).') . "</p><hr />\n";
flush();
// Update the last update value
$this->update_last_update();
return true;
}
示例9: update_remote_catalog
/**
* update_remote_catalog
*
* Pulls the data from a remote catalog and adds any missing songs to the
* database.
*/
public function update_remote_catalog()
{
$songsadded = 0;
try {
$api = $this->createClient();
if ($api != null) {
// Get all liked songs
$songs = json_decode($api->get('me/favorites'));
if ($songs) {
foreach ($songs as $song) {
if ($song->streamable == true && $song->kind == 'track') {
$data = array();
$data['artist'] = $song->user->username;
$data['album'] = $data['artist'];
$data['title'] = $song->title;
$data['year'] = $song->release_year;
$data['mode'] = 'vbr';
$data['genre'] = explode(' ', $song->genre);
$data['comment'] = $song->description;
$data['file'] = $song->stream_url . '.mp3';
// Always stream as mp3, if evolve => $song->original_format;
$data['size'] = $song->original_content_size;
$data['time'] = intval($song->duration / 1000);
if ($this->check_remote_song($data)) {
debug_event('soundcloud_catalog', 'Skipping existing song ' . $data['file'], 5);
} else {
$data['catalog'] = $this->id;
debug_event('soundcloud_catalog', 'Adding song ' . $data['file'], 5, 'ampache-catalog');
if (!Song::insert($data)) {
debug_event('soundcloud_catalog', 'Insert failed for ' . $data['file'], 1);
Error::add('general', T_('Unable to Insert Song - %s'), $data['file']);
Error::display('general');
flush();
} else {
$songsadded++;
}
}
}
}
echo "<p>" . T_('Completed updating SoundCloud catalog(s).') . " " . $songsadded . " " . T_('Songs added.') . "</p><hr />\n";
flush();
// Update the last update value
$this->update_last_update();
} else {
echo "<p>" . T_('API Error: cannot get song list.') . "</p><hr />\n";
flush();
}
} else {
echo "<p>" . T_('API Error: cannot connect to SoundCloud.') . "</p><hr />\n";
flush();
}
} catch (Exception $ex) {
echo "<p>" . T_('SoundCloud exception: ') . $ex->getMessage() . "</p><hr />\n";
}
return true;
}
示例10: update_remote_catalog
/**
* update_remote_catalog
*
* Pulls the data from a remote catalog and adds any missing songs to the
* database.
*/
public function update_remote_catalog()
{
$subsonic = $this->createClient();
$songsadded = 0;
// Get all artists
$artists = $subsonic->getIndexes();
if ($artists['success']) {
foreach ($artists['data']['indexes']['index'] as $index) {
foreach ($index['artist'] as $artist) {
// Get albums for artist
$albums = $subsonic->getMusicDirectory(array('id' => $artist['id']));
if ($albums['success']) {
foreach ($albums['data']['directory']['child'] as $album) {
if (is_array($album)) {
$songs = $subsonic->getMusicDirectory(array('id' => $album['id']));
if ($songs['success']) {
foreach ($songs['data']['directory']['child'] as $song) {
if (is_array($song)) {
$data = array();
$data['artist'] = html_entity_decode($song['artist']);
$data['album'] = html_entity_decode($song['album']);
$data['title'] = html_entity_decode($song['title']);
$data['bitrate'] = $song['bitRate'] * 1000;
$data['size'] = $song['size'];
$data['time'] = $song['duration'];
$data['track'] = $song['track'];
$data['disk'] = $song['discNumber'];
$data['mode'] = 'vbr';
$data['genre'] = explode(' ', html_entity_decode($song['genre']));
$data['file'] = $this->uri . '/rest/stream.view?id=' . $song['id'] . '&filename=' . urlencode($song['path']);
if ($this->check_remote_song($data)) {
debug_event('subsonic_catalog', 'Skipping existing song ' . $data['path'], 5);
} else {
$data['catalog'] = $this->id;
debug_event('subsonic_catalog', 'Adding song ' . $song['path'], 5, 'ampache-catalog');
if (!Song::insert($data)) {
debug_event('subsonic_catalog', 'Insert failed for ' . $song['path'], 1);
Error::add('general', T_('Unable to Insert Song - %s'), $song['path']);
Error::display('general');
flush();
} else {
$songsadded++;
}
}
}
}
} else {
echo "<p>" . T_('Song Error.') . ": " . $songs['error'] . "</p><hr />\n";
flush();
}
}
}
} else {
echo "<p>" . T_('Album Error.') . ": " . $albums['error'] . "</p><hr />\n";
flush();
}
}
}
echo "<p>" . T_('Completed updating Subsonic catalog(s).') . " " . $songsadded . " " . T_('Songs added.') . "</p><hr />\n";
flush();
// Update the last update value
$this->update_last_update();
} else {
echo "<p>" . T_('Artist Error.') . ": " . $artists['error'] . "</p><hr />\n";
flush();
}
return true;
}
示例11:
<?php
use helpers\form, core\error;
?>
<?php
echo Error::display($error);
?>
<div class="loginPage">
<h5>To register, please login or <a href="/createAccount/"><strong>create an account</strong></a></h5>
<?php
echo Form::open(array('method' => 'post', 'class' => 'form-group'));
?>
<h3>Login</h3>
<label for="usernameInput">Pawprint:
<?php
echo Form::input(array('name' => 'username', 'id' => 'username', 'class' => 'form-control', 'placeholder' => 'Pawprint'));
?>
</label>
<label for="passwordInput">Password:
<?php
echo Form::input(array('name' => 'password', 'id' => 'password', 'type' => 'password', 'class' => 'form-control', 'placeholder' => 'Password'));
?>
</label>
<br />
<br />
<?php
echo Form::input(array('type' => 'submit', 'name' => 'submit', 'value' => 'Login', 'class' => 'btn btn-default btn-primary'));
示例12: T_
</ul>
</div>
<?php
Error::display('general');
?>
<h2><?php
echo T_('Generate Config File');
?>
</h2>
<h3><?php
echo T_('Database connection');
?>
</h3>
<?php
Error::display('config');
?>
<form method="post" action="<?php
echo $web_path . "/install.php?action=create_config";
?>
" enctype="multipart/form-data" >
<div class="form-group">
<label for="web_path" class="col-sm-4 control-label"><?php
echo T_('Web Path');
?>
</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="web_path" name="web_path" value="<?php
echo scrub_out($web_path_guess);
?>
">
示例13: function
<div class="tweet-container">
<h2>Mais que se passe-t-il ?</h2>
<div class="tweet"></div>
</div>
<div id="footer">
<p class="copyright">© 2009 - 2012 HABBOBETA, Nous ne sommes pas lié ou autorisé par Sulake Corporation Oy. HABBO est une marque déposée de Sulake Corporation Oy dans l'Union Européenne, les Etats-Unis, le Japon, la république populaire de Chine et autres juridictions. Tous droits réservés.</p>
</div>
<br/>
<center>
<?php
echo $Error->display('AuthFalse');
?>
<div id="connexion" style="display:block;">
<form accept="" method="post">
<input type="text" name="username"/>
<input type="password" name="password"/>
<input type="submit" name="submit" value="Se connecter"/>
</form>
</div><br/>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '<?php
echo $config->fb_appid;
示例14: json_encode
$json['c'] = 'Le captcha n\'est pas bon';
$Error->set('captcha', 'vide');
}
} else {
$Error->set('captcha', 'vide');
$json['c'] = 'Le captcha n\'est pas bon';
}
if (!$Error->ErrorPresent()) {
$password = hashMe($_POST['password']);
$UserDB = new Db('users');
$data = array('username' => safe($_POST['pseudo'], 'SQL'), 'password' => safe($password), 'mail' => safe($_POST['email'], 'SQL'), 'rank' => safe($config->rank_default, 'SQL'), 'motto' => safe($config->motto_default, 'SQL'), 'credits' => safe($config->credit_default, 'SQL'), 'activity_points' => safe($config->activitypoints_default, 'SQL'), 'account_created' => FullDate('hc'), 'ip_reg' => safe($_SERVER['REMOTE_ADDR'], 'HTML'), 'last_online' => time());
$UserDB->save($data);
$uid = $db->getLastID();
$salt = hashMe(uniqid());
$Auth->setSaltUsers($uid);
$d = date('Y-m-d');
$req = $db->query('UPDATE habbophp_stats SET inscrits=inscrits+1 WHERE date="' . safe($d, 'SQL') . '"');
if ($req) {
$username = safe($_POST['pseudo'], 'SQL');
$password = safe($_POST['password'], 'SQL');
session_destroy();
session_start();
if ($Auth->connexion(array('username' => $username, 'password' => $password))) {
$json['fini'] = 'yep';
$json['Auth'] = $Auth->getSaltUsers($uid);
}
}
}
$json['pseudo'] = $Error->display('pseudo');
$json['email'] = $Error->display('email');
echo json_encode($json);
示例15: delete
public function delete($table, $option = array())
{
$this->table = $table;
$this->_setupFilter($option);
$result['success'] = false;
if (sizeof($this->filter) > 0) {
try {
$this->init();
if ($this->_setupQuery('DELETE')) {
$result['query'] = $this->query;
$stmt = $this->db->prepare($this->query);
if ($stmt->execute($this->values)) {
$result['success'] = true;
}
}
$this->_clearDbClassProperties();
} catch (PDOException $e) {
Error::display('PDO_ERROR', $e->getMessage());
}
}
return $result;
}