Quick solution for 'edit' folder being deleted Quick solution for 'edit' folder being deleted
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Quick solution for 'edit' folder being deleted

Started by yoshikiwei, September 22, 2004, 08:22:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yoshikiwei

My /albums/edit folder is being deleted every now and then.
And getting frustrated with it, I decided to modify the following codes in upload.php

upload.php, find
function spring_cleaning($directory_path) {

   //First we get the transitory directory handle.
   $directory_handle = opendir($directory_path);

   // Exit if the directory cannot be opened.
   if(!$directory_handle) {

       // Return.
      return;

   }

replace with
function spring_cleaning($directory_path) {

   //First we get the transitory directory handle.
   $directory_handle = @opendir($directory_path);

   // Exit if the directory cannot be opened.
   if(!$directory_handle) {

       // Return.
mkdir($directory_path, 0777);
       return;

   }


this codes simply creates the edit folder if it cannot be opened

use this at your own risks and preference

kegobeer

Actually, you should use the albums path that's in the config settings instead of hardcoding it.  Like this:

global $CONFIG;
mkdir('.' . $CONFIG['fullpath'] . 'edit', 0777);
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

yoshikiwei

true enough
or perhaps I should use $directory_path instead

btw, have the dev team already know what causes the edit folder to be deleted ?

erroneus


Joachim Müller

as suggested (just summarizing the previous posts up): edit upload.php, findfunction spring_cleaning($directory_path) {

    //First we get the transitory directory handle.
    $directory_handle = opendir($directory_path);

    // Exit if the directory cannot be opened.
    if(!$directory_handle) {

        // Return.
       return;

    }
and replace withfunction spring_cleaning($directory_path) {
    global $CONFIG;
    //First we get the transitory directory handle.
    $directory_handle = @opendir($directory_path);

    // Exit if the directory cannot be opened.
    if(!$directory_handle) {
mkdir('.' . $CONFIG['fullpath'] . 'edit', 0777);
        // Return.
        return;
    }
This is a quick-and-dirty fix - wouldn't mind if I were you though, it won't break anything.

Joachim

Pauky

Hey guys,

I'm assuming the above problem relates to me.  I've noticed that my 'edit' directory keeps losing it's permissions (from 755 to 666).  I think this is because it's getting deleted as well.  I changed the code in the 'pload.php' but it's not adding the 777 permissions and I get the following error:

Warning: mkdir(.albums/edit): No such file or directory in /c59/ewiddel/gallery/upload.php on line 402


I did a search on the above errors with different variations, but found thing.  

Any ideas guys?  In the mean time, I'll call my Web hosting company to have them change the permissions to 755 again.  Thanks in advance.

Casper

Open your include/picmgmt.inc.php file, and find and change '0666' to '0755'.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Pauky

I changed the 0666 to 0755 on the include/picmgmt.inc.php file and that didn't seem to work.  I verified that the Albums, Albums/userpics, and albums/edit folders are set to 755.

I still get Warning: mkdir(.albums/edit): No such file or directory in /c59/ewiddle/gallery/upload.php on line 402 when I click on the upload link and the following when I actually try and upload a picture (the same symptoms that everyone gets when the 'edit' folder isn't set to 755 although mine is.  Any ideas?

Warning: move_uploaded_file(./edit/mHTTP_temp_2995890e.jpg): failed to open stream: No such file or directory in /c59/ewiddle/gallery/upload.php on line 1155

Warning: move_uploaded_file(): Unable to move '/tmp/phpkkemiK' to './edit/mHTTP_temp_2995890e.jpg' in /c59/ewiddle/gallery/upload.php on line 1155