Esempio n. 1
0
function admin_filter_user_name($id)
{
    $u = new User($id);
    if ($u->error) {
        return i18n_get('Nobody');
    }
    return $u->name;
}
Esempio n. 2
0
/**
 * User access levels for the admin/conditional_forward dynamic object embed.
 */
function admin_user_groups()
{
    $list = User::access_list();
    $out = array();
    foreach ($list as $access) {
        $out[] = (object) array('key' => $access, 'value' => i18n_get(ucfirst($access)));
    }
    return $out;
}
Esempio n. 3
0
 function test_cascade()
 {
     global $i18n;
     // Setup fr_ca -> fr fallback
     $i18n = new I18n();
     $i18n->language = 'fr_ca';
     $i18n->hash_order = array('fr_ca', 'fr');
     $i18n->lang_hash['fr_ca'] = array('Home' => 'Maison');
     $i18n->lang_hash['fr'] = array('Back' => 'Retournez');
     $this->assertEquals('Maison', i18n_get('Home'));
     $this->assertEquals('Retournez', i18n_get('Back'));
 }
Esempio n. 4
0
 /**
  * Verifies it's an Elefant app or theme with the required
  * config info.
  */
 public static function verify($config)
 {
     if (!isset($config->name)) {
         self::$error = i18n_get('Verification failed: No name specified');
         return false;
     }
     if (!isset($config->type)) {
         self::$error = i18n_get('Verification failed: No type specified.');
         return false;
     }
     if (!in_array($config->type, array('theme', 'app'))) {
         // No type or invalid type specified
         self::$error = i18n_get('Verification failed: Invalid type.');
         return false;
     }
     if (!isset($config->folder)) {
         self::$error = i18n_get('Verification failed: No folder specified');
         return false;
     }
     if (!preg_match('/^[a-z0-9_-]+$/i', $config->folder)) {
         // No folder or invalid name (e.g., spaces)
         self::$error = i18n_get('Verification failed: Invalid folder name.');
         return false;
     }
     if (!isset($config->version)) {
         // Version is required
         self::$error = i18n_get('Verification failed: No version specified.');
         return false;
     }
     if (!isset($config->repository) && !isset($config->website)) {
         // Repository or website required
         self::$error = i18n_get('Verification failed: Repository or website required.');
         return false;
     }
     if (isset($config->requires) && !self::verify_requires($config->requires)) {
         // Site failed to meet minimum requirements (PHP or Elefant version)
         return false;
     }
     // Check that it's not overwriting an existing app or theme
     if ($config->type == 'theme' && file_exists('layouts/' . $config->folder)) {
         self::$error = i18n_get('A theme by this name is already installed.');
         return false;
     } elseif ($config->type == 'app' && file_exists('apps/' . $config->folder)) {
         self::$error = i18n_get('An app by this name is already installed.');
         return false;
     }
     return true;
 }
Esempio n. 5
0
        $imported = 0;
        try {
            $posts = new SimpleXMLElement(file_get_contents($file));
            foreach ($posts->channel->item as $entry) {
                $dc = $entry->children('http://purl.org/dc/elements/1.1/');
                $content = $entry->children('http://purl.org/rss/1.0/modules/content/');
                $post = array('title' => (string) $entry->title, 'author' => (string) $dc->creator, 'ts' => gmdate('Y-m-d H:i:s', strtotime($entry->pubDate)), 'published' => $_POST['published'], 'body' => str_replace("\n", "<br />\n", (string) $content->encoded), 'tags' => '');
                $sep = '';
                for ($i = 0; $i < count($entry->category); $i++) {
                    $post['tags'] .= $sep . $entry->category[$i]->attributes()->nicename;
                    $sep = ', ';
                }
                $p = new blog\Post($post);
                if ($p->put()) {
                    Versions::add($p);
                    $imported++;
                }
            }
            echo '<p>' . i18n_getf('Imported %d posts.', $imported) . '</p>';
            echo '<p><a href="/blog/admin">' . i18n_get('Continue') . '</a></p>';
        } catch (Exception $e) {
            echo '<p><strong>' . i18n_get('Error importing file') . ': ' . $e->getMessage() . '</strong></p>';
            echo '<p><a href="/blog/admin">' . i18n_get('Back') . '</a></p>';
        }
        return;
    } else {
        echo '<p><strong>' . i18n_get('Error uploading file.') . '</strong></p>';
    }
}
$o = new StdClass();
echo $tpl->render('blog/import/wordpress', $o);
Esempio n. 6
0
<?php

