本文整理汇总了PHP中pathang类的典型用法代码示例。如果您正苦于以下问题:PHP pathang类的具体用法?PHP pathang怎么用?PHP pathang使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pathang类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: krishna
public function krishna()
{
$request = pathang::getInstance('request');
$request->page = 'color';
$request->color = 'red';
pathang::render('sample', 'krishna');
}
示例2: main
public function main()
{
$tmpl = pathang::getInstance('packet')->get('tmpl');
if ($tmpl) {
pathang::display($tmpl);
}
}
示例3: theme
public function theme()
{
$request = pathang::getInstance('request');
$request->page = 'color';
$request->color = 'voilet';
pathang::render('sample', 'themes');
}
示例4: renderView
public function renderView()
{
$heading = "giving wings to developers !";
$data = "<p>Do you know... you can render this page in three different formats?</p>\n\t\t<p> For normal view with template its root_url/render, To get the json format you need to suffix .json to the url... \n\t\tlike this root_url/render.json and to display html version by excluding the template... suffix the url with .html ex: root_url/render.html</p>";
$basket = pathang::getInstance('basket');
$basket->set('heading', $heading);
$basket->set('message', $data);
}
示例5: main
public function main()
{
//openmenu based on page either 'feed','admin' or 'mainpage'
$page = strtoupper(pathang::getInstance('node')->get('n1'));
if ($page === 'FEED' || $page === 'ADMIN') {
pathang::display(strtolower($page));
} else {
pathang::display();
}
}
示例6: main
public function main()
{
//$username = pathang::getInstance('node')->get('n1');
//$uid = pathang::getModel('userlog')->getUserId($username);
pathang::GetInstance('request')->set('snippet', 1);
$popular = pathang::getController('profile')->popular();
$count = 0;
pathang::GetInstance('packet')->Set('popular', $popular);
pathang::GetInstance('packet')->Set('count', $count);
pathang::display();
}
示例7: main
public function main()
{
$username = pathang::getInstance('node')->get('n1');
$uid = pathang::getModel('userlog')->getUserId($username);
pathang::GetInstance('request')->set('snippet', 1);
$following = pathang::getController('profile')->following();
$count = pathang::getModel('profile')->followingCount($uid);
pathang::GetInstance('packet')->Set('following', $following);
pathang::GetInstance('packet')->Set('count', $count);
pathang::display();
}
示例8: saveNotification
public function saveNotification($uid, $agent, $target, $action)
{
$time_stamp = date("Y-m-d H:i:s");
$status = 1;
//pdo object and table
$pdo = pathang::getInstance('pdo');
$table = 'notifications';
// sql insert statement
$sql = "INSERT INTO {$table} \r\n\t\t\t\t\t\t(uid,agent,target,action,time_stamp,status) \r\n\t\t\t\t VALUES ({$uid},{$agent},{$target},'{$action}','{$time_stamp}',{$status})";
$result = $pdo->exec($sql);
$insertId = $pdo->lastInsertId();
if ($insertId) {
return $insertId;
} else {
return false;
}
}
示例9: start
public static function start()
{
if (session_id() == '') {
session_start();
session_regenerate_id(true);
}
if (isset($_SESSION['timeout'])) {
$session_life = time() - $_SESSION['timeout'];
$expire = $_SESSION['expire'];
//echo $session_life.' '.$expire;
if ($session_life > $expire) {
self::destroy();
}
}
$pathang = pathang::getInstance('pathang');
$expire = $pathang->SITE->SESSION_EXPIRE;
self::expire($expire);
}
示例10: main
public function main()
{
//display menu as user/guest or admin
$n1 = pathang::getInstance('node')->get('n1');
$session = pathang::getInstance('session');
$liveuser = $session->get('liveuser');
if ($liveuser) {
$uid = $liveuser->id;
$unread = pathang::GetModel('profile')->getUnreadNotificationCount($uid);
pathang::getInstance('packet')->set('unread', $unread);
if ($liveuser->type == 1) {
pathang::display();
} else {
pathang::display('admin');
}
} else {
pathang::display('guest');
}
}
示例11: create_tables
public function create_tables($db_name, $host, $user, $pass)
{
$db = new PDO("mysql:host=localhost;dbname={$db_name}", $user, $pass);
$file = 'app/db.json';
if (file_exists($file)) {
$setting = json_decode(file_get_contents($file));
foreach ($setting as $key => $value) {
$db->exec($value);
}
}
//create admin
$request = pathang::GetInstance('request');
$name = ucwords($request->filterHTMLSQL('name'));
$username = $request->filterHTMLSQL('username');
$password = $request->filterHTMLSQL('password');
$email = $request->filterHTMLSQL('email');
$hash = md5($password);
$activation = 1;
$timestamp = date("Y-m-d H:i:s");
$feeds_per_page = pathang::getInstance('pathang')->FEEDSTACK->FEED_COUNT;
$access = 1;
$bio = "Hey people im a new entry to this website..hope to have fun..follow me to get updates.";
$image_type = 'server';
//pdo object and table
$pdo = $db;
$table = 'users';
// sql insert statement
$sql = "INSERT INTO {$table} \r\n\t\t\t\t\t\t(bio,image_type,name,username,password,email,type,block,\r\n\t\t\t\t\t\t activation,creation_timestamp,feeds_per_page,access,lastlogin_timestamp) \r\n\t\t\t\t VALUES ('{$bio}','{$image_type}','{$name}','{$username}','{$hash}','{$email}',2,0,\r\n\t\t\t\t \t\t '{$activation}','{$timestamp}',{$feeds_per_page},{$access},'{$timestamp}')";
// type 1 - users, type 2 - moderator, type 3 - administrator
// creation and lastlogin time is set to same value
// password is md5 hash of the given value
// activation is a random 8 char code
$result = $pdo->exec($sql);
$uid = $pdo->lastInsertId();
//self follow
$time_stamp = date("Y-m-d H:i:s");
$table = 'followers';
$follow_id = $uid;
// sql insert statement
$sql = "INSERT INTO {$table} \r\n\t\t\t\t\t\t(uid,follow_id,time_stamp) \r\n\t\t\t\t VALUES ({$uid},{$follow_id},'{$time_stamp}')";
$result = $pdo->exec($sql);
}
示例12: getCount
public function getCount($table)
{
//pdo object and table
$pdo = pathang::getInstance('pdo');
if ($table == 'followers') {
$sql = "SELECT count(*) 'count' \r\n\t\t\t\t\tFROM {$table} where uid!=follow_id";
} else {
// sql insert statement
$sql = "SELECT count(*) 'count' \r\n\t\t\t\t\tFROM {$table}";
}
//query and fetch the result
$res = $pdo->query($sql);
$result = $res->fetch(PDO::FETCH_ASSOC);
//if record found return activation else false
if ($result) {
return $result['count'];
} else {
return null;
}
}
示例13: main
public function main()
{
// get request object
$request = pathang::GetInstance('request');
// set the snippet,limit and unread varaibles
$request->Set('snippet', 'one');
$request->set('limit', 3);
$request->set('unread', true);
// if user exists then only display
if (isset(pathang::GetInstance('session')->get('liveuser')->username)) {
$liveuser = pathang::GetInstance('session')->get('liveuser')->username;
$user = pathang::GetInstance('node')->get('n1');
//if the user is liveuser then display
if ($user == $liveuser) {
//get notification and counter
$notify = pathang::getController('profile')->notifications()->messages;
$count = pathang::getController('profile')->notifications()->unread;
pathang::GetInstance('packet')->set('notify', $notify);
pathang::GetInstance('packet')->set('count', $count);
pathang::display();
}
}
}
示例14:
<div class="bcol-100 logo"><?php
pathang::snippet('logo');
?>
</div>
<div class="bcol-100 menu">
<span class="menu-text">+ menu</span>
<?php
pathang::snippet('menu');
?>
</div>
<div class="clear"></div>
</div>
</div>
<div class="body">
<div class="container-main pad-20">
<div class="app"><?php
pathang::app();
?>
</div>
</div>
</div>
<div class="footer">
<div class="container-main pad-20">
<div class="footer-pad"><?php
pathang::Snippet('footer');
?>
</div>
</div>
</div>
</body>
</html>
示例15:
<!--
Reset Password Page
_________________________________________
-Input box to take new password and post to url
user/forgot for processing.
-Code in the url is the key factor to change the
password in backend processing.
-->
<?php
//get the hash code to form the url
$code = pathang::getInstance('node')->get('n3');
?>
<div class="box-userlog">
<h1>Reset Password</h1>
<form action="<?php
echo ROOT;
?>
user/forgot/<?php
echo $code;
?>
" method="post" >
<input type="password" class="input" name="password" placeholder="password"/><br>
<input type="password" class="input" name="re-password" placeholder="retype password"/><br>
<button class="btn btn-login">Reset Password</button>
</form>
</div>