From c74e2ab49ee08101b38b3904a49037fcd6f9403c Mon Sep 17 00:00:00 2001 From: patdenice Date: Sun, 23 Nov 2008 17:23:57 +0000 Subject: - Add home and identification buttons after installation. - Use fetchRemote function for remote site actions. - Corrections in fetchRemote fnction. - Move PLUGIN_PICTURE_BEFORE in picture.tpl. git-svn-id: http://piwigo.org/svn/trunk@2902 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 18 +++++++++++++++++- admin/site_manager.php | 6 ++++-- admin/site_reader_remote.php | 5 ++--- admin/template/goto/install.tpl | 6 ++++++ include/functions_xml.inc.php | 9 +-------- language/de_DE/install.lang.php | 2 +- language/en_UK/install.lang.php | 2 +- language/es_ES/install.lang.php | 2 +- language/fr_FR/install.lang.php | 2 +- language/it_IT/install.lang.php | 2 +- language/nl_NL/install.lang.php | 2 +- template/yoga/picture.tpl | 5 ++--- 12 files changed, 38 insertions(+), 23 deletions(-) diff --git a/admin/include/functions.php b/admin/include/functions.php index a8193d3af..fc11101fc 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1948,6 +1948,21 @@ function cat_admin_access($category_id) */ function fetchRemote($src, &$dest, $user_agent='Piwigo', $step=0) { + // Try to retrieve data from local file? + if (!url_is_remote($src)) + { + $content = @file_get_contents($src); + if ($content !== false) + { + is_resource($dest) ? @fwrite($dest, $content) : $dest = $content; + return true; + } + else + { + return false; + } + } + // After 3 redirections, return false if ($step > 3) return false; @@ -1964,8 +1979,9 @@ function fetchRemote($src, &$dest, $user_agent='Piwigo', $step=0) @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $content = @curl_exec($ch); $header_length = @curl_getinfo($ch, CURLINFO_HEADER_SIZE); + $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE); @curl_close($ch); - if ($content !== false) + if ($content !== false and $status >= 200 and $status < 400) { if (preg_match('/Location:\s+?(.+)/', substr($content, 0, $header_length), $m)) { diff --git a/admin/site_manager.php b/admin/site_manager.php index b965b26e8..ea7f060cd 100644 --- a/admin/site_manager.php +++ b/admin/site_manager.php @@ -44,8 +44,9 @@ function remote_output($url) { global $template, $page; - if($lines = @file($url)) + if (fetchRemote($url, $result)) { + $lines = explode("\r\n", $result); // cleaning lines from HTML tags foreach ($lines as $line) { @@ -112,8 +113,9 @@ SELECT COUNT(id) AS count $clf_url = $url.'create_listing_file.php'; $clf_url.= '?action=test'; $clf_url.= '&version='.PHPWG_VERSION; - if ( ($lines = @file($clf_url)) !== false) + if (fetchRemote($clf_url, $result)) { + $lines = explode("\r\n", $result); $first_line = strip_tags($lines[0]); if (!preg_match('/^PWG-INFO-2:/', $first_line)) { diff --git a/admin/site_reader_remote.php b/admin/site_reader_remote.php index 31ae3e792..5c350acf8 100644 --- a/admin/site_reader_remote.php +++ b/admin/site_reader_remote.php @@ -48,7 +48,7 @@ function RemoteSiteReader($url, $listing_url) if (!isset($listing_url)) { - $this->listing_url = $this->site_url.'/listing.xml'; + $this->listing_url = $this->site_url.'listing.xml'; } else { @@ -65,11 +65,10 @@ function open() { global $errors; - if (@fopen($this->listing_url, 'r')) + if ($xml_content = getXmlCode($this->listing_url)) { $this->site_dirs = array(); $this->site_files = array(); - $xml_content = getXmlCode($this->listing_url); $info_xml_element = getChild($xml_content, 'informations'); if (getAttribute($info_xml_element , 'phpwg_version') != PHPWG_VERSION) { diff --git a/admin/template/goto/install.tpl b/admin/template/goto/install.tpl index a0e8eff6f..bea5cddb4 100644 --- a/admin/template/goto/install.tpl +++ b/admin/template/goto/install.tpl @@ -145,6 +145,12 @@ TD { +{else} +

+
+ + +

