コード例 #1
0
 function do_install()
 {
     if (is_file($this->fs_filename())) {
         if (ALLOW_FILES_BACKUP == 'false') {
             $this->backup_file();
         }
         //save_md5 ($this->fs_filename(), $this->contrib);
         ci_remove($this->fs_filename());
     }
     return $this->error;
 }
コード例 #2
0
 function deleteconfirm()
 {
     global $message, $cip;
     if (strstr($this->cip, '..')) {
         return;
     }
     $cip = new CIP($this->cip);
     $cip->unregister;
     ci_remove($this->current_path . '/' . $this->cip);
     //        if (is_dir($this->current_path.'/'.$this->cip)) {
     //            $message->add(ci_remove($this->current_path.'/'.$this->cip));
     //        } else {
     //            $message->add("Couldn't remove ".$this->current_path.'/'.$this->cip);
     //        }
 }
コード例 #3
0
function ci_remove($source)
{
    //Return true if error.
    global $message;
    if (!is_file($source) and !is_dir($source)) {
        return;
    }
    if (is_dir($source)) {
        $dir = dir($source);
        //if (!is_object($dir))    return;
        while ($file = $dir->read()) {
            if ($file != '.' && $file != '..') {
                if (is_writeable($source . '/' . $file)) {
                    if (ci_remove($source . '/' . $file)) {
                        return true;
                    }
                } else {
                    $message->add(sprintf(ERROR_FILE_NOT_REMOVEABLE, $source . '/' . $file), 'error');
                    return true;
                }
            }
        }
        $dir->close();
        if (is_writeable($source)) {
            @rmdir($source);
        } else {
            $message->add(sprintf(ERROR_DIRECTORY_NOT_REMOVEABLE, $source), 'error');
            return true;
        }
    } else {
        if (is_writeable($source)) {
            @unlink($source);
        } else {
            $message->add(sprintf(ERROR_FILE_NOT_REMOVEABLE, $source), 'error');
            return true;
        }
    }
}
コード例 #4
0
 function error($text = '')
 {
     global $message;
     if ($text) {
         if ($this->was_unpacked() && $this->is_unpacked()) {
             ci_remove(DIR_FS_CIP . '/' . $this->get_cip_name());
         }
         return $this->error = $message->add($text, 'error');
     }
 }
コード例 #5
0
 function do_install()
 {
     if ($this->error) {
         return;
     }
     for ($i = 0; $i < count($this->data['filename']); $i++) {
         $cip_file = DIR_FS_CIP . '/' . $this->contrib . '/' . $this->data['srcdir'][$i] . '/' . $this->data['filename'][$i];
         if (is_file($this->fs_filename($i))) {
             //if file is copied
             if ($this->equal_files($cip_file, $this->fs_filename($i))) {
                 continue;
             }
             //If file exists we should backup them. Later we could restore him.
             //If we couldn't backup we should print an error and stop.
             //If Total_Backup havn't been done we should do it.
             if (ALLOW_FILES_BACKUP == 'false') {
                 $this->backup_file($this->data['filename'][$i]);
             }
             ci_remove($this->fs_filename($i));
         }
         //We copy file to right location:
         if (@(!copy($cip_file, $this->fs_filename($i)))) {
             $this->error("Run time error: " . COULDNT_COPY_TO_TEXT . $this->fs_filename($i));
             return $this->error;
         } elseif (file_exists($this->fs_filename($i))) {
             chmod($this->fs_filename($i), 0777);
         }
     }
     return $this->error;
 }
コード例 #6
0
 function error($text = '')
 {
     global $message, $cip;
     if ($text) {
         if ($cip->was_unpacked() && $cip->is_unpacked()) {
             ci_remove(DIR_FS_CIP . '/' . $this->contrib);
         }
         return $this->error = $message->add($text . "<br>&#060;<i>" . $this->get_tag_name() . "&#062; #" . $this->get_id() . " " . $this->depend . "</i>", 'error');
     }
 }