Beispiel #1
0
 public function index($args)
 {
     $db = $this->database();
     $s = new model_section($db);
     $p = new model_page($db);
     $md = new markdown_parser();
     $rt = explode("/", $args["_url"]);
     $s->load_from_name(strlen($rt[0]) > 0 ? $rt[0] : "home");
     array_shift($rt);
     $rt = implode("/", $rt);
     $cur_url = strlen($rt) > 0 ? $args["_url"] : $s->default_page();
     $p->load_from_url($cur_url);
     $navs = MODEL_SECTION::get_sections($db);
     $subnavs = $s->get_pages();
     $tpl = new view($this->registry);
     $tpl->set("cur_url", $cur_url);
     $tpl->set("title", $p->title);
     $tpl->set("navs", $navs);
     $tpl->set("subnavs", $subnavs);
     $tpl->set("page", $s->name);
     $tpl->set("content", $p->is_markdown ? array("markdown" => $md->transform($p->content)) : array("html" => $p->content));
     $tpl->set("s_intro", $md->transform($s->introduction));
     $tpl->set("s_img", $s->image);
     $tpl->show("default");
 }
Beispiel #2
0
 /**
  * 图片上传
  */
 public function upload()
 {
     view::show(false);
     $json = array();
     $json['error'] = 0;
     $json['url'] = 'https://image.gatherup.cc/2016051515083636542_10277411847325777_1265886255.jpeg';
     echo json_encode($json);
 }
Beispiel #3
0
 public function edit()
 {
     $controller = lib::getitem('controller');
     if (empty($controller->params[0])) {
         lib::sendto();
     } else {
         $user = new user((int) $controller->params[0]);
         echo view::show('users/edit', array('user' => $user));
     }
 }
Beispiel #4
0
 public function defaultaction()
 {
     if (!auth::isloggedin()) {
         lib::sendto('/login');
     } else {
         $contacts = new contactscollection(lib::getitem('user'));
         $contacts->getwithdata();
         echo view::show('contacts/browse', array('contacts' => $contacts));
     }
 }
Beispiel #5
0
 public function render($filename, $parameters, $uri = null)
 {
     if ($uri === null) {
         $uri = $this->_uri;
     }
     $view = new view();
     $view->setFilename(dirname($this->_filename) . '/' . $filename);
     $view->setUri($uri);
     $view->show($parameters);
 }
 protected function _view($filename, $parameters = array(), $uri = null)
 {
     if ($uri === null) {
         $uri = $this->rel();
     }
     $view = new view();
     //echo $filename;
     $view->setFilename($filename);
     $view->setUri($uri);
     $view->show($parameters);
     //include($filename);
 }
Beispiel #7
0
 public function index($args)
 {
     $view = new view();
     $db = $this->database();
     $this->load_locale("lang");
     $g = new model_game($db);
     //		$g->assign_targets();
     $g->kill_agent("Edward");
     $view->set("games", MODEL_KILL::killboard_list());
     $view->set("page_title", L_PAGE_TITLE);
     $view->set("site_name", L_SITE_NAME);
     $view->show("home");
 }