{/if} {* content *}
{$L_INSTALL_HELP}
diff --git a/include/functions_xml.inc.php b/include/functions_xml.inc.php index 1a849d434..81ae48dde 100644 --- a/include/functions_xml.inc.php +++ b/include/functions_xml.inc.php @@ -121,18 +121,11 @@ function getXmlCode( $filename ) ini_set("pcre.backtrack_limit", pow(2, 32)); } - $file = fopen( $filename, 'r' ); - if ( !$file ) + if (!fetchRemote($filename, $xml_content)) { return false; } - $xml_content = ''; - while ( !feof( $file ) ) - { - $xml_content .= fgets( $file, 1024 ); - } - fclose( $file ); $xml_content = str_replace( "\n", '', $xml_content ); $xml_content = str_replace( "\t", '', $xml_content ); diff --git a/language/de_DE/install.lang.php b/language/de_DE/install.lang.php index d2c897a08..5eab1aa5e 100644 --- a/language/de_DE/install.lang.php +++ b/language/de_DE/install.lang.php @@ -57,7 +57,7 @@ $lang['step2_pwd_conf_info'] = 'Prüfung'; $lang['step1_err_copy'] = 'Kopieren Sie den Text in rosaen zwischen Bindestriche und fügen Sie ihn in die Datei "include / mysql.inc.php" (Warnung: mysql.inc.php müssen nur enthalten, was in rosa, keine Zeile zurück oder Leerzeichen)'; $lang['install_help'] = 'Brauchen Sie Hilfe? Stellen Sie Ihre Frage auf der Forum Piwigo .'; $lang['install_end_message'] = 'Die Konfiguration der Piwigo abgeschlossen ist, hier ist der nächste Schritt

-* Gehen Sie auf die Identifizierung Seite: [
Identifizierung ] und verwenden Sie die Login / Passwort für Webmaster
+* Gehen Sie auf die Identifizierung Seite und verwenden Sie die Login / Passwort für Webmaster
* diesem Login ermöglicht Ihnen den Zugang zu den Verwaltungs-Panel und den Anweisungen, um Platz Bilder in Ihre Verzeichnisse.'; $lang['conf_mail_webmaster'] = 'Webmaster Mail-Adresse'; $lang['conf_mail_webmaster_info'] = 'Besucher können sich nicht Kontakt Site Administrator mit diesem E-Mail'; diff --git a/language/en_UK/install.lang.php b/language/en_UK/install.lang.php index c34bb2e30..aa2d24652 100644 --- a/language/en_UK/install.lang.php +++ b/language/en_UK/install.lang.php @@ -59,7 +59,7 @@ $lang['step2_pwd_conf'] = 'Password [confirm]'; $lang['step2_pwd_conf_info'] = 'verification'; $lang['install_help'] = 'Need help ? Ask your question on Piwigo message board.'; $lang['install_end_message'] = 'The configuration of Piwigo is finished, here is the next step

-* go to the identification page : [ identification ] and use the login/password given for webmaster
+* go to the identification page and use the login/password given for webmaster
* this login will enable you to access to the administration panel and to the instructions in order to place pictures in your directories'; $lang['conf_mail_webmaster'] = 'Webmaster mail address'; $lang['conf_mail_webmaster_info'] = 'Visitors will be able to contact site administrator with this mail'; diff --git a/language/es_ES/install.lang.php b/language/es_ES/install.lang.php index 960dddc4c..f142ab457 100644 --- a/language/es_ES/install.lang.php +++ b/language/es_ES/install.lang.php @@ -57,7 +57,7 @@ $lang['step2_pwd_conf_info'] = 'Comprobación'; $lang['step1_err_copy'] = 'Copie el texto en rosa entre las rayas y pegúelo en el fichero mysql.inc.php que se encuentra en el repertorio " include " a la base del lugar donde usted instaló a Piwigo (el fichero mysql.inc.php debe contener SÓLO lo que está en rosa entre las rayas, ninguna vuelta a la línea o espacio es autorizado)'; $lang['install_help'] = '¿ Necesidad de ayudante? Plantee su cuestión sobre él foro de Piwigo.'; $lang['install_end_message'] = 'La configuración de la aplicación correctamente se celebró, coloca en la etapa próxima

-* Vaya sobre la página de identificación : [ identificación ] Y conéctese con pseudo dado para el webmaster
+* Vaya sobre la página de identificación y conéctese con pseudo dado para el webmaster
* Éste le permite acceder a la parte administración y a las instrucciones para colocar las imágenes en los repertorios.'; $lang['conf_mail_webmaster'] = 'Dirige e-mail del Administrador'; $lang['conf_mail_webmaster_info'] = 'Los visitadores podrán ponerse en contacto con usted por este mail'; diff --git a/language/fr_FR/install.lang.php b/language/fr_FR/install.lang.php index d9b69f3f6..cc628ab2e 100644 --- a/language/fr_FR/install.lang.php +++ b/language/fr_FR/install.lang.php @@ -57,7 +57,7 @@ $lang['step2_pwd_conf_info'] = 'Vérification'; $lang['step1_err_copy'] = 'Copiez le texte en rose entre les tirets et collez-le dans le fichier mysql.inc.php qui se trouve dans le répertoire "include" à la base de l\'endroit où vous avez installé Piwigo (le fichier mysql.inc.php ne doit comporter QUE ce qui est en rose entre les tirets, aucun retour à la ligne ou espace n\'est autorisé)'; $lang['install_help'] = 'Besoin d\'aide ? Posez votre question sur le forum de Piwigo.'; $lang['install_end_message'] = 'La configuration de l\'application s\'est correctement déroulée, place à la prochaine étape

