diff --git a/inc/js/photosphere/sphere.js b/inc/js/photosphere/sphere.js index 742b0a9..2305c01 100644 --- a/inc/js/photosphere/sphere.js +++ b/inc/js/photosphere/sphere.js @@ -13,7 +13,7 @@ function Photosphere(image){ } Photosphere.prototype.loadPhotosphere = function(holder){ - holder.innerHTML = "wait..."; + holder.innerHTML = "
Loading...
"; this.holder = holder; diff --git a/inc/loc/default.ini b/inc/loc/default.ini index 6addf33..2563e98 100644 --- a/inc/loc/default.ini +++ b/inc/loc/default.ini @@ -1,31 +1,42 @@ [settings] settings = "Settings" +global = "Global" title = "Title" site_address= "Site root URL" buttons = "Buttons" +s_networks = "Social Networks" fb = "Facebook" facebook_appid = "Facebook Application ID" fbappid = "AppID" plusone = "Google +1" register = "Register" +options = "Options" noregister = "Block Registration" forcehttps = "Force https for login and registration" comment = "Comments" nocomment = "Remove Comments Panel" download = "Downloads" +nocomments = "Remove comments" +nodescription = "Remove descriptions" nodownload = "Remove downloading links" +reverse_menu = "Reverse menu order" +rss = "RSS feed" +button_title = "Title for buttons" numcomments = "Number of comments in Admin Stats" numcomm = "Comments" sens = "Max number of images displayed when hovering an album" +thumbs_size = "Thumbnails size (px)" images = "Images" language = "Language" +user_theme = "Theme" submit = "Submit" generate = "Generate recursively thumbs and web images" folder = "Folder" all = "All" gener = "Generate" -video_comment = "PhotoShow only displays videos in WebM. You can set the encoding to convert to other formats than webm" -encode_video = "Encode Video Activate" +video = "Video" +video_comment = "PhotoShow only displays videos in WebM. You can set the encoding to convert to other formats than webm." +encode_video = "Encode Video" ffmpeg_path = "FFmpeg path" ffmpeg_option = "Encoding option" @@ -40,6 +51,7 @@ oldpass = "Old Pass" submit = "Save" or = "or" cancel = "Cancel" +key = "Key" [delete] delete = "Delete" @@ -55,9 +67,17 @@ groups = "Edit Groups" account = "Edit Accounts" back = "Back to Website" +[statistics] +heading = "Statistics" +summary = "Summary" +by_age = "(by age)" +items = "Items" +gen_items = "Generated items" + [jsaccounts] accounts = "Accounts" groups = "Groups" +groupname_label = "Group name:" groupname = "Name" addgroup = "Create Group" @@ -65,6 +85,7 @@ addgroup = "Create Group" logintitle = "Login" login = "Login" pass = "Password" +submit = "Submit" or = "or" register = "Register" back = "Back to Website" @@ -84,16 +105,20 @@ back = "Back to Website" [menubar] logged = "logged as" +not_logged = "Not logged in!" login = "LOGIN" register = "REGISTER" logout = "LOGOUT" admin = "ADMIN" +account = "ACCOUNT" powered = "Powered by" [bin] delete = "Delete" [judge] +infos = "Infos" +access = "Access" public = "This item is public." gopriv = "Go Private" priv = "This item is private." @@ -101,11 +126,13 @@ gopub = "Go Public" accounts = "Allowed accounts" groups = "Allowed groups" set = "Set Rights" +exif = "Exif" [adminpanel] rename = "Rename" new = "New Folder" create = "Create" +upload_heading = "Upload" upload = "Upload images here" [boardheader] @@ -114,15 +141,34 @@ download = "DOWNLOAD" [board] albums = "Albums" images = "Images" +videos = "Videos" [comments] +comment = "Comment" comments = "Comments" anonymous = "Anonymous" submit = "Post Comment" +[description] +description = "Description" +submit = "Post Description" + [token] token = "Guest Token" tokens = "Guest Tokens" deletetoken = "Delete" createtoken = "Create Guest Token" +[buttons] +prev = "Previous" +back = "Back" +img = "View" +get = "Download" +slideshow = "Start slideshow" +pshere = "Photo Sphere" +next = "Next" +pause = "Pause slideshow" +play = "Play slideshow" +stop = "Stop slideshow" +rss = "RSS feed" +menuright = "Menu" diff --git a/inc/loc/francais.ini b/inc/loc/francais.ini index 9271da6..78995c8 100644 --- a/inc/loc/francais.ini +++ b/inc/loc/francais.ini @@ -1,27 +1,41 @@ [settings] -settings = "Param&eagrave;tres" +settings = "Paramètres" +global = "Général" title = "Titre" +site_address= "URL de la racine du site" buttons = "Boutons" +s_networks = "Réseaux sociaux" fb = "Facebook" +facebook_appid = "Facebook Application ID" +fbappid = "AppID" plusone = "Google +1" register = "Inscriptions" +options = "Options" noregister = "Bloquer les inscriptions" forcehttps = "Forcer HTTPS pour les inscriptions et identifications" comment = "Comms" nocomment = "Supprimer le panneau de commentaires" download = "Archives" +nocomments = "Bloquer les commentaires" +nodescription = "Bloquer les descriptions" nodownload = "Bloquer le téléchargement de fichiers" +reverse_menu = "Inverser l'ordre du menu" +rss = "Flux RSS" +button_title = "Titre pour les boutons" numcomments = "Nombre de commentaires sur la page de stats" numcomm = "Comms" sens = "Nombre maximal d'images affichées au survol d'album" +thumbs_size = "Taille des miniatures (px)" images = "Images" language = "Langue" +user_theme = "Thème" submit = "Valider" -generate = "Générer les vignettes et images 800x600 (récursif)" +generate = "Générer les vignettes et images (récursif)" folder = "Dossier" all = "Tout" gener = "Générer" -video_comment = "PhotoShow affiche uniquement les vidéos au format Webm. Tu peux activer l'encodage pour les autres formats" +video = "Vidéo" +video_comment = "PhotoShow affiche uniquement les vidéos au format WebM. Vous pouvez définir l'encodage pour les autres formats." encode_video = "Encodage vidéo" ffmpeg_path = "Chemin ffmpeg" ffmpeg_option = "Options ffmpeg" @@ -29,7 +43,7 @@ ffmpeg_option = "Options ffmpeg" [account] createaccount = "Créer un compte" account = "Compte" -editing = "Edition du compte : " +editing = "Édition du compte : " name = "Nom" email = "Courriel" password = "Mot de passe" @@ -37,6 +51,7 @@ oldpass = "Ancien mdp" submit = "Sauver" or = "ou" cancel = "Annuler" +key = "Clef" [delete] delete = "Supprimer" @@ -44,16 +59,25 @@ path = "Chemin" submit = "Supprimer" [adminmenu] -about = "À propos..." -stats = "Afficher statistiques" -settings = "Préférences" +about = "À propos" +stats = "Statistiques" +tokens = "Jetons d'authentification" +settings = "Paramètres" account = "Comptes" groups = "Groupes" back = "Retour au site" +[statistics] +heading = "Statistiques" +summary = "Résumé" +by_age = "(par âge)" +items = "Objets" +gen_items = "Objets générés" + [jsaccounts] accounts = "Comptes" groups = "Groupes" +groupname_label = "Nom du groupe :" groupname = "Nom" addgroup = "Créer le groupe" @@ -81,16 +105,20 @@ back = "Retourner au site" [menubar] logged = "connecté en tant que" +not_logged = "Non connecté(e)" login = "CONNEXION" register = "INSCRIPTION" logout = "DÉCONNEXION" admin = "PRÉFÉRENCES" +account = "COMPTE" powered = "Ce site utilise" [bin] delete = "Supprimer" [judge] +infos = "Infos" +access = "Accès" public = "Cet élément est public." gopriv = "Passer privé" priv = "Cet élément est privé." @@ -98,11 +126,13 @@ gopub = "Passer public" accounts = "Comptes autorisés" groups = "Groupes autorisés" set = "Valider" +exif = "Exif" [adminpanel] rename = "Renommer" new = "Nouveau dossier" create = "Créer" +upload_heading = "Ajout" upload = "Ajouter des images" [boardheader] @@ -111,7 +141,34 @@ download = "TÉLÉCHARGER" [board] albums = "Albums" images = "Images" +videos = "Vidéos" [comments] +comment = "Commentaire" +comments = "Commentaires" anonymous = "Anonyme" submit = "Commenter" + +[description] +description = "Description" +submit = "Enregistrer" + +[token] +token = "Jeton invité" +tokens = "Jetons d'authentification" +deletetoken = "Supprimer" +createtoken = "Créer un jeton" + +[buttons] +prev = "Précédent" +back = "Retour" +img = "Afficher" +get = "Télécharger" +slideshow = "Démarrer le diaporama" +pshere = "Photo Sphere" +next = "Suivant" +pause = "Mettre en pause le diaporama" +play = "Reprendre le diaporama" +stop = "Quitter le diaporama" +rss = "Flux RSS" +menuright = "Menu" diff --git a/inc/spiffygif.gif b/inc/spiffygif.gif new file mode 100644 index 0000000..1872d1f Binary files /dev/null and b/inc/spiffygif.gif differ diff --git a/index.php b/index.php index aea7e84..d1c4b74 100644 --- a/index.php +++ b/index.php @@ -63,6 +63,13 @@ function protect_user_send_var($var){ return addslashes($var); } +/// workaround for splitting basename whith beginning utf8 multibyte char +/// See https://bugs.php.net/bug.php?id=37268 +function mb_basename($filepath, $suffix = NULL) { + $splited = preg_split ( '/\//', rtrim ( $filepath, '/ ' ) ); + return substr ( basename ( 'X' . $splited [count ( $splited ) - 1], $suffix ), 1 ); +} + if (!get_magic_quotes_gpc()){ $_POST = protect_user_send_var($_POST); diff --git a/src/classes/Account.php b/src/classes/Account.php index ba76cf0..b424ef6 100644 --- a/src/classes/Account.php +++ b/src/classes/Account.php @@ -444,7 +444,7 @@ public function toHTML(){ $this->header(); echo "
"; - echo "

Account

"; + echo "

".Settings::_("jsaccounts","accounts")."

"; echo "
"; if(CurrentUser::$admin){ @@ -509,9 +509,9 @@ public function toHTML(){ } echo "\n"; - /// Login + /// Key echo "
- + get_key(), ENT_QUOTES ,'UTF-8')."\">
"; diff --git a/src/classes/Admin.php b/src/classes/Admin.php index ddee9bb..7b8e812 100644 --- a/src/classes/Admin.php +++ b/src/classes/Admin.php @@ -216,31 +216,32 @@ public static function move(){ } $from = File::r2a(stripslashes($_POST['pathFrom'])); - $to = File::r2a(stripslashes($_POST['pathTo'])); + $to = dirname($from)."/".stripslashes($_POST['pathTo']); $type = $_POST['move']; if($from == $to){ return; } - if($type == "rename"){ - $thumbsDir = Settings::$thumbs_dir."/".stripslashes($_POST['pathFrom']); - @rename($from,dirname($from)."/".stripslashes($_POST['pathTo'])); - @rename($thumbsDir,dirname($thumbsDir)."/".stripslashes($_POST['pathTo'])); - return; - } + if(file_exists($to)){ + /// We don't want to overwrite existing data + return; + } - if(is_file($from) || $type=="directory"){ - @rename($from,$to."/".basename($from)); + if($type == "rename"){ + /// Metadatas need to be done first: once moved/deleted, + /// we won't be able to compute from the original file + Admin::manage_metadatas(stripslashes($_POST['pathFrom']), stripslashes($_POST['pathTo'])); + @rename($from,$to); return; } - - /// We are moving multiple files $files = scandir($from); foreach($files as $file){ if($file != "." && $file!=".."){ + Admin::manage_metadatas(stripslashes($_POST['pathFrom'])."/".$file, + stripslashes($_POST['pathTo'])."/".$file); @rename($from."/".$file,$to."/".$file); } } @@ -262,12 +263,16 @@ public function delete(){ } if(!is_array($_POST['del'])){ - $del = File::r2a(stripslashes($_POST['del'])); - return Admin::rec_del($del); + $rela_del = stripslashes($_POST['del']); + $del = File::r2a($rela_del); + Admin::manage_metadatas($rela_del); + Admin::rec_del($del); }else{ foreach($_POST['del'] as $todel){ - $del = File::r2a(stripslashes($todel)); - Admin::rec_del($del); + $rela_del = stripslashes($todel); + $del = File::r2a($rela_del); + Admin::manage_metadatas($rela_del); + Admin::rec_del($del); } } } @@ -288,7 +293,7 @@ public function rec_del($dir){ } $dirs = Menu::list_dirs($dir); - $files = Menu::list_files($dir,false,true); + $files = Menu::list_files($dir,false,true,false,true); foreach($dirs as $d){ Admin::rec_del($d); @@ -301,6 +306,71 @@ public function rec_del($dir){ return rmdir($dir); } + /** + * Manage all metadatas (tokens, _*.xml, thumbnails) + * associated to a file or folder + * + * @param string $file + * @param string $to optional parameter for a rename + */ + public function manage_metadatas($file, $to = null){ + $originalFile = File::r2a($file); + $thumbFile = Settings::$thumbs_dir.$file; + $thumbFile_dirname = dirname($thumbFile); + $isVideo = File::Type($originalFile) == "Video"; + + /// Tokens + /// It doesn't make any sense to rename a token: its link might + /// have been already shared, which is now broken because of the + /// file deletion/renaming, so delete them in all case + GuestToken::delete_file_tokens($file); + + /// XML + if(is_file($originalFile)){ + /// XML of folders are inside them, so they will be moved/deleted with the thumbnails + $xml_metadatas = array("comments","rights","description"); + foreach($xml_metadatas as $xml_metadata){ + $xml_metadata = "_".$xml_metadata.".xml"; + $xml_file = $thumbFile_dirname."/.".mb_basename($file).$xml_metadata; + if (file_exists($xml_file)){ + if (isset($to)) + rename($xml_file, $thumbFile_dirname."/.".mb_basename($to).$xml_metadata); + else + unlink($xml_file); + } + } + } + + /// Thumbnails + $originalFile_obj = new File($originalFile); + if ($isVideo){ + /// A thumbnail of a picture has the same filename of the original file, but it's a jpg for a video + $thumbFile = $thumbFile_dirname."/".$originalFile_obj->name.".jpg"; + $thumbFileTo = $thumbFile_dirname."/".mb_basename($to, $originalFile_obj->extension)."jpg"; + $webFile = $thumbFile_dirname."/".$originalFile_obj->name.".webm"; + $webFileTo = $thumbFile_dirname."/".mb_basename($to, $originalFile_obj->extension)."webm"; + } + else{ + $thumbFileTo = $thumbFile_dirname."/".$to; + $webFile = $thumbFile_dirname."/".$originalFile_obj->name."_small.".$originalFile_obj->extension; + $webFileTo = $thumbFile_dirname."/".mb_basename($to, '.'.$originalFile_obj->extension)."_small.".$originalFile_obj->extension; + } + + if (!file_exists($thumbFile)) + return; + if (isset($to)){ + rename($thumbFile, $thumbFileTo); + // The webfile might not have been created yet, or $file is < 1200px, or $file is a folder: + if (file_exists($webFile)) + rename($webFile, $webFileTo); + } + else{ + Admin::rec_del($thumbFile); + if (file_exists($webFile)) + // Only files can have a webFile, so we don't need rec_del() + unlink($webFile); + } + } /** * Display admin page diff --git a/src/classes/AdminAbout.php b/src/classes/AdminAbout.php index 0cff3a0..766d1e8 100644 --- a/src/classes/AdminAbout.php +++ b/src/classes/AdminAbout.php @@ -61,7 +61,7 @@ public function __construct(){ public function toHTML(){ echo "
"; - echo "