Beispiel #8
0
 public function __construct($request = '')
 {
     $this->content_type = 'text/html';
     $this->error_type = 0;
     $this->succeed = TRUE;
     $request = ltrim($request, '/');
     $ext = 'cache';
     //检测环境
     if (!RUN_ENV) {
         $this->error_type = 'no_run_env';
         $this->succeed = FALSE;
     } elseif ($request === '' && WELCOME_DOC) {
         //显示欢迎页面
         view::show('welcome');
         return;
     } else {
         //检查防盗链
         $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
         @($referer = parse_url($referer));
         $referer = isset($referer['host']) ? $referer['host'] : '';
         if (ALLOW_REGX && !preg_match('/' . ALLOW_REGX . '/i', $referer)) {
             $this->error_type = 'not_allowed_domain';
             $this->succeed = FALSE;
         } else {
             //匹配文件后缀
             $mime_types = array('3gp' => 'video/3gpp', 'ai' => 'application/postscript', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'asc' => 'text/plain', 'atom' => 'application/atom+xml', 'au' => 'audio/basic', 'avi' => 'video/x-msvideo', 'bcpio' => 'application/x-bcpio', 'bin' => 'application/octet-stream', 'bmp' => 'image/bmp', 'cdf' => 'application/x-netcdf', 'cgm' => 'image/cgm', 'class' => 'application/octet-stream', 'cpio' => 'application/x-cpio', 'cpt' => 'application/mac-compactpro', 'csh' => 'application/x-csh', 'css' => 'text/css', 'dcr' => 'application/x-director', 'dif' => 'video/x-dv', 'dir' => 'application/x-director', 'djv' => 'image/vnd.djvu', 'djvu' => 'image/vnd.djvu', 'dll' => 'application/octet-stream', 'dmg' => 'application/octet-stream', 'dms' => 'application/octet-stream', 'doc' => 'application/msword', 'dtd' => 'application/xml-dtd', 'dv' => 'video/x-dv', 'dvi' => 'application/x-dvi', 'dxr' => 'application/x-director', 'eps' => 'application/postscript', 'etx' => 'text/x-setext', 'exe' => 'application/octet-stream', 'ez' => 'application/andrew-inset', 'flv' => 'video/x-flv', 'gif' => 'image/gif', 'gram' => 'application/srgs', 'grxml' => 'application/srgs+xml', 'gtar' => 'application/x-gtar', 'gz' => 'application/x-gzip', 'hdf' => 'application/x-hdf', 'hqx' => 'application/mac-binhex40', 'htm' => 'text/html', 'html' => 'text/html', 'ice' => 'x-conference/x-cooltalk', 'ico' => 'image/x-icon', 'ics' => 'text/calendar', 'ief' => 'image/ief', 'ifb' => 'text/calendar', 'iges' => 'model/iges', 'igs' => 'model/iges', 'jnlp' => 'application/x-java-jnlp-file', 'jp2' => 'image/jp2', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'js' => 'application/x-javascript', 'kar' => 'audio/midi', 'latex' => 'application/x-latex', 'lha' => 'application/octet-stream', 'lzh' => 'application/octet-stream', 'm3u' => 'audio/x-mpegurl', 'm4a' => 'audio/mp4a-latm', 'm4p' => 'audio/mp4a-latm', 'm4u' => 'video/vnd.mpegurl', 'm4v' => 'video/x-m4v', 'mac' => 'image/x-macpaint', 'man' => 'application/x-troff-man', 'mathml' => 'application/mathml+xml', 'me' => 'application/x-troff-me', 'mesh' => 'model/mesh', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mif' => 'application/vnd.mif', 'mov' => 'video/quicktime', 'movie' => 'video/x-sgi-movie', 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'mp4' => 'video/mp4', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpga' => 'audio/mpeg', 'ms' => 'application/x-troff-ms', 'msh' => 'model/mesh', 'mxu' => 'video/vnd.mpegurl', 'nc' => 'application/x-netcdf', 'oda' => 'application/oda', 'ogg' => 'application/ogg', 'ogv' => 'video/ogv', 'pbm' => 'image/x-portable-bitmap', 'pct' => 'image/pict', 'pdb' => 'chemical/x-pdb', 'pdf' => 'application/pdf', 'pgm' => 'image/x-portable-graymap', 'pgn' => 'application/x-chess-pgn', 'pic' => 'image/pict', 'pict' => 'image/pict', 'png' => 'image/png', 'pnm' => 'image/x-portable-anymap', 'pnt' => 'image/x-macpaint', 'pntg' => 'image/x-macpaint', 'ppm' => 'image/x-portable-pixmap', 'ppt' => 'application/vnd.ms-powerpoint', 'ps' => 'application/postscript', 'qt' => 'video/quicktime', 'qti' => 'image/x-quicktime', 'qtif' => 'image/x-quicktime', 'ra' => 'audio/x-pn-realaudio', 'ram' => 'audio/x-pn-realaudio', 'ras' => 'image/x-cmu-raster', 'rdf' => 'application/rdf+xml', 'rgb' => 'image/x-rgb', 'rm' => 'application/vnd.rn-realmedia', 'roff' => 'application/x-troff', 'rtf' => 'text/rtf', 'rtx' => 'text/richtext', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'silo' => 'model/mesh', 'sit' => 'application/x-stuffit', 'skd' => 'application/x-koan', 'skm' => 'application/x-koan', 'skp' => 'application/x-koan', 'skt' => 'application/x-koan', 'smi' => 'application/smil', 'smil' => 'application/smil', 'snd' => 'audio/basic', 'so' => 'application/octet-stream', 'spl' => 'application/x-futuresplash', 'src' => 'application/x-wais-source', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'svg' => 'image/svg+xml', 'swf' => 'application/x-shockwave-flash', 't' => 'application/x-troff', 'tar' => 'application/x-tar', 'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex', 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'tr' => 'application/x-troff', 'tsv' => 'text/tab-separated-values', 'txt' => 'text/plain', 'ustar' => 'application/x-ustar', 'vcd' => 'application/x-cdlink', 'vrml' => 'model/vrml', 'vxml' => 'application/voicexml+xml', 'wav' => 'audio/x-wav', 'wbmp' => 'image/vnd.wap.wbmp', 'wbxml' => 'application/vnd.wap.wbxml', 'webm' => 'video/webm', 'wml' => 'text/vnd.wap.wml', 'wmlc' => 'application/vnd.wap.wmlc', 'wmls' => 'text/vnd.wap.wmlscript', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'wmv' => 'video/x-ms-wmv', 'wrl' => 'model/vrml', 'xbm' => 'image/x-xbitmap', 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', 'xls' => 'application/vnd.ms-excel', 'xml' => 'application/xml', 'xpm' => 'image/x-xpixmap', 'xsl' => 'application/xml', 'xslt' => 'application/xslt+xml', 'xul' => 'application/vnd.mozilla.xul+xml', 'xwd' => 'image/x-xwindowdump', 'xyz' => 'chemical/x-xyz', 'zip' => 'application/zip');
             $basename = basename($request);
             $ext = strtolower(substr($basename, strrpos($basename, '.') + 1));
             if (isset($mime_types[$ext])) {
                 $this->content_type = $mime_types[$ext];
             }
             $direct = false;
             if (in_array($ext, explode('|', strtolower(DIRECT_EXT)))) {
                 $direct = true;
             }
         }
     }
     //开始处理
     $delete = false;
     if (count($purge = explode(PURGE_KEY . '/', $request, 2)) > 1) {
         $delete = true;
         $request = $purge[1];
     }
     $key = NO_KEY ? $request : md5($request) . '_' . strlen($request) . '.' . $ext;
     $this->hit = false;
     $this->handle($request, $key, $delete, $direct);
 }
Beispiel #9
0
 public function index($args)
 {
     $db = $this->database();
     $articles = array();
     $sth = $db->prepare("\n\t\t\tSELECT\t\tid, title, body, date_added, author, publisher, date\n\t\t\tFROM\t\tarticles\n\t\t\tORDER BY\tdate_added DESC\n\t\t\tLIMIT\t\t5\n\t\t");
     $sth->execute();
     while ($article = $sth->fetch()) {
         $seo_url = new seo_url($article);
         $s = new markdown_smartypantstypographer();
         $articles[] = array("id" => $article["id"], "title" => $article["title"], "excerpt" => $s->transform(utf8_encode(substr($article["body"], 0, 200))) . "…", "seo_url" => $seo_url->url, "date_added" => date("dS M", strtotime($article["date_added"])), "author" => $article["author"], "publisher" => $article["publisher"], "date" => $article["date"]);
     }
     $tpl = new view($this->registry);
     $tpl->set("articles", $articles);
     $tpl->set("page_title", "Look At That F***ing Title");
     $tpl->set("subview", "home_body");
     $tpl->show("home");
 }
Beispiel #10
0
 public function index($args)
 {
     $db = $this->database();
     $s = new model_section($db);
     $p = new model_page($db);
     $md = new markdown_parser();
     $rt = explode("/", $args["_url"]);
     $s->load_from_name(strlen($rt[0]) > 0 ? $rt[0] : "home");
     array_shift($rt);
     $rt = implode("/", $rt);
     $cur_url = strlen($rt) > 0 ? $args["_url"] : $s->default_page();
     $p->load_from_url($cur_url);
     $navs = MODEL_SECTION::get_sections($db);
     $subnavs = $s->get_pages();
     $tpl = new view($this->registry);
     if ($args["article"]) {
         # Loading and displaying an article.
         $a = new model_article($db, $args["article"]);
         $tpl->set("content", array("markdown" => $md->transform($a->body)));
         $tpl->set("title", $a->title);
     } else {
         # Listing articles.
         switch ($args["_url"]) {
             case "projects/other.html":
                 $listed = array(8, 9, 14);
                 $subtitle = "Other";
                 break;
             default:
                 $listed = array(13, 12, 11, 10, 15, 16, 17);
                 $subtitle = "KT-EQUAL";
                 break;
         }
         $projects = array();
         $projects = MODEL_ARTICLE::get_articles($db, $listed);
         $tpl->set("include", "subviews/project_list.php");
         $tpl->set("projects", $projects);
         $tpl->set("title", $subtitle . " Projects");
     }
     $tpl->set("cur_url", $cur_url);
     $tpl->set("navs", $navs);
     $tpl->set("subnavs", $subnavs);
     $tpl->set("page", $s->name);
     $tpl->set("s_intro", $md->transform($s->introduction));
     $tpl->set("s_img", $s->image);
     $tpl->show("default");
 }
Beispiel #11
0
 public function view($args)
 {
     $template = new view($this->registry);
     $db = $this->database();
     $sth = $db->prepare("\n\t\t\tSELECT \tid, title, body, author, date, publisher\n\t\t\tFROM \tarticles\n\t\t\tWHERE\tid = :id\n\t\t\tLIMIT \t1\n\t\t");
     $sth->execute(array(":id" => $args["id"]));
     $article = $sth->fetch();
     $template->set("page_title", "Look At That F***ing Title");
     $template->set("title", utf8_encode($article["title"]));
     $p = new markdown_parser();
     $s = new markdown_smartypantstypographer();
     include SITE_PATH . DIRSEP . "definitions" . DIRSEP . "article.php";
     $body_text = $p->transform($s->transform($article["body"]));
     $article_info = sprintf(HTML_ARTICLE_INFO, $article["author"], $article["date"], $article["publisher"]);
     $template->set("info", $article_info);
     $template->set("body", utf8_encode(sprintf(HTML_ARTICLE_BODY, $body_text)));
     $template->show("home");
 }
Beispiel #12
0
        <div class="row"><label>Grouping:</label>
        <input name="type[<?php 
echo $view['counter'];
?>
][label]" 
            value="<?php 