-* allez sur la page d\'identification : [ identification ] et connectez-vous avec le pseudo donné pour le webmaster
+* allez sur la page d\'identification et connectez-vous avec le pseudo donné pour le webmaster
* celui-ci vous permet d\'accéder à la partie administration et aux instructions pour placer les images dans les répertoires.'; $lang['conf_mail_webmaster'] = 'Adresse e-mail de l\'Administrateur'; $lang['conf_mail_webmaster_info'] = 'Les visiteurs pourront vous contacter par ce mail'; diff --git a/language/it_IT/install.lang.php b/language/it_IT/install.lang.php index ba811445b..e0f7935b4 100644 --- a/language/it_IT/install.lang.php +++ b/language/it_IT/install.lang.php @@ -57,7 +57,7 @@ $lang['step2_pwd_conf_info'] = 'verifica'; $lang['step1_err_copy'] = 'Copiate il testo in rosa trà i trattini e mettetelo nel file mysql.inc.php che si trova nella directory "include" alla base del vostro sito dove aveto installato Piwigo (il file mysql.inc.php non deve contenere altro che ciò che è in rosa tra i trattini, nessun ritorno a capo o spazio è autorizzato)'; $lang['install_help'] = 'Bisogno di un aiuto? Visitate il forum di Piwigo.'; $lang['install_end_message'] = 'La configurazione di Piwigo è conclusa. Procedete al prossimo step

-* collegatevi alla pagina d\'accesso: [ Accedi ora ] e usate il vostro nome utente e password del Webmaster
+* collegatevi alla pagina d\'accesso e usate il vostro nome utente e password del Webmaster
* a questo punto sarete abilitati all\'accesso al pannello di amministrazione in cui troverete le istruzioni per l\'inserimento delle immagini nelle vostre directory'; $lang['conf_mail_webmaster'] = 'Indirizzo email del Amministratore'; $lang['conf_mail_webmaster_info'] = 'i visitatori potranno contattarvi utilizzando questo indirizzo email'; diff --git a/language/nl_NL/install.lang.php b/language/nl_NL/install.lang.php index 15fc4d24f..63f62abc6 100644 --- a/language/nl_NL/install.lang.php +++ b/language/nl_NL/install.lang.php @@ -59,7 +59,7 @@ $lang['step2_pwd_conf'] = 'Wachtwoord [bevestigen]'; $lang['step2_pwd_conf_info'] = 'verificatie'; $lang['install_help'] = 'Hulp nodig ? stel een vraag op het Piwigo forum.'; $lang['install_end_message'] = 'Het installeren van Piwigo is klaar, de volgende stap is

-* Ga naar de Indentificatie pagina: [ Indentificatie ] gebruik hiervoor het eerder opgegeven gebruikersnaam met wachtwoord
+* Ga naar de Indentificatie pagina en gebruik hiervoor het eerder opgegeven gebruikersnaam met wachtwoord
* Deze gebruikersnaam geeft u toegang tot de beheermenu zodat u afbeeldingen op uw website kan plaatsen'; $lang['conf_mail_webmaster'] = 'Webmaster email adres'; $lang['conf_mail_webmaster_info'] = 'Het is mogelijk dat bezoekers contact opnemen met de beheerder middels e-mail'; diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index b8f3ec522..26450a21c 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -25,6 +25,8 @@ {/if} +{if !empty($PLUGIN_PICTURE_BEFORE)}{$PLUGIN_PICTURE_BEFORE}{/if} +
{'home'|@translate} @@ -37,7 +39,6 @@ {/if}
-{if !empty($PLUGIN_PICTURE_BEFORE)}{$PLUGIN_PICTURE_BEFORE}{/if}
{if isset($U_SLIDESHOW_START) } @@ -278,6 +279,4 @@ y.callService(
{/if} {*comments*} - - {if !empty($PLUGIN_PICTURE_AFTER)}{$PLUGIN_PICTURE_AFTER}{/if} -- cgit v1.2.3