本文整理汇总了PHP中Error::add_error方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::add_error方法的具体用法?PHP Error::add_error怎么用?PHP Error::add_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::add_error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: translate
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
$login = $fh->get('login');
$password = _hash($fh->get('password'));
$password_confirm = _hash($fh->get('password_confirm'));
$email = $fh->get('email');
if ($password != $password_confirm) {
$error = new Error();
$error->add_error(translate('two_passwords_not'), ERROR_PAGE, __FILE__, __LINE__);
} else {
$params = array($login, $email, $password, time(), time());
$bdd->query('INSERT INTO ' . TABLE_MEMBERS . ' ( membre_login, membre_email, membre_password, membre_register, membre_last_up ) VALUES( ?, ?, ?, ?, ? )', $params);
$error = new Error();
$error->add_error(translate('inscription_ok'), ERROR_PAGE, __FILE__, __LINE__);
tpl_begin();
echo '<p>' . translate('welcome') . '</p>';
tpl_end();
exit;
}
}
tpl_begin();
?>
<h2><?php
echo translate('title');
?>
</h2>
<?php
$form->build_all();
tpl_end();
示例2: Error
<?php
require_once '../../kernel/begin.php';
$lang->setModule('membres', 'deconnexion');
if ($member->is_connected()) {
$sessions->end_session();
$member->log_out();
$error = new Error();
$error->add_error(translate('deconnexion_ok'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . '/modules/accueil/index.php');
} else {
$error = new Error();
$error->add_error(translate('already_offline'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . '/modules/accueil/index.php');
}
#tpl_begin();
#tpl_end();
示例3: XTCode
<?php
require_once '../../kernel/begin.php';
$lang->setModule('news', 'voir');
$xtcode = new XTCode();
if (!isset($_GET['id']) || empty($_GET['id'])) {
$error = new Error();
$error->add_error(translate('inexistant_news'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/news/index.php');
} else {
$_GET['id'] = (int) $_GET['id'];
$newsVerif = $bdd->count_sql(TABLE_NEWS, 'WHERE news_id = ?', $_GET['id']);
if ($newsVerif == 0) {
$error = new Error();
$error->add_error(translate('inexistant_news'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/news/index.php');
} else {
$req = $bdd->query('SELECT categorie_nom, news_id, news_titre, news_categorie, news_auteur, news_contenu, membre_login, DATE_FORMAT(news_creation, "%d/%m/%Y à %Hh%i") AS news_creation, news_modification
FROM ' . TABLE_NEWS . ' LEFT JOIN ' . TABLE_MEMBERS . ' ON membre_id = news_auteur LEFT JOIN ' . TABLE_NEWS_CATS . ' ON categorie_id = news_categorie WHERE news_id = ? ORDER BY news_id DESC', $_GET['id']);
while ($data = $bdd->fetch($req)) {
$data['news_titre'] = htmlspecialchars(stripslashes($data['news_titre']));
$data['categorie_nom'] = htmlspecialchars(stripslashes($data['categorie_nom']));
$data['news_contenu'] = stripslashes(XTCode_decode($data['news_contenu']));
$breadcrumb->add(translate('list_news'), 'modules/news/index.php');
$breadcrumb->add($data['news_titre']);
tpl_begin();
?>
<h1><?php
echo $data['news_titre'];
?>
</h1>
<p style="font-size: 0.9em; color: rgb(83, 88, 106); margin-left: 20px; padding-left: 25px; font-weight: bold; background: url('<?php
echo DESIGN;
示例4: translate
if (is_dir(ROOT . $dirs[$k] . '/' . $nameZip)) {
$error = new Error();
$error->add_error(translate('file_already_exists'), ERROR_PAGE, __FILE__, __LINE__);
} else {
if (($dirDbFile = ROOT . 'cache/tmp/' . $dirs[$k] . '/' . $nameZip . 'db/db.sql') && is_file($dirDbFile)) {
$bdd->extract_files($dirDbFile);
}
#rm( ROOT . 'cache/tmp/' . $dirs[$k] . '/' . $nameZip . 'db/' );
rename(ROOT . 'cache/tmp/' . $dirs[$k] . '/' . $nameZip, ROOT . $dirs[$k] . '/' . $nameZip);
rm(ROOT . 'cache/tmp/' . $dirs[$k] . '/' . $nameZip);
$error = new Error();
$error->add_error(translate('file_success'), ERROR_PAGE, __FILE__, __LINE__);
}
} else {
$error = new Error();
$error->add_error(translate('file_fail'), ERROR_PAGE, __FILE__, __LINE__);
}
}
}
tpl_begin();
?>
<p><?php
echo translate('help_message');
?>
</p>
<?php
foreach ($formulaires as $type => $f) {
echo '<p>' . translate($type . '_help') . '</p>';
$f->build_all();
}
tpl_end();
示例5: foreach
$i = 0;
foreach ($configsDatas as $k => $config) {
$i++;
$form->add_input($configurations['config_name'] . '_config_entry_name_' . $i, $configurations['config_name'] . '_config_entry_name_' . $i, translate('config_entry_name'))->setValue(htmlspecialchars($k));
$form->add_textarea($configurations['config_name'] . '_config_entry_value_' . $i, $configurations['config_name'] . '_config_entry_value_' . $i, translate('config_entry_value'))->setValue(stripslashes(htmlspecialchars($config)));
}
$form->add_input($configurations['config_name'] . '_config_lang', 'config_lang', translate('config_lang'))->setValue($configurations['config_lang']);
$form->add_button();
$listeForms[$configurations['config_name']] = $form;
unset($form);
}
foreach ($listeForms as $nomConfig => $formulaire) {
$traitement = new FormHandle($formulaire);
$traitement->handle();
if ($traitement->okay()) {
$langSite = $traitement->get($nomConfig . '_config_lang');
$configValues = array();
for ($i = 1; ($nomEntree = $traitement->get($nomConfig . '_config_entry_name_' . $i)) != NULL && ($valeurEntree = $traitement->get($nomConfig . '_config_entry_value_' . $i)) != NULL; $i++) {
$configValues[$nomEntree] = addslashes($valeurEntree);
}
$configValues = serialize($configValues);
$bdd->query('UPDATE ' . TABLE_CONFIG . ' SET config_lang = ?, config_value = ? WHERE config_name = ?', array($langSite, $configValues, $nomConfig));
$error = new Error();
$error->add_error(translate('modification_success'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/admin/config.php');
}
}
tpl_begin();
foreach ($listeForms as $form) {
$form->build_all();
}
tpl_end();
示例6: translate
require_once '../../kernel/begin.php';
require_once 'parser.class.php';
$lang->setModule('xtc_builder', 'index');
$form = new Form('Titre', 'post');
$form->add_fieldset();
$form->add_input('nom_page', 'nom_page', translate('page_name'));
$form->add_button('button', 'include_insert', translate('include_insert'))->setonClick('insert( \'texTop\', \'Include <page.php>\' );')->setInline(true);
$form->add_button('button', 'load_insert', translate('load_insert'))->setonClick('insert( \'texTop\', \'Load <page>\' );')->setInline(true);
$form->add_button('button', 'requetesql_insert', translate('requetesql_insert'))->setonClick('insert( \'texTop\', \'Requete <table,type,champs,conditions,order,limit>\' );')->setInline(true);
$form->add_button('button', 'debut_insert', translate('debut_insert'))->setonClick('insert( \'texTop\', \'AfficDebut\' );')->setInline(true);
$form->add_button('button', 'fin_insert', translate('fin_insert'))->setonClick('insert( \'texTop\', \'AfficFin\' );')->setInline(true);
$form->add_button('button', 'html_insert', translate('html_insert'))->setonClick('insert( \'texTop\', \'Html\\n{\\n}\' );')->setInline(true);
$form->add_textarea('texTop', 'texTop', 'Contenu à parser');
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
$contenuAParser = $fh->get('texTop');
$parserPage = new xtc_builder_page($contenuAParser);
$md5Page = md5($contenuAParser);
$bdd->query('INSERT INTO ' . TABLE_PAGES_PHP . ' VALUES( ?, ? )', array($md5Page, $fh->get('nom_page')));
file_put_contents('cache/pagesOriginales/' . $md5Page . '.php', $parserPage);
file_put_contents('cache/pagesPHP/' . $md5Page . '.php', $parserPage->parse_content());
$error = new Error();
$error->add_error(translate('page_success'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/accueil/index.php');
}
tpl_begin();
echo '<p><a href="formulaire.php" target="_blank">Créer un formulaire.</a></p>';
echo translate('presentation');
$form->build_all();
tpl_end();
示例7: translate
if (isset($_GET['fichier'])) {
$fichier = $_GET['fichier'];
$verif = ROOT . 'kernel/templates/' . $fichier . '.tpl';
if (in_array($verif, $listeFichiers)) {
$contenu = file_get_contents($verif);
$form = new Form(translate('file_form'), 'post');
$form->add_fieldset();
$form->add_textarea('contenu', 'contenu', translate('content_file'))->setValue($contenu);
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
$contenu = $fh->get('contenu');
file_put_contents($verif, $contenu);
$error = new Error();
$error->add_error(translate('modification_ok'), ERROR_PAGE, __FILE__, __LINE__);
} else {
$form->build_all();
}
}
}
?>
<p><?php
echo translate('help_message');
?>
</p>
<ul>
<?php
foreach ($listeFichiers as $fichier) {
$lien = str_replace(array('.tpl', ROOT . 'kernel/templates/'), '', $fichier);
echo '<li><a href="?fichier=' . $lien . '">' . $lien . '</a></li>';
示例8: error
function error($label, $type = ERROR_GLOBAL, $file = NULL, $line = NULL, $next = false)
{
$error = new Error();
$error->add_error($label, $type, $file, $line, $next);
}
示例9: XTCode
<?php
require_once '../../kernel/begin.php';
$lang->setModule('news', 'ajouter');
$xtcode = new XTCode();
$form = new Form(translate('title_add_form'));
$form->add_fieldset();
$form->add_input('news_title', 'news_title', translate('news_title'));
$form->add_textarea('news_content', 'news_content', translate('news_content'));
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
$error = new Error();
$error->add_error(translate('addition_success'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/news/index.php');
} else {
tpl_begin();
$form->build_all();
tpl_end();
}
示例10: while
<table>
<thead>
<tr>
<th>#</th>
<th>Pseudo</th>
</tr>
</thead>
<tbody>
<?php
if ($bdd->count_sql(TABLE_MEMBERS) > 1) {
$query = $bdd->query('SELECT membre_id, membre_login FROM ' . TABLE_MEMBERS . ' WHERE membre_id > 0');
while ($fetch = $bdd->fetch($query)) {
echo '
<tr>
<td>' . $fetch['membre_id'] . '</td>
<td><a href="' . ROOTU . 'modules/membres/profil.php?idMembre=' . $fetch['membre_id'] . '">' . htmlentities($fetch['membre_login']) . '</a></td>
</tr>';
}
} else {
$error = new Error();
$error->add_error('Aucun membre à afficher.', ERROR_PAGE, 'modules/members/liste.php', __LINE__);
echo '
<tr>
<td colspan="2">Aucun membre</td>
</tr>';
}
?>
</tbody>
</table>
<?php
tpl_end();
示例11: basename
<?php
$lang->setModule('admin', str_replace('.php', '', basename($_SERVER['PHP_SELF'])));
$tpl->menus()->setType(2);
if (!$member->is_connected()) {
$error = new Error();
$error->add_error(translate('not_online'), ERROR_GLOBAL, __FILE__, __LINE__);
tpl_begin();
tpl_end();
die;
} elseif ($member->getRank() < RANK_ADMIN) {
$error = new Error();
$error->add_error(translate('not_admin'), ERROR_GLOBAL, __FILE__, __LINE__);
tpl_begin();
tpl_end();
die;
}
示例12: Form
$form = new Form(translate('title_form'), 'post');
$form->add_fieldset();
$form->add_input('login', 'login', translate('login_form'));
$form->add_input('password', 'password', translate('password_form'), 'password');
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
$login = $fh->get('login');
$password = _hash($fh->get('password'));
$params = array($login, $password);
$cSql = $bdd->count_sql(TABLE_MEMBERS, 'WHERE membre_login = ? AND membre_password = ?', $params);
if ($cSql == 0) {
$error = new Error();
$error->add_error(translate('inexistant_member'), ERROR_PAGE, __FILE__, __LINE__);
} else {
$requete = $bdd->query('SELECT * FROM ' . TABLE_MEMBERS . ' WHERE membre_login = ? AND membre_password = ?', $params);
$resultats = $bdd->fetch($requete);
$hashKey = _hash($resultats['membre_id'] . $login, 'XTC_CMS');
$sessions->add_session('pseudo', $login, '__member')->add_session('id', $resultats['membre_id'], '__member')->add_session('key', $hashKey, '__member')->add_session('isConnected', true, '__member');
$member->log_in($resultats['membre_id']);
$error = new Error();
$error->add_error(translate('connexion_ok'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/accueil/index.php');
}
}
}
tpl_begin();
if (isset($form)) {
$form->build_all();
}
tpl_end();
示例13: Form
?>
</p>
<p>Biographie : <?php
echo XTCode_decode($data['membre_biographie']);
?>
</p>
<?php
break;
case 'modifier':
$form = new Form(translate('edit_profile'), 'post');
$form->add_fieldset();
$form->add_input('login', 'login', translate('login_form'), 'text', 'disabled')->setValue(htmlentities($data['membre_login']));
$form->add_input('email', 'email', translate('email_form'))->setValue(htmlentities($data['membre_email']));
$form->add_input('citation', 'citation', translate('citation_form'))->setValue(htmlentities($data['membre_citation']));
$form->add_textarea('biographie', 'biographie', translate('biographie_form'))->setValue($data['membre_biographie']);
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
$newEmail = $fh->get('email');
$newCitation = $fh->get('citation');
$newBiographie = $fh->get('biographie');
$bdd->query('UPDATE ' . TABLE_MEMBERS . ' SET membre_email = ?, membre_citation = ?, membre_biographie = ? WHERE membre_id = ?', array($newEmail, $newCitation, $newBiographie));
$error = new Error();
$error->add_error(translate('edit_ok'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/membres/connexion.php');
goto voirAction;
}
$form->build_all();
break;
}
tpl_end();
示例14: Form
<?php
require_once '../../kernel/begin.php';
$lang->setModule('accueil', 'contact');
$form = new Form(translate('contact_form'));
$form->add_fieldset();
$form->add_input('message_objet', 'message_objet', translate('message_objet_form'));
$form->add_input('message_email', 'message_email', translate('message_email_form'))->setRequired(false);
$form->add_textarea('message_contenu', 'message_contenu', translate('message_contenu_form'));
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
$messageObjet = $fh->get('message_objet');
$messageEmail = $fh->get('message_email');
$messageContenu = $fh->get('message_contenu');
$bdd->query('INSERT INTO ' . TABLE_CONTACT . ' ( contact_objet, contact_message, contact_email, contact_date, contact_ip ) VALUES( ?, ?, ?, ?, ? )', array($messageObjet, $messageContenu, $messageEmail, time(), get_ip()));
$error = new Error();
$error->add_error(translate('message_send_okay'), ERROR_PAGE, __FILE__, __LINE__);
}
tpl_begin();
$form->build_all();
tpl_end();
示例15: Form
$form = new Form(translate('title_edit_form'));
$form->add_fieldset();
$form->add_input('cours_nom', 'cours_nom', translate('cours_name_form'))->setValue($donneesTutoriel['cours_nom']);
$form->add_textarea('cours_introduction', 'cours_introduction', translate('cours_intro_form'))->setValue($donneesTutoriel['cours_texte']);
$form->add_textarea('cours_conclusion', 'cours_conclusion', translate('cours_conclu_form'))->setValue($donneesTutoriel['cours_texte']);
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
$dataCours['coursNom'] = $fh->get('cours_nom');
$dataCours['coursIntro'] = $fh->get('cours_introduction');
$dataCours['coursConclusion'] = $fh->get('cours_conclusion');
$cours = new Cours();
$cours->modifier_element($dataCours);
$error = new Error();
$error->add_error(translate('cours_edit_okay'), ERROR_PAGE, __FILE__, __LINE__);
}
break;
case 'deplacerTutoriel':
$idTutoriel = intval($_GET['idTutoriel']);
$donneesTutoriel = $bdd->requete('SELECT cours_level, cours_id, cours_nom, cours_texte, cours_gauche, cours_droite FROM ' . TABLE_COURS . ' WHERE cours_id = ?', $idTutoriel);
$form = new Form(translate('title_edit_form'));
$form->add_fieldset();
$listeCategories = $form->add_list('cours_categorie', 'cours_categorie', translate('cours_category_form'));
$requeteCategories = $bdd->query('SELECT cours_level, cours_id, cours_nom, cours_gauche, cours_droite FROM ' . TABLE_COURS . ' WHERE cours_type = 0 ORDER BY cours_gauche');
$categorieDuTutoriel = 0;
while ($donneesCategories = $bdd->fetch($requeteCategories)) {
$suffixe = NULL;
for ($i = 0; $i < $donneesCategories['cours_level']; $i++) {
$suffixe .= '--';
}