echo $view['group']->label;
?>
" /></div>
        <div>
            <?php 
if ($view['group'] instanceof contactgroup) {
    $methods = new contactmethodscollection($view['group']);
    $methods->getwithdata();
    foreach ($methods as $method) {
        echo view::show('contacts/method', array('method' => $method, 'counter' => $view['counter']));
    }
}
echo view::show('contacts/method', array('method' => null, 'counter' => $view['counter']));
?>
        </div>
         
        <?php 
if ($view['type'] == 'edit') {
    echo '<a href="#" class="deletecontactgrouping">Delete this group</a>';
} else {
    echo '<a href="#" class="addcontactgrouping">Add Another Grouping</a>';
}
?>
    </div>
Beispiel #13
0
 public static function show()
 {
     self::sendHeaders();
     view::show(self::$view);
 }
Beispiel #14
0
 public function view()
 {
     $controller = lib::getitem('controller');
     if (empty($controller->params[0])) {
         lib::sendto();
     } else {
         $params = new facadecontactinformation((int) $controller->params[0]);
         echo view::show('contacts/view', array('contact' => $params->contact, 'groups' => $params->groups, 'methods' => $params->methods));
     }
 }
Beispiel #15
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="/assets/main.css" />
	<title>Acme Company Contact Manager</title>
    <script type="text/javascript" src="/assets/jquery-1.3.2.min.js"></script>
