4images Forum & Community
4images Help / Hilfe => News & Announcements => Topic started by: kai on August 09, 2010, 05:29:52 PM
-
:flag-de: Die neue Version 4images 1.7.8 wurde veröffentlicht. Das Release bringt neue Funktionen sowie Detailverbesserungen, behebt einge Fehler und bietet weiter verbesserte PHP 5.3 Kompatibilität.
Wir empfehlen allen Nutzern ein Update auf die aktuelle Version. Alle Änderungen und Features sind in der Datei "docs/Changelog.txt" aufgelistet.
:flag-en: The new version 4images 1.7.8 has been released. This release comes with lots of improvements and new features, bugfixes and minor changes.
We recommend all users to update to the current version. All changes and features are listed in "docs/Changelog.txt".
Download:
http://www.4homepages.de/4images/download.php
Demo:
http://www.4homepages.de/4images/demo.php
Für Feedback zur 4images 1.7.8 Version bitte diesen Thread (http://www.4homepages.de/forum/index.php?topic=27688.0) nutzen.
Please use this thread (http://www.4homepages.de/forum/index.php?topic=27688.0) for feedback about the 4images 1.7.8 version.
-
=========================================================
ChangeLog Version 1.7.8
=========================================================
- PHP 5.3 compatibility fixes
- Improved security level of captcha handling
- Removed error reporting overriding in search.php
- Fixed typo in example of DB fields definitions
- Fixed German translation typos and misspellings across language files
- Fixed EXIF exposure time issue
- Fixed use of double quoted string in configuration file (http://www.4homepages.de/forum/index.php?topic=25792.0)
- Fixed an issue when max height has no affect on image resize (http://www.4homepages.de/forum/index.php?topic=7058.0)
- Fixed showing username containing curly braces in who is online box
- Fixed editing of templates into subdirectories from ACP (http://www.4homepages.de/forum/index.php?topic=25403.0)
- Fixed an issue when .zip files can be corrupt on download (http://www.4homepages.de/forum/index.php?topic=25893.0)
- Fixed an issue when some templating feature can not work properly if server auto prepends content prior output
- Fixed an issue when due missing MIME type thumbnail upload may fail (http://www.4homepages.de/forum/index.php?topic=27012.0)
- Fixed an issue when trying to edit media/* templates (http://www.4homepages.de/forum/index.php?topic=27669.0)
- Implemented population of alt and title attributes for thumbnail images with image name
- Extended number of possible template variables for media/* templates (http://www.4homepages.de/forum/index.php?topic=26279.0)
- Implemented comma separated keywords and plugin for migration from white-space separated keywords
- Enhanced "Check new images" feature in ACP with V@no's mod (http://www.4homepages.de/forum/index.php?topic=4754.0)
- Added plugin "Check files" (http://www.4homepages.de/forum/index.php?topic=6760.0)
- Fixed a visual glitch when adding multiple users from ACP
- Enhanced posting comments. After a comment posted page refresh will not attempt re-post that comment again.
Neue Dateien / New Files:
---------------------------------------
- admin/plugins/files_check.php
- admin/plugins/migrate_keywords.php
Geänderte Dateien / Changed Files:
---------------------------------------
config.new.php
categories.php
details.php
download.php
global.php
index.php
install.php
member.php
login.php
logout.php
postcards.php
register.php
rss.php
search.php
top.php
admin/admin_functions.php
admin/admin_global.php
admin/backup.php
admin/checkimages.php
admin/home.php
admin/images.php
admin/index.php
admin/resizer.php
admin/templates.php
admin/thumbnailer.php
admin/users.php
admin/validateimages.php
admin/plugins/clear_cache.php
includes/captcha_utils.php
includes/db_field_definitions.php
includes/db_utils.php
includes/email.php
includes/functions.php
includes/image_utils.php
includes/page_footer.php
includes/page_header.php
includes/paging.php
includes/upload.php
includes/search_utils.php
includes/sessions.php
lang/deutsch/admin.php
lang/deutsch/install.php
lang/deutsch/main.php
lang/english/admin.php
lang/english/install.php
lang/english/main.php
lang/spanish/install.php
lang/spanish/main.php
Sprache / Language:
---------------------------------------
- admin.php
- added new section for "check new images"
- install.php
- added new variable for timezone selector $lang['timezone_select']
=========================================================
The changelog for all versions can be found here:
http://www.4homepages.de/forum/index.php?topic=15186.0
-
Here is a detailed list of what has been changed in the php files from 4images 1.7.7 -> 1.7.8.
(The best way for yourself to compare the code of files is to use Winmerge (http://winmerge.org/).)
Language files:
lang/deutsch/main.php
find:
$lang['send_postcard_success'] = "Viele Dank! Ihre eCard wurde erfolgreich versendet.";
replace with:
$lang['send_postcard_success'] = "Vielen Dank! Ihre eCard wurde erfolgreich versendet.";
find:
$lang['invalid_activationkey'] = "Diese Account ist nicht mehr aktiv. Bitte registrieren Sie sich erneut.</>";
replace with:
$lang['invalid_activationkey'] = "Dieser Account ist nicht mehr aktiv. Bitte registrieren Sie sich erneut.";
find:
$lang['edit_profile_msg'] = "Hier können Sie Ihr persönliches Profil und Ihre Passwort ändern.";
replace with:
$lang['edit_profile_msg'] = "Hier können Sie Ihr persönliches Profil und Ihr Passwort ändern.";
find:
$lang['agreement_terms'] = "
Dieses Archiv nutzt ein Kommentarsystem mit dem die Besucher Kommentare
zu den Einträgen abgeben können. Obwohl die Administratoren
dieser Seite versuchen, alle unerwünschten Beiträge von
diesem System fernzuhalten, ist es für uns unmöglich, alle
Beiträge zu überprüfen. Alle Beiträge drücken
die Ansichten des Autors aus und die Eigentümer dieser Website
können nicht für den Inhalt jedes Beitrags verantwortlich
gemacht werden.
<br /><br />
Sie verpflichten Sich, keine beleidigenden, obszönen, vulgären,
verleumdenden, gewaltverherrlichenden oder aus anderen Gründen
strafbaren Inhalte zu veröffentlichen. Sie räumen den Betreibern
und Administratoren dieser Website das Recht ein, Beiträge nach
eigenem Ermessen zu entfernen oder zu bearbeiten. Sie stimmen ausserdem
zu, dass die im Rahmen der Registrierung erhobenen Daten in einer
Datenbank gespeichert werden.
<br /><br />
Dieses System verwendet Cookies, um Informationen auf Ihrem Computer
zu speichern. Diese Cookies enthalten keine persönlichen Informationen,
sondern dienen ausschließlich Ihrem Komfort.
<br /><br />
Durch das Abschließen der Registrierung stimmen Sie diesen Nutzungsbedingungen zu.";
replace with:
$lang['agreement_terms'] = "
Dieses Archiv nutzt ein Kommentarsystem mit dem die Besucher Kommentare
zu den Einträgen abgeben können. Obwohl die Administratoren
dieser Seite versuchen, alle unerwünschten Beiträge von
diesem System fernzuhalten, ist es für uns unmöglich, alle
Beiträge zu überprüfen. Alle Beiträge drücken
die Ansichten des Autors aus und die Eigentümer dieser Website
können nicht für den Inhalt jedes Beitrags verantwortlich
gemacht werden.
<br /><br />
Sie verpflichten sich, keine beleidigenden, obszönen, vulgären,
verleumdenden, gewaltverherrlichenden oder aus anderen Gründen
strafbaren Inhalte zu veröffentlichen. Sie räumen den Betreibern
und Administratoren dieser Website das Recht ein, Beiträge nach
eigenem Ermessen zu entfernen oder zu bearbeiten. Sie stimmen ausserdem
zu, dass die im Rahmen der Registrierung erhobenen Daten in einer
Datenbank gespeichert werden.
<br /><br />
Dieses System verwendet Cookies, um Informationen auf Ihrem Computer
zu speichern. Diese Cookies enthalten keine persönlichen Informationen,
sondern dienen ausschließlich Ihrem Komfort.
<br /><br />
Durch das Abschließen der Registrierung stimmen Sie diesen Nutzungsbedingungen zu.";
find:
$lang['comment_edit_error'] = "Fehler beim Bearbeiten der Kommentar";
replace with:
$lang['comment_edit_error'] = "Fehler beim Bearbeiten des Kommentars";
find:
$lang['comment_delete_error'] = "Fehler beim Löschen der Kommentar";
replace with:
$lang['comment_delete_error'] = "Fehler beim Löschen des Kommentars";
find:
$lang['keywords_ext'] = "Schlüsselwörter:<br /><span class=\"smalltext\">Schlüsselwörter durch Leerzeichen getrennt eingeben.</span>";
replace with:
$lang['keywords_ext'] = "Schlüsselwörter:<br /><span class=\"smalltext\">Schlüsselwörter durch Komma getrennt eingeben.</span>";
find:
$lang['lightbox_delete_success'] = "Leuchkasten erfolgreich gelöscht.";
replace with:
$lang['lightbox_delete_success'] = "Leuchtkasten erfolgreich gelöscht.";
find:
$lang['delete_lightbox_confirm'] = "Wollen Sie Ihren Leuchkasten wirklich loeschen?";
replace with:
$lang['delete_lightbox_confirm'] = "Wollen Sie Ihren Leuchtkasten wirklich loeschen?";
lang/deutsch/install.php
find:
?>
insert before:
$lang['timezone_select'] = "Bitte wählen Sie Ihre Zeitzone";
lang/deutsch/admin.php
find:
$lang['resizing_image_error'] = "Fehler beim Konvertieren der Bild-Datei!";
insert after:
//-----------------------------------------------------
//--- Check New Images --------------------------------
//-----------------------------------------------------
$lang['add_as_user'] = "Hinzufügen als Benutzer:";
$lang['cni_max_dim'] = "Maximale Größe der Vorschaubilder:<br /><span class=\"smalltext\">Bei \"Ausführlicher Anzeige\", wird das Bild auf Ihrem Bildschirm auf diesen Wert verkleinert.</span>";
$lang['cni_iptc_name'] = "Verwende Dateiname aus IPTC Daten:";
$lang['cni_iptc_description'] = "Verwenden Beschreibung aus IPTC Daten:";
$lang['cni_iptc_keywords'] = "Verwenden Schlüsselwörter aus IPTC Daten:";
$lang['cni_iptc_date'] = "Verwende Datum aus IPTC Daten:";
$lang['cni_check_subcat'] = "Unterkategorien durchsuchen:";
$lang['cni_auto_resizer'] = "Automatisch verkleinern:";
$lang['cni_save_orig'] = "Originalbild speichern:";
$lang['cni_big_folder'] = "Ordnername in welchen das Originalbild gespeicher werden soll:";
$lang['cni_add_ann'] = "Wasserzeichen hinzufügen:";
$lang['cni_auto_thumbnailer'] = "Thumbnails automatisch erstellen:";
$lang['cni_foundin'] = "Gefunden in";
$lang['cni_root_folder'] = "Stammverzeichniss";
$lang['on'] = "Ein";
$lang['off'] = "Aus";
$lang['cni_file_rename_success'] = "Datei wurde umbenannt von <b>{from}</b> zu <b>{to}</b>";
$lang['cni_file_rename_error'] = "<u>Fehler</u> bei Umbenennen der Datei von <b>{from}</b> zu <b>{to}</b>";
$lang['cni_media_file_rename'] = "Media Dateiname wurde umbenannt von <b>{from}</b> zu <b>{to}</b>";
$lang['cni_media_file_rename_error'] = "<u>Fehler</u> bei Umbenennen der Media Datei von <b>{from}</b> zu <b>{to}</b>";
$lang['cni_thumb_file_rename'] = "Thumbnail Dateiname wurde umbenannt von <b>{from}</b> zu <b>{to}</b>";
$lang['cni_thumb_file_rename_error'] = "<u>Fehler</u> bei Umbenennen der Thumbnail Datei von <b>{from}</b> zu <b>{to}</b>";
$lang['cni_copy_success'] = "Kopiere Original Datei in <b>{name}</b> Ordner.";
$lang['cni_copy_thumb_success'] = "Kopiere Thumbnail in <b>{name}</b> Ordner.";
$lang['cni_backup_success'] = "Kopiere Original Datei in <b>{name}</b> Ordner.";
$lang['cni_backup_error'] = "<u>Fehler</u> bei kopieren der Original Datei in <b>{name}</b> Ordner.";
$lang['cni_annotation_success'] = "Wasserzeichen hinzufügen in <b>{name}</b> Datei.";
$lang['cni_annotation_error'] = "<u>Fehler</u> bei hinzufügen des Wasserzeichens in <b>{name}</b> Datei.";
$lang['cni_create_folder_success'] = "Erstelle <b>{name}/</b> Ordner.";
$lang['cni_create_folder_error'] = "<u>Fehler</u> bei erstellen des <b>{name}/</b> Ordner.";
$lang['cni_resized_success'] = "Bildgröße erfolgreich geändert.";
$lang['cni_resized_error'] = "<u>Fehler</u> bei Änderung der Bildgröße";
$lang['cni_thumbnail_success'] = "Thumbnail erfolgreich erstellt.";
$lang['cni_thumbnail_error'] = "<u>Fehler</u> Thumbnail konnten nicht erstellt werden!";
$lang['cni_error'] = "<u>Fehler</u>";
$lang['cni_working'] = "Datei <b>{file}</b> wurde Bearbeitet";
lang/spanish/main.php
find:
$lang['post_comment'] = "Agregar comentario";
insert after:
$lang['comment_success'] = "Tu comentario se ha guardado";
lang/spanish/install.php
find:
?>
insert before:
$lang['timezone_select'] = "Por favor seleccione su zona horaria";
lang/english/main.php
find:
$lang['keywords_ext'] = "Keywords:<br /><span class=\"smalltext\">Keywords must be seperated by spaces.</span>";
replace with:
$lang['keywords_ext'] = "Keywords:<br /><span class=\"smalltext\">Keywords must be separated by commas or newlines.</span>";
lang/english/install.php
find:
?>
insert before:
$lang['timezone_select'] = "Please select your timezone";
lang/english/admin.php
find:
$lang['field_keywords_ext'] = "Keywords<br /><span class=\"smalltext\">Keywords must be seperated by spaces.</span>";
replace with:
$lang['field_keywords_ext'] = "Keywords<br /><span class=\"smalltext\">Keywords must be separated by commas or newlines.</span>";
find:
$lang['resizing_image_error'] = "Error converting image file!";
insert after:
//-----------------------------------------------------
//--- Check New Images --------------------------------
//-----------------------------------------------------
$lang['add_as_user'] = 'Add as user';
$lang['cni_max_dim'] = "Max dimensions for images preview<br /><span class=\"smalltext\">When checked \"Detailed\", image will be resized on your screen acording this value.</span>";
$lang['cni_iptc_name'] = "Use name from IPTC value";
$lang['cni_iptc_description'] = "Use description from IPTC value";
$lang['cni_iptc_keywords'] = "Use keywords from IPTC value";
$lang['cni_iptc_date'] = "Use date from IPTC value";
$lang['cni_check_subcat'] = "Check subcategories";
$lang['cni_auto_resizer'] = "Auto resizer";
$lang['cni_save_orig'] = "Save original size images";
$lang['cni_big_folder'] = "Folder name where to save original size images (big)";
$lang['cni_add_ann'] = "Add annotation (watermark)";
$lang['cni_auto_thumbnailer'] = "Auto thumbnailer";
$lang['cni_foundin'] = "Found in";
$lang['cni_root_folder'] = "root folder";
$lang['on'] = "On";
$lang['off'] = "Off";
$lang['cni_file_rename_success'] = "File renamed from <b>{from}</b> to <b>{to}</b>";
$lang['cni_file_rename_error'] = "<u>Error</u> renaming media file from <b>{from}</b> to <b>{to}</b>";
$lang['cni_thumbnail_rename_success'] = "Thumbnail file renamed from <b>{from}</b> to <b>{to}</b>";
$lang['cni_thumbnail_rename_error'] = "<u>Error</u> renaming thumbnail file from <b>{from}</b> to <b>{to}</b>";
$lang['cni_copy_success'] = "Copied file into <b>{name}</b> folder.";
$lang['cni_copy_error'] = "<u>Error</u> copying file into <b>{name}</b> folder.";
$lang['cni_copy_thumb_success'] = "Copied thumbnail into <b>{name}</b> folder.";
$lang['cni_copy_thumb_error'] = "<u>Error</u> copying thumbnail into <b>{name}</b> folder.";
$lang['cni_backup_success'] = "Backup original file into <b>{name}</b> folder.";
$lang['cni_backup_error'] = "<u>Error</u> copying original file into <b>{name}</b> folder.";
$lang['cni_annotation_success'] = "Added annotation in <b>{name}</b> file.";
$lang['cni_annotation_error'] = "<u>Error</u> adding annotation in <b>{name}</b> file.";
$lang['cni_create_folder_success'] = "Created <b>{name}/</b> folder.";
$lang['cni_create_folder_error'] = "<u>Error</u> creating <b>{name}/</b> folder.";
$lang['cni_resized_success'] = "Image resized.";
$lang['cni_resized_error'] = "<u>Error</u> resizing image.";
$lang['cni_thumbnail_success'] = "Thumbnail created.";
$lang['cni_thumbnail_error'] = "<u>Error</u> creating thumbnail.";
$lang['cni_error'] = "<u>Error</u> adding image.";
$lang['cni_working'] = "Working on <b>{file}</b> file";
$lang['file_not_found'] = "File not found";
-
Here is a detailed list of what has been changed in the php files from 4images 1.7.7 -> 1.7.8.
(The best way for yourself to compare the code of files is to use Winmerge (http://winmerge.org/).)
Admin files
admin/plugins/clear_cache.php
find:
$root_path = (!eregi("\/plugins\/", $_SERVER['PHP_SELF'])) ? "./../" : "./../../";
replace with:
$root_path = (false === stristr($_SERVER['PHP_SELF'], "/plugins/")) ? "./../" : "./../../";
admin/templates.php
find:
$template_file_name = basename($template_file_name);
replace with:
$template_file_name = (strpos($template_file_name, 'media/') !== false ? 'media/' : '') . basename($template_file_name);
admin/users.php
find:
for ($i = 1; $i <= $num_newusers; $i++) {
insert after:
$log = array();
admin/checkimages.php
Completely rewritten, better replace whole file.
admin/backup.php
find:
if (eregi("\.gz", $file)) {
replace with:
if (preg_match("/\.gz$/i", $file)) {
find:
if (eregi("\.gz", $file)) {
replace with:
if (preg_match("/\.gz$/i", $file)) {
find:
if (is_file(ROOT_PATH.DATABASE_DIR."/".$file) && $file != "." && $file != ".." && eregi("\.sql",$file)) {
replace with:
if (is_file(ROOT_PATH.DATABASE_DIR."/".$file) && $file != "." && $file != ".." && preg_match("/\.sql$/i",$file)) {
admin/images.php
find:
$image_keywords = preg_replace("/[\n\r]/is", " ", $image_keywords);
$image_keywords = str_replace(","," ",$image_keywords);
$image_keywords = ereg_replace("( ){2,}", " ", $image_keywords);
replace with:
$image_keywords = preg_replace("/[\n\r]/is", ",", $image_keywords);
$image_keywords_arr = explode(',', $image_keywords);
array_walk($image_keywords_arr, 'trim_value');
$image_keywords = implode(',', array_unique(array_filter($image_keywords_arr)));
find:
$image_keywords = preg_replace("/[\n\r]/is", " ", $image_keywords);
$image_keywords = str_replace(","," ",$image_keywords);
$image_keywords = ereg_replace("( ){2,}", " ", $image_keywords);
replace with:
$image_keywords = preg_replace("/[\n\r]/is", ",", $image_keywords);
$image_keywords_arr = explode(',', $image_keywords);
array_walk($image_keywords_arr, 'trim_value');
$image_keywords = implode(',', array_unique(array_filter($image_keywords_arr)));
admin/index.php
find:
if (eregi("^\.{1,2}$", $file) || !eregi("\.php$", $file)) {
replace with:
if (get_file_extension($file) != "php") {
find:
if (preg_match("/PLUGIN_TITLE:([a-zäöüß0-9\-_ ]+)/i", $plugin_file[0], $regs)) {
replace with:
if (preg_match("/PLUGIN_TITLE:(.+)/", $plugin_file[0], $regs)) {
admin/admin_global.php
find:
if (isset($PHP_SELF) && eregi("\/plugins\/", $PHP_SELF)) {
replace with:
if (isset($PHP_SELF) && preg_match("/\/plugins\//i", $PHP_SELF)) {
admin/thumbnailer.php
find:
echo "<td colspan=\"2\"><p><input type=\"text\" size=\"$textinput_size\" name=\"dimension\" value=\"100\"></p></td>\n</tr>\n";
replace with:
echo "<td colspan=\"2\"><p><input type=\"text\" size=\"" . $textinput_size . "\" name=\"dimension\" value=\"" . $config['auto_thumbnail_dimension'] . "\"></p></td>\n</tr>\n";
find:
echo "<td colspan=\"2\"><p><input type=\"text\" size=\"$textinput_size\" name=\"quality\" value=\"75\"></p></td>\n</tr>\n";
replace with:
echo "<td colspan=\"2\"><p><input type=\"text\" size=\"" . $textinput_size . "\" name=\"quality\" value=\"" . $config['auto_thumbnail_quality'] . "\"></p></td>\n</tr>\n";
admin/validateimages.php
find:
$image_keywords = preg_replace("/[\n\r]/is", " ", $image_keywords);
$image_keywords = str_replace(","," ",$image_keywords);
$image_keywords = ereg_replace("( ){2,}", " ", $image_keywords);
replace with:
$image_keywords = preg_replace("/[\n\r]/is", ",", $image_keywords);
$image_keywords_arr = explode(',', $image_keywords);
array_walk($image_keywords_arr, 'trim_value');
$image_keywords = implode(',', array_unique(array_filter($image_keywords_arr)));
admin/admin_functions.php
find:
if (is_array($iptc)) {
insert after:
$separator = "";
find:
$value = $iptc['2#120'][0];
replace with:
$value = trim($iptc['2#120'][0]);
find:
$value .= (($value != "" ) ? " " : "").$val;
replace with:
$value .= (($value != "" ) ? "," : "").trim($val);
find:
break;
case "object_name":
insert before:
$separator = ",";
find:
$value = $iptc['2#005'][0];
replace with:
$value = trim($iptc['2#005'][0]);
find:
$html = "\n<input type=\"hidden\" name=\"hidden_".$input."\" value=\"".trim($value)." \">\n";
replace with:
$html = "\n<input type=\"hidden\" name=\"hidden_".$input."\" value=\"".$value." \">\n";
find:
$html .= "this.document.writeln('<br /><br /><input type=\"button\" value=\"IPTC ".str_replace(":", "", $lang['iptc_'.$iptc_tag])." »\" onClick=\"this.form.".$input.".value=".(($add_text) ? "this.form.".$input.".value + " : "")."this.form.hidden_".$input.".value\">');";
replace with:
$html .= "this.document.writeln('<br /><br /><input type=\"button\" value=\"IPTC ".str_replace(":", "", $lang['iptc_'.$iptc_tag])." »\" onClick=\"this.form.".$input.".value=".(($add_text) ? "this.form.".$input.".value + ".($separator ? "(this.form.".$input.".value.replace(/^\s+/, \'\').replace(/\s+$/, \'\') == \'\' ? \'\' : \'".$separator."\')+" : "") : "")."this.form.hidden_".$input.".value\">');";
find:
function copy_media($image_media_file, $from_cat = 0, $to_cat = 0) {
global $config;
if (is_remote($image_media_file)) {
return $image_media_file;
}
$ok = 0;
$image_src = ($from_cat != -1) ? MEDIA_PATH.(($from_cat != 0) ? "/".$from_cat : "") : MEDIA_TEMP_PATH;
$image_dest = ($to_cat != -1) ? MEDIA_PATH.(($to_cat != 0) ? "/".$to_cat : "") : MEDIA_TEMP_PATH;
$image_src_file = $image_src."/".$image_media_file;
switch ($config['upload_mode']) {
case 1: // overwrite mode
if (file_exists($image_src."/".$image_media_file)) {
if (file_exists($image_dest."/".$image_media_file)) {
unlink($image_dest."/".$image_media_file);
}
$ok = copy($image_src."/".$image_media_file, $image_dest."/".$image_media_file);
}
break;
case 2: // create new with incremental extention
if (file_exists($image_src."/".$image_media_file)) {
$file_extension = get_file_extension($image_media_file);
$file_name = get_file_name($image_media_file);
$n = 2;
$copy = "";
while (file_exists($image_dest."/".$file_name.$copy.".".$file_extension)) {
$copy = "_".$n;
$n++;
}
$new_file = $file_name.$copy.".".$file_extension;
$ok = copy($image_src."/".$image_media_file, $image_dest."/".$new_file);
$image_media_file = $new_file;
}
break;
case 3: // do nothing if exists, highest protection
default:
if (file_exists($image_src."/".$image_media_file)) {
if (file_exists($image_dest."/".$image_media_file)) {
$ok = 0;
}
else {
$ok = copy($image_src."/".$image_media_file, $image_dest."/".$image_media_file);
}
}
break;
}
if ($ok) {
@unlink($image_src_file);
@chmod($image_dest."/".$image_media_file, CHMOD_FILES);
return $image_media_file;
}
else {
return false;
}
}
function copy_thumbnail($image_media_file, $image_thumb_file, $from_cat = 0, $to_cat = 0) {
if (is_remote($image_thumb_file)) {
return $image_thumb_file;
}
$thumb_src = ($from_cat != -1) ? THUMB_PATH.(($from_cat != 0) ? "/".$from_cat : "") : THUMB_TEMP_PATH;
$thumb_dest = ($to_cat != -1) ? THUMB_PATH.(($to_cat != 0) ? "/".$to_cat : "") : THUMB_TEMP_PATH;
$thumb_src_file = $thumb_src."/".$image_thumb_file;
if ($image_thumb_file != "" && file_exists($thumb_src."/".$image_thumb_file)) {
$thumb_extension = get_file_extension($image_thumb_file);
$new_thumb = get_file_name($image_media_file).".".$thumb_extension;
if (file_exists($thumb_dest."/".$new_thumb)) {
unlink($thumb_dest."/".$new_thumb);
}
$ok = copy($thumb_src."/".$image_thumb_file, $thumb_dest."/".$new_thumb);
if ($ok) {
@unlink($thumb_src_file);
@chmod($thumb_dest."/".$new_thumb, CHMOD_FILES);
$image_thumb_file = $new_thumb;
}
}
return $image_thumb_file;
}
replace with:
function copy_media($image_media_file, $from_cat = 0, $to_cat = 0) {
global $config;
if (is_remote($image_media_file)) {
return $image_media_file;
}
$image_src = ($from_cat != -1) ? MEDIA_PATH.(($from_cat != 0) ? "/".$from_cat : "") : MEDIA_TEMP_PATH;
$image_dest = ($to_cat != -1) ? MEDIA_PATH.(($to_cat != 0) ? "/".$to_cat : "") : MEDIA_TEMP_PATH;
return copy_file($image_src, $image_dest, $image_media_file, $image_media_file, $config['upload_mode']);
}
function copy_thumbnail($image_media_file, $image_thumb_file, $from_cat = 0, $to_cat = 0) {
if (is_remote($image_thumb_file)) {
return $image_thumb_file;
}
$thumb_src = ($from_cat != -1) ? THUMB_PATH.(($from_cat != 0) ? "/".$from_cat : "") : THUMB_TEMP_PATH;
$thumb_dest = ($to_cat != -1) ? THUMB_PATH.(($to_cat != 0) ? "/".$to_cat : "") : THUMB_TEMP_PATH;
if ($image_thumb_file != "" && file_exists($thumb_src."/".$image_thumb_file)) {
$thumb_extension = get_file_extension($image_thumb_file);
$new_thumb = get_file_name($image_media_file).".".$thumb_extension;
if ($new_thumb = copy_file($thumb_src, $thumb_dest, $image_thumb_file, $new_thumb, 1))
{
$image_thumb_file = $new_thumb;
}
}
return $image_thumb_file;
}
function copy_file($image_src, $image_dest, $image_media_file, $dest_file_name, $type, $filter = 1, $move = 1)
{
$image_src_file = $image_src."/".$image_media_file;
$dest_file_name = ($filter) ? filterFileName($dest_file_name) : $dest_file_name;
$ok = 0;
if (!file_exists($image_dest) || !is_dir($image_dest))
{
$oldumask = umask(0);
$result = _mkdir($image_dest);
@chmod($image_dest, CHMOD_DIRS);
umask($oldumask);
}
switch ($type) {
case 1: // overwrite mode
if (file_exists($image_src."/".$image_media_file)) {
if (file_exists($image_dest."/".$dest_file_name)) {
unlink($image_dest."/".$dest_file_name);
}
$ok = copy($image_src."/".$image_media_file, $image_dest."/".$dest_file_name);
}
break;
case 2: // create new with incremental extention
if (file_exists($image_src."/".$image_media_file)) {
$file_extension = get_file_extension($dest_file_name);
$file_name = get_file_name($dest_file_name);
$n = 2;
$copy = "";
while (file_exists($image_dest."/".$file_name.$copy.".".$file_extension)) {
$copy = "_".$n;
$n++;
}
$new_file = $file_name.$copy.".".$file_extension;
$ok = copy($image_src."/".$image_media_file, $image_dest."/".$new_file);
$dest_file_name = $new_file;
}
break;
case 3: // do nothing if exists, highest protection
default:
if (file_exists($image_src."/".$image_media_file)) {
if (file_exists($image_dest."/".$dest_file_name)) {
$ok = 0;
}
else {
$ok = copy($image_src."/".$image_media_file, $image_dest."/".$dest_file_name);
}
}
break;
}
if ($ok) {
if ($move)
{
@unlink($image_src_file);
}
@chmod($image_dest."/".$dest_file_name, CHMOD_FILES);
return $dest_file_name;
}
else {
return false;
}
}
find:
if ($newlangfile && !ereg("settings.php", $self_url)) {
replace with:
if ($newlangfile && strstr($self_url, "settings.php") === false) {
find:
if (ereg("de", $browser_language)) {
replace with:
if (strstr($browser_language, "de") !== false) {
find:
elseif (ereg("sb", $browser_language) || ereg("sr", $browser_language)) {
replace with:
elseif (preg_match("/s(b|r)/", $browser_language)) {
find:
if (eregi("gzip", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
replace with:
if (preg_match("/gzip/i", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
find:
elseif (eregi("x-gzip", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
replace with:
elseif (preg_match("/x-gzip/i", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
find:
$dir = (!eregi("/$", $dir)) ? $dir."/" : $dir;
replace with:
$dir = (!preg_match("#/$#", $dir)) ? $dir."/" : $dir;
find:
if (eregi("^\.{1,2}$",$file)) {
replace with:
if (preg_match("/^\.{1,2}$/",$file)) {
admin/resizer.php
find:
$nozip = 1;
insert before:
ini_set('memory_limit', '1024M');
find:
$dimension = (isset($HTTP_POST_VARS['dimension'])) ? intval($HTTP_POST_VARS['dimension']) : 200;
$resize_type = (isset($HTTP_POST_VARS['resize_type'])) ? intval($HTTP_POST_VARS['resize_type']) : 1;
replace with:
$dimension = (isset($HTTP_POST_VARS['dimension'])) ? intval($HTTP_POST_VARS['dimension']) : $config['max_image_width'];
$height = (isset($HTTP_POST_VARS['height'])) ? intval($HTTP_POST_VARS['height']) : $config['max_image_height'];
$resize_type = (isset($HTTP_POST_VARS['resize_type'])) ? intval($HTTP_POST_VARS['resize_type']) : $config['auto_thumbnail_resize_type'];
find:
$dimension = (isset($HTTP_POST_VARS['dimension'])) ? intval($HTTP_POST_VARS['dimension']) : 200;
$resize_type = (isset($HTTP_POST_VARS['resize_type'])) ? intval($HTTP_POST_VARS['resize_type']) : 1;
replace with:
$dimension = (isset($HTTP_POST_VARS['dimension'])) ? intval($HTTP_POST_VARS['dimension']) : $config['max_image_width'];
$height = (isset($HTTP_POST_VARS['height'])) ? intval($HTTP_POST_VARS['height']) : $config['max_image_height'];
$resize_type = (isset($HTTP_POST_VARS['resize_type'])) ? intval($HTTP_POST_VARS['resize_type']) : $config['auto_thumbnail_resize_type'];
find:
show_input_row($lang['resize_dimension_desc'], "dimension", $dimension);
replace with:
show_input_row($lang['max_imagewidth'], "dimension", $dimension);
show_input_row($lang['max_imageheight'], "height", $height);
find:
$dimension = (isset($HTTP_POST_VARS['dimension'])) ? intval($HTTP_POST_VARS['dimension']) : 200;
replace with:
$dimension = (isset($HTTP_POST_VARS['dimension'])) ? intval($HTTP_POST_VARS['dimension']) : $config['max_image_height'];
$height = (isset($HTTP_POST_VARS['height'])) ? intval($HTTP_POST_VARS['height']) : $config['max_image_height'];
find:
if ($resize_type == 1 && ($image_info[0] > $dimension || $image_info[1] > $dimension)) {
replace with:
if ($resize_type == 1 && ($image_info[0] > $dimension || $image_info[1] > $height)) {
find:
elseif ($resize_type == 3 && $image_info[1] > $dimension) {
replace with:
elseif ($resize_type == 3 && $image_info[1] > $height) {
find:
$width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
replace with:
$width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type, $height);
find:
show_hidden_input("image_type", $image_type);
insert after:
show_hidden_input("height", $height);
admin/home.php
find:
if (eregi("Control Panel", $row[$user_table_fields['user_location']])) {
replace with:
if (preg_match("/Control Panel/i", $row[$user_table_fields['user_location']])) {
find:
if (eregi("Control Panel", $row['session_location'])) {
replace with:
if (preg_match("/Control Panel/i", $row['session_location'])) {
-
Here is a detailed list of what has been changed in the php files from 4images 1.7.7 -> 1.7.8.
(The best way for yourself to compare the code of files is to use Winmerge (http://winmerge.org/).)
Includes
includes/page_footer.php
find:
if (eregi("gzip", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
replace with:
if (preg_match("/gzip/i", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
find:
elseif (eregi("x-gzip", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
replace with:
elseif (preg_match("/x-gzip/i", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
includes/image_utils.php
find:
"convert_path" => ereg_replace("\/$", "", $config['convert_tool_path'])
replace with:
"convert_path" => preg_replace("/\/$/", "", $config['convert_tool_path'])
find:
function get_width_height($dimension, $width, $height, $resize_type = 1) {
if ($resize_type == 2) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}
elseif ($resize_type == 3) {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
else {
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}
else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
}
return array("width" => $new_width, "height" => $new_height);
}
replace with:
function get_width_height($dimension, $width, $height, $resize_type = 1, $max_height = false) {
$max_width = $dimension;
$max_height = ($max_height === false) ? $max_width : $max_height;
if ($resize_type == 2)
{
$new_width = $max_width;
$new_height = floor(($max_width/$width) * $height);
}
elseif ($resize_type == 3)
{
$new_width = floor(($max_height/$height) * $width);
$new_height = $max_height;
}
else
{
$new_width = $width;
$new_height = $height;
if ($width > $max_width || $height > $max_height)
{
$scale = min($max_width/$width, $max_height/$height);
$new_width = floor($scale*$width);
$new_height = floor($scale*$height);
}
}
return array("width" => $new_width, "height" => $new_height);
}
find:
function resize_image($file, $quality, $dimension, $resize_type = 1) {
replace with:
function resize_image($file, $quality, $dimension, $resize_type = 1, $height = false) {
find:
$width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
replace width:
$width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type, $height);
includes/db_utils.php
find:
$queries[$i] = preg_replace("/;$/i", "", $line);
replace with:
$queries[$i] = preg_replace("/;$/", "", $line);
find:
$queries[$i] .= preg_replace("/;$/i", "", $line);
replace with:
$queries[$i] .= preg_replace("/;$/", "", $line);
find:
if (eregi('^(MyISAM|ISAM|HEAP|InnoDB)$', ((isset($row['Type'])) ? $row['Type'] : $row['Engine']))) {
replace with:
if (preg_match('/^(MyISAM|ISAM|HEAP|InnoDB)$/i', ((isset($row['Type'])) ? $row['Type'] : $row['Engine']))) {
includes/paging.php
find:
$link_args = ereg_replace("&page=[0-9]*", "", $link_args);
$link_args = ereg_replace("page=[0-9]*&", "", $link_args);
replace with:
$link_args = preg_replace("/&page=[0-9]*/", "", $link_args);
$link_args = preg_replace("/page=[0-9]*&/", "", $link_args);
includes/sessions.php
find:
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
replace with:
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".str_replace(array("{", "}"), array("{", "}"), $username)."</a>".$invisibleuser;
includes/functions.php
find:
ereg("(.+)\?(.+)", $basename, $regs);
replace with:
preg_match("#(.+)\?(.+)#", $basename, $regs);
find:
return is_remote($remote_thumb_file) && preg_match("#\.[gif|jpg|jpeg|png]+$#is", $remote_thumb_file) ? 1 : 0;
replace with:
return is_remote($remote_thumb_file) && preg_match("#\.(gif|jpg|jpeg|png)$#is", $remote_thumb_file) ? 1 : 0;
find:
return !is_remote($local_thumb_file) && get_basefile($local_thumb_file) != $local_thumb_file && preg_match("#\.[gif|jpg|jpeg|png]+$#i", $local_thumb_file) ? 1 : 0;
replace with:
return !is_remote($local_thumb_file) && get_basefile($local_thumb_file) != $local_thumb_file && preg_match("#\.(gif|jpg|jpeg|png)$#i", $local_thumb_file) ? 1 : 0;
find:
function get_file_name($file_name) {
ereg("(.+)\.(.+)", get_basefile($file_name), $regs);
return $regs[1];
}
replace with:
function get_file_name($file_name) {
if (preg_match("#(.+)\.(.+)#", get_basefile($file_name), $regs)) {
return $regs[1];
}
return false;
}
find:
return (preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? 1 : 0;
replace with:
return (preg_match("#\.(gif|jpg|jpeg|png)$#is", $file_name)) ? 1 : 0;
find:
if (substr(PHP_OS, 0, 3) == "WIN" && !eregi("\.exe$", $file_name)) {
replace with:
if (substr(PHP_OS, 0, 3) == "WIN" && !preg_match("#\.exe$#i", $file_name)) {
find:
$file_name = eregi_replace("\.exe$", "", $file_name);
replace with:
$file_name = preg_replace("#\.exe$#i", "", $file_name);
find:
return ($check_handle($file_name) && remote_file_exists($file_name, $check_remote)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $file_name) : $return_code;
replace with:
return ($check_handle($file_name) && remote_file_exists($file_name, $check_remote)) ? (($in_admin && !preg_match("#\.(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $file_name) : $return_code;
find:
return ($check_handle($file_name) && file_exists($file_path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $file_name) : $return_code;
replace with:
return ($check_handle($file_name) && file_exists($file_path)) ? (($in_admin && !preg_match("#\.(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $file_name) : $return_code;
find:
return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;
replace with:
return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#\.(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;
find:
elseif ($key == "ExposureTime") {
$exposure = explode("/", $exif_info);
$exif_array[$exif_match[$key]] = "1/" . ($exposure[1] / $exposure[0]);
replace with:
elseif ( $key == "ExposureTime" ) {
$ExposureTime = explode("/", $exif_info);
if ( $ExposureTime[0] == 1 && $ExposureTime[1] == 1 ){
$exif_array[$exif_match[$key]] = $ExposureTime[1]." sec(s)";
} elseif ( $ExposureTime[0] == 1 ) {
$exif_array[$exif_match[$key]] = "1/".($ExposureTime[1] * $ExposureTime[0])." sec(s)";
} elseif ( $ExposureTime[1] > 1 ) {
$exif_array[$exif_match[$key]] = ($ExposureTime[0]/$ExposureTime[1])." sec(s)";
} elseif( $ExposureTime[1] == 1 ) {
$exif_array[$exif_match[$key]] = ($ExposureTime[0] * $ExposureTime[1])." sec(s)";
}
find:
$split_keywords = explode(" ", $image_row['image_keywords']);
replace with:
$split_keywords = explode(",", $image_row['image_keywords']);
find and delete:
"image" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view),
find:
$site_template->register_vars("rate_form", $rate_form);
insert after:
$site_template->register_vars(array(
"image" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view),
));
find:
$thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".format_text($image_name, 2)."\" />";
replace with:
$thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".format_text($image_name, 2)."\" title=\"".format_text($image_name, 2)."\" />";
find:
$thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".format_text($image_name, 2)."\" />";
replace with:
$thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".format_text($image_name, 2)."\" title=\"".format_text($image_name, 2)."\" />";
find:
if (eregi("Win", $HTTP_USER_AGENT)) {
replace with:
if (preg_match("#Win#i", $HTTP_USER_AGENT)) {
find:
elseif (eregi("Mac", $HTTP_USER_AGENT)) {
replace with:
elseif (preg_match("#Mac#i", $HTTP_USER_AGENT)) {
find:
if (eregi("MSIE ([0-9].[0-9]{1,2})", $HTTP_USER_AGENT, $regs)) {
replace with:
if (preg_match("#MSIE ([0-9].[0-9]{1,2})#i", $HTTP_USER_AGENT, $regs)) {
find:
elseif (eregi("Mozilla/([0-9].[0-9]{1,2})", $HTTP_USER_AGENT, $regs)) {
replace with:
elseif (preg_match("#Mozilla/([0-9].[0-9]{1,2})#i", $HTTP_USER_AGENT, $regs)) {
find:
elseif (eregi("Opera(/| )([0-9].[0-9]{1,2})", $HTTP_USER_AGENT, $regs)) {
replace with:
elseif (preg_match("#Opera(/| )([0-9].[0-9]{1,2})#i", $HTTP_USER_AGENT, $regs)) {
find:
if (!eregi("http", $url['scheme'])) {
replace with:
if (!preg_match("#http#i", $url['scheme'])) {
find:
return 'application/octet-stream';
}
insert after:
function trim_value(&$value)
{
$value = trim($value);
}
/*
create directory tree recursively
backward compatibility for php4
*/
function _mkdir($dir, $chmod = CHMOD_DIRS)
{
if (is_dir($dir) || @mkdir($dir, $chmod)) return true;
if (!_mkdir(dirname($dir), $chmod)) return false;
return @mkdir($dir, $chmod);
}
function filterFileName($text, $tolower = 1, $transl = null)
{
global $translit;
$transl = ($transl !== null) ? $transl : @$translit;
if ($transl)
$text = strtr(
$text,
array(
// russian Windows-1251
"\xc0" => "a",
"\xc1" => "b",
"\xc2" => "v",
"\xc3" => "g",
"\xc4" => "d",
"\xc5" => "e",
"\xa8" => "e",
"\xc6" => "zh",
"\xc7" => "z",
"\xc8" => "i",
"\xc9" => "j",
"\xca" => "k",
"\xcb" => "l",
"\xcc" => "m",
"\xcd" => "n",
"\xce" => "o",
"\xcf" => "p",
"\xd0" => "r",
"\xd1" => "s",
"\xd2" => "t",
"\xd3" => "u",
"\xd4" => "f",
"\xd5" => "h",
"\xd6" => "c",
"\xd7" => "ch",
"\xd8" => "sh",
"\xd9" => "sch",
"\xda" => "",
"\xdb" => "i",
"\xdc" => "",
"\xdd" => "e",
"\xde" => "yu",
"\xdf" => "ya",
"\xe0" => "a",
"\xe1" => "b",
"\xe2" => "v",
"\xe3" => "g",
"\xe4" => "d",
"\xe5" => "e",
"\xb8" => "e",
"\xe6" => "zh",
"\xe7" => "z",
"\xe8" => "i",
"\xe9" => "j",
"\xea" => "k",
"\xeb" => "l",
"\xec" => "m",
"\xed" => "n",
"\xee" => "o",
"\xef" => "p",
"\xf0" => "r",
"\xf1" => "s",
"\xf2" => "t",
"\xf3" => "u",
"\xf4" => "f",
"\xf5" => "h",
"\xf6" => "c",
"\xf7" => "ch",
"\xf8" => "sh",
"\xf9" => "sch",
"\xfa" => "",
"\xfb" => "i",
"\xfc" => "",
"\xfd" => "e",
"\xfe" => "yu",
"\xff" => "ya",
));
if ($tolower)
$text = strtolower($text);
$text = str_replace(" ", "_", $text);
$text = str_replace("%20", "_", $text);
$text = preg_replace("/[^\-\._a-z0-9]/i", "_", $text);
return $text;
}
includes/db_mysql.php
find:
if (isset($user_info['user_level']) && $user_info['user_level'] == ADMIN){
replace with:
if (!defined("4IMAGES_ACTIVE") || (isset($user_info['user_level']) && $user_info['user_level'] == ADMIN)){
includes/constants.php
find:
define('SCRIPT_VERSION', '1.7.7');
replace with
define('SCRIPT_VERSION', '1.7.8');
includes/captcha_utils.php
find:
$valid = $sess_code != '' && strtolower($sess_code) == strtolower($code);
replace with:
$valid = $sess_code != '' && $sess_code == $code;
includes/page_header.php
find:
$file = get_included_files();
$file = get_file_name(basename($file[0]));
$list = array("categories", "details", "index", "member", "postcards", "register", "search", "top");
$array = array();
foreach ($list as $name)
{
$array[$name] = ($name == $file);
}
replace with:
$file = get_file_name(basename(MAIN_SCRIPT));
$array = array(
"categories" => false,
"details" => false,
"index" => false,
"member" => false,
"postcards" => false,
"register" => false,
"search" => false,
"top" => false
);
if ( isset($array[$file]) ) {
$array[$file] = true;
}
includes/upload.php
find:
return (ereg_replace('/+', '/', $tmp_file) == $file_name) ? 1 : 0;
replace with:
return (preg_replace('#/+#', '/', $tmp_file) == $file_name) ? 1 : 0;
find:
if (eregi("image", $this->HTTP_POST_FILES[$this->field_name]['type'])) {
replace with:
if (preg_match("/image/i", $this->HTTP_POST_FILES[$this->field_name]['type'])) {
find:
ereg("(.+)\.(.+)", $file_name, $regs);
$this->name = $regs[1];
ereg("(.+)\.(.+)", $this->HTTP_POST_FILES[$this->field_name]['name'], $regs);
replace with:
preg_match("/(.+)\.(.+)/", $file_name, $regs);
$this->name = $regs[1];
preg_match("/(.+)\.(.+)/", $this->HTTP_POST_FILES[$this->field_name]['name'], $regs);
find:
$this->file_name = ereg_replace(" ", "_", $this->file_name);
$this->file_name = ereg_replace("%20", "_", $this->file_name);
replace with:
$this->file_name = str_replace(" ", "_", $this->file_name);
$this->file_name = str_replace("%20", "_", $this->file_name);
find:
ereg("(.+)\.(.+)", $this->file_name, $regs);
replace with:
preg_match("/(.+)\.(.+)/", $this->file_name, $regs);
find:
function check_mime_type() {
if (!isset($this->accepted_mime_types[$this->image_type])) {
return true;
}
if (!in_array($this->mime_type, $this->accepted_mime_types[$this->image_type])) {
return false;
}
else {
return true;
}
}
replace with:
function check_mime_type()
{
if (!isset($this->accepted_mime_types[$this->extension]))
return false;
if (!is_array($this->accepted_mime_types[$this->extension]))
return ($this->accepted_mime_types[$this->extension] == $this->mime_type);
return (in_array($this->mime_type, $this->accepted_mime_types[$this->extension]));
}
find and delete:
$this->accepted_mime_types['thumb'] = array(
"image/jpg",
"image/jpeg",
"image/pjpeg",
"image/gif",
"image/x-png"
);
find:
include(ROOT_PATH.'includes/upload_definitions.php');
foreach ($mime_type_match as $key => $val) {
if (in_array($key, $this->accepted_extensions['media'])) {
if (is_array($val)) {
foreach ($val as $key2 => $val2) {
$this->accepted_mime_types['media'][] = $val2;
}
}
else {
$this->accepted_mime_types['media'][] = $val;
}
}
}
replace with:
include_once(ROOT_PATH.'includes/upload_definitions.php');
$this->accepted_mime_types = $mime_type_match;
includes/search_utils.php
find:
if ($for_search) {
insert before:
$val = preg_replace('/[\n\r]+/', ',', $val);
find:
"#[\n\t\r^\$\(\)<>\"\|,@\?%~\+\.\[\]{}:\/=!§\\\\]+#s"
replace with:
"#[\n\t\r^\$\(\)<>\"\|@\?%~\+\.\[\]{}:\/=!§\\\\]+#s"
find:
$split_words = preg_split("/\s+/", $val);
replace with:
$split_words = preg_split("/,+/", $val);
find:
foreach ($split_words as $word) {
insert after:
$word = trim($word);
includes/email.php
find:
$to_header = ereg_replace(", $", "", $to_header);
replace with:
$to_header = preg_replace("/, $/", "", $to_header);
-
Here is a detailed list of what has been changed in the php files from 4images 1.7.7 -> 1.7.8.
(The best way for yourself to compare the code of files is to use Winmerge (http://winmerge.org/).)
Root files
config.php
find:
$db_servertype = "mysql";
insert before:
date_default_timezone_set('CET');
global.php
find:
error_reporting(E_ERROR | E_WARNING | E_PARSE);
set_magic_quotes_runtime(0);
$start_time = microtime();
replace with:
$start_time = microtime();
error_reporting(E_ERROR | E_WARNING | E_PARSE);
if (function_exists("set_magic_quotes_runtime"))
{
@set_magic_quotes_runtime(0);
}
find:
$captcha_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
replace with:
$captcha_chars = "abcdefghijklmnopqrstuvwxyz1234567890";
find:
if (eregi("gzip", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"]) || eregi("x-gzip", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
replace with:
if (preg_match("/gzip/i", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"]) || preg_match("/x-gzip/i", $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"])) {
find:
$config['cat_order'] = empty($config['cat_order']) ? 'cat_order, cat_name ASC' : $config['cat_order'];
replace with:
$config['cat_order'] = empty($config['cat_order']) ? 'cat_order, cat_name' : $config['cat_order'];
$config['cat_sort'] = empty($config['cat_sort']) ? 'ASC' : $config['cat_sort'];
top.php
find:
define('ROOT_PATH', './');
insert after:
define('MAIN_SCRIPT', __FILE__);
postcards.php
find:
define('ROOT_PATH', './');
insert after:
define('MAIN_SCRIPT', __FILE__);
search.php
find:
define('ROOT_PATH', './');
insert after:
define('MAIN_SCRIPT', __FILE__);
find and delete:
error_reporting(E_ALL);
install.php
find:
error_reporting(E_ERROR | E_WARNING | E_PARSE);
set_magic_quotes_runtime(0);
define('ROOT_PATH', './');
replace with:
error_reporting(E_ERROR | E_WARNING | E_PARSE);
if (function_exists("set_magic_quotes_runtime"))
{
@set_magic_quotes_runtime(0);
}
define('ROOT_PATH', './');
find:
if (!isset($HTTP_GET_VARS)) {
insert before:
function get_timezone_by_offset($offset) {
$timezones = array(
'-12' => 'Pacific/Kwajalein',
'-11' => 'Pacific/Samoa',
'-10' => 'Pacific/Honolulu',
'-9.5' => 'Pacific/Marquesas',
'-9' => 'America/Juneau',
'-8' => 'America/Los_Angeles',
'-7' => 'America/Denver',
'-6' => 'America/Mexico_City',
'-5' => 'America/New_York',
'-4.5' => 'America/Caracas',
'-4' => 'America/Caracas',
'-3.5' => 'America/St_Johns',
'-3' => 'America/Argentina/Buenos_Aires',
'-2' => 'Atlantic/South_Georgia',
'-1' => 'Atlantic/Azores',
'0' => 'Europe/London',
'1' => 'Europe/Berlin',
'2' => 'Europe/Helsinki',
'3' => 'Europe/Moscow',
'3.5' => 'Asia/Tehran',
'4' => 'Asia/Baku',
'4.5' => 'Asia/Kabul',
'5' => 'Asia/Karachi',
'5.5' => 'Asia/Calcutta',
'5.75' => 'Asia/Kathmandu',
'6' => 'Asia/Colombo',
'6.5' => 'Indian/Cocos',
'7' => 'Asia/Bangkok',
'8' => 'Asia/Singapore',
'8.75' => 'Australia/Eucla',
'9' => 'Asia/Tokyo',
'9.5' => 'Australia/Darwin',
'10' => 'Pacific/Guam',
'10.5' => 'Australia/Lord_Howe',
'11' => 'Asia/Magadan',
'11.5' => 'Pacific/Norfolk',
'12' => 'Asia/Kamchatka',
'12.75' => 'Pacific/Chatham',
'13' => 'Pacific/Enderbury',
'14' => 'Pacific/Kiritimati',
);
if ( isset($timezones[$offset]) ) {
return $timezones[$offset];
}
return $timezones['1'];
}
find:
if (@file_exists(ROOT_PATH."config.php")) {
@include(ROOT_PATH.'config.php');
}
replace with:
if (@file_exists(ROOT_PATH."config.php")) {
@include(ROOT_PATH.'config.php');
} else {
date_default_timezone_set('CET');
}
find:
$admin_password2 = (isset($HTTP_POST_VARS['admin_password2'])) ? trim($HTTP_POST_VARS['admin_password2']) : "";
insert after:
$selected_timezone = (isset($HTTP_POST_VARS['timezone_select'])) ? trim($HTTP_POST_VARS['timezone_select']) : '1';
$selected_timezone = get_timezone_by_offset($selected_timezone);
find:
$config_file .= '$db_servertype = "'.$db_servertype.'";'."\n";
$config_file .= '$db_host = "'.$db_host.'";'."\n";
$config_file .= '$db_name = "'.$db_name.'";'."\n";
$config_file .= '$db_user = "'.$db_user.'";'."\n";
$config_file .= '$db_password = "'.$db_password.'";'."\n\n";
$config_file .= '$table_prefix = "'.$table_prefix . '";'."\n\n";
replace with:
$config_file .= 'date_default_timezone_set("' . $selected_timezone . '");'."\n\n";
$config_file .= '$db_servertype = \''.$db_servertype.'\';'."\n";
$config_file .= '$db_host = \''.$db_host.'\';'."\n";
$config_file .= '$db_name = \''.$db_name.'\';'."\n";
$config_file .= '$db_user = \''.$db_user.'\';'."\n";
$config_file .= '$db_password = \''.$db_password.'\';'."\n\n";
$config_file .= '$table_prefix = \''.$table_prefix . '\';'."\n\n";
find:
<p><b><?php echo $lang['admin_user'] ?></b></p>
insert before:
<p><b><?php echo $lang['timezone_select'] ?></b></p>
</td>
<td>
<p>
<select name="timezone_select" style="width: 188px;">
<option value="-12">Baker Island Time (UTC-12)</option>
<option value="-11">Niue Time, Samoa Standard Time (UTC-11)</option>
<option value="-10">Hawaii-Aleutian Standard Time, Cook Island Time (UTC-10)</option>
<option value="-9.5">Marquesas Islands Time (UTC-9:30)</option>
<option value="-9">Alaska Standard Time, Gambier Island Time (UTC-9)</option>
<option value="-8">Pacific Standard Time (UTC-8)</option>
<option value="-7">Mountain Standard Time (UTC-7)</option>
<option value="-6">Central Standard Time (UTC-6)</option>
<option value="-5">Eastern Standard Time (UTC-5)</option>
<option value="-4.5">Venezuelan Standard Time (UTC-4:30)</option>
<option value="-4">Atlantic Standard Time (UTC-4)</option>
<option value="-3.5">Newfoundland Standard Time (UTC-3:30)</option>
<option value="-3">Amazon Standard Time, Central Greenland Time (UTC-3)</option>
<option value="-2">Fernando de Noronha Time, South Georgia & the South Sandwich Islands Time (UTC-2)</option>
<option value="-1">Azores Standard Time, Cape Verde Time, Eastern Greenland Time (UTC-1)</option>
<option value="0">Western European Time, Greenwich Mean Time (UTC)</option>
<option value="1" selected="selected">Central European Time, West African Time (UTC+1)</option>
<option value="2">Eastern European Time, Central African Time (UTC+2)</option>
<option value="3">Moscow Standard Time, Eastern African Time (UTC+3)</option>
<option value="3.5">Iran Standard Time (UTC+3:30)</option>
<option value="4">Gulf Standard Time, Samara Standard Time (UTC+4)</option>
<option value="4.5">Afghanistan Time (UTC+4:30)</option>
<option value="5">Pakistan Standard Time, Yekaterinburg Standard Time (UTC+5)</option>
<option value="5.5">Indian Standard Time, Sri Lanka Time (UTC+5:30)</option>
<option value="5.75">Nepal Time (UTC+5:45)</option>
<option value="6">Bangladesh Time, Bhutan Time, Novosibirsk Standard Time (UTC+6)</option>
<option value="6.5">Cocos Islands Time, Myanmar Time (UTC+6:30)</option>
<option value="7">Indochina Time, Krasnoyarsk Standard Time (UTC+7)</option>
<option value="8">Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time (UTC+8)</option>
<option value="8.75">Southeastern Western Australia Standard Time (UTC+8:45)</option>
<option value="9">Japan Standard Time, Korea Standard Time, Chita Standard Time (UTC+9)</option>
<option value="9.5"> Australian Central Standard Time (UTC+9:30)</option>
<option value="10">Australian Eastern Standard Time, Vladivostok Standard Time (UTC+10)</option>
<option value="10.5">Lord Howe Standard Time (UTC+10:30)</option>
<option value="11">Solomon Island Time, Magadan Standard Time (UTC+11)</option>
<option value="11.5">Norfolk Island Time (UTC+11:30)</option>
<option value="12">New Zealand Time, Fiji Time, Kamchatka Standard Time (UTC+12)</option>
<option value="12.75">Chatham Islands Time (UTC+12:45)</option>
<option value="13">Tonga Time, Phoenix Islands Time (UTC+13)</option>
<option value="14">Line Island Time (UTC+14)</option>
</select>
</p>
</td>
</tr>
<tr class="tablerow2">
<td>
member.php
find:
define('ROOT_PATH', './');
insert after:
define('MAIN_SCRIPT', __FILE__);
find:
$image_keywords = preg_replace("/[\n\r]/is", " ", $image_keywords);
$image_keywords = str_replace(","," ",$image_keywords);
$image_keywords = ereg_replace("( ){2,}", " ", $image_keywords);
replace with:
$image_keywords = preg_replace("/[\n\r]/is", ",", $image_keywords);
$image_keywords_arr = explode(',', $image_keywords);
array_walk($image_keywords_arr, 'trim_value');
$image_keywords = implode(',', array_unique(array_filter($image_keywords_arr)));
find:
$image_keywords = preg_replace("/[\n\r]/is", " ", $image_keywords);
$image_keywords = str_replace(","," ",$image_keywords);
$image_keywords = ereg_replace("( ){2,}", " ", $image_keywords);
replace with:
$image_keywords = preg_replace("/[\n\r]/is", ",", $image_keywords);
$image_keywords_arr = explode(',', $image_keywords);
array_walk($image_keywords_arr, 'trim_value');
$image_keywords = implode(',', array_unique(array_filter($image_keywords_arr)));
download.php
find:
$disposition = (!eregi("\.zip$", $file_name)) ? 'attachment' : 'inline';
replace with:
$disposition = (!preg_match("/\.zip$/i", $file_name)) ? 'attachment' : 'inline';
find:
if (!is_remote_file($file_path) && ($filesize = filesize($file_path)) > 0) {
replace with:
if (!is_remote_file($file_path) && ($filesize = filesize($file_path)) > 0 && !@ini_get('zlib.output_compression') && !@ini_get('output_handler')) {
find:
ereg("(.+)\.(.+)", basename($image_row['image_download_url']), $regs);
replace with:
preg_match("/(.+)\.(.+)/", basename($image_row['image_download_url']), $regs);
find:
ereg("(.+)\.(.+)", get_basefile($image_row['image_media_file']), $regs);
replace with:
preg_match("/(.+)\.(.+)/", get_basefile($image_row['image_media_file']), $regs);
find:
ereg("(.+)\.(.+)", get_basefile($image_row['image_media_file']), $regs);
replace with:
preg_match("/(.+)\.(.+)/", get_basefile($image_row['image_media_file']), $regs);
find:
if ($action == "zip" && !eregi("\.zip$", $file['file_name']) && function_exists("gzcompress") && function_exists("crc32")) {
replace with:
if ($action == "zip" && !preg_match("/\.zip$/i", $file['file_name']) && function_exists("gzcompress") && function_exists("crc32")) {
index.php
find:
define('ROOT_PATH', './');
insert after:
define('MAIN_SCRIPT', __FILE__);
rss.php
find:
ORDER BY i.image_date DESC
replace with:
ORDER BY i.image_date DESC, i.image_id DESC
login.php
find:
if (!ereg("index.php", $url) && !ereg("login.php", $url) && !ereg("register.php", $url) && !ereg("member.php", $url)) {
replace with:
if (!preg_match("/index\.php/", $url) && !preg_match("/login\.php/", $url) && !preg_match("/register\.php/", $url) && !preg_match("/member\.php/", $url)) {
find:
if (!ereg("index.php", $url) && !ereg("login.php", $url) && !ereg("register.php", $url) && !ereg("member.php", $url)) {
replace with:
if (!preg_match("/index\.php/", $url) && !preg_match("/login\.php/", $url) && !preg_match("/register\.php/", $url) && !preg_match("/member\.php/", $url)) {
logout.php
find:
if (!ereg("index.php", $url) && !ereg("lightbox.php", $url) && !ereg("login.php", $url) && !ereg("register.php", $url) && !ereg("member.php", $url)) {
replace with:
if (!preg_match("/index\.php/", $url) && !preg_match("/lightbox\.php/", $url) && !preg_match("/login\.php/", $url) && !preg_match("/register\.php/", $url) && !preg_match("/member\.php/", $url)) {
register.php
find:
define('ROOT_PATH', './');
insert after:
define('MAIN_SCRIPT', __FILE__);
find:
$user_name = ereg_replace("( ){2,}", " ", $user_name);
replace with:
$user_name = preg_replace("/( ){2,}/", " ", $user_name);
details.php
find:
define('ROOT_PATH', './');
insert after:
define('MAIN_SCRIPT', __FILE__);
find:
$meta_keywords = !empty($image_row['image_keywords']) ? implode(", ", explode(" ", $image_row['image_keywords'])) : "";
replace with:
$meta_keywords = !empty($image_row['image_keywords']) ? implode(", ", explode(",", $image_row['image_keywords'])) : "";
find:
update_comment_count($id, $user_info['user_id']);
$msg = $lang['comment_success'];
insert after:
$site_sess->set_session_var("msgdetails", $msg);
redirect(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : "").(($page > 1) ? "&page=".$page : ""));
find:
//-----------------------------------------------------
//--- Show Comments -----------------------------------
//-----------------------------------------------------
insert after:
if ($msgdetails = $site_sess->get_session_var("msgdetails"))
{
$msg .= ($msg !== "" ? "<br />" : "").$msgdetails;
unset($msgdetails);
$site_sess->drop_session_var("msgdetails");
}
categories.php
find:
define('ROOT_PATH', './');
insert after:
define('MAIN_SCRIPT', __FILE__);