Esempio n. 1
0
 static function login()
 {
     global $panel;
     $result = false;
     if (get('login')) {
         $result = $panel->user->login();
         if (success($result)) {
             go(thisURL());
         }
     }
     return $result;
 }
Esempio n. 2
0
 static function changeDirname()
 {
     global $page, $pages;
     if ($page->isHomePage()) {
         return array('status' => 'error', 'msg' => l::get('options.errors.homepage'));
     }
     if ($page->isErrorPage()) {
         return array('status' => 'error', 'msg' => l::get('options.errors.errorpage'));
     }
     $uid = get('uid');
     $name = $page->num() ? $page->num() . '-' . $uid : $uid;
     if ($name == $page->dirname()) {
         return array('status' => 'success', 'msg' => l::get('nochanges'));
     }
     if (!preg_match('!^[a-z0-9-_]+$!i', $name)) {
         return array('status' => 'error', 'msg' => l::get('options.errors.characters'));
     }
     $oldRoot = $page->root();
     $newRoot = dirname($page->root()) . '/' . $name;
     if (!is_writable($oldRoot)) {
         return array('status' => 'error', 'msg' => l::get('options.errors.permissions'));
     }
     if (is_dir($newRoot)) {
         return array('status' => 'error', 'msg' => l::get('options.errors.exists'));
     }
     $siblings = $page->siblings();
     $check = $siblings ? $siblings->find($uid) : false;
     if ($check) {
         return array('status' => 'error', 'msg' => l::get('options.errors.exists'));
     }
     $move = dir::move($oldRoot, $newRoot);
     if (!$move) {
         return array('status' => 'error', 'msg' => l::get('options.errors.move'));
     }
     $url = str_replace('/' . $page->uid() . '/', '/' . $uid . '/', thisURL());
     self::killCache();
     go($url);
 }
// set the defaults
if (!isset($disqus_shortname)) {
    die('Please pass the disqus shortname');
}
if (!isset($disqus_title)) {
    $disqus_title = $page->title();
}
if (!isset($disqus_developer)) {
    $disqus_developer = false;
}
if (!isset($disqus_identifier)) {
    $disqus_identifier = $page->uri();
}
if (!isset($disqus_url)) {
    $disqus_url = thisURL();
}
$disqus_title = addcslashes($disqus_title, "'");
$disqus_developer = $disqus_developer ? 'true' : 'false';
?>
<div id="disqus_thread"></div>
<script type="text/javascript">
  var disqus_shortname  = '<?php 
echo $disqus_shortname;
?>
'; // required: replace example with your forum shortname
  var disqus_title      = '<?php 
echo html($disqus_title);
?>
';
  var disqus_developer  = '<?php 
Esempio n. 4
0
<?php

require_once 'config.php';
require_once 'functions.php';
require_once '../common/db.php';
try {
    // Database connection first.
    $db = new CompactDB($mt_dbhost, $mt_dbname, $mt_dbuser, $mt_dbpass);
    $q = new Query($db);
    $chunks = $q->select('id,content')->from('track')->where("processed=0")->run();
    // Required objects and set up
    $c = new Canvas(thisURL());
    $c->common->addScriptRef(APP_URL . 'files/jquery.js');
    $c->common->addScriptRef(APP_URL . 'files/jquery-effects.js');
    switch ($c->getMode()) {
        /* --------------------------------------------------------------------------------------------------------- */
        case 'show':
        default:
            // We create the toolbar
            $t = new Toolbar();
            $c->register($t);
            // If there are chunks to process, we display a button.
            if (count($chunks) > 0) {
                $t->addAction('Process ' . count($chunks) . ' tracks', "doConfirm('This action may take a long time and make the browser\\nto timeout. Are you sure you want to do this?','process')", 'go-jump');
            }
            // We retrieve all the tracks we have stored in a pretty table.
            $mtrx = $db->qSelect("select t.id, t.name, t.pid, from_unixtime(t.offset/1000) as t_start, round(max(e.t)/1000,1) as t_duration " . "from track as t, event as e where t.id=e.track_id and t.processed=1 group by e.track_id;");
            $tab = new Table($mtrx);
            $tab->setProperty('highlight', true);
            $tab->setProperty('numbering', true);
            $tab->setProperty('id', 'id');
Esempio n. 5
0
<?php

if (!defined('KIRBY')) {
    die('Direct access is not allowed');
}
snippet('header');
if (!$page->isHomePage() && !$page->isErrorPage()) {
    $action = action::updateURL();
    ?>
<div class="options form">

  <form action="<?php 
    echo thisURL();
    ?>
" method="post">
    
    <fieldset>    
      <div class="field url">
        <label><?php 
    echo l::get('options.url');
    ?>
</label>
        <span class="url input"><em><?php 
    echo dirname(ourl($page->url()));
    ?>
/</em><strong><input type="url" name="uid" value="<?php 
    echo $page->uid();
    ?>
" /></strong></span>
      </div>
    </fieldset>
Esempio n. 6
0
 /**
  * Avoid direct link for sections
  *
  * @param Page $page The Page of the section
  * @param string $redirectToParent If true, the page will be redirected the the parent page
  * @return void
  * @author fenixkim
  */
 public static function avoidDirectLink($page, $redirectToParent = true, $addHash = true)
 {
     $template = $page->template();
     // If the URLs Match is because is a direct link
     if (thisURL() === (string) $page->url()) {
         $parent = $page->parent();
         if ($parent && $redirectToParent) {
             go($parent->url() . '/' . ($addHash ? '#' . $page->uid() : ''));
         } else {
             go(site()->errorPage());
         }
     }
 }
Esempio n. 7
0
?>
</link>
    <description><?php 
echo $site->description();
?>
</description>
    <generator><?php 
echo c::get('feed.generator', 'Kirby');
?>
</generator>
    <lastBuildDate><?php 
echo isset($modified) ? date('r', $modified) : date('r', $site->modified());
?>
</lastBuildDate>
    <atom:link href="<?php 
echo xml(thisURL());
?>
" rel="self" type="application/rss+xml" />

    <?php 
if ($page->description() || isset($description)) {
    ?>
    <description><?php 
    echo isset($description) ? xml($description) : xml($page->description());
    ?>
</description>
    <?php 
}
?>
  
    <?php