@@ -25,7 +25,7 @@ |
||
| 25 | 25 | if (!strlen($phrase)) |
| 26 | 26 | return; |
| 27 | 27 | if ($opt) |
| 28 | - $phrase .= " :: ".str_replace("\n", ' ', join(', ',$opt)); |
|
| 28 | + $phrase .= " :: ".str_replace("\n", ' ', join(', ', $opt)); |
|
| 29 | 29 | spip_log($phrase, 'journal'); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | // si elle y est deja c'est qu'il y a eu suspension du script, on reprend. |
| 18 | 18 | |
| 19 | 19 | // http://doc.spip.org/@inc_admin_dist |
| 20 | -function inc_admin_dist($script, $titre, $comment='', $anonymous=false) |
|
| 20 | +function inc_admin_dist($script, $titre, $comment = '', $anonymous = false) |
|
| 21 | 21 | { |
| 22 | 22 | $reprise = true; |
| 23 | 23 | if (!isset($GLOBALS['meta'][$script]) |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | $reprise = false; |
| 26 | 26 | $res = debut_admin($script, $titre, $comment); |
| 27 | 27 | if ($res) return $res; |
| 28 | - spip_log("meta: $script " . join(',', $_POST)); |
|
| 28 | + spip_log("meta: $script ".join(',', $_POST)); |
|
| 29 | 29 | ecrire_meta($script, serialize($_POST)); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $res = admin_verifie_session($script,$anonymous); |
|
| 32 | + $res = admin_verifie_session($script, $anonymous); |
|
| 33 | 33 | if ($res) return $res; |
| 34 | 34 | $base = charger_fonction($script, 'base'); |
| 35 | - $base($titre,$reprise); |
|
| 35 | + $base($titre, $reprise); |
|
| 36 | 36 | fin_admin($script); |
| 37 | 37 | return ''; |
| 38 | 38 | } |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | // c'est que l'operation se passe mal, on la stoppe |
| 54 | 54 | |
| 55 | 55 | // http://doc.spip.org/@admin_verifie_session |
| 56 | -function admin_verifie_session($script, $anonymous=false) { |
|
| 56 | +function admin_verifie_session($script, $anonymous = false) { |
|
| 57 | 57 | |
| 58 | 58 | include_spip('base/abstract_sql'); |
| 59 | - $pref = sprintf("_%d_",$GLOBALS['visiteur_session']['id_auteur']); |
|
| 59 | + $pref = sprintf("_%d_", $GLOBALS['visiteur_session']['id_auteur']); |
|
| 60 | 60 | $signal = fichier_admin($script, "$script$pref"); |
| 61 | 61 | $valeur = sql_getfetsel('valeur', 'spip_meta', "nom='admin'"); |
| 62 | 62 | if ($valeur === NULL) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } else { |
| 65 | 65 | if (!$anonymous AND ($valeur != $signal)) { |
| 66 | 66 | if (!preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']["admin"], $l) |
| 67 | - OR intval($l[2])!=$GLOBALS['visiteur_session']['id_auteur']) { |
|
| 67 | + OR intval($l[2]) != $GLOBALS['visiteur_session']['id_auteur']) { |
|
| 68 | 68 | include_spip('inc/minipres'); |
| 69 | 69 | spip_log("refus de lancer $script, priorite a $valeur"); |
| 70 | 70 | return minipres(_T('info_travaux_texte')); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $journal = 'webmestre'; |
| 77 | 77 | // on pourrait statuer automatiquement les webmestres a l'init d'une action auth par ftp ... ? |
| 78 | 78 | |
| 79 | - spip_log("admin $pref" . ($valeur ? " (reprise)" : ' (init)'),$journal); |
|
| 79 | + spip_log("admin $pref".($valeur ? " (reprise)" : ' (init)'), $journal); |
|
| 80 | 80 | return ''; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | if (autoriser('configurer')) { |
| 87 | 87 | return _DIR_TMP; |
| 88 | 88 | } else { |
| 89 | - return _DIR_TRANSFERT . $GLOBALS['visiteur_session']['login'] . '/'; |
|
| 89 | + return _DIR_TRANSFERT.$GLOBALS['visiteur_session']['login'].'/'; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | // http://doc.spip.org/@fichier_admin |
| 94 | -function fichier_admin($action, $pref='admin_') { |
|
| 94 | +function fichier_admin($action, $pref = 'admin_') { |
|
| 95 | 95 | |
| 96 | - return $pref . |
|
| 96 | + return $pref. |
|
| 97 | 97 | substr(md5($action.(time() & ~2047).$GLOBALS['visiteur_session']['login']), 0, 10); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // ou retourne sans rien faire si repertoire deja la. |
| 102 | 102 | |
| 103 | 103 | // http://doc.spip.org/@debut_admin |
| 104 | -function debut_admin($script, $action='', $corps='') { |
|
| 104 | +function debut_admin($script, $action = '', $corps = '') { |
|
| 105 | 105 | |
| 106 | 106 | if ((!$action) || !(autoriser('webmestre') OR autoriser('chargerftp'))) { |
| 107 | 107 | include_spip('inc/minipres'); |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | } else { |
| 110 | 110 | $dir = dir_admin(); |
| 111 | 111 | $signal = fichier_admin($script); |
| 112 | - if (@file_exists($dir . $signal)) { |
|
| 113 | - spip_log ("Action admin: $action"); |
|
| 112 | + if (@file_exists($dir.$signal)) { |
|
| 113 | + spip_log("Action admin: $action"); |
|
| 114 | 114 | return ''; |
| 115 | 115 | } |
| 116 | 116 | include_spip('inc/minipres'); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if ((autoriser('webmestre') OR $script === 'repair') |
| 121 | 121 | AND $script != 'delete_all') { |
| 122 | 122 | if (_request('validation_admin') == $signal) { |
| 123 | - spip_log ("Action super-admin: $action"); |
|
| 123 | + spip_log("Action super-admin: $action"); |
|
| 124 | 124 | return ''; |
| 125 | 125 | } |
| 126 | 126 | $corps .= '<input type="hidden" name="validation_admin" value="'.$signal.'" />'; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } else { |
| 130 | 130 | // cet appel permet d'assurer un copier-coller du nom du repertoire a creer dans tmp (esj) |
| 131 | 131 | // l'insertion du script a cet endroit n'est pas xhtml licite mais evite de l'embarquer dans toutes les pages minipres |
| 132 | - $corps .= http_script('', "spip_barre.js"); |
|
| 132 | + $corps .= http_script('', "spip_barre.js"); |
|
| 133 | 133 | |
| 134 | 134 | $corps .= "<fieldset><legend>" |
| 135 | 135 | . _T('info_authentification_ftp') |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | // http://doc.spip.org/@fin_admin |
| 169 | 169 | function fin_admin($action) { |
| 170 | - $signal = dir_admin() . fichier_admin($action); |
|
| 170 | + $signal = dir_admin().fichier_admin($action); |
|
| 171 | 171 | spip_unlink($signal); |
| 172 | 172 | if ($action != 'delete_all') { |
| 173 | 173 | effacer_meta($action); |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // http://doc.spip.org/@copy_request |
| 180 | -function copy_request($script, $suite, $submit='') |
|
| 180 | +function copy_request($script, $suite, $submit = '') |
|
| 181 | 181 | { |
| 182 | 182 | include_spip('inc/filtres'); |
| 183 | - foreach(array_merge($_POST,$_GET) as $n => $c) { |
|
| 184 | - if (!in_array($n,array('fichier','exec','validation_admin')) AND !is_array($c)) |
|
| 185 | - $suite .= "\n<input type='hidden' name='".spip_htmlspecialchars($n)."' value='" . |
|
| 186 | - entites_html($c) . |
|
| 183 | + foreach (array_merge($_POST, $_GET) as $n => $c) { |
|
| 184 | + if (!in_array($n, array('fichier', 'exec', 'validation_admin')) AND !is_array($c)) |
|
| 185 | + $suite .= "\n<input type='hidden' name='".spip_htmlspecialchars($n)."' value='". |
|
| 186 | + entites_html($c). |
|
| 187 | 187 | "' />"; |
| 188 | 188 | } |
| 189 | 189 | return generer_form_ecrire($script, $suite, '', $submit); |
@@ -39,17 +39,17 @@ |
||
| 39 | 39 | |
| 40 | 40 | $ref = $_SERVER['HTTP_REFERER']; |
| 41 | 41 | //avoid a js injection |
| 42 | - if ($surcharge_surligne){ |
|
| 42 | + if ($surcharge_surligne) { |
|
| 43 | 43 | $surcharge_surligne = preg_replace(",(?<!\\\\)((?:(?>\\\\){2})*)('),", "$1\\\\$2", $surcharge_surligne); |
| 44 | 44 | $surcharge_surligne = str_replace("\\", "\\\\", $surcharge_surligne); |
| 45 | - if ($GLOBALS['meta']['charset']=='utf-8'){ |
|
| 45 | + if ($GLOBALS['meta']['charset'] == 'utf-8') { |
|
| 46 | 46 | include_spip('inc/charsets'); |
| 47 | 47 | if (!is_utf8($surcharge_surligne)) $surcharge_surligne = utf8_encode($surcharge_surligne); |
| 48 | 48 | } |
| 49 | 49 | $surcharge_surligne = preg_replace(',\*$,', '', trim($surcharge_surligne)); # supprimer un * final |
| 50 | 50 | } |
| 51 | 51 | foreach ($surlignejs_engines as $engine) |
| 52 | - if ($surcharge_surligne || (preg_match($engine[0], $ref) && preg_match($engine[1], $ref))){ |
|
| 52 | + if ($surcharge_surligne || (preg_match($engine[0], $ref) && preg_match($engine[1], $ref))) { |
|
| 53 | 53 | |
| 54 | 54 | //good referrer found or var_recherche is not null |
| 55 | 55 | include_spip('inc/filtres'); |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | if ($GLOBALS['meta']['charset'] <> 'utf-8') { |
| 29 | 29 | $t = str_replace( |
| 30 | - array("’","“","”"), |
|
| 31 | - array("'", '"', '"'), |
|
| 30 | + array("’", "“", "”"), |
|
| 31 | + array("'", '"', '"'), |
|
| 32 | 32 | $t); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $t = str_replace( |
| 36 | 36 | array("—", "&endash;"), |
| 37 | - array("--","-" ), |
|
| 37 | + array("--", "-"), |
|
| 38 | 38 | $t); |
| 39 | 39 | |
| 40 | 40 | return $t; |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | $email_envoi = $destinataire; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (is_array($corps)){ |
|
| 86 | + if (is_array($corps)) { |
|
| 87 | 87 | $texte = $corps['texte']; |
| 88 | - $from = (isset($corps['from'])?$corps['from']:$from); |
|
| 89 | - $headers = (isset($corps['headers'])?$corps['headers']:$headers); |
|
| 88 | + $from = (isset($corps['from']) ? $corps['from'] : $from); |
|
| 89 | + $headers = (isset($corps['headers']) ? $corps['headers'] : $headers); |
|
| 90 | 90 | if (is_array($headers)) |
| 91 | - $headers = implode("\n",$headers); |
|
| 91 | + $headers = implode("\n", $headers); |
|
| 92 | 92 | $parts = ""; |
| 93 | 93 | if ($corps['pieces_jointes'] AND function_exists('mail_embarquer_pieces_jointes')) |
| 94 | 94 | $parts = mail_embarquer_pieces_jointes($corps['pieces_jointes']); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // ceci est la RegExp NO_REAL_NAME faisant hurler SpamAssassin |
| 101 | 101 | if (preg_match('/^["\s]*\<?\S+\@\S+\>?\s*$/', $from)) |
| 102 | - $from .= ' (' . str_replace(')','', translitteration(str_replace('@', ' at ', $from))) . ')'; |
|
| 102 | + $from .= ' ('.str_replace(')', '', translitteration(str_replace('@', ' at ', $from))).')'; |
|
| 103 | 103 | |
| 104 | 104 | // nettoyer les é ’, &emdash; etc... |
| 105 | 105 | // les 'cliquer ici' etc sont a eviter; voir: |
@@ -117,24 +117,24 @@ discard block |
||
| 117 | 117 | mb_internal_encoding('utf-8'); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if (function_exists('wordwrap') && (preg_match(',multipart/mixed,',$headers) == 0)) |
|
| 120 | + if (function_exists('wordwrap') && (preg_match(',multipart/mixed,', $headers) == 0)) |
|
| 121 | 121 | $texte = wordwrap($texte); |
| 122 | 122 | |
| 123 | 123 | list($headers, $texte) = mail_normaliser_headers($headers, $from, $destinataire, $texte, $parts); |
| 124 | 124 | |
| 125 | 125 | if (_OS_SERVEUR == 'windows') { |
| 126 | - $texte = preg_replace ("@\r*\n@","\r\n", $texte); |
|
| 127 | - $headers = preg_replace ("@\r*\n@","\r\n", $headers); |
|
| 128 | - $sujet = preg_replace ("@\r*\n@","\r\n", $sujet); |
|
| 126 | + $texte = preg_replace("@\r*\n@", "\r\n", $texte); |
|
| 127 | + $headers = preg_replace("@\r*\n@", "\r\n", $headers); |
|
| 128 | + $sujet = preg_replace("@\r*\n@", "\r\n", $sujet); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - spip_log("mail $destinataire\n$sujet\n$headers",'mails'); |
|
| 131 | + spip_log("mail $destinataire\n$sujet\n$headers", 'mails'); |
|
| 132 | 132 | // mode TEST : forcer l'email |
| 133 | 133 | if (defined('_TEST_EMAIL_DEST')) { |
| 134 | 134 | if (!_TEST_EMAIL_DEST) |
| 135 | 135 | return false; |
| 136 | 136 | else { |
| 137 | - $texte = "Dest : $destinataire\r\n" . $texte; |
|
| 137 | + $texte = "Dest : $destinataire\r\n".$texte; |
|
| 138 | 138 | $destinataire = _TEST_EMAIL_DEST; |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | return @mail($destinataire, $sujet, $texte, $headers); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | -function mail_normaliser_headers($headers, $from, $to, $texte, $parts="") |
|
| 145 | +function mail_normaliser_headers($headers, $from, $to, $texte, $parts = "") |
|
| 146 | 146 | { |
| 147 | 147 | $charset = $GLOBALS['meta']['charset']; |
| 148 | 148 | |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | // calculer un identifiant unique |
| 157 | 157 | preg_match('/@\S+/', $from, $domain); |
| 158 | - $uniq = rand() . '_' . md5($to . $texte) . $domain[0]; |
|
| 158 | + $uniq = rand().'_'.md5($to.$texte).$domain[0]; |
|
| 159 | 159 | |
| 160 | 160 | // Si multi-part, s'en servir comme borne ... |
| 161 | 161 | if ($parts) { |
| 162 | - $texte = "--$uniq\n$type\n" . $texte ."\n"; |
|
| 162 | + $texte = "--$uniq\n$type\n".$texte."\n"; |
|
| 163 | 163 | foreach ($parts as $part) { |
| 164 | - $n = strlen($part[1]) . ($part[0] ? "\n" : ''); |
|
| 164 | + $n = strlen($part[1]).($part[0] ? "\n" : ''); |
|
| 165 | 165 | $e = join("\n", $part[0]); |
| 166 | - $texte .= "\n--$uniq\nContent-Length: $n$e\n\n" . $part[1]; |
|
| 166 | + $texte .= "\n--$uniq\nContent-Length: $n$e\n\n".$part[1]; |
|
| 167 | 167 | } |
| 168 | 168 | $texte .= "\n\n--$uniq--\n"; |
| 169 | 169 | // Si boundary n'est pas entre guillemets, |
@@ -173,11 +173,11 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // .. et s'en servir pour plaire a SpamAssassin |
| 175 | 175 | |
| 176 | - $mid = 'Message-Id: <' . $uniq . ">"; |
|
| 176 | + $mid = 'Message-Id: <'.$uniq.">"; |
|
| 177 | 177 | |
| 178 | 178 | // indispensable pour les sites qui collent d'office From: serveur-http |
| 179 | 179 | // sauf si deja mis par l'envoyeur |
| 180 | - $rep = (strpos($headers,"Reply-To:")!==FALSE) ? '' : "Reply-To: $from\n"; |
|
| 180 | + $rep = (strpos($headers, "Reply-To:") !== FALSE) ? '' : "Reply-To: $from\n"; |
|
| 181 | 181 | |
| 182 | 182 | // Nettoyer les en-tetes envoyees |
| 183 | 183 | // Ajouter le \n final |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // Regarder dans le repertoire local des images TeX et blocs MathML |
| 39 | 39 | if (!@is_dir($dir_tex = _DIR_VAR.'cache-TeX/')) |
| 40 | - @mkdir ($dir_tex, _SPIP_CHMOD); |
|
| 41 | - $fichier = $dir_tex .md5(trim($tex)).$ext; |
|
| 40 | + @mkdir($dir_tex, _SPIP_CHMOD); |
|
| 41 | + $fichier = $dir_tex.md5(trim($tex)).$ext; |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | if (!@file_exists($fichier)) { |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | if ($server) { |
| 47 | 47 | spip_log($url = $server.'?'.rawurlencode($tex)); |
| 48 | 48 | include_spip('inc/distant'); |
| 49 | - recuperer_page($url,$fichier); |
|
| 49 | + recuperer_page($url, $fichier); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // MathML |
| 59 | 59 | if ($traiter_math == 'mathml') { |
| 60 | - return join(file("$fichier"),""); |
|
| 60 | + return join(file("$fichier"), ""); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // TeX |
@@ -76,35 +76,35 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // Fonction appelee par propre() s'il repere un mode <math> |
| 78 | 78 | // http://doc.spip.org/@traiter_math |
| 79 | -function traiter_math($letexte, $source='') { |
|
| 79 | +function traiter_math($letexte, $source = '') { |
|
| 80 | 80 | |
| 81 | 81 | $texte_a_voir = $letexte; |
| 82 | 82 | while (($debut = strpos($texte_a_voir, "<math>")) !== false) { |
| 83 | - if (!$fin = strpos($texte_a_voir,"</math>")) |
|
| 83 | + if (!$fin = strpos($texte_a_voir, "</math>")) |
|
| 84 | 84 | $fin = strlen($texte_a_voir); |
| 85 | 85 | |
| 86 | 86 | $texte_debut = substr($texte_a_voir, 0, $debut); |
| 87 | 87 | $texte_milieu = substr($texte_a_voir, |
| 88 | - $debut+strlen("<math>"), $fin-$debut-strlen("<math>")); |
|
| 88 | + $debut + strlen("<math>"), $fin - $debut - strlen("<math>")); |
|
| 89 | 89 | $texte_fin = substr($texte_a_voir, |
| 90 | - $fin+strlen("</math>"), strlen($texte_a_voir)); |
|
| 90 | + $fin + strlen("</math>"), strlen($texte_a_voir)); |
|
| 91 | 91 | |
| 92 | 92 | // Les doubles $$x^2$$ en mode 'div' |
| 93 | - while((preg_match(",[$][$]([^$]+)[$][$],",$texte_milieu, $regs))) { |
|
| 93 | + while ((preg_match(",[$][$]([^$]+)[$][$],", $texte_milieu, $regs))) { |
|
| 94 | 94 | $echap = "\n<p class=\"spip\" style=\"text-align: center;\">".produire_image_math($regs[1])."</p>\n"; |
| 95 | 95 | $pos = strpos($texte_milieu, $regs[0]); |
| 96 | - $texte_milieu = substr($texte_milieu,0,$pos) |
|
| 96 | + $texte_milieu = substr($texte_milieu, 0, $pos) |
|
| 97 | 97 | . code_echappement($echap, $source) |
| 98 | - . substr($texte_milieu,$pos+strlen($regs[0])); |
|
| 98 | + . substr($texte_milieu, $pos + strlen($regs[0])); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Les simples $x^2$ en mode 'span' |
| 102 | - while((preg_match(",[$]([^$]+)[$],",$texte_milieu, $regs))) { |
|
| 102 | + while ((preg_match(",[$]([^$]+)[$],", $texte_milieu, $regs))) { |
|
| 103 | 103 | $echap = produire_image_math($regs[1]); |
| 104 | 104 | $pos = strpos($texte_milieu, $regs[0]); |
| 105 | - $texte_milieu = substr($texte_milieu,0,$pos) |
|
| 105 | + $texte_milieu = substr($texte_milieu, 0, $pos) |
|
| 106 | 106 | . code_echappement($echap, $source) |
| 107 | - . substr($texte_milieu,$pos+strlen($regs[0])); |
|
| 107 | + . substr($texte_milieu, $pos + strlen($regs[0])); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $texte_a_voir = $texte_debut.$texte_milieu.$texte_fin; |
@@ -13,15 +13,15 @@ discard block |
||
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) return; |
| 14 | 14 | |
| 15 | 15 | // http://doc.spip.org/@inc_chercher_logo_dist |
| 16 | -function inc_chercher_logo_dist($id, $_id_objet, $mode='on') { |
|
| 16 | +function inc_chercher_logo_dist($id, $_id_objet, $mode = 'on') { |
|
| 17 | 17 | global $formats_logos; |
| 18 | 18 | # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() |
| 19 | 19 | |
| 20 | 20 | $type = type_du_logo($_id_objet); |
| 21 | - $nom = $type . $mode . intval($id); |
|
| 21 | + $nom = $type.$mode.intval($id); |
|
| 22 | 22 | |
| 23 | 23 | foreach ($formats_logos as $format) { |
| 24 | - if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { |
|
| 24 | + if (@file_exists($d = (_DIR_LOGOS.$nom.'.'.$format))) { |
|
| 25 | 25 | return array($d, _DIR_LOGOS, $nom, $format, @filemtime($d)); |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | function type_du_logo($_id_objet) { |
| 34 | 34 | return isset($GLOBALS['table_logos'][$_id_objet]) |
| 35 | 35 | ? $GLOBALS['table_logos'][$_id_objet] |
| 36 | - : objet_type(preg_replace(',^id_,','',$_id_objet)); |
|
| 36 | + : objet_type(preg_replace(',^id_,', '', $_id_objet)); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Exceptions standards (historique) |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | // ----- Constants |
| 37 | 37 | if (!defined('PCLZIP_READ_BLOCK_SIZE')) { |
| 38 | - define( 'PCLZIP_READ_BLOCK_SIZE', 2048 ); |
|
| 38 | + define('PCLZIP_READ_BLOCK_SIZE', 2048); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // ----- File list separator |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | //define( 'PCLZIP_SEPARATOR', ' ' ); |
| 50 | 50 | // Recommanded values for smart separation of filenames. |
| 51 | 51 | if (!defined('PCLZIP_SEPARATOR')) { |
| 52 | - define( 'PCLZIP_SEPARATOR', ',' ); |
|
| 52 | + define('PCLZIP_SEPARATOR', ','); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // ----- Error configuration |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | // you must ensure that you have included PclError library. |
| 59 | 59 | // [2,...] : reserved for futur use |
| 60 | 60 | if (!defined('PCLZIP_ERROR_EXTERNAL')) { |
| 61 | - define( 'PCLZIP_ERROR_EXTERNAL', 0 ); |
|
| 61 | + define('PCLZIP_ERROR_EXTERNAL', 0); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // ----- Optional static temporary directory |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' ); |
| 72 | 72 | // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' ); |
| 73 | 73 | if (!defined('PCLZIP_TEMPORARY_DIR')) { |
| 74 | - define( 'PCLZIP_TEMPORARY_DIR', '' ); |
|
| 74 | + define('PCLZIP_TEMPORARY_DIR', ''); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // ----- Optional threshold ratio for use of temporary files |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | // Samples : |
| 84 | 84 | // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 ); |
| 85 | 85 | if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) { |
| 86 | - define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 ); |
|
| 86 | + define('PCLZIP_TEMPORARY_FILE_RATIO', 0.47); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // -------------------------------------------------------------------------------- |
@@ -108,72 +108,72 @@ discard block |
||
| 108 | 108 | // -12 : Unable to rename file (rename) |
| 109 | 109 | // -13 : Invalid header checksum |
| 110 | 110 | // -14 : Invalid archive size |
| 111 | - define( 'PCLZIP_ERR_USER_ABORTED', 2 ); |
|
| 112 | - define( 'PCLZIP_ERR_NO_ERROR', 0 ); |
|
| 113 | - define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 ); |
|
| 114 | - define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 ); |
|
| 115 | - define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 ); |
|
| 116 | - define( 'PCLZIP_ERR_MISSING_FILE', -4 ); |
|
| 117 | - define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 ); |
|
| 118 | - define( 'PCLZIP_ERR_INVALID_ZIP', -6 ); |
|
| 119 | - define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 ); |
|
| 120 | - define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 ); |
|
| 121 | - define( 'PCLZIP_ERR_BAD_EXTENSION', -9 ); |
|
| 122 | - define( 'PCLZIP_ERR_BAD_FORMAT', -10 ); |
|
| 123 | - define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 ); |
|
| 124 | - define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 ); |
|
| 125 | - define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 ); |
|
| 126 | - define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 ); |
|
| 127 | - define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 ); |
|
| 128 | - define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 ); |
|
| 129 | - define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 ); |
|
| 130 | - define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 ); |
|
| 131 | - define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 ); |
|
| 132 | - define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 ); |
|
| 133 | - define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 ); |
|
| 111 | + define('PCLZIP_ERR_USER_ABORTED', 2); |
|
| 112 | + define('PCLZIP_ERR_NO_ERROR', 0); |
|
| 113 | + define('PCLZIP_ERR_WRITE_OPEN_FAIL', -1); |
|
| 114 | + define('PCLZIP_ERR_READ_OPEN_FAIL', -2); |
|
| 115 | + define('PCLZIP_ERR_INVALID_PARAMETER', -3); |
|
| 116 | + define('PCLZIP_ERR_MISSING_FILE', -4); |
|
| 117 | + define('PCLZIP_ERR_FILENAME_TOO_LONG', -5); |
|
| 118 | + define('PCLZIP_ERR_INVALID_ZIP', -6); |
|
| 119 | + define('PCLZIP_ERR_BAD_EXTRACTED_FILE', -7); |
|
| 120 | + define('PCLZIP_ERR_DIR_CREATE_FAIL', -8); |
|
| 121 | + define('PCLZIP_ERR_BAD_EXTENSION', -9); |
|
| 122 | + define('PCLZIP_ERR_BAD_FORMAT', -10); |
|
| 123 | + define('PCLZIP_ERR_DELETE_FILE_FAIL', -11); |
|
| 124 | + define('PCLZIP_ERR_RENAME_FILE_FAIL', -12); |
|
| 125 | + define('PCLZIP_ERR_BAD_CHECKSUM', -13); |
|
| 126 | + define('PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14); |
|
| 127 | + define('PCLZIP_ERR_MISSING_OPTION_VALUE', -15); |
|
| 128 | + define('PCLZIP_ERR_INVALID_OPTION_VALUE', -16); |
|
| 129 | + define('PCLZIP_ERR_ALREADY_A_DIRECTORY', -17); |
|
| 130 | + define('PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18); |
|
| 131 | + define('PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19); |
|
| 132 | + define('PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20); |
|
| 133 | + define('PCLZIP_ERR_DIRECTORY_RESTRICTION', -21); |
|
| 134 | 134 | |
| 135 | 135 | // ----- Options values |
| 136 | - define( 'PCLZIP_OPT_PATH', 77001 ); |
|
| 137 | - define( 'PCLZIP_OPT_ADD_PATH', 77002 ); |
|
| 138 | - define( 'PCLZIP_OPT_REMOVE_PATH', 77003 ); |
|
| 139 | - define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 ); |
|
| 140 | - define( 'PCLZIP_OPT_SET_CHMOD', 77005 ); |
|
| 141 | - define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 ); |
|
| 142 | - define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 ); |
|
| 143 | - define( 'PCLZIP_OPT_BY_NAME', 77008 ); |
|
| 144 | - define( 'PCLZIP_OPT_BY_INDEX', 77009 ); |
|
| 145 | - define( 'PCLZIP_OPT_BY_EREG', 77010 ); |
|
| 146 | - define( 'PCLZIP_OPT_BY_PREG', 77011 ); |
|
| 147 | - define( 'PCLZIP_OPT_COMMENT', 77012 ); |
|
| 148 | - define( 'PCLZIP_OPT_ADD_COMMENT', 77013 ); |
|
| 149 | - define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 ); |
|
| 150 | - define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 ); |
|
| 151 | - define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 ); |
|
| 152 | - define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 ); |
|
| 136 | + define('PCLZIP_OPT_PATH', 77001); |
|
| 137 | + define('PCLZIP_OPT_ADD_PATH', 77002); |
|
| 138 | + define('PCLZIP_OPT_REMOVE_PATH', 77003); |
|
| 139 | + define('PCLZIP_OPT_REMOVE_ALL_PATH', 77004); |
|
| 140 | + define('PCLZIP_OPT_SET_CHMOD', 77005); |
|
| 141 | + define('PCLZIP_OPT_EXTRACT_AS_STRING', 77006); |
|
| 142 | + define('PCLZIP_OPT_NO_COMPRESSION', 77007); |
|
| 143 | + define('PCLZIP_OPT_BY_NAME', 77008); |
|
| 144 | + define('PCLZIP_OPT_BY_INDEX', 77009); |
|
| 145 | + define('PCLZIP_OPT_BY_EREG', 77010); |
|
| 146 | + define('PCLZIP_OPT_BY_PREG', 77011); |
|
| 147 | + define('PCLZIP_OPT_COMMENT', 77012); |
|
| 148 | + define('PCLZIP_OPT_ADD_COMMENT', 77013); |
|
| 149 | + define('PCLZIP_OPT_PREPEND_COMMENT', 77014); |
|
| 150 | + define('PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015); |
|
| 151 | + define('PCLZIP_OPT_REPLACE_NEWER', 77016); |
|
| 152 | + define('PCLZIP_OPT_STOP_ON_ERROR', 77017); |
|
| 153 | 153 | // Having big trouble with crypt. Need to multiply 2 long int |
| 154 | 154 | // which is not correctly supported by PHP ... |
| 155 | 155 | //define( 'PCLZIP_OPT_CRYPT', 77018 ); |
| 156 | - define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 ); |
|
| 157 | - define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 ); |
|
| 158 | - define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias |
|
| 159 | - define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 ); |
|
| 160 | - define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias |
|
| 161 | - define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 ); |
|
| 162 | - define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias |
|
| 156 | + define('PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019); |
|
| 157 | + define('PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020); |
|
| 158 | + define('PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020); // alias |
|
| 159 | + define('PCLZIP_OPT_TEMP_FILE_ON', 77021); |
|
| 160 | + define('PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021); // alias |
|
| 161 | + define('PCLZIP_OPT_TEMP_FILE_OFF', 77022); |
|
| 162 | + define('PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022); // alias |
|
| 163 | 163 | |
| 164 | 164 | // ----- File description attributes |
| 165 | - define( 'PCLZIP_ATT_FILE_NAME', 79001 ); |
|
| 166 | - define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 ); |
|
| 167 | - define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 ); |
|
| 168 | - define( 'PCLZIP_ATT_FILE_MTIME', 79004 ); |
|
| 169 | - define( 'PCLZIP_ATT_FILE_CONTENT', 79005 ); |
|
| 170 | - define( 'PCLZIP_ATT_FILE_COMMENT', 79006 ); |
|
| 165 | + define('PCLZIP_ATT_FILE_NAME', 79001); |
|
| 166 | + define('PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002); |
|
| 167 | + define('PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003); |
|
| 168 | + define('PCLZIP_ATT_FILE_MTIME', 79004); |
|
| 169 | + define('PCLZIP_ATT_FILE_CONTENT', 79005); |
|
| 170 | + define('PCLZIP_ATT_FILE_COMMENT', 79006); |
|
| 171 | 171 | |
| 172 | 172 | // ----- Call backs values |
| 173 | - define( 'PCLZIP_CB_PRE_EXTRACT', 78001 ); |
|
| 174 | - define( 'PCLZIP_CB_POST_EXTRACT', 78002 ); |
|
| 175 | - define( 'PCLZIP_CB_PRE_ADD', 78003 ); |
|
| 176 | - define( 'PCLZIP_CB_POST_ADD', 78004 ); |
|
| 173 | + define('PCLZIP_CB_PRE_EXTRACT', 78001); |
|
| 174 | + define('PCLZIP_CB_POST_EXTRACT', 78002); |
|
| 175 | + define('PCLZIP_CB_PRE_ADD', 78003); |
|
| 176 | + define('PCLZIP_CB_POST_ADD', 78004); |
|
| 177 | 177 | /* For futur use |
| 178 | 178 | define( 'PCLZIP_CB_PRE_LIST', 78005 ); |
| 179 | 179 | define( 'PCLZIP_CB_POST_LIST', 78006 ); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // -------------------------------------------------------------------------------- |
| 279 | 279 | function create($p_filelist) |
| 280 | 280 | { |
| 281 | - $v_result=1; |
|
| 281 | + $v_result = 1; |
|
| 282 | 282 | |
| 283 | 283 | // ----- Reset the error handler |
| 284 | 284 | $this->privErrorReset(); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | // ----- Parse the options |
| 306 | 306 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
| 307 | - array (PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
| 307 | + array(PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
| 308 | 308 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
| 309 | 309 | PCLZIP_OPT_ADD_PATH => 'optional', |
| 310 | 310 | PCLZIP_CB_PRE_ADD => 'optional', |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | // ----- For each file in the list check the attributes |
| 392 | 392 | $v_supported_attributes |
| 393 | - = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' |
|
| 393 | + = array(PCLZIP_ATT_FILE_NAME => 'mandatory' |
|
| 394 | 394 | ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' |
| 395 | 395 | ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' |
| 396 | 396 | ,PCLZIP_ATT_FILE_MTIME => 'optional' |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | // -------------------------------------------------------------------------------- |
| 462 | 462 | function add($p_filelist) |
| 463 | 463 | { |
| 464 | - $v_result=1; |
|
| 464 | + $v_result = 1; |
|
| 465 | 465 | |
| 466 | 466 | // ----- Reset the error handler |
| 467 | 467 | $this->privErrorReset(); |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | // ----- Parse the options |
| 489 | 489 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
| 490 | - array (PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
| 490 | + array(PCLZIP_OPT_REMOVE_PATH => 'optional', |
|
| 491 | 491 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
| 492 | 492 | PCLZIP_OPT_ADD_PATH => 'optional', |
| 493 | 493 | PCLZIP_CB_PRE_ADD => 'optional', |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | |
| 574 | 574 | // ----- For each file in the list check the attributes |
| 575 | 575 | $v_supported_attributes |
| 576 | - = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' |
|
| 576 | + = array(PCLZIP_ATT_FILE_NAME => 'mandatory' |
|
| 577 | 577 | ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' |
| 578 | 578 | ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' |
| 579 | 579 | ,PCLZIP_ATT_FILE_MTIME => 'optional' |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | // -------------------------------------------------------------------------------- |
| 651 | 651 | function listContent() |
| 652 | 652 | { |
| 653 | - $v_result=1; |
|
| 653 | + $v_result = 1; |
|
| 654 | 654 | |
| 655 | 655 | // ----- Reset the error handler |
| 656 | 656 | $this->privErrorReset(); |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | // -------------------------------------------------------------------------------- |
| 708 | 708 | function extract() |
| 709 | 709 | { |
| 710 | - $v_result=1; |
|
| 710 | + $v_result = 1; |
|
| 711 | 711 | |
| 712 | 712 | // ----- Reset the error handler |
| 713 | 713 | $this->privErrorReset(); |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | |
| 741 | 741 | // ----- Parse the options |
| 742 | 742 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
| 743 | - array (PCLZIP_OPT_PATH => 'optional', |
|
| 743 | + array(PCLZIP_OPT_PATH => 'optional', |
|
| 744 | 744 | PCLZIP_OPT_REMOVE_PATH => 'optional', |
| 745 | 745 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
| 746 | 746 | PCLZIP_OPT_ADD_PATH => 'optional', |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | //function extractByIndex($p_index, options...) |
| 865 | 865 | function extractByIndex($p_index) |
| 866 | 866 | { |
| 867 | - $v_result=1; |
|
| 867 | + $v_result = 1; |
|
| 868 | 868 | |
| 869 | 869 | // ----- Reset the error handler |
| 870 | 870 | $this->privErrorReset(); |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | |
| 902 | 902 | // ----- Parse the options |
| 903 | 903 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
| 904 | - array (PCLZIP_OPT_PATH => 'optional', |
|
| 904 | + array(PCLZIP_OPT_PATH => 'optional', |
|
| 905 | 905 | PCLZIP_OPT_REMOVE_PATH => 'optional', |
| 906 | 906 | PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', |
| 907 | 907 | PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', |
@@ -971,10 +971,10 @@ discard block |
||
| 971 | 971 | // ----- Trick |
| 972 | 972 | // Here I want to reuse extractByRule(), so I need to parse the $p_index |
| 973 | 973 | // with privParseOptions() |
| 974 | - $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index); |
|
| 974 | + $v_arg_trick = array(PCLZIP_OPT_BY_INDEX, $p_index); |
|
| 975 | 975 | $v_options_trick = array(); |
| 976 | 976 | $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, |
| 977 | - array (PCLZIP_OPT_BY_INDEX => 'optional' )); |
|
| 977 | + array(PCLZIP_OPT_BY_INDEX => 'optional')); |
|
| 978 | 978 | if ($v_result != 1) { |
| 979 | 979 | return 0; |
| 980 | 980 | } |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | // -------------------------------------------------------------------------------- |
| 1014 | 1014 | function delete() |
| 1015 | 1015 | { |
| 1016 | - $v_result=1; |
|
| 1016 | + $v_result = 1; |
|
| 1017 | 1017 | |
| 1018 | 1018 | // ----- Reset the error handler |
| 1019 | 1019 | $this->privErrorReset(); |
@@ -1036,10 +1036,10 @@ discard block |
||
| 1036 | 1036 | |
| 1037 | 1037 | // ----- Parse the options |
| 1038 | 1038 | $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, |
| 1039 | - array (PCLZIP_OPT_BY_NAME => 'optional', |
|
| 1039 | + array(PCLZIP_OPT_BY_NAME => 'optional', |
|
| 1040 | 1040 | PCLZIP_OPT_BY_EREG => 'optional', |
| 1041 | 1041 | PCLZIP_OPT_BY_PREG => 'optional', |
| 1042 | - PCLZIP_OPT_BY_INDEX => 'optional' )); |
|
| 1042 | + PCLZIP_OPT_BY_INDEX => 'optional')); |
|
| 1043 | 1043 | if ($v_result != 1) { |
| 1044 | 1044 | return 0; |
| 1045 | 1045 | } |
@@ -1293,9 +1293,9 @@ discard block |
||
| 1293 | 1293 | // Description : |
| 1294 | 1294 | // Parameters : |
| 1295 | 1295 | // -------------------------------------------------------------------------------- |
| 1296 | - function errorName($p_with_code=false) |
|
| 1296 | + function errorName($p_with_code = false) |
|
| 1297 | 1297 | { |
| 1298 | - $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', |
|
| 1298 | + $v_name = array(PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', |
|
| 1299 | 1299 | PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', |
| 1300 | 1300 | PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', |
| 1301 | 1301 | PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', |
@@ -1339,7 +1339,7 @@ discard block |
||
| 1339 | 1339 | // Description : |
| 1340 | 1340 | // Parameters : |
| 1341 | 1341 | // -------------------------------------------------------------------------------- |
| 1342 | - function errorInfo($p_full=false) |
|
| 1342 | + function errorInfo($p_full = false) |
|
| 1343 | 1343 | { |
| 1344 | 1344 | if (PCLZIP_ERROR_EXTERNAL == 1) { |
| 1345 | 1345 | return(PclErrorString()); |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | // true on success, |
| 1379 | 1379 | // false on error, the error code is set. |
| 1380 | 1380 | // -------------------------------------------------------------------------------- |
| 1381 | - function privCheckFormat($p_level=0) |
|
| 1381 | + function privCheckFormat($p_level = 0) |
|
| 1382 | 1382 | { |
| 1383 | 1383 | $v_result = true; |
| 1384 | 1384 | |
@@ -1431,13 +1431,13 @@ discard block |
||
| 1431 | 1431 | // 1 on success. |
| 1432 | 1432 | // 0 on failure. |
| 1433 | 1433 | // -------------------------------------------------------------------------------- |
| 1434 | - function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false) |
|
| 1434 | + function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false) |
|
| 1435 | 1435 | { |
| 1436 | - $v_result=1; |
|
| 1436 | + $v_result = 1; |
|
| 1437 | 1437 | |
| 1438 | 1438 | // ----- Read the options |
| 1439 | - $i=0; |
|
| 1440 | - while ($i<$p_size) { |
|
| 1439 | + $i = 0; |
|
| 1440 | + while ($i < $p_size) { |
|
| 1441 | 1441 | |
| 1442 | 1442 | // ----- Check if the option is supported |
| 1443 | 1443 | if (!isset($v_requested_options[$p_options_list[$i]])) { |
@@ -1455,7 +1455,7 @@ discard block |
||
| 1455 | 1455 | case PCLZIP_OPT_REMOVE_PATH : |
| 1456 | 1456 | case PCLZIP_OPT_ADD_PATH : |
| 1457 | 1457 | // ----- Check the number of parameters |
| 1458 | - if (($i+1) >= $p_size) { |
|
| 1458 | + if (($i + 1) >= $p_size) { |
|
| 1459 | 1459 | // ----- Error log |
| 1460 | 1460 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1461 | 1461 | |
@@ -1464,13 +1464,13 @@ discard block |
||
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | 1466 | // ----- Get the value |
| 1467 | - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); |
|
| 1467 | + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], FALSE); |
|
| 1468 | 1468 | $i++; |
| 1469 | 1469 | break; |
| 1470 | 1470 | |
| 1471 | 1471 | case PCLZIP_OPT_TEMP_FILE_THRESHOLD : |
| 1472 | 1472 | // ----- Check the number of parameters |
| 1473 | - if (($i+1) >= $p_size) { |
|
| 1473 | + if (($i + 1) >= $p_size) { |
|
| 1474 | 1474 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1475 | 1475 | return PclZip::errorCode(); |
| 1476 | 1476 | } |
@@ -1482,14 +1482,14 @@ discard block |
||
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | // ----- Check the value |
| 1485 | - $v_value = $p_options_list[$i+1]; |
|
| 1486 | - if ((!is_integer($v_value)) || ($v_value<0)) { |
|
| 1485 | + $v_value = $p_options_list[$i + 1]; |
|
| 1486 | + if ((!is_integer($v_value)) || ($v_value < 0)) { |
|
| 1487 | 1487 | PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1488 | 1488 | return PclZip::errorCode(); |
| 1489 | 1489 | } |
| 1490 | 1490 | |
| 1491 | 1491 | // ----- Get the value (and convert it in bytes) |
| 1492 | - $v_result_list[$p_options_list[$i]] = $v_value*1048576; |
|
| 1492 | + $v_result_list[$p_options_list[$i]] = $v_value * 1048576; |
|
| 1493 | 1493 | $i++; |
| 1494 | 1494 | break; |
| 1495 | 1495 | |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | |
| 1521 | 1521 | case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : |
| 1522 | 1522 | // ----- Check the number of parameters |
| 1523 | - if (($i+1) >= $p_size) { |
|
| 1523 | + if (($i + 1) >= $p_size) { |
|
| 1524 | 1524 | // ----- Error log |
| 1525 | 1525 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1526 | 1526 | |
@@ -1529,9 +1529,9 @@ discard block |
||
| 1529 | 1529 | } |
| 1530 | 1530 | |
| 1531 | 1531 | // ----- Get the value |
| 1532 | - if ( is_string($p_options_list[$i+1]) |
|
| 1533 | - && ($p_options_list[$i+1] != '')) { |
|
| 1534 | - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); |
|
| 1532 | + if (is_string($p_options_list[$i + 1]) |
|
| 1533 | + && ($p_options_list[$i + 1] != '')) { |
|
| 1534 | + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], FALSE); |
|
| 1535 | 1535 | $i++; |
| 1536 | 1536 | } |
| 1537 | 1537 | else { |
@@ -1541,7 +1541,7 @@ discard block |
||
| 1541 | 1541 | // ----- Look for options that request an array of string for value |
| 1542 | 1542 | case PCLZIP_OPT_BY_NAME : |
| 1543 | 1543 | // ----- Check the number of parameters |
| 1544 | - if (($i+1) >= $p_size) { |
|
| 1544 | + if (($i + 1) >= $p_size) { |
|
| 1545 | 1545 | // ----- Error log |
| 1546 | 1546 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1547 | 1547 | |
@@ -1550,11 +1550,11 @@ discard block |
||
| 1550 | 1550 | } |
| 1551 | 1551 | |
| 1552 | 1552 | // ----- Get the value |
| 1553 | - if (is_string($p_options_list[$i+1])) { |
|
| 1554 | - $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; |
|
| 1553 | + if (is_string($p_options_list[$i + 1])) { |
|
| 1554 | + $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1]; |
|
| 1555 | 1555 | } |
| 1556 | - else if (is_array($p_options_list[$i+1])) { |
|
| 1557 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
| 1556 | + else if (is_array($p_options_list[$i + 1])) { |
|
| 1557 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
| 1558 | 1558 | } |
| 1559 | 1559 | else { |
| 1560 | 1560 | // ----- Error log |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | case PCLZIP_OPT_BY_PREG : |
| 1575 | 1575 | //case PCLZIP_OPT_CRYPT : |
| 1576 | 1576 | // ----- Check the number of parameters |
| 1577 | - if (($i+1) >= $p_size) { |
|
| 1577 | + if (($i + 1) >= $p_size) { |
|
| 1578 | 1578 | // ----- Error log |
| 1579 | 1579 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1580 | 1580 | |
@@ -1583,8 +1583,8 @@ discard block |
||
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | // ----- Get the value |
| 1586 | - if (is_string($p_options_list[$i+1])) { |
|
| 1587 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
| 1586 | + if (is_string($p_options_list[$i + 1])) { |
|
| 1587 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
| 1588 | 1588 | } |
| 1589 | 1589 | else { |
| 1590 | 1590 | // ----- Error log |
@@ -1601,7 +1601,7 @@ discard block |
||
| 1601 | 1601 | case PCLZIP_OPT_ADD_COMMENT : |
| 1602 | 1602 | case PCLZIP_OPT_PREPEND_COMMENT : |
| 1603 | 1603 | // ----- Check the number of parameters |
| 1604 | - if (($i+1) >= $p_size) { |
|
| 1604 | + if (($i + 1) >= $p_size) { |
|
| 1605 | 1605 | // ----- Error log |
| 1606 | 1606 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, |
| 1607 | 1607 | "Missing parameter value for option '" |
@@ -1613,8 +1613,8 @@ discard block |
||
| 1613 | 1613 | } |
| 1614 | 1614 | |
| 1615 | 1615 | // ----- Get the value |
| 1616 | - if (is_string($p_options_list[$i+1])) { |
|
| 1617 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
| 1616 | + if (is_string($p_options_list[$i + 1])) { |
|
| 1617 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
| 1618 | 1618 | } |
| 1619 | 1619 | else { |
| 1620 | 1620 | // ----- Error log |
@@ -1632,7 +1632,7 @@ discard block |
||
| 1632 | 1632 | // ----- Look for options that request an array of index |
| 1633 | 1633 | case PCLZIP_OPT_BY_INDEX : |
| 1634 | 1634 | // ----- Check the number of parameters |
| 1635 | - if (($i+1) >= $p_size) { |
|
| 1635 | + if (($i + 1) >= $p_size) { |
|
| 1636 | 1636 | // ----- Error log |
| 1637 | 1637 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1638 | 1638 | |
@@ -1642,19 +1642,19 @@ discard block |
||
| 1642 | 1642 | |
| 1643 | 1643 | // ----- Get the value |
| 1644 | 1644 | $v_work_list = array(); |
| 1645 | - if (is_string($p_options_list[$i+1])) { |
|
| 1645 | + if (is_string($p_options_list[$i + 1])) { |
|
| 1646 | 1646 | |
| 1647 | 1647 | // ----- Remove spaces |
| 1648 | - $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', ''); |
|
| 1648 | + $p_options_list[$i + 1] = strtr($p_options_list[$i + 1], ' ', ''); |
|
| 1649 | 1649 | |
| 1650 | 1650 | // ----- Parse items |
| 1651 | - $v_work_list = explode(",", $p_options_list[$i+1]); |
|
| 1651 | + $v_work_list = explode(",", $p_options_list[$i + 1]); |
|
| 1652 | 1652 | } |
| 1653 | - else if (is_integer($p_options_list[$i+1])) { |
|
| 1654 | - $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; |
|
| 1653 | + else if (is_integer($p_options_list[$i + 1])) { |
|
| 1654 | + $v_work_list[0] = $p_options_list[$i + 1].'-'.$p_options_list[$i + 1]; |
|
| 1655 | 1655 | } |
| 1656 | - else if (is_array($p_options_list[$i+1])) { |
|
| 1657 | - $v_work_list = $p_options_list[$i+1]; |
|
| 1656 | + else if (is_array($p_options_list[$i + 1])) { |
|
| 1657 | + $v_work_list = $p_options_list[$i + 1]; |
|
| 1658 | 1658 | } |
| 1659 | 1659 | else { |
| 1660 | 1660 | // ----- Error log |
@@ -1668,9 +1668,9 @@ discard block |
||
| 1668 | 1668 | // each index item in the list must be a couple with a start and |
| 1669 | 1669 | // an end value : [0,3], [5-5], [8-10], ... |
| 1670 | 1670 | // ----- Check the format of each item |
| 1671 | - $v_sort_flag=false; |
|
| 1672 | - $v_sort_value=0; |
|
| 1673 | - for ($j=0; $j<sizeof($v_work_list); $j++) { |
|
| 1671 | + $v_sort_flag = false; |
|
| 1672 | + $v_sort_value = 0; |
|
| 1673 | + for ($j = 0; $j < sizeof($v_work_list); $j++) { |
|
| 1674 | 1674 | // ----- Explode the item |
| 1675 | 1675 | $v_item_list = explode("-", $v_work_list[$j]); |
| 1676 | 1676 | $v_size_item_list = sizeof($v_item_list); |
@@ -1700,7 +1700,7 @@ discard block |
||
| 1700 | 1700 | |
| 1701 | 1701 | // ----- Look for list sort |
| 1702 | 1702 | if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) { |
| 1703 | - $v_sort_flag=true; |
|
| 1703 | + $v_sort_flag = true; |
|
| 1704 | 1704 | |
| 1705 | 1705 | // ----- TBC : An automatic sort should be writen ... |
| 1706 | 1706 | // ----- Error log |
@@ -1734,7 +1734,7 @@ discard block |
||
| 1734 | 1734 | // ----- Look for options that request an octal value |
| 1735 | 1735 | case PCLZIP_OPT_SET_CHMOD : |
| 1736 | 1736 | // ----- Check the number of parameters |
| 1737 | - if (($i+1) >= $p_size) { |
|
| 1737 | + if (($i + 1) >= $p_size) { |
|
| 1738 | 1738 | // ----- Error log |
| 1739 | 1739 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1740 | 1740 | |
@@ -1743,7 +1743,7 @@ discard block |
||
| 1743 | 1743 | } |
| 1744 | 1744 | |
| 1745 | 1745 | // ----- Get the value |
| 1746 | - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; |
|
| 1746 | + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; |
|
| 1747 | 1747 | $i++; |
| 1748 | 1748 | break; |
| 1749 | 1749 | |
@@ -1759,7 +1759,7 @@ discard block |
||
| 1759 | 1759 | case PCLZIP_CB_POST_LIST : |
| 1760 | 1760 | */ |
| 1761 | 1761 | // ----- Check the number of parameters |
| 1762 | - if (($i+1) >= $p_size) { |
|
| 1762 | + if (($i + 1) >= $p_size) { |
|
| 1763 | 1763 | // ----- Error log |
| 1764 | 1764 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); |
| 1765 | 1765 | |
@@ -1768,7 +1768,7 @@ discard block |
||
| 1768 | 1768 | } |
| 1769 | 1769 | |
| 1770 | 1770 | // ----- Get the value |
| 1771 | - $v_function_name = $p_options_list[$i+1]; |
|
| 1771 | + $v_function_name = $p_options_list[$i + 1]; |
|
| 1772 | 1772 | |
| 1773 | 1773 | // ----- Check that the value is a valid existing function |
| 1774 | 1774 | if (!function_exists($v_function_name)) { |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | |
| 1801 | 1801 | // ----- Look for mandatory options |
| 1802 | 1802 | if ($v_requested_options !== false) { |
| 1803 | - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { |
|
| 1803 | + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { |
|
| 1804 | 1804 | // ----- Look for mandatory option |
| 1805 | 1805 | if ($v_requested_options[$key] == 'mandatory') { |
| 1806 | 1806 | // ----- Look if present |
@@ -1833,7 +1833,7 @@ discard block |
||
| 1833 | 1833 | // -------------------------------------------------------------------------------- |
| 1834 | 1834 | function privOptionDefaultThreshold(&$p_options) |
| 1835 | 1835 | { |
| 1836 | - $v_result=1; |
|
| 1836 | + $v_result = 1; |
|
| 1837 | 1837 | |
| 1838 | 1838 | if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) |
| 1839 | 1839 | || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { |
@@ -1845,16 +1845,16 @@ discard block |
||
| 1845 | 1845 | $v_memory_limit = trim($v_memory_limit); |
| 1846 | 1846 | $last = strtolower(substr($v_memory_limit, -1)); |
| 1847 | 1847 | |
| 1848 | - if($last == 'g') |
|
| 1848 | + if ($last == 'g') |
|
| 1849 | 1849 | //$v_memory_limit = $v_memory_limit*1024*1024*1024; |
| 1850 | - $v_memory_limit = $v_memory_limit*1073741824; |
|
| 1851 | - if($last == 'm') |
|
| 1850 | + $v_memory_limit = $v_memory_limit * 1073741824; |
|
| 1851 | + if ($last == 'm') |
|
| 1852 | 1852 | //$v_memory_limit = $v_memory_limit*1024*1024; |
| 1853 | - $v_memory_limit = $v_memory_limit*1048576; |
|
| 1854 | - if($last == 'k') |
|
| 1855 | - $v_memory_limit = $v_memory_limit*1024; |
|
| 1853 | + $v_memory_limit = $v_memory_limit * 1048576; |
|
| 1854 | + if ($last == 'k') |
|
| 1855 | + $v_memory_limit = $v_memory_limit * 1024; |
|
| 1856 | 1856 | |
| 1857 | - $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); |
|
| 1857 | + $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit * PCLZIP_TEMPORARY_FILE_RATIO); |
|
| 1858 | 1858 | |
| 1859 | 1859 | |
| 1860 | 1860 | // ----- Sanity check : No threshold if value lower than 1M |
@@ -1875,9 +1875,9 @@ discard block |
||
| 1875 | 1875 | // 1 on success. |
| 1876 | 1876 | // 0 on failure. |
| 1877 | 1877 | // -------------------------------------------------------------------------------- |
| 1878 | - function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false) |
|
| 1878 | + function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false) |
|
| 1879 | 1879 | { |
| 1880 | - $v_result=1; |
|
| 1880 | + $v_result = 1; |
|
| 1881 | 1881 | |
| 1882 | 1882 | // ----- For each file in the list check the attributes |
| 1883 | 1883 | foreach ($p_file_list as $v_key => $v_value) { |
@@ -1970,7 +1970,7 @@ discard block |
||
| 1970 | 1970 | |
| 1971 | 1971 | // ----- Look for mandatory options |
| 1972 | 1972 | if ($v_requested_options !== false) { |
| 1973 | - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { |
|
| 1973 | + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { |
|
| 1974 | 1974 | // ----- Look for mandatory option |
| 1975 | 1975 | if ($v_requested_options[$key] == 'mandatory') { |
| 1976 | 1976 | // ----- Look if present |
@@ -2006,13 +2006,13 @@ discard block |
||
| 2006 | 2006 | // -------------------------------------------------------------------------------- |
| 2007 | 2007 | function privFileDescrExpand(&$p_filedescr_list, &$p_options) |
| 2008 | 2008 | { |
| 2009 | - $v_result=1; |
|
| 2009 | + $v_result = 1; |
|
| 2010 | 2010 | |
| 2011 | 2011 | // ----- Create a result list |
| 2012 | 2012 | $v_result_list = array(); |
| 2013 | 2013 | |
| 2014 | 2014 | // ----- Look each entry |
| 2015 | - for ($i=0; $i<sizeof($p_filedescr_list); $i++) { |
|
| 2015 | + for ($i = 0; $i < sizeof($p_filedescr_list); $i++) { |
|
| 2016 | 2016 | |
| 2017 | 2017 | // ----- Get filedescr |
| 2018 | 2018 | $v_descr = $p_filedescr_list[$i]; |
@@ -2131,7 +2131,7 @@ discard block |
||
| 2131 | 2131 | // -------------------------------------------------------------------------------- |
| 2132 | 2132 | function privCreate($p_filedescr_list, &$p_result_list, &$p_options) |
| 2133 | 2133 | { |
| 2134 | - $v_result=1; |
|
| 2134 | + $v_result = 1; |
|
| 2135 | 2135 | $v_list_detail = array(); |
| 2136 | 2136 | |
| 2137 | 2137 | // ----- Magic quotes trick |
@@ -2166,7 +2166,7 @@ discard block |
||
| 2166 | 2166 | // -------------------------------------------------------------------------------- |
| 2167 | 2167 | function privAdd($p_filedescr_list, &$p_result_list, &$p_options) |
| 2168 | 2168 | { |
| 2169 | - $v_result=1; |
|
| 2169 | + $v_result = 1; |
|
| 2170 | 2170 | $v_list_detail = array(); |
| 2171 | 2171 | |
| 2172 | 2172 | // ----- Look if the archive exists or is empty |
@@ -2183,7 +2183,7 @@ discard block |
||
| 2183 | 2183 | $this->privDisableMagicQuotes(); |
| 2184 | 2184 | |
| 2185 | 2185 | // ----- Open the zip file |
| 2186 | - if (($v_result=$this->privOpenFd('rb')) != 1) |
|
| 2186 | + if (($v_result = $this->privOpenFd('rb')) != 1) |
|
| 2187 | 2187 | { |
| 2188 | 2188 | // ----- Magic quotes trick |
| 2189 | 2189 | $this->privSwapBackMagicQuotes(); |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | } |
| 2265 | 2265 | |
| 2266 | 2266 | // ----- Create the Central Dir files header |
| 2267 | - for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++) |
|
| 2267 | + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) |
|
| 2268 | 2268 | { |
| 2269 | 2269 | // ----- Create the file header |
| 2270 | 2270 | if ($v_header_list[$i]['status'] == 'ok') { |
@@ -2297,10 +2297,10 @@ discard block |
||
| 2297 | 2297 | } |
| 2298 | 2298 | |
| 2299 | 2299 | // ----- Calculate the size of the central header |
| 2300 | - $v_size = @ftell($this->zip_fd)-$v_offset; |
|
| 2300 | + $v_size = @ftell($this->zip_fd) - $v_offset; |
|
| 2301 | 2301 | |
| 2302 | 2302 | // ----- Create the central dir footer |
| 2303 | - if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) |
|
| 2303 | + if (($v_result = $this->privWriteCentralHeader($v_count + $v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) |
|
| 2304 | 2304 | { |
| 2305 | 2305 | // ----- Reset the file list |
| 2306 | 2306 | unset($v_header_list); |
@@ -2345,7 +2345,7 @@ discard block |
||
| 2345 | 2345 | // -------------------------------------------------------------------------------- |
| 2346 | 2346 | function privOpenFd($p_mode) |
| 2347 | 2347 | { |
| 2348 | - $v_result=1; |
|
| 2348 | + $v_result = 1; |
|
| 2349 | 2349 | |
| 2350 | 2350 | // ----- Look if already open |
| 2351 | 2351 | if ($this->zip_fd != 0) |
@@ -2379,7 +2379,7 @@ discard block |
||
| 2379 | 2379 | // -------------------------------------------------------------------------------- |
| 2380 | 2380 | function privCloseFd() |
| 2381 | 2381 | { |
| 2382 | - $v_result=1; |
|
| 2382 | + $v_result = 1; |
|
| 2383 | 2383 | |
| 2384 | 2384 | if ($this->zip_fd != 0) |
| 2385 | 2385 | @fclose($this->zip_fd); |
@@ -2406,7 +2406,7 @@ discard block |
||
| 2406 | 2406 | // function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) |
| 2407 | 2407 | function privAddList($p_filedescr_list, &$p_result_list, &$p_options) |
| 2408 | 2408 | { |
| 2409 | - $v_result=1; |
|
| 2409 | + $v_result = 1; |
|
| 2410 | 2410 | |
| 2411 | 2411 | // ----- Add the files |
| 2412 | 2412 | $v_header_list = array(); |
@@ -2420,7 +2420,7 @@ discard block |
||
| 2420 | 2420 | $v_offset = @ftell($this->zip_fd); |
| 2421 | 2421 | |
| 2422 | 2422 | // ----- Create the Central Dir files header |
| 2423 | - for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++) |
|
| 2423 | + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) |
|
| 2424 | 2424 | { |
| 2425 | 2425 | // ----- Create the file header |
| 2426 | 2426 | if ($v_header_list[$i]['status'] == 'ok') { |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | } |
| 2443 | 2443 | |
| 2444 | 2444 | // ----- Calculate the size of the central header |
| 2445 | - $v_size = @ftell($this->zip_fd)-$v_offset; |
|
| 2445 | + $v_size = @ftell($this->zip_fd) - $v_offset; |
|
| 2446 | 2446 | |
| 2447 | 2447 | // ----- Create the central dir footer |
| 2448 | 2448 | if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) |
@@ -2470,14 +2470,14 @@ discard block |
||
| 2470 | 2470 | // -------------------------------------------------------------------------------- |
| 2471 | 2471 | function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) |
| 2472 | 2472 | { |
| 2473 | - $v_result=1; |
|
| 2473 | + $v_result = 1; |
|
| 2474 | 2474 | $v_header = array(); |
| 2475 | 2475 | |
| 2476 | 2476 | // ----- Recuperate the current number of elt in list |
| 2477 | 2477 | $v_nb = sizeof($p_result_list); |
| 2478 | 2478 | |
| 2479 | 2479 | // ----- Loop on the files |
| 2480 | - for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) { |
|
| 2480 | + for ($j = 0; ($j < sizeof($p_filedescr_list)) && ($v_result == 1); $j++) { |
|
| 2481 | 2481 | // ----- Format the filename |
| 2482 | 2482 | $p_filedescr_list[$j]['filename'] |
| 2483 | 2483 | = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); |
@@ -2490,7 +2490,7 @@ discard block |
||
| 2490 | 2490 | } |
| 2491 | 2491 | |
| 2492 | 2492 | // ----- Check the filename |
| 2493 | - if ( ($p_filedescr_list[$j]['type'] != 'virtual_file') |
|
| 2493 | + if (($p_filedescr_list[$j]['type'] != 'virtual_file') |
|
| 2494 | 2494 | && (!file_exists($p_filedescr_list[$j]['filename']))) { |
| 2495 | 2495 | PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist"); |
| 2496 | 2496 | return PclZip::errorCode(); |
@@ -2500,10 +2500,10 @@ discard block |
||
| 2500 | 2500 | // or a dir with all its path removed |
| 2501 | 2501 | // if ( (is_file($p_filedescr_list[$j]['filename'])) |
| 2502 | 2502 | // || ( is_dir($p_filedescr_list[$j]['filename']) |
| 2503 | - if ( ($p_filedescr_list[$j]['type'] == 'file') |
|
| 2503 | + if (($p_filedescr_list[$j]['type'] == 'file') |
|
| 2504 | 2504 | || ($p_filedescr_list[$j]['type'] == 'virtual_file') |
| 2505 | - || ( ($p_filedescr_list[$j]['type'] == 'folder') |
|
| 2506 | - && ( !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) |
|
| 2505 | + || (($p_filedescr_list[$j]['type'] == 'folder') |
|
| 2506 | + && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) |
|
| 2507 | 2507 | || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) |
| 2508 | 2508 | ) { |
| 2509 | 2509 | |
@@ -2532,7 +2532,7 @@ discard block |
||
| 2532 | 2532 | // -------------------------------------------------------------------------------- |
| 2533 | 2533 | function privAddFile($p_filedescr, &$p_header, &$p_options) |
| 2534 | 2534 | { |
| 2535 | - $v_result=1; |
|
| 2535 | + $v_result = 1; |
|
| 2536 | 2536 | |
| 2537 | 2537 | // ----- Working variable |
| 2538 | 2538 | $p_filename = $p_filedescr['filename']; |
@@ -2577,13 +2577,13 @@ discard block |
||
| 2577 | 2577 | $p_header['index'] = -1; |
| 2578 | 2578 | |
| 2579 | 2579 | // ----- Look for regular file |
| 2580 | - if ($p_filedescr['type']=='file') { |
|
| 2580 | + if ($p_filedescr['type'] == 'file') { |
|
| 2581 | 2581 | $p_header['external'] = 0x00000000; |
| 2582 | 2582 | $p_header['size'] = filesize($p_filename); |
| 2583 | 2583 | } |
| 2584 | 2584 | |
| 2585 | 2585 | // ----- Look for regular folder |
| 2586 | - else if ($p_filedescr['type']=='folder') { |
|
| 2586 | + else if ($p_filedescr['type'] == 'folder') { |
|
| 2587 | 2587 | $p_header['external'] = 0x00000010; |
| 2588 | 2588 | $p_header['mtime'] = filemtime($p_filename); |
| 2589 | 2589 | $p_header['size'] = filesize($p_filename); |
@@ -2658,10 +2658,10 @@ discard block |
||
| 2658 | 2658 | // ----- Look for a file |
| 2659 | 2659 | if ($p_filedescr['type'] == 'file') { |
| 2660 | 2660 | // ----- Look for using temporary file to zip |
| 2661 | - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) |
|
| 2661 | + if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) |
|
| 2662 | 2662 | && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) |
| 2663 | 2663 | || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) |
| 2664 | - && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) { |
|
| 2664 | + && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) { |
|
| 2665 | 2665 | $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); |
| 2666 | 2666 | if ($v_result < PCLZIP_ERR_NO_ERROR) { |
| 2667 | 2667 | return $v_result; |
@@ -2761,7 +2761,7 @@ discard block |
||
| 2761 | 2761 | // ----- Set the file properties |
| 2762 | 2762 | $p_header['size'] = 0; |
| 2763 | 2763 | //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
| 2764 | - $p_header['external'] = 0x00000010; // Value for a folder : to be checked |
|
| 2764 | + $p_header['external'] = 0x00000010; // Value for a folder : to be checked |
|
| 2765 | 2765 | |
| 2766 | 2766 | // ----- Call the header generation |
| 2767 | 2767 | if (($v_result = $this->privWriteFileHeader($p_header)) != 1) |
@@ -2805,7 +2805,7 @@ discard block |
||
| 2805 | 2805 | // -------------------------------------------------------------------------------- |
| 2806 | 2806 | function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) |
| 2807 | 2807 | { |
| 2808 | - $v_result=PCLZIP_ERR_NO_ERROR; |
|
| 2808 | + $v_result = PCLZIP_ERR_NO_ERROR; |
|
| 2809 | 2809 | |
| 2810 | 2810 | // ----- Working variable |
| 2811 | 2811 | $p_filename = $p_filedescr['filename']; |
@@ -2859,7 +2859,7 @@ discard block |
||
| 2859 | 2859 | $v_data_header['os'] = bin2hex($v_data_header['os']); |
| 2860 | 2860 | |
| 2861 | 2861 | // ----- Read the gzip file footer |
| 2862 | - @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8); |
|
| 2862 | + @fseek($v_file_compressed, filesize($v_gzip_temp_name) - 8); |
|
| 2863 | 2863 | $v_binary_data = @fread($v_file_compressed, 8); |
| 2864 | 2864 | $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); |
| 2865 | 2865 | |
@@ -2867,7 +2867,7 @@ discard block |
||
| 2867 | 2867 | $p_header['compression'] = ord($v_data_header['cm']); |
| 2868 | 2868 | //$p_header['mtime'] = $v_data_header['mtime']; |
| 2869 | 2869 | $p_header['crc'] = $v_data_footer['crc']; |
| 2870 | - $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18; |
|
| 2870 | + $p_header['compressed_size'] = filesize($v_gzip_temp_name) - 18; |
|
| 2871 | 2871 | |
| 2872 | 2872 | // ----- Close the file |
| 2873 | 2873 | @fclose($v_file_compressed); |
@@ -2917,7 +2917,7 @@ discard block |
||
| 2917 | 2917 | // -------------------------------------------------------------------------------- |
| 2918 | 2918 | function privCalculateStoredFilename(&$p_filedescr, &$p_options) |
| 2919 | 2919 | { |
| 2920 | - $v_result=1; |
|
| 2920 | + $v_result = 1; |
|
| 2921 | 2921 | |
| 2922 | 2922 | // ----- Working variables |
| 2923 | 2923 | $p_filename = $p_filedescr['filename']; |
@@ -2974,14 +2974,14 @@ discard block |
||
| 2974 | 2974 | if (substr($p_remove_dir, -1) != '/') |
| 2975 | 2975 | $p_remove_dir .= "/"; |
| 2976 | 2976 | |
| 2977 | - if ( (substr($p_filename, 0, 2) == "./") |
|
| 2977 | + if ((substr($p_filename, 0, 2) == "./") |
|
| 2978 | 2978 | || (substr($p_remove_dir, 0, 2) == "./")) { |
| 2979 | 2979 | |
| 2980 | - if ( (substr($p_filename, 0, 2) == "./") |
|
| 2980 | + if ((substr($p_filename, 0, 2) == "./") |
|
| 2981 | 2981 | && (substr($p_remove_dir, 0, 2) != "./")) { |
| 2982 | 2982 | $p_remove_dir = "./".$p_remove_dir; |
| 2983 | 2983 | } |
| 2984 | - if ( (substr($p_filename, 0, 2) != "./") |
|
| 2984 | + if ((substr($p_filename, 0, 2) != "./") |
|
| 2985 | 2985 | && (substr($p_remove_dir, 0, 2) == "./")) { |
| 2986 | 2986 | $p_remove_dir = substr($p_remove_dir, 2); |
| 2987 | 2987 | } |
@@ -3029,15 +3029,15 @@ discard block |
||
| 3029 | 3029 | // -------------------------------------------------------------------------------- |
| 3030 | 3030 | function privWriteFileHeader(&$p_header) |
| 3031 | 3031 | { |
| 3032 | - $v_result=1; |
|
| 3032 | + $v_result = 1; |
|
| 3033 | 3033 | |
| 3034 | 3034 | // ----- Store the offset position of the file |
| 3035 | 3035 | $p_header['offset'] = ftell($this->zip_fd); |
| 3036 | 3036 | |
| 3037 | 3037 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
| 3038 | 3038 | $v_date = getdate($p_header['mtime']); |
| 3039 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
| 3040 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
| 3039 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
| 3040 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
| 3041 | 3041 | |
| 3042 | 3042 | // ----- Packed data |
| 3043 | 3043 | $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, |
@@ -3074,7 +3074,7 @@ discard block |
||
| 3074 | 3074 | // -------------------------------------------------------------------------------- |
| 3075 | 3075 | function privWriteCentralFileHeader(&$p_header) |
| 3076 | 3076 | { |
| 3077 | - $v_result=1; |
|
| 3077 | + $v_result = 1; |
|
| 3078 | 3078 | |
| 3079 | 3079 | // TBC |
| 3080 | 3080 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -3082,8 +3082,8 @@ discard block |
||
| 3082 | 3082 | |
| 3083 | 3083 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
| 3084 | 3084 | $v_date = getdate($p_header['mtime']); |
| 3085 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
| 3086 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
| 3085 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
| 3086 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
| 3087 | 3087 | |
| 3088 | 3088 | |
| 3089 | 3089 | // ----- Packed data |
@@ -3127,7 +3127,7 @@ discard block |
||
| 3127 | 3127 | // -------------------------------------------------------------------------------- |
| 3128 | 3128 | function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) |
| 3129 | 3129 | { |
| 3130 | - $v_result=1; |
|
| 3130 | + $v_result = 1; |
|
| 3131 | 3131 | |
| 3132 | 3132 | // ----- Packed data |
| 3133 | 3133 | $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, |
@@ -3156,7 +3156,7 @@ discard block |
||
| 3156 | 3156 | // -------------------------------------------------------------------------------- |
| 3157 | 3157 | function privList(&$p_list) |
| 3158 | 3158 | { |
| 3159 | - $v_result=1; |
|
| 3159 | + $v_result = 1; |
|
| 3160 | 3160 | |
| 3161 | 3161 | // ----- Magic quotes trick |
| 3162 | 3162 | $this->privDisableMagicQuotes(); |
@@ -3196,7 +3196,7 @@ discard block |
||
| 3196 | 3196 | } |
| 3197 | 3197 | |
| 3198 | 3198 | // ----- Read each entry |
| 3199 | - for ($i=0; $i<$v_central_dir['entries']; $i++) |
|
| 3199 | + for ($i = 0; $i < $v_central_dir['entries']; $i++) |
|
| 3200 | 3200 | { |
| 3201 | 3201 | // ----- Read the file header |
| 3202 | 3202 | if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) |
@@ -3243,7 +3243,7 @@ discard block |
||
| 3243 | 3243 | // -------------------------------------------------------------------------------- |
| 3244 | 3244 | function privConvertHeader2FileInfo($p_header, &$p_info) |
| 3245 | 3245 | { |
| 3246 | - $v_result=1; |
|
| 3246 | + $v_result = 1; |
|
| 3247 | 3247 | |
| 3248 | 3248 | // ----- Get the interesting attributes |
| 3249 | 3249 | $v_temp_path = PclZipUtilPathReduction($p_header['filename']); |
@@ -3254,7 +3254,7 @@ discard block |
||
| 3254 | 3254 | $p_info['compressed_size'] = $p_header['compressed_size']; |
| 3255 | 3255 | $p_info['mtime'] = $p_header['mtime']; |
| 3256 | 3256 | $p_info['comment'] = $p_header['comment']; |
| 3257 | - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); |
|
| 3257 | + $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); |
|
| 3258 | 3258 | $p_info['index'] = $p_header['index']; |
| 3259 | 3259 | $p_info['status'] = $p_header['status']; |
| 3260 | 3260 | $p_info['crc'] = $p_header['crc']; |
@@ -3282,16 +3282,16 @@ discard block |
||
| 3282 | 3282 | // -------------------------------------------------------------------------------- |
| 3283 | 3283 | function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) |
| 3284 | 3284 | { |
| 3285 | - $v_result=1; |
|
| 3285 | + $v_result = 1; |
|
| 3286 | 3286 | |
| 3287 | 3287 | // ----- Magic quotes trick |
| 3288 | 3288 | $this->privDisableMagicQuotes(); |
| 3289 | 3289 | |
| 3290 | 3290 | // ----- Check the path |
| 3291 | - if ( ($p_path == "") |
|
| 3292 | - || ( (substr($p_path, 0, 1) != "/") |
|
| 3291 | + if (($p_path == "") |
|
| 3292 | + || ((substr($p_path, 0, 1) != "/") |
|
| 3293 | 3293 | && (substr($p_path, 0, 3) != "../") |
| 3294 | - && (substr($p_path,1,2)!=":/"))) |
|
| 3294 | + && (substr($p_path, 1, 2) != ":/"))) |
|
| 3295 | 3295 | $p_path = "./".$p_path; |
| 3296 | 3296 | |
| 3297 | 3297 | // ----- Reduce the path last (and duplicated) '/' |
@@ -3300,7 +3300,7 @@ discard block |
||
| 3300 | 3300 | // ----- Look for the path end '/' |
| 3301 | 3301 | while (substr($p_path, -1) == "/") |
| 3302 | 3302 | { |
| 3303 | - $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
| 3303 | + $p_path = substr($p_path, 0, strlen($p_path) - 1); |
|
| 3304 | 3304 | } |
| 3305 | 3305 | } |
| 3306 | 3306 | |
@@ -3334,7 +3334,7 @@ discard block |
||
| 3334 | 3334 | |
| 3335 | 3335 | // ----- Read each entry |
| 3336 | 3336 | $j_start = 0; |
| 3337 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) |
|
| 3337 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) |
|
| 3338 | 3338 | { |
| 3339 | 3339 | |
| 3340 | 3340 | // ----- Read next Central dir entry |
@@ -3373,17 +3373,17 @@ discard block |
||
| 3373 | 3373 | $v_extract = false; |
| 3374 | 3374 | |
| 3375 | 3375 | // ----- Look for extract by name rule |
| 3376 | - if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) |
|
| 3376 | + if ((isset($p_options[PCLZIP_OPT_BY_NAME])) |
|
| 3377 | 3377 | && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { |
| 3378 | 3378 | |
| 3379 | 3379 | // ----- Look if the filename is in the list |
| 3380 | - for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { |
|
| 3380 | + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { |
|
| 3381 | 3381 | |
| 3382 | 3382 | // ----- Look for a directory |
| 3383 | 3383 | if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { |
| 3384 | 3384 | |
| 3385 | 3385 | // ----- Look if the directory is in the filename path |
| 3386 | - if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) |
|
| 3386 | + if ((strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) |
|
| 3387 | 3387 | && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { |
| 3388 | 3388 | $v_extract = true; |
| 3389 | 3389 | } |
@@ -3408,7 +3408,7 @@ discard block |
||
| 3408 | 3408 | */ |
| 3409 | 3409 | |
| 3410 | 3410 | // ----- Look for extract by preg rule |
| 3411 | - else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) |
|
| 3411 | + else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) |
|
| 3412 | 3412 | && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { |
| 3413 | 3413 | |
| 3414 | 3414 | if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { |
@@ -3417,20 +3417,20 @@ discard block |
||
| 3417 | 3417 | } |
| 3418 | 3418 | |
| 3419 | 3419 | // ----- Look for extract by index rule |
| 3420 | - else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) |
|
| 3420 | + else if ((isset($p_options[PCLZIP_OPT_BY_INDEX])) |
|
| 3421 | 3421 | && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { |
| 3422 | 3422 | |
| 3423 | 3423 | // ----- Look if the index is in the list |
| 3424 | - for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { |
|
| 3424 | + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { |
|
| 3425 | 3425 | |
| 3426 | - if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
| 3426 | + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
| 3427 | 3427 | $v_extract = true; |
| 3428 | 3428 | } |
| 3429 | - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
| 3430 | - $j_start = $j+1; |
|
| 3429 | + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
| 3430 | + $j_start = $j + 1; |
|
| 3431 | 3431 | } |
| 3432 | 3432 | |
| 3433 | - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { |
|
| 3433 | + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { |
|
| 3434 | 3434 | break; |
| 3435 | 3435 | } |
| 3436 | 3436 | } |
@@ -3442,14 +3442,14 @@ discard block |
||
| 3442 | 3442 | } |
| 3443 | 3443 | |
| 3444 | 3444 | // ----- Check compression method |
| 3445 | - if ( ($v_extract) |
|
| 3446 | - && ( ($v_header['compression'] != 8) |
|
| 3445 | + if (($v_extract) |
|
| 3446 | + && (($v_header['compression'] != 8) |
|
| 3447 | 3447 | && ($v_header['compression'] != 0))) { |
| 3448 | 3448 | $v_header['status'] = 'unsupported_compression'; |
| 3449 | 3449 | |
| 3450 | 3450 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
| 3451 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3452 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
| 3451 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3452 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
| 3453 | 3453 | |
| 3454 | 3454 | $this->privSwapBackMagicQuotes(); |
| 3455 | 3455 | |
@@ -3467,8 +3467,8 @@ discard block |
||
| 3467 | 3467 | $v_header['status'] = 'unsupported_encryption'; |
| 3468 | 3468 | |
| 3469 | 3469 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
| 3470 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3471 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
| 3470 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3471 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
| 3472 | 3472 | |
| 3473 | 3473 | $this->privSwapBackMagicQuotes(); |
| 3474 | 3474 | |
@@ -3549,7 +3549,7 @@ discard block |
||
| 3549 | 3549 | } |
| 3550 | 3550 | } |
| 3551 | 3551 | // ----- Look for extraction in standard output |
| 3552 | - elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) |
|
| 3552 | + elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) |
|
| 3553 | 3553 | && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { |
| 3554 | 3554 | // ----- Extracting the file in standard output |
| 3555 | 3555 | $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); |
@@ -3622,7 +3622,7 @@ discard block |
||
| 3622 | 3622 | // -------------------------------------------------------------------------------- |
| 3623 | 3623 | function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) |
| 3624 | 3624 | { |
| 3625 | - $v_result=1; |
|
| 3625 | + $v_result = 1; |
|
| 3626 | 3626 | |
| 3627 | 3627 | // ----- Read the file header |
| 3628 | 3628 | if (($v_result = $this->privReadFileHeader($v_header)) != 1) |
@@ -3640,7 +3640,7 @@ discard block |
||
| 3640 | 3640 | // ----- Look for all path to remove |
| 3641 | 3641 | if ($p_remove_all_path == true) { |
| 3642 | 3642 | // ----- Look for folder entry that not need to be extracted |
| 3643 | - if (($p_entry['external']&0x00000010)==0x00000010) { |
|
| 3643 | + if (($p_entry['external'] & 0x00000010) == 0x00000010) { |
|
| 3644 | 3644 | |
| 3645 | 3645 | $p_entry['status'] = "filtered"; |
| 3646 | 3646 | |
@@ -3742,8 +3742,8 @@ discard block |
||
| 3742 | 3742 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
| 3743 | 3743 | // For historical reason first PclZip implementation does not stop |
| 3744 | 3744 | // when this kind of error occurs. |
| 3745 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3746 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
| 3745 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3746 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
| 3747 | 3747 | |
| 3748 | 3748 | PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, |
| 3749 | 3749 | "Filename '".$p_entry['filename']."' is " |
@@ -3762,8 +3762,8 @@ discard block |
||
| 3762 | 3762 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
| 3763 | 3763 | // For historical reason first PclZip implementation does not stop |
| 3764 | 3764 | // when this kind of error occurs. |
| 3765 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3766 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
| 3765 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3766 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
| 3767 | 3767 | |
| 3768 | 3768 | PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, |
| 3769 | 3769 | "Filename '".$p_entry['filename']."' exists " |
@@ -3777,8 +3777,8 @@ discard block |
||
| 3777 | 3777 | else if (filemtime($p_entry['filename']) > $p_entry['mtime']) |
| 3778 | 3778 | { |
| 3779 | 3779 | // ----- Change the file status |
| 3780 | - if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) |
|
| 3781 | - && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { |
|
| 3780 | + if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) |
|
| 3781 | + && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) { |
|
| 3782 | 3782 | } |
| 3783 | 3783 | else { |
| 3784 | 3784 | $p_entry['status'] = "newer_exist"; |
@@ -3786,8 +3786,8 @@ discard block |
||
| 3786 | 3786 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
| 3787 | 3787 | // For historical reason first PclZip implementation does not stop |
| 3788 | 3788 | // when this kind of error occurs. |
| 3789 | - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3790 | - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { |
|
| 3789 | + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) |
|
| 3790 | + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { |
|
| 3791 | 3791 | |
| 3792 | 3792 | PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, |
| 3793 | 3793 | "Newer version of '".$p_entry['filename']."' exists " |
@@ -3803,14 +3803,14 @@ discard block |
||
| 3803 | 3803 | |
| 3804 | 3804 | // ----- Check the directory availability and create it if necessary |
| 3805 | 3805 | else { |
| 3806 | - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) |
|
| 3806 | + if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) |
|
| 3807 | 3807 | $v_dir_to_check = $p_entry['filename']; |
| 3808 | 3808 | else if (!strstr($p_entry['filename'], "/")) |
| 3809 | 3809 | $v_dir_to_check = ""; |
| 3810 | 3810 | else |
| 3811 | 3811 | $v_dir_to_check = dirname($p_entry['filename']); |
| 3812 | 3812 | |
| 3813 | - if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { |
|
| 3813 | + if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) { |
|
| 3814 | 3814 | |
| 3815 | 3815 | // ----- Change the file status |
| 3816 | 3816 | $p_entry['status'] = "path_creation_fail"; |
@@ -3826,7 +3826,7 @@ discard block |
||
| 3826 | 3826 | if ($p_entry['status'] == 'ok') { |
| 3827 | 3827 | |
| 3828 | 3828 | // ----- Do the extraction (if not a folder) |
| 3829 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) |
|
| 3829 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) |
|
| 3830 | 3830 | { |
| 3831 | 3831 | // ----- Look for not compressed file |
| 3832 | 3832 | if ($p_entry['compression'] == 0) { |
@@ -3875,10 +3875,10 @@ discard block |
||
| 3875 | 3875 | |
| 3876 | 3876 | |
| 3877 | 3877 | // ----- Look for using temporary file to unzip |
| 3878 | - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) |
|
| 3878 | + if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) |
|
| 3879 | 3879 | && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) |
| 3880 | 3880 | || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) |
| 3881 | - && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) { |
|
| 3881 | + && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) { |
|
| 3882 | 3882 | $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); |
| 3883 | 3883 | if ($v_result < PCLZIP_ERR_NO_ERROR) { |
| 3884 | 3884 | return $v_result; |
@@ -3973,7 +3973,7 @@ discard block |
||
| 3973 | 3973 | // -------------------------------------------------------------------------------- |
| 3974 | 3974 | function privExtractFileUsingTempFile(&$p_entry, &$p_options) |
| 3975 | 3975 | { |
| 3976 | - $v_result=1; |
|
| 3976 | + $v_result = 1; |
|
| 3977 | 3977 | |
| 3978 | 3978 | // ----- Creates a temporary file |
| 3979 | 3979 | $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; |
@@ -4049,7 +4049,7 @@ discard block |
||
| 4049 | 4049 | // -------------------------------------------------------------------------------- |
| 4050 | 4050 | function privExtractFileInOutput(&$p_entry, &$p_options) |
| 4051 | 4051 | { |
| 4052 | - $v_result=1; |
|
| 4052 | + $v_result = 1; |
|
| 4053 | 4053 | |
| 4054 | 4054 | // ----- Read the file header |
| 4055 | 4055 | if (($v_result = $this->privReadFileHeader($v_header)) != 1) { |
@@ -4098,7 +4098,7 @@ discard block |
||
| 4098 | 4098 | if ($p_entry['status'] == 'ok') { |
| 4099 | 4099 | |
| 4100 | 4100 | // ----- Do the extraction (if not a folder) |
| 4101 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
| 4101 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
| 4102 | 4102 | // ----- Look for not compressed file |
| 4103 | 4103 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
| 4104 | 4104 | |
@@ -4161,7 +4161,7 @@ discard block |
||
| 4161 | 4161 | // -------------------------------------------------------------------------------- |
| 4162 | 4162 | function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) |
| 4163 | 4163 | { |
| 4164 | - $v_result=1; |
|
| 4164 | + $v_result = 1; |
|
| 4165 | 4165 | |
| 4166 | 4166 | // ----- Read the file header |
| 4167 | 4167 | $v_header = array(); |
@@ -4212,7 +4212,7 @@ discard block |
||
| 4212 | 4212 | if ($p_entry['status'] == 'ok') { |
| 4213 | 4213 | |
| 4214 | 4214 | // ----- Do the extraction (if not a folder) |
| 4215 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
| 4215 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
| 4216 | 4216 | // ----- Look for not compressed file |
| 4217 | 4217 | // if ($p_entry['compressed_size'] == $p_entry['size']) |
| 4218 | 4218 | if ($p_entry['compression'] == 0) { |
@@ -4284,7 +4284,7 @@ discard block |
||
| 4284 | 4284 | // -------------------------------------------------------------------------------- |
| 4285 | 4285 | function privReadFileHeader(&$p_header) |
| 4286 | 4286 | { |
| 4287 | - $v_result=1; |
|
| 4287 | + $v_result = 1; |
|
| 4288 | 4288 | |
| 4289 | 4289 | // ----- Read the 4 bytes signature |
| 4290 | 4290 | $v_binary_data = @fread($this->zip_fd, 4); |
@@ -4348,7 +4348,7 @@ discard block |
||
| 4348 | 4348 | // ----- Extract time |
| 4349 | 4349 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
| 4350 | 4350 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
| 4351 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
| 4351 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
| 4352 | 4352 | |
| 4353 | 4353 | // ----- Extract date |
| 4354 | 4354 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -4387,7 +4387,7 @@ discard block |
||
| 4387 | 4387 | // -------------------------------------------------------------------------------- |
| 4388 | 4388 | function privReadCentralFileHeader(&$p_header) |
| 4389 | 4389 | { |
| 4390 | - $v_result=1; |
|
| 4390 | + $v_result = 1; |
|
| 4391 | 4391 | |
| 4392 | 4392 | // ----- Read the 4 bytes signature |
| 4393 | 4393 | $v_binary_data = @fread($this->zip_fd, 4); |
@@ -4451,7 +4451,7 @@ discard block |
||
| 4451 | 4451 | // ----- Extract time |
| 4452 | 4452 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
| 4453 | 4453 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
| 4454 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
| 4454 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
| 4455 | 4455 | |
| 4456 | 4456 | // ----- Extract date |
| 4457 | 4457 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -4495,7 +4495,7 @@ discard block |
||
| 4495 | 4495 | // -------------------------------------------------------------------------------- |
| 4496 | 4496 | function privCheckFileHeaders(&$p_local_header, &$p_central_header) |
| 4497 | 4497 | { |
| 4498 | - $v_result=1; |
|
| 4498 | + $v_result = 1; |
|
| 4499 | 4499 | |
| 4500 | 4500 | // ----- Check the static values |
| 4501 | 4501 | // TBC |
@@ -4532,7 +4532,7 @@ discard block |
||
| 4532 | 4532 | // -------------------------------------------------------------------------------- |
| 4533 | 4533 | function privReadEndCentralDir(&$p_central_dir) |
| 4534 | 4534 | { |
| 4535 | - $v_result=1; |
|
| 4535 | + $v_result = 1; |
|
| 4536 | 4536 | |
| 4537 | 4537 | // ----- Go to the end of the zip file |
| 4538 | 4538 | $v_size = filesize($this->zipname); |
@@ -4550,8 +4550,8 @@ discard block |
||
| 4550 | 4550 | // in this case the end of central dir is at 22 bytes of the file end |
| 4551 | 4551 | $v_found = 0; |
| 4552 | 4552 | if ($v_size > 26) { |
| 4553 | - @fseek($this->zip_fd, $v_size-22); |
|
| 4554 | - if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) |
|
| 4553 | + @fseek($this->zip_fd, $v_size - 22); |
|
| 4554 | + if (($v_pos = @ftell($this->zip_fd)) != ($v_size - 22)) |
|
| 4555 | 4555 | { |
| 4556 | 4556 | // ----- Error log |
| 4557 | 4557 | PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); |
@@ -4577,8 +4577,8 @@ discard block |
||
| 4577 | 4577 | $v_maximum_size = 65557; // 0xFFFF + 22; |
| 4578 | 4578 | if ($v_maximum_size > $v_size) |
| 4579 | 4579 | $v_maximum_size = $v_size; |
| 4580 | - @fseek($this->zip_fd, $v_size-$v_maximum_size); |
|
| 4581 | - if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) |
|
| 4580 | + @fseek($this->zip_fd, $v_size - $v_maximum_size); |
|
| 4581 | + if (@ftell($this->zip_fd) != ($v_size - $v_maximum_size)) |
|
| 4582 | 4582 | { |
| 4583 | 4583 | // ----- Error log |
| 4584 | 4584 | PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); |
@@ -4599,7 +4599,7 @@ discard block |
||
| 4599 | 4599 | //$v_bytes = ($v_bytes << 8) | Ord($v_byte); |
| 4600 | 4600 | // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number |
| 4601 | 4601 | // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. |
| 4602 | - $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); |
|
| 4602 | + $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); |
|
| 4603 | 4603 | |
| 4604 | 4604 | // ----- Compare the bytes |
| 4605 | 4605 | if ($v_bytes == 0x504b0506) |
@@ -4689,11 +4689,11 @@ discard block |
||
| 4689 | 4689 | // -------------------------------------------------------------------------------- |
| 4690 | 4690 | function privDeleteByRule(&$p_result_list, &$p_options) |
| 4691 | 4691 | { |
| 4692 | - $v_result=1; |
|
| 4692 | + $v_result = 1; |
|
| 4693 | 4693 | $v_list_detail = array(); |
| 4694 | 4694 | |
| 4695 | 4695 | // ----- Open the zip file |
| 4696 | - if (($v_result=$this->privOpenFd('rb')) != 1) |
|
| 4696 | + if (($v_result = $this->privOpenFd('rb')) != 1) |
|
| 4697 | 4697 | { |
| 4698 | 4698 | // ----- Return |
| 4699 | 4699 | return $v_result; |
@@ -4729,7 +4729,7 @@ discard block |
||
| 4729 | 4729 | // ----- Read each entry |
| 4730 | 4730 | $v_header_list = array(); |
| 4731 | 4731 | $j_start = 0; |
| 4732 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) |
|
| 4732 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) |
|
| 4733 | 4733 | { |
| 4734 | 4734 | |
| 4735 | 4735 | // ----- Read the file header |
@@ -4750,21 +4750,21 @@ discard block |
||
| 4750 | 4750 | $v_found = false; |
| 4751 | 4751 | |
| 4752 | 4752 | // ----- Look for extract by name rule |
| 4753 | - if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) |
|
| 4753 | + if ((isset($p_options[PCLZIP_OPT_BY_NAME])) |
|
| 4754 | 4754 | && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { |
| 4755 | 4755 | |
| 4756 | 4756 | // ----- Look if the filename is in the list |
| 4757 | - for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { |
|
| 4757 | + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { |
|
| 4758 | 4758 | |
| 4759 | 4759 | // ----- Look for a directory |
| 4760 | 4760 | if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { |
| 4761 | 4761 | |
| 4762 | 4762 | // ----- Look if the directory is in the filename path |
| 4763 | - if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) |
|
| 4763 | + if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) |
|
| 4764 | 4764 | && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { |
| 4765 | 4765 | $v_found = true; |
| 4766 | 4766 | } |
| 4767 | - elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ |
|
| 4767 | + elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ |
|
| 4768 | 4768 | && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { |
| 4769 | 4769 | $v_found = true; |
| 4770 | 4770 | } |
@@ -4789,7 +4789,7 @@ discard block |
||
| 4789 | 4789 | */ |
| 4790 | 4790 | |
| 4791 | 4791 | // ----- Look for extract by preg rule |
| 4792 | - else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) |
|
| 4792 | + else if ((isset($p_options[PCLZIP_OPT_BY_PREG])) |
|
| 4793 | 4793 | && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { |
| 4794 | 4794 | |
| 4795 | 4795 | if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { |
@@ -4798,20 +4798,20 @@ discard block |
||
| 4798 | 4798 | } |
| 4799 | 4799 | |
| 4800 | 4800 | // ----- Look for extract by index rule |
| 4801 | - else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) |
|
| 4801 | + else if ((isset($p_options[PCLZIP_OPT_BY_INDEX])) |
|
| 4802 | 4802 | && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { |
| 4803 | 4803 | |
| 4804 | 4804 | // ----- Look if the index is in the list |
| 4805 | - for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { |
|
| 4805 | + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { |
|
| 4806 | 4806 | |
| 4807 | - if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
| 4807 | + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { |
|
| 4808 | 4808 | $v_found = true; |
| 4809 | 4809 | } |
| 4810 | - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
| 4811 | - $j_start = $j+1; |
|
| 4810 | + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { |
|
| 4811 | + $j_start = $j + 1; |
|
| 4812 | 4812 | } |
| 4813 | 4813 | |
| 4814 | - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { |
|
| 4814 | + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { |
|
| 4815 | 4815 | break; |
| 4816 | 4816 | } |
| 4817 | 4817 | } |
@@ -4849,11 +4849,11 @@ discard block |
||
| 4849 | 4849 | } |
| 4850 | 4850 | |
| 4851 | 4851 | // ----- Look which file need to be kept |
| 4852 | - for ($i=0; $i<sizeof($v_header_list); $i++) { |
|
| 4852 | + for ($i = 0; $i < sizeof($v_header_list); $i++) { |
|
| 4853 | 4853 | |
| 4854 | 4854 | // ----- Calculate the position of the header |
| 4855 | 4855 | @rewind($this->zip_fd); |
| 4856 | - if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { |
|
| 4856 | + if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { |
|
| 4857 | 4857 | // ----- Close the zip file |
| 4858 | 4858 | $this->privCloseFd(); |
| 4859 | 4859 | $v_temp_zip->privCloseFd(); |
@@ -4912,7 +4912,7 @@ discard block |
||
| 4912 | 4912 | $v_offset = @ftell($v_temp_zip->zip_fd); |
| 4913 | 4913 | |
| 4914 | 4914 | // ----- Re-Create the Central Dir files header |
| 4915 | - for ($i=0; $i<sizeof($v_header_list); $i++) { |
|
| 4915 | + for ($i = 0; $i < sizeof($v_header_list); $i++) { |
|
| 4916 | 4916 | // ----- Create the file header |
| 4917 | 4917 | if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) { |
| 4918 | 4918 | $v_temp_zip->privCloseFd(); |
@@ -4935,7 +4935,7 @@ discard block |
||
| 4935 | 4935 | } |
| 4936 | 4936 | |
| 4937 | 4937 | // ----- Calculate the size of the central header |
| 4938 | - $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; |
|
| 4938 | + $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset; |
|
| 4939 | 4939 | |
| 4940 | 4940 | // ----- Create the central dir footer |
| 4941 | 4941 | if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { |
@@ -4997,15 +4997,15 @@ discard block |
||
| 4997 | 4997 | // 1 : OK |
| 4998 | 4998 | // -1 : Unable to create directory |
| 4999 | 4999 | // -------------------------------------------------------------------------------- |
| 5000 | - function privDirCheck($p_dir, $p_is_dir=false) |
|
| 5000 | + function privDirCheck($p_dir, $p_is_dir = false) |
|
| 5001 | 5001 | { |
| 5002 | 5002 | $v_result = 1; |
| 5003 | 5003 | |
| 5004 | 5004 | |
| 5005 | 5005 | // ----- Remove the final '/' |
| 5006 | - if (($p_is_dir) && (substr($p_dir, -1)=='/')) |
|
| 5006 | + if (($p_is_dir) && (substr($p_dir, -1) == '/')) |
|
| 5007 | 5007 | { |
| 5008 | - $p_dir = substr($p_dir, 0, strlen($p_dir)-1); |
|
| 5008 | + $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); |
|
| 5009 | 5009 | } |
| 5010 | 5010 | |
| 5011 | 5011 | // ----- Check the directory availability |
@@ -5054,7 +5054,7 @@ discard block |
||
| 5054 | 5054 | // -------------------------------------------------------------------------------- |
| 5055 | 5055 | function privMerge(&$p_archive_to_add) |
| 5056 | 5056 | { |
| 5057 | - $v_result=1; |
|
| 5057 | + $v_result = 1; |
|
| 5058 | 5058 | |
| 5059 | 5059 | // ----- Look if the archive_to_add exists |
| 5060 | 5060 | if (!is_file($p_archive_to_add->zipname)) |
@@ -5079,7 +5079,7 @@ discard block |
||
| 5079 | 5079 | } |
| 5080 | 5080 | |
| 5081 | 5081 | // ----- Open the zip file |
| 5082 | - if (($v_result=$this->privOpenFd('rb')) != 1) |
|
| 5082 | + if (($v_result = $this->privOpenFd('rb')) != 1) |
|
| 5083 | 5083 | { |
| 5084 | 5084 | // ----- Return |
| 5085 | 5085 | return $v_result; |
@@ -5097,7 +5097,7 @@ discard block |
||
| 5097 | 5097 | @rewind($this->zip_fd); |
| 5098 | 5098 | |
| 5099 | 5099 | // ----- Open the archive_to_add file |
| 5100 | - if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) |
|
| 5100 | + if (($v_result = $p_archive_to_add->privOpenFd('rb')) != 1) |
|
| 5101 | 5101 | { |
| 5102 | 5102 | $this->privCloseFd(); |
| 5103 | 5103 | |
@@ -5181,7 +5181,7 @@ discard block |
||
| 5181 | 5181 | $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment']; |
| 5182 | 5182 | |
| 5183 | 5183 | // ----- Calculate the size of the (new) central header |
| 5184 | - $v_size = @ftell($v_zip_temp_fd)-$v_offset; |
|
| 5184 | + $v_size = @ftell($v_zip_temp_fd) - $v_offset; |
|
| 5185 | 5185 | |
| 5186 | 5186 | // ----- Swap the file descriptor |
| 5187 | 5187 | // Here is a trick : I swap the temporary fd with the zip fd, in order to use |
@@ -5191,7 +5191,7 @@ discard block |
||
| 5191 | 5191 | $v_zip_temp_fd = $v_swap; |
| 5192 | 5192 | |
| 5193 | 5193 | // ----- Create the central dir footer |
| 5194 | - if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) |
|
| 5194 | + if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries'] + $v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) |
|
| 5195 | 5195 | { |
| 5196 | 5196 | $this->privCloseFd(); |
| 5197 | 5197 | $p_archive_to_add->privCloseFd(); |
@@ -5239,7 +5239,7 @@ discard block |
||
| 5239 | 5239 | // -------------------------------------------------------------------------------- |
| 5240 | 5240 | function privDuplicate($p_archive_filename) |
| 5241 | 5241 | { |
| 5242 | - $v_result=1; |
|
| 5242 | + $v_result = 1; |
|
| 5243 | 5243 | |
| 5244 | 5244 | // ----- Look if the $p_archive_filename exists |
| 5245 | 5245 | if (!is_file($p_archive_filename)) |
@@ -5253,7 +5253,7 @@ discard block |
||
| 5253 | 5253 | } |
| 5254 | 5254 | |
| 5255 | 5255 | // ----- Open the zip file |
| 5256 | - if (($v_result=$this->privOpenFd('wb')) != 1) |
|
| 5256 | + if (($v_result = $this->privOpenFd('wb')) != 1) |
|
| 5257 | 5257 | { |
| 5258 | 5258 | // ----- Return |
| 5259 | 5259 | return $v_result; |
@@ -5297,7 +5297,7 @@ discard block |
||
| 5297 | 5297 | // Description : |
| 5298 | 5298 | // Parameters : |
| 5299 | 5299 | // -------------------------------------------------------------------------------- |
| 5300 | - function privErrorLog($p_error_code=0, $p_error_string='') |
|
| 5300 | + function privErrorLog($p_error_code = 0, $p_error_string = '') |
|
| 5301 | 5301 | { |
| 5302 | 5302 | if (PCLZIP_ERROR_EXTERNAL == 1) { |
| 5303 | 5303 | PclError($p_error_code, $p_error_string); |
@@ -5334,10 +5334,10 @@ discard block |
||
| 5334 | 5334 | // -------------------------------------------------------------------------------- |
| 5335 | 5335 | function privDisableMagicQuotes() |
| 5336 | 5336 | { |
| 5337 | - $v_result=1; |
|
| 5337 | + $v_result = 1; |
|
| 5338 | 5338 | |
| 5339 | 5339 | // ----- Look if function exists |
| 5340 | - if ( (!function_exists("get_magic_quotes_runtime")) |
|
| 5340 | + if ((!function_exists("get_magic_quotes_runtime")) |
|
| 5341 | 5341 | || (!function_exists("set_magic_quotes_runtime"))) { |
| 5342 | 5342 | return $v_result; |
| 5343 | 5343 | } |
@@ -5368,10 +5368,10 @@ discard block |
||
| 5368 | 5368 | // -------------------------------------------------------------------------------- |
| 5369 | 5369 | function privSwapBackMagicQuotes() |
| 5370 | 5370 | { |
| 5371 | - $v_result=1; |
|
| 5371 | + $v_result = 1; |
|
| 5372 | 5372 | |
| 5373 | 5373 | // ----- Look if function exists |
| 5374 | - if ( (!function_exists("get_magic_quotes_runtime")) |
|
| 5374 | + if ((!function_exists("get_magic_quotes_runtime")) |
|
| 5375 | 5375 | || (!function_exists("set_magic_quotes_runtime"))) { |
| 5376 | 5376 | return $v_result; |
| 5377 | 5377 | } |
@@ -5412,7 +5412,7 @@ discard block |
||
| 5412 | 5412 | |
| 5413 | 5413 | // ----- Study directories from last to first |
| 5414 | 5414 | $v_skip = 0; |
| 5415 | - for ($i=sizeof($v_list)-1; $i>=0; $i--) { |
|
| 5415 | + for ($i = sizeof($v_list) - 1; $i >= 0; $i--) { |
|
| 5416 | 5416 | // ----- Look for current path |
| 5417 | 5417 | if ($v_list[$i] == ".") { |
| 5418 | 5418 | // ----- Ignore this directory |
@@ -5433,7 +5433,7 @@ discard block |
||
| 5433 | 5433 | } |
| 5434 | 5434 | } |
| 5435 | 5435 | // ----- Last '/' i.e. indicates a directory |
| 5436 | - else if ($i == (sizeof($v_list)-1)) { |
|
| 5436 | + else if ($i == (sizeof($v_list) - 1)) { |
|
| 5437 | 5437 | $v_result = $v_list[$i]; |
| 5438 | 5438 | } |
| 5439 | 5439 | // ----- Double '/' inside the path |
@@ -5448,7 +5448,7 @@ discard block |
||
| 5448 | 5448 | $v_skip--; |
| 5449 | 5449 | } |
| 5450 | 5450 | else { |
| 5451 | - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); |
|
| 5451 | + $v_result = $v_list[$i].($i != (sizeof($v_list) - 1) ? "/".$v_result : ""); |
|
| 5452 | 5452 | } |
| 5453 | 5453 | } |
| 5454 | 5454 | } |
@@ -5487,12 +5487,12 @@ discard block |
||
| 5487 | 5487 | $v_result = 1; |
| 5488 | 5488 | |
| 5489 | 5489 | // ----- Look for path beginning by ./ |
| 5490 | - if ( ($p_dir == '.') |
|
| 5491 | - || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { |
|
| 5490 | + if (($p_dir == '.') |
|
| 5491 | + || ((strlen($p_dir) >= 2) && (substr($p_dir, 0, 2) == './'))) { |
|
| 5492 | 5492 | $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1); |
| 5493 | 5493 | } |
| 5494 | - if ( ($p_path == '.') |
|
| 5495 | - || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) { |
|
| 5494 | + if (($p_path == '.') |
|
| 5495 | + || ((strlen($p_path) >= 2) && (substr($p_path, 0, 2) == './'))) { |
|
| 5496 | 5496 | $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1); |
| 5497 | 5497 | } |
| 5498 | 5498 | |
@@ -5518,7 +5518,7 @@ discard block |
||
| 5518 | 5518 | } |
| 5519 | 5519 | |
| 5520 | 5520 | // ----- Compare the items |
| 5521 | - if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) { |
|
| 5521 | + if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) { |
|
| 5522 | 5522 | $v_result = 0; |
| 5523 | 5523 | } |
| 5524 | 5524 | |
@@ -5559,11 +5559,11 @@ discard block |
||
| 5559 | 5559 | // 3 : src & dest gzip |
| 5560 | 5560 | // Return Values : |
| 5561 | 5561 | // -------------------------------------------------------------------------------- |
| 5562 | - function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0) |
|
| 5562 | + function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) |
|
| 5563 | 5563 | { |
| 5564 | 5564 | $v_result = 1; |
| 5565 | 5565 | |
| 5566 | - if ($p_mode==0) |
|
| 5566 | + if ($p_mode == 0) |
|
| 5567 | 5567 | { |
| 5568 | 5568 | while ($p_size != 0) |
| 5569 | 5569 | { |
@@ -5573,7 +5573,7 @@ discard block |
||
| 5573 | 5573 | $p_size -= $v_read_size; |
| 5574 | 5574 | } |
| 5575 | 5575 | } |
| 5576 | - else if ($p_mode==1) |
|
| 5576 | + else if ($p_mode == 1) |
|
| 5577 | 5577 | { |
| 5578 | 5578 | while ($p_size != 0) |
| 5579 | 5579 | { |
@@ -5583,7 +5583,7 @@ discard block |
||
| 5583 | 5583 | $p_size -= $v_read_size; |
| 5584 | 5584 | } |
| 5585 | 5585 | } |
| 5586 | - else if ($p_mode==2) |
|
| 5586 | + else if ($p_mode == 2) |
|
| 5587 | 5587 | { |
| 5588 | 5588 | while ($p_size != 0) |
| 5589 | 5589 | { |
@@ -5593,7 +5593,7 @@ discard block |
||
| 5593 | 5593 | $p_size -= $v_read_size; |
| 5594 | 5594 | } |
| 5595 | 5595 | } |
| 5596 | - else if ($p_mode==3) |
|
| 5596 | + else if ($p_mode == 3) |
|
| 5597 | 5597 | { |
| 5598 | 5598 | while ($p_size != 0) |
| 5599 | 5599 | { |
@@ -5657,7 +5657,7 @@ discard block |
||
| 5657 | 5657 | $v_list = get_defined_constants(); |
| 5658 | 5658 | for (reset($v_list); $v_key = key($v_list); next($v_list)) { |
| 5659 | 5659 | $v_prefix = substr($v_key, 0, 10); |
| 5660 | - if (( ($v_prefix == 'PCLZIP_OPT') |
|
| 5660 | + if ((($v_prefix == 'PCLZIP_OPT') |
|
| 5661 | 5661 | || ($v_prefix == 'PCLZIP_CB_') |
| 5662 | 5662 | || ($v_prefix == 'PCLZIP_ATT')) |
| 5663 | 5663 | && ($v_list[$v_key] == $p_option)) { |
@@ -5682,15 +5682,15 @@ discard block |
||
| 5682 | 5682 | // Return Values : |
| 5683 | 5683 | // The path translated. |
| 5684 | 5684 | // -------------------------------------------------------------------------------- |
| 5685 | - function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true) |
|
| 5685 | + function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true) |
|
| 5686 | 5686 | { |
| 5687 | 5687 | if (stristr(php_uname(), 'windows')) { |
| 5688 | 5688 | // ----- Look for potential disk letter |
| 5689 | 5689 | if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { |
| 5690 | - $p_path = substr($p_path, $v_position+1); |
|
| 5690 | + $p_path = substr($p_path, $v_position + 1); |
|
| 5691 | 5691 | } |
| 5692 | 5692 | // ----- Change potential windows directory separator |
| 5693 | - if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { |
|
| 5693 | + if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { |
|
| 5694 | 5694 | $p_path = strtr($p_path, '\\', '/'); |
| 5695 | 5695 | } |
| 5696 | 5696 | } |
@@ -47,26 +47,26 @@ discard block |
||
| 47 | 47 | * @return bool |
| 48 | 48 | * true si le statut change effectivement |
| 49 | 49 | **/ |
| 50 | -function calculer_rubriques_if ($id_rubrique, $modifs, $statut_ancien='', $postdate = false) |
|
| 50 | +function calculer_rubriques_if($id_rubrique, $modifs, $statut_ancien = '', $postdate = false) |
|
| 51 | 51 | { |
| 52 | 52 | $neuf = false; |
| 53 | 53 | if ($statut_ancien == 'publie') { |
| 54 | 54 | if (isset($modifs['statut']) |
| 55 | 55 | OR isset($modifs['id_rubrique']) |
| 56 | - OR ($postdate AND strtotime($postdate)>time())) |
|
| 56 | + OR ($postdate AND strtotime($postdate) > time())) |
|
| 57 | 57 | $neuf |= depublier_branche_rubrique_if($id_rubrique); |
| 58 | 58 | // ne publier que si c'est pas un postdate, ou si la date n'est pas dans le futur |
| 59 | - if ($postdate){ |
|
| 59 | + if ($postdate) { |
|
| 60 | 60 | calculer_prochain_postdate(true); |
| 61 | - $neuf |= (strtotime($postdate)<=time()); // par securite |
|
| 61 | + $neuf |= (strtotime($postdate) <= time()); // par securite |
|
| 62 | 62 | } |
| 63 | 63 | elseif (isset($modifs['id_rubrique'])) |
| 64 | 64 | $neuf |= publier_branche_rubrique($modifs['id_rubrique']); |
| 65 | 65 | } |
| 66 | - elseif ($modifs['statut']=='publie'){ |
|
| 67 | - if ($postdate){ |
|
| 66 | + elseif ($modifs['statut'] == 'publie') { |
|
| 67 | + if ($postdate) { |
|
| 68 | 68 | calculer_prochain_postdate(true); |
| 69 | - $neuf |= (strtotime($postdate)<=time()); // par securite |
|
| 69 | + $neuf |= (strtotime($postdate) <= time()); // par securite |
|
| 70 | 70 | } |
| 71 | 71 | else |
| 72 | 72 | $neuf |= publier_branche_rubrique($id_rubrique); |
@@ -121,14 +121,14 @@ discard block |
||
| 121 | 121 | * @return bool |
| 122 | 122 | * true si le statut change effectivement |
| 123 | 123 | */ |
| 124 | -function depublier_branche_rubrique_if($id_rubrique){ |
|
| 124 | +function depublier_branche_rubrique_if($id_rubrique) { |
|
| 125 | 125 | $date = date('Y-m-d H:i:s'); // figer la date |
| 126 | 126 | |
| 127 | 127 | # spip_log("depublier_branche_rubrique($id_rubrique ?"); |
| 128 | 128 | $id_pred = $id_rubrique; |
| 129 | 129 | while ($id_pred) { |
| 130 | 130 | |
| 131 | - if (!depublier_rubrique_if($id_pred,$date)) |
|
| 131 | + if (!depublier_rubrique_if($id_pred, $date)) |
|
| 132 | 132 | return $id_pred != $id_rubrique; |
| 133 | 133 | // passer au parent si on a depublie |
| 134 | 134 | $r = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=$id_pred"); |
@@ -149,27 +149,27 @@ discard block |
||
| 149 | 149 | * @return bool |
| 150 | 150 | * true si la rubrique a été dépubliée |
| 151 | 151 | */ |
| 152 | -function depublier_rubrique_if($id_rubrique,$date=null){ |
|
| 152 | +function depublier_rubrique_if($id_rubrique, $date = null) { |
|
| 153 | 153 | if (is_null($date)) { |
| 154 | 154 | $date = date('Y-m-d H:i:s'); |
| 155 | 155 | } |
| 156 | 156 | $postdates = ($GLOBALS['meta']["post_dates"] == "non") ? |
| 157 | 157 | " AND date <= ".sql_quote($date) : ''; |
| 158 | 158 | |
| 159 | - if (!$id_rubrique=intval($id_rubrique)) |
|
| 159 | + if (!$id_rubrique = intval($id_rubrique)) |
|
| 160 | 160 | return false; |
| 161 | 161 | |
| 162 | 162 | // verifier qu'elle existe et est bien publiee |
| 163 | - $r = sql_fetsel('id_rubrique,statut','spip_rubriques',"id_rubrique=$id_rubrique"); |
|
| 164 | - if (!$r OR $r['statut']!=='publie') |
|
| 163 | + $r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', "id_rubrique=$id_rubrique"); |
|
| 164 | + if (!$r OR $r['statut'] !== 'publie') |
|
| 165 | 165 | return false; |
| 166 | 166 | |
| 167 | 167 | // On met le nombre de chaque type d'enfants dans un tableau |
| 168 | 168 | // Le type de l'objet est au pluriel |
| 169 | 169 | $compte = array( |
| 170 | - 'articles' => sql_countsel("spip_articles", "id_rubrique=$id_rubrique AND statut='publie'$postdates"), |
|
| 171 | - 'rubriques' => sql_countsel("spip_rubriques", "id_parent=$id_rubrique AND statut='publie'"), |
|
| 172 | - 'documents' => sql_countsel("spip_documents_liens", "id_objet=$id_rubrique AND objet='rubrique'") |
|
| 170 | + 'articles' => sql_countsel("spip_articles", "id_rubrique=$id_rubrique AND statut='publie'$postdates"), |
|
| 171 | + 'rubriques' => sql_countsel("spip_rubriques", "id_parent=$id_rubrique AND statut='publie'"), |
|
| 172 | + 'documents' => sql_countsel("spip_documents_liens", "id_objet=$id_rubrique AND objet='rubrique'") |
|
| 173 | 173 | ); |
| 174 | 174 | |
| 175 | 175 | // On passe le tableau des comptes dans un pipeline pour que les plugins puissent ajouter (ou retirer) des enfants |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | 188 | // S'il y a au moins un enfant de n'importe quoi, on ne dépublie pas |
| 189 | - foreach($compte as $objet => $n) |
|
| 189 | + foreach ($compte as $objet => $n) |
|
| 190 | 190 | if ($n) |
| 191 | 191 | return false; |
| 192 | 192 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $continuer = false; |
| 268 | 268 | $r = sql_select("R.id_rubrique AS id, max(A.date_tmp) AS date_h", "spip_rubriques AS R, spip_rubriques AS A", "R.id_rubrique = A.id_parent AND (R.date_tmp < A.date_tmp OR R.statut_tmp<>'publie') AND A.statut_tmp='publie' ", "R.id_rubrique"); |
| 269 | 269 | while ($row = sql_fetch($r)) { |
| 270 | - sql_updateq('spip_rubriques', array('statut_tmp'=>'publie', 'date_tmp'=>$row['date_h']),"id_rubrique=".$row['id']); |
|
| 270 | + sql_updateq('spip_rubriques', array('statut_tmp'=>'publie', 'date_tmp'=>$row['date_h']), "id_rubrique=".$row['id']); |
|
| 271 | 271 | $continuer = true; |
| 272 | 272 | } |
| 273 | 273 | } while ($continuer); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | // Profondeur 0 |
| 291 | 291 | // Toutes les rubriques racines sont de profondeur 0 |
| 292 | 292 | // et fixer les id_secteur des rubriques racines |
| 293 | - sql_update('spip_rubriques', array('id_secteur'=>'id_rubrique','profondeur'=>0), "id_parent=0"); |
|
| 293 | + sql_update('spip_rubriques', array('id_secteur'=>'id_rubrique', 'profondeur'=>0), "id_parent=0"); |
|
| 294 | 294 | // Toute rubrique non racine est de profondeur >0 |
| 295 | 295 | sql_updateq('spip_rubriques', array('profondeur'=>1), "id_parent<>0 AND profondeur=0"); |
| 296 | 296 | |
@@ -318,21 +318,21 @@ discard block |
||
| 318 | 318 | "A.id_rubrique AS id, R.id_secteur AS id_secteur, R.profondeur+1 as profondeur", |
| 319 | 319 | "spip_rubriques AS A JOIN spip_rubriques AS R ON A.id_parent = R.id_rubrique", |
| 320 | 320 | "R.profondeur=".intval($prof)." AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)", |
| 321 | - "","R.id_secteur","0,100")){ |
|
| 321 | + "", "R.id_secteur", "0,100")) { |
|
| 322 | 322 | |
| 323 | 323 | $id_secteur = null; |
| 324 | 324 | $ids = array(); |
| 325 | 325 | while ($row = array_shift($rows)) { |
| 326 | - if ($row['id_secteur']!==$id_secteur){ |
|
| 326 | + if ($row['id_secteur'] !== $id_secteur) { |
|
| 327 | 327 | if (count($ids)) |
| 328 | - sql_updateq("spip_rubriques", array("id_secteur" => $id_secteur,'profondeur' => $prof+1), sql_in('id_rubrique',$ids)); |
|
| 328 | + sql_updateq("spip_rubriques", array("id_secteur" => $id_secteur, 'profondeur' => $prof + 1), sql_in('id_rubrique', $ids)); |
|
| 329 | 329 | $id_secteur = $row['id_secteur']; |
| 330 | 330 | $ids = array(); |
| 331 | 331 | } |
| 332 | 332 | $ids[] = $row['id']; |
| 333 | 333 | } |
| 334 | 334 | if (count($ids)) |
| 335 | - sql_updateq("spip_rubriques", array("id_secteur" => $id_secteur,'profondeur' => $prof+1), sql_in('id_rubrique',$ids)); |
|
| 335 | + sql_updateq("spip_rubriques", array("id_secteur" => $id_secteur, 'profondeur' => $prof + 1), sql_in('id_rubrique', $ids)); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | |
@@ -342,16 +342,16 @@ discard block |
||
| 342 | 342 | AND $rows = sql_allfetsel( |
| 343 | 343 | "id_rubrique as id", |
| 344 | 344 | "spip_rubriques", |
| 345 | - "profondeur=".intval($prof+1)." AND id_parent NOT IN (".sql_get_select("zzz.id_rubrique","spip_rubriques AS zzz","zzz.profondeur=".intval($prof)).")",'','','0,100')){ |
|
| 346 | - $rows = array_map('reset',$rows); |
|
| 347 | - sql_updateq("spip_rubriques", array('profondeur' => $prof+2), sql_in("id_rubrique",$rows)); |
|
| 345 | + "profondeur=".intval($prof + 1)." AND id_parent NOT IN (".sql_get_select("zzz.id_rubrique", "spip_rubriques AS zzz", "zzz.profondeur=".intval($prof)).")", '', '', '0,100')) { |
|
| 346 | + $rows = array_map('reset', $rows); |
|
| 347 | + sql_updateq("spip_rubriques", array('profondeur' => $prof + 2), sql_in("id_rubrique", $rows)); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | // ici on a fini de valider $prof+1, toutes les rubriques de prondeur 0 a $prof+1 sont OK |
| 351 | 351 | // si pas de rubrique a profondeur $prof+1 pas la peine de continuer |
| 352 | 352 | // si il reste des rubriques non vues, c'est une branche morte ou reference circulaire (base foireuse) |
| 353 | 353 | // on arrete les frais |
| 354 | - if (sql_countsel("spip_rubriques","profondeur=".intval($prof+1))){ |
|
| 354 | + if (sql_countsel("spip_rubriques", "profondeur=".intval($prof + 1))) { |
|
| 355 | 355 | $prof++; |
| 356 | 356 | $continuer = true; |
| 357 | 357 | } |
@@ -360,9 +360,9 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | // loger si la table des rubriques semble foireuse |
| 362 | 362 | // et mettre un id_secteur=0 sur ces rubriques pour eviter toute selection par les boucles |
| 363 | - if (sql_countsel("spip_rubriques","profondeur>".intval($prof+1))){ |
|
| 364 | - spip_log("Les rubriques de profondeur>".($prof+1)." semblent suspectes (branches morte ou reference circulaire dans les parents)",_LOG_CRITIQUE); |
|
| 365 | - sql_update("spip_rubriques",array('id_secteur'=>0),"profondeur>".intval($prof+1)); |
|
| 363 | + if (sql_countsel("spip_rubriques", "profondeur>".intval($prof + 1))) { |
|
| 364 | + spip_log("Les rubriques de profondeur>".($prof + 1)." semblent suspectes (branches morte ou reference circulaire dans les parents)", _LOG_CRITIQUE); |
|
| 365 | + sql_update("spip_rubriques", array('id_secteur'=>0), "profondeur>".intval($prof + 1)); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | // reparer les articles |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | // avertir les plugins qui peuvent faire leur mises a jour egalement |
| 376 | - pipeline('trig_propager_les_secteurs',''); |
|
| 376 | + pipeline('trig_propager_les_secteurs', ''); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | // avertir les plugins qui peuvent faire leur mises a jour egalement |
| 434 | - pipeline('trig_calculer_langues_rubriques',''); |
|
| 434 | + pipeline('trig_calculer_langues_rubriques', ''); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * @return string |
| 448 | 448 | * Liste des langues utilisées séparées par des virgules |
| 449 | 449 | **/ |
| 450 | -function calculer_langues_utilisees ($serveur='') { |
|
| 450 | +function calculer_langues_utilisees($serveur = '') { |
|
| 451 | 451 | include_spip('public/interfaces'); |
| 452 | 452 | include_spip('public/compiler'); |
| 453 | 453 | include_spip('public/composer'); |
@@ -457,14 +457,14 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | include_spip('base/objets'); |
| 459 | 459 | $tables = lister_tables_objets_sql(); |
| 460 | - $trouver_table = charger_fonction('trouver_table','base'); |
|
| 460 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 461 | 461 | |
| 462 | - foreach(array_keys($tables) as $t){ |
|
| 463 | - $desc = $trouver_table($t,$serveur); |
|
| 462 | + foreach (array_keys($tables) as $t) { |
|
| 463 | + $desc = $trouver_table($t, $serveur); |
|
| 464 | 464 | // c'est une table avec des langues |
| 465 | 465 | if ($desc['exist'] |
| 466 | 466 | AND isset($desc['field']['lang']) |
| 467 | - AND isset($desc['field']['langue_choisie'])){ |
|
| 467 | + AND isset($desc['field']['langue_choisie'])) { |
|
| 468 | 468 | |
| 469 | 469 | $boucle = new Boucle(); |
| 470 | 470 | $boucle->show = $desc; |
@@ -477,12 +477,12 @@ discard block |
||
| 477 | 477 | $boucle = pipeline('pre_boucle', $boucle); |
| 478 | 478 | |
| 479 | 479 | if (isset($desc['statut']) |
| 480 | - AND $desc['statut']){ |
|
| 480 | + AND $desc['statut']) { |
|
| 481 | 481 | instituer_boucle($boucle, false); |
| 482 | - $res = calculer_select($boucle->select,$boucle->from,$boucle->from_type,$boucle->where,$boucle->join,$boucle->group,$boucle->order,$boucle->limit,$boucle->having,$desc['table_objet'],$desc['table_objet'],$serveur); |
|
| 482 | + $res = calculer_select($boucle->select, $boucle->from, $boucle->from_type, $boucle->where, $boucle->join, $boucle->group, $boucle->order, $boucle->limit, $boucle->having, $desc['table_objet'], $desc['table_objet'], $serveur); |
|
| 483 | 483 | } |
| 484 | 484 | else |
| 485 | - $res = sql_select(implode(',',$boucle->select),$boucle->from); |
|
| 485 | + $res = sql_select(implode(',', $boucle->select), $boucle->from); |
|
| 486 | 486 | while ($row = sql_fetch($res)) { |
| 487 | 487 | $langues[$row['lang']] = 1; |
| 488 | 488 | } |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | $langues = array_filter(array_keys($langues)); |
| 493 | 493 | sort($langues); |
| 494 | - $langues = join(',',$langues); |
|
| 494 | + $langues = join(',', $langues); |
|
| 495 | 495 | spip_log("langues utilisees: $langues"); |
| 496 | 496 | return $langues; |
| 497 | 497 | } |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | * @param string|int|array $generation |
| 508 | 508 | * @return string |
| 509 | 509 | */ |
| 510 | -function calcul_branche ($generation) {return calcul_branche_in($generation);} |
|
| 510 | +function calcul_branche($generation) {return calcul_branche_in($generation); } |
|
| 511 | 511 | |
| 512 | 512 | /** |
| 513 | 513 | * Calcul d'une branche de rubrique |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | * incluant les rubriques noeuds et toutes leurs descendances |
| 524 | 524 | */ |
| 525 | 525 | function calcul_branche_in($id) { |
| 526 | - $calcul_branche_in = charger_fonction('calcul_branche_in','inc'); |
|
| 526 | + $calcul_branche_in = charger_fonction('calcul_branche_in', 'inc'); |
|
| 527 | 527 | return $calcul_branche_in($id); |
| 528 | 528 | } |
| 529 | 529 | |
@@ -541,8 +541,8 @@ discard block |
||
| 541 | 541 | * Liste des identifiants séparés par des virgules, |
| 542 | 542 | * incluant les rubriques transmises et toutes leurs parentées |
| 543 | 543 | */ |
| 544 | -function calcul_hierarchie_in($id, $tout=true) { |
|
| 545 | - $calcul_hierarchie_in = charger_fonction('calcul_hierarchie_in','inc'); |
|
| 544 | +function calcul_hierarchie_in($id, $tout = true) { |
|
| 545 | + $calcul_hierarchie_in = charger_fonction('calcul_hierarchie_in', 'inc'); |
|
| 546 | 546 | return $calcul_hierarchie_in($id, $tout); |
| 547 | 547 | } |
| 548 | 548 | |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | static $b = array(); |
| 566 | 566 | |
| 567 | 567 | // normaliser $id qui a pu arriver comme un array, comme un entier, ou comme une chaine NN,NN,NN |
| 568 | - if (!is_array($id)) $id = explode(',',$id); |
|
| 568 | + if (!is_array($id)) $id = explode(',', $id); |
|
| 569 | 569 | $id = join(',', array_map('intval', $id)); |
| 570 | 570 | if (isset($b[$id])) |
| 571 | 571 | return $b[$id]; |
@@ -579,14 +579,14 @@ discard block |
||
| 579 | 579 | while ($maxiter-- AND $filles = sql_allfetsel( |
| 580 | 580 | 'id_rubrique', |
| 581 | 581 | 'spip_rubriques', |
| 582 | - sql_in('id_parent', $r) ." AND ". sql_in('id_rubrique', $r, 'NOT') |
|
| 582 | + sql_in('id_parent', $r)." AND ".sql_in('id_rubrique', $r, 'NOT') |
|
| 583 | 583 | )) { |
| 584 | 584 | $r = join(',', array_map('reset', $filles)); |
| 585 | - $branche .= ',' . $r; |
|
| 585 | + $branche .= ','.$r; |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | # securite pour ne pas plomber la conso memoire sur les sites prolifiques |
| 589 | - if (strlen($branche)<10000) |
|
| 589 | + if (strlen($branche) < 10000) |
|
| 590 | 590 | $b[$id] = $branche; |
| 591 | 591 | return $branche; |
| 592 | 592 | } |
@@ -607,16 +607,16 @@ discard block |
||
| 607 | 607 | * Liste des identifiants séparés par des virgules, |
| 608 | 608 | * incluant les rubriques transmises et toutes leurs parentées |
| 609 | 609 | */ |
| 610 | -function inc_calcul_hierarchie_in_dist($id, $tout=true) { |
|
| 610 | +function inc_calcul_hierarchie_in_dist($id, $tout = true) { |
|
| 611 | 611 | static $b = array(); |
| 612 | 612 | |
| 613 | 613 | // normaliser $id qui a pu arriver comme un array, comme un entier, ou comme une chaine NN,NN,NN |
| 614 | - if (!is_array($id)) $id = explode(',',$id); |
|
| 614 | + if (!is_array($id)) $id = explode(',', $id); |
|
| 615 | 615 | $id = join(',', array_map('intval', $id)); |
| 616 | 616 | |
| 617 | 617 | if (isset($b[$id])) { |
| 618 | 618 | // Notre branche commence par la rubrique de depart si $tout=true |
| 619 | - return $tout ? (strlen($b[$id]) ? $b[$id] . ",$id" : $id) : $b[$id]; |
|
| 619 | + return $tout ? (strlen($b[$id]) ? $b[$id].",$id" : $id) : $b[$id]; |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | $hier = ""; |
@@ -628,14 +628,14 @@ discard block |
||
| 628 | 628 | while ($maxiter-- AND $parents = sql_allfetsel( |
| 629 | 629 | 'id_parent', |
| 630 | 630 | 'spip_rubriques', |
| 631 | - sql_in('id_rubrique', $ids_nouveaux_parents) ." AND ". sql_in('id_parent',$hier,'NOT') |
|
| 631 | + sql_in('id_rubrique', $ids_nouveaux_parents)." AND ".sql_in('id_parent', $hier, 'NOT') |
|
| 632 | 632 | )) { |
| 633 | 633 | $ids_nouveaux_parents = join(',', array_map('reset', $parents)); |
| 634 | - $hier = $ids_nouveaux_parents.(strlen($hier)?','.$hier:''); |
|
| 634 | + $hier = $ids_nouveaux_parents.(strlen($hier) ? ','.$hier : ''); |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | # securite pour ne pas plomber la conso memoire sur les sites prolifiques |
| 638 | - if (strlen($hier)<10000) { |
|
| 638 | + if (strlen($hier) < 10000) { |
|
| 639 | 639 | $b[$id] = $hier; |
| 640 | 640 | } |
| 641 | 641 | |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | * true pour affecter le statut des rubriques concernées. |
| 658 | 658 | * @return void |
| 659 | 659 | **/ |
| 660 | -function calculer_prochain_postdate($check= false) { |
|
| 660 | +function calculer_prochain_postdate($check = false) { |
|
| 661 | 661 | include_spip('base/abstract_sql'); |
| 662 | 662 | if ($check) { |
| 663 | 663 | $postdates = ($GLOBALS['meta']["post_dates"] == "non") ? |
@@ -668,15 +668,15 @@ discard block |
||
| 668 | 668 | while ($row = sql_fetch($r)) |
| 669 | 669 | publier_branche_rubrique($row['id']); |
| 670 | 670 | |
| 671 | - pipeline('trig_calculer_prochain_postdate',''); |
|
| 671 | + pipeline('trig_calculer_prochain_postdate', ''); |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | $t = sql_fetsel("date", "spip_articles", "statut='publie' AND date > ".sql_quote(date('Y-m-d H:i:s')), "", "date", "1"); |
| 675 | 675 | |
| 676 | 676 | if ($t) { |
| 677 | - $t = $t['date']; |
|
| 677 | + $t = $t['date']; |
|
| 678 | 678 | if (!isset($GLOBALS['meta']['date_prochain_postdate']) |
| 679 | - OR $t<>$GLOBALS['meta']['date_prochain_postdate']){ |
|
| 679 | + OR $t <> $GLOBALS['meta']['date_prochain_postdate']) { |
|
| 680 | 680 | ecrire_meta('date_prochain_postdate', strtotime($t)); |
| 681 | 681 | ecrire_meta('derniere_modif', time()); |
| 682 | 682 | } |
@@ -709,16 +709,16 @@ discard block |
||
| 709 | 709 | * @return int |
| 710 | 710 | * Identifiant de la rubrique la plus profonde. |
| 711 | 711 | */ |
| 712 | -function creer_rubrique_nommee($titre, $id_parent=0, $serveur='') { |
|
| 712 | +function creer_rubrique_nommee($titre, $id_parent = 0, $serveur = '') { |
|
| 713 | 713 | |
| 714 | 714 | // eclater l'arborescence demandee |
| 715 | 715 | // echapper les </multi> et autres balises fermantes html |
| 716 | - $titre = preg_replace(",</([a-z][^>]*)>,ims","<@\\1>",$titre); |
|
| 716 | + $titre = preg_replace(",</([a-z][^>]*)>,ims", "<@\\1>", $titre); |
|
| 717 | 717 | $arbo = explode('/', preg_replace(',^/,', '', $titre)); |
| 718 | 718 | include_spip('base/abstract_sql'); |
| 719 | 719 | foreach ($arbo as $titre) { |
| 720 | 720 | // retablir les </multi> et autres balises fermantes html |
| 721 | - $titre = preg_replace(",<@([a-z][^>]*)>,ims","</\\1>",$titre); |
|
| 721 | + $titre = preg_replace(",<@([a-z][^>]*)>,ims", "</\\1>", $titre); |
|
| 722 | 722 | $r = sql_getfetsel("id_rubrique", "spip_rubriques", "titre = ".sql_quote($titre)." AND id_parent=".intval($id_parent), |
| 723 | 723 | $groupby = array(), $orderby = array(), $limit = '', $having = array(), $serveur); |
| 724 | 724 | if ($r !== NULL) { |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | 'titre' => $titre, |
| 729 | 729 | 'id_parent' => $id_parent, |
| 730 | 730 | 'statut' => 'prive') |
| 731 | - ,$desc=array(), $serveur); |
|
| 731 | + ,$desc = array(), $serveur); |
|
| 732 | 732 | if ($id_parent > 0) { |
| 733 | 733 | $data = sql_fetsel("id_secteur,lang", "spip_rubriques", "id_rubrique=$id_parent", |
| 734 | 734 | $groupby = array(), $orderby = array(), $limit = '', $having = array(), $serveur); |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | $lang = $GLOBALS['meta']['langue_site']; |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | - sql_updateq('spip_rubriques', array('id_secteur'=>$id_secteur, "lang"=>$lang), "id_rubrique=$id_rubrique", $desc='', $serveur); |
|
| 742 | + sql_updateq('spip_rubriques', array('id_secteur'=>$id_secteur, "lang"=>$lang), "id_rubrique=$id_rubrique", $desc = '', $serveur); |
|
| 743 | 743 | |
| 744 | 744 | // pour la recursion |
| 745 | 745 | $id_parent = $id_rubrique; |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | * @param <type> $dirname |
| 23 | 23 | * @return <type> |
| 24 | 24 | */ |
| 25 | -function find_langs_in_path ($file, $dirname='lang') { |
|
| 26 | - static $dirs=array(); |
|
| 25 | +function find_langs_in_path($file, $dirname = 'lang') { |
|
| 26 | + static $dirs = array(); |
|
| 27 | 27 | $liste = array(); |
| 28 | - foreach(creer_chemin() as $dir) { |
|
| 29 | - if (!isset($dirs[$a = $dir . $dirname])) |
|
| 30 | - $dirs[$a] = (is_dir($a) || !$a) ; |
|
| 28 | + foreach (creer_chemin() as $dir) { |
|
| 29 | + if (!isset($dirs[$a = $dir.$dirname])) |
|
| 30 | + $dirs[$a] = (is_dir($a) || !$a); |
|
| 31 | 31 | if ($dirs[$a]) { |
| 32 | 32 | if (is_readable($a .= $file)) { |
| 33 | 33 | $liste[] = $a; |
@@ -48,18 +48,18 @@ discard block |
||
| 48 | 48 | if ($f = ($module == 'local' |
| 49 | 49 | ? find_in_path($module.$lang.'.php', 'lang/') |
| 50 | 50 | : find_langs_in_path($module.$lang.'.php', 'lang/'))) |
| 51 | - return is_array($f)?$f:array($f); |
|
| 51 | + return is_array($f) ? $f : array($f); |
|
| 52 | 52 | |
| 53 | 53 | // 2) directement dans le chemin (old style, uniquement pour local) |
| 54 | 54 | return (($module == 'local') OR strpos($module, '/')) |
| 55 | - ? (($f = find_in_path($module.$lang. '.php')) ? array($f):false) |
|
| 55 | + ? (($f = find_in_path($module.$lang.'.php')) ? array($f) : false) |
|
| 56 | 56 | : false; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // http://doc.spip.org/@charger_langue |
| 60 | 60 | function charger_langue($lang, $module = 'spip') { |
| 61 | 61 | if ($lang AND $fichiers_lang = chercher_module_lang($module, $lang)) { |
| 62 | - $GLOBALS['idx_lang']='i18n_'.$module.'_'.$lang; |
|
| 62 | + $GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$lang; |
|
| 63 | 63 | include(array_shift($fichiers_lang)); |
| 64 | 64 | surcharger_langue($fichiers_lang); |
| 65 | 65 | } else { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $fichiers_lang = chercher_module_lang($module, _LANGUE_PAR_DEFAUT); |
| 73 | 73 | |
| 74 | 74 | if ($fichiers_lang) { |
| 75 | - $GLOBALS['idx_lang']='i18n_'.$module.'_' .$l; |
|
| 75 | + $GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$l; |
|
| 76 | 76 | include(array_shift($fichiers_lang)); |
| 77 | 77 | surcharger_langue($fichiers_lang); |
| 78 | 78 | $GLOBALS['i18n_'.$module.'_'.$lang] |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | if (!is_array($fichiers)) $fichiers = array($fichiers); |
| 94 | 94 | if (!count($fichiers)) return; |
| 95 | - foreach($fichiers as $fichier){ |
|
| 95 | + foreach ($fichiers as $fichier) { |
|
| 96 | 96 | if (!isset($surcharges[$fichier])) { |
| 97 | 97 | $idx_lang_normal = $GLOBALS['idx_lang']; |
| 98 | 98 | $GLOBALS['idx_lang'] = $GLOBALS['idx_lang'].'@temporaire'; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | if (is_array($surcharges[$fichier])) { |
| 105 | 105 | $GLOBALS[$GLOBALS['idx_lang']] = array_merge( |
| 106 | - (array)$GLOBALS[$GLOBALS['idx_lang']], |
|
| 106 | + (array) $GLOBALS[$GLOBALS['idx_lang']], |
|
| 107 | 107 | $surcharges[$fichier] |
| 108 | 108 | ); |
| 109 | 109 | } |
@@ -122,14 +122,14 @@ discard block |
||
| 122 | 122 | return $deja_vu[$lang][$ori]; |
| 123 | 123 | |
| 124 | 124 | // modules demandes explicitement <xxx|yyy|zzz:code> cf MODULES_IDIOMES |
| 125 | - if (strpos($ori,':')) { |
|
| 126 | - list($modules,$code) = explode(':',$ori,2); |
|
| 125 | + if (strpos($ori, ':')) { |
|
| 126 | + list($modules, $code) = explode(':', $ori, 2); |
|
| 127 | 127 | $modules = explode('|', $modules); |
| 128 | 128 | $ori_complet = $ori; |
| 129 | 129 | } else { |
| 130 | 130 | $modules = array('spip', 'ecrire'); |
| 131 | 131 | $code = $ori; |
| 132 | - $ori_complet = implode('|', $modules) . ':' . $ori; |
|
| 132 | + $ori_complet = implode('|', $modules).':'.$ori; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $text = ''; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | // -- on cherche (lang/)local_xx.php ... |
| 145 | 145 | if (!isset($local['local_'.$lang])) { |
| 146 | 146 | // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer) |
| 147 | - $GLOBALS['idx_lang']= $var; |
|
| 147 | + $GLOBALS['idx_lang'] = $var; |
|
| 148 | 148 | $local['local_'.$lang] = chercher_module_lang('local', $lang); |
| 149 | 149 | } |
| 150 | 150 | if ($local['local_'.$lang]) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // Supprimer la mention <NEW> ou <MODIF> |
| 182 | - if (substr($text,0,1) === '<') |
|
| 182 | + if (substr($text, 0, 1) === '<') |
|
| 183 | 183 | $text = str_replace(array('<NEW>', '<MODIF>'), array(), $text); |
| 184 | 184 | |
| 185 | 185 | // Si on n'est pas en utf-8, la chaine peut l'etre... |
@@ -187,13 +187,13 @@ discard block |
||
| 187 | 187 | if ($GLOBALS['meta']['charset'] !== 'utf-8' |
| 188 | 188 | AND preg_match(',[\x7f-\xff],S', $text)) { |
| 189 | 189 | include_spip('inc/charsets'); |
| 190 | - $text = charset2unicode($text,'utf-8'); |
|
| 190 | + $text = charset2unicode($text, 'utf-8'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (_request('var_mode') == 'traduction') { |
| 194 | - if ($text) { |
|
| 195 | - $classe = 'debug-traduction' . ($module_retenu == 'ecrire' ? '-prive' : ''); |
|
| 196 | - $text = '<span lang=' . $langue_retenue . ' class=' . $classe . ' title=' . $ori_complet . '(' . $langue_retenue . ')>' . $text . '</span>'; |
|
| 194 | + if ($text) { |
|
| 195 | + $classe = 'debug-traduction'.($module_retenu == 'ecrire' ? '-prive' : ''); |
|
| 196 | + $text = '<span lang='.$langue_retenue.' class='.$classe.' title='.$ori_complet.'('.$langue_retenue.')>'.$text.'</span>'; |
|
| 197 | 197 | $text = str_replace( |
| 198 | 198 | array("$module_retenu:", "$module_retenu|"), |
| 199 | 199 | array("*$module_retenu*:", "*$module_retenu*|"), |