/**
 * Forwards a user to the specified URL location.
 * Works as a dynamic object to be embedded
 * into the WYSIWYG editor.
 */
$url = isset($data['to']) ? $data['to'] : $_GET['to'];
if (User::is_valid() && User::is('admin')) {
    printf('<p>%s:</p><p><a href="%s">%s</a></p>', i18n_get('This page forwards visitors to the following link'), $url, $url);
    return;
}
$code = isset($data['code']) ? $data['code'] : (isset($_GET['code']) ? $_GET['code'] : 302);
if ($code === 301) {
    $this->permenent_redirect($url);
}
$this->redirect($url);
Esempio n. 7
0
/**
 * Returns a list of display style options for the gallery handler.
 */
function filemanager_style_list()
{
    return array(array('key' => 'lightbox', 'value' => i18n_get('Lightbox')), array('key' => 'embedded', 'value' => i18n_get('Embedded')));
}
Esempio n. 8
0
 * apply CSS to with the `breadcrumb` class, for example:
 *
 *     .breadcrumb {
 *         list-style-type: none;
 *         margin: 0;
 *         padding: 0;
 *     }
 *
 *     .breadcrumb li {
 *         list-style-type: none;
 *         margin: 0;
 *         padding: 0;
 *         display: inline;
 *     }
 */
$n = new Navigation();
$path = $n->path($page->id, true);
$home = array('index' => i18n_get('Home'));
$path = $path ? $path : $home;
if (!in_array('index', array_keys($path))) {
    $path = array_merge($home, $path);
}
echo "<ul class=\"breadcrumb\">\n";
foreach ($path as $id => $title) {
    if ($id != $page->id) {
        printf("<li><a href=\"/%s\">%s</a> <span class=\"divider\">/</span></li>\n", $id, $title);
    } else {
        printf("<li class=\"active\">%s</li>\n", $title);
    }
}
echo '</ul>';
Esempio n. 9
0
<?php

/**
 * Changes the default layout template.
 */
if (!User::require_admin()) {
    $this->redirect('/admin');
}
$confdata = file_get_contents('conf/config.php');
$confdata = str_replace('default_layout = "' . conf('General', 'default_layout') . '"', 'default_layout = "' . $_GET['layout'] . '"', $confdata);
file_put_contents('conf/config.php', $confdata);
$this->add_notification(i18n_get('Default layout updated.'));
$this->redirect('/designer');
Esempio n. 10
0
<?php

