Esempio n. 1
0
 public function profile()
 {
     $current_user = Statamic_Auth::get_current_user() ? Statamic_Auth::get_current_user()->get_name() : false;
     $member = $this->fetchParam('member', $current_user);
     $profile_data = Statamic_user::get_profile($member);
     if ($profile_data) {
         return Parse::template($this->content, $profile_data);
     }
 }
Esempio n. 2
0
File: routes.php Progetto: nob/joi
/**
 * The Routes
 **/
function authenticateForRole($role = 'member')
{
    $admin_app = \Slim\Slim::getInstance();
    $user = Statamic_Auth::get_current_user();
    if ($user) {
        if ($user->has_role($role) === false) {
            $admin_app->redirect($admin_app->urlFor('denied'));
        }
    } else {
        $admin_app->redirect($admin_app->urlFor('login'));
    }
    return true;
}
Esempio n. 3
0
 public function redactor__fetch_images()
 {
     if (!Statamic_Auth::get_current_user()) {
         exit("Invalid Request");
     }
     $dir = Path::tidy(ltrim(Request::get('path'), '/') . '/');
     $image_list = glob($dir . "*.{jpg,jpeg,gif,png}", GLOB_BRACE);
     $images = array();
     if (count($image_list) > 0) {
         foreach ($image_list as $image) {
             $images[] = array('thumb' => Config::getSiteRoot() . $image, 'image' => Config::getSiteRoot() . $image);
         }
     }
     echo json_encode($images);
 }
Esempio n. 4
0
File: ft.users.php Progetto: nob/joi
 public function render()
 {
     $html = "<div class='input-select-wrap'><select name='{$this->fieldname}' tabindex='{$this->tabindex}'>";
     $html .= "<option value=''>- None Selected-</option>";
     $current_user = Statamic_Auth::get_current_user();
     $current_username = $current_user->get_name();
     if ($this->field_data == '') {
         $this->field_data = $current_username;
     }
     foreach (Statamic_Auth::get_user_list() as $key => $data) {
         $selected = $this->field_data == $key ? " selected='selected'" : '';
         $html .= "<option {$selected} value='{$key}'>{$data->get_first_name()} {$data->get_last_name()}</option>";
     }
     $html .= "</select></div>";
     return $html;
 }
Esempio n. 5
0
File: statamic.php Progetto: nob/joi
 /**
  * Set up any and all global vars, tags, and other defaults
  *
  * @return void
  */
 public static function setDefaultTags()
 {
     $app = \Slim\Slim::getInstance();
     /*
     |--------------------------------------------------------------------------
     | User & Session Authentication
     |--------------------------------------------------------------------------
     |
     | This may be overwritten later, but let's go ahead and set the default
     | layout file to start assembling our front-end view.
     |
     */
     $current_user = Statamic_Auth::get_current_user();
     $app->config['logged_in'] = $current_user !== FALSE;
     $app->config['username'] = $current_user ? $current_user->get_name() : FALSE;
     $app->config['is_admin'] = $current_user ? $current_user->has_role('admin') : FALSE;
     /**
      * @deprecated
      * The {{ user }} tag has been replaced by {{ member:profile }} and
      * will be removed in v1.6
      */
     $app->config['user'] = $current_user ? array(array('first_name' => $current_user->get_first_name()), array('last_name' => $current_user->get_last_name()), array('bio' => $current_user->get_biography())) : FALSE;
     $app->config['homepage'] = Config::getSiteRoot();
     /*
     |--------------------------------------------------------------------------
     | Load Environment Configs and Variables
     |--------------------------------------------------------------------------
     |
     | Environments settings explicitly overwrite any existing settings, and
     | therefore must be loaded late. We also set a few helper variables
     | to make working with environments even easier.
     |
     */
     Environment::establish();
 }
Esempio n. 6
0
File: default.php Progetto: nob/joi
<?php

$current_user = Statamic_Auth::get_current_user();
$name = $current_user->get_name();
?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
  <title>Statamic Control Panel</title>
  <link rel="stylesheet" href="<?php 
echo Path::tidy(Config::getSiteRoot() . '/' . $app->config['theme_path']);
?>
css/ascent.min.css">
  <link rel="shortcut icon" href="<?php 
print Path::tidy(Config::getSiteRoot() . '/' . $app->config['theme_path']);
?>
img/favicon.ico" />
  <script type="text/javascript" src="<?php 
echo Path::tidy(Config::getSiteRoot() . '/' . $app->config['theme_path']);
?>
js/ascent.min.js"></script>
  <?php 
echo Hook::run('control_panel', 'add_to_head', 'cumulative');
?>
</head>
<body id="<?php 
echo $route;
?>
">