From: Pierre Habouzit (MadCoder Date: Sun, 12 Dec 2004 17:29:46 +0000 (+0000) Subject: some refactor X-Git-Tag: xorg/old~682 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=55899818f8f73255aa4146445b4b03cdf7a1949d;p=platal.git some refactor git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-66 --- diff --git a/htdocs/TESTS/__init__.php b/htdocs/TESTS/__init__.php index 01f699f..1c8e965 100644 --- a/htdocs/TESTS/__init__.php +++ b/htdocs/TESTS/__init__.php @@ -1,9 +1,10 @@ diff --git a/htdocs/TESTS/xorg_errors.inc.php b/htdocs/TESTS/xorg_errors.inc.php index 9309508..524e844 100644 --- a/htdocs/TESTS/xorg_errors.inc.php +++ b/htdocs/TESTS/xorg_errors.inc.php @@ -13,9 +13,9 @@ class TestOfXOrgErrors extends UnitTestCase { $this->assertIdentical($errors->failure, false); } - function testTrigger() { + function testTrig() { $errors = new XOrgErrors(); - $errors->trigger("Foo error"); + $errors->trig("Foo error"); $this->assertIdentical($errors->errs, Array("Foo error")); $this->assertIdentical($errors->failure, false); } diff --git a/htdocs/admin/utilisateurs.php b/htdocs/admin/utilisateurs.php index 16c3244..1444285 100644 --- a/htdocs/admin/utilisateurs.php +++ b/htdocs/admin/utilisateurs.php @@ -76,7 +76,7 @@ if (!empty($_REQUEST['login'])) { if (list($redir) = mysql_fetch_row($res)) { list($login) = split('@', $redir); } else { - $page->trigger("il n'y a pas d'utilisateur avec cet alias melix"); + $page->trig("il n'y a pas d'utilisateur avec cet alias melix"); } mysql_free_result($res); } else { @@ -88,9 +88,9 @@ if (!empty($_REQUEST['login'])) { if ($i) { $aliases = Array(); while (list($a) = mysql_fetch_row($res)) $aliases[] = $a; - $page->trigger("Il y a $i utilisateurs avec cette adresse mail : ".join(', ', $aliases)); + $page->trig("Il y a $i utilisateurs avec cette adresse mail : ".join(', ', $aliases)); } else { - $page->trigger("il n'y a pas d'utilisateur avec cette adresse mail"); + $page->trig("il n'y a pas d'utilisateur avec cette adresse mail"); } } else { list($login) = mysql_fetch_row($res); @@ -108,7 +108,7 @@ if (!empty($_REQUEST['login'])) { if ($tmp = mysql_fetch_assoc($r)) { $mr =& $tmp; } else { - $page->trigger("il n'y a pas d'utilisateur avec ce login (ou alors il a des homonymes)"); + $page->trig("il n'y a pas d'utilisateur avec ce login (ou alors il a des homonymes)"); } mysql_free_result($r); } @@ -133,11 +133,11 @@ if(isset($mr)) { case "add_fwd": $email = $_REQUEST['email']; if (!isvalid_email_redirection($email)) { - $page->trigger("invalid email $email"); + $page->trig("invalid email $email"); break; } $redirect->add_email(trim($email)); - $page->trigger("Ajout de $email effectué"); + $page->trig("Ajout de $email effectué"); break; case "del_fwd": @@ -150,7 +150,7 @@ if(isset($mr)) { $globals->db->query("DELETE FROM aliases WHERE id='{$_REQUEST['user_id']}' AND alias='$val' AND type!='a_vie' AND type!='homonyme'"); fix_bestalias($_REQUEST['user_id']); - $page->trigger($val." a été supprimé"); + $page->trig($val." a été supprimé"); break; case "add_alias": @@ -192,7 +192,7 @@ if(isset($mr)) { fputs($f,"1"); fclose($f); - $page->trigger("updaté correctement."); + $page->trig("updaté correctement."); // envoi du mail au webmaster require_once("diogenes.hermes.inc.php"); $mailer = new HermesMailer(); @@ -210,7 +210,7 @@ if(isset($mr)) { case "u_kill": require_once("user.func.inc.php"); user_clear_all_subs($_REQUEST['user_id']); - $page->trigger("'{$_REQUEST['user_id']}' a été désinscrit !"); + $page->trig("'{$_REQUEST['user_id']}' a été désinscrit !"); require_once("diogenes.hermes.inc.php"); $mailer = new HermesMailer(); $mailer->setFrom("webmaster@polytechnique.org"); diff --git a/htdocs/alias.php b/htdocs/alias.php index 3fc21ac..3bd91b1 100644 --- a/htdocs/alias.php +++ b/htdocs/alias.php @@ -49,17 +49,17 @@ if (isset($_REQUEST['alias']) and isset($_REQUEST['raison'])) { //Quelques vérifications sur l'alias (caractères spéciaux) if (!preg_match( "/^[a-zA-Z0-9\-.]{3,20}$/", $alias)) { - $page->trigger("L'adresse demandée n'est pas valide. - Vérifie qu'elle comporte entre 3 et 20 caractères - et qu'elle ne contient que des lettres non accentuées, - des chiffres ou les caractères - et ."); + $page->trig("L'adresse demandée n'est pas valide. + Vérifie qu'elle comporte entre 3 et 20 caractères + et qu'elle ne contient que des lettres non accentuées, + des chiffres ou les caractères - et ."); $page->run('error'); } else { //vérifier que l'alias n'est pas déja pris $result = $globals->db->query("SELECT 1 FROM virtual WHERE alias='$alias@{$globals->mail->alias_dom}'"); if (mysql_num_rows($result)>0) { - $page->trigger("L'alias $alias@{$globals->mail->alias_dom} a déja été attribué. - Tu ne peux donc pas l'obtenir."); + $page->trig("L'alias $alias@{$globals->mail->alias_dom} a déja été attribué. + Tu ne peux donc pas l'obtenir."); $page->run('error'); } @@ -67,8 +67,8 @@ if (isset($_REQUEST['alias']) and isset($_REQUEST['raison'])) { $it = new ValidateIterator (); while($req = $it->next()) { if ($req->type == "alias" and $req->alias == $alias) { - $page->trigger("L'alias $alias@{$globals->mail->alias_dom} a déja été demandé. - Tu ne peux donc pas l'obtenir pour l'instant."); + $page->trig("L'alias $alias@{$globals->mail->alias_dom} a déja été demandé. + Tu ne peux donc pas l'obtenir pour l'instant."); $page->run('error'); } } diff --git a/htdocs/carnet/mescontacts.php b/htdocs/carnet/mescontacts.php index b413ff7..a954250 100644 --- a/htdocs/carnet/mescontacts.php +++ b/htdocs/carnet/mescontacts.php @@ -29,7 +29,7 @@ if (isset($_REQUEST['action'])) { $user = $_REQUEST['user']; if (preg_match('/^\d+$/', $user)) { if ($globals->db->query("DELETE FROM contacts WHERE uid = '{$_SESSION['uid']}' AND contact='{$user}'")) { - $page->trigger("Contact retiré !"); + $page->trig("Contact retiré !"); } } else { if ($globals->db->query( @@ -38,7 +38,7 @@ if (isset($_REQUEST['action'])) { INNER JOIN aliases AS a ON (c.contact=a.id and a.type!='homonyme') WHERE c.uid = '{$_SESSION['uid']}' AND a.alias='$user'" )) { - $page->trigger("Contact retiré !"); + $page->trig("Contact retiré !"); } } @@ -48,11 +48,11 @@ if (isset($_REQUEST['action'])) { if (($res = $globals->db->query("SELECT id FROM aliases WHERE alias='{$_REQUEST['user']}' AND type!='homonyme'")) && mysql_num_rows($res)==1) { list($cont_user_id) = mysql_fetch_row($res); if ($globals->db->query("INSERT INTO contacts set uid = '{$_SESSION['uid']}', contact = '$cont_user_id'")) { - $page->trigger('Contact ajouté !'); + $page->trig('Contact ajouté !'); } else - $page->trigger('Contact déjà dans la liste !'); + $page->trig('Contact déjà dans la liste !'); } else { - $page->trigger('Utilisateur inexistant ou non inscrit !'); + $page->trig('Utilisateur inexistant ou non inscrit !'); } } } diff --git a/htdocs/carnet/notifs.php b/htdocs/carnet/notifs.php index 7c33735..eac57a2 100644 --- a/htdocs/carnet/notifs.php +++ b/htdocs/carnet/notifs.php @@ -29,7 +29,7 @@ if(isset($_REQUEST['promo'])) { if(preg_match('!^ *(\d{4}) *$!', $_REQUEST['promo'], $matches)) { $p = intval($matches[1]); if($p<1900 || $p>2100) { - $page->trigger("la promo entrée est invalide"); + $page->trig("la promo entrée est invalide"); } else { if(isset($_REQUEST['add_promo'])) $watch->_promos->add($p); if(isset($_REQUEST['del_promo'])) $watch->_promos->del($p); @@ -38,15 +38,15 @@ if(isset($_REQUEST['promo'])) { $p1 = intval($matches[1]); $p2 = intval($matches[2]); if($p1<1900 || $p1>2100) { - $page->trigger('la première promo de la plage entrée est invalide'); + $page->trig('la première promo de la plage entrée est invalide'); } elseif($p2<1900 || $p2>2100) { - $page->trigger('la seconde promo de la plage entrée est invalide'); + $page->trig('la seconde promo de la plage entrée est invalide'); } else { if(isset($_REQUEST['add_promo'])) $watch->_promos->addRange($p1,$p2); if(isset($_REQUEST['del_promo'])) $watch->_promos->delRange($p1,$p2); } } else { - $page->trigger("La promo (ou la plage de promo) entrée est dans un format incorrect."); + $page->trig("La promo (ou la plage de promo) entrée est dans un format incorrect."); } } diff --git a/htdocs/emails/broken.php b/htdocs/emails/broken.php index b77963d..9e6a4c7 100644 --- a/htdocs/emails/broken.php +++ b/htdocs/emails/broken.php @@ -61,7 +61,7 @@ L' $mail->setSubject("Une de tes adresse de redirection Polytechnique.org ne marche plus !!"); $mail->setTxtBody($message); $mail->send(); - $page->trigger("Mail envoyé ! :o)"); + $page->trig("Mail envoyé ! :o)"); } } elseif (array_key_exists('email', $_POST)) { $email = valide_email($_POST['email']); diff --git a/htdocs/emails/send.php b/htdocs/emails/send.php index 71801fd..99c9299 100644 --- a/htdocs/emails/send.php +++ b/htdocs/emails/send.php @@ -41,7 +41,7 @@ if (isset($_REQUEST['submit']) and $_REQUEST['submit'] == 'Envoyer' } if ($_REQUEST['to'] == '' and $_REQUEST['cc'] == '' and $autre_to == '') { - $page->trigger("Indique au moins un destinataire."); + $page->trig("Indique au moins un destinataire."); } else { require_once("diogenes.hermes.inc.php"); //$_REQUEST['contenu'] = chunk_split($_REQUEST['contenu'], 76, "\n"); // pas bon, ne tient pas compte des mots @@ -54,10 +54,10 @@ if (isset($_REQUEST['submit']) and $_REQUEST['submit'] == 'Envoyer' if (!empty($_REQUEST['bcc'])) $mymail->addBcc($_REQUEST['bcc']); $mymail->setTxtBody(wordwrap($_REQUEST['contenu'],72,"\n")); if ($mymail->send()) { - $page->trigger("Ton mail a bien été envoyé."); + $page->trig("Ton mail a bien été envoyé."); $_REQUEST = array(); } else { - $page->trigger("Erreur lors de l'envoi du courriel, réessaye."); + $page->trig("Erreur lors de l'envoi du courriel, réessaye."); } } // ! if ($_REQUEST['to'] == '' and $_REQUEST['cc'] == '') } diff --git a/htdocs/inscription/step3.php b/htdocs/inscription/step3.php index e19b7ee..5b7743b 100644 --- a/htdocs/inscription/step3.php +++ b/htdocs/inscription/step3.php @@ -27,16 +27,16 @@ $page->assign('mailorg', $mailorg); $page->assign('forlife', $forlife); if(!isvalid_email($_REQUEST["email"])) { - $page->trigger("Le champ 'E-mail' n'est pas valide."); + $page->trig("Le champ 'E-mail' n'est pas valide."); } if (!isvalid_email_redirection($_REQUEST["email"])) { - $page->trigger("\"$forlife@polytechnique.org\" doit renvoyer vers un email existant valide. + $page->trig("\"$forlife@polytechnique.org\" doit renvoyer vers un email existant valide. En particulier, il ne peut pas être renvoyé vers lui-même."); } if (!ereg("[0-3][0-9][0-1][0-9][1][9]([0-9]{2})", $_REQUEST["naissance"])) { - $page->trigger("La 'Date de naissance' n'est pas correcte. + $page->trig("La 'Date de naissance' n'est pas correcte. Elle est obligatoire pour continuer mais ne sera jamais visible sur le site par la suite."); } diff --git a/htdocs/listes/admin.php b/htdocs/listes/admin.php index 25b5028..2e9865a 100644 --- a/htdocs/listes/admin.php +++ b/htdocs/listes/admin.php @@ -32,7 +32,7 @@ if(isset($_REQUEST['add_member'])) { $arr = $client->mass_subscribe($liste, Array($_REQUEST['add_member'])); if(is_array($arr)) { foreach($arr as $addr) { - $page->trigger("{$addr[0]} inscrit."); + $page->trig("{$addr[0]} inscrit."); } } @@ -43,7 +43,7 @@ if(isset($_REQUEST['del_member'])) { if(isset($_REQUEST['add_owner'])) { if($client->add_owner($liste, $_REQUEST['add_owner'])) { - $page->trigger($_REQUEST['add_owner']." ajouté aux modérateurs."); + $page->trig($_REQUEST['add_owner']." ajouté aux modérateurs."); } } diff --git a/htdocs/listes/create.php b/htdocs/listes/create.php index 3fc793e..f7bffc7 100644 --- a/htdocs/listes/create.php +++ b/htdocs/listes/create.php @@ -57,10 +57,10 @@ ksort($members); array_unique($members); if(isset($_POST['submit'])) { if(empty($_POST['liste'])) { - $page->trigger('champs «addresse souhaitée» vide'); + $page->trig('champs «addresse souhaitée» vide'); } if(!preg_match("/^[a-zA-Z0-9\-]*$/", $_POST['liste'])) { - $page->trigger('le nom de la liste ne doit contenir que des lettres, chiffres et tirets'); + $page->trig('le nom de la liste ne doit contenir que des lettres, chiffres et tirets'); } $res = $globals->db->query("SELECT COUNT(*) FROM aliases WHERE alias='{$_POST['liste']}'"); @@ -68,19 +68,19 @@ if(isset($_POST['submit'])) { mysql_free_result($res); if($n) { - $page->trigger('cet alias est déjà pris'); + $page->trig('cet alias est déjà pris'); } if(empty($_POST['desc'])) { - $page->trigger('le sujet est vide'); + $page->trig('le sujet est vide'); } if(!count($owners)) { - $page->trigger('pas de gestionnaire'); + $page->trig('pas de gestionnaire'); } if(count($members)<4) { - $page->trigger('pas assez de membres'); + $page->trig('pas assez de membres'); } if (!$page->nb_errs()) { diff --git a/htdocs/marketing/volontaire.php b/htdocs/marketing/volontaire.php index 8ac0bc1..44ed436 100644 --- a/htdocs/marketing/volontaire.php +++ b/htdocs/marketing/volontaire.php @@ -25,11 +25,11 @@ new_admin_page('marketing/volontaire.tpl'); // traitement des paramètres éventuels if (!empty($_GET["del"])) { $globals->db->query("DELETE FROM marketing WHERE id ='{$_GET['del']}'"); - $page->trigger("Entrée effacée"); + $page->trig("Entrée effacée"); } if (!empty($_GET["done"])) { $globals->db->query("UPDATE marketing SET flags = CONCAT(flags,',envoye') WHERE id ='{$_GET['done']}'"); - $page->trigger("Entrée mise à jour"); + $page->trig("Entrée mise à jour"); } $sql = "SELECT m.id, m.expe, m.dest, m.email, diff --git a/htdocs/paiement/index.php b/htdocs/paiement/index.php index 0d63423..c2d7136 100644 --- a/htdocs/paiement/index.php +++ b/htdocs/paiement/index.php @@ -31,13 +31,13 @@ $meth = new PayMethod(isset($_REQUEST['methode']) ? $_REQUEST['methode'] : -1); $pay = new Payment(isset($_REQUEST['ref']) ? $_REQUEST['ref'] : -1); if($pay->flags->hasflag('old')){ - $page->trigger("La transaction selectionnée est périmée."); + $page->trig("La transaction selectionnée est périmée."); $pay = new Payment(); } $val = (($op=="submit") && isset($_REQUEST['montant'])) ? $_REQUEST['montant'] : $pay->montant_def; if (($e = $pay->check($val)) !== true) { - $page->trigger($e); + $page->trig($e); } if ($op=='submit') { diff --git a/htdocs/profil.php b/htdocs/profil.php index 317cab4..4a7be40 100644 --- a/htdocs/profil.php +++ b/htdocs/profil.php @@ -49,9 +49,8 @@ if (!$naissance) { if (isset($_REQUEST['birth'])) { //en cas d'erreur : if (!ereg("[0-3][0-9][0-1][0-9][1][9]([0-9]{2})", $_REQUEST['birth'])) { - $page->trigger("Date de naissance incorrecte ou incohérente."); $page->assign('etat_naissance','query'); - $page->run();//on reaffiche le formulaire + $page->trig_run("Date de naissance incorrecte ou incohérente."); } //sinon diff --git a/htdocs/recovery.php b/htdocs/recovery.php index eef8942..b2ac06e 100644 --- a/htdocs/recovery.php +++ b/htdocs/recovery.php @@ -24,8 +24,7 @@ new_skinned_page('recovery.tpl', AUTH_PUBLIC); if (isset($_REQUEST['login']) and isset($_REQUEST['birth'])) { if (!ereg("[0-3][0-9][0-1][0-9][1][9]([0-9]{2})", $_REQUEST['birth'])) { - $page->trigger("Date de naissance incorrecte ou incohérente"); - $page->run(); + $page->trig_run("Date de naissance incorrecte ou incohérente"); } $birth = sprintf("%s-%s-%s", substr($_REQUEST["birth"],4,4), substr($_REQUEST["birth"],2,2), substr($_REQUEST["birth"],0,2)); @@ -91,7 +90,7 @@ Mail envoy $logger = $_SESSION['log'] = (isset($logger) ? $logger : new DiogenesCoreLogger($uid)); $logger->log("recovery",$emails); } else { - $page->trigger("Pas de résultat correspondant aux champs entrés dans notre base de données."); + $page->trig("Pas de résultat correspondant aux champs entrés dans notre base de données."); } } diff --git a/htdocs/trombino.php b/htdocs/trombino.php index e67300a..fa753a9 100644 --- a/htdocs/trombino.php +++ b/htdocs/trombino.php @@ -33,7 +33,7 @@ if (isset($_REQUEST["ordi"]) and // net $fp = fopen($_REQUEST["photo"], 'r'); if (!$fp) { - $page->trigger("Fichier inexistant"); + $page->trig("Fichier inexistant"); } else { $attach = fread($fp, 35000); fclose($fp); diff --git a/htdocs/trombipromo.php b/htdocs/trombipromo.php index 454b6b8..0cc4562 100644 --- a/htdocs/trombipromo.php +++ b/htdocs/trombipromo.php @@ -55,7 +55,7 @@ if(isset($_REQUEST['xpromo'])) { $xpromo = intval($_REQUEST['xpromo']); if ( $xpromo<1900 || $xpromo>date('Y') || ($xpromo == -1 && $_SESSION['perms']!="admin") ) { - $page->trigger("Promotion incorrecte (saisir au format YYYY). Recommence."); + $page->trig("Promotion incorrecte (saisir au format YYYY). Recommence."); $page->assign('error', true); } else { $trombi = new Trombi('getList'); diff --git a/htdocs/webredirect.php b/htdocs/webredirect.php index 6bbb490..0af0cbf 100644 --- a/htdocs/webredirect.php +++ b/htdocs/webredirect.php @@ -27,9 +27,9 @@ if (isset($_REQUEST['submit']) and ($_REQUEST['submit'] == "Valider" or $_REQUES $globals->db->query("update auth_user_quick set redirecturl = '{$_REQUEST['url']}' where user_id = '{$_SESSION['uid']}'"); if (mysql_errno() == 0) { $_SESSION['log']->log("carva_add","http://".$_REQUEST['url']); - $page->trigger("Redirection activée vers {$_REQUEST['url']}"); + $page->trig("Redirection activée vers {$_REQUEST['url']}"); } else { - $page->trigger('Erreur de mise à jour'); + $page->trig('Erreur de mise à jour'); } } elseif (isset($_REQUEST['submit']) and $_REQUEST['submit'] == "Supprimer") { // on supprime la redirection @@ -37,9 +37,9 @@ if (isset($_REQUEST['submit']) and ($_REQUEST['submit'] == "Valider" or $_REQUES if (mysql_errno() == 0) { $_SESSION['log']->log("carva_del",$_REQUEST['url']); $_POST['url'] = ''; - $page->trigger('Redirection supprimée'); + $page->trig('Redirection supprimée'); } else { - $page->trigger('Erreur de suppression'); + $page->trig('Erreur de suppression'); } } diff --git a/include/identification.inc.php b/include/identification.inc.php index 23fe873..cc3c9e3 100644 --- a/include/identification.inc.php +++ b/include/identification.inc.php @@ -24,8 +24,7 @@ require_once('xorg.misc.inc.php'); function sortie_id($err) { global $page; new_skinned_page('inscription/step1.tpl', AUTH_PUBLIC); - $page->trigger($err); - $page->run(); + $page->trig_run($err); } $promo = intval($_REQUEST["promo"]); diff --git a/include/profil/verif_general.inc.php b/include/profil/verif_general.inc.php index 9e26d5e..0b184fe 100644 --- a/include/profil/verif_general.inc.php +++ b/include/profil/verif_general.inc.php @@ -22,7 +22,7 @@ // validité du mobile if (strlen(strtok($mobile,"<>{}@&#~\/:;?,!§*_`[]|%$^=")) < strlen($mobile)) { - $page->trigger("Le champ 'Téléphone mobile' contient un caractère interdit."); + $page->trig("Le champ 'Téléphone mobile' contient un caractère interdit."); } // correction du champ web si vide @@ -30,7 +30,7 @@ if ($web=="http://" or $web == '') { $web=''; } elseif (!preg_match("{^(https?|ftp)://[a-zA-Z0-9._%#+/?=&~-]+$}i", $web)) { // validité de l'url donnée dans web - $page->trigger("URL incorrecte dans le champ 'Page web perso', une url doit commencer par + $page->trig("URL incorrecte dans le champ 'Page web perso', une url doit commencer par http:// ou https:// ou ftp:// et ne pas contenir de caractères interdits"); } else { $web = str_replace('&', '&', $web); @@ -39,7 +39,7 @@ if ($web=="http://" or $web == '') { //validité du champ libre if (strlen(strtok($libre,"<>")) < strlen($libre)) { - $page->trigger("Le champ 'Complément libre' contient un caractère interdit."); + $page->trig("Le champ 'Complément libre' contient un caractère interdit."); } ?> diff --git a/include/profil/verif_mentor.inc.php b/include/profil/verif_mentor.inc.php index 8a60bd1..c620d83 100644 --- a/include/profil/verif_mentor.inc.php +++ b/include/profil/verif_mentor.inc.php @@ -25,7 +25,7 @@ if(isset($_POST['mentor_expertise'])){ $mentor_expertise = stripslashes($_POST['mentor_expertise']); if(!empty($mentor_expertise)){ if (strlen(strtok($mentor_expertise,"<>{}~§`|%$^")) < strlen($mentor_expertise)){//TODO: affiner la liste - $page->trigger("L'expertise contient un caractère interdit."); + $page->trig("L'expertise contient un caractère interdit."); } } } diff --git a/include/search.classes.inc.php b/include/search.classes.inc.php index 7b84062..de3ffe3 100644 --- a/include/search.classes.inc.php +++ b/include/search.classes.inc.php @@ -84,8 +84,7 @@ class ThrowError function ThrowError($explain) { global $page; - $page->trigger('Erreur : '.$explain); - $page->run(); + $page->trig_run('Erreur : '.$explain); } } diff --git a/include/xorg.page.inc.php b/include/xorg.page.inc.php index 8f380fb..254dcd7 100644 --- a/include/xorg.page.inc.php +++ b/include/xorg.page.inc.php @@ -47,7 +47,8 @@ class XorgPage extends DiogenesCorePage { global $globals; - $this->setLang('fr_FR'); + setlocale(LC_MESSAGES, 'fr_FR'); + setlocale(LC_TIME, 'fr_FR'); $this->template_dir = $globals->spoolroot."/templates/"; $this->compile_dir = $globals->spoolroot."/templates_c/"; @@ -75,7 +76,6 @@ class XorgPage extends DiogenesCorePage $this->register_block('dynamic', 'block_dynamic', false); $this->register_function('dyn', 'function_dyn', false); $this->register_function('implode', 'function_implode'); - $this->register_prefilter('triple_quote_to_gettext'); $this->register_prefilter('at_to_globals'); // if necessary, construct new session @@ -104,20 +104,6 @@ class XorgPage extends DiogenesCorePage } // }}} - // {{{ function setLang() - - function setLang($lang=null) - { - global $globals; - $locale = empty($lang) ? 'fr_FR' : $lang; - setlocale(LC_MESSAGES, $locale); - setlocale(LC_TIME, $locale); - $this->compile_id = $locale; - bindtextdomain('xorg', $globals->spoolroot.'/locale/'); - textdomain('xorg'); - } - - // }}} // {{{ function run() function run($append_to_id="") @@ -165,19 +151,27 @@ class XorgPage extends DiogenesCorePage } // }}} - // {{{ function trigger() + // {{{ function nb_errs() - function trigger($msg) + function nb_errs() { - $this->_errors->trigger($msg); + return count($this->_errors->errs); } // }}} - // {{{ function nb_errs() + // {{{ function trig() - function nb_errs() + function trig($msg) { - return count($this->_errors->errs); + $this->_errors->trig($msg); + } + + // {{{ function trig() + + function trig_run($msg) + { + $this->_errors->trig($msg); + $this->run(); } // }}} @@ -211,18 +205,6 @@ class XorgPage extends DiogenesCorePage } // }}} - // {{{ function xorg_clear_cache() - - function xorg_clear_cache($tpl) - { - if ($this->_page_type == NO_SKIN) { - return parent::clear_cache($tpl); - } else { - return parent::clear_cache(null, $tpl); - } - } - - // }}} // {{{ function make_id() function make_id($append_to_id="") diff --git a/include/xorg/errors.inc.php b/include/xorg/errors.inc.php index c4e4f3f..ea8811f 100644 --- a/include/xorg/errors.inc.php +++ b/include/xorg/errors.inc.php @@ -35,9 +35,9 @@ class XOrgErrors { } // }}} - // {{{ function trigger + // {{{ function trig - function trigger($text) { + function trig($text) { $this->errs[] = $text; } @@ -45,7 +45,7 @@ class XOrgErrors // {{{ function fail($text) { - $this->trigger($text); + $this->trig($text); $this->failure = true; } diff --git a/include/xorg/smarty.plugins.inc.php b/include/xorg/smarty.plugins.inc.php index 0d512ea..37a93eb 100644 --- a/include/xorg/smarty.plugins.inc.php +++ b/include/xorg/smarty.plugins.inc.php @@ -88,19 +88,6 @@ function escape_html(&$string) } // }}} -// {{{ function triple_quote_to_gettext() - -/** - * compilation plugin used for i18n purposes. - * - * Not used. - */ -function triple_quote_to_gettext($tpl_source, &$smarty) -{ - return preg_replace('/"""(.*?)"""/se', 'gettext(stripslashes(\'\\1\'))',$tpl_source); -} - -// }}} // {{{ function at_to_globals() /**