diff --git a/config.php b/config.php index 946c3a8..35ff744 100644 --- a/config.php +++ b/config.php @@ -39,6 +39,7 @@ // Local timezone. Default one is "Europe/Paris". #$config->timezone = "Europe/Paris"; +setlocale(LC_TIME, 'fr_FR.utf8','fra'); // If you want to inject a tracking code (or anything really) in your pages
, use this to refer to a file containing that: #$config->tracking_code_include = '/path/to/something.html'; diff --git a/inc/loc/default.ini b/inc/loc/default.ini index 8a57bb6..3d07966 100644 --- a/inc/loc/default.ini +++ b/inc/loc/default.ini @@ -27,6 +27,7 @@ numcomments = "Number of comments in Admin Stats" numcomm = "Comments" sens = "Max number of images displayed when hovering an album" thumbs_size = "Thumbnails size (px)" +album_coverfilename = "Album cover filename" images = "Images" language = "Language" user_theme = "Theme" @@ -139,6 +140,7 @@ new = "New Folder" create = "Create" upload_heading = "Upload" upload = "Upload images here" +cover = "Set as album cover" [boardheader] download = "DOWNLOAD" diff --git a/inc/loc/francais.ini b/inc/loc/francais.ini index 78995c8..1e3a03f 100644 --- a/inc/loc/francais.ini +++ b/inc/loc/francais.ini @@ -26,6 +26,7 @@ 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)" +album_coverfilename = "Miniatures des albums" images = "Images" language = "Langue" user_theme = "Thème" @@ -134,6 +135,7 @@ new = "Nouveau dossier" create = "Créer" upload_heading = "Ajout" upload = "Ajouter des images" +cover = "Définir comme miniature de l'album" [boardheader] download = "TÉLÉCHARGER" diff --git a/inc/ui.js b/inc/ui.js index 71e4b14..4fe762d 100644 --- a/inc/ui.js +++ b/inc/ui.js @@ -11,4 +11,6 @@ $(this).parent().children(".button-hidden").toggleClass("hidden"); }); - + $('#menu').animate({ + scrollTop: ($('li.menu_title ul.selected').offset().top-$(window).height()/2) + }, 500); \ No newline at end of file diff --git a/src/classes/Account.php b/src/classes/Account.php index b424ef6..c321024 100644 --- a/src/classes/Account.php +++ b/src/classes/Account.php @@ -111,14 +111,15 @@ public function __construct($login=NULL,$key=NULL){ //throw new Exception("Login $login not found"); return false; } - - /** - * Creates a new account in the base - * - * @param string $login - * @param string $password - * @author Thibaud Rohmer - */ + + /** + * Creates a new account in the base + * + * @param string $login + * @param string $password + * @author Thibaud Rohmer + * @return bool + */ public static function create($login, $password, $verif, $groups=array(),$name='',$email=''){ // Check if login already exists @@ -162,7 +163,7 @@ public static function create($login, $password, $verif, $groups=array(),$name=' * Encrypt password * * @param string $password - * @return void + * @return string * @author Thibaud Rohmer */ public static function password($password){ @@ -172,7 +173,7 @@ public static function password($password){ /** * Generate key * - * @return void + * @return string * @author Thibaud Rohmer */ private function key(){ @@ -265,24 +266,30 @@ public function save(){ $xml->asXML($xml_infos); } - /** - * Edit an account - * - * @param string $login - * @param string $old_password - * @param string $password - * @param string $name - * @param string $email - * @author Thibaud Rohmer - */ + /** + * Edit an account + * + * @param string $login + * @param string $old_password + * @param string $password + * @param string $name + * @param string $email + * @param array $groups + * @param string|null $language + * @throws Exception + * @author Thibaud Rohmer + */ public static function edit($login=NULL, $old_password=NULL, $password=NULL, $name=NULL, $email=NULL, $groups=array(), $language=NULL){ /// Only the admin can modify other accounts if( !CurrentUser::$admin && $login != CurrentUser::$account->login ){ return; } - if(isset($login) && (preg_match("/^[A-Z][a-zA-Z -]+$/", $login) === 0) ){ - $acc = new Account($login); + if(isset($login)){ + $acc = new Account($login); + if(!$acc){ + throw new Exception("Error: user with username '$login' not found."); + } }else{ $acc = CurrentUser::$account; } @@ -415,7 +422,7 @@ public static function findAll(){ * Returns the rights of an account * * @param string $login - * @return void + * @return array * @author Thibaud Rohmer */ public static function rights($login){ @@ -537,6 +544,13 @@ public function toHTML(){ "; echo "\n"; + echo "\n"; echo "\n"; } diff --git a/src/classes/Admin.php b/src/classes/Admin.php index 7b8e812..971d516 100644 --- a/src/classes/Admin.php +++ b/src/classes/Admin.php @@ -107,6 +107,27 @@ public function __construct(){ Admin::delete(); } break; + + case "Cpy" : if(isset($_POST['pathFrom'])){ + try{ + CurrentUser::$path = File::r2a(dirname(stripslashes($_POST['pathFrom']))); + }catch(Exception $e){ + CurrentUser::$path = Settings::$photos_dir; + } + } + Admin::copyFile(); + + if(isset($_POST['copy']) && $_POST['copy']=="copy"){ + try{ + if(is_dir(File::r2a(stripslashes($_POST['pathFrom'])))){ + CurrentUser::$path = dirname(File::r2a(stripslashes($_POST['pathFrom'])))."/".stripslashes($_POST['pathTo']); + } + }catch(Exception $e){ + CurrentUser::$path = Settings::$photos_dir; + } + } + + break; } } @@ -133,6 +154,11 @@ public function __construct(){ case "Acc" : if(isset($_POST['edit'])){ Account::edit($_POST['login'],$_POST['old_password'],$_POST['password'],$_POST['name'],$_POST['email'],NULL,$_POST['language']); } + if(isset($_POST['delete'])){ + if (CurrentUser::$account != $_POST['login']){ + Account::delete($_POST['login']); + } + } if(isset($_POST['login'])){ $this->page = new Account($_POST['login']); }else{ @@ -248,7 +274,48 @@ public static function move(){ return; } + + + /** + * Copy files on the server + * + * @author Alesc from Thibaud Rohmer move() function + */ + public static function copyFile(){ + /// Just to be really sure... + if( !(CurrentUser::$admin || CurrentUser::$uploader) ){ + return; + } + + $from = File::r2a(stripslashes($_POST['pathFrom'])); + $to = dirname($from)."/".stripslashes($_POST['pathTo']); + $type = $_POST['copy']; + + if($from == $to){ + return; + } + + if($type == "copy"){ + /// 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'])); + @copy($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); + @copy($from."/".$file,$to."/".$file); + } + } + + return; + } /** * Delete files on the server diff --git a/src/classes/Board.php b/src/classes/Board.php index 3e0116c..d26c628 100644 --- a/src/classes/Board.php +++ b/src/classes/Board.php @@ -162,7 +162,7 @@ private function grid($type="Image"){ continue; } - $this->boarditems[] = new BoardItem($file); + $this->boarditems[] = new BoardItem($file,0,File::FileDate($file)); } } @@ -176,17 +176,18 @@ private function foldergrid(){ foreach($this->dirs as $d){ if(!Judge::view($d)) //Dir is not accessible (rights) - ignore it for better performance continue; - $firstImg = Judge::searchDir($d); - if(!$firstImg){ + + $albumCover = Judge::searchAlbumImage($d); + if(!$albumCover){ if(CurrentUser::$admin){ - $firstImg = NULL; + $albumCover = NULL; }else{ continue; } } - $item = new BoardDir($d,$firstImg); + $item = new BoardDir($d,$albumCover); $this->boardfolders[] = $item; } @@ -226,10 +227,36 @@ public function toHTML(){ $this->grid("Image"); if(sizeof($this->boarditems)>0){ echo "".print_r($years)."
"; + + + foreach($years as $year){ + echo "