Dirty fix for ImageManager

Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5
#1
Hi,

Here is my quick and dirty fix for the imagemanager in the deletion problem (the 1.11.3 did not fix my problem).

The fix

in lib/FileManager/imagemanager/Classes/ImageManager.php

Line 373

Replace

Code :
if($key == $path)


with

Code :
if($key == $path || $key == $path."/")



The problem seems to be in the verification of relative path in line if( !$this->validRelativePath($r2) ) return false;
The getDirskeys have "/" at the end but the $r2 not and the compare return false...
#1
Hi,

Here is my quick and dirty fix for the imagemanager in the deletion problem (the 1.11.3 did not fix my problem).

The fix

in lib/FileManager/imagemanager/Classes/ImageManager.php

Line 373

Replace

Code :
if($key == $path)


with

Code :
if($key == $path || $key == $path."/")



The problem seems to be in the verification of relative path in line if( !$this->validRelativePath($r2) ) return false;
The getDirskeys have "/" at the end but the $r2 not and the compare return false...
#2
This did not fix the problem for me

But Ok for
The problem seems to be in the verification of relative path in line if( !$this->validRelativePath($r2) ) return false;
J-C Etiemble v 2.2.xx
#2
This did not fix the problem for me

But Ok for
The problem seems to be in the verification of relative path in line if( !$this->validRelativePath($r2) ) return false;
J-C Etiemble v 2.2.xx
#3
This cannot fix because we have if($path == '/') return true; in line 365
$path.'/' -> //
#3
This cannot fix because we have if($path == '/') return true; in line 365
$path.'/' -> //
#4
For your information.

Here is my complete validRelativePath method. Which solve the problem on my 1.11.3 install

Code :
    function validRelativePath($path)
    {
        $dirs = $this->getDirs();
        if($path == '/')
            Return true;
        //check the path given in the url against the
        //list of paths in the system.
        for($i = 0; $i < count($dirs); $i++)
        {
            $key = key($dirs);
            //we found the path
            if($key == $path || $key == $path."/")
                Return true;

            next($dirs);
        }
        Return false;
    }

The condition if($path == '/') is only for the root folder management. The code below this instruction manage all subfolders.

Regards,
#4
For your information.

Here is my complete validRelativePath method. Which solve the problem on my 1.11.3 install

Code :
    function validRelativePath($path)
    {
        $dirs = $this->getDirs();
        if($path == '/')
            Return true;
        //check the path given in the url against the
        //list of paths in the system.
        for($i = 0; $i < count($dirs); $i++)
        {
            $key = key($dirs);
            //we found the path
            if($key == $path || $key == $path."/")
                Return true;

            next($dirs);
        }
        Return false;
    }

The condition if($path == '/') is only for the root folder management. The code below this instruction manage all subfolders.

Regards,
#5
fix the problem for me...thanks
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#5
fix the problem for me...thanks
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#6
@ n00pX90
This did not fix the problem for me -> I use the SVN 8542
with WAMP windows

so are you using
- the last SVN rev 8542 ?
- or the official 1.11.3 ?

@ jissey tu es sur quelle version la 1.11.3 ou la SVN ??
il y a eu des modification entre la 1.11.3 et SVN rev 8542 sur imagemanager
J-C Etiemble v 2.2.xx
#6
@ n00pX90
This did not fix the problem for me -> I use the SVN 8542
with WAMP windows

so are you using
- the last SVN rev 8542 ?
- or the official 1.11.3 ?

@ jissey tu es sur quelle version la 1.11.3 ou la SVN ??
il y a eu des modification entre la 1.11.3 et SVN rev 8542 sur imagemanager
J-C Etiemble v 2.2.xx
#7
1.11.3 mise à jour 1.11.4 “Fernandina_8509Fr”
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#7
1.11.3 mise à jour 1.11.4 “Fernandina_8509Fr”
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#8
Code :
[== Indéfini ==]
1.11.3 mise à jour 1.11.4 “Fernandina_8509Fr”

sous WAMP ??

j'ai tester un 1.11.3 suus Wamp ça ne marche pas non plus le patch

il s'agit bien de supprimer les images du dossier /images uniquement
J-C Etiemble v 2.2.xx
#8
Code :
[== Indéfini ==]
1.11.3 mise à jour 1.11.4 “Fernandina_8509Fr”

