From 8937389d78fab2081ae3e60d1dc0ad1eb8f47a2a Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Mon, 14 Mar 2016 08:37:52 +0100 Subject: [PATCH 01/19] Nettoyage git --- config.php | 3 --- data/.htaccess | 1 - data/configuration/index.html | 0 data/index.html | 0 4 files changed, 4 deletions(-) delete mode 100644 config.php delete mode 100644 data/.htaccess delete mode 100644 data/configuration/index.html delete mode 100644 data/index.html diff --git a/config.php b/config.php deleted file mode 100644 index 6344ccc6f..000000000 --- a/config.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/data/.htaccess b/data/.htaccess deleted file mode 100644 index ce7ca4512..000000000 --- a/data/.htaccess +++ /dev/null @@ -1 +0,0 @@ -options -indexes \ No newline at end of file diff --git a/data/configuration/index.html b/data/configuration/index.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/data/index.html b/data/index.html deleted file mode 100644 index e69de29bb..000000000 From e6caa0f85bf7656246207b096a79f4cd08c920c3 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Mon, 14 Mar 2016 21:55:02 +0100 Subject: [PATCH 02/19] Nettoyage --- data/articles/.htaccess | 4 ---- data/commentaires/.htaccess | 4 ---- data/configuration/.htaccess | 4 ---- data/statiques/.htaccess | 4 ---- 4 files changed, 16 deletions(-) delete mode 100644 data/articles/.htaccess delete mode 100644 data/commentaires/.htaccess delete mode 100644 data/configuration/.htaccess delete mode 100644 data/statiques/.htaccess diff --git a/data/articles/.htaccess b/data/articles/.htaccess deleted file mode 100644 index 51d1a8668..000000000 --- a/data/articles/.htaccess +++ /dev/null @@ -1,4 +0,0 @@ - - Order allow,deny - Deny from all - diff --git a/data/commentaires/.htaccess b/data/commentaires/.htaccess deleted file mode 100644 index 51d1a8668..000000000 --- a/data/commentaires/.htaccess +++ /dev/null @@ -1,4 +0,0 @@ - - Order allow,deny - Deny from all - diff --git a/data/configuration/.htaccess b/data/configuration/.htaccess deleted file mode 100644 index 9a42a760d..000000000 --- a/data/configuration/.htaccess +++ /dev/null @@ -1,4 +0,0 @@ - - Order allow,deny - Deny from all - \ No newline at end of file diff --git a/data/statiques/.htaccess b/data/statiques/.htaccess deleted file mode 100644 index 51d1a8668..000000000 --- a/data/statiques/.htaccess +++ /dev/null @@ -1,4 +0,0 @@ - - Order allow,deny - Deny from all - From 971414e08a2b3107cb9bd112f28f8b0a750c199d Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Tue, 15 Mar 2016 02:48:34 +0100 Subject: [PATCH 03/19] =?UTF-8?q?R=C3=A9initialisation=20config.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.php | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 config.php diff --git a/config.php b/config.php new file mode 100644 index 000000000..cb7a549e3 --- /dev/null +++ b/config.php @@ -0,0 +1,3 @@ + From 728c944991d3ac6855861488fca03f04b81bcc47 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Fri, 18 Mar 2016 23:37:22 +0100 Subject: [PATCH 04/19] Chgt config.php --- config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.php b/config.php index cb7a549e3..b1fd01b6c 100644 --- a/config.php +++ b/config.php @@ -1,3 +1,3 @@ From 62934c538401352346c0991d0d2c08007a9e6353 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Sun, 27 Mar 2016 15:49:57 +0200 Subject: [PATCH 05/19] =?UTF-8?q?D=C3=A9sindexation=20config.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.php | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 config.php diff --git a/config.php b/config.php deleted file mode 100644 index b1fd01b6c..000000000 --- a/config.php +++ /dev/null @@ -1,3 +0,0 @@ - From dbdd9bff5d6f9570c6ab4cb667ca8d856088872f Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Sun, 27 Mar 2016 18:51:13 +0200 Subject: [PATCH 06/19] Modif PlxShow::staticUrl --- config.php | 3 +++ core/lib/class.plx.show.php | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 config.php diff --git a/config.php b/config.php new file mode 100644 index 000000000..b3f1a7d7e --- /dev/null +++ b/config.php @@ -0,0 +1,3 @@ + diff --git a/core/lib/class.plx.show.php b/core/lib/class.plx.show.php index 91bce98ec..fcc8a19ac 100644 --- a/core/lib/class.plx.show.php +++ b/core/lib/class.plx.show.php @@ -1372,10 +1372,12 @@ public function staticId() { * @scope static * @author Florent MONTHEL, Stéphane F **/ - public function staticUrl($type='relatif') { + public function staticUrl($type='relatif', $staticId=false) { # Recupération ID URL - $staticId = $this->staticId(); + if (empty($staticId) or !array_key_exists(str_pad($staticId,3,'0',STR_PAD_LEFT), $this->plxMotor->aStats)) { + $staticId = $this->staticId(); + } $staticIdFill = str_pad($staticId,3,'0',STR_PAD_LEFT); if(!empty($staticId) AND isset($this->plxMotor->aStats[ $staticIdFill ])) echo $this->plxMotor->urlRewrite('?static'.$staticId.'/'.$this->plxMotor->aStats[ $staticIdFill ]['url']); From e32a075bec322e05c87b62d20eecbabe8b5d3222 Mon Sep 17 00:00:00 2001 From: Stephane Date: Wed, 1 Mar 2017 11:01:08 +0100 Subject: [PATCH 07/19] ajout fichiers --- core/admin/theme/images/file.png | Bin 0 -> 685 bytes core/admin/theme/images/progress.png | Bin 0 -> 192 bytes core/admin/upload.php | 87 ++++++++++++ core/lib/filedrag.js | 199 +++++++++++++++++++++++++++ 4 files changed, 286 insertions(+) create mode 100644 core/admin/theme/images/file.png create mode 100644 core/admin/theme/images/progress.png create mode 100644 core/admin/upload.php create mode 100644 core/lib/filedrag.js diff --git a/core/admin/theme/images/file.png b/core/admin/theme/images/file.png new file mode 100644 index 0000000000000000000000000000000000000000..8717e8b0702b250d383a57505bd11445d752e7f5 GIT binary patch literal 685 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sIRQQ)u0R?q=rbCPy?pr+sNn6}w@a5U{rdImw{PE`KY#w@$&(*Hemr~j z?C#yWSFc`OuwcQNGiP@1-hKc6{U=|_jslJ2FA4GsX7F}4Q03(iZEmQuv5;>36n9`h z0|VnjPZ!4!kK<>r=K4Q25MX(*d)tAJWqvv3!M8bEKmGr&y!mm2f?)oBMYaMZ!+vwm z<{zI|8`qxJ{*=I=f3I3nQ1Ii4(?8#q?lNb1#UVIZaoOp;j4YuaFZM4k=3D;ssm;l! z_2M3^FTxcCE(_@Yw_0$Q;S|rg+L?1s%Ni~`w?qG<@aGMjSyR0W7Iq#=-^zQ9`=Zsp z_ERd(GZ=m=zdoe+K3#Z$6;B4=tOY4Lw-?0KWEU-U*ro8|ov!bUgap4|#a16raGE7p zFKt=OTe16&l(&;8JL|z20p`cWzlEQRU}$=4vV8Kl%cTsBzjzL0?s+eFVR}=8@D+t{ zH6E5(if1)uKhQWNn6uOH%t7nAoQlW&vm5HU7#R*4&%NlTu!}*F!Sl6xIqQd9r3~{m zxt}N9%AWfpg40E(p=MtrBY%d8TE_|r%jS;rCzu5KuDfo$x52pKx}e7eJ+bx;`nL}V ze^6B|=IwaT_&4>7vR_R0=J&mv8=vf$qP1Z`U)>!x%jEAd(;~cB)(WnF*`S(i+>rWl zQPXYXyPSef;*LAqjvVKEpnvWWU){daNBR}WxRM~h zU#b=%V)iJHgW$$pcxFFu6{1-oD!M $msg, + 'status' => $status + ))); +} + +# validation du token de scurit +if($_SERVER['REQUEST_METHOD']=='POST' AND isset($_SESSION['formtoken'])) { + if(empty($_POST['token']) OR plxUtils::getValue($_SESSION['formtoken'][$_POST['token']]) < time() - 3600) { # 3600 seconds + unset($_SESSION['formtoken']); + die('Security error : invalid or expired token'); + } +} + +# Scurisation du chemin du dossier +if(isset($_POST['folder']) AND $_POST['folder']!='.' AND !plxUtils::checkSource($_POST['folder'])) { + $_POST['folder']='.'; +} + +# Recherche du type de medias afficher via la session +if(empty($_SESSION['medias'])) { + $_SESSION['medias'] = $plxAdmin->aConf['medias']; + $_SESSION['folder'] = ''; +} +elseif(!empty($_POST['folder'])) { + $_SESSION['currentfolder']= (isset($_SESSION['folder'])?$_SESSION['folder']:''); + $_SESSION['folder'] = ($_POST['folder']=='.'?'':$_POST['folder']); +} +# Nouvel objet de type plxMedias +if($plxAdmin->aConf['userfolders'] AND $_SESSION['profil']==PROFIL_WRITER) + $plxMedias = new plxMedias(PLX_ROOT.$_SESSION['medias'].$_SESSION['user'].'/',$_SESSION['folder']); +else + $plxMedias = new plxMedias(PLX_ROOT.$_SESSION['medias'],$_SESSION['folder']); + +if(!empty($_POST['token'])) { + $plxMedias->uploadFiles($_FILES, $_POST); +} + +outputJSON('upload.php', 'Debug'); +exit; + +// Check for errors +if($_FILES['SelectedFile']['error'] > 0){ + outputJSON('An error ocurred when uploading.'); +} +/* +if(!getimagesize($_FILES['SelectedFile']['tmp_name'])){ + outputJSON('Please ensure you are uploading an image.'); +} +*/ +// Check filetype +/* +if($_FILES['SelectedFile']['type'] != 'image/png'){ + outputJSON('Unsupported filetype uploaded.'); +} + +// Check filesize +if($_FILES['SelectedFile']['size'] > 500000){ + outputJSON('File uploaded exceeds maximum upload size.'); +} +*/ +// Check if the file exists +if(file_exists('uploads/' . $_FILES['SelectedFile']['name'])){ + outputJSON('File with that name already exists - '.$_FILES['SelectedFile']['name']); +} + +// Upload file +if(!move_uploaded_file($_FILES['SelectedFile']['tmp_name'], 'uploads/' . $_FILES['SelectedFile']['name'])){ + outputJSON('Error uploading file - check destination is writeable.'); +} + +// Success! +outputJSON('File uploaded successfully to "' . 'uploads/' . $_FILES['SelectedFile']['name'] . '".', 'success'); \ No newline at end of file diff --git a/core/lib/filedrag.js b/core/lib/filedrag.js new file mode 100644 index 000000000..369807765 --- /dev/null +++ b/core/lib/filedrag.js @@ -0,0 +1,199 @@ +(function() { + + var usrFiles = []; + var fileSelect = $id("myfiles"); + var fileDrag = $id("filedrag"); + var btnUpload = $id("btn_upload"); + var btnReset = $id("btn_reset"); + var Token = $$id('token'); + + var resize = $$id("resize"); + var user_w = $$id("user_w"); + var user_h = $$id("user_h"); + var thumb = $$id("thumb"); + var thumb_w = $$id("thumb_w"); + var thumb_h = $$id("thumb_h"); + + // getElementById + function $id(id) { + return document.getElementById(id); + } + + // getElementById + function $$id(id) { + return document.form_uploader.elements[id].value; + } + + // file drag hover + function FileDragHover(e) { + e.stopPropagation(); + e.preventDefault(); + e.target.className = (e.type == "dragover" ? "hover" : ""); + } + + // file selection + function FileSelectHandler(e) { + + // cancel event and hover styling + FileDragHover(e); + + // fetch FileList object + var files = e.target.files || e.dataTransfer.files; + + // unique id + var uid = (new Date().getTime()).toString(10); + + // process all File objects + for (var i = 0; i < files.length; i++) { + var f = { + file : files[i], + fid : 'p_' + uid + '_' + i + }; + div = document.createElement("div"); + div.setAttribute("id", f.fid); + div.setAttribute("class", "progress"); + $id("progress").appendChild(div); + usrFiles.push(f); + ParseFile(f); + } + + btnUpload.style.display = "inline-block"; + btnReset.style.display = "inline-block"; + + } + + // output file information + function ParseFile(f) { + + // display image file + var reader = new FileReader(); + reader.onload = function(e) { + // image + var img = document.createElement("img"); + img.setAttribute("src", f.file.type.indexOf("image") == 0 ? e.target.result : 'theme/images/file.png'); + img.setAttribute("title", f.file.name); + $id(f.fid).appendChild(img); + // delete link + var lnkDelete = document.createElement('a'); + lnkDelete.setAttribute('href', 'javascript:void(0)'); + lnkDelete.innerHTML = '✖'; + lnkDelete.setAttribute("class","btn_delete"); + lnkDelete.setAttribute("className","btn_delete"); /* Hack IE */ + lnkDelete.onclick = function(){ + var div = $id(f.fid); + div.parentNode.removeChild(div); + // remove file from usrFile array + for(var i=0;i 10) { + s = s.substring(0,5) + '...' + getFilePathExtension(s); + } + $id(f.fid).appendChild(document.createTextNode(s)); + } + reader.readAsDataURL(f.file); + } + + function getFilePathExtension(path) { + var filename = path.split('\\').pop().split('/').pop(); + return filename.substr(( Math.max(0, filename.lastIndexOf(".")) || Infinity) + 1); + } + + function UploadFiles(f) { + + var xhr = new XMLHttpRequest(); + if (xhr.upload) { + + var progress = $id(f.fid).appendChild(document.createElement("p")); + progress.setAttribute('class', 'progress'); + + // progress bar + xhr.upload.addEventListener("progress", function(e) { + var pc = parseInt(100 - (e.loaded / e.total * 100)); + progress.style.backgroundPosition = pc + "% 0"; + }, false); + + xhr.onreadystatechange = function(){ + if(xhr.readyState == 4){ + try { + var resp = JSON.parse(xhr.response); + } catch (e){ + var resp = { + status: 'error', + data: 'Unknown error occurred: [' + xhr.responseText + ']' + }; + } + progress.className = (resp.status=='error' ? "failed": "success"); + console.log(resp.status + ': ' + resp.data); + } + }; + + var data = new FormData(); + data.append('myfiles', f.file); + data.append('token', Token); + data.append('resize', resize); + data.append('user_w', user_w); + data.append('user_h', user_h); + data.append('thumb', thumb); + data.append('thumb_w', thumb_w); + data.append('thumb_h', thumb_h); + + // start upload + xhr.open("POST", 'upload.php', true); + xhr.send(data); + + } + + } + + // initialize + function Init() { + + // file select + fileSelect.addEventListener("change", FileSelectHandler, false); + + // is XHR2 available? + var xhr = new XMLHttpRequest(); + if (xhr.upload) { + fileDrag.addEventListener("dragover", FileDragHover, false); + fileDrag.addEventListener("dragleave", FileDragHover, false); + fileDrag.addEventListener("drop", FileSelectHandler, false); + fileDrag.addEventListener("click", function(){ fileSelect.click() }, false); + } + + btnUpload.addEventListener('click', function(e) { + e.stopPropagation(); + e.preventDefault(); + for (var i = 0; i < usrFiles.length; i++) { + UploadFiles(usrFiles[i]); + } + }); + + btnReset.addEventListener('click', function(e) { + e.stopPropagation(); + e.preventDefault(); + usrFiles.splice(0); // reset array + $id('progress').innerHTML = ''; + btnUpload.style.display = "none"; + btnReset.style.display = "none"; + }); + + } + + // call initialization file + if (window.File && window.FileList && window.FileReader) { + Init(); + } + +})(); \ No newline at end of file From 4badd6548f1f82c32352949940b50ca75f962503 Mon Sep 17 00:00:00 2001 From: Stephane Date: Wed, 1 Mar 2017 11:01:19 +0100 Subject: [PATCH 08/19] dragdrop --- core/admin/medias.php | 20 ++++++++++-- core/admin/theme/theme.css | 58 ++++++++++++++++++++++++++++++++++- core/lib/class.plx.medias.php | 18 ++++++++++- 3 files changed, 91 insertions(+), 5 deletions(-) diff --git a/core/admin/medias.php b/core/admin/medias.php index c1cc22b2b..1969b4a9f 100644 --- a/core/admin/medias.php +++ b/core/admin/medias.php @@ -115,7 +115,7 @@ plxPlugins->callHook('AdminMediasTop')) # Hook Plugins ?> -
+
@@ -215,7 +215,7 @@
-
+ @@ -243,10 +242,24 @@

: maxUpload['display'] ?>

+
+ +
Drop files here or click to select
+
+
+
+ + +
+ + +
@@ -344,6 +357,7 @@ function copy(elt, data) { } } + $msg, + 'status' => $status + ))); + } /** * Méthode qui envoie une liste de fichiers sur le serveur @@ -330,6 +338,11 @@ private function _uploadFile($file, $resize, $thumb) { **/ public function uploadFiles($usrfiles, $post) { + echo "
";
+	print_r($_FILES);
+	print_r($_POST);
+	die;
+	/*
 		$files = array();
 		if(isset($post['myfiles'])) {
 			foreach($post['myfiles'] as $key => $val) {
@@ -341,7 +354,10 @@ public function uploadFiles($usrfiles, $post) {
 				);
 			}
 		}
-
+	*/
+		$files = $usrfiles;
+		
+		
 		$count=0;
 		foreach($files as $file) {
 			$resize = false;

From c1c8655d9f653744fa7e7f17850a0c1305e61bbc Mon Sep 17 00:00:00 2001
From: Stephane 
Date: Wed, 1 Mar 2017 13:00:50 +0100
Subject: [PATCH 09/19] drag & drop medias

---
 core/admin/medias.php         | 19 +++-------
 core/admin/upload.php         | 51 +++-----------------------
 core/lang/de/admin.php        |  1 +
 core/lang/en/admin.php        |  1 +
 core/lang/es/admin.php        |  6 ++--
 core/lang/fr/admin.php        |  1 +
 core/lang/it/admin.php        |  3 +-
 core/lang/nl/admin.php        |  3 +-
 core/lang/oc/admin.php        |  3 +-
 core/lang/pl/admin.php        |  3 +-
 core/lang/pt/admin.php        |  3 +-
 core/lang/ro/admin.php        |  3 +-
 core/lang/ru/admin.php        |  1 +
 core/lib/class.plx.medias.php | 52 +++++++++++++++++++++------
 core/lib/filedrag.js          | 67 +++++++++++++++--------------------
 themes/defaut/article.php     |  4 ++-
 themes/defaut/header.php      |  2 ++
 themes/defaut/static.php      |  2 ++
 18 files changed, 107 insertions(+), 118 deletions(-)

diff --git a/core/admin/medias.php b/core/admin/medias.php
index 1969b4a9f..b0f5b655d 100644
--- a/core/admin/medias.php
+++ b/core/admin/medias.php
@@ -235,31 +235,22 @@
 				}
 				?>
 			

+ +
-

+

: maxUpload['display'] ?>

-
Drop files here or click to select
+
-
- - -
- -
@@ -357,7 +348,7 @@ function copy(elt, data) { } } - + $msg, - 'status' => $status - ))); -} - # validation du token de scurit if($_SERVER['REQUEST_METHOD']=='POST' AND isset($_SESSION['formtoken'])) { if(empty($_POST['token']) OR plxUtils::getValue($_SESSION['formtoken'][$_POST['token']]) < time() - 3600) { # 3600 seconds unset($_SESSION['formtoken']); die('Security error : invalid or expired token'); } +} else { + die; } # Scurisation du chemin du dossier @@ -47,41 +40,7 @@ function outputJSON($msg, $status = 'error'){ $plxMedias = new plxMedias(PLX_ROOT.$_SESSION['medias'],$_SESSION['folder']); if(!empty($_POST['token'])) { - $plxMedias->uploadFiles($_FILES, $_POST); -} - -outputJSON('upload.php', 'Debug'); -exit; - -// Check for errors -if($_FILES['SelectedFile']['error'] > 0){ - outputJSON('An error ocurred when uploading.'); -} -/* -if(!getimagesize($_FILES['SelectedFile']['tmp_name'])){ - outputJSON('Please ensure you are uploading an image.'); -} -*/ -// Check filetype -/* -if($_FILES['SelectedFile']['type'] != 'image/png'){ - outputJSON('Unsupported filetype uploaded.'); -} - -// Check filesize -if($_FILES['SelectedFile']['size'] > 500000){ - outputJSON('File uploaded exceeds maximum upload size.'); -} -*/ -// Check if the file exists -if(file_exists('uploads/' . $_FILES['SelectedFile']['name'])){ - outputJSON('File with that name already exists - '.$_FILES['SelectedFile']['name']); -} - -// Upload file -if(!move_uploaded_file($_FILES['SelectedFile']['tmp_name'], 'uploads/' . $_FILES['SelectedFile']['name'])){ - outputJSON('Error uploading file - check destination is writeable.'); + $plxMedias->outputJSON('', $plxMedias->uploadFile($_FILES, $_POST)); } -// Success! -outputJSON('File uploaded successfully to "' . 'uploads/' . $_FILES['SelectedFile']['name'] . '".', 'success'); \ No newline at end of file +exit; \ No newline at end of file diff --git a/core/lang/de/admin.php b/core/lang/de/admin.php index c3ce45eff..112a30ff3 100644 --- a/core/lang/de/admin.php +++ b/core/lang/de/admin.php @@ -274,6 +274,7 @@ 'L_MEDIAS_LINK_COPYCLP' => 'Link kopieren kopieren', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Können Sie den Link in die Zwischenablage zu kopieren', 'L_MEDIAS_LINK_COPYCLP_DONE' => 'Link kopiert', +'L_MEDIAS_DROP_CLICK' => 'Drop-Dateien hier oder klicken Sie auf wählen', 'L_SORT_ASCENDING_DATE' => 'Datum aufsteigend', 'L_SORT_DESCENDING_DATE' => 'Datum absteigend', 'L_SORT_ALPHABETICAL' => 'alphabetisch', diff --git a/core/lang/en/admin.php b/core/lang/en/admin.php index f6dd5c333..d9ebeab1c 100644 --- a/core/lang/en/admin.php +++ b/core/lang/en/admin.php @@ -282,6 +282,7 @@ 'L_MEDIAS_LINK_COPYCLP' => 'Copy link to clipboard', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Unable to copy link to clipboard', 'L_MEDIAS_LINK_COPYCLP_DONE' => 'Copied link', +'L_MEDIAS_DROP_CLICK' => 'Drop files here or click to select', 'L_CONFIG_VIEW_FIELD' => 'Display preferences', 'L_CONFIG_VIEW_SKIN_SELECT' => 'Skin', 'L_CONFIG_VIEW_FILES_EDIT_TITLE' => 'Edit theme files', diff --git a/core/lang/es/admin.php b/core/lang/es/admin.php index 70f010ebd..082f8bdc5 100644 --- a/core/lang/es/admin.php +++ b/core/lang/es/admin.php @@ -82,7 +82,7 @@ 'L_PLXMEDIAS_RECREATE_THUMBS_ERR' => 'Error al crear las miniaturas', 'L_PLXMEDIAS_RECREATE_THUMB_SUCCESSFUL' => 'Miniatura creada correctamente', 'L_PLXMEDIAS_RECREATE_THUMBS_SUCCESSFUL' => 'Miniaturas creadas correctamente', - + # article.php 'L_DEFAULT_NEW_ARTICLE_TITLE' => 'Nuevo artículo', @@ -325,7 +325,8 @@ 'L_MEDIAS_RECREATE_THUMB' => 'Crear miniatura nuevamente', 'L_MEDIAS_LINK_COPYCLP' => 'Copiar enlace al portapapeles', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'No se puede copiar el enlace en el portapapeles', -'L_MEDIAS_LINK_COPYCLP_DONE' => 'Enlace copiado', +'L_MEDIAS_LINK_COPYCLP_DONE' => 'Enlace copiado', +'L_MEDIAS_DROP_CLICK' => 'Soltar archivos aquí o hacer clic para seleccionar', # parametres_affichage.php @@ -566,5 +567,6 @@ 'L_HELP_TITLE' => 'Consulte la ayuda', 'L_BACK_TO_THEMES' => 'Volver a la lista de temas', 'L_CONFIG_THEME_UPDATE' => 'Cambiar tema', + ); ?> \ No newline at end of file diff --git a/core/lang/fr/admin.php b/core/lang/fr/admin.php index 532706d02..fbecd8730 100644 --- a/core/lang/fr/admin.php +++ b/core/lang/fr/admin.php @@ -330,6 +330,7 @@ 'L_MEDIAS_LINK_COPYCLP' => 'Copier le lien dans le presse-papier', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Impossible de copier le lien dans le presse-papier', 'L_MEDIAS_LINK_COPYCLP_DONE' => 'Lien copié', +'L_MEDIAS_DROP_CLICK' => 'Déposez des fichiers ici ou cliquez pour sélectionner', # parametres_affichage.php diff --git a/core/lang/it/admin.php b/core/lang/it/admin.php index 80e33b8b7..3fdd2751b 100644 --- a/core/lang/it/admin.php +++ b/core/lang/it/admin.php @@ -272,7 +272,8 @@ 'L_MEDIAS_RECREATE_THUMB' => 'Ricrea thumbnail', 'L_MEDIAS_LINK_COPYCLP' => 'Copia collegamento negli Appunti', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Impossibile copiare il link negli appunti', -'L_MEDIAS_LINK_COPYCLP_DONE' => 'Link copiato', +'L_MEDIAS_LINK_COPYCLP_DONE' => 'Link copiato', +'L_MEDIAS_DROP_CLICK' => 'Drop dei file qui o fare clic per selezionare', 'L_SORT_ASCENDING_DATE' => 'data ascendente', 'L_SORT_DESCENDING_DATE' => 'data discendente', 'L_SORT_ALPHABETICAL' => 'alfabetico', diff --git a/core/lang/nl/admin.php b/core/lang/nl/admin.php index c6512ab38..b9d1fe62c 100644 --- a/core/lang/nl/admin.php +++ b/core/lang/nl/admin.php @@ -272,7 +272,8 @@ 'L_MEDIAS_RECREATE_THUMB' => 'Opnieuw thumbnail', 'L_MEDIAS_LINK_COPYCLP' => 'Kopieer Link naar klembord', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Niet in staat om de link te kopiëren naar het klembord', -'L_MEDIAS_LINK_COPYCLP_DONE' => 'Koppeling gekopieerd', +'L_MEDIAS_LINK_COPYCLP_DONE' => 'Koppeling gekopieerd', +'L_MEDIAS_DROP_CLICK' => 'Drop bestanden hier of klik om te selecteren', 'L_SORT_ASCENDING_DATE' => 'datum oplopend', 'L_SORT_DESCENDING_DATE' => 'datum aflopend', 'L_SORT_ALPHABETICAL' => 'alfabetisch', diff --git a/core/lang/oc/admin.php b/core/lang/oc/admin.php index 941885374..39c3f4f0d 100644 --- a/core/lang/oc/admin.php +++ b/core/lang/oc/admin.php @@ -325,7 +325,8 @@ 'L_MEDIAS_RECREATE_THUMB' => 'Recrear miniaturas', 'L_MEDIAS_LINK_COPYCLP' => 'Copiar lo ligam al quichapapièrs', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Fracàs de la còpia del ligam al quichapapièrs', -'L_MEDIAS_LINK_COPYCLP_DONE' => 'Ligam copiat', +'L_MEDIAS_LINK_COPYCLP_DONE' => 'Ligam copiat', +'L_MEDIAS_DROP_CLICK' => 'Déposez des fichiers ici ou cliquez pour sélectionner', # parametres_affichage.php diff --git a/core/lang/pl/admin.php b/core/lang/pl/admin.php index 1e7ac8efc..fc9107d4e 100644 --- a/core/lang/pl/admin.php +++ b/core/lang/pl/admin.php @@ -326,7 +326,8 @@ 'L_MEDIAS_RECREATE_THUMB' => 'Recréer miniatures', 'L_MEDIAS_LINK_COPYCLP' => 'Skopiuj link do schowka', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Nie można skopiować link do schowka', -'L_MEDIAS_LINK_COPYCLP_DONE' => 'Link został skopiowany', +'L_MEDIAS_LINK_COPYCLP_DONE' => 'Link został skopiowany', +'L_MEDIAS_DROP_CLICK' => 'Upuść pliki tutaj lub kliknij, aby zaznaczyć', # parametres_affichage.php diff --git a/core/lang/pt/admin.php b/core/lang/pt/admin.php index a0daf96cf..3d2f70d65 100644 --- a/core/lang/pt/admin.php +++ b/core/lang/pt/admin.php @@ -272,7 +272,8 @@ 'L_MEDIAS_RECREATE_THUMB' => 'Recriar de miniaturas', 'L_MEDIAS_LINK_COPYCLP' => 'Copy Link para área de transferência', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Não é possível copiar o link para a área de transferência', -'L_MEDIAS_LINK_COPYCLP_DONE' => 'Link copiado', +'L_MEDIAS_LINK_COPYCLP_DONE' => 'Link copiado', +'L_MEDIAS_DROP_CLICK' => 'Solte arquivos aqui ou clique para selecionar', 'L_SORT_ASCENDING_DATE' => 'data ascendente', 'L_SORT_DESCENDING_DATE' => 'data decrescente', 'L_SORT_ALPHABETICAL' => 'alfabético', diff --git a/core/lang/ro/admin.php b/core/lang/ro/admin.php index 0ffa133d0..41dbc8cff 100644 --- a/core/lang/ro/admin.php +++ b/core/lang/ro/admin.php @@ -272,7 +272,8 @@ 'L_MEDIAS_RECREATE_THUMB' => 'Recreează miniatură', 'L_MEDIAS_LINK_COPYCLP' => 'Copiați linkul în clipboard', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Imposibil de copiat link-ul în clipboard', -'L_MEDIAS_LINK_COPYCLP_DONE' => 'link-ul copiat', +'L_MEDIAS_LINK_COPYCLP_DONE' => 'link-ul copiat', +'L_MEDIAS_DROP_CLICK' => 'Aici fișiere sau faceți clic pentru a selecta', 'L_SORT_ASCENDING_DATE' => 'data crescator', 'L_SORT_DESCENDING_DATE' => 'descendentă Data', 'L_SORT_ALPHABETICAL' => 'alfabetic', diff --git a/core/lang/ru/admin.php b/core/lang/ru/admin.php index f52f165ab..5d697783e 100644 --- a/core/lang/ru/admin.php +++ b/core/lang/ru/admin.php @@ -329,6 +329,7 @@ 'L_MEDIAS_LINK_COPYCLP' => 'Скопировать ссылку в буфер обмена', 'L_MEDIAS_LINK_COPYCLP_ERR' => 'Невозможно скопировать ссылку в буфер обмена', 'L_MEDIAS_LINK_COPYCLP_DONE' => 'ссылка скопирована', +'L_MEDIAS_DROP_CLICK' => 'Перетащите сюда файлы или выберите', # parametres_affichage.php diff --git a/core/lib/class.plx.medias.php b/core/lib/class.plx.medias.php index 0d66db3d9..8fbec59a2 100644 --- a/core/lib/class.plx.medias.php +++ b/core/lib/class.plx.medias.php @@ -319,8 +319,8 @@ private function _uploadFile($file, $resize, $thumb) { } return L_PLXMEDIAS_UPLOAD_SUCCESSFUL; } - - private function outputJSON($msg, $status = 'error') { + + public function outputJSON($msg, $status = 'error') { header('Content-Type: application/json'); die(json_encode(array( 'data' => $msg, @@ -328,6 +328,44 @@ private function outputJSON($msg, $status = 'error') { ))); } + /** + * Méthode qui envoie un fichier sur le serveur + * + * @param usrfile fichier utilisateur à uploader + * @param post paramètres + * @return msg résultat de l'envoi des fichiers + * @author Stephane F + **/ + public function uploadFile($usrfile, $post) { + + $file = array( + 'name' => $usrfile['myfiles']['name'], + 'size' => $usrfile['myfiles']['size'], + 'tmp_name' => $usrfile['myfiles']['tmp_name'], + ); + + $resize = false; + $thumb = false; + if(!empty($post['resize'])) { + if($post['resize']=='user') { + $resize = array('width' => intval($post['user_w']), 'height' => intval($post['user_h'])); + } else { + list($width,$height) = explode('x', $post['resize']); + $resize = array('width' => $width, 'height' => $height); + } + } + if(!empty($post['thumb'])) { + if($post['thumb']=='user') { + $thumb = array('width' => intval($post['thumb_w']), 'height' => intval($post['thumb_h'])); + } else { + list($width,$height) = explode('x', $post['thumb']); + $thumb = array('width' => $width, 'height' => $height); + } + } + return $this->_uploadFile($file, $resize, $thumb); + + } + /** * Méthode qui envoie une liste de fichiers sur le serveur * @@ -338,11 +376,6 @@ private function outputJSON($msg, $status = 'error') { **/ public function uploadFiles($usrfiles, $post) { - echo "
";
-	print_r($_FILES);
-	print_r($_POST);
-	die;
-	/*
 		$files = array();
 		if(isset($post['myfiles'])) {
 			foreach($post['myfiles'] as $key => $val) {
@@ -354,10 +387,7 @@ public function uploadFiles($usrfiles, $post) {
 				);
 			}
 		}
-	*/
-		$files = $usrfiles;
-		
-		
+
 		$count=0;
 		foreach($files as $file) {
 			$resize = false;
diff --git a/core/lib/filedrag.js b/core/lib/filedrag.js
index 369807765..17f8159b9 100644
--- a/core/lib/filedrag.js
+++ b/core/lib/filedrag.js
@@ -1,26 +1,18 @@
 (function() {
-	
+
 	var usrFiles = [];
 	var fileSelect = $id("myfiles");
 	var fileDrag = $id("filedrag");
 	var btnUpload = $id("btn_upload");
 	var btnReset = $id("btn_reset");
-	var Token = $$id('token');
-	
-	var resize = $$id("resize");
-	var user_w = $$id("user_w");
-	var user_h = $$id("user_h");
-	var thumb = $$id("thumb");
-	var thumb_w = $$id("thumb_w");
-	var thumb_h = $$id("thumb_h");	
 
 	// getElementById
 	function $id(id) {
 		return document.getElementById(id);
 	}
-	
-	// getElementById
-	function $$id(id) {
+
+	// form field value
+	function $_id(id) {
 		return document.form_uploader.elements[id].value;
 	}
 
@@ -30,13 +22,13 @@
 		e.preventDefault();
 		e.target.className = (e.type == "dragover" ? "hover" : "");
 	}
-	
+
 	// file selection
 	function FileSelectHandler(e) {
 
 		// cancel event and hover styling
 		FileDragHover(e);
-		
+
 		// fetch FileList object
 		var files = e.target.files || e.dataTransfer.files;
 
@@ -45,23 +37,23 @@
 
 		// process all File objects
 		for (var i = 0; i < files.length; i++) {
-			var f = { 
-				file : files[i], 
-				fid : 'p_' + uid + '_' + i 
+			var f = {
+				file : files[i],
+				fid : 'p_' + uid + '_' + i
 			};
 			div = document.createElement("div");
 			div.setAttribute("id", f.fid);
 			div.setAttribute("class", "progress");
 			$id("progress").appendChild(div);
-			usrFiles.push(f);	
+			usrFiles.push(f);
 			ParseFile(f);
 		}
-		
+
 		btnUpload.style.display = "inline-block";
 		btnReset.style.display = "inline-block";
-		
+
 	}
-	
+
 	// output file information
 	function ParseFile(f) {
 
@@ -69,7 +61,7 @@
 		var reader = new FileReader();
 		reader.onload = function(e) {
 			// image
-			var img = document.createElement("img");	
+			var img = document.createElement("img");
 			img.setAttribute("src", f.file.type.indexOf("image") == 0 ? e.target.result : 'theme/images/file.png');
 			img.setAttribute("title", f.file.name);
 			$id(f.fid).appendChild(img);
@@ -117,7 +109,7 @@
 
 			var progress = $id(f.fid).appendChild(document.createElement("p"));
 			progress.setAttribute('class', 'progress');
-			
+
 			// progress bar
 			xhr.upload.addEventListener("progress", function(e) {
 				var pc = parseInt(100 - (e.loaded / e.total * 100));
@@ -141,22 +133,21 @@
 
 			var data = new FormData();
 			data.append('myfiles', f.file);
-			data.append('token', Token);
-			data.append('resize', resize);
-			data.append('user_w', user_w);
-			data.append('user_h', user_h);
-			data.append('thumb', thumb);
-			data.append('thumb_w', thumb_w);
-			data.append('thumb_h', thumb_h);	
-			
+			data.append('token', $_id('token'));
+			data.append('resize', $_id('resize'));
+			data.append('user_w', $_id('user_w'));
+			data.append('user_h', $_id('user_h'));
+			data.append('thumb', $_id('thumb'));
+			data.append('thumb_w', $_id('thumb_w'));
+			data.append('thumb_h', $_id('thumb_h'));
 			// start upload
 			xhr.open("POST", 'upload.php', true);
 			xhr.send(data);
 
-		} 
+		}
 
 	}
-	
+
 	// initialize
 	function Init() {
 
@@ -170,16 +161,16 @@
 			fileDrag.addEventListener("dragleave", FileDragHover, false);
 			fileDrag.addEventListener("drop", FileSelectHandler, false);
 			fileDrag.addEventListener("click", function(){ fileSelect.click() }, false);
-		} 
-		
+		}
+
 		btnUpload.addEventListener('click', function(e) {
 			e.stopPropagation();
 			e.preventDefault();
 			for (var i = 0; i < usrFiles.length; i++) {
 				UploadFiles(usrFiles[i]);
 			}
-		});		
-		
+		});
+
 		btnReset.addEventListener('click', function(e) {
 			e.stopPropagation();
 			e.preventDefault();
@@ -187,7 +178,7 @@
 			$id('progress').innerHTML = '';
 			btnUpload.style.display = "none";
 			btnReset.style.display = "none";
-		});			
+		});
 
 	}
 