About

"; + echo "

".Settings::_("adminmenu","about")."

"; echo "
"; echo "

PhotoShow

"; diff --git a/src/classes/AdminPanel.php b/src/classes/AdminPanel.php index e8fd141..6cebe2f 100644 --- a/src/classes/AdminPanel.php +++ b/src/classes/AdminPanel.php @@ -42,8 +42,6 @@ class AdminPanel { - private $infos; - private $j; private $isfile = false; @@ -56,54 +54,6 @@ public function __construct(){ } $this->j = new Judge($file); - if(is_array($file)){ - $this->infos = ""; - - }else{ - $this->infos = $this->infodirtoHTML($file); - } - } - - - public function infodirtoHTML($dir){ - $w = File::a2r($dir); - $ret = ""; - -// $ret .= ""; - - - /// Folder name - if(strlen($w)>1 && $this->isfile){ - $ret .= "
- - - - -
"; - }else{ - $ret .= "
- - - -
"; - - /// Upload Images form - - - /*$ret .= "
"; - $w=File::a2r(CurrentUser::$path); - $ret .= "
- - - - -
".Settings::_("adminpanel","upload")."
-
"; - */ - } - return $ret; - } public function toHTML(){ diff --git a/src/classes/AdminStats.php b/src/classes/AdminStats.php index 44484f4..2b4f98f 100644 --- a/src/classes/AdminStats.php +++ b/src/classes/AdminStats.php @@ -87,26 +87,43 @@ public function Calculate() { } + private function _getRealName($name) { + switch ($name) { + case "Users": + return Settings::_("jsaccounts","accounts"); + case "Groups": + return Settings::_("jsaccounts","groups"); + case "Items": + return Settings::_("statistics","items"); + case "Generated items": + return Settings::_("statistics","gen_items"); + case "Albums": + return Settings::_("board","albums"); + default: + return $name; + } + } + public function toHTML(){ self::Calculate() ; echo "
"; - echo "

Statistics

"; + echo "

".Settings::_("statistics","heading")."

"; echo "
"; - echo "

Stats

"; + echo "

".Settings::_("statistics","summary")."

"; echo ""; - echo "

Accounts (by age)

"; + echo "

".Settings::_("jsaccounts","accounts")." ".Settings::_("statistics","by_age")."

"; echo "