@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | if (!isset($options['titre'])) { |
| 66 | 66 | $balise_img = chercher_filtre('balise_img'); |
| 67 | - $img = $balise_img(chemin_image('image-24.png'),'', 'cadre-icone'); |
|
| 67 | + $img = $balise_img(chemin_image('image-24.png'), '', 'cadre-icone'); |
|
| 68 | 68 | $libelles = pipeline('libeller_logo', $GLOBALS['logo_libelles']); |
| 69 | 69 | $libelle = (($id_objet or $objet != 'rubrique') ? $objet : 'racine'); |
| 70 | 70 | if (isset($libelles[$libelle])) { |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | switch ($objet) { |
| 78 | 78 | case 'article': |
| 79 | - $libelle .= ' ' . aider('logoart'); |
|
| 79 | + $libelle .= ' '.aider('logoart'); |
|
| 80 | 80 | break; |
| 81 | 81 | case 'breve': |
| 82 | - $libelle .= ' ' . aider('breveslogo'); |
|
| 82 | + $libelle .= ' '.aider('breveslogo'); |
|
| 83 | 83 | break; |
| 84 | 84 | case 'rubrique': |
| 85 | - $libelle .= ' ' . aider('rublogo'); |
|
| 85 | + $libelle .= ' '.aider('rublogo'); |
|
| 86 | 86 | break; |
| 87 | 87 | default: |
| 88 | 88 | break; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $options['titre'] = $img . $libelle; |
|
| 91 | + $options['titre'] = $img.$libelle; |
|
| 92 | 92 | } |
| 93 | 93 | if (!isset($options['editable'])) { |
| 94 | 94 | include_spip('inc/autoriser'); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | foreach ($etats as $etat) { |
| 114 | 114 | $logo = $chercher_logo($id_objet, $_id_objet, $etat); |
| 115 | 115 | if ($logo) { |
| 116 | - $res['logo_' . $etat] = $logo[0]; |
|
| 116 | + $res['logo_'.$etat] = $logo[0]; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | // pas de logo_on -> pas de formulaire pour le survol |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | strtolower(pathinfo($file['name'], PATHINFO_EXTENSION)), |
| 177 | 177 | $extensions_possibles |
| 178 | 178 | )) { |
| 179 | - $erreurs['logo_' . $etat] = _L('Extension non reconnue'); |
|
| 179 | + $erreurs['logo_'.$etat] = _L('Extension non reconnue'); |
|
| 180 | 180 | } |
| 181 | 181 | } elseif ($file and $file['error'] != 0 and isset($file['msg'])) { |
| 182 | 182 | $erreurs['message_erreur'] = $file['msg']; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | include_spip('inc/documents'); |
| 262 | 262 | $sources = array(); |
| 263 | 263 | foreach (array('on', 'off') as $etat) { |
| 264 | - $logo = 'logo_' . $etat; |
|
| 264 | + $logo = 'logo_'.$etat; |
|
| 265 | 265 | if (isset($_FILES[$logo])) { |
| 266 | 266 | if ($_FILES[$logo]['error'] == 0) { |
| 267 | 267 | $sources[$etat] = $_FILES[$logo]; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $mode = preg_replace(",\W,", '', $mode); |
| 41 | 41 | if ($mode) { |
| 42 | 42 | // chercher dans la base |
| 43 | - $mode_document = 'logo' . $mode; |
|
| 43 | + $mode_document = 'logo'.$mode; |
|
| 44 | 44 | $objet = objet_type($_id_objet); |
| 45 | 45 | $doc = sql_fetsel('D.*', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', "D.mode=".sql_quote($mode_document)." AND L.objet=".sql_quote($objet)." AND id_objet=".intval($id)); |
| 46 | 46 | if ($doc) { |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | if ($compat_old_logos) { |
| 53 | 53 | # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() |
| 54 | 54 | $type = type_du_logo($_id_objet); |
| 55 | - $nom = $type . $mode . intval($id); |
|
| 55 | + $nom = $type.$mode.intval($id); |
|
| 56 | 56 | |
| 57 | 57 | foreach ($GLOBALS['formats_logos'] as $format) { |
| 58 | - if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { |
|
| 58 | + if (@file_exists($d = (_DIR_LOGOS.$nom.'.'.$format))) { |
|
| 59 | 59 | return array($d, _DIR_LOGOS, $nom, $format, @filemtime($d)); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $GLOBALS['contexte'] = calculer_contexte(); |
| 39 | 39 | $page = array('contexte_implicite' => calculer_contexte_implicite()); |
| 40 | - $page['contexte_implicite']['cache'] = $fond . preg_replace(',\.[a-zA-Z0-9]*$,', '', |
|
| 40 | + $page['contexte_implicite']['cache'] = $fond.preg_replace(',\.[a-zA-Z0-9]*$,', '', |
|
| 41 | 41 | preg_replace('/[?].*$/', '', $GLOBALS['REQUEST_URI'])); |
| 42 | 42 | // Cette fonction est utilisee deux fois |
| 43 | 43 | $cacher = charger_fonction('cacher', 'public', true); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $lastmodified, $connect); |
| 119 | 119 | if ($page === '') { |
| 120 | 120 | $erreur = _T('info_erreur_squelette2', |
| 121 | - array('fichier' => spip_htmlspecialchars($fond) . '.' . _EXTENSION_SQUELETTES)); |
|
| 121 | + array('fichier' => spip_htmlspecialchars($fond).'.'._EXTENSION_SQUELETTES)); |
|
| 122 | 122 | erreur_squelette($erreur); |
| 123 | 123 | // eviter des erreurs strictes ensuite sur $page['cle'] en PHP >= 5.4 |
| 124 | 124 | $page = array('texte' => '', 'erreur' => $erreur); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | and !isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) |
| 161 | 161 | and !isset($page['entetes']["Last-Modified"]) |
| 162 | 162 | ) { |
| 163 | - $page['entetes']["Last-Modified"] = gmdate("D, d M Y H:i:s", $lastmodified) . " GMT"; |
|
| 163 | + $page['entetes']["Last-Modified"] = gmdate("D, d M Y H:i:s", $lastmodified)." GMT"; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // fermer la connexion apres les headers si requete HEAD |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | 'spip_version_code' => $GLOBALS['spip_version_code'], |
| 226 | 226 | ); |
| 227 | 227 | if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { |
| 228 | - $contexte_implicite['host'] .= "|" . $_SERVER['HTTP_X_FORWARDED_HOST']; |
|
| 228 | + $contexte_implicite['host'] .= "|".$_SERVER['HTTP_X_FORWARDED_HOST']; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | return $contexte_implicite; |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | * et il ne doit etre utilise que pour trouver le id_xx si pas de $id fourni (cas appel depuis styliser) |
| 498 | 498 | * @return string |
| 499 | 499 | */ |
| 500 | -function styliser_modele($modele, $id, $contexte=null) { |
|
| 500 | +function styliser_modele($modele, $id, $contexte = null) { |
|
| 501 | 501 | static $styliseurs = null; |
| 502 | 502 | if (is_null($styliseurs)) { |
| 503 | 503 | $tables_objet = lister_tables_objets_sql(); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | if (is_null($id)) { |
| 526 | - $msg = "modeles/$modele : " . _T('zbug_parametres_inclus_incorrects', array('param' => "id/$primary")); |
|
| 526 | + $msg = "modeles/$modele : "._T('zbug_parametres_inclus_incorrects', array('param' => "id/$primary")); |
|
| 527 | 527 | erreur_squelette($msg); |
| 528 | 528 | // on passe id=0 au routeur pour tomber sur le modele par defaut et eviter une seconde erreur sur un modele inexistant |
| 529 | 529 | $id = 0; |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if (preg_match(',^[a-z0-9_]+$,', $soustype)) { |
| 573 | - if (!trouve_modele($fond = ($type . '_' . $soustype))) { |
|
| 573 | + if (!trouve_modele($fond = ($type.'_'.$soustype))) { |
|
| 574 | 574 | $fond = ''; |
| 575 | 575 | $class = $soustype; |
| 576 | 576 | } |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | |
| 586 | 586 | return false; |
| 587 | 587 | } |
| 588 | - $fond = 'modeles/' . $fond; |
|
| 588 | + $fond = 'modeles/'.$fond; |
|
| 589 | 589 | // Creer le contexte |
| 590 | 590 | $contexte = $env; |
| 591 | 591 | $contexte['dir_racine'] = _DIR_RACINE; # eviter de mixer un cache racine et un cache ecrire (meme si pour l'instant les modeles ne sont pas caches, le resultat etant different il faut que le contexte en tienne compte |
@@ -624,13 +624,13 @@ discard block |
||
| 624 | 624 | // Regarder si le modele tient compte des liens (il *doit* alors indiquer |
| 625 | 625 | // spip_lien_ok dans les classes de son conteneur de premier niveau ; |
| 626 | 626 | // sinon, s'il y a un lien, on l'ajoute classiquement |
| 627 | - if (strstr(' ' . ($classes = extraire_attribut($retour, 'class')) . ' ', |
|
| 627 | + if (strstr(' '.($classes = extraire_attribut($retour, 'class')).' ', |
|
| 628 | 628 | 'spip_lien_ok')) { |
| 629 | 629 | $retour = inserer_attribut($retour, 'class', |
| 630 | 630 | trim(str_replace(' spip_lien_ok ', ' ', " $classes "))); |
| 631 | 631 | } else { |
| 632 | 632 | if ($lien) { |
| 633 | - $retour = "<a href='" . $lien['href'] . "' class='" . $lien['class'] . "'>" . $retour . "</a>"; |
|
| 633 | + $retour = "<a href='".$lien['href']."' class='".$lien['class']."'>".$retour."</a>"; |
|
| 634 | 634 | } |
| 635 | 635 | } |
| 636 | 636 | |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | return $page; |
| 655 | 655 | } |
| 656 | 656 | // eval $page et affecte $res |
| 657 | - include _ROOT_RESTREINT . "public/evaluer_page.php"; |
|
| 657 | + include _ROOT_RESTREINT."public/evaluer_page.php"; |
|
| 658 | 658 | |
| 659 | 659 | // Lever un drapeau (global) si le fond utilise #SESSION |
| 660 | 660 | // a destination de public/parametrer |
@@ -717,14 +717,14 @@ discard block |
||
| 717 | 717 | if (($pos = strpos($head, '<head>')) !== false) { |
| 718 | 718 | $head = substr_replace($head, $bbase, $pos + 6, 0); |
| 719 | 719 | } elseif (preg_match(",<head[^>]*>,i", $head, $r)) { |
| 720 | - $head = str_replace($r[0], $r[0] . $bbase, $head); |
|
| 720 | + $head = str_replace($r[0], $r[0].$bbase, $head); |
|
| 721 | 721 | } |
| 722 | - $texte = $head . substr($texte, $poshead); |
|
| 722 | + $texte = $head.substr($texte, $poshead); |
|
| 723 | 723 | // gerer les ancres |
| 724 | 724 | $base = $_SERVER['REQUEST_URI']; |
| 725 | 725 | // pas de guillemets ni < dans l'URL qu'on insere dans le HTML |
| 726 | - if (strpos($base,"'") or strpos($base,'"') or strpos($base,'<')) { |
|
| 727 | - $base = str_replace(array("'",'"','<'),array("%27",'%22','%3C'), $base); |
|
| 726 | + if (strpos($base, "'") or strpos($base, '"') or strpos($base, '<')) { |
|
| 727 | + $base = str_replace(array("'", '"', '<'), array("%27", '%22', '%3C'), $base); |
|
| 728 | 728 | } |
| 729 | 729 | if (strpos($texte, "href='#") !== false) { |
| 730 | 730 | $texte = str_replace("href='#", "href='$base#", $texte); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | if ($fichier) { |
| 109 | 109 | $code = "quete_logo_file($doc, $qconnect)"; |
| 110 | 110 | } else { |
| 111 | - $code = "quete_logo_document($doc, " . ($lien ? $lien : "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)"; |
|
| 111 | + $code = "quete_logo_document($doc, ".($lien ? $lien : "''").", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)"; |
|
| 112 | 112 | } |
| 113 | 113 | // (x=non-faux ? y : '') pour affecter x en retournant y |
| 114 | 114 | if ($p->descr['documents']) { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | // demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0} |
| 127 | 127 | if ($coord_x or $coord_y) { |
| 128 | - $code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))"; |
|
| 128 | + $code = "filtrer('image_graver',filtrer('image_reduire',".$code.", '$coord_x', '$coord_y'))"; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $p->code = $code; |
@@ -158,14 +158,12 @@ discard block |
||
| 158 | 158 | * Code compilé retournant le chemin du logo ou le code HTML du logo. |
| 159 | 159 | **/ |
| 160 | 160 | function logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $_lien, $p, $suite) { |
| 161 | - $code = "quete_logo('$id_objet', '" . |
|
| 162 | - (($suite == '_SURVOL') ? 'off' : |
|
| 163 | - (($suite == '_NORMAL') ? 'on' : 'ON')) . |
|
| 164 | - "', $_id_objet," . |
|
| 161 | + $code = "quete_logo('$id_objet', '". |
|
| 162 | + (($suite == '_SURVOL') ? 'off' : (($suite == '_NORMAL') ? 'on' : 'ON')). |
|
| 163 | + "', $_id_objet,". |
|
| 165 | 164 | (($suite == '_RUBRIQUE') ? |
| 166 | - champ_sql('id_rubrique', $p) : |
|
| 167 | - (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) . |
|
| 168 | - ', ' . intval($fichier) . ')'; |
|
| 165 | + champ_sql('id_rubrique', $p) : (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")). |
|
| 166 | + ', '.intval($fichier).')'; |
|
| 169 | 167 | |
| 170 | 168 | if ($fichier) { |
| 171 | 169 | return $code; |
@@ -173,5 +171,5 @@ discard block |
||
| 173 | 171 | |
| 174 | 172 | $align = preg_replace(",\W,", "", $align); |
| 175 | 173 | |
| 176 | - return "quete_html_logo($code, '$align', " .($_lien ? $_lien : "''") .")"; |
|
| 174 | + return "quete_html_logo($code, '$align', ".($_lien ? $_lien : "''").")"; |
|
| 177 | 175 | } |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | //$md5next = $regs[4]; |
| 54 | 54 | } // si envoi non crypte, crypter maintenant |
| 55 | 55 | elseif ($pass) { |
| 56 | - $row = sql_fetsel("alea_actuel, alea_futur", "spip_auteurs", "login=" . sql_quote($login, $serveur, 'text'), '', '', |
|
| 56 | + $row = sql_fetsel("alea_actuel, alea_futur", "spip_auteurs", "login=".sql_quote($login, $serveur, 'text'), '', '', |
|
| 57 | 57 | '', '', $serveur); |
| 58 | 58 | |
| 59 | 59 | if ($row) { |
| 60 | 60 | include_spip('auth/sha256.inc'); |
| 61 | - $shapass = spip_sha256($row['alea_actuel'] . $pass); |
|
| 62 | - $shanext = spip_sha256($row['alea_futur'] . $pass); |
|
| 63 | - $md5pass = md5($row['alea_actuel'] . $pass); |
|
| 61 | + $shapass = spip_sha256($row['alea_actuel'].$pass); |
|
| 62 | + $shanext = spip_sha256($row['alea_futur'].$pass); |
|
| 63 | + $md5pass = md5($row['alea_actuel'].$pass); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $row = sql_fetsel("*", "spip_auteurs", |
| 73 | - "login=" . sql_quote($login, $serveur, 'text') . " AND pass=" . sql_quote($shapass, $serveur, |
|
| 74 | - 'text') . " AND statut<>'5poubelle'", '', '', '', '', $serveur); |
|
| 73 | + "login=".sql_quote($login, $serveur, 'text')." AND pass=".sql_quote($shapass, $serveur, |
|
| 74 | + 'text')." AND statut<>'5poubelle'", '', '', '', '', $serveur); |
|
| 75 | 75 | |
| 76 | 76 | // compat avec les anciennes bases en md5 |
| 77 | 77 | if (!$row and $md5pass) { |
| 78 | 78 | $row = sql_fetsel("*", "spip_auteurs", |
| 79 | - "login=" . sql_quote($login, $serveur, 'text') . " AND pass=" . sql_quote($md5pass, $serveur, |
|
| 80 | - 'text') . " AND statut<>'5poubelle'", '', '', '', '', $serveur); |
|
| 79 | + "login=".sql_quote($login, $serveur, 'text')." AND pass=".sql_quote($md5pass, $serveur, |
|
| 80 | + 'text')." AND statut<>'5poubelle'", '', '', '', '', $serveur); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // login/mot de passe incorrect |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | 'alea_actuel' => 'alea_futur', |
| 95 | 95 | 'pass' => sql_quote($shanext, $serveur, 'text'), |
| 96 | 96 | 'alea_futur' => sql_quote(creer_uniqid(), $serveur, 'text') |
| 97 | - ), "id_auteur=" . $row['id_auteur'] . ' AND pass IN (' . sql_quote($shapass, $serveur, |
|
| 98 | - 'text') . ', ' . sql_quote($md5pass, $serveur, 'text') . ')', '', $serveur); |
|
| 97 | + ), "id_auteur=".$row['id_auteur'].' AND pass IN ('.sql_quote($shapass, $serveur, |
|
| 98 | + 'text').', '.sql_quote($md5pass, $serveur, 'text').')', '', $serveur); |
|
| 99 | 99 | // En profiter pour verifier la securite de tmp/ |
| 100 | 100 | // Si elle ne fonctionne pas a l'installation, prevenir |
| 101 | 101 | if (!verifier_htaccess(_DIR_TMP) and defined('_ECRIRE_INSTALL')) { |
@@ -131,16 +131,16 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | // javascript qui gere la securite du login en evitant de faire circuler le pass en clair |
| 133 | 133 | $flux['data'] .= |
| 134 | - ($compat_md5 ? '<script type="text/javascript" src="' . _DIR_JAVASCRIPT . 'md5.js"></script>' : '') |
|
| 135 | - . '<script type="text/javascript" src="' . _DIR_JAVASCRIPT . 'login-sha-min.js"></script>' |
|
| 134 | + ($compat_md5 ? '<script type="text/javascript" src="'._DIR_JAVASCRIPT.'md5.js"></script>' : '') |
|
| 135 | + . '<script type="text/javascript" src="'._DIR_JAVASCRIPT.'login-sha-min.js"></script>' |
|
| 136 | 136 | . '<script type="text/javascript">/*<![CDATA[*/' |
| 137 | - . "var login_info={'alea_actuel':'" . $flux['args']['contexte']['_alea_actuel'] . "'," |
|
| 138 | - . "'alea_futur':'" . $flux['args']['contexte']['_alea_futur'] . "'," |
|
| 139 | - . "'login':'" . $flux['args']['contexte']['var_login'] . "'," |
|
| 140 | - . "'page_auteur': '" . generer_url_public('informer_auteur') . "'," |
|
| 137 | + . "var login_info={'alea_actuel':'".$flux['args']['contexte']['_alea_actuel']."'," |
|
| 138 | + . "'alea_futur':'".$flux['args']['contexte']['_alea_futur']."'," |
|
| 139 | + . "'login':'".$flux['args']['contexte']['var_login']."'," |
|
| 140 | + . "'page_auteur': '".generer_url_public('informer_auteur')."'," |
|
| 141 | 141 | . "'informe_auteur_en_cours':false," |
| 142 | 142 | . "'attente_informe':0," |
| 143 | - . "'compat_md5':" . ($compat_md5 ? "true" : "false") . "};" |
|
| 143 | + . "'compat_md5':".($compat_md5 ? "true" : "false")."};" |
|
| 144 | 144 | . "jQuery(function(){ |
| 145 | 145 | jQuery('#var_login').change(actualise_auteur); |
| 146 | 146 | jQuery('form#formulaire_login').submit(login_submit); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | return _T('info_login_trop_court_car_pluriel', array('nb' => _LOGIN_TROP_COURT)); |
| 183 | 183 | } else { |
| 184 | 184 | $n = sql_countsel('spip_auteurs', |
| 185 | - "login=" . sql_quote($new_login) . " AND id_auteur!=" . intval($id_auteur) . " AND statut!='5poubelle'", '', '', |
|
| 185 | + "login=".sql_quote($new_login)." AND id_auteur!=".intval($id_auteur)." AND statut!='5poubelle'", '', '', |
|
| 186 | 186 | $serveur); |
| 187 | 187 | if ($n) { |
| 188 | 188 | return _T('info_login_existant'); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | 208 | if (!$id_auteur = intval($id_auteur) |
| 209 | - or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur) |
|
| 209 | + or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur='.intval($id_auteur), '', '', '', '', $serveur) |
|
| 210 | 210 | ) { |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | // vider le login des auteurs a la poubelle qui avaient ce meme login |
| 220 | 220 | if (strlen($new_login)) { |
| 221 | 221 | $anciens = sql_allfetsel('id_auteur', 'spip_auteurs', |
| 222 | - 'login=' . sql_quote($new_login, $serveur, 'text') . " AND statut='5poubelle'", '', '', '', '', $serveur); |
|
| 222 | + 'login='.sql_quote($new_login, $serveur, 'text')." AND statut='5poubelle'", '', '', '', '', $serveur); |
|
| 223 | 223 | while ($row = array_pop($anciens)) { |
| 224 | 224 | auteur_modifier($row['id_auteur'], array('login' => ''), true); // manque la gestion de $serveur |
| 225 | 225 | } |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | } // pas la peine de requeter |
| 245 | 245 | $l = sql_quote($login, $serveur, 'text'); |
| 246 | 246 | if ($r = sql_getfetsel('login', 'spip_auteurs', |
| 247 | - "statut<>'5poubelle'" . |
|
| 248 | - " AND (length(pass)>0)" . |
|
| 247 | + "statut<>'5poubelle'". |
|
| 248 | + " AND (length(pass)>0)". |
|
| 249 | 249 | " AND (login=$l)", '', '', '', '', $serveur) |
| 250 | 250 | ) { |
| 251 | 251 | return $r; |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | // car un nom peut etre homonyme d'un autre login |
| 257 | 257 | else { |
| 258 | 258 | return sql_getfetsel('login', 'spip_auteurs', |
| 259 | - "statut<>'5poubelle'" . |
|
| 260 | - " AND (length(pass)>0)" . |
|
| 259 | + "statut<>'5poubelle'". |
|
| 260 | + " AND (length(pass)>0)". |
|
| 261 | 261 | " AND (login<>'' AND (nom=$l OR email=$l))", '', '', '', '', $serveur); |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | if (!$id_auteur = intval($id_auteur) |
| 343 | - or !sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur) |
|
| 343 | + or !sql_fetsel('login', 'spip_auteurs', 'id_auteur='.intval($id_auteur), '', '', '', '', $serveur) |
|
| 344 | 344 | ) { |
| 345 | 345 | return false; |
| 346 | 346 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $htpass = generer_htpass($new_pass); |
| 352 | 352 | $alea_actuel = creer_uniqid(); |
| 353 | 353 | $alea_futur = creer_uniqid(); |
| 354 | - $pass = spip_sha256($alea_actuel . $new_pass); |
|
| 354 | + $pass = spip_sha256($alea_actuel.$new_pass); |
|
| 355 | 355 | $c['pass'] = $pass; |
| 356 | 356 | $c['htpass'] = $htpass; |
| 357 | 357 | $c['alea_actuel'] = $alea_actuel; |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | or (isset($options['all']) and $options['all']) |
| 388 | 388 | ) { |
| 389 | 389 | |
| 390 | - $htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME; |
|
| 391 | - $htpasswd = _DIR_TMP . _AUTH_USER_FILE; |
|
| 390 | + $htaccess = _DIR_RESTREINT._ACCESS_FILE_NAME; |
|
| 391 | + $htpasswd = _DIR_TMP._AUTH_USER_FILE; |
|
| 392 | 392 | |
| 393 | 393 | // Cette variable de configuration peut etre posee par un plugin |
| 394 | 394 | // par exemple acces_restreint ; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | and !@file_exists($htaccess) |
| 398 | 398 | ) { |
| 399 | 399 | spip_unlink($htpasswd); |
| 400 | - spip_unlink($htpasswd . "-admin"); |
|
| 400 | + spip_unlink($htpasswd."-admin"); |
|
| 401 | 401 | |
| 402 | 402 | return; |
| 403 | 403 | } |
@@ -412,16 +412,16 @@ discard block |
||
| 412 | 412 | sql_in("statut", array('1comite', '0minirezo', 'nouveau'))); |
| 413 | 413 | while ($t = sql_fetch($s)) { |
| 414 | 414 | if (strlen($t['login']) and strlen($t['htpass'])) { |
| 415 | - $p1 .= $t['login'] . ':' . $t['htpass'] . "\n"; |
|
| 415 | + $p1 .= $t['login'].':'.$t['htpass']."\n"; |
|
| 416 | 416 | if ($t['statut'] == '0minirezo') { |
| 417 | - $p2 .= $t['login'] . ':' . $t['htpass'] . "\n"; |
|
| 417 | + $p2 .= $t['login'].':'.$t['htpass']."\n"; |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | sql_free($s); |
| 422 | 422 | if ($p1) { |
| 423 | 423 | ecrire_fichier($htpasswd, $p1); |
| 424 | - ecrire_fichier($htpasswd . '-admin', $p2); |
|
| 424 | + ecrire_fichier($htpasswd.'-admin', $p2); |
|
| 425 | 425 | spip_log("Ecriture de $htpasswd et $htpasswd-admin"); |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | if ($echec) { |
| 49 | 49 | echo minipres( |
| 50 | 50 | 'AUTO', |
| 51 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 52 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 53 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 51 | + info_progression_etape(3, 'etape_', 'install/', true). |
|
| 52 | + "<div class='error'><h3>$echec</h3>\n". |
|
| 53 | + '<p>'._T('avis_connexion_echec_2').'</p>'. |
|
| 54 | 54 | '</div>' |
| 55 | 55 | ); |
| 56 | 56 | exit; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $htpass = generer_htpass($pass); |
| 87 | 87 | $alea_actuel = creer_uniqid(); |
| 88 | 88 | $alea_futur = creer_uniqid(); |
| 89 | - $shapass = spip_sha256($alea_actuel . $pass); |
|
| 89 | + $shapass = spip_sha256($alea_actuel.$pass); |
|
| 90 | 90 | // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
| 91 | 91 | // sur une vieille base |
| 92 | 92 | $t = sql_showtable('spip_auteurs', true); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 97 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login='.sql_quote($login)); |
|
| 98 | 98 | if ($id_auteur !== null) { |
| 99 | 99 | sql_updateq('spip_auteurs', array( |
| 100 | 100 | 'nom' => $nom, |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | if (!$auteur = auth_identifier_login($login, $pass) |
| 134 | 134 | or !auth_loger($auteur, true) |
| 135 | 135 | ) { |
| 136 | - spip_log("login automatique impossible $auth_spip $session" . count($row)); |
|
| 136 | + spip_log("login automatique impossible $auth_spip $session".count($row)); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | // Determiner l'action demandee |
| 36 | 36 | // |
| 37 | 37 | |
| 38 | -$exec = (string)_request('exec'); |
|
| 38 | +$exec = (string) _request('exec'); |
|
| 39 | 39 | $reinstall = (!is_null(_request('reinstall'))) ? _request('reinstall') : ($exec == 'install' ? 'oui' : null); |
| 40 | 40 | // |
| 41 | 41 | // Les scripts d'insallation n'authentifient pas, forcement, |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | if (_request('action') or _request('var_ajax') or _request('formulaire_action')) { |
| 67 | - if (!autoriser_sans_cookie($exec)){ |
|
| 67 | + if (!autoriser_sans_cookie($exec)) { |
|
| 68 | 68 | // Charger l'aiguilleur qui va mettre sur la bonne voie les traitements derogatoires |
| 69 | 69 | include_spip('public/aiguiller'); |
| 70 | 70 | if ( |
@@ -76,17 +76,17 @@ discard block |
||
| 76 | 76 | or |
| 77 | 77 | // cas des formulaires charger/verifier/traiter |
| 78 | 78 | traiter_formulaires_dynamiques() |
| 79 | - ){ |
|
| 79 | + ) { |
|
| 80 | 80 | exit; |
| 81 | 81 | } // le hit est fini ! |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | // securiser les redirect du back-office |
| 85 | 85 | if (_request('redirect')) { |
| 86 | - if (!function_exists('securiser_redirect_action')){ |
|
| 86 | + if (!function_exists('securiser_redirect_action')) { |
|
| 87 | 87 | include_spip('public/aiguiller'); |
| 88 | 88 | } |
| 89 | - set_request('redirect',securiser_redirect_action(_request('redirect'))); |
|
| 89 | + set_request('redirect', securiser_redirect_action(_request('redirect'))); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | or (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']['statut'] == '0minirezo') |
| 120 | 120 | ) |
| 121 | 121 | ) { |
| 122 | - spip_log("Quand la meta admin vaut " . |
|
| 123 | - $GLOBALS['meta']["admin"] . |
|
| 124 | - " seul un admin peut se connecter et sans AJAX." . |
|
| 122 | + spip_log("Quand la meta admin vaut ". |
|
| 123 | + $GLOBALS['meta']["admin"]. |
|
| 124 | + " seul un admin peut se connecter et sans AJAX.". |
|
| 125 | 125 | " En cas de probleme, detruire cette meta."); |
| 126 | 126 | die(_T('info_travaux_texte')); |
| 127 | 127 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if (find_in_path($charset . '.php', 'charsets/', true)) { |
|
| 76 | + if (find_in_path($charset.'.php', 'charsets/', true)) { |
|
| 77 | 77 | return $charset; |
| 78 | 78 | } else { |
| 79 | 79 | spip_log("Erreur: pas de fichier de conversion 'charsets/$charset'"); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | static $pcre_ok = 0; |
| 160 | 160 | |
| 161 | 161 | if (!$pcre_ok) { |
| 162 | - $s = " " . chr(195) . chr(169) . "t" . chr(195) . chr(169) . " "; |
|
| 162 | + $s = " ".chr(195).chr(169)."t".chr(195).chr(169)." "; |
|
| 163 | 163 | if (preg_match(',\W...\W,u', $s)) { |
| 164 | 164 | $pcre_ok = 1; |
| 165 | 165 | } else { |
@@ -260,38 +260,38 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | if (!isset($trans[$charset][$charset_cible])) { |
| 262 | 262 | $trans[$charset][$charset_cible] = array( |
| 263 | - $p . chr(128) => "€", |
|
| 264 | - $p . chr(129) => ' ', # pas affecte |
|
| 265 | - $p . chr(130) => "‚", |
|
| 266 | - $p . chr(131) => "ƒ", |
|
| 267 | - $p . chr(132) => "„", |
|
| 268 | - $p . chr(133) => "…", |
|
| 269 | - $p . chr(134) => "†", |
|
| 270 | - $p . chr(135) => "‡", |
|
| 271 | - $p . chr(136) => "ˆ", |
|
| 272 | - $p . chr(137) => "‰", |
|
| 273 | - $p . chr(138) => "Š", |
|
| 274 | - $p . chr(139) => "‹", |
|
| 275 | - $p . chr(140) => "Œ", |
|
| 276 | - $p . chr(141) => ' ', # pas affecte |
|
| 277 | - $p . chr(142) => "Ž", |
|
| 278 | - $p . chr(143) => ' ', # pas affecte |
|
| 279 | - $p . chr(144) => ' ', # pas affecte |
|
| 280 | - $p . chr(145) => "‘", |
|
| 281 | - $p . chr(146) => "’", |
|
| 282 | - $p . chr(147) => "“", |
|
| 283 | - $p . chr(148) => "”", |
|
| 284 | - $p . chr(149) => "•", |
|
| 285 | - $p . chr(150) => "–", |
|
| 286 | - $p . chr(151) => "—", |
|
| 287 | - $p . chr(152) => "˜", |
|
| 288 | - $p . chr(153) => "™", |
|
| 289 | - $p . chr(154) => "š", |
|
| 290 | - $p . chr(155) => "›", |
|
| 291 | - $p . chr(156) => "œ", |
|
| 292 | - $p . chr(157) => ' ', # pas affecte |
|
| 293 | - $p . chr(158) => "ž", |
|
| 294 | - $p . chr(159) => "Ÿ", |
|
| 263 | + $p.chr(128) => "€", |
|
| 264 | + $p.chr(129) => ' ', # pas affecte |
|
| 265 | + $p.chr(130) => "‚", |
|
| 266 | + $p.chr(131) => "ƒ", |
|
| 267 | + $p.chr(132) => "„", |
|
| 268 | + $p.chr(133) => "…", |
|
| 269 | + $p.chr(134) => "†", |
|
| 270 | + $p.chr(135) => "‡", |
|
| 271 | + $p.chr(136) => "ˆ", |
|
| 272 | + $p.chr(137) => "‰", |
|
| 273 | + $p.chr(138) => "Š", |
|
| 274 | + $p.chr(139) => "‹", |
|
| 275 | + $p.chr(140) => "Œ", |
|
| 276 | + $p.chr(141) => ' ', # pas affecte |
|
| 277 | + $p.chr(142) => "Ž", |
|
| 278 | + $p.chr(143) => ' ', # pas affecte |
|
| 279 | + $p.chr(144) => ' ', # pas affecte |
|
| 280 | + $p.chr(145) => "‘", |
|
| 281 | + $p.chr(146) => "’", |
|
| 282 | + $p.chr(147) => "“", |
|
| 283 | + $p.chr(148) => "”", |
|
| 284 | + $p.chr(149) => "•", |
|
| 285 | + $p.chr(150) => "–", |
|
| 286 | + $p.chr(151) => "—", |
|
| 287 | + $p.chr(152) => "˜", |
|
| 288 | + $p.chr(153) => "™", |
|
| 289 | + $p.chr(154) => "š", |
|
| 290 | + $p.chr(155) => "›", |
|
| 291 | + $p.chr(156) => "œ", |
|
| 292 | + $p.chr(157) => ' ', # pas affecte |
|
| 293 | + $p.chr(158) => "ž", |
|
| 294 | + $p.chr(159) => "Ÿ", |
|
| 295 | 295 | ); |
| 296 | 296 | if ($charset_cible != 'unicode') { |
| 297 | 297 | foreach ($trans[$charset][$charset_cible] as $k => $c) { |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | and is_array($GLOBALS['CHARSET'][$cset]) |
| 422 | 422 | ) { |
| 423 | 423 | foreach ($GLOBALS['CHARSET'][$cset] as $key => $val) { |
| 424 | - $trans[$charset][chr($key)] = '&#' . $val . ';'; |
|
| 424 | + $trans[$charset][chr($key)] = '&#'.$val.';'; |
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -488,11 +488,11 @@ discard block |
||
| 488 | 488 | $h = dechex($e); |
| 489 | 489 | if ($s = isset($CHARSET_REVERSE[$charset][$e])) { |
| 490 | 490 | $s = $CHARSET_REVERSE[$charset][$e]; |
| 491 | - $t['&#' . $e . ';'] = $t['�' . $e . ';'] = $t['�' . $e . ';'] = chr($s); |
|
| 492 | - $t['&#x' . $h . ';'] = $t['�' . $h . ';'] = $t['�' . $h . ';'] = chr($s); |
|
| 491 | + $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($s); |
|
| 492 | + $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($s); |
|
| 493 | 493 | } else { |
| 494 | - $t['&#' . $e . ';'] = $t['�' . $e . ';'] = $t['�' . $e . ';'] = chr($e); |
|
| 495 | - $t['&#x' . $h . ';'] = $t['�' . $h . ';'] = $t['�' . $h . ';'] = chr($e); |
|
| 494 | + $t['&#'.$e.';'] = $t['�'.$e.';'] = $t['�'.$e.';'] = chr($e); |
|
| 495 | + $t['&#x'.$h.';'] = $t['�'.$h.';'] = $t['�'.$h.';'] = chr($e); |
|
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | } |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | and is_array($GLOBALS['CHARSET'][$cset]) |
| 537 | 537 | ) { |
| 538 | 538 | foreach ($GLOBALS['CHARSET'][$cset] as $key => $val) { |
| 539 | - $trans[$charset][chr($key)] = unicode2charset('&#' . $val . ';'); |
|
| 539 | + $trans[$charset][chr($key)] = unicode2charset('&#'.$val.';'); |
|
| 540 | 540 | } |
| 541 | 541 | } |
| 542 | 542 | } |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | } |
| 644 | 644 | $thisPos++; |
| 645 | 645 | } |
| 646 | - $encodedLetter = "&#" . preg_replace('/^0+/', '', $decimalCode) . ';'; |
|
| 646 | + $encodedLetter = "&#".preg_replace('/^0+/', '', $decimalCode).';'; |
|
| 647 | 647 | $encodedString .= $encodedLetter; |
| 648 | 648 | } |
| 649 | 649 | } |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | } // ignorer le BOM - http://www.unicode.org/faq/utf_bom.html |
| 687 | 687 | else { |
| 688 | 688 | if ($word != 65279) { |
| 689 | - $texte .= '&#' . $word . ';'; |
|
| 689 | + $texte .= '&#'.$word.';'; |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | } |
@@ -715,13 +715,13 @@ discard block |
||
| 715 | 715 | return chr($num); |
| 716 | 716 | } |
| 717 | 717 | if ($num < 2048) { |
| 718 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 718 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 719 | 719 | } |
| 720 | 720 | if ($num < 65536) { |
| 721 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 721 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 722 | 722 | } |
| 723 | 723 | if ($num < 1114112) { |
| 724 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 724 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | return ''; |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | while (preg_match(',�*([0-9]+);,S', $texte, $regs) and !isset($vu[$regs[1]])) { |
| 778 | 778 | $num = $regs[1]; |
| 779 | 779 | $vu[$num] = true; |
| 780 | - $s = '\u' . sprintf("%04x", $num); |
|
| 780 | + $s = '\u'.sprintf("%04x", $num); |
|
| 781 | 781 | $texte = str_replace($regs[0], $s, $texte); |
| 782 | 782 | } |
| 783 | 783 | |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | **/ |
| 795 | 795 | function javascript_to_unicode($texte) { |
| 796 | 796 | while (preg_match(",%u([0-9A-F][0-9A-F][0-9A-F][0-9A-F]),", $texte, $regs)) { |
| 797 | - $texte = str_replace($regs[0], "&#" . hexdec($regs[1]) . ";", $texte); |
|
| 797 | + $texte = str_replace($regs[0], "&#".hexdec($regs[1]).";", $texte); |
|
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | return $texte; |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | return $texte; |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | - $table_translit = 'translit' . $complexe; |
|
| 842 | + $table_translit = 'translit'.$complexe; |
|
| 843 | 843 | |
| 844 | 844 | // 2. Translitterer grace a la table predefinie |
| 845 | 845 | if (!isset($trans[$complexe])) { |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | * true s'il a un BOM |
| 931 | 931 | **/ |
| 932 | 932 | function bom_utf8($texte) { |
| 933 | - return (substr($texte, 0, 3) == chr(0xEF) . chr(0xBB) . chr(0xBF)); |
|
| 933 | + return (substr($texte, 0, 3) == chr(0xEF).chr(0xBB).chr(0xBF)); |
|
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | /** |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | // on prend n fois la longueur desiree, pour etre surs d'avoir tout |
| 1126 | 1126 | // (un caractere utf-8 prenant au maximum n bytes) |
| 1127 | 1127 | $n = 0; |
| 1128 | - while (preg_match(',[\x80-\xBF]{' . (++$n) . '},', $c)) { |
|
| 1128 | + while (preg_match(',[\x80-\xBF]{'.(++$n).'},', $c)) { |
|
| 1129 | 1129 | ; |
| 1130 | 1130 | } |
| 1131 | 1131 | $c = substr($c, 0, $n * $length); |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | |
| 1160 | 1160 | $lettre1 = mb_strtoupper(spip_substr($c, 0, 1)); |
| 1161 | 1161 | |
| 1162 | - return $lettre1 . spip_substr($c, 1); |
|
| 1162 | + return $lettre1.spip_substr($c, 1); |
|
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | /** |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | protected $_lcount = 19; |
| 74 | 74 | protected $_vcount = 21; |
| 75 | 75 | protected $_tcount = 28; |
| 76 | - protected $_ncount = 588; // _vcount * _tcount |
|
| 76 | + protected $_ncount = 588; // _vcount * _tcount |
|
| 77 | 77 | protected $_scount = 11172; // _lcount * _tcount * _vcount |
| 78 | 78 | protected $_error = false; |
| 79 | 79 | protected static $_mb_string_overload = null; |
| 80 | 80 | // See {@link set_paramter()} for details of how to change the following |
| 81 | 81 | // settings from within your script / application |
| 82 | - protected $_api_encoding = 'utf8'; // Default input charset is UTF-8 |
|
| 83 | - protected $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden |
|
| 84 | - protected $_strict_mode = false; // Behave strict or not |
|
| 85 | - protected $_idn_version = 2003; // Can be either 2003 (old, default) or 2008 |
|
| 82 | + protected $_api_encoding = 'utf8'; // Default input charset is UTF-8 |
|
| 83 | + protected $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden |
|
| 84 | + protected $_strict_mode = false; // Behave strict or not |
|
| 85 | + protected $_idn_version = 2003; // Can be either 2003 (old, default) or 2008 |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * the constructor |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $this->_api_encoding = $v; |
| 141 | 141 | break; |
| 142 | 142 | default: |
| 143 | - $this->_error('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k); |
|
| 143 | + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
| 144 | 144 | return false; |
| 145 | 145 | } |
| 146 | 146 | break; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | if (in_array($v, array('2003', '2008'))) { |
| 155 | 155 | $this->_idn_version = $v; |
| 156 | 156 | } else { |
| 157 | - $this->_error('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k); |
|
| 157 | + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
| 158 | 158 | } |
| 159 | 159 | break; |
| 160 | 160 | case 'encode_german_sz': // Deprecated |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | break; |
| 167 | 167 | default: |
| 168 | - $this->_error('Set Parameter: Unknown option ' . $k); |
|
| 168 | + $this->_error('Set Parameter: Unknown option '.$k); |
|
| 169 | 169 | return false; |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | case 'ucs4_array': |
| 189 | 189 | break; |
| 190 | 190 | default: |
| 191 | - $this->_error('Unknown encoding ' . $one_time_encoding); |
|
| 191 | + $this->_error('Unknown encoding '.$one_time_encoding); |
|
| 192 | 192 | return false; |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | list ($email_pref, $input) = explode('@', $input, 2); |
| 207 | 207 | $arr = explode('.', $input); |
| 208 | 208 | foreach ($arr as $k => $v) { |
| 209 | - if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) { |
|
| 209 | + if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { |
|
| 210 | 210 | $conv = $this->_decode($v); |
| 211 | 211 | if ($conv) { |
| 212 | 212 | $arr[$k] = $conv; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $input = join('.', $arr); |
| 217 | 217 | $arr = explode('.', $email_pref); |
| 218 | 218 | foreach ($arr as $k => $v) { |
| 219 | - if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) { |
|
| 219 | + if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { |
|
| 220 | 220 | $conv = $this->_decode($v); |
| 221 | 221 | if ($conv) { |
| 222 | 222 | $arr[$k] = $conv; |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | $email_pref = join('.', $arr); |
| 227 | - $return = $email_pref . '@' . $input; |
|
| 227 | + $return = $email_pref.'@'.$input; |
|
| 228 | 228 | } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) |
| 229 | 229 | // No no in strict mode |
| 230 | 230 | if ($this->_strict_mode) { |
@@ -241,13 +241,13 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | $parsed['host'] = join('.', $arr); |
| 244 | - $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 245 | - (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@'). |
|
| 244 | + $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 245 | + (empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@'). |
|
| 246 | 246 | $parsed['host']. |
| 247 | - (empty($parsed['port']) ? '' : ':' . $parsed['port']). |
|
| 247 | + (empty($parsed['port']) ? '' : ':'.$parsed['port']). |
|
| 248 | 248 | (empty($parsed['path']) ? '' : $parsed['path']). |
| 249 | - (empty($parsed['query']) ? '' : '?' . $parsed['query']). |
|
| 250 | - (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']); |
|
| 249 | + (empty($parsed['query']) ? '' : '?'.$parsed['query']). |
|
| 250 | + (empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); |
|
| 251 | 251 | } else { // parse_url seems to have failed, try without it |
| 252 | 252 | $arr = explode('.', $input); |
| 253 | 253 | foreach ($arr as $k => $v) { |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | // The output is UTF-8 by default, other output formats need conversion here |
| 266 | 266 | // If one time encoding is given, use this, else the objects property |
| 267 | 267 | switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { |
| 268 | - case 'utf8': return $return; // break; |
|
| 269 | - case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); // break; |
|
| 268 | + case 'utf8' : return $return; // break; |
|
| 269 | + case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); // break; |
|
| 270 | 270 | case 'ucs4_array': return $this->_utf8_to_ucs4($return); // break; |
| 271 | 271 | default: $this->_error('Unsupported output format'); return false; |
| 272 | 272 | } |
@@ -283,15 +283,14 @@ discard block |
||
| 283 | 283 | // Forcing conversion of input to UCS4 array |
| 284 | 284 | // If one time encoding is given, use this, else the objects property |
| 285 | 285 | switch ($one_time_encoding ? $one_time_encoding : $this->_api_encoding) { |
| 286 | - case 'utf8': |
|
| 287 | - $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 286 | + case 'utf8' : $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 288 | 287 | break; |
| 289 | 288 | case 'ucs4_string': |
| 290 | 289 | $decoded = $this->_ucs4_string_to_ucs4($decoded); |
| 291 | 290 | case 'ucs4_array': |
| 292 | 291 | break; |
| 293 | 292 | default: |
| 294 | - $this->_error('Unsupported input format: ' . ($one_time_encoding ? $one_time_encoding : $this->_api_encoding)); |
|
| 293 | + $this->_error('Unsupported input format: '.($one_time_encoding ? $one_time_encoding : $this->_api_encoding)); |
|
| 295 | 294 | return false; |
| 296 | 295 | } |
| 297 | 296 | |
@@ -380,13 +379,13 @@ discard block |
||
| 380 | 379 | } |
| 381 | 380 | } |
| 382 | 381 | $parsed['host'] = join('.', $arr); |
| 383 | - $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 384 | - (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@'). |
|
| 382 | + $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 383 | + (empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@'). |
|
| 385 | 384 | $parsed['host']. |
| 386 | - (empty($parsed['port']) ? '' : ':' . $parsed['port']). |
|
| 385 | + (empty($parsed['port']) ? '' : ':'.$parsed['port']). |
|
| 387 | 386 | (empty($parsed['path']) ? '' : $parsed['path']). |
| 388 | - (empty($parsed['query']) ? '' : '?' . $parsed['query']). |
|
| 389 | - (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']); |
|
| 387 | + (empty($parsed['query']) ? '' : '?'.$parsed['query']). |
|
| 388 | + (empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); |
|
| 390 | 389 | return $return; |
| 391 | 390 | } |
| 392 | 391 | |
@@ -409,11 +408,11 @@ discard block |
||
| 409 | 408 | { |
| 410 | 409 | $decoded = array(); |
| 411 | 410 | // find the Punycode prefix |
| 412 | - if (!preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $encoded)) { |
|
| 411 | + if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) { |
|
| 413 | 412 | $this->_error('This is not a punycode string'); |
| 414 | 413 | return false; |
| 415 | 414 | } |
| 416 | - $encode_test = preg_replace('!^' . preg_quote($this->_punycode_prefix, '!') . '!', '', $encoded); |
|
| 415 | + $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded); |
|
| 417 | 416 | // If nothing left after removing the prefix, it is hopeless |
| 418 | 417 | if (!$encode_test) { |
| 419 | 418 | $this->_error('The given encoded string was empty'); |
@@ -439,8 +438,7 @@ discard block |
||
| 439 | 438 | for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) { |
| 440 | 439 | $digit = $this->_decode_digit($encoded[$enco_idx++]); |
| 441 | 440 | $idx += $digit * $w; |
| 442 | - $t = ($k <= $bias) ? $this->_tmin : |
|
| 443 | - (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
|
| 441 | + $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
|
| 444 | 442 | if ($digit < $t) { |
| 445 | 443 | break; |
| 446 | 444 | } |
@@ -513,7 +511,7 @@ discard block |
||
| 513 | 511 | return $encoded; // All codepoints were basic ones |
| 514 | 512 | } |
| 515 | 513 | // Start with the prefix; copy it to output |
| 516 | - $encoded = $this->_punycode_prefix . $encoded; |
|
| 514 | + $encoded = $this->_punycode_prefix.$encoded; |
|
| 517 | 515 | // If we have basic code points in output, add an hyphen to the end |
| 518 | 516 | if ($codecount) { |
| 519 | 517 | $encoded .= '-'; |
@@ -540,8 +538,7 @@ discard block |
||
| 540 | 538 | $delta++; |
| 541 | 539 | } elseif ($decoded[$i] == $cur_code) { |
| 542 | 540 | for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { |
| 543 | - $t = ($k <= $bias) ? $this->_tmin : |
|
| 544 | - (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
|
| 541 | + $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
|
| 545 | 542 | if ($q < $t) { |
| 546 | 543 | break; |
| 547 | 544 | } |
@@ -628,12 +625,12 @@ discard block |
||
| 628 | 625 | } |
| 629 | 626 | // Try to find prohibited input |
| 630 | 627 | if (in_array($v, self::$NP['prohibit']) || in_array($v, self::$NP['general_prohibited'])) { |
| 631 | - $this->_error('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v)); |
|
| 628 | + $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); |
|
| 632 | 629 | return false; |
| 633 | 630 | } |
| 634 | 631 | foreach (self::$NP['prohibit_ranges'] as $range) { |
| 635 | 632 | if ($range[0] <= $v && $v <= $range[1]) { |
| 636 | - $this->_error('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v)); |
|
| 633 | + $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); |
|
| 637 | 634 | return false; |
| 638 | 635 | } |
| 639 | 636 | } |
@@ -869,7 +866,7 @@ discard block |
||
| 869 | 866 | $output[$out_len] = $v; |
| 870 | 867 | ++$out_len; |
| 871 | 868 | if ('add' == $mode) { |
| 872 | - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k); |
|
| 869 | + $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
| 873 | 870 | return false; |
| 874 | 871 | } |
| 875 | 872 | continue; |
@@ -894,7 +891,7 @@ discard block |
||
| 894 | 891 | $next_byte = 4; |
| 895 | 892 | $v = ($v - 252) << 30; |
| 896 | 893 | } else { |
| 897 | - $this->_error('This might be UTF-8, but I don\'t understand it at byte ' . $k); |
|
| 894 | + $this->_error('This might be UTF-8, but I don\'t understand it at byte '.$k); |
|
| 898 | 895 | return false; |
| 899 | 896 | } |
| 900 | 897 | if ('add' == $mode) { |
@@ -907,7 +904,7 @@ discard block |
||
| 907 | 904 | if (!$this->_allow_overlong && $test == 'range') { |
| 908 | 905 | $test = 'none'; |
| 909 | 906 | if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { |
| 910 | - $this->_error('Bogus UTF-8 character detected (out of legal range) at byte ' . $k); |
|
| 907 | + $this->_error('Bogus UTF-8 character detected (out of legal range) at byte '.$k); |
|
| 911 | 908 | return false; |
| 912 | 909 | } |
| 913 | 910 | } |
@@ -916,7 +913,7 @@ discard block |
||
| 916 | 913 | $output[($out_len - 1)] += $v; |
| 917 | 914 | --$next_byte; |
| 918 | 915 | } else { |
| 919 | - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k); |
|
| 916 | + $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
| 920 | 917 | return false; |
| 921 | 918 | } |
| 922 | 919 | if ($next_byte < 0) { |
@@ -940,13 +937,13 @@ discard block |
||
| 940 | 937 | if ($v < 128) { // 7bit are transferred literally |
| 941 | 938 | $output .= chr($v); |
| 942 | 939 | } elseif ($v < (1 << 11)) { // 2 bytes |
| 943 | - $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 940 | + $output .= chr(192 + ($v >> 6)).chr(128 + ($v & 63)); |
|
| 944 | 941 | } elseif ($v < (1 << 16)) { // 3 bytes |
| 945 | - $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 942 | + $output .= chr(224 + ($v >> 12)).chr(128 + (($v >> 6) & 63)).chr(128 + ($v & 63)); |
|
| 946 | 943 | } elseif ($v < (1 << 21)) { // 4 bytes |
| 947 | - $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 944 | + $output .= chr(240 + ($v >> 18)).chr(128 + (($v >> 12) & 63)).chr(128 + (($v >> 6) & 63)).chr(128 + ($v & 63)); |
|
| 948 | 945 | } else { |
| 949 | - $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte ' . $k); |
|
| 946 | + $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); |
|
| 950 | 947 | return false; |
| 951 | 948 | } |
| 952 | 949 | } |
@@ -965,7 +962,7 @@ discard block |
||
| 965 | 962 | // Take array values and split output to 4 bytes per value |
| 966 | 963 | // The bit mask is 255, which reads &11111111 |
| 967 | 964 | foreach ($input as $v) { |
| 968 | - $output .= chr(($v >> 24) & 255) . chr(($v >> 16) & 255) . chr(($v >> 8) & 255) . chr($v & 255); |
|
| 965 | + $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); |
|
| 969 | 966 | } |
| 970 | 967 | return $output; |
| 971 | 968 | } |
@@ -995,7 +992,7 @@ discard block |
||
| 995 | 992 | $out_len++; |
| 996 | 993 | $output[$out_len] = 0; |
| 997 | 994 | } |
| 998 | - $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) ); |
|
| 995 | + $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4))); |
|
| 999 | 996 | } |
| 1000 | 997 | return $output; |
| 1001 | 998 | } |