diff --git a/themes/defaut/article.php b/themes/defaut/article.php
index d7c38853d..12766e87b 100644
--- a/themes/defaut/article.php
+++ b/themes/defaut/article.php
@@ -29,7 +29,9 @@
 
 						artThumbnail(); ?>
 						artContent(); ?>
-
+						
+						callHook('MyMultiLingue', 'artlinks')) ?>
+						
 						
diff --git a/themes/defaut/header.php b/themes/defaut/header.php index 86b274196..21a790cc7 100644 --- a/themes/defaut/header.php +++ b/themes/defaut/header.php @@ -38,3 +38,5 @@

subTitle(); ?>

+ + callHook('MyMultiLingue')) ?> \ No newline at end of file diff --git a/themes/defaut/static.php b/themes/defaut/static.php index ea91d94a1..3ddf7e2e7 100644 --- a/themes/defaut/static.php +++ b/themes/defaut/static.php @@ -17,6 +17,8 @@ staticContent(); ?> + + callHook('MyMultiLingue', 'staticlinks')) ?>
From bb459689f1677e4531a8a415ba105a72682fd47a Mon Sep 17 00:00:00 2001 From: Stephane Date: Wed, 1 Mar 2017 13:21:14 +0100 Subject: [PATCH 10/19] drap & drop: gestion erreur upload fichiers --- core/admin/upload.php | 22 ++++++++++++++++++++-- core/lib/class.plx.medias.php | 8 ++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/core/admin/upload.php b/core/admin/upload.php index 969fae2df..d2255ab50 100644 --- a/core/admin/upload.php +++ b/core/admin/upload.php @@ -6,7 +6,7 @@ * @package PLX * @author Stephane F **/ - + include(dirname(__FILE__).'/prepend.php'); # validation du token de scurit @@ -40,7 +40,25 @@ $plxMedias = new plxMedias(PLX_ROOT.$_SESSION['medias'],$_SESSION['folder']); if(!empty($_POST['token'])) { - $plxMedias->outputJSON('', $plxMedias->uploadFile($_FILES, $_POST)); + $res = $plxMedias->uploadFile($_FILES, $_POST); + /* + switch($res) { + case L_PLXMEDIAS_WRONG_FILESIZE: + plxMsg::Error(L_PLXMEDIAS_WRONG_FILESIZE); + break; + case L_PLXMEDIAS_WRONG_FILEFORMAT: + plxMsg::Error(L_PLXMEDIAS_WRONG_FILEFORMAT); + break; + case L_PLXMEDIAS_UPLOAD_ERR: + plxMsg::Error(L_PLXMEDIAS_UPLOAD_ERR); + break; + case L_PLXMEDIAS_UPLOAD_SUCCESSFUL: + plxMsg::Info(L_PLXMEDIAS_UPLOAD_SUCCESSFUL); + break; + } + */ + $plxMedias->outputJSON($res, ($res == L_PLXMEDIAS_UPLOAD_SUCCESSFUL ? '' : 'error')); + } exit; \ No newline at end of file diff --git a/core/lib/class.plx.medias.php b/core/lib/class.plx.medias.php index 8fbec59a2..c6f8afd81 100644 --- a/core/lib/class.plx.medias.php +++ b/core/lib/class.plx.medias.php @@ -320,6 +320,13 @@ private function _uploadFile($file, $resize, $thumb) { return L_PLXMEDIAS_UPLOAD_SUCCESSFUL; } + /** + * Méthode qui renvoit une sortie au format JSON + * + * @param msg message + * @param statut status erreur + * @author Stephane F + **/ public function outputJSON($msg, $status = 'error') { header('Content-Type: application/json'); die(json_encode(array( @@ -362,6 +369,7 @@ public function uploadFile($usrfile, $post) { $thumb = array('width' => $width, 'height' => $height); } } + return $this->_uploadFile($file, $resize, $thumb); } From 3a22be4199e4b4aa9dedf89425a85161897ae655 Mon Sep 17 00:00:00 2001 From: Stephane Date: Wed, 1 Mar 2017 15:45:21 +0100 Subject: [PATCH 11/19] =?UTF-8?q?err=20propri=C3=A9t=C3=A9=20css=20hover?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/admin/theme/theme.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/admin/theme/theme.css b/core/admin/theme/theme.css index 31a2f67eb..0701b254c 100644 --- a/core/admin/theme/theme.css +++ b/core/admin/theme/theme.css @@ -579,7 +579,7 @@ div.copy div { border-radius: 7px; cursor: default; } -#form_uploader #filedrag.hover { +#form_uploader #filedrag:hover { color: #f00; border-color: #f00; border-style: solid; From 7e03d9e7778ce40293266308873795731bd46940 Mon Sep 17 00:00:00 2001 From: Stephane Date: Fri, 3 Mar 2017 09:31:16 +0100 Subject: [PATCH 12/19] ajout hook plxMotorRedir301 + fct redir301 --- core/lib/class.plx.motor.php | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/core/lib/class.plx.motor.php b/core/lib/class.plx.motor.php index f23dabd93..111aa06ef 100644 --- a/core/lib/class.plx.motor.php +++ b/core/lib/class.plx.motor.php @@ -87,7 +87,7 @@ protected function __construct($filename) { $this->path_url = str_replace(ltrim($var['path'], '\/'), '', ltrim($_SERVER['REQUEST_URI'], '\/')); # Traitement des plugins # Dtermination du fichier de langue (nb: la langue peut tre modifie par plugins via $_SESSION['lang']) - $lang = isset($_SESSION['lang']) ? $_SESSION['lang'] : $this->aConf['default_lang']; + $lang = isset($_SESSION['lang']) ? $_SESSION['lang'] : $this->aConf['default_lang']; $this->plxPlugins = new plxPlugins($lang); $this->plxPlugins->loadPlugins(); # Hook plugins @@ -142,10 +142,8 @@ public function prechauffage() { $this->motif = '/^'.$this->cible.'.((?:[0-9]|home|,)*(?:'.$this->activeCats.'|home)(?:[0-9]|home|,)*).[0-9]{3}.[0-9]{12}.[a-z0-9-]+.xml$/'; # Motif de recherche if($this->getArticles()) { # Redirection 301 - if($this->plxRecord_arts->f('url')!=$capture[2]) { - header('Status: 301 Moved Permanently', false, 301); - header('Location: '.$this->urlRewrite('?article'.intval($this->cible).'/'.$this->plxRecord_arts->f('url'))); - exit(); + if(!isset($capture[2]) OR $this->plxRecord_arts->f('url')!=$capture[2]) { + $this->redir301($this->urlRewrite('?article'.intval($this->cible).'/'.$this->plxRecord_arts->f('url'))); } } else { $this->error404(L_UNKNOWN_ARTICLE); @@ -158,18 +156,14 @@ public function prechauffage() { } else { if(!empty($this->aConf['homestatic']) AND $capture[1]){ if($this->aConf['homestatic']==$this->cible){ - header('Status: 301 Moved Permanently', false, 301); - header('Location: '.$this->urlRewrite()); - exit(); + $this->redir301($this->urlRewrite()); } } if($this->aStats[$this->cible]['url']==$capture[2]) { $this->mode = 'static'; # Mode static $this->template = $this->aStats[$this->cible]['template']; } else { - header('Status: 301 Moved Permanently', false, 301); - header('Location: '.$this->urlRewrite('?static'.intval($this->cible).'/'.$this->aStats[$this->cible]['url'])); - exit(); + $this->redir301($this->urlRewrite('?static'.intval($this->cible).'/'.$this->aStats[$this->cible]['url'])); } } } @@ -184,9 +178,7 @@ public function prechauffage() { } elseif(isset($this->aCats[$this->cible])) { # Redirection 301 if($this->aCats[$this->cible]['url']!=$capture[2]) { - header('Status: 301 Moved Permanently', false, 301); - header('Location: '.$this->urlRewrite('?categorie'.intval($this->cible).'/'.$this->aCats[$this->cible]['url'])); - exit(); + $this->redir301($this->urlRewrite('?categorie'.intval($this->cible).'/'.$this->aCats[$this->cible]['url'])); } } else { $this->error404(L_UNKNOWN_CATEGORY); @@ -248,6 +240,21 @@ public function prechauffage() { eval($this->plxPlugins->callHook('plxMotorPreChauffageEnd')); } + /** + * Mthode qui fait une redirection de type 301 + * + * @return null + * @author Stephane F + **/ + public function redir301($url) { + # Hook plugins + eval($this->plxPlugins->callHook('plxMotorRedir301')); + # Redirection 301 + header('Status: 301 Moved Permanently', false, 301); + header('Location: '.$url); + exit(); + } + /** * Mthode qui retourne une erreur 404 Document non trouv * From 1b89929bef6bd8f324ab165307926079a3f55d36 Mon Sep 17 00:00:00 2001 From: Stephane Date: Fri, 3 Mar 2017 09:31:35 +0100 Subject: [PATCH 13/19] maj changelog --- readme/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/readme/CHANGELOG b/readme/CHANGELOG index 5790ed1ae..f64fd6513 100644 --- a/readme/CHANGELOG +++ b/readme/CHANGELOG @@ -15,6 +15,7 @@ [+] Tri des articles par ordre aléatoire configurable à partir de l'administration (Paramètres > Options d'affichage et Catégories) [+] plxShow:templateCSS - Prise en compte des fichiers css minifiés si disponibles (contribution alexandre-lg) [+] Réglage de l'affichage de l'indentation des commentaires sur smartphones (contribution kowalsky) +[+] Ajout du hook plxMotorRedir301 dans la classe plxMotor [+] #69: plxAdmin:editArticle - ajout du hook plxAdminEditArticleEnd [+] #177: Ajout de la protection du lien téléphone (contribution cfdev) [+] #191: plxShow:catList - Ajout de la variable #cat_description From d57c16254014de479823d443990ee2355c9b9243 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Wed, 8 Mar 2017 23:51:31 +0100 Subject: [PATCH 14/19] dim. et tailles miniatures meme cols que images --- config.php | 2 +- core/admin/medias.php | 10 ++++++++-- core/admin/theme/theme.css | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config.php b/config.php index b3f1a7d7e..f24da0e0d 100644 --- a/config.php +++ b/config.php @@ -1,3 +1,3 @@ diff --git a/core/admin/medias.php b/core/admin/medias.php index 9a1f8fa2a..873870c37 100644 --- a/core/admin/medias.php +++ b/core/admin/medias.php @@ -193,15 +193,21 @@ if($isImage AND is_file($href)) { echo ''.L_MEDIAS_THUMB.''; echo '
'.L_MEDIAS_LINK_COPYCLP_DONE.'
'; - echo ' : '.$v['thumb']['infos'][0].' x '.$v['thumb']['infos'][1]. ' ('.plxUtils::formatFilesize($v['thumb']['filesize']).')'; } echo ''; echo ''.strtoupper($v['extension']).''; - echo ''.plxUtils::formatFilesize($v['filesize']).''; + echo ''.plxUtils::formatFilesize($v['filesize']); + if($isImage AND is_file($href)) { + echo '
'.plxUtils::formatFilesize($v['thumb']['filesize']); + } + echo ''; $dimensions = ' '; if($isImage AND (isset($v['infos']) AND isset($v['infos'][0]) AND isset($v['infos'][1]))) { $dimensions = $v['infos'][0].' x '.$v['infos'][1]; } + if($isImage AND is_file($href)) { + $dimensions .= '
'.$v['thumb']['infos'][0].' x '.$v['thumb']['infos'][1]; + } echo ''.$dimensions.''; echo ''.plxDate::formatDate(plxDate::timestamp2Date($v['date'])).''; echo ''; diff --git a/core/admin/theme/theme.css b/core/admin/theme/theme.css index de6d1230b..525f6b776 100644 --- a/core/admin/theme/theme.css +++ b/core/admin/theme/theme.css @@ -242,6 +242,12 @@ textarea { #medias-table { margin-top: 10px; } +#medias-table tbody tr td:nth-of-type(5) { + text-align: right; +} +#medias-table tbody tr td:nth-of-type(6) { + text-align: center; +} .publication input { font-weight: bold; color: #777; @@ -606,4 +612,4 @@ div.copy div { } #form_uploader .progress p.failed { background: #c00 none 0 0 no-repeat; -} +} \ No newline at end of file From e52625a149e8cc05759ac4cbbea40922b7631120 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Fri, 10 Mar 2017 23:43:52 +0100 Subject: [PATCH 15/19] Synchro core/admin/medias.php avec site PluXml --- core/admin/medias.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/core/admin/medias.php b/core/admin/medias.php index a4cb98f26..bf50183a0 100644 --- a/core/admin/medias.php +++ b/core/admin/medias.php @@ -115,7 +115,7 @@ plxPlugins->callHook('AdminMediasTop')) # Hook Plugins ?> - +
@@ -233,7 +233,7 @@
-
+ -

