예제 #1
0
파일: File.php 프로젝트: moiseh/metapages
 public function getFullPath()
 {
     return \Meta\Core\FileSystem::getFilesPath() . '/' . $this->name;
 }
예제 #2
0
    print_footer();
    ?>
    <?php 
});
// edit/manage page route
route_add('builder/page/*', function ($path) {
    $pages = \Meta\Builder::read('pages');
    $pageArray = $pages[$path];
    // check write permissions
    if (!is_writable(\Meta\Builder::pageFile())) {
        $cmd = 'sudo chmod 666 ' . \Meta\Builder::pageFile();
        \Meta\Core\Flash::error(t('The file <b>' . basename(\Meta\Builder::pageFile()) . '</b> is not writable! To set correct permission, type: <br/><b>' . $cmd . '</b>'));
    }
    // file perms
    if (!\Meta\Core\FileSystem::isDirWritable()) {
        $cmd = 'sudo chmod 666 ' . \Meta\Core\FileSystem::getFilesPath() . ' -R';
        \Meta\Core\Flash::error(t('The files directory is not writable! To set correct permission, type: <br/><b>' . $cmd . '</b>'));
    }
    set_page_title(t("Page: {$pageArray['label']}"));
    // form
    \Meta\Core\Form::validateRequired('name');
    \Meta\Core\Form::validateRequired('label');
    $new_name = \Meta\Core\Form::value('name');
    // page rename action detect
    $renamed = false;
    if (is_post() && $new_name != $path) {
        $renamed = true;
        // validate page exists
        if (isset($pages[$new_name])) {
            \Meta\Core\Form::addError(t('This page already exists'));
        }