/**
 * Lists all content blocks for editing.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
$limit = 20;
$_GET['offset'] = isset($_GET['offset']) ? $_GET['offset'] : 0;
$lock = new Lock();
$blocks = Block::query('id, title, access')->order('id asc')->fetch_orig($limit, $_GET['offset']);
$count = Block::query()->count();
foreach ($blocks as $k => $b) {
    $blocks[$k]->locked = $lock->exists('Block', $b->id);
}
$page->title = i18n_get('Blocks');
echo $tpl->render('blocks/admin', array('blocks' => $blocks, 'count' => $count, 'offset' => $_GET['offset'], 'more' => $count > $_GET['offset'] + $limit ? true : false, 'prev' => $_GET['offset'] - $limit, 'next' => $_GET['offset'] + $limit));
Esempio n. 11
0
        $lang = $_POST['code'] . '_' . $_POST['locale'];
    } else {
        $lang = $_POST['code'];
    }
    global $i18n;
    if ($lang !== $_GET['lang']) {
        // Language has changed ids
        if (isset($i18n->languages[$lang])) {
            // Language already exists
            $form->failed = array('dupe');
            return false;
        }
        $i18n->languages[$lang] = $i18n->languages[$_GET['lang']];
        unset($i18n->languages[$_GET['lang']]);
        rename('lang/' . $_GET['lang'] . '.php', 'lang/' . $lang . '.php');
    }
    $i18n->languages[$lang]['name'] = $_POST['name'];
    $i18n->languages[$lang]['code'] = $_POST['code'];
    $i18n->languages[$lang]['locale'] = $_POST['locale'];
    $i18n->languages[$lang]['charset'] = $_POST['charset'];
    $i18n->languages[$lang]['fallback'] = $_POST['fallback'];
    $i18n->languages[$lang]['date_format'] = $_POST['date_format'];
    $i18n->languages[$lang]['short_format'] = $_POST['short_format'];
    $i18n->languages[$lang]['time_format'] = $_POST['time_format'];
    uasort($i18n->languages, 'translator_sort_languages');
    if (!Ini::write($i18n->languages, 'lang/languages.php')) {
        return false;
    }
    $form->controller->add_notification(i18n_get('Language updated.'));
    $form->controller->redirect('/translator/index');
});
Esempio n. 12
0
<?php

/**
 * Admin page where you can edit posts and create new ones.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
require_once 'apps/blog/lib/Filters.php';
$limit = 20;
$_GET['offset'] = isset($_GET['offset']) ? $_GET['offset'] : 0;
$lock = new Lock();
$posts = blog\Post::query('id, title, ts, author, published')->order('ts desc')->fetch_orig($limit, $_GET['offset']);
$count = blog\Post::query()->count();
foreach ($posts as $k => $p) {
    $posts[$k]->locked = $lock->exists('Blog', $p->id);
}
$page->title = i18n_get('Blog Posts');
echo $tpl->render('blog/admin', array('posts' => $posts, 'count' => $count, 'offset' => $_GET['offset'], 'more' => $count > $_GET['offset'] + $limit ? true : false, 'prev' => $_GET['offset'] - $limit, 'next' => $_GET['offset'] + $limit));
Esempio n. 13
0
<?php

/**
 * Displays the latest blog posts as a bulleted list of links.
 */
if (!$this->internal) {
    $page->layout = $appconf['Blog']['layout'];
    $page->title = i18n_get('Latest Posts');
}
require_once 'apps/blog/lib/Filters.php';
$p = new blog\Post();
if ($data['tag'] !== '') {
    $posts = $p->tagged($data['tag']);
} else {
    $posts = $p->headlines();
}
$dates = isset($data['dates']) && $data['dates'] === 'yes' ? true : false;
echo $tpl->render('blog/headlines', array('posts' => $posts, 'dates' => $dates));
Esempio n. 14
0
<?php

if (!User::require_admin()) {
    header('Location: /admin');
    exit;
}
if (!isset($_GET['table'])) {
    header('Location: /dbman/index');
    exit;
}
$page->layout = 'admin';
$sql = sprintf('delete from `%s` where %s = ?', $_GET['table'], DBMan::primary_key($_GET['table']));
if (db_execute($sql, $_GET['key'])) {
    $this->add_notification(i18n_get('Item deleted.'));
    $this->redirect('/dbman/browse?table=' . $_GET['table']);
}
$page->title = i18n_get('An Error Occurred');
printf("<p>%s</p>\n<p><a href='/dbman/browse?table=%s'>&laquo; %s</a></p>\n", db_error(), $_GET['table'], i18n_get('Back'));
Esempio n. 15
0
 *     {! admin/util/dates !}
 *
 * 2. Filter your dates via:
 *
 *     {{ date_value|I18n::date }}
 *     {{ date_value|I18n::time }}
 *     {{ date_value|I18n::date_time }}
 *
 * These will display dates in the following forms:
 *
 *     January 3, 2012
 *     5:30PM
 *     April 16, 2012 - 11:13AM
 */