+

: maxUpload['display'] ?> maxPost['value'] > 0) echo " / ".L_MEDIAS_MAX_POST_SIZE." : ".$plxMedias->maxPost['display']; ?>

-
- -
+ +
-
-
@@ -403,7 +399,6 @@ function plugFilter() { dlg.style.display = "none"; } - Date: Fri, 17 Mar 2017 15:39:01 +0100 Subject: [PATCH 16/19] Ajout colonne email dans tableau utilisateurs --- core/admin/parametres_users.php | 5 +++++ core/admin/user.php | 2 +- core/lang/fr/admin.php | 2 +- core/lib/class.plx.admin.php | 9 ++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/core/admin/parametres_users.php b/core/admin/parametres_users.php index 6e598205d..2f55b4836 100644 --- a/core/admin/parametres_users.php +++ b/core/admin/parametres_users.php @@ -57,6 +57,7 @@ + @@ -78,6 +79,8 @@ echo ''; plxUtils::printInput($_userid.'_password', '', 'password', '10-255', false, '', '', 'onkeyup="pwdStrength(this.id)"'); echo ''; + plxUtils::printInput($_userid.'_email', plxUtils::strCheck($_user['email']), 'email', '10-255'); + echo ''; if($_userid=='001') { plxUtils::printInput($_userid.'_profil', $_user['profil'], 'hidden'); plxUtils::printInput($_userid.'_active', $_user['active'], 'hidden'); @@ -115,6 +118,8 @@ echo ''; plxUtils::printInput($new_userid.'_password', '', 'password', '10-255', false, '', '', 'onkeyup="pwdStrength(this.id)"'); echo ''; + plxUtils::printInput($new_userid.'_email', '', 'email', '10-255'); + echo ''; plxUtils::printSelect($new_userid.'_profil', $aProfils, PROFIL_WRITER); echo ''; plxUtils::printSelect($new_userid.'_active', array('1'=>L_YES,'0'=>L_NO), '1'); diff --git a/core/admin/user.php b/core/admin/user.php index d1450e222..856056f35 100644 --- a/core/admin/user.php +++ b/core/admin/user.php @@ -66,7 +66,7 @@
- aUsers[$id]['email']), 'text', '30-255') ?> + aUsers[$id]['email']), 'email', '30-255') ?>
diff --git a/core/lang/fr/admin.php b/core/lang/fr/admin.php index 931f9c951..9e320385b 100644 --- a/core/lang/fr/admin.php +++ b/core/lang/fr/admin.php @@ -577,4 +577,4 @@ 'L_BACK_TO_THEMES' => 'Retour à la page des thèmes', 'L_CONFIG_THEME_UPDATE' => 'Modifier le thème', ); -?> +?> \ No newline at end of file diff --git a/core/lib/class.plx.admin.php b/core/lib/class.plx.admin.php index 5cbd1f4ba..25f8080ed 100644 --- a/core/lib/class.plx.admin.php +++ b/core/lib/class.plx.admin.php @@ -324,9 +324,16 @@ public function editUsers($content, $action=false) { $this->aUsers[$user_id]['profil'] = ($_SESSION['user']==$user_id?$this->aUsers[$user_id]['profil']:$content[$user_id.'_profil']); $this->aUsers[$user_id]['password'] = $password; $this->aUsers[$user_id]['salt'] = $salt; + if(isset($content[$user_id.'_email'])) { + $email = trim($content[$user_id.'_email']); + if(empty($email)) { + $this->aUsers[$user_id]['email'] = ''; + } elseif(plxUtils::checkMail($email)) { + $this->aUsers[$user_id]['email'] = $email; + } + } $this->aUsers[$user_id]['delete'] = (isset($this->aUsers[$user_id]['delete'])?$this->aUsers[$user_id]['delete']:0); $this->aUsers[$user_id]['lang'] = (isset($this->aUsers[$user_id]['lang'])?$this->aUsers[$user_id]['lang']:$this->aConf['default_lang']); - $this->aUsers[$user_id]['email'] = (isset($this->aUsers[$user_id]['email'])?$this->aUsers[$user_id]['email']:''); $this->aUsers[$user_id]['infos'] = (isset($this->aUsers[$user_id]['infos'])?$this->aUsers[$user_id]['infos']:''); # Hook plugins eval($this->plxPlugins->callHook('plxAdminEditUsersUpdate')); From f873e59a1417e260bfed80faf1da214f97bc5065 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Sun, 19 Mar 2017 14:02:23 +0100 Subject: [PATCH 17/19] synchro core/admin/themes/admin.css avec upstream --- core/admin/theme/theme.css | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/core/admin/theme/theme.css b/core/admin/theme/theme.css index 4cbac6e0e..1429d1c7e 100644 --- a/core/admin/theme/theme.css +++ b/core/admin/theme/theme.css @@ -609,47 +609,10 @@ div.ico div { float: right; font-size: 28px; font-weight: bold; -<<<<<<< HEAD } .dialog-close:hover, .dialog-close:focus { color: #000; text-decoration: none; cursor: pointer; -======= - text-align: center; - padding: 1em 0; - margin: 1em 0; - color: #555; - border: 2px dashed #555; - border-radius: 7px; - cursor: default; -} -#form_uploader #filedrag:hover { - color: #f00; - border-color: #f00; - border-style: solid; -} -#form_uploader .progress { - display: inline-block; - width: 75px; - margin: 0 10px 10px 0; - font-size: 10px; - text-align: center; - overflow: hidden; -} -#form_uploader .progress img { - width: 100%; -} -#form_uploader .progress p { - background: #eee url("images/progress.png") 100% 0 repeat-y; - height: 5px; - margin: 0 0 2px; -} -#form_uploader .progress p.success { - background: #0c0 none 0 0 no-repeat; -} -#form_uploader .progress p.failed { - background: #c00 none 0 0 no-repeat; ->>>>>>> thumb_size } \ No newline at end of file From a307b23840a8bd2c381e37c62ac540bb0ba1ca54 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Tue, 21 Mar 2017 14:35:47 +0100 Subject: [PATCH 18/19] bugfix dans core/lib/class.plx.admin.php (email) --- core/lib/class.plx.admin.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/lib/class.plx.admin.php b/core/lib/class.plx.admin.php index 0149c7417..bd58184cb 100644 --- a/core/lib/class.plx.admin.php +++ b/core/lib/class.plx.admin.php @@ -328,7 +328,6 @@ public function editUsers($content, $action=false) { $this->aUsers[$user_id]['profil'] = ($_SESSION['user']==$user_id?$this->aUsers[$user_id]['profil']:$content[$user_id.'_profil']); $this->aUsers[$user_id]['password'] = $password; $this->aUsers[$user_id]['salt'] = $salt; -<<<<<<< HEAD if(isset($content[$user_id.'_email'])) { $email = trim($content[$user_id.'_email']); if(empty($email)) { @@ -337,10 +336,6 @@ public function editUsers($content, $action=false) { $this->aUsers[$user_id]['email'] = $email; } } -======= - $this->aUsers[$user_id]['email'] = $email; - ->>>>>>> master $this->aUsers[$user_id]['delete'] = (isset($this->aUsers[$user_id]['delete'])?$this->aUsers[$user_id]['delete']:0); $this->aUsers[$user_id]['lang'] = (isset($this->aUsers[$user_id]['lang'])?$this->aUsers[$user_id]['lang']:$this->aConf['default_lang']); $this->aUsers[$user_id]['infos'] = (isset($this->aUsers[$user_id]['infos'])?$this->aUsers[$user_id]['infos']:''); @@ -1090,4 +1085,4 @@ public function checkMaj() { } } -?> \ No newline at end of file +?> From aed79b7cd1c61b0d431659e0c7d87d5f7ef32061 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Sun, 19 Mar 2017 13:58:46 +0100 Subject: [PATCH 19/19] Gestion de '; echo ''; echo ''.$k.''; - plxUtils::printInput($k.'_name', plxUtils::strCheck($v['name']), 'text', '10-50'); + plxUtils::printInput($k.'_name', plxUtils::strCheck($v['name']), 'text', '-50'); echo ''; - plxUtils::printInput($k.'_url', $v['url'], 'text', '10-50'); + plxUtils::printInput($k.'_url', $v['url'], 'text', '-50'); echo ''; plxUtils::printSelect($k.'_active', array('1'=>L_YES,'0'=>L_NO), $v['active']); echo ''; plxUtils::printSelect($k.'_tri', $aTri, $v['tri']); echo ''; - plxUtils::printInput($k.'_bypage', $v['bypage'], 'text', '1-3'); + plxUtils::printInput($k.'_bypage', $v['bypage'], 'text', '-3'); echo ''; - plxUtils::printInput($k.'_ordre', $ordre, 'text', '1-3'); + plxUtils::printInput($k.'_ordre', $ordre, 'text', '-3'); echo ''; plxUtils::printSelect($k.'_menu', array('oui'=>L_DISPLAY,'non'=>L_HIDE), $v['menu']); echo ''; @@ -104,17 +104,17 @@ '; plxUtils::printInput($new_catid.'_template', 'categorie.php', 'hidden'); - plxUtils::printInput($new_catid.'_name', '', 'text', '10-50'); + plxUtils::printInput($new_catid.'_name', '', 'text', '-50'); echo ''; - plxUtils::printInput($new_catid.'_url', '', 'text', '10-50'); + plxUtils::printInput($new_catid.'_url', '', 'text', '-50'); echo ''; plxUtils::printSelect($new_catid.'_active', array('1'=>L_YES,'0'=>L_NO), '1'); echo ''; plxUtils::printSelect($new_catid.'_tri', $aTri, $plxAdmin->aConf['tri']); echo ''; - plxUtils::printInput($new_catid.'_bypage', $plxAdmin->aConf['bypage'], 'text', '1-3'); + plxUtils::printInput($new_catid.'_bypage', $plxAdmin->aConf['bypage'], 'text', '-3'); echo ''; - plxUtils::printInput($new_catid.'_ordre', ++$num, 'text', '1-3'); + plxUtils::printInput($new_catid.'_ordre', ++$num, 'text', '-3'); echo ''; plxUtils::printSelect($new_catid.'_menu', array('oui'=>L_DISPLAY,'non'=>L_HIDE), '1'); echo ' '; diff --git a/core/admin/parametres_users.php b/core/admin/parametres_users.php index 491be7495..076388395 100644 --- a/core/admin/parametres_users.php +++ b/core/admin/parametres_users.php @@ -73,13 +73,13 @@ echo ''; echo ''; echo ''.$_userid.''; - plxUtils::printInput($_userid.'_name', plxUtils::strCheck($_user['name']), 'text', '12-255'); + plxUtils::printInput($_userid.'_name', plxUtils::strCheck($_user['name']), 'text', ''); echo ''; - plxUtils::printInput($_userid.'_login', plxUtils::strCheck($_user['login']), 'text', '12-255'); + plxUtils::printInput($_userid.'_login', plxUtils::strCheck($_user['login']), 'text', ''); echo ''; - plxUtils::printInput($_userid.'_password', '', 'password', '10-255', false, '', '', 'onkeyup="pwdStrength(this.id)"'); + plxUtils::printInput($_userid.'_password', '', 'password', '', false, '', '', 'onkeyup="pwdStrength(this.id)"'); echo ''; - plxUtils::printInput($_userid.'_email', plxUtils::strCheck($_user['email']), 'email', '20-255'); + plxUtils::printInput($_userid.'_email', plxUtils::strCheck($_user['email']), 'email', ''); echo ''; if($_userid=='001') { plxUtils::printInput($_userid.'_profil', $_user['profil'], 'hidden'); @@ -111,14 +111,14 @@ '; plxUtils::printInput($new_userid.'_newuser', 'true', 'hidden'); - plxUtils::printInput($new_userid.'_name', '', 'text', '12-255'); + plxUtils::printInput($new_userid.'_name', '', 'text', ''); plxUtils::printInput($new_userid.'_infos', '', 'hidden'); echo ''; - plxUtils::printInput($new_userid.'_login', '', 'text', '12-255'); + plxUtils::printInput($new_userid.'_login', '', 'text', ''); echo ''; - plxUtils::printInput($new_userid.'_password', '', 'password', '10-255', false, '', '', 'onkeyup="pwdStrength(this.id)"'); + plxUtils::printInput($new_userid.'_password', '', 'password', '', false, '', '', 'onkeyup="pwdStrength(this.id)"'); echo ''; - plxUtils::printInput($new_userid.'_email', '', 'email', '20-255'); + plxUtils::printInput($new_userid.'_email', '', 'email', ''); echo ''; plxUtils::printSelect($new_userid.'_profil', $aProfils, PROFIL_WRITER); echo ''; diff --git a/core/admin/statiques.php b/core/admin/statiques.php index a57f235ca..40fcddc6a 100644 --- a/core/admin/statiques.php +++ b/core/admin/statiques.php @@ -87,15 +87,15 @@ function checkBox(cb) { $selected = $plxAdmin->aConf['homestatic']==$k ? ' checked="checked"' : ''; echo ''; echo ''; - plxUtils::printInput($k.'_group', plxUtils::strCheck($v['group']), 'text', '10-100'); + plxUtils::printInput($k.'_group', plxUtils::strCheck($v['group']), 'text', '-100'); echo ''; - plxUtils::printInput($k.'_name', plxUtils::strCheck($v['name']), 'text', '10-255'); + plxUtils::printInput($k.'_name', plxUtils::strCheck($v['name']), 'text', '-255'); echo ''; - plxUtils::printInput($k.'_url', $v['url'], 'text', '10-255'); + plxUtils::printInput($k.'_url', $v['url'], 'text', '-255'); echo ''; plxUtils::printSelect($k.'_active', array('1'=>L_YES,'0'=>L_NO), $v['active']); echo ''; - plxUtils::printInput($k.'_ordre', $ordre, 'text', '1-3'); + plxUtils::printInput($k.'_ordre', $ordre, 'text', '2-3'); echo ''; plxUtils::printSelect($k.'_menu', array('oui'=>L_DISPLAY,'non'=>L_HIDE), $v['menu']); $url = $v['url']; @@ -125,16 +125,16 @@ function checkBox(cb) { '; - plxUtils::printInput($new_staticid.'_group', '', 'text', '10-100'); + plxUtils::printInput($new_staticid.'_group', '', 'text', '-100'); echo ''; - plxUtils::printInput($new_staticid.'_name', '', 'text', '10-255'); + plxUtils::printInput($new_staticid.'_name', '', 'text', '-255'); plxUtils::printInput($new_staticid.'_template', 'static.php', 'hidden'); echo ''; - plxUtils::printInput($new_staticid.'_url', '', 'text', '10-255'); + plxUtils::printInput($new_staticid.'_url', '', 'text', '-255'); echo ''; plxUtils::printSelect($new_staticid.'_active', array('1'=>L_YES,'0'=>L_NO), '0'); echo ''; - plxUtils::printInput($new_staticid.'_ordre', ++$num, 'text', '1-3'); + plxUtils::printInput($new_staticid.'_ordre', ++$num, 'text', '2-3'); echo ''; plxUtils::printSelect($new_staticid.'_menu', array('oui'=>L_DISPLAY,'non'=>L_HIDE), '1'); ?> diff --git a/core/admin/theme/theme.css b/core/admin/theme/theme.css index d9fa04cd8..1e1a0dc6c 100644 --- a/core/admin/theme/theme.css +++ b/core/admin/theme/theme.css @@ -618,4 +618,17 @@ div.ico div { color: #000; text-decoration: none; cursor: pointer; +<<<<<<< f873e59a1417e260bfed80faf1da214f97bc5065 +======= +} + +#statics-table input:not([type="checkbox"]), +#categories-table input:not([type="checkbox"]), +#users-table input:not([type="checkbox"]) { + width: 100%; +} +input[maxlength="3"] { + width: 4rem !important; + text-align: right; +>>>>>>> Gestion de '."\n"; - else - echo ''."\n"; - } else { - echo ''."\n"; - } + public static function printInput($name, $value='', $type='text', $sizes='50-255', $readonly=false, $className='', $placeholder='', $extra='') { + + $params = array( + 'id="id_'.$name.'"', + 'name="'.$name.'"', + 'type="'.$type.'"' + ); + if(! empty($value)) { $params[] = 'value="'.$value.'"'; } + if(! empty($extra)) { $params[] = $extra; } + if($type != 'hidden') { + if($readonly === true) { $params[] = 'readony'; } + if(! empty($className)) { $params[] = $className; } + if(! empty($placeholder)) { $params[] = $placeholder; } + if(! empty($sizes) and (strpos($sizes, '-') !== false)) { + list($size, $maxlength) = explode('-', $sizes); + if(! empty($size)) { $params[] = 'size="'.$size.'"'; } + if(! empty($maxlength)) { $params[] = 'maxlength="'.$maxlength.'"'; } + } + } + echo ''; } /** @@ -1048,4 +1055,4 @@ public static function debug($obj) { echo ""; } } -?> +?> \ No newline at end of file