To manage 4images with SAFE MODE !
Finish remove/create directory by FTP and CHMOD 777 !
Requirements :
- FTP account
- PHP SAFE MODE actived
DO NOT MODIFY THE FILES IF YOU DON'T HAVE ANY PROBLEM WITH SAFE MODE !
BE SURE TO BACKUP : /admin/categories.php and /global.php
Step 1
Note : be sure to change all blue lines if not the hack don't work !
Open /admin/categories.php and Find :
function create_cat_folder($path, $mode) {
if (@is_dir($path)) {
@chmod($path, $mode);
return true;
}
else {
$oldumask = umask(0);
$result = mkdir($path, $mode);
umask($oldumask);
if (!@is_dir($path) || !$result) {
$result = mkdir($path, 0755);
@chmod($path, $mode);
}
return $result;
}
}
Replace by
function create_cat_folder($path, $mode) {
//initialisation de la connection FTP
$ftp_server='195.90.85.74'; // your FTP IP Serveur
$conn_id = ftp_connect($ftp_server);
// login et mot de passe
$user="camo"; // your login name
$passwd="whyNot"; // your password
$login_result = ftp_login($conn_id, $user, $passwd);
// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {
echo "Mauvaise connexion FTP";
echo "Essaye de se connecter a $ftp_server for user $ftp_user_name";
die;
} else {
//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result = ftp_mkdir($conn_id,$path);
}
//Fermeture de la connection ftp
ftp_close($conn_id);
}
Step 2
Note : be sure to change all blue lines if not the hack don't work !
Find :
function remove_cat_folder($path) {
$ok = 1;
if (@is_dir($path)) {
$handle = opendir($path);
while ($file = @readdir($handle)) {
if ($file != "." && $file != "..") {
$ok = (!remove_cat_folder($path."/".$file)) ? 0 : $ok;
}
}
closedir($handle);
$ok = (!rmdir($path)) ? 0 : $ok;
}
else {
$ok = (!unlink($path)) ? 0 : $ok;
}
return $ok;
}
Replace by
function remove_cat_folder($path) {
//initialisation de la connection FTP
$ftp_server='195.90.85.74'; // your FTP IP Serveur
$conn_id = ftp_connect($ftp_server);
// login et mot de passe
$user="camo"; // your login name
$passwd="whyNot"; // your password
$login_result = ftp_login($conn_id, $user, $passwd);
// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {
echo "Mauvaise connexion FTP";
echo "Essaye de se connecter a $ftp_server for user $ftp_user_name";
die;
} else {
//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result = ftp_rmdir($conn_id,$path);
}
//Fermeture de la connection ftp
ftp_close($conn_id);
}
Step 3
Open /global.php and Find :
$msg = "";
$clickstream = "";
define('MEDIA_PATH', ROOT_PATH.MEDIA_DIR);
define('THUMB_PATH', ROOT_PATH.THUMB_DIR);
define('MEDIA_TEMP_PATH', ROOT_PATH.MEDIA_TEMP_DIR);
define('THUMB_TEMP_PATH', ROOT_PATH.THUMB_TEMP_DIR);
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
Replace by
$msg = "";
$clickstream = "";
define('MEDIA_PATH_FTP', "/4images/data/media");
define('THUMB_PATH_FTP', "/4images/data/thumbnails");
define('MEDIA_PATH', ROOT_PATH.MEDIA_DIR);
define('THUMB_PATH', ROOT_PATH.THUMB_DIR);
define('MEDIA_TEMP_PATH', ROOT_PATH.MEDIA_TEMP_DIR);
define('THUMB_TEMP_PATH', ROOT_PATH.THUMB_TEMP_DIR);
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
Now! make as if safe mode had never existed !
Camo
[edit=Nicky]
[color]
and [/color]
removed from codes. original post attached as chmod.txt