예제 #1
0
 public function render()
 {
     // Let's make sure they set an upload destination
     if (array_get($this->field_config, 'destination', false) === false) {
         throw new Exception("You need to set a destination for your File field.");
     }
     if ($this->field_data) {
         $file = Path::toAsset($this->field_data);
         $html = "<div class='file-field-container file-exists'>";
         $html .= "<div>";
         if (File::isImage(Path::fromAsset($this->field_data, true))) {
             $html .= "<img src='{$file}' height='58'>";
         }
         $html .= "<p>" . basename($this->field_data) . "</p>";
         $html .= "<a class='btn btn-small btn-remove-file' href='#'>" . Localization::fetch('remove') . "</a>";
         $html .= "</div>";
         $html .= $this->makeFileSelect($file);
     } else {
         $html = "<div class='file-field-container'>";
         $html .= "<div class='upload-file'>";
         $html .= "<p><input type='file' name='{$this->fieldname}' tabindex='{$this->tabindex}' value='' /></p>";
         $html .= $this->makeFileSelect();
         $html .= "</div>";
     }
     $html .= "</div>";
     return $html;
 }
예제 #2
0
 /**
  * Renders the field
  *
  * @return string
  */
 function render()
 {
     $random_keys = array('name' => $this->field_id, 'latitude' => Helper::getRandomString(), 'longitude' => Helper::getRandomString());
     $values = array('name' => isset($this->field_data['name']) ? $this->field_data['name'] : '', 'latitude' => isset($this->field_data['latitude']) ? $this->field_data['latitude'] : '', 'longitude' => isset($this->field_data['longitude']) ? $this->field_data['longitude'] : '');
     $html = '<div class="map"';
     // add in per-field settings
     $settings = array();
     foreach ($this->field_config as $setting => $value) {
         if (!in_array($setting, $this->allowed_settings) || is_null($value)) {
             continue;
         }
         $settings[$setting] = $value;
     }
     // if we found something, add the configuration to the element
     if (count($settings)) {
         $html .= " data-location-configuration='" . json_encode($settings) . "'";
     }
     $html .= '></div>';
     $html .= '<div class="entry">';
     $html .= '	<div class="name">';
     $html .= '		<p>';
     $html .= Fieldtype::render_fieldtype('text', 'yaml][' . $this->field . '][name', array('display' => Localization::fetch('location_name')), $values['name'], NULL, NULL, $random_keys['name']);
     $html .= '		</p>';
     $html .= '	</div>';
     $html .= '	<div class="coordinates">';
     $html .= '		<p class="latitude">';
     $html .= Fieldtype::render_fieldtype('text', 'yaml][' . $this->field . '][latitude', array('display' => Localization::fetch('latitude')), $values['latitude'], NULL, NULL, $random_keys['latitude']);
     $html .= '		</p>';
     $html .= '		<p class="longitude">';
     $html .= Fieldtype::render_fieldtype('text', 'yaml][' . $this->field . '][longitude', array('display' => Localization::fetch('longitude')), $values['longitude'], NULL, NULL, $random_keys['longitude']);
     $html .= '		</p>';
     $html .= '	</div>';
     $html .= '</div>';
     return $html;
 }
 public function control_panel__add_routes()
 {
     $app = \Slim\Slim::getInstance();
     $app->get('/globes', function () use($app) {
         authenticateForRole('admin');
         doStatamicVersionCheck($app);
         Statamic_View::set_templates(array('globes-overview'), __DIR__ . '/templates');
         $data = $this->tasks->getThemeSettings();
         $app->render(null, array('route' => 'globes', 'app' => $app) + $data);
     })->name('globes');
     // Update global vars
     $app->post('/globes/update', function () use($app) {
         authenticateForRole('admin');
         doStatamicVersionCheck($app);
         $data = $this->tasks->getThemeSettings();
         $vars = Request::fetch('pageglobals');
         foreach ($vars as $name => $var) {
             foreach ($data['globals'] as $key => $item) {
                 if ($item['name'] === $name) {
                     $data['globals'][$key]['value'] = $var;
                 }
             }
         }
         File::put($this->tasks->getThemeSettingsPath(), YAML::dump($data, 1));
         $app->flash('success', Localization::fetch('update_success'));
         $app->redirect($app->urlFor('globes'));
     });
 }
