public function __construct($details)
 {
     parent::__construct($details);
     $this->file_path = 's3://' . $details['file_path'];
     $s3_config = PerchConfig::get('amazon_s3');
     $this->Client = S3Client::factory(array('key' => $s3_config['access_key_id'], 'secret' => $s3_config['secret_access_key']));
     $this->Client->registerStreamWrapper();
 }
 public function __construct()
 {
     $dropbox_config = PerchConfig::get('dropbox');
     $Perch = Perch::fetch();
     $this->Client = new dbx\Client($dropbox_config['access_token'], "Perch Runway/" . $Perch->version);
     $conf = PerchConfig::get('env');
     $this->temp_folder = $conf['temp_folder'];
 }
 public function __construct($details)
 {
     parent::__construct($details);
     $this->file_path = 'dropbox://' . $details['file_path'];
     $dropbox_config = PerchConfig::get('dropbox');
     if (in_array('dropbox', stream_get_wrappers())) {
         stream_wrapper_unregister('dropbox');
     }
     stream_wrapper_register('dropbox', 'DropboxStream', STREAM_IS_URL);
 }
 public function __construct($details)
 {
     parent::__construct($details);
     $this->file_path = 'swift://' . $details['file_path'];
     if (!self::$init) {
         $config = PerchConfig::get('openstack_object_storage');
         Bootstrap::useStreamWrappers();
         Bootstrap::setConfiguration(['account' => isset($config['account']) ? $config['account'] : null, 'key' => isset($config['key']) ? $config['key'] : null, 'username' => isset($config['username']) ? $config['username'] : null, 'password' => isset($config['password']) ? $config['password'] : null, 'tenantname' => isset($config['tenantname']) ? $config['tenantname'] : null, 'tenantid' => isset($config['tenantid']) ? $config['tenantid'] : null, 'endpoint' => $config['endpoint'], 'openstack.swift.region' => $config['region']]);
         self::$init = true;
     }
 }
 public static function factory($bucket)
 {
     $type = isset($bucket['type']) ? $bucket['type'] : 'file';
     if (!PERCH_RUNWAY || $type == 'file') {
         return new PerchResourceBucket($bucket);
     }
     $handlers = PerchSystem::get_registered_bucket_handlers();
     if (isset($handlers[$type])) {
         return new $handlers[$type]($bucket);
     } else {
         $config = PerchConfig::get($type);
         if ($config && is_array($config) && isset($config['handler']) && isset($config['handler_path'])) {
             include $config['handler_path'];
             PerchSystem::register_bucket_handler($type, $config['handler']);
             return new $config['handler']($bucket);
         } else {
             error_log("Handler not found: {$type}");
         }
     }
 }
示例#6
0
 public function set_qs_param($qs_param)
 {
     if ($qs_param) {
         $this->qs_param = $qs_param;
     }
     $Perch = Perch::fetch();
     $this->page_pattern = '\\b' . $this->qs_param . '=[0-9]+\\b';
     $this->page_replacement = $this->qs_param . '=%d';
     if (!$Perch->admin && PERCH_RUNWAY) {
         $paging_conf = PerchConfig::get('paging');
         if ($paging_conf && isset($paging_conf['pattern']) && isset($paging_conf['replacement'])) {
             $this->page_pattern = $paging_conf['pattern'];
             $this->page_replacement = $paging_conf['replacement'];
             $this->use_qs = false;
         }
     }
     if (PerchUtil::get($this->qs_param)) {
         $this->current_page = (int) PerchUtil::get($this->qs_param);
     }
 }
示例#7
0
<?php

if (PERCH_RUNWAY) {
    $varnish_config = PerchConfig::get('varnish');
    if ($varnish_config && $varnish_config['enabled']) {
        PerchUtil::debug("Varnish enavled!");
        $API = new PerchAPI(1.0, 'perch_varnish');
        $API->on('page.publish', function ($Event) use($API) {
            $PerchVarnish = new PerchVarnish($API);
            $PerchVarnish->purge($Event->subject);
        });
        spl_autoload_register(function ($class_name) {
            if (strpos($class_name, 'PerchVarnish') === 0) {
                include 'PerchVarnish.class.php';
                return true;
            }
            if ($class_name == 'PerchPageRoutes') {
                include PERCH_CORE . '/runway/PerchPageRoutes.class.php';
                include PERCH_CORE . '/runway/PerchPageRoute.class.php';
            }
            return false;
        });
    }
}
示例#8
0
    $messages[] = array('type' => 'warning', 'text' => PerchLang::get('%sNo native JSON library.%s Consider installing the PHP JSON library if possible.', '<strong>', '</strong>'));
}
if (!is_writable(PERCH_RESFILEPATH)) {
    $messages[] = array('type' => 'failure', 'text' => PerchLang::get('%sResources folder is not writable%s', '<strong>', '</strong>'));
}
if ($max_upload < 8) {
    $messages[] = array('type' => 'warning', 'text' => PerchLang::get('%sFile upload size is low.%s You can only upload files up to %sM.', '<strong>', '</strong>', $max_upload));
}
if ($memory_limit < 64) {
    $messages[] = array('type' => 'warning', 'text' => PerchLang::get('%sMemory limit is low.%s Memory use is limited to %sM, which could cause problems manipulating large images.', '<strong>', '</strong>', $memory_limit));
}
if (PerchUtil::find_executable_files_in_resources()) {
    $messages[] = array('type' => 'failure', 'text' => PerchLang::get('%sThere are PHP files in your resources folder.%s These could be dangerous and a sign of a security breach.', '<strong>', '</strong>'));
}
if (PERCH_RUNWAY) {
    $env_config = PerchConfig::get('env');
    if (!isset($env_config['temp_folder']) || !is_writable($env_config['temp_folder'])) {
        $messages[] = array('type' => 'warning', 'text' => PerchLang::get('%sTemp folder is not writable.%s Check the path to your temp folder in your %srunway.php%s file and check permissions are set for PHP to write to it.', '<strong>', '</strong>', '<code>', '</code>'));
        $Alert->set('notice', PerchLang::get('Your backup temp folder is not set, or is not writable.'));
        $errors = true;
    }
}
if (strpos(PERCH_LICENSE_KEY, 'LOCAL-TESTING') > 2) {
    $product .= ' LTM';
}
foreach ($messages as $message) {
    echo '<li class="icon ' . $message['type'] . '">' . $message['text'] . '</li>';
}
?>
        </ul>