Esempio n. 1
0
 /**
  * Wraps around the Fu_DB::save method and adds error to Fu_Feedback
  */
 function find_all($options = array())
 {
     try {
         if (!$options['limit']) {
             $options['limit'] = '9999999';
         }
         $results = parent::find_all($options);
         $results->num_rows = $results->total_rows;
         return $results;
     } catch (Fu_DB_Validation_Exception $e) {
         $errors = $e->getErrors();
         foreach ($errors as $error) {
             Fu_Feedback::add_error($error['message']);
         }
         throw new Fu_DB_Exception('Validations failed');
     }
 }
Esempio n. 2
0
<?php

if (http_is_post()) {
    if ($_POST['form_action'] == 'newuser') {
        if ($user = $g->add_user($_POST)) {
            Fu_Feedback::set_flash('user added');
            http_redirect(http_request_uri());
        }
    }
}
$users = $g->get_users();
include 'giiki/theme/_header.php';
?>

    <div id="wrapper" class="wat-cf">
		<div id="main">
			<div class="block" id="">
				<div class="content">
					<h2 class="title">Manage Users</h2>
					<div class="inner">
						<!-- messages //-->
						<?php 
app_show_feedback();
?>

						<table class="table">
						<tr>
							<th class="first">Name</th>
							<th>Email</th>
							<th>Admin?</th>
							<th class="last"></th>
Esempio n. 3
0
$current_user = $g->get_logged_in_user();
$settings = $current_user->settings();
if (http_is_post()) {
    if ($_POST['form_action'] == 'savepage') {
        $g->set_page_contents($_POST['contents']);
        Fu_Feedback::set_flash('page saved');
        if ($settings->remain_edit_mode) {
            http_redirect(http_request_uri());
        } else {
            http_redirect('/' . $g->get_page());
        }
    }
    if ($_POST['form_action'] == 'delpage') {
        if ($g->delete_page()) {
            Fu_Feedback::set_flash('page deleted');
            http_redirect('/');
        }
    }
}
include 'giiki/theme/_header.php';
$editor = $settings->editor;
?>

    <div id="wrapper" class="wat-cf">
		<div id="main">
            <!-- messages //-->
			<?php 
app_show_feedback();
?>
Esempio n. 4
0
<?php

$pages = $g->get_pages();
if (http_is_post()) {
    if ($_POST['form_action'] == 'changepassword') {
        if ($g->change_password($_POST['current_password'], $_POST['new_password'])) {
            Fu_Feedback::set_flash('new password saved');
            http_redirect(http_request_uri());
        }
    }
    if ($_POST['form_action'] == 'savesettings') {
        if ($g->save_settings($_POST['settings'])) {
            Fu_Feedback::set_flash('settings saved');
            http_redirect(http_request_uri());
        }
    }
}
$default_settings = array('editor' => array('normal' => 'Normal textarea', 'tinymce' => 'TinyMCE'));
$current_user = $g->get_logged_in_user();
$settings = $current_user->settings();
include 'giiki/theme/_header.php';
?>

    <div id="wrapper" class="wat-cf">
		<div id="main">
			<?php 
if (http_is_get()) {
    ?>
			<div class="block" id="">
				<!-- messages //-->
				<?php 
Esempio n. 5
0
/**
 * Display an error box on a form
 */
function app_show_errors()
{
    if (Fu_Feedback::has_errors()) {
        echo '<div class="message error"><p>Sorry - a problem occurred:</p><ul>';
        foreach (Fu_Feedback::errors() as $e) {
            printf("<li>%s</li>\n", $e);
        }
        echo "</ul></div>";
    } else {
        if ($msg = Fu_Feedback::get_flash('error')) {
            printf('<div class="message error"><p>Sorry - a problem occurred:</p><ul><li>%s</li></ul></div>', $msg);
        }
    }
}
Esempio n. 6
0
 function enforce_admin()
 {
     if (!$this->is_admin_user()) {
         Fu_Feedback::set_flash('Access denied', 'info');
         http_redirect('/');
     }
 }