Exemple #1
0
 protected function generateMW()
 {
     if (file_exits($this->pathcache . $this->getBaseName())) {
         return true;
     }
     $img = NewMagickWand();
     MagickReadImage($img, $this->pathname . $this->filename);
     $this->info = array('width' => MagickGetImageWidth($img), 'height' => MagickGetImageHeight($img), 'duration' => 0, 'mime' => $this->mime, 'size' => filesize($this->pathname . $this->filename));
     MagickSetImageFormat($img, 'JPEG');
     MagickWriteImage($img, $this->pathcache . $this->getBaseName());
     $this->mime = 'image/jpeg';
     $this->type = array('image', 'jpeg');
     $this->pathname = $this->pathcache;
     $this->filename = $this->getBaseName();
     return true;
 }
Exemple #2
0
    echo json_encode(array('error' => 'New sessionIds are not available!'));
    exit;
}
if (($projectName = request_project_name()) === false) {
    http_response_code(500);
    header('Content-Type: application/json');
    echo json_encode(array('error' => 'Invalid project!'));
    exit;
}
if (!isset($_GET['c']) || empty($_GET['c']) || preg_match('/^([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9]+$/', $_GET['c']) < 1) {
    header('Content-Type: application/json');
    echo json_encode(array('error' => 'Invalid client name!'));
    exit;
}
$clientName = $_GET['c'];
if (!file_exits($dataFolder . DIRECTORY_SEPARATOR . $projectName)) {
    if (!mkdir($dataFolder . DIRECTORY_SEPARATOR . $projectName)) {
        header('Content-Type: application/json');
        echo json_encode(array('error' => 'Can\'t add client!'));
        exit;
    }
}
if (!file_exists($dataFolder . DIRECTORY_SEPARATOR . $projectName . DIRECTORY_SEPARATOR . $clientName)) {
    if (!mkdir($dataFolder . DIRECTORY_SEPARATOR . $projectName . DIRECTORY_SEPARATOR . $clientName)) {
        header('Content-Type: application/json');
        echo json_encode(array('error' => 'Can\'t add client!'));
        exit;
    }
}
// If a session token is give, we update the session
if (isset($_GET['s'])) {
Exemple #3
0
    chdir('../../../../');
    // go to drupal root
} else {
    if (file_exists('../../includes/bootstrap.inc')) {
        // If this script is in the (drupal-root)/modules/pubdlcnt directory
        chdir('../../');
        // go to drupal root
    } else {
        // Non standard location: you need to edit the line below so that chdir()
        // command change the directory to the drupal root directory of your server
        // using an absolute path.
        // First, please delete the line below and then edit the next line
        print "Error: Public Download Count module failed to work. The file pubdlcnt.php requires manual editing.\n";
        chdir('/absolute-path-to-drupal-root/');
        // <---- edit this line!
        if (!file_exits('./includes/bootstrap.inc')) {
            // We can not locate the bootstrap.inc file, let's give up using the
            // script and just fetch the file
            header('Location: ' . $_GET['file']);
            exit;
        }
    }
}
include_once './includes/bootstrap.inc';
// following two lines are needed for check_url() and valid_url() call
include_once './includes/common.inc';
include_once './modules/filter/filter.module';
// start Drupal bootstrap for accessing database
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
chdir($current_dir);
/**
 public function url_stat($path, $flags)
 {
     $path = str_replace(self::$properties['protocol'] . '://', '', $path);
     if (!file_exits($path)) {
         return false;
     }
     return stat($fname);
 }