예제 #4
0
    public function control_panel__add_to_foot()
    {
        if (URL::getCurrent() == '/publish' && Request::get('path') == $this->tasks->getFilename()) {
            return $this->js->inline('
				$(".input-block").first().hide();
				$(".status-block")
					.html("<span class=\'folder\'>' . Localization::fetch('editing_globals') . '</span>")
					.next().find("li").first().hide();
				$("#item-content a").removeClass("active");
				$("#item-globals a").addClass("active");
			');
        }
    }
예제 #5
0
 public function render()
 {
     $html = "<div class='file-field-container'>";
     if ($this->field_data) {
         $html .= "<div class='file-exists'>";
         if (File::isImage(Path::fromAsset($this->field_data, true))) {
             $html .= "<img src='" . Path::toAsset($this->field_data) . "' height='58'>";
         }
         $html .= "<p>" . basename($this->field_data) . "</p>";
         $html .= "<a class='btn btn-small btn-remove-file' href='#'>" . Localization::fetch('remove') . "</a>";
         $html .= "<input type='hidden' name='{$this->fieldname}' value='{$this->field_data}' />";
         $html .= "</div>";
     } else {
         $html .= "<div class='upload-file'>";
         $html .= "<p><input type='file' name='{$this->fieldname}' tabindex='{$this->tabindex}' value='' /></p>";
         $html .= "</div>";
     }
     $html .= "</div>";
     return $html;
 }
예제 #6
0
 public function control_panel__add_routes()
 {
     $app = \Slim\Slim::getInstance();
     $app->get('/raven', function () use($app) {
         authenticateForRole('admin');
         doStatamicVersionCheck($app);
         $template_list = array("raven-overview");
         Statamic_View::set_templates(array_reverse($template_list), __DIR__ . '/templates');
         $data = $this->tasks->getOverviewData();
         if (count($data['formsets']) === 1) {
             $app->redirect($app->urlFor('raven') . '/' . key($data['formsets']));
         }
         $app->render(null, array('route' => 'raven', 'app' => $app) + $data);
     })->name('raven');
     $app->get('/raven/:formset', function ($formset) use($app) {
         authenticateForRole('admin');
         doStatamicVersionCheck($app);
         $template_list = array("raven-detail");
         Statamic_View::set_templates(array_reverse($template_list), __DIR__ . '/templates');
         $app->render(null, array('route' => 'raven', 'app' => $app) + $this->tasks->getFormsetData($formset));
     });
     $app->get('/raven/:formset/spam', function ($formset) use($app) {
         authenticateForRole('admin');
         doStatamicVersionCheck($app);
         $template_list = array("raven-spam");
         Statamic_View::set_templates(array_reverse($template_list), __DIR__ . '/templates');
         $app->render(null, array('route' => 'raven', 'app' => $app) + $this->tasks->getFormsetSpamData($formset));
     });
     $app->get('/raven/:formset/export', function ($formset) use($app) {
         authenticateForRole('admin');
         doStatamicVersionCheck($app);
         $res = $app->response();
         $res['Content-Type'] = 'text/csv';
         $res['Content-Disposition'] = 'attachment;filename=' . $formset . '-export.csv';
         $this->tasks->exportCSV($formset);
     });
     $app->post('/raven/:formset/batch', function ($formset) use($app) {
         authenticateForRole('admin');
         doStatamicVersionCheck($app);
         $files = (array) Request::fetch('files');
         $action = Request::fetch('action');
         $count = count($files);
         foreach ($files as $file) {
             switch ($action) {
                 case "delete":
                     File::delete($file);
                     break;
                 case "spam":
                     $this->tasks->markAsSpam($file);
                     break;
                 case "ham":
                     $this->tasks->markAsHam($file);
                     break;
             }
         }
         $app->flash('success', Localization::fetch('batch_' . $action));
         $app->redirect($app->urlFor('raven') . '/' . $formset);
     });
     $app->map('/raven/:formset/delete', function ($formset) use($app) {
         authenticateForRole('admin');
         doStatamicVersionCheck($app);
         $files = (array) Request::fetch('files');
         $count = count($files);
         foreach ($files as $file) {
             File::delete($file);
         }
         if ($count > 1) {
             $app->flash('success', Localization::fetch('files_deleted'));
         } else {
             $app->flash('success', Localization::fetch('file_deleted'));
         }
         $app->redirect($app->urlFor('raven') . '/' . $formset);
     })->via('GET', 'POST');
 }
예제 #7
0
        <div class="input-select-wrap">
          <select data-bind="enable: selectedEntries().length > 0, selectedOptions: selectedAction">
            <option value=""><?php 
echo Localization::fetch('take_action');
?>
</option>
            <option value="delete"><?php 
echo Localization::fetch('delete_entries');
?>
</option>
          </select>
        </div>
      </div>

       <input type="submit" class="btn pull-left" data-bind="visible: selectedAction() != '' && selectedEntries().length > 0" value="<?php 
echo Localization::fetch('confirm_action');
?>
">
    </div>
  </form>

  </div>
</div>


<script type="text/javascript">
  var viewModel = {
      selectedEntries: ko.observableArray(),
      selectedAction: ko.observable(''),
  };
예제 #8
0
파일: entries.php 프로젝트: nob/joi
              <th><div class="header-inner"><?php 
    echo Localization::fetch('date');
    ?>
</div></th>
            <?php 
} elseif ($type == 'number') {
    ?>
              <th><div class="header-inner"><?php 
    echo Localization::fetch('number');
    ?>
</div></th>
            <?php 
}
?>
            <th style="width:80px"><div class="header-inner"><?php 
