@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | # include_spip('inc/indexation'); |
| 21 | 21 | # purger_index(); |
| 22 | 22 | # creer_liste_indexation(); |
| 23 | - maj_version (1.600); |
|
| 23 | + maj_version(1.600); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | if (upgrade_vers(1.601, $version_installee, $version_cible)) { |
| 27 | 27 | spip_query("ALTER TABLE spip_forum ADD INDEX id_syndic (id_syndic)"); |
| 28 | - maj_version (1.601); |
|
| 28 | + maj_version(1.601); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if (upgrade_vers(1.603, $version_installee, $version_cible)) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | spip_unlink('inc_meta_cache.php'); |
| 34 | 34 | spip_unlink('inc_meta_cache.php3'); |
| 35 | 35 | spip_unlink('data/engines-list.ini'); |
| 36 | - maj_version (1.603); |
|
| 36 | + maj_version(1.603); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | if (upgrade_vers(1.604, $version_installee, $version_cible)) { |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | $prefs = unserialize($row['prefs']); |
| 44 | 44 | $l = $prefs['spip_lang']; |
| 45 | 45 | unset ($prefs['spip_lang']); |
| 46 | - spip_query("UPDATE spip_auteurs SET lang=" . _q($l) . ", prefs='".addslashes(serialize($prefs))."' WHERE id_auteur=".$row['id_auteur']); |
|
| 46 | + spip_query("UPDATE spip_auteurs SET lang="._q($l).", prefs='".addslashes(serialize($prefs))."' WHERE id_auteur=".$row['id_auteur']); |
|
| 47 | 47 | } |
| 48 | 48 | $u = spip_query("SELECT lang FROM spip_auteurs"); |
| 49 | - maj_version (1.604, $u); |
|
| 49 | + maj_version(1.604, $u); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | if (upgrade_vers(1.1, $version_installee, $version_cible)) { |
| 20 | 20 | spip_query("DROP TABLE spip_petition"); |
| 21 | 21 | spip_query("DROP TABLE spip_signatures_petition"); |
| 22 | - maj_version (1.1); |
|
| 22 | + maj_version(1.1); |
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | spip_query("ALTER TABLE spip_auteurs ADD en_ligne datetime DEFAULT '0000-00-00 00:00:00' NOT NULL"); |
| 23 | 23 | spip_query("ALTER TABLE spip_auteurs ADD imessage VARCHAR(3) not null"); |
| 24 | 24 | spip_query("ALTER TABLE spip_auteurs ADD messagerie VARCHAR(3) not null"); |
| 25 | - maj_version (1.204); |
|
| 25 | + maj_version(1.204); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | if (upgrade_vers(1.207, $version_installee, $version_cible)) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | // Declencher le calcul des rubriques publiques |
| 33 | 33 | include_spip('inc/rubriques'); |
| 34 | 34 | calculer_rubriques(); |
| 35 | - maj_version (1.207); |
|
| 35 | + maj_version(1.207); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (upgrade_vers(1.208, $version_installee, $version_cible)) { |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | spip_query("ALTER TABLE spip_auteurs_messages DROP statut"); |
| 53 | - maj_version (1.208); |
|
| 53 | + maj_version(1.208); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if (upgrade_vers(1.209, $version_installee, $version_cible)) { |
| 57 | 57 | spip_query("ALTER TABLE spip_syndic ADD maj TIMESTAMP"); |
| 58 | 58 | spip_query("ALTER TABLE spip_syndic_articles ADD maj TIMESTAMP"); |
| 59 | 59 | spip_query("ALTER TABLE spip_messages ADD maj TIMESTAMP"); |
| 60 | - maj_version (1.209); |
|
| 60 | + maj_version(1.209); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if (upgrade_vers(1.210, $version_installee, $version_cible)) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | stripslashes_base('spip_signatures', array('nom_email', 'nom_site', 'message')); |
| 75 | 75 | stripslashes_base('spip_syndic', array('nom_site', 'descriptif')); |
| 76 | 76 | stripslashes_base('spip_syndic_articles', array('titre', 'lesauteurs')); |
| 77 | - maj_version (1.210); |
|
| 77 | + maj_version(1.210); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | spip_query("ALTER TABLE spip_forum ADD maj TIMESTAMP"); |
| 43 | 43 | spip_query("ALTER TABLE spip_forum DROP INDEX id_forum"); |
| 44 | 44 | spip_query("ALTER TABLE spip_forum ADD INDEX id_parent (id_parent), ADD INDEX id_rubrique (id_rubrique), ADD INDEX id_article(id_article), ADD INDEX id_breve(id_breve)"); |
| 45 | - maj_version (0.98); |
|
| 45 | + maj_version(0.98); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | if (upgrade_vers(0.99, $version_installee, $version_cible)) { |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | spip_query("UPDATE spip_forum SET id_rubrique=$id_rubrique WHERE id_forum IN ($forums_rubrique)"); |
| 103 | 103 | |
| 104 | 104 | } |
| 105 | - maj_version (0.99); |
|
| 105 | + maj_version(0.99); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if (upgrade_vers(0.997, $version_installee, $version_cible)) { |
| 109 | 109 | spip_query("DROP TABLE spip_index"); |
| 110 | - maj_version (0.997); |
|
| 110 | + maj_version(0.997); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if (upgrade_vers(0.999, $version_installee, $version_cible)) { |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | spip_query("ALTER TABLE spip_auteurs ADD htpass tinyblob NOT NULL"); |
| 117 | 117 | $result = spip_query("SELECT id_auteur, pass FROM spip_auteurs WHERE pass!=''"); |
| 118 | 118 | |
| 119 | - while ($r= sql_fetch($result)) { |
|
| 119 | + while ($r = sql_fetch($result)) { |
|
| 120 | 120 | $htpass = generer_htpass($r['pass']); |
| 121 | 121 | $pass = md5($pass); |
| 122 | - spip_query("UPDATE spip_auteurs SET pass='$pass', htpass='$htpass' WHERE id_auteur=" . $r['id_auteur']); |
|
| 122 | + spip_query("UPDATE spip_auteurs SET pass='$pass', htpass='$htpass' WHERE id_auteur=".$r['id_auteur']); |
|
| 123 | 123 | } |
| 124 | - maj_version (0.999); |
|
| 124 | + maj_version(0.999); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | spip_query("UPDATE spip_mots SET type='Mots sans groupe...' WHERE type=''"); |
| 21 | 21 | |
| 22 | 22 | $result = spip_query("SELECT * FROM spip_mots GROUP BY type"); |
| 23 | - while($row = sql_fetch($result)) { |
|
| 23 | + while ($row = sql_fetch($result)) { |
|
| 24 | 24 | $type = addslashes($row['type']); |
| 25 | 25 | // Old style, doit echouer |
| 26 | 26 | spip_log('ne pas tenir compte de l erreur spip_groupes_mots ci-dessous:', 'mysql'); |
@@ -29,19 +29,19 @@ discard block |
||
| 29 | 29 | spip_query("INSERT INTO spip_groupes_mots (titre, unseul, obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum) VALUES (\"$type\", 'non', 'non', 'oui', 'oui', 'non', 'oui', 'oui', 'oui', 'non')"); |
| 30 | 30 | } |
| 31 | 31 | sql_delete("spip_mots", "titre='kawax'"); |
| 32 | - maj_version (1.404); |
|
| 32 | + maj_version(1.404); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | if (upgrade_vers(1.405, $version_installee, $version_cible)) { |
| 36 | 36 | spip_query("ALTER TABLE spip_mots ADD id_groupe bigint(21) NOT NULL"); |
| 37 | 37 | |
| 38 | 38 | $result = spip_query("SELECT * FROM spip_groupes_mots"); |
| 39 | - while($row = sql_fetch($result)) { |
|
| 39 | + while ($row = sql_fetch($result)) { |
|
| 40 | 40 | $id_groupe = addslashes($row['id_groupe']); |
| 41 | 41 | $type = addslashes($row['titre']); |
| 42 | 42 | spip_query("UPDATE spip_mots SET id_groupe = '$id_groupe' WHERE type='$type'"); |
| 43 | 43 | } |
| 44 | - maj_version (1.405); |
|
| 44 | + maj_version(1.405); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if (upgrade_vers(1.408, $version_installee, $version_cible)) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | preg_match(",-([0-9]+)\.(gif|jpg|png)$,i", $fichier, $match); |
| 66 | 66 | $id_type = intval($types[$match[2]]); |
| 67 | 67 | $num_img = $match[1]; |
| 68 | - $fichier = _DIR_IMG . $fichier; |
|
| 68 | + $fichier = _DIR_IMG.$fichier; |
|
| 69 | 69 | $taille = @filesize($fichier); |
| 70 | 70 | // ici on n'a pas les fonctions absctract ! |
| 71 | 71 | $s = spip_query("INSERT INTO spip_documents (titre, id_type, fichier, mode, largeur, hauteur, taille) VALUES ('image $largeur x $hauteur', $id_type, '$fichier', 'vignette', '$largeur', '$hauteur', '$taille')"); |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | spip_query("ALTER TABLE spip_articles DROP images"); |
| 90 | - maj_version (1.408); |
|
| 90 | + maj_version(1.408); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if (upgrade_vers(1.414, $version_installee, $version_cible)) { |
| 94 | 94 | // Forum par defaut "en dur" dans les spip_articles |
| 95 | 95 | // -> non, prio (priori), pos (posteriori), abo (abonnement) |
| 96 | - $accepter_forum = substr($GLOBALS['meta']["forums_publics"],0,3) ; |
|
| 96 | + $accepter_forum = substr($GLOBALS['meta']["forums_publics"], 0, 3); |
|
| 97 | 97 | $result = spip_query("ALTER TABLE spip_articles CHANGE accepter_forum accepter_forum CHAR(3) NOT NULL"); |
| 98 | 98 | |
| 99 | 99 | $result = spip_query("UPDATE spip_articles SET accepter_forum='$accepter_forum' WHERE accepter_forum != 'non'"); |
| 100 | 100 | |
| 101 | - maj_version (1.414); |
|
| 101 | + maj_version(1.414); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /* |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | if (upgrade_vers(1.417, $version_installee, $version_cible)) { |
| 112 | 112 | spip_query("ALTER TABLE spip_syndic_articles DROP date_index"); |
| 113 | - maj_version (1.417); |
|
| 113 | + maj_version(1.417); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | if (upgrade_vers(1.418, $version_installee, $version_cible)) { |
@@ -119,49 +119,49 @@ discard block |
||
| 119 | 119 | if ($webmaster = sql_fetch($result)) { |
| 120 | 120 | ecrire_meta('email_webmaster', $webmaster['email']); |
| 121 | 121 | } |
| 122 | - maj_version (1.418); |
|
| 122 | + maj_version(1.418); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (upgrade_vers(1.419, $version_installee, $version_cible)) { |
| 126 | 126 | spip_query("ALTER TABLE spip_auteurs ADD alea_actuel TINYTEXT DEFAULT ''"); |
| 127 | 127 | spip_query("ALTER TABLE spip_auteurs ADD alea_futur TINYTEXT DEFAULT ''"); |
| 128 | 128 | spip_query("UPDATE spip_auteurs SET alea_futur = FLOOR(32000*RAND())"); |
| 129 | - maj_version (1.419); |
|
| 129 | + maj_version(1.419); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if (upgrade_vers(1.420, $version_installee, $version_cible)) { |
| 133 | 133 | spip_query("UPDATE spip_auteurs SET alea_actuel='' WHERE statut='nouveau'"); |
| 134 | - maj_version (1.420); |
|
| 134 | + maj_version(1.420); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (upgrade_vers(1.421, $version_installee, $version_cible)) { |
| 138 | 138 | spip_query("ALTER TABLE spip_articles ADD auteur_modif bigint(21) DEFAULT '0' NOT NULL"); |
| 139 | 139 | spip_query("ALTER TABLE spip_articles ADD date_modif datetime DEFAULT '0000-00-00 00:00:00' NOT NULL"); |
| 140 | - maj_version (1.421); |
|
| 140 | + maj_version(1.421); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (upgrade_vers(1.432, $version_installee, $version_cible)) { |
| 144 | 144 | spip_query("ALTER TABLE spip_articles DROP referers"); |
| 145 | 145 | spip_query("ALTER TABLE spip_articles ADD referers INTEGER DEFAULT '0' NOT NULL"); |
| 146 | 146 | spip_query("ALTER TABLE spip_articles ADD popularite INTEGER DEFAULT '0' NOT NULL"); |
| 147 | - maj_version (1.432); |
|
| 147 | + maj_version(1.432); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (upgrade_vers(1.436, $version_installee, $version_cible)) { |
| 151 | 151 | spip_query("ALTER TABLE spip_documents ADD date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL"); |
| 152 | - maj_version (1.436); |
|
| 152 | + maj_version(1.436); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if (upgrade_vers(1.437, $version_installee, $version_cible)) { |
| 156 | 156 | spip_query("ALTER TABLE spip_visites ADD maj TIMESTAMP"); |
| 157 | 157 | spip_query("ALTER TABLE spip_visites_referers ADD maj TIMESTAMP"); |
| 158 | - maj_version (1.437); |
|
| 158 | + maj_version(1.437); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (upgrade_vers(1.438, $version_installee, $version_cible)) { |
| 162 | 162 | spip_query("ALTER TABLE spip_articles ADD INDEX id_secteur (id_secteur)"); |
| 163 | 163 | spip_query("ALTER TABLE spip_articles ADD INDEX statut (statut, date)"); |
| 164 | - maj_version (1.438); |
|
| 164 | + maj_version(1.438); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (upgrade_vers(1.439, $version_installee, $version_cible)) { |
@@ -169,24 +169,24 @@ discard block |
||
| 169 | 169 | spip_query("ALTER TABLE spip_syndic_articles ADD INDEX statut (statut)"); |
| 170 | 170 | spip_query("ALTER TABLE spip_syndic_articles CHANGE url url VARCHAR(255) NOT NULL"); |
| 171 | 171 | spip_query("ALTER TABLE spip_syndic_articles ADD INDEX url (url)"); |
| 172 | - maj_version (1.439); |
|
| 172 | + maj_version(1.439); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (upgrade_vers(1.440, $version_installee, $version_cible)) { |
| 176 | 176 | spip_query("ALTER TABLE spip_visites_temp CHANGE ip ip INTEGER UNSIGNED NOT NULL"); |
| 177 | - maj_version (1.440); |
|
| 177 | + maj_version(1.440); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (upgrade_vers(1.441, $version_installee, $version_cible)) { |
| 181 | 181 | spip_query("ALTER TABLE spip_visites_temp CHANGE date date DATE NOT NULL"); |
| 182 | 182 | spip_query("ALTER TABLE spip_visites CHANGE date date DATE NOT NULL"); |
| 183 | 183 | spip_query("ALTER TABLE spip_visites_referers CHANGE date date DATE NOT NULL"); |
| 184 | - maj_version (1.441); |
|
| 184 | + maj_version(1.441); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (upgrade_vers(1.442, $version_installee, $version_cible)) { |
| 188 | 188 | spip_query("ALTER TABLE spip_auteurs ADD prefs TINYTEXT NOT NULL"); |
| 189 | - maj_version (1.442); |
|
| 189 | + maj_version(1.442); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (upgrade_vers(1.443, $version_installee, $version_cible)) { |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | spip_query("ALTER TABLE spip_auteurs CHANGE statut statut VARCHAR(255) NOT NULL"); |
| 195 | 195 | spip_query("ALTER TABLE spip_auteurs ADD INDEX login (login)"); |
| 196 | 196 | spip_query("ALTER TABLE spip_auteurs ADD INDEX statut (statut)"); |
| 197 | - maj_version (1.443); |
|
| 197 | + maj_version(1.443); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | if (upgrade_vers(1.444, $version_installee, $version_cible)) { |
| 201 | 201 | spip_query("ALTER TABLE spip_syndic ADD moderation VARCHAR(3) NOT NULL"); |
| 202 | - maj_version (1.444); |
|
| 202 | + maj_version(1.444); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if (upgrade_vers(1.457, $version_installee, $version_cible)) { |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | spip_query("DROP TABLE spip_visites_temp"); |
| 208 | 208 | spip_query("DROP TABLE spip_visites_referers"); |
| 209 | 209 | creer_base(); // crade, a ameliorer :-(( |
| 210 | - maj_version (1.457); |
|
| 210 | + maj_version(1.457); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | if (upgrade_vers(1.458, $version_installee, $version_cible)) { |
| 214 | 214 | spip_query("ALTER TABLE spip_auteurs ADD cookie_oubli TINYTEXT NOT NULL"); |
| 215 | - maj_version (1.458); |
|
| 215 | + maj_version(1.458); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | if (upgrade_vers(1.459, $version_installee, $version_cible)) { |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | spip_query("UPDATE spip_articles SET popularite=0"); |
| 230 | - maj_version (1.459); |
|
| 230 | + maj_version(1.459); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | if (upgrade_vers(1.460, $version_installee, $version_cible)) { |
@@ -237,26 +237,26 @@ discard block |
||
| 237 | 237 | $result = spip_query("SELECT * FROM spip_groupes_mots ORDER BY id_groupe"); |
| 238 | 238 | while ($row = sql_fetch($result)) { |
| 239 | 239 | $titre = addslashes($row['titre']); |
| 240 | - if (! $vu[$titre] ) { |
|
| 240 | + if (!$vu[$titre]) { |
|
| 241 | 241 | $vu[$titre] = true; |
| 242 | 242 | $id_groupe = $row['id_groupe']; |
| 243 | 243 | spip_query("UPDATE spip_mots SET id_groupe=$id_groupe WHERE type='$titre'"); |
| 244 | 244 | sql_delete("spip_groupes_mots", "titre='$titre' AND id_groupe<>$id_groupe"); |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | - maj_version (1.460); |
|
| 247 | + maj_version(1.460); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (upgrade_vers(1.462, $version_installee, $version_cible)) { |
| 251 | 251 | spip_query("UPDATE spip_types_documents SET inclus='embed' WHERE inclus!='non' AND extension IN ('aiff', 'asf', 'avi', 'mid', 'mov', 'mp3', 'mpg', 'ogg', 'qt', 'ra', 'ram', 'rm', 'swf', 'wav', 'wmv')"); |
| 252 | - maj_version (1.462); |
|
| 252 | + maj_version(1.462); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if (upgrade_vers(1.463, $version_installee, $version_cible)) { |
| 256 | 256 | spip_query("ALTER TABLE spip_articles CHANGE popularite popularite DOUBLE"); |
| 257 | 257 | spip_query("ALTER TABLE spip_visites_temp ADD maj TIMESTAMP"); |
| 258 | 258 | spip_query("ALTER TABLE spip_referers_temp ADD maj TIMESTAMP"); |
| 259 | - maj_version (1.463); |
|
| 259 | + maj_version(1.463); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // l'upgrade < 1.462 ci-dessus etait fausse, d'ou correctif |
@@ -267,23 +267,23 @@ discard block |
||
| 267 | 267 | $id_type = $row['id_type']; |
| 268 | 268 | spip_query("UPDATE spip_documents SET id_type=$id_type WHERE fichier like '%.$extension'"); |
| 269 | 269 | } |
| 270 | - maj_version (1.464); |
|
| 270 | + maj_version(1.464); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if (upgrade_vers(1.465, $version_installee, $version_cible)) { |
| 274 | 274 | spip_query("ALTER TABLE spip_articles CHANGE popularite popularite DOUBLE NOT NULL"); |
| 275 | - maj_version (1.465); |
|
| 275 | + maj_version(1.465); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | if (upgrade_vers(1.466, $version_installee, $version_cible)) { |
| 279 | 279 | spip_query("ALTER TABLE spip_auteurs ADD source VARCHAR(10) DEFAULT 'spip' NOT NULL"); |
| 280 | - maj_version (1.466); |
|
| 280 | + maj_version(1.466); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | if (upgrade_vers(1.468, $version_installee, $version_cible)) { |
| 284 | 284 | spip_query("ALTER TABLE spip_auteurs ADD INDEX en_ligne (en_ligne)"); |
| 285 | 285 | spip_query("ALTER TABLE spip_forum ADD INDEX statut (statut, date_heure)"); |
| 286 | - maj_version (1.468); |
|
| 286 | + maj_version(1.468); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | if (upgrade_vers(1.470, $version_installee, $version_cible)) { |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | spip_query("ALTER TABLE spip_auteurs DROP abonne"); |
| 293 | 293 | spip_query("ALTER TABLE spip_auteurs DROP abonne_pass"); |
| 294 | 294 | } |
| 295 | - maj_version (1.470); |
|
| 295 | + maj_version(1.470); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | if (upgrade_vers(1.471, $version_installee, $version_cible)) { |
@@ -309,18 +309,18 @@ discard block |
||
| 309 | 309 | spip_query("ALTER TABLE spip_mots_syndic DROP maj TIMESTAMP"); |
| 310 | 310 | spip_query("ALTER TABLE spip_mots_forum DROP maj TIMESTAMP"); |
| 311 | 311 | } |
| 312 | - maj_version (1.471); |
|
| 312 | + maj_version(1.471); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | if (upgrade_vers(1.472, $version_installee, $version_cible)) { |
| 316 | 316 | spip_query("ALTER TABLE spip_referers ADD visites_jour INTEGER UNSIGNED NOT NULL"); |
| 317 | - maj_version (1.472); |
|
| 317 | + maj_version(1.472); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | if (upgrade_vers(1.473, $version_installee, $version_cible)) { |
| 321 | 321 | spip_query("UPDATE spip_syndic_articles SET url = REPLACE(url, '&', '&')"); |
| 322 | 322 | spip_query("UPDATE spip_syndic SET url_site = REPLACE(url_site, '&', '&')"); |
| 323 | - maj_version (1.473); |
|
| 323 | + maj_version(1.473); |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | spip_query("ALTER TABLE spip_meta CHANGE `valeur` `valeur` TEXT"); |
| 56 | 56 | // table des correspondances table->id_table |
| 57 | 57 | $liste_tables = array(); |
| 58 | - $liste_tables[1]='spip_articles'; |
|
| 59 | - $liste_tables[2]='spip_auteurs'; |
|
| 60 | - $liste_tables[3]='spip_breves'; |
|
| 61 | - $liste_tables[4]='spip_documents'; |
|
| 62 | - $liste_tables[5]='spip_forum'; |
|
| 63 | - $liste_tables[6]='spip_mots'; |
|
| 64 | - $liste_tables[7]='spip_rubriques'; |
|
| 65 | - $liste_tables[8]='spip_signatures'; |
|
| 66 | - $liste_tables[9]='spip_syndic'; |
|
| 58 | + $liste_tables[1] = 'spip_articles'; |
|
| 59 | + $liste_tables[2] = 'spip_auteurs'; |
|
| 60 | + $liste_tables[3] = 'spip_breves'; |
|
| 61 | + $liste_tables[4] = 'spip_documents'; |
|
| 62 | + $liste_tables[5] = 'spip_forum'; |
|
| 63 | + $liste_tables[6] = 'spip_mots'; |
|
| 64 | + $liste_tables[7] = 'spip_rubriques'; |
|
| 65 | + $liste_tables[8] = 'spip_signatures'; |
|
| 66 | + $liste_tables[9] = 'spip_syndic'; |
|
| 67 | 67 | |
| 68 | 68 | ecrire_meta('index_table', serialize($liste_tables)); |
| 69 | 69 | |
@@ -220,18 +220,18 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | if (upgrade_vers(1.922, $version_installee, $version_cible)) { |
| 222 | 222 | spip_query("ALTER TABLE spip_meta ADD `impt` ENUM('non', 'oui') DEFAULT 'oui' NOT NULL AFTER `valeur`"); |
| 223 | - $meta_serveur = array('version_installee','adresse_site','alea_ephemere_ancien','alea_ephemere','alea_ephemere_date','langue_site','langues_proposees','date_calcul_rubriques','derniere_modif','optimiser_table','drapeau_edition','creer_preview','taille_preview','creer_htpasswd','creer_htaccess','gd_formats_read','gd_formats', |
|
| 224 | - 'netpbm_formats','formats_graphiques','image_process','plugin_header','plugin'); |
|
| 225 | - foreach($meta_serveur as $nom) |
|
| 223 | + $meta_serveur = array('version_installee', 'adresse_site', 'alea_ephemere_ancien', 'alea_ephemere', 'alea_ephemere_date', 'langue_site', 'langues_proposees', 'date_calcul_rubriques', 'derniere_modif', 'optimiser_table', 'drapeau_edition', 'creer_preview', 'taille_preview', 'creer_htpasswd', 'creer_htaccess', 'gd_formats_read', 'gd_formats', |
|
| 224 | + 'netpbm_formats', 'formats_graphiques', 'image_process', 'plugin_header', 'plugin'); |
|
| 225 | + foreach ($meta_serveur as $nom) |
|
| 226 | 226 | spip_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`="._q($nom)); |
| 227 | 227 | maj_version('1.922'); |
| 228 | 228 | } |
| 229 | 229 | if (upgrade_vers(1.923, $version_installee, $version_cible)) { |
| 230 | - if (isset($GLOBALS['meta']['IMPORT_tables_noimport'])){ |
|
| 230 | + if (isset($GLOBALS['meta']['IMPORT_tables_noimport'])) { |
|
| 231 | 231 | $IMPORT_tables_noimport = unserialize($GLOBALS['meta']['IMPORT_tables_noimport']); |
| 232 | 232 | foreach ($IMPORT_tables_noimport as $key=>$table) |
| 233 | - if ($table=='spip_meta') unset($IMPORT_tables_noimport[$key]); |
|
| 234 | - ecrire_meta('IMPORT_tables_noimport',serialize($IMPORT_tables_noimport),'non'); |
|
| 233 | + if ($table == 'spip_meta') unset($IMPORT_tables_noimport[$key]); |
|
| 234 | + ecrire_meta('IMPORT_tables_noimport', serialize($IMPORT_tables_noimport), 'non'); |
|
| 235 | 235 | } |
| 236 | 236 | maj_version('1.923'); |
| 237 | 237 | } |
@@ -246,47 +246,47 @@ discard block |
||
| 246 | 246 | /* deplacement des sessions */ |
| 247 | 247 | $f_session = preg_files('data', 'session_'); |
| 248 | 248 | $repertoire = _DIR_SESSIONS; |
| 249 | - if(!@file_exists($repertoire)) { |
|
| 249 | + if (!@file_exists($repertoire)) { |
|
| 250 | 250 | $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
| 251 | 251 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 252 | 252 | } |
| 253 | - foreach($f_session as $f) { |
|
| 253 | + foreach ($f_session as $f) { |
|
| 254 | 254 | $d = basename($f); |
| 255 | 255 | @copy($f, $repertoire.$d); |
| 256 | 256 | } |
| 257 | 257 | /* deplacement des visites */ |
| 258 | 258 | $f_visites = preg_files('data/visites'); |
| 259 | 259 | $repertoire = sous_repertoire(_DIR_TMP, 'visites'); |
| 260 | - foreach($f_visites as $f) { |
|
| 260 | + foreach ($f_visites as $f) { |
|
| 261 | 261 | $d = basename($f); |
| 262 | 262 | @copy($f, $repertoire.$d); |
| 263 | 263 | } |
| 264 | 264 | /* deplacement des upload */ |
| 265 | 265 | $auteurs = array(); |
| 266 | 266 | $req = spip_query("SELECT `login` FROM spip_auteurs WHERE `statut` = '0minirezo'"); |
| 267 | - while($row = sql_fetch($req)) |
|
| 267 | + while ($row = sql_fetch($req)) |
|
| 268 | 268 | $auteurs[] = $row['login']; |
| 269 | 269 | $f_upload = preg_files('upload', -1, 10000, $auteurs); |
| 270 | 270 | $repertoire = _DIR_TRANSFERT; |
| 271 | - if(!@file_exists($repertoire)) { |
|
| 271 | + if (!@file_exists($repertoire)) { |
|
| 272 | 272 | $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
| 273 | 273 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 274 | 274 | } |
| 275 | - foreach($auteurs as $login) { |
|
| 276 | - if(is_dir('upload/'.$login)) |
|
| 275 | + foreach ($auteurs as $login) { |
|
| 276 | + if (is_dir('upload/'.$login)) |
|
| 277 | 277 | $sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login); |
| 278 | 278 | } |
| 279 | - foreach($f_upload as $f) { |
|
| 279 | + foreach ($f_upload as $f) { |
|
| 280 | 280 | @copy($f, _DIR_TMP.$f); |
| 281 | 281 | } |
| 282 | 282 | /* deplacement des dumps */ |
| 283 | 283 | $f_session = preg_files('data', 'dump'); |
| 284 | 284 | $repertoire = _DIR_DUMP; |
| 285 | - if(!@file_exists($repertoire)) { |
|
| 285 | + if (!@file_exists($repertoire)) { |
|
| 286 | 286 | $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
| 287 | 287 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 288 | 288 | } |
| 289 | - foreach($f_session as $f) { |
|
| 289 | + foreach ($f_session as $f) { |
|
| 290 | 290 | $d = basename($f); |
| 291 | 291 | @copy($f, $repertoire.$d); |
| 292 | 292 | } |
@@ -65,10 +65,10 @@ |
||
| 65 | 65 | do { |
| 66 | 66 | $discussion = "0"; |
| 67 | 67 | $precedent = 0; |
| 68 | - $r = sql_select("fille.id_forum AS id, maman.id_thread AS thread", 'spip_forum AS fille, spip_forum AS maman', "fille.id_parent = maman.id_forum AND fille.id_thread <> maman.id_thread",'', "thread"); |
|
| 68 | + $r = sql_select("fille.id_forum AS id, maman.id_thread AS thread", 'spip_forum AS fille, spip_forum AS maman', "fille.id_parent = maman.id_forum AND fille.id_thread <> maman.id_thread", '', "thread"); |
|
| 69 | 69 | while ($row = sql_fetch($r)) { |
| 70 | 70 | if ($row['thread'] == $precedent) |
| 71 | - $discussion .= "," . $row['id']; |
|
| 71 | + $discussion .= ",".$row['id']; |
|
| 72 | 72 | else { |
| 73 | 73 | if ($precedent) |
| 74 | 74 | sql_updateq("spip_forum", array("id_thread" => $precedent), "id_forum IN ($discussion)"); |
@@ -17,28 +17,28 @@ |
||
| 17 | 17 | |
| 18 | 18 | if (upgrade_vers(1.01, $version_installee, $version_cible)) { |
| 19 | 19 | spip_query("UPDATE spip_forum SET statut='publie' WHERE statut=''"); |
| 20 | - maj_version (1.01); |
|
| 20 | + maj_version(1.01); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (upgrade_vers(1.02, $version_installee, $version_cible)) { |
| 24 | 24 | spip_query("ALTER TABLE spip_forum ADD id_auteur BIGINT DEFAULT '0' NOT NULL"); |
| 25 | - maj_version (1.02); |
|
| 25 | + maj_version(1.02); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | if (upgrade_vers(1.03, $version_installee, $version_cible)) { |
| 29 | 29 | spip_query("DROP TABLE spip_maj"); |
| 30 | - maj_version (1.03); |
|
| 30 | + maj_version(1.03); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | if (upgrade_vers(1.04, $version_installee, $version_cible)) { |
| 34 | 34 | spip_query("ALTER TABLE spip_articles ADD accepter_forum VARCHAR(3)"); |
| 35 | - maj_version (1.04); |
|
| 35 | + maj_version(1.04); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (upgrade_vers(1.05, $version_installee, $version_cible)) { |
| 39 | 39 | spip_query("DROP TABLE spip_petition"); |
| 40 | 40 | spip_query("DROP TABLE spip_signatures_petition"); |
| 41 | - maj_version (1.05); |
|
| 41 | + maj_version(1.05); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | : ((defined('_NANO_SHA2_UPPER')) ? true : false); |
| 84 | 84 | |
| 85 | 85 | // Deteremine if the system is 32 or 64 bit. |
| 86 | - $tmpInt = (int)4294967295; |
|
| 86 | + $tmpInt = (int) 4294967295; |
|
| 87 | 87 | $this->platform = ($tmpInt > 0) ? 64 : 32; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | if ($x < 0) { |
| 96 | 96 | $x &= 0x7FFFFFFF; |
| 97 | - $x = (float)$x + $mask; |
|
| 97 | + $x = (float) $x + $mask; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | if ($y < 0) { |
| 101 | 101 | $y &= 0x7FFFFFFF; |
| 102 | - $y = (float)$y + $mask; |
|
| 102 | + $y = (float) $y + $mask; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $r = $x + $y; |
@@ -110,52 +110,52 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - return (int)$r; |
|
| 113 | + return (int) $r; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Logical bitwise right shift (PHP default is arithmetic shift) |
| 117 | 117 | function SHR($x, $n) // x >> n |
| 118 | 118 | { |
| 119 | 119 | if ($n >= 32) { // impose some limits to keep it 32-bit |
| 120 | - return (int)0; |
|
| 120 | + return (int) 0; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if ($n <= 0) { |
| 124 | - return (int)$x; |
|
| 124 | + return (int) $x; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $mask = 0x40000000; |
| 128 | 128 | |
| 129 | 129 | if ($x < 0) { |
| 130 | 130 | $x &= 0x7FFFFFFF; |
| 131 | - $mask = $mask >> ($n-1); |
|
| 131 | + $mask = $mask >> ($n - 1); |
|
| 132 | 132 | return ($x >> $n) | $mask; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - return (int)$x >> (int)$n; |
|
| 135 | + return (int) $x >> (int) $n; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - function ROTR($x, $n) { return (int)(($this->SHR($x, $n) | ($x << (32-$n)) & 0xFFFFFFFF)); } |
|
| 138 | + function ROTR($x, $n) { return (int) (($this->SHR($x, $n) | ($x << (32 - $n)) & 0xFFFFFFFF)); } |
|
| 139 | 139 | function Ch($x, $y, $z) { return ($x & $y) ^ ((~$x) & $z); } |
| 140 | 140 | function Maj($x, $y, $z) { return ($x & $y) ^ ($x & $z) ^ ($y & $z); } |
| 141 | - function Sigma0($x) { return (int) ($this->ROTR($x, 2)^$this->ROTR($x, 13)^$this->ROTR($x, 22)); } |
|
| 142 | - function Sigma1($x) { return (int) ($this->ROTR($x, 6)^$this->ROTR($x, 11)^$this->ROTR($x, 25)); } |
|
| 143 | - function sigma_0($x) { return (int) ($this->ROTR($x, 7)^$this->ROTR($x, 18)^$this->SHR($x, 3)); } |
|
| 144 | - function sigma_1($x) { return (int) ($this->ROTR($x, 17)^$this->ROTR($x, 19)^$this->SHR($x, 10)); } |
|
| 141 | + function Sigma0($x) { return (int) ($this->ROTR($x, 2) ^ $this->ROTR($x, 13) ^ $this->ROTR($x, 22)); } |
|
| 142 | + function Sigma1($x) { return (int) ($this->ROTR($x, 6) ^ $this->ROTR($x, 11) ^ $this->ROTR($x, 25)); } |
|
| 143 | + function sigma_0($x) { return (int) ($this->ROTR($x, 7) ^ $this->ROTR($x, 18) ^ $this->SHR($x, 3)); } |
|
| 144 | + function sigma_1($x) { return (int) ($this->ROTR($x, 17) ^ $this->ROTR($x, 19) ^ $this->SHR($x, 10)); } |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | - function string2ordUTF8($s,&$byteSize){ |
|
| 147 | + function string2ordUTF8($s, &$byteSize) { |
|
| 148 | 148 | $chars = array(); |
| 149 | 149 | // par defaut sur 8bits |
| 150 | 150 | $byteSize = 8; |
| 151 | 151 | $i = 0; |
| 152 | - while ($i<strlen($s)){ |
|
| 152 | + while ($i < strlen($s)) { |
|
| 153 | 153 | $chars[] = $this->ordUTF8($s, $i, $bytes); |
| 154 | - $i+=$bytes; |
|
| 154 | + $i += $bytes; |
|
| 155 | 155 | // mais si un char necessite 16bits, on passe tout sur 16 |
| 156 | 156 | // sinon on ne concorde pas avec le lecture de la chaine en js |
| 157 | 157 | // et le sha256 js |
| 158 | - if ($bytes>1) $byteSize = 16; |
|
| 158 | + if ($bytes > 1) $byteSize = 16; |
|
| 159 | 159 | } |
| 160 | 160 | return $chars; |
| 161 | 161 | } |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | $bytes = 1; |
| 175 | 175 | return $h; |
| 176 | 176 | } |
| 177 | - else if ($h < 0xC2){ |
|
| 177 | + else if ($h < 0xC2) { |
|
| 178 | 178 | // pas utf mais renvoyer quand meme ce qu'on a |
| 179 | 179 | $bytes = 1; |
| 180 | 180 | return $h; |
| 181 | 181 | } |
| 182 | 182 | else if ($h <= 0xDF && $index < $len - 1) { |
| 183 | 183 | $bytes = 2; |
| 184 | - return ($h & 0x1F) << 6 | (ord($c{$index + 1}) & 0x3F); |
|
| 184 | + return ($h & 0x1F) << 6 | (ord($c{$index + 1}) & 0x3F); |
|
| 185 | 185 | } |
| 186 | 186 | else if ($h <= 0xEF && $index < $len - 2) { |
| 187 | 187 | $bytes = 3; |
@@ -201,33 +201,33 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - function string2binint ($str,$npad=512) { |
|
| 204 | + function string2binint($str, $npad = 512) { |
|
| 205 | 205 | $bin = array(); |
| 206 | - $ords = $this->string2ordUTF8($str,$this->bytesString); |
|
| 207 | - $npad = $npad/$this->bytesString; |
|
| 206 | + $ords = $this->string2ordUTF8($str, $this->bytesString); |
|
| 207 | + $npad = $npad / $this->bytesString; |
|
| 208 | 208 | $length = count($ords); |
| 209 | 209 | $ords[] = 0x80; // append the "1" bit followed by 7 0's |
| 210 | - $pad = ceil(($length+1+32/$this->bytesString)/$npad)*$npad-32/$this->bytesString; |
|
| 211 | - $ords = array_pad($ords,$pad,0); |
|
| 210 | + $pad = ceil(($length + 1 + 32 / $this->bytesString) / $npad) * $npad - 32 / $this->bytesString; |
|
| 211 | + $ords = array_pad($ords, $pad, 0); |
|
| 212 | 212 | $mask = (1 << $this->bytesString) - 1; |
| 213 | - for($i = 0; $i < count($ords) * $this->bytesString; $i += $this->bytesString) { |
|
| 214 | - if (!isset($bin[$i>>5])) { $bin[$i>>5] = 0; } // pour eviter des notices. |
|
| 215 | - $bin[$i>>5] |= ($ords[$i / $this->bytesString] & $mask) << (24 - $i%32); |
|
| 213 | + for ($i = 0; $i < count($ords) * $this->bytesString; $i += $this->bytesString) { |
|
| 214 | + if (!isset($bin[$i >> 5])) { $bin[$i >> 5] = 0; } // pour eviter des notices. |
|
| 215 | + $bin[$i >> 5] |= ($ords[$i / $this->bytesString] & $mask) << (24 - $i % 32); |
|
| 216 | 216 | } |
| 217 | - $bin[] = $length*$this->bytesString; |
|
| 217 | + $bin[] = $length * $this->bytesString; |
|
| 218 | 218 | return $bin; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | function array_split($a, $n) { |
| 222 | 222 | $split = array(); |
| 223 | - while (count($a)>$n) { |
|
| 223 | + while (count($a) > $n) { |
|
| 224 | 224 | $s = array(); |
| 225 | - for($i = 0;$i<$n;$i++) |
|
| 225 | + for ($i = 0; $i < $n; $i++) |
|
| 226 | 226 | $s[] = array_shift($a); |
| 227 | 227 | $split[] = $s; |
| 228 | 228 | } |
| 229 | - if (count($a)){ |
|
| 230 | - $a = array_pad($a,$n,0); |
|
| 229 | + if (count($a)) { |
|
| 230 | + $a = array_pad($a, $n, 0); |
|
| 231 | 231 | $split[] = $a; |
| 232 | 232 | } |
| 233 | 233 | return $split; |
@@ -242,12 +242,12 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | function hash($str, $ig_func = true) |
| 244 | 244 | { |
| 245 | - unset($binStr); // binary representation of input string |
|
| 246 | - unset($hexStr); // 256-bit message digest in readable hex format |
|
| 245 | + unset($binStr); // binary representation of input string |
|
| 246 | + unset($hexStr); // 256-bit message digest in readable hex format |
|
| 247 | 247 | |
| 248 | 248 | // check for php's internal sha256 function, ignore if ig_func==true |
| 249 | 249 | if ($ig_func == false) { |
| 250 | - if (version_compare(PHP_VERSION,'5.1.2','>=') AND !defined('_NO_HASH_DEFINED')) { |
|
| 250 | + if (version_compare(PHP_VERSION, '5.1.2', '>=') AND !defined('_NO_HASH_DEFINED')) { |
|
| 251 | 251 | return hash("sha256", $str, false); |
| 252 | 252 | } else if (function_exists('mhash') && defined('MHASH_SHA256')) { |
| 253 | 253 | return base64_encode(bin2hex(mhash(MHASH_SHA256, $str))); |
@@ -260,44 +260,44 @@ discard block |
||
| 260 | 260 | * first thirty-two bits of the fractional parts of the cube roots |
| 261 | 261 | * of the first sixtyfour prime numbers. |
| 262 | 262 | */ |
| 263 | - $K = array((int)0x428a2f98, (int)0x71374491, (int)0xb5c0fbcf, |
|
| 264 | - (int)0xe9b5dba5, (int)0x3956c25b, (int)0x59f111f1, |
|
| 265 | - (int)0x923f82a4, (int)0xab1c5ed5, (int)0xd807aa98, |
|
| 266 | - (int)0x12835b01, (int)0x243185be, (int)0x550c7dc3, |
|
| 267 | - (int)0x72be5d74, (int)0x80deb1fe, (int)0x9bdc06a7, |
|
| 268 | - (int)0xc19bf174, (int)0xe49b69c1, (int)0xefbe4786, |
|
| 269 | - (int)0x0fc19dc6, (int)0x240ca1cc, (int)0x2de92c6f, |
|
| 270 | - (int)0x4a7484aa, (int)0x5cb0a9dc, (int)0x76f988da, |
|
| 271 | - (int)0x983e5152, (int)0xa831c66d, (int)0xb00327c8, |
|
| 272 | - (int)0xbf597fc7, (int)0xc6e00bf3, (int)0xd5a79147, |
|
| 273 | - (int)0x06ca6351, (int)0x14292967, (int)0x27b70a85, |
|
| 274 | - (int)0x2e1b2138, (int)0x4d2c6dfc, (int)0x53380d13, |
|
| 275 | - (int)0x650a7354, (int)0x766a0abb, (int)0x81c2c92e, |
|
| 276 | - (int)0x92722c85, (int)0xa2bfe8a1, (int)0xa81a664b, |
|
| 277 | - (int)0xc24b8b70, (int)0xc76c51a3, (int)0xd192e819, |
|
| 278 | - (int)0xd6990624, (int)0xf40e3585, (int)0x106aa070, |
|
| 279 | - (int)0x19a4c116, (int)0x1e376c08, (int)0x2748774c, |
|
| 280 | - (int)0x34b0bcb5, (int)0x391c0cb3, (int)0x4ed8aa4a, |
|
| 281 | - (int)0x5b9cca4f, (int)0x682e6ff3, (int)0x748f82ee, |
|
| 282 | - (int)0x78a5636f, (int)0x84c87814, (int)0x8cc70208, |
|
| 283 | - (int)0x90befffa, (int)0xa4506ceb, (int)0xbef9a3f7, |
|
| 284 | - (int)0xc67178f2); |
|
| 263 | + $K = array((int) 0x428a2f98, (int) 0x71374491, (int) 0xb5c0fbcf, |
|
| 264 | + (int) 0xe9b5dba5, (int) 0x3956c25b, (int) 0x59f111f1, |
|
| 265 | + (int) 0x923f82a4, (int) 0xab1c5ed5, (int) 0xd807aa98, |
|
| 266 | + (int) 0x12835b01, (int) 0x243185be, (int) 0x550c7dc3, |
|
| 267 | + (int) 0x72be5d74, (int) 0x80deb1fe, (int) 0x9bdc06a7, |
|
| 268 | + (int) 0xc19bf174, (int) 0xe49b69c1, (int) 0xefbe4786, |
|
| 269 | + (int) 0x0fc19dc6, (int) 0x240ca1cc, (int) 0x2de92c6f, |
|
| 270 | + (int) 0x4a7484aa, (int) 0x5cb0a9dc, (int) 0x76f988da, |
|
| 271 | + (int) 0x983e5152, (int) 0xa831c66d, (int) 0xb00327c8, |
|
| 272 | + (int) 0xbf597fc7, (int) 0xc6e00bf3, (int) 0xd5a79147, |
|
| 273 | + (int) 0x06ca6351, (int) 0x14292967, (int) 0x27b70a85, |
|
| 274 | + (int) 0x2e1b2138, (int) 0x4d2c6dfc, (int) 0x53380d13, |
|
| 275 | + (int) 0x650a7354, (int) 0x766a0abb, (int) 0x81c2c92e, |
|
| 276 | + (int) 0x92722c85, (int) 0xa2bfe8a1, (int) 0xa81a664b, |
|
| 277 | + (int) 0xc24b8b70, (int) 0xc76c51a3, (int) 0xd192e819, |
|
| 278 | + (int) 0xd6990624, (int) 0xf40e3585, (int) 0x106aa070, |
|
| 279 | + (int) 0x19a4c116, (int) 0x1e376c08, (int) 0x2748774c, |
|
| 280 | + (int) 0x34b0bcb5, (int) 0x391c0cb3, (int) 0x4ed8aa4a, |
|
| 281 | + (int) 0x5b9cca4f, (int) 0x682e6ff3, (int) 0x748f82ee, |
|
| 282 | + (int) 0x78a5636f, (int) 0x84c87814, (int) 0x8cc70208, |
|
| 283 | + (int) 0x90befffa, (int) 0xa4506ceb, (int) 0xbef9a3f7, |
|
| 284 | + (int) 0xc67178f2); |
|
| 285 | 285 | |
| 286 | 286 | // Pre-processing: Padding the string |
| 287 | - $binStr = $this->string2binint($str,512); |
|
| 287 | + $binStr = $this->string2binint($str, 512); |
|
| 288 | 288 | |
| 289 | 289 | // Parsing the Padded Message (Break into N 512-bit blocks) |
| 290 | 290 | $M = $this->array_split($binStr, 16); |
| 291 | 291 | |
| 292 | 292 | // Set the initial hash values |
| 293 | - $h[0] = (int)0x6a09e667; |
|
| 294 | - $h[1] = (int)0xbb67ae85; |
|
| 295 | - $h[2] = (int)0x3c6ef372; |
|
| 296 | - $h[3] = (int)0xa54ff53a; |
|
| 297 | - $h[4] = (int)0x510e527f; |
|
| 298 | - $h[5] = (int)0x9b05688c; |
|
| 299 | - $h[6] = (int)0x1f83d9ab; |
|
| 300 | - $h[7] = (int)0x5be0cd19; |
|
| 293 | + $h[0] = (int) 0x6a09e667; |
|
| 294 | + $h[1] = (int) 0xbb67ae85; |
|
| 295 | + $h[2] = (int) 0x3c6ef372; |
|
| 296 | + $h[3] = (int) 0xa54ff53a; |
|
| 297 | + $h[4] = (int) 0x510e527f; |
|
| 298 | + $h[5] = (int) 0x9b05688c; |
|
| 299 | + $h[6] = (int) 0x1f83d9ab; |
|
| 300 | + $h[7] = (int) 0x5be0cd19; |
|
| 301 | 301 | |
| 302 | 302 | // loop through message blocks and compute hash. ( For i=1 to N : ) |
| 303 | 303 | $N = count($M); |
@@ -307,14 +307,14 @@ discard block |
||
| 307 | 307 | $MI = $M[$i]; |
| 308 | 308 | |
| 309 | 309 | // Initialize working variables |
| 310 | - $_a = (int)$h[0]; |
|
| 311 | - $_b = (int)$h[1]; |
|
| 312 | - $_c = (int)$h[2]; |
|
| 313 | - $_d = (int)$h[3]; |
|
| 314 | - $_e = (int)$h[4]; |
|
| 315 | - $_f = (int)$h[5]; |
|
| 316 | - $_g = (int)$h[6]; |
|
| 317 | - $_h = (int)$h[7]; |
|
| 310 | + $_a = (int) $h[0]; |
|
| 311 | + $_b = (int) $h[1]; |
|
| 312 | + $_c = (int) $h[2]; |
|
| 313 | + $_d = (int) $h[3]; |
|
| 314 | + $_e = (int) $h[4]; |
|
| 315 | + $_f = (int) $h[5]; |
|
| 316 | + $_g = (int) $h[6]; |
|
| 317 | + $_h = (int) $h[7]; |
|
| 318 | 318 | unset($_s0); |
| 319 | 319 | unset($_s1); |
| 320 | 320 | unset($_T1); |
@@ -339,15 +339,15 @@ discard block |
||
| 339 | 339 | for (; $t < 64; $t++) |
| 340 | 340 | { |
| 341 | 341 | // Continue building the message schedule as we loop |
| 342 | - $_s0 = $W[($t+1)&0x0F]; |
|
| 342 | + $_s0 = $W[($t + 1) & 0x0F]; |
|
| 343 | 343 | $_s0 = $this->sigma_0($_s0); |
| 344 | - $_s1 = $W[($t+14)&0x0F]; |
|
| 344 | + $_s1 = $W[($t + 14) & 0x0F]; |
|
| 345 | 345 | $_s1 = $this->sigma_1($_s1); |
| 346 | 346 | |
| 347 | - $W[$t&0xF] = $this->addmod2n($this->addmod2n($this->addmod2n($W[$t&0xF], $_s0), $_s1), $W[($t+9)&0x0F]); |
|
| 347 | + $W[$t & 0xF] = $this->addmod2n($this->addmod2n($this->addmod2n($W[$t & 0xF], $_s0), $_s1), $W[($t + 9) & 0x0F]); |
|
| 348 | 348 | |
| 349 | 349 | // Compute hash |
| 350 | - $_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)), $this->Ch($_e, $_f, $_g)), $K[$t]), $W[$t&0xF]); |
|
| 350 | + $_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)), $this->Ch($_e, $_f, $_g)), $K[$t]), $W[$t & 0xF]); |
|
| 351 | 351 | $_T2 = $this->addmod2n($this->Sigma0($_a), $this->Maj($_a, $_b, $_c)); |
| 352 | 352 | |
| 353 | 353 | // Update working variables |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | for ($i = 0; $i < $strlen; $i++) |
| 398 | 398 | { |
| 399 | 399 | $i = (($sign < 0) ? $i + $length : $i); |
| 400 | - $result[] = substr($string, $sign*$i, $length); |
|
| 400 | + $result[] = substr($string, $sign * $i, $length); |
|
| 401 | 401 | $i--; |
| 402 | 402 | $i = (($sign < 0) ? $i : $i + $length); |
| 403 | 403 | |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | // support to give php4 the hash() routine which abstracts this code. |
| 435 | 435 | if (!function_exists('hash')) |
| 436 | 436 | { |
| 437 | - define('_NO_HASH_DEFINED',true); |
|
| 437 | + define('_NO_HASH_DEFINED', true); |
|
| 438 | 438 | function hash($algo, $data) |
| 439 | 439 | { |
| 440 | 440 | if (empty($algo) || !is_string($algo) || !is_string($data)) { |