</head>
<body>
    <div id="header"><?php 
echo view::show('standard/header');
?>
</div>
    <div id="body">
	   <?php 
echo $view['body'];
?>
    </div>
    <div id="footer"><?php 
echo view::show('standard/footer');
?>
</div>
</body>
</html>
Beispiel #16
0
    }
    $counter++;
    $group = null;
} else {
    $counter = 0;
    $group = new stdClass();
    $group->label = 'Business';
}
echo view::show('contacts/group', array('group' => $group, 'counter' => $counter, 'type' => 'add'));
?>
    
    <hr id="lastclone" />
    <div><label for="submit"> </label>
         <input id="submit" type="submit" value="<?php 
echo $view['title'];
?>
" class="submitbutton" />
    </div>
</form>
<div id="contactgroupingcontainer">
    <?php 
echo view::show('contacts/group', array('label' => 'Business', 'counter' => 0));
?>
</div>
<script type="text/javascript" src="/assets/managecontact.js"></script>
<script type="text/javascript">
var groupcount = <?php 
echo $counter;
?>
;
</script>
Beispiel #17
0
<?php

echo view::show('contacts/manage', array('title' => 'Edit Contact', 'action' => '/contacts/processedit', 'formid' => 'editform', 'type' => 'edit', 'contact' => $view['contact'], 'groups' => $view['groups']));
Beispiel #18
0
<h1>Your Contacts</h1>
<div id="browsecontacts">
<?php 
foreach ($view['contacts'] as $contact) {
    echo view::show('contacts/small', array('contact' => $contact));
}
echo '</div>';
if (!isset($contact)) {
    echo view::show('index/welcome');
}
<?php

