Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function parse()
 {
     $uri = [];
     $uri['SCHEME'] = $this->server_input->REQUEST_SCHEME;
     $uri['HOST'] = $this->server_input->HTTP_HOST;
     $domain_info = Util::getDomainInfo($uri['HOST']);
     $uri['DOMAIN'] = $domain_info['domain'];
     $uri['SUB_DOMAIN'] = $domain_info['sub_domain'];
     $uri['BOOTSTRAP'] = str_replace($this->server_input->DOCUMENT_ROOT, '/', $this->server_input->SCRIPT_FILENAME);
     $uri['PATH'] = $path = preg_replace('@(\\?|\\#).*@', '', $this->server_input->REQUEST_URI);
     if (stripos($path, $uri['BOOTSTRAP']) === 0) {
         $path = substr($path, strlen($uri['BOOTSTRAP']));
     }
     if (!$path) {
         $path = $this->get_input->path ?: '/';
     }
     $uri['PRETTY_PATH'] = $path;
     $uri['DIR'] = substr($path, 0, strrpos($path, '/') + 1);
     $file_name = substr($path, strrpos($path, '/') + 1);
     if (strpos($file_name, '.') === false) {
         $uri['FILE'] = $file_name;
         $uri['EXT'] = '';
     } else {
         $uri['FILE'] = substr($file_name, 0, strrpos($file_name, '.'));
         $uri['EXT'] = substr($file_name, strrpos($file_name, '.') + 1);
     }
     $uri['URI'] = "{$uri['SCHEME']}://{$uri['HOST']}{$uri['PATH']}";
     $uri['PRETTY_URI'] = "{$uri['SCHEME']}://{$uri['HOST']}{$uri['PRETTY_PATH']}";
     return $uri;
 }
Ejemplo n.º 2
0
<?php

use Pudding\Library\Util;
require __DIR__ . '/../vendor/autoload.php';
$depth = 3;
$save_path_config = ini_get('session.save_path');
if (!$save_path_config) {
    exit("Error: session.save_path is not configured, please check your php.ini." . PHP_EOL);
}
if (strpos($save_path_config, ';') === false) {
    $save_path = $save_path_config;
} else {
    $save_path = substr($save_path_config, strrpos($save_path_config, ';') + 1);
    $depth = intval(substr($save_path_config, 0, strpos($save_path_config, ';')));
}
if (!is_dir($save_path) or !is_readable($save_path) or !is_writable($save_path)) {
    exit("Error: your session dir: '{$save_path}' is not readable & writable by the php runner." . PHP_EOL);
}
Util::makeHashDirRecursive($save_path, $depth, 1);
exit('Success: all session dirs are already created.' . PHP_EOL);