$abbr_months = explode(' ', i18n_get('Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'));
$full_months = explode(' ', i18n_get('January February March April May June July August September October November December'));
global $i18n;
$page->add_script('/js/jquery.localize.min.js');
$page->add_script('<script>
$(function () {
	$.localize_dates = function () {
		$.localize.fullMonths = ' . json_encode($full_months) . ';
		$.localize.abbrMonths = ' . json_encode($abbr_months) . ';
		$(\'time.datetime\').localize(\'' . $i18n->date_format . ' - ' . $i18n->time_format . '\');
		$(\'time.shortdatetime\').localize(\'' . $i18n->short_format . ' - ' . $i18n->time_format . '\');
		$(\'time.date\').localize(\'' . $i18n->date_format . '\');
		$(\'time.shortdate\').localize(\'' . $i18n->short_format . '\');
		$(\'time.time\').localize(\'' . $i18n->time_format . '\');
	};
	$.localize_dates ();
});
Esempio n. 16
0
/**
 * Password recovery form for users who forgot their passwords.
 */
$f = new Form('post', 'user/recover');
if ($f->submit()) {
    $u = User::query()->where('email', $_POST['email'])->single();
    $data = $u->userdata;
    $data['recover'] = md5(uniqid(mt_rand(), 1));
    $data['recover_expires'] = time() + 7200;
    $u->userdata = $data;
    $u->put();
    try {
        Mailer::send(array('to' => array($u->email, $u->name), 'subject' => i18n_get('Password recovery'), 'text' => $tpl->render('user/email/recover', array('recover' => $data['recover'], 'email' => $u->email, 'name' => $u->name))));
    } catch (Exception $e) {
        @error_log('Email failed (user/recover): ' . $_POST['email']);
        $page->title = i18n_get('An Error Occurred');
        echo '<p>' . i18n_get('Please try again later.') . '</p>';
        echo '<p><a href="/">' . i18n_get('Back') . '</a></p>';
        return;
    }
    $page->title = i18n_get('Check your inbox');
    echo '<p>' . i18n_get('An email has been sent with a link to reset your password.') . '</p>';
} else {
    $u = new StdClass();
    $u->email = '';
    $u = $f->merge_values($u);
    $u->failed = $f->failed;
    $page->title = i18n_get('Forgot your password?');
    echo $tpl->render('user/recover', $u);
}
Esempio n. 17
0
File: API.php Progetto: Alm001/form
 /**
  * Update the form actions. Usage:
  *
  *     /form/api/actions/form-id
  *
  * Expects a single POST item named `actions` containing
  * the data structure of the form actions.
  */
 public function post_actions($id)
 {
     $f = new Form($id);
     if ($f->error) {
         return $this->error(i18n_get('Form not found'));
     }
     if (!isset($_POST['actions'])) {
         $_POST['actions'] = array();
     }
     if (!is_array($_POST['actions'])) {
         return $this->error(i18n_get('Invalid actions parameter'));
     }
     $f->actions = $_POST['actions'];
     $f->put();
     if ($f->error) {
         return $this->error(i18n_get('Failed to save changes'));
     }
     \Versions::add($f);
     return i18n_get('Form updated');
 }
Esempio n. 18
0
function facebook_light_dark()
{
    return array((object) array('key' => 'light', 'value' => i18n_get('Light')), (object) array('key' => 'dark', 'value' => i18n_get('Dark')));
}
Esempio n. 19
0
File: add.php Progetto: Alm001/form
<?php

/**
 * Creates a new untitled form and forwards to /form/edit, the form builder.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
$f = new form\Form(array('title' => 'Untitled', 'message' => 'Please fill in the following information.', 'ts' => gmdate('Y-m-d H:i:s'), 'fields' => '[]', 'actions' => '[]', 'response_title' => 'Thank you', 'response_body' => 'Your information has been saved.'));
$f->put();
\Versions::add($f);
if (!$f->error) {
    $this->redirect('/form/edit?id=' . $f->id);
}
$page->title = i18n_get('An Error Occurred');
echo '<p>' . i18n_get('Unable to create a new form.') . '</p>';
Esempio n. 20
0
<?php

/**
 * Provides the navigation editing capabilities for admins to add pages
 * and reorganize them in the site tree.
 */
if (!User::require_admin()) {
    $this->redirect('/admin');
}
$page->title = i18n_get('Navigation');
$page->layout = 'admin';
$page->add_script('<script src="/apps/navigation/js/jquery.jstree.js"></script>');
// get ids already in tree to skip
$nav = new Navigation();
$ids = $nav->get_all_ids();
// build other page list
require_once 'apps/navigation/lib/Functions.php';
$pages = navigation_get_other_pages($ids);
echo $tpl->render('navigation/admin', array('pages' => $pages));
Esempio n. 21
0
    $appconf = parse_ini_file($file, true);
    if (isset($appconf['Admin']['handler'])) {
        if (isset($appconf['Admin']['install'])) {
            $ver = $this->installed($app, $appconf['Admin']['version']);
            if ($ver === true) {
                // installed
                $tools[$appconf['Admin']['handler']] = $appconf['Admin'];
                $tools[$appconf['Admin']['handler']]['class'] = false;
            } elseif ($ver === false) {
                // not installed
                $appconf['Admin']['name'] .= ' (' . i18n_get('click to install') . ')';
                $tools[$appconf['Admin']['install']] = $appconf['Admin'];
                $tools[$appconf['Admin']['install']]['class'] = 'not-installed';
            } else {
                // needs upgrade
                $appconf['Admin']['name'] .= ' (' . i18n_get('click to upgrade') . ')';
                $tools[$appconf['Admin']['upgrade']] = $appconf['Admin'];
                $tools[$appconf['Admin']['upgrade']]['class'] = 'needs-upgrade';
            }
        } else {
            // no installer, as you were
            $tools[$appconf['Admin']['handler']] = $appconf['Admin'];
            $tools[$appconf['Admin']['handler']]['class'] = false;
        }
    }
}
uasort($tools, 'admin_head_links_sort');
$out = array('name' => Product::name(), 'logo' => Product::logo_toolbar(), 'links' => $tpl->render('admin/head/links', array('user' => User::val('name'), 'tools' => $tools)));
$page->layout = false;
header('Content-Type: application/json');
echo json_encode($out);
Esempio n. 22
0
<?php

/**
 * Delete a form and its associated data.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
$f = new form\Form($_GET['id']);
if ($f->error) {
    $page->title = i18n_get('An Error Occurred');
    echo '<p>' . i18n_get('The requested form could not be found.') . '</p>';
    return;
}
if (!$f->remove()) {
    $page->title = i18n_get('An Error Occurred');
    echo '<p>' . i18n_get('Unable to delete the form.') . '</p>';
    return;
}
// also remove results
DB::execute('delete from results where form_id = ?', $_GET['id']);
$this->add_notification(i18n_get('Form deleted.'));
$this->redirect('/form/admin');
Esempio n. 23
0
set_time_limit(90);
foreach ($sources as $source) {
    $files = glob($source);
    foreach ($files as $file) {
        $data = file_get_contents($file);
        if (preg_match('/\\.html/', $file)) {
            // parse for {""} syntax
            preg_match_all('/\\{[\'"] ?(.*?) ?[\'"]\\}/', $data, $matches);
            foreach ($matches[1] as $str) {
                if (!isset($list[$str])) {
                    $list[$str] = array('orig' => $str, 'src' => $file);
                }
            }
        } else {
            // parse for i18n_getf?() syntax
            preg_match_all('/i18n_getf? ?\\([\'"](.*?)[\'"]\\)/', $data, $matches);
            foreach ($matches[1] as $str) {
                $str = stripslashes($str);
                if (!isset($list[$str])) {
                    $list[$str] = array('orig' => $str, 'src' => $file);
                }
            }
        }
    }
}
asort($list);
file_put_contents('lang/_index.php', serialize($list));
chmod('lang/_index.php', 0777);
$page->title = i18n_get('Indexing completed');
echo '<p><a href="/translator/index">' . i18n_get('Continue') . '</a></p>';
Esempio n. 24
0
    case 'pgsql':
        DB::execute('alter table "user" alter column "password" type varchar(128)');
        break;
    case 'mysql':
        DB::execute('alter table `user` change column `password` `password` varchar(128) not null');
        break;
    case 'sqlite':
        DB::execute('begin transaction');
        DB::execute('alter table `user` rename to `tmp_user`');
        DB::execute('create table user (
			id integer primary key,
			email char(72) unique not null,
			password char(128) not null,
			session_id char(32) unique,
			expires datetime not null,
			name char(72) not null,
			type char(32) not null,
			signed_up datetime not null,
			updated datetime not null,
			userdata text not null
		)');
        DB::execute('create index user_email_password on user (email, password)');
        DB::execute('create index user_session_id on user (session_id)');
        DB::execute('insert into `user` (id, email, password, session_id, expires, name, type, signed_up, updated, userdata)
			select id, email, password, session_id, expires, name, type, signed_up, updated, userdata from `tmp_user`');
        DB::execute('drop table `tmp_user`');
        DB::execute('commit');
        break;
}
echo '<p>' . i18n_get('Done.') . '</p>';
$this->mark_installed('user', $appconf['Admin']['version']);
Esempio n. 25
0
require_once 'apps/blog/lib/Filters.php';
$page->limit = 10;
$page->num = count($this->params) > 0 && is_numeric($this->params[0]) ? $this->params[0] - 1 : 0;
$page->offset = $page->num * $page->limit;
$p = new blog\Post();
$posts = $p->latest($page->limit, $page->offset);
$page->count = $p->query()->where('published', 'yes')->count();
$page->last = $page->offset + count($posts);
$page->more = $page->count > $page->last ? true : false;
$page->next = $page->num + 2;
if (!is_array($posts) || count($posts) === 0) {
    echo '<p>' . i18n_get('No posts yet... :(') . '</p>';
    if (User::require_admin()) {
        echo '<p><a href="/blog/add">' . i18n_get('Add Blog Post') . '</a></p>';
    }
} else {
    if (User::require_admin()) {
        echo '<p><a href="/blog/add">' . i18n_get('Add Blog Post') . '</a></p>';
    }
    foreach ($posts as $post) {
        $post->url = '/blog/post/' . $post->id . '/' . URLify::filter($post->title);
        $post->tag_list = explode(',', $post->tags);
        $post->social_buttons = $appconf['Social Buttons'];
        echo $tpl->render('blog/post', $post);
    }
}
if (!$this->internal) {
    $page->title = $appconf['Blog']['title'];
}
$page->add_script(sprintf('<link rel="alternate" type="application/rss+xml" href="http://%s/blog/rss" />', $_SERVER['HTTP_HOST']));
echo $tpl->render('blog/index', $page);
Esempio n. 26
0
<?php

/**
 * Switch to display the comment count for a post.
 */
switch ($appconf['Blog']['comments']) {
    case 'disqus':
        echo $this->run('blog/disqus/commentcount', $data);
        break;
    case 'facebook':
        printf('<a href="%s">%s %s</a>', $data['url'], $this->run('social/facebook/commentcount', $data), i18n_get('comments'));
        break;
}
Esempio n. 27
0
    if (!$appconf['Custom Handlers']['user/login']) {
        echo $this->error(404, i18n_get('Not found'), i18n_get('The page you requested could not be found.'));
        return;
    }
    echo $this->run($appconf['Custom Handlers']['user/login'], $data);
    return;
}
if (!$this->internal) {
    $page->title = i18n_get('Members');
}
if (isset($_GET['redirect'])) {
    $_POST['redirect'] = $_GET['redirect'];
}
if (!isset($_POST['redirect'])) {
    $_POST['redirect'] = $_SERVER['REQUEST_URI'];
    if ($_POST['redirect'] == '/user/login') {
        $_POST['redirect'] = '/user';
    }
}
if (!Form::verify_value($_POST['redirect'], 'header')) {
    $_POST['redirect'] = '/user';
}
if (!User::require_login()) {
    if (!$this->internal && !empty($_POST['username'])) {
        echo '<p>' . i18n_get('Incorrect email or password, please try again.') . '</p>';
    }
    $_POST['signup_handler'] = $appconf['Custom Handlers']['user/signup'];
    echo $tpl->render('user/login', $_POST);
} elseif (!$this->internal) {
    $this->redirect($_POST['redirect']);
}
Esempio n. 28
0
<?php

/**
 * Form to reset your password, accessed through a link from an email.
 */
$verified = false;
$u = User::query()->where('email', $_GET['email'])->single();
$data = $u->userdata;
if ($data['recover'] == $_GET['recover'] && $data['recover_expires'] > time() + 60) {
    $f = new Form('post', 'user/newpass');
    if ($f->submit()) {
        $u->password = User::encrypt_pass($_POST['password']);
        unset($data['recover']);
        unset($data['recover_expires']);
        $u->userdata = $data;
        $u->put();
        $_POST['username'] = $u->email;
        User::require_login();
        $page->title = i18n_get('Password updated');
        echo '<p><a href="/user">' . i18n_get('Continue') . '</a></p>';
    } else {
        $u = new StdClass();
        $u = $f->merge_values($u);
        $u->failed = $f->failed;
        $page->title = i18n_get('Choose a new password');
        echo $tpl->render('user/newpass', $u);
    }
} else {
    $page->title = i18n_get('Invalid or expired recovery link');
    echo '<p><a href="/">' . i18n_get('Continue') . '</a></p>';
}
Esempio n. 29
0
$f->verify_csrf = false;
if ($f->submit()) {
    $wp->id = $_POST['id'];
    $wp->title = $_POST['title'];
    $wp->menu_title = $_POST['menu_title'];
    $wp->window_title = $_POST['window_title'];
    $wp->access = $_POST['access'];
    $wp->layout = $_POST['layout'];
    $wp->description = $_POST['description'];
    $wp->keywords = $_POST['keywords'];
    $wp->body = $_POST['body'];
    $wp->put();
    if (!$wp->error) {
        Versions::add($wp);
        $memcache->delete('_admin_page_' . $_GET['page']);
        $this->add_notification(i18n_get('Page saved.'));
        $_POST['page'] = $_GET['page'];
        $lock->remove();
        $this->hook('admin/edit', $_POST);
        $this->redirect('/' . $_POST['id']);
    }
    $page->title = i18n_get('An Error Occurred');
    echo i18n_get('Error Message') . ': ' . $wp->error;
} else {
    $wp->layouts = admin_get_layouts();
    $wp->failed = $f->failed;
    $wp = $f->merge_values($wp);
    $page->title = i18n_get('Edit Page') . ': ' . $wp->title;
    $page->head = $tpl->render('admin/edit/head', $wp) . $tpl->render('admin/wysiwyg');
    echo $tpl->render('admin/edit', $wp);
}
Esempio n. 30
0
}
$lock = new Lock('Designer', $_GET['file']);
if ($lock->exists()) {
    $page->title = i18n_get('Editing Locked');
    echo $tpl->render('admin/locked', $lock->info());
    return;
} else {
    $lock->add();
}
$f = new Form('post', 'designer/editlayout');
$f->verify_csrf = false;
if ($f->submit()) {
    if (@file_put_contents($_GET['file'], $_POST['body'])) {
        $this->add_notification(i18n_get('Layout saved.'));
        @chmod($_GET['file'], 0777);
        $lock->remove();
        $this->redirect('/designer');
    }
    $page->title = i18n_get('Saving Layout Failed');
    echo '<p>' . i18n_get('Check that your permissions are correct and try again.') . '</p>';
} else {
    $page->title = i18n_get('Edit Layout') . ': ' . $_GET['file'];
}
$o = new StdClass();
$o->file = $_GET['file'];
$o->body = @file_get_contents($_GET['file']);
$o->failed = $f->failed;
$o = $f->merge_values($o);
$page->add_script('/apps/designer/css/edit_layout.css');
$page->add_script('/apps/designer/js/jquery.bindWithDelay.js');
echo $tpl->render('designer/edit/layout', $o);