sous WAMP ??

j'ai tester un 1.11.3 suus Wamp ça ne marche pas non plus le patch

il s'agit bien de supprimer les images du dossier /images uniquement
J-C Etiemble v 2.2.xx
#9
chez OVH mutu.


----------------------------------------------

Cms Version: 1.11.4

Installed Modules:

CMSMailer: 5.2.1
CMSPrinting: 1.0.3
FileManager: 1.4.2
MenuManager: 1.8.4
MicroTiny: 1.2.4
ModuleManager: 1.5.5
News: 2.12.10
Search: 1.7.7
ThemeManager: 1.1.7
Gallery: 1.6
Archiver: 0.2.6
BackupMySql: 0.3.1
UsersGuide: 1.5


Config Information:

php_memory_limit:
process_whole_template:
output_compression:
max_upload_size: 64000000
url_rewriting: mod_rewrite
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true


Php Information:

phpversion: 5.3.16
md5_function: On (Vrai)
gd_version: 2
tempnam_function: On (Vrai)
magic_quotes_runtime: Off (Faux)
E_STRICT: 0
E_DEPRECATED: 8192
memory_limit: 128M
max_execution_time: 120
output_buffering: 4096
safe_mode: Off (Faux)
file_uploads: On (Vrai)
post_max_size: 64M
upload_max_filesize: 64M
session_save_path: /tmp (1777)
session_use_cookies: On (Vrai)
xml_function: On (Vrai)
xmlreader_class: On (Vrai)


Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.1.63
Server Db Grants: Impossible de trouver un privilège "GRANT ALL". Cela peut signifier que vous pourriez avoir des problèmes pour installer ou retirer des modules, ou encore l 'ajout et la suppression d'éléments, y compris les pages.


----------------------------------------------
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#9
chez OVH mutu.


----------------------------------------------

Cms Version: 1.11.4

Installed Modules:

CMSMailer: 5.2.1
CMSPrinting: 1.0.3
FileManager: 1.4.2
MenuManager: 1.8.4
MicroTiny: 1.2.4
ModuleManager: 1.5.5
News: 2.12.10
Search: 1.7.7
ThemeManager: 1.1.7
Gallery: 1.6
Archiver: 0.2.6
BackupMySql: 0.3.1
UsersGuide: 1.5


Config Information:

php_memory_limit:
process_whole_template:
output_compression:
max_upload_size: 64000000
url_rewriting: mod_rewrite
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true


Php Information:

phpversion: 5.3.16
md5_function: On (Vrai)
gd_version: 2
tempnam_function: On (Vrai)
magic_quotes_runtime: Off (Faux)
E_STRICT: 0
E_DEPRECATED: 8192
memory_limit: 128M
max_execution_time: 120
output_buffering: 4096
safe_mode: Off (Faux)
file_uploads: On (Vrai)
post_max_size: 64M
upload_max_filesize: 64M
session_save_path: /tmp (1777)
session_use_cookies: On (Vrai)
xml_function: On (Vrai)
xmlreader_class: On (Vrai)


Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.1.63
Server Db Grants: Impossible de trouver un privilège "GRANT ALL". Cela peut signifier que vous pourriez avoir des problèmes pour installer ou retirer des modules, ou encore l 'ajout et la suppression d'éléments, y compris les pages.


----------------------------------------------
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#10
Code :
[== Indéfini ==]
chez OVH mutu.

Sous Windows ?? quelle version ??

cela voudrait dire que le problème se situe uniquement sur les systèmes WAMP sous Windows local
J-C Etiemble v 2.2.xx
#10
Code :
[== Indéfini ==]
chez OVH mutu.

Sous Windows ?? quelle version ??

cela voudrait dire que le problème se situe uniquement sur les systèmes WAMP sous Windows local
J-C Etiemble v 2.2.xx
#11
I use the stable release 1.11.3 not the SVN version.

And i'm on a Linux shared host.

To debug on WAMP, you can echoing the $path and $dirs array then compare the differences in the result.

Do something like this after $dirs = $this->getDirs();

Code :
$dirs = $this->getDirs();
echo "This is my real path".$path."<br>";
echo "<pre>";
print_r($dirs);
echo "</pre>";
...
#11
I use the stable release 1.11.3 not the SVN version.