echo Localization::fetch('status');
?>
</div></th>
          </tr>
        </thead>
        <tbody>

        <?php 
foreach ($entries as $slug => $entry) {
    ?>
        <?php 
    $status = isset($entry['status']) ? $entry['status'] : 'live';
    ?>
          <tr>
            <td class="checkbox-col">
              <input type="checkbox" name="entries[]" value="<?php 
 public function index()
 {
     $str = $this->fetchParam('fetch', null, null, false, false);
     return Localization::fetch($str);
 }
예제 #10
0
파일: members.php 프로젝트: nob/joi
?>
 </span>
      <span class="folder"><?php 
echo Localization::fetch('members');
?>
</span>
    </div>
    <ul>
      <li>
        <a href="<?php 
print $app->urlFor('member') . "?new=1";
?>
">
          <span class="ss-icon">adduser</span>
          <?php 
echo Localization::fetch('new_member');
?>
        </a>
      </li>
    </ul>
  </div>

    <div class="section">

      <?php 
foreach ($members as $name => $member) {
    ?>
      <div class="block member-block">
        <img src="<?php 
    echo $member->get_gravatar(42);
    ?>
 public function member__forgot_password()
 {
     $globals = Statamic::loadAllConfigs();
     $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
     $token = filter_input(INPUT_POST, 'token', FILTER_SANITIZE_STRING);
     $return = filter_input(INPUT_POST, 'return', FILTER_SANITIZE_STRING);
     $reset_return = filter_input(INPUT_POST, 'reset_return', FILTER_SANITIZE_STRING);
     $referrer = Request::getReferrer();
     // validate form token
     if (!$this->tokens->validate($token)) {
         $this->flash->set('forgot_password_error', 'Invalid token.');
         URL::redirect($referrer);
     }
     // bail if member doesn't exist
     if (!($member = Member::load($username))) {
         $this->flash->set('forgot_password_error', Localization::fetch('member_doesnt_exist'));
         URL::redirect($referrer);
     }
     // cache reset data
     $token = $this->tokens->create();
     $reset_data = array('username' => $username);
     if (isset($reset_return)) {
         $reset_data['return'] = $reset_return;
     }
     $this->cache->putYAML($token, $reset_data);
     // generate reset url
     $reset_url = URL::makeFull($this->fetchConfig('reset_password_url', str_replace(Config::getSiteURL(), '', $referrer)));
     $reset_url .= '?H=' . $token;
     // send email
     $attributes = array('from' => $this->fetchConfig('email_sender', Config::get('email_sender'), null, false, false), 'to' => $member->get('email'), 'subject' => $this->fetchConfig('reset_password_subject', 'Password Reset', null, false, false));
     if ($html_template = $this->fetchConfig('reset_password_html_email', false, null, false, false)) {
         $attributes['html'] = Theme::getTemplate($html_template);
     }
     if ($text_template = $this->fetchConfig('reset_password_text_email', false, null, false, false)) {
         $attributes['text'] = Theme::getTemplate($text_template);
     }
     foreach ($attributes as $key => $value) {
         $attributes[$key] = Parse::template($value, array('reset_url' => $reset_url), array('statamic_view', 'callback'), $globals);
     }
     Email::send($attributes);
     $this->flash->set('forgot_password_sent', true);
     // redirect
     URL::redirect($return);
 }
 /**
  * Renames this member
  * 
  * @param string  $username  username to rename this Member to
  * @return boolean
  * @throws Exception
  */
 public function rename($username)
 {
     // the files in question
     $current_file = Config::getConfigPath() . '/users/' . $this->get('username') . '.yaml';
     $new_file = Config::getConfigPath() . '/users/' . $username . '.yaml';
     // is this the same that it already is?
     if ($username === $this->get('username')) {
         return true;
     }
     // is this a valid username?
     if (!self::isValidusername($username)) {
         throw new Exception(Localization::fetch('invalid_username'));
     }
     // does this filename already exist?
     if (File::exists($new_file)) {
         throw new Exception(Localization::fetch('username_already_exists'));
     }
     // everything checks out, rename the file and return true
     File::rename($current_file, $new_file);
     return true;
 }
>
          <?php 
    print Fieldtype::render_fieldtype($fieldtype, $key, $value, $val, tabindex(), $input_key);
    ?>
        </div>

      <?php 
}
?>
    </div>

    <div id="publish-action" class="footer-controls push-down">
      <button type="submit" class="btn" id="publish-submit"><?php 
echo Localization::fetch('save_publish');
?>
</button>
      <button type="submit" class="btn" id="publish-continue-submit" name="continue" value="true"><?php 
echo Localization::fetch('save_publish_continue');
?>
</button>
    </div>

  </form>
</div>

<?php 
function tabindex()
{
    static $count = 1;
    return $count++;
}
예제 #14
0
파일: error.php 프로젝트: nob/joi
<div id="screen">
  <h1><?php 
echo Localization::fetch('error');
?>
</h1>

  <?php 
if ($flash['error']) {
    ?>
  <div id="flash-msg-still" class="error">
    <span class="icon">c</span>
    <span class="msg"><?php 
    print $flash['error'];
    ?>
</p>
  </div>
  <?php 
}
?>

</div>
예제 #15
0
파일: pages.php 프로젝트: nob/joi
function display_folder($app, $folder, $base = "")
{
    ?>
  <ul class="subpages">
  <?php 
    foreach ($folder as $page) {
        ?>
  <li class="page">
    <div class="page-wrapper">
      <div class="page-primary">

      <!-- PAGE TITLE -->
        <?php 
        if ($page['type'] == 'file') {
            ?>
          <a href="<?php 
            print $app->urlFor('publish') . "?path={$base}/{$page['slug']}";
            ?>
"><span class="page-title"><?php 
            print isset($page['title']) ? $page['title'] : Statamic_Helper::prettify($page['slug']);
            ?>
</span></a>
        <?php 
        } else {
            ?>
          <a href="<?php 
            print $app->urlFor('publish') . "?path={$page['file_path']}";
            ?>
"><span class="page-title"><?php 
            print isset($page['title']) ? $page['title'] : Statamic_Helper::prettify($page['slug']);
            ?>
</span></a>

        <?php 
        }
        ?>

      <!-- ENTRIES -->
      <?php 
        if (isset($page['has_entries']) && $page['has_entries']) {
            ?>
        <div class="control-entries">
          <span class="ss-icon">textfile</span>
          <span class="muted"><?php 
            echo Localization::fetch('entries');
            ?>
:</span>
          <a href="<?php 
            print $app->urlFor('entries') . "?path={$base}/{$page['slug']}";
            ?>
">
            <?php 
            echo Localization::fetch('list');
            ?>
          </a>
          <span class="muted">or</span>
          <a href="<?php 
            print $app->urlFor('publish') . "?path={$base}/{$page['slug']}&new=true";
            ?>
">
            <?php 
            echo Localization::fetch('create');
            ?>
          </a>
        </div>
      <?php 
        }
        ?>
      </div>

      <!-- SLUG & VIEW PAGE LINK -->
      <div class="page-extras">

        <div class="page-view">
          <a href="<?php 
        print $page['url'];
        ?>
" class="tip" title="View Page">
            <span class="ss-icon">link</span>
          </a>
        </div>

        <?php 
        if ($page['type'] != 'file') {
            ?>
        <div class="page-add"><a href="#" data-path="<?php 
            print $page['raw_url'];
            ?>
" data-title="<?php 
            print $page['title'];
            ?>
" class="tip add-page-btn" title="<?php 
            echo Localization::fetch('new_child_page');
            ?>
"><span class="ss-icon">addfile</span></a></div>
        <?php 
        }
        ?>

        <?php 
        if (Config::get('_enable_delete_page', true)) {
            ?>
        <div class="page-delete">
          <a class="confirm" href="<?php 
            print $app->urlFor('delete_page') . '?path=' . $page['raw_url'] . '&type=' . $page['type'];
            ?>
" class="tip" title="<?php 
            echo Localization::fetch('delete_page');
            ?>
" data-confirm-message="Are you sure you wish to delete this page?">
            <span class="ss-icon">delete</span>
          </a>
        </div>
        <?php 
        }
        ?>

        <div class="slug-preview">
          <?php 
        print isset($page['url']) ? $page['url'] : $base . ' /' . $page['slug'];
        ?>
        </div>

      </div>

    </div>
    <?php 
        if (isset($page['children']) && sizeof($page['children']) > 0) {
            display_folder($app, $page['children'], $base . "/" . $page['slug']);
        }
        ?>

  </li>
  <?php 
    }
    ?>
  </ul>
  <?php 
}
<div class="container">

  <div class="error-block">
    <h1><?php 
echo Localization::fetch('error');
?>
</h1>

    <p class="msg"><?php 
echo Localization::fetch($_GET['code']);
?>
</p>

    <a href="#" class="btn push-down go-back"><span class="ss-icon">directleft</span> Go back</a>

  </div>


</div>
 public function index($value, $parameters = array())
 {
     return Helper::makeSentenceList($value, Localization::fetch('and'));
 }
</strong> <span class="muted"><?php 
echo Localization::fetch('form', null, true);
?>
 <?php 
echo Localization::fetch('submissions', null, true);
?>
    </div>
    <ul>
      <li>
        <a href="<?php 
echo $app->urlFor("raven") . '/' . $name;
?>
/export">
          <span class="ss-icon">downloadfile</span>
          <?php 
echo Localization::fetch('export_csv');
?>
        </a>
      </li>
    </ul>
  </div>
  
  <?php 
if ($metrics) {
    ?>
  <div class="section">
    <table class="simple-table metrics">
      <tbody>
        <tr>
          <?php 
    foreach ($metrics as $metric) {
예제 #19
0
파일: publish.php 프로젝트: nob/joi
        <span class="folder"><?php 
echo $identifier;
?>
</span>
      </div>
      <ul>
        <li>
          <?php 
print Fieldtype::render_fieldtype('status', 'status', array('display' => 'status'), $status, tabindex());
?>
        </li>
        <li>
          <a href="#" class="faux-submit">
            <span class="ss-icon">check</span>
            <?php 
echo Localization::fetch('save_publish');
?>
          </a>
        </li>
      </ul>
    </div>

    <div class="section content">

      <?php 
print Hook::run('control_panel', 'add_to_publish_form', 'cumulative');
?>

      <input type="hidden" name="page[full_slug]" value="<?php 
print $full_slug;
?>
 public function reset_password_form()
 {
     $data = array();
     $errors = array();
     // parse parameters and vars
     $attr_string = '';
     $site_root = Config::getSiteRoot();
     $logged_in_redirect = $this->fetchParam('logged_in_redirect', $this->fetchConfig('member_home', $site_root), null, false, false);
     $attr = $this->fetchParam('attr', false);
     $hash = filter_input(INPUT_GET, 'H', FILTER_SANITIZE_URL);
     // is user already logged in? forward as needed
     if (Auth::isLoggedIn()) {
         URL::redirect($logged_in_redirect, 302);
     }
     // no hash in URL?
     if (!$hash) {
         $errors[] = Localization::fetch('reset_password_url_invalid');
         $data['url_invalid'] = true;
     }
     if (count($errors) == 0) {
         // cache file doesn't exist or is too old
         if (!$this->cache->exists($hash) || $this->cache->getAge($hash) > $this->fetchConfig('reset_password_age_limit') * 60) {
             $errors[] = Localization::fetch('reset_password_url_expired');
             $data['expired'] = true;
         }
         // flash errors
         if ($flash_error = $this->flash->get('reset_password_error')) {
             $errors[] = $flash_error;
         }
     }
     // set up attributes
     if ($attr) {
         $attributes_array = Helper::explodeOptions($attr, true);
         foreach ($attributes_array as $key => $value) {
             $attr_string .= ' ' . $key . '="' . $value . '"';
         }
     }
     // errors
     $data['errors'] = $errors;
     // set up form HTML
     $html = '<form method="post" action="' . Path::tidy($site_root . "/TRIGGER/member/reset_password") . '" ' . $attr_string . '>';
     $html .= '<input type="hidden" name="token" value="' . $this->tokens->create() . '">';
     $html .= '<input type="hidden" name="hash" value="' . $hash . '">';
     $html .= Parse::template($this->content, $data);
     $html .= '</form>';
     // return that HTML
     return $html;
 }
예제 #21
0
function display_folder($app, $folder, $base = "")
{
    ?>
  <ul class="subpages">
  <?php 
    foreach ($folder as $page) {
        ?>
  <?php 
        if (CP_Helper::is_page_visible($page)) {
            ?>
  <li class="page">
    <div class="page-wrapper">
      <div class="page-primary">

      <!-- PAGE TITLE -->
        <?php 
            if ($page['type'] == 'file') {
                ?>
          <a href="<?php 
                print $app->urlFor('publish') . "?path={$base}/{$page['slug']}";
                ?>
"><span class="page-title"><?php 
                print isset($page['title']) ? $page['title'] : Slug::prettify($page['slug']);
                ?>
</span></a>
        <?php 
            } else {
                ?>
          <a href="<?php 
                print $app->urlFor('publish') . "?path={$page['file_path']}";
                ?>
"><span class="page-title"><?php 
                print isset($page['title']) ? $page['title'] : Slug::prettify($page['slug']);
                ?>
</span></a>

        <?php 
            }
            ?>

      <!-- ENTRIES -->
      <?php 
            if (isset($page['has_entries']) && $page['has_entries']) {
                ?>
        <div class="control-entries">
          <span class="ss-icon">textfile</span>
          <span class="muted"><?php 
                echo $page['entries_label'];
                ?>
:</span>
          <a href="<?php 
                print $app->urlFor('entries') . "?path={$base}/{$page['slug']}";
                ?>
">
            <?php 
                echo Localization::fetch('list');
                ?>
          </a>
          <span class="muted"><?php 
                echo Localization::fetch('or');
                ?>
</span>
          <a href="<?php 
                print $app->urlFor('publish') . "?path={$base}/{$page['slug']}&new=true";
                ?>
">
            <?php 
                echo Localization::fetch('create');
                ?>
          </a>
        </div>
      <?php 
            }
            ?>
      </div>

      <!-- SLUG & VIEW PAGE LINK -->
      <div class="page-extras">

        <div class="page-view">
          <a href="<?php 
            print Path::tidy(Config::getSiteRoot() . '/' . $page['url']);
            ?>
" class="tip" title="View Page">
            <span class="ss-icon">link</span>
          </a>
        </div>

        <?php 
            if ($page['type'] != 'file' && Config::get('_enable_add_child_page', true)) {
                ?>
          <div class="page-add"><a href="#" data-path="<?php 
                print $page['raw_url'];
                ?>
" data-title="<?php 
                print $page['title'];
                ?>
" class="tip add-page-btn add-page-modal-trigger" title="<?php 
                echo Localization::fetch('new_child_page');
                ?>
"><span class="ss-icon">addfile</span></a></div>
        <?php 
            }
            ?>

        <?php 
            if (Config::get('_enable_delete_page', true)) {
                ?>
          <div class="page-delete">
            <?php 
                if (array_get($page, '_admin:protected', false)) {
                    ?>
              <a alt="This page is protected" class="tip"><span class="ss-icon protected">lock</span></a>
            <?php 
                } else {
                    ?>
              <a class="confirm tip" href="<?php 
                    print $app->urlFor('delete_page') . '?path=' . $page['raw_url'] . '&type=' . $page['type'];
                    ?>
" title="<?php 
                    echo Localization::fetch('delete_page');
                    ?>
" data-confirm-message="<?php 
                    echo Localization::fetch('pagedelete_confirm');
                    ?>
">
                <span class="ss-icon">delete</span>
              </a>
            <?php 
                }
                ?>
          </div>
        <?php 
            }
            ?>

        <div class="slug-preview">
          <?php 
            print isset($page['url']) ? $page['url'] : $base . ' /' . $page['slug'];
            ?>
        </div>

      </div>

    </div>
    <?php 
            if (isset($page['children']) && sizeof($page['children']) > 0) {
                display_folder($app, $page['children'], $base . "/" . $page['slug']);
            }
            ?>

  </li>
  <?php 
        }
        ?>
  <?php 
    }
    ?>
  </ul>
  <?php 
}
예제 #22
0
파일: default.php 프로젝트: nob/joi
    <?php 
    if (isset($app->config['latest_version']) && $app->config['latest_version'] != '' && STATAMIC_VERSION < $app->config['latest_version']) {
        ?>
      <a href="https://store.statamic.com/account"><?php 
        echo Localization::fetch('update_available');
        ?>
: v<?php 
        echo $app->config['latest_version'];
        ?>
</a>
    <?php 
    } else {
        ?>
      <?php 
        echo Localization::fetch('up_to_date');
        ?>
    <?php 
    }
    ?>
  <?php 
} else {
    ?>
    <a href="http://store.statamic.com">This site is unlicensed. Please purchase and enter your license key.</a>
  <?php 
}
?>
  </span>
</div>

<script type="text/javascript">
예제 #23
0
 /**
  * Create friendly error messages for upload issues
  * 
  * @param int  $error  Error int
  * @return string
  */
 private static function getFriendlyErrorMessage($error)
 {
     // these errors are PHP-based
     if ($error === UPLOAD_ERR_OK) {
         return '';
     } elseif ($error === UPLOAD_ERR_INI_SIZE) {
         return Localization::fetch('upload_error_ini_size');
     } elseif ($error === UPLOAD_ERR_FORM_SIZE) {
         return Localization::fetch('upload_error_form_size');
     } elseif ($error === UPLOAD_ERR_PARTIAL) {
         return Localization::fetch('upload_error_err_partial');
     } elseif ($error === UPLOAD_ERR_NO_FILE) {
         return Localization::fetch('upload_error_no_file');
     } elseif ($error === UPLOAD_ERR_NO_TMP_DIR) {
         return Localization::fetch('upload_error_no_temp_dir');
     } elseif ($error === UPLOAD_ERR_CANT_WRITE) {
         return Localization::fetch('upload_error_cant_write');
     } elseif ($error === UPLOAD_ERR_EXTENSION) {
         return Localization::fetch('upload_error_extension');
     } else {
         // we should never, ever see this
         return Localization::fetch('upload_error_unknown');
     }
 }
예제 #24
0
    public static function get_content_tree($directory = '/', $depth = 1, $max_depth = 5, $folders_only = false, $include_entries = false, $hide_hidden = true, $include_content = false, $site_root = false)
    {
        // $folders_only = true only page.md
        // folders_only = false includes any numbered or non-numbered page (excluding anything with a fields.yaml file)
        // if include_entries is true then any numbered files are included

        $content_root = Config::getContentRoot();
        $content_type = Config::getContentType();
        $site_root    = $site_root ? $site_root : Config::getSiteRoot();

        $current_url = Path::tidy($site_root . '/' . Request::getResourceURI());

        $taxonomy_url = false;
        if (Taxonomy::isTaxonomyURL($current_url)) {
            list($taxonomy_type, $taxonomy_name) = Taxonomy::getCriteria($current_url);
            $taxonomy_url = self::remove_taxonomy_from_path($current_url, $taxonomy_type, $taxonomy_name);
        }

        $directory = '/' . $directory . '/'; #ensure proper slashing

        if ($directory <> '/') {
            $base = Path::tidy("{$content_root}/{$directory}");
        } elseif ($directory == '/') {
            $base = "{$content_root}";
        } else {
            $base = "{$content_root}";
        }

        $files = glob("{$base}/*");


        $data = array();
        if ($files) {
            foreach ($files as $path) {
                $current_name = basename($path);

                if (!Pattern::endsWith($current_name, '.yaml')) {

                    // Hidden page that should be removed
                    if ($hide_hidden && Pattern::startsWith($current_name, '_')) continue;

                    $node = array();
                    $file = substr($path, strlen($base) + 1, strlen($path) - strlen($base) - strlen($content_type) - 2);

                    if (is_dir($path)) {
                        $folder        = substr($path, strlen($base) + 1);
                        $node['type']  = 'folder';
                        $node['slug']  = basename($folder);
                        $node['title'] = ucwords(basename($folder));

                        $node['numeric'] = Slug::getOrderNumber($folder);

                        $node['file_path'] = Path::tidy($site_root . '/' . $directory . '/' . $folder . '/page');

                        if (Slug::isNumeric($folder)) {
                            $pos = strpos($folder, ".");
                            if ($pos !== false) {
                                $node['raw_url'] = Path::tidy(Path::clean($site_root . '/' . $directory . '/' . $folder));
                                $node['url']     = Path::clean($node['raw_url']);
                                $node['title']   = ucwords(basename(substr($folder, $pos + 1)));
                            } else {
                                $node['title']   = ucwords(basename($folder));
                                $node['raw_url'] = Path::tidy($site_root . '/' . $directory . '/' . $folder);
                                $node['url']     = Path::clean($node['raw_url']);
                            }
                        } else {
                            $node['title']   = ucwords(basename($folder));
                            $node['raw_url'] = Path::tidy($site_root . '/' . $directory . '/' . $folder);
                            $node['url']     = Path::clean($node['raw_url']);
                        }

                        $node['depth']      = $depth;
                        $node['children']   = $depth < $max_depth ? self::get_content_tree($directory . $folder . '/', $depth + 1, $max_depth, $folders_only, $include_entries, $hide_hidden, $include_content, $site_root) : null;
                        $node['is_current'] = $node['raw_url'] == $current_url || $node['url'] == $current_url ? true : false;

                        $node['is_parent'] = false;
                        if ($node['url'] == URL::popLastSegment($current_url) || ($taxonomy_url && $node['url'] == $taxonomy_url)) {
                            $node['is_parent'] = true;
                        }

                        $node['has_children'] = $node['children'] ? true : false;

                        // has entries?
                        if (File::exists(Path::tidy($path . "/fields.yaml"))) {
                            $node['has_entries'] = true;
                            $fields_raw  = File::get(Path::tidy($path . "/fields.yaml"));
                            $fields_data = YAML::parse($fields_raw);
                            $node['entries_label'] = array_get($fields_data, '_entries_label', Localization::fetch('entries'));
                        } else {
                            $node['has_entries'] = false;
                        }

                        $meta = self::get_content_meta("page", Path::tidy($directory . "/" . $folder), false, true);
                        //$meta = self::get_content_meta("page", Statamic_Helper::reduce_double_slashes($directory."/".$folder));

                        if (isset($meta['title'])) {
                            $node['title'] = $meta['title'];
                        }

                        if (isset($meta['last_modified'])) {
                            $node['last_modified'] = $meta['last_modified'];
                        }

                        if ($hide_hidden === true && (isset($meta['status']) && (($meta['status'] == 'hidden' || $meta['status'] == 'draft')))) {
                            // placeholder condition
                        } else {
                            $data[] = $include_content ? array_merge($meta, $node) : $node;
                            // print_r($data);
                        }

                    } else {
                        if (Pattern::endsWith($path, $content_type)) {
                            if ($folders_only == false) {
                                if ($file == 'page' || $file == 'feed' || $file == '404') {
                                    // $node['url'] = $directory;
                                    // $node['title'] = basename($directory);

                                    // $meta = self::get_content_meta('page', substr($directory, 1));
                                    // $node['depth'] = $depth;
                                } else {
                                    $include = true;

                                    // date based is never included
                                    if (Config::getEntryTimestamps() && Slug::isDateTime(basename($path))) {
                                        $include = false;
                                    } elseif (Slug::isDate(basename($path))) {
                                        $include = false;
                                    } elseif (Slug::isNumeric(basename($path))) {
                                        if ($include_entries == false) {
                                            if (File::exists(Path::tidy(dirname($path) . "/fields.yaml"))) {
                                                $include = false;
                                            }
                                        }
                                    }

                                    if ($include) {
                                        $node['type']    = 'file';
                                        $node['raw_url'] = Path::tidy($directory) . basename($path);

                                        $pretty_url         = Path::clean($node['raw_url']);
                                        $node['url']        = substr($pretty_url, 0, -1 * (strlen($content_type) + 1));
                                        $node['is_current'] = $node['url'] == $current_url || $node['url'] == $current_url ? true : false;

                                        $node['slug'] = substr(basename($path), 0, -1 * (strlen($content_type) + 1));

                                        $meta = self::get_content_meta(substr(basename($path), 0, -1 * (strlen($content_type) + 1)), substr($directory, 1), false, true);

                                        //$node['meta'] = $meta;

                                        if (isset($meta['title'])) $node['title'] = $meta['title'];
                                        $node['depth'] = $depth;

                                        if ($hide_hidden === true && (isset($meta['status']) && (($meta['status'] == 'hidden' || $meta['status'] == 'draft')))) {
                                        } else {
                                            $data[] = $include_content ? array_merge($meta, $node) : $node;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        return $data;
    }
    ?>
>
          <?php 
    print Fieldtype::render_fieldtype($fieldtype, $key, $value, $val, tabindex(), $input_key, null, $error);
    ?>
        </div>

      <?php 
}
?>

    </div>

    <div id="publish-action" class="footer-controls push-down">
      <input type="submit" class="btn" value="<?php 
echo Localization::fetch('save');
?>
" id="publish-submit">
    </div>

  </form>
</div>
<?php 
function tabindex()
{
    static $count = 1;
    return $count++;
}
?>

<script type="text/javascript">
 private function abortDeletion($error)
 {
     return array('success' => false, 'message' => Localization::fetch($error));
 }
예제 #27
0
        ?>
</a>
    <?php 
    } else {
        ?>
      <?php 
        echo Localization::fetch('up_to_date');
        ?>
    <?php 
    }
    ?>
  <?php 
} else {
    ?>
    <a href="http://store.statamic.com"><?php 
    echo Localization::fetch('site_unlicensed');
    ?>
</a>
  <?php 
}
?>
  </span>
</div>

<script type="text/javascript">

  <?php 
if ($flash['success']) {
    ?>
    alertify.log("<?php 
    print $flash['success'];
<div id="screen">
  <h1><?php 
echo Localization::fetch('access_denied');
?>
</h1>
</div>
<!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><?php 
echo Config::getSiteName();
?>
 <?php 
echo Localization::fetch('login');
?>
</title>
  <?php 
if (!Config::get('disable_google_fonts', false)) {
    ?>
    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Raleway:400,700|Open+Sans:400italic,400,600" />
  <?php 
}
?>
  <link rel="stylesheet" href="<?php 
echo Path::tidy(Config::getSiteRoot() . '/' . $app->config['theme_path']);
?>
css/ascent.min.css">
  <link rel="icon" href="<?php 
echo Path::tidy(Config::getSiteRoot() . '/' . $app->config['theme_path']);
?>
img/favicon.png" sizes="16x16" type="img/png" />
  <script type="text/javascript" src="<?php 
echo Path::tidy(Config::getSiteRoot() . '/' . $app->config['theme_path']);
?>
js/ascent.min.js"></script>
예제 #30
0
파일: routes.php 프로젝트: jalmelb/24hl2015
$admin_app->get('/images', function () use($admin_app) {
    authenticateForRole('admin');
    doStatamicVersionCheck($admin_app);
    $path = $admin_app->request()->get('path');
    $image_list = glob($path . "*.{jpg,jpeg,gif,png}", GLOB_BRACE);
    $images = array();
    if (count($image_list) > 0) {
        foreach ($image_list as $image) {
            $images[] = array('thumb' => '/' . $image, 'image' => '/' . $image);
        }
    }
    echo json_encode($images);
})->name('images');
/*
|--------------------------------------------------------------------------
| Hook: Add Routes
|--------------------------------------------------------------------------
|
| Allows add-ons to add their own hooks to the control panel.
|
*/
Hook::run('control_panel', 'add_routes');
// GET: 404
// --------------------------------------------------------
$admin_app->notFound(function () use($admin_app) {
    authenticateForRole('admin');
    doStatamicVersionCheck($admin_app);
    $admin_app->flash('error', Localization::fetch('admin_404'));
    $redirect_to = Config::get('_admin_404_page', $admin_app->urlFor('pages'));
    $admin_app->redirect($redirect_to);
});