Skip to content

Commit fd23485

Browse files
committed
FIX Comments list sorting #419 (#420)
1 parent ee4bb9b commit fd23485

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

Diff for: core/admin/comments.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,19 @@
8787
$h2 = '<h2>'.L_COMMENTS_ALL_LIST.'</h2>';
8888
}
8989
elseif($comSel=='online') {
90-
$comSelMotif = '/^[0-9]{4}.(.*).xml$/';
90+
$comSelMotif = '/^\d{4}.(.*).xml$/';
9191
$_SESSION['selCom'] = 'online';
9292
$nbComPagination=$plxAdmin->nbComments('online');
9393
$h2 = '<h2>'.L_COMMENTS_ONLINE_LIST.'</h2>';
9494
}
9595
elseif($comSel=='offline') {
96-
$comSelMotif = '/^_[0-9]{4}.(.*).xml$/';
96+
$comSelMotif = '/^_\d{4}.(.*).xml$/';
9797
$_SESSION['selCom'] = 'offline';
9898
$nbComPagination=$plxAdmin->nbComments('offline');
9999
$h2 = '<h2>'.L_COMMENTS_OFFLINE_LIST.'</h2>';
100100
}
101101
elseif($comSel=='all') { // all
102-
$comSelMotif = '/^[[:punct:]]?[0-9]{4}.(.*).xml$/';
102+
$comSelMotif = '/^[[:punct:]]?\d{4}.(.*).xml$/';
103103
$_SESSION['selCom'] = 'all';
104104
$nbComPagination=$plxAdmin->nbComments('all');
105105
$h2 = '<h2>'.L_COMMENTS_ALL_LIST.'</h2>';

Diff for: core/lib/class.plx.motor.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -829,28 +829,29 @@ public function parentChildSort_r($idField, $parentField, $els, $parentID = 0, &
829829
* @param start commencement
830830
* @param limite nombre de commentaires à retourner
831831
* @param publi before, after ou all => on récupère tous les fichiers (date) ?
832-
* @return null
833-
* @author Florent MONTHEL, Stephane F
832+
* @return bool true if there is comments else false
833+
* @author Florent MONTHEL, Stephane F, Pedro "P3ter" CADETE
834834
**/
835835
public function getCommentaires($motif,$ordre='sort',$start=0,$limite=false,$publi='before') {
836836

837837
# On récupère les fichiers des commentaires
838838
$aFiles = $this->plxGlob_coms->query($motif,'com',$ordre,$start,$limite,$publi);
839839
if($aFiles) { # On a des fichiers
840-
foreach($aFiles as $k=>$v)
840+
foreach($aFiles as $k=>$v) {
841841
$array[$k] = $this->parseCommentaire(PLX_ROOT.$this->aConf['racine_commentaires'].$v);
842+
}
842843

843844
# hiérarchisation et indentation des commentaires seulement sur les écrans requis
844-
if( !(defined('plxAdmin::PLX_ADMIN') OR defined('plxFeed::PLX_FEED')) OR preg_match('#comment_new#',basename($_SERVER['SCRIPT_NAME']))) {
845+
if (!preg_match('#comments#',basename($_SERVER['SCRIPT_NAME']))) {
845846
$array = $this->parentChildSort_r('index', 'parent', $array);
846847
}
847848

848849
# On stocke les enregistrements dans un objet plxRecord
849850
$this->plxRecord_coms = new plxRecord($array);
850851

851-
return true;
852852
}
853-
else return false;
853+
854+
return !empty($aFiles);
854855
}
855856

856857
/**

Diff for: readme/CHANGELOG

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ FIX Headline and Tags toggles always closed in article edition #382 (sudwebdesig
77
FIX Error when adding or modifying a user #393 (P3ter)
88
FIX Alternative to PHPMailer with sendmail #401 (bazooka07)
99
FIX Used of an extern URL as a static page #403 (bazooka07)
10+
FIX Comments list sorting #419 (P3ter)
1011

1112
## PLUXML 5.8.2 (2020/02/09) ##
1213
[+] #371 Check PluXml update using javascript if "curl" or "file_get_contents" can not be used (bazooka07)

0 commit comments

Comments
 (0)