And i'm on a Linux shared host.

To debug on WAMP, you can echoing the $path and $dirs array then compare the differences in the result.

Do something like this after $dirs = $this->getDirs();

Code :
$dirs = $this->getDirs();
echo "This is my real path".$path."<br>";
echo "<pre>";
print_r($dirs);
echo "</pre>";
...
#12
Citation :I use the stable release 1.11.3 not the SVN version.

And i'm on a Linux shared host.

Ok some modifications are on the last SVN (next 1.11.4)
On linux with the last SVN all is OK from ImageManager

So
The bug is NOT on Linux but only on windows
* There is a problem with deleting images in ImageManager in Windows
http://dev.cmsmadesimple.org/bug/view/8673

see http://www.cmsmadesimple.fr/forum/viewtopic.php?id=4772
J-C Etiemble v 2.2.xx
#12
Citation :I use the stable release 1.11.3 not the SVN version.

And i'm on a Linux shared host.

Ok some modifications are on the last SVN (next 1.11.4)
On linux with the last SVN all is OK from ImageManager

So
The bug is NOT on Linux but only on windows
* There is a problem with deleting images in ImageManager in Windows
http://dev.cmsmadesimple.org/bug/view/8673

see http://www.cmsmadesimple.fr/forum/viewtopic.php?id=4772
J-C Etiemble v 2.2.xx
#13
OVH mutu=linux
j'avais ce problème sous Linux.

En local avec Wamp, je viens de tester sur 1.11.3 “Darwin” : erreur. => Corrigée avec la solution de n00pX90.
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#13
OVH mutu=linux
j'avais ce problème sous Linux.

En local avec Wamp, je viens de tester sur 1.11.3 “Darwin” : erreur. => Corrigée avec la solution de n00pX90.
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#14
Citation :j'avais ce problème sous Linux.
Oui mais le problème est uniquement sur la future 1.11.4 (actuellement SVN) et que Sous Windows Et que sous /images pas dans les sous dossiers de/images

ben non pour moi ça marche pas
c'est le même résultat que Jean
echo $path; \/ donc erreur
Il y a des \ et / qui se croisent et plante la suppression
J-C Etiemble v 2.2.xx
#14
Citation :j'avais ce problème sous Linux.
Oui mais le problème est uniquement sur la future 1.11.4 (actuellement SVN) et que Sous Windows Et que sous /images pas dans les sous dossiers de/images

ben non pour moi ça marche pas
c'est le même résultat que Jean
echo $path; \/ donc erreur
Il y a des \ et / qui se croisent et plante la suppression
J-C Etiemble v 2.2.xx
#15
je récapitule :
Sous Linux avec ta 1.11.4
Sous Windaube avec la 1.11.3 officielle.
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#15
je récapitule :
Sous Linux avec ta 1.11.4
Sous Windaube avec la 1.11.3 officielle.
{SEO}
Inscrivez-vous à notre Newsletter sur le site (colonne de droite, en bas).
Vous appréciez CMSMS et l'aide qui vous est fournie ici, aidez-nous en participant au projet.
Formation CMS Made Simple | Création de site CMS Made Simple.

C'est en se plantant qu'on devient cultivé.
J'ai un string dans l'Array (Paris Hilton)
#16
Proposition à tester sous Win et linux

dans \ImageManager\Classes\ImageManager.php

function validRelativePath($path)

- if($path == '/') return true;// a supprimer
+ if($path == '/' || $path.'\/') return true; // Nouvelle ligne

Merci du retour
J-C Etiemble v 2.2.xx
#16
Proposition à tester sous Win et linux

dans \ImageManager\Classes\ImageManager.php

function validRelativePath($path)

- if($path == '/') return true;// a supprimer
+ if($path == '/' || $path.'\/') return true; // Nouvelle ligne

Merci du retour
J-C Etiemble v 2.2.xx
#17
voir : http://www.cmsmadesimple.fr/forum/viewto...882#p32882
#17
voir : http://www.cmsmadesimple.fr/forum/viewto...882#p32882
#18
discussion fermée suivre sur
Tests sur 1.11.4 ImageManager sous Windows
J-C Etiemble v 2.2.xx
#18
discussion fermée suivre sur
Tests sur 1.11.4 ImageManager sous Windows
J-C Etiemble v 2.2.xx


Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)