Exemple #1
0
     $fieldset_data = $fs->get_data();
     $data['fields'] = $fieldset_data['fields'];
 } else {
     # not set.
     $data['fields'] = array();
 }
 /*
 |--------------------------------------------------------------------------
 | Check if file is writable
 |--------------------------------------------------------------------------
 |
 | We now have a file name. Let's check if we can write to this thing.
 | If not, throw an error page
 |
 */
 if (!Statamic::is_content_writable() || File::exists($file) && !File::isWritable($file)) {
     $url = $admin_app->urlFor('error') . "?code=content_not_writable";
     $admin_app->redirect($url);
 }
 /*
 |--------------------------------------------------------------------------
 | Fieldset defaults
 |--------------------------------------------------------------------------
 |
 | We need to bring in the fieldset so we know what we're working with
 |
 */
 $fieldset = null;
 $field_settings = array();
 if (count($data['fields']) < 1 && File::exists("{$content_root}/{$folder}/fields.yaml")) {
     $fields_raw = File::get("{$content_root}/{$folder}/fields.yaml");
Exemple #2
0
})->name('logout');
// ERROR FUNCTION
// --------------------------------------------------------
$admin_app->get('/error', function () use($admin_app) {
    $template_list = array("error");
    Statamic_View::set_templates(array_reverse($template_list));
    Statamic_View::set_layout("layouts/default");
    $admin_app->render(null, array('route' => 'login', 'app' => $admin_app));
})->name('error');
// PUBLICATION
// --------------------------------------------------------
$admin_app->get('/pages', function () use($admin_app) {
    authenticateForRole('admin');
    doStatamicVersionCheck($admin_app);
    $template_list = array("pages");
    if (!Statamic::is_content_writable()) {
        $admin_app->flash('error', 'Content folder not writable');
        $url = $admin_app->urlFor('error') . "?code=write_permission";
        $admin_app->redirect($url);
        return;
    }
    $path = "";
    $path = $admin_app->request()->get('path');
    $errors = array();
    /*
    |--------------------------------------------------------------------------
    | Pages and Home page
    |--------------------------------------------------------------------------
    |
    | We can get all the pages from get_content_tree(), but the home page
    | is a bit of an exception. We need to set a few things manually.