require_once '../ignition.php';
define('INST_PATH', dirname(__FILE__) . '/');
//installtion path
$E = new view();
$E->set_layout(INST_PATH . 'view/layout.ly.php');
$required_php_veriosn = '5.2.0';
if (version_compare($required_php_version, phpversion()) > 0) {
    $E->error = 'PHP version ' . $required_php_version . ' or higher is needed to run Swifttide. Yours is ' . phpversion() . ' .';
    $E->set_view(INST_PATH . 'view/error.ly.php');
    $E->show();
    exit;
}
if (file_exists('../config.php')) {
    $E->error = 'File <tt>config.php</tt> already exists. Please delete this file in order to re-install Swifttide';
    $E->set_view(INST_PATH . 'view/error.ly.php');
    $E->show();
    exit;
}
Beispiel #20
0
<div class="sidebar"><br />
<a class="featured" href="/users/add">Add User</a>
</div>

<h1>User Admin</h1>
<p>
    Create, Edit or Delete users of the Contact System here.
</p>
<table>
<tr>
<th>Username</th>
<th>Admin?</th>
<th></th>
<th></th>
</tr>
<?php 
foreach ($view['users'] as $user) {
    echo view::show('users/row', array('user' => $user));
}
?>
</table>
<script type="text/javascript" src="/assets/removal.js"></script>
Beispiel #21
0
 public function defaultaction()
 {
     echo view::show('login/form');
 }
Beispiel #22
0
<?php

echo view::show('contacts/manage', array('title' => 'Add Contacts', 'action' => '/contacts/processadd', 'formid' => 'addform', 'type' => 'add'));
Beispiel #23
0
 /**
  * 输出内容文本可以包括Html
  * @access protected
  * @param string $content 输出内容
  * @param string $charset 模板输出字符集
  * @param string $contentType 输出类型
  * @return mixed
  */
 protected function show($content, $charset = '', $contentType = '')
 {
     $this->initView();
     return $this->view->show($content, $charset, $contentType);
 }
Beispiel #24
0
<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/12/11
 * Time: 14:28
 */
require 'includes/autoloader.php';
require 'includes/exceptions.php';
session_start();
$view = new view();
lib::setitem('controller', new controller($_GET['u']));
lib::getitem('controller')->render();
$content = $view->finish();
echo view::show('shell', array('body' => $content));
Beispiel #25
0
<?php

$contactname = "{$view['contact']->firstname} {$view['contact']->middlename} {$view['contact']->lastname}";
echo view::show('contacts/viewsidebar', array('contactname' => $contactname, 'id' => $view['contact']->id));
print "<h1>{$contactname}</h1>";
foreach ($view['groups'] as $group) {
    print "<fieldset><legend>{$group->label}</legend>";
    print '<table>';
    foreach ($view['methods'][$group->id] as $method) {
        $decoratorclass = "decorator{$method->type}";
        if (class_exists($decoratorclass)) {
            $decorator = new $decoratorclass();
            $method->value = $decorator->decorate($method->value);
        }
        print "<tr><td>{$method->type}:</td><td>{$method->value}</td></tr>";
    }
    print '</table>';
    print "</fieldset>";
}
?>
<script type="text/javascript" src="/assets/removal.js"></script>
Beispiel #26
0
<?php

echo view::show('users/manage', array('title' => 'Add User', 'action' => '/users/processadd'));
Beispiel #27
0
<?php

echo view::show('users/manage', array('title' => 'Edit User', 'action' => '/users/processedit', 'user' => $view['user']));
Beispiel #28
0
<div id="loginbox">
	<h1>Login</h1>
	<?php 
echo view::show('standard/errors');
?>
	<form action="/login/process" method="post">
		<div class="row"><label for="username">Username:</label><input type="text" name="username" id="username" value="<?php 
echo lib::getitem('username');
?>
" /></div>
		<div class="row"><label for="password">Password:</label><input type="password" name="password" id="password" /></div>
		<div class="row"><label for="submit"> </label><input id="submit" type="submit" value="login" class="submitbutton" /></div>
	</form>
</div>