public function krishna() { $request = pathang::getInstance('request'); $request->page = 'color'; $request->color = 'red'; pathang::render('sample', 'krishna'); }
public function main() { $tmpl = pathang::getInstance('packet')->get('tmpl'); if ($tmpl) { pathang::display($tmpl); } }
public function theme() { $request = pathang::getInstance('request'); $request->page = 'color'; $request->color = 'voilet'; pathang::render('sample', 'themes'); }
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); }
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(); } }
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(); }
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(); }
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; } }
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); }
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'); } }
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); }
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; } }
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(); } } }
<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>
<!-- 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>
" from="<?php echo $id; ?> "></div> <?php if ($count == $i && $heading == 'Members') { ?> <div class="loadmore-members" id="<?php echo $id; ?> "> Load more members </div> <?php } ?> </div> </div> <?php $show = pathang::GetInstance('pathang')->AD_BLOCK->VISIBLE; if ($show) { ?> <div > <?php pathang::getInstance('packet')->set('tmpl', '728'); pathang::snippet('ads'); ?> </div> <?php } ?> </div>
<!-- Logged in Page _________________________________________ -User Page after login which displays the username and logout button. --> <div class="box-userlog"> <?php $liveuser = pathang::getInstance('session')->get('liveuser'); ?> <img src="<?php echo $liveuser->image; ?> " class="login-image"/ > <h1>Hi <a href="<?php echo ROOT . $liveuser->username; ?> "> <span style="color:#2980b9"><?php echo $liveuser->name; ?> </span> </a> </h1> <h4><a href="<?php echo ROOT; ?> user/logout">Logout</a></h4>
<?php $username = pathang::getInstance('session')->get('liveuser')->username; $unread = pathang::getInstance('packet')->get('unread'); ?> <ul class="menu-bar"> <a href="<?php echo ROOT; ?> " ><li><i class="fa fa-space fa-home"></i>Home</li></a> <a href="<?php echo ROOT; ?> admin" ><li><i class="fa fa-space fa-dashboard"></i>Admin</li></a> <a href="<?php echo ROOT . $username; ?> " ><li><i class="fa fa-space fa-user"> </i>Profile <?php if ($unread) { ?> <span class="menu-unread"><i class="fa da-space fa-bell"></i> <?php echo $unread; ?> </span> <?php } ?> </li> </a>
<title><?php pathang::Meta('title'); ?> </title> <link href="<?php echo ROOT . 'themes' . DS . 'colors' . DS . 'style.css'; ?> " rel="stylesheet"> <link href="<?php echo ROOT . 'themes' . DS . 'colors' . DS . 'kolor.css'; ?> " rel="stylesheet"> </head> <?php $request = pathang::getInstance('request'); $color = $request->get('color'); ?> <body class="<?php echo $color; ?> "> <div class="page"> <?php pathang::app(); ?> </div> </body> </html>
public function getFeedsFollowing($uid = null, $type = null, $from = null, $limit = null) { //pdo object and table $pdo = pathang::getInstance('pdo'); $table = 'feeds'; if (!$limit) { $limit = '3'; } if ($uid) { if ($type) { if ($from) { $sql = "SELECT f.feed,f.uid,f.views,f.feed_container,u.username,u.name,u.image_type,u.email,f.id,f.time_stamp \n\t\t\t\t\tFROM feeds f,users u,followers w\n\t\t\t\t\tWHERE (w.follow_id = f.uid )\n\t\t\t\t\tand w.uid = {$uid} and f.uid = u.id and f.feed_type ='{$type}' and f.id < {$from} ORDER BY f.id \n\t\t\t\t\tdesc LIMIT {$limit}"; } else { $sql = "SELECT f.feed,f.uid,f.views,f.feed_container,u.username,u.name,u.image_type,u.email,f.id,f.time_stamp \n\t\t\t\t\tFROM feeds f,users u,followers w\n\t\t\t\t\tWHERE w.uid={$uid} and f.uid = w.follow_id and f.uid = u.id and f.feed_type ='{$type}'\n\t\t\t\t\tORDER BY f.id \n\t\t\t\t\tdesc LIMIT {$limit}"; } } else { if ($from) { $sql = "SELECT f.feed,f.uid,f.views,f.feed_container,u.username,u.name,u.image_type,u.email,f.id,f.time_stamp \n\t\t\t\t\tFROM feeds f,users u,followers w\n\t\t\t\t\tWHERE (w.follow_id = f.uid) and w.uid = {$uid} and f.uid = u.id and f.id < {$from} ORDER BY f.id \n\t\t\t\t\tdesc LIMIT {$limit}"; } else { $sql = "SELECT f.feed,f.uid,f.views,f.feed_container,u.username,u.name,u.image_type,u.email,f.id,f.time_stamp \n\t\t\t\t\tFROM feeds f,users u,followers w\n\t\t\t\t\tWHERE f.uid = u.id and (w.follow_id = f.uid ) and w.uid = {$uid} \n\t\t\t\t\tORDER BY f.id \n\t\t\t\t\tdesc LIMIT {$limit}"; } } } if (isset($sql)) { //query and fetch the result $res = $pdo->query($sql); $result = $res->fetchALL(PDO::FETCH_ASSOC); //if record found return activation else false if ($result) { return $result; } else { return null; } } else { return null; } }
public function user() { $n2 = strtoupper(pathang::getInstance('node')->get('n2')); switch ($n2) { case 'LOGIN': case 'LOGOUT': case 'REGISTER': case 'FORGOT': case 'USERNAMECHECK': case 'EMAILCHECK': pathang::getController('userlog')->{$n2}(); break; case 'SEARCH': case 'FOLLOW': case 'UNFOLLOW': case 'NOTIFY': pathang::getController('usermain')->{$n2}(); break; default: $this->main(); } }
public function main() { pathang::display(); }
echo ROOT; ?> lib/jform/jform.js"></script> <script src="<?php echo ROOT; ?> lib/upload/script.js"></script> <script src="<?php echo ROOT; ?> lib/upload/drop.js"></script> <div class="root" root="<?php echo ROOT; ?> " access-token='<?php echo pathang::GetInstance('session')->get('token'); ?> '></div> <div class="image_container"> <div class="load_pad"> <div class="load"> <div class="drop" u="<?php echo ROOT . 'editor'; ?> "> Drop the Image Here <form action="<?php echo ROOT . $username; ?> /image_upload" method="post" id="myForm" class="form well"
<meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="<?php pathang::Meta('desc'); ?> "> <meta name="author" content="<?php pathang::Meta('author'); ?> "> <meta name="keywords" content="<?php pathang::Meta('keywords'); ?> "> <title><?php pathang::Meta('title'); ?> </title> <!-- Adding Favicon --> <link rel="shortcut icon" href="<?php echo ROOT; ?> favicon.ico"> <!-- Linking style sheets --> <link rel="stylesheet" href="lib/font-awesome/css/font-awesome.css" > <link href="<?php echo 'themes' . DS . 'simplex' . DS . 'css' . DS . 'bottle.css'; ?> " rel="stylesheet"> <style> body{
<style> .ad-block{ margin:10px; margin-top:20px; padding:5px; background: white; width:250px; height:250px; } </style> <div class="ad-block"> <?php if (isset(pathang::getInstance('pathang')->AD_BLOCK->{$tmpl})) { $code = pathang::getInstance('pathang')->AD_BLOCK->{$tmpl}; echo $code; } else { ?> <img src="<?php echo ROOT; ?> img/250.png"/> <?php } ?> </div>
<?php $likers = pathang::getInstance('basket')->get('likers'); ?> <h3> Feed Liked by</h3> <div class="outer-container-liker"> <?php foreach ($likers as $liker) { ?> <div class="liker-container"> <div class='liker-image-container'> <a href="<?php echo $liker->profile_link; ?> "> <img src="<?php echo $liker->image; ?> " class="liker-image" > </a> <div class="liker-name"> <a href="<?php echo $liker->profile_link; ?> "><?php echo ucfirst($liker->name); ?> </a> </div> </div> </div>
<a href="<?php echo ROOT; ?> " > <img src="<?php echo pathang::getInstance('pathang')->SITE->LOGO; ?> " /> </a>
public static function Meta($key) { $pathang = pathang::getInstance('pathang'); $key = strtoupper($key); if (isset($pathang->META->{$key})) { echo $pathang->META->{$key}; } }
<script src="<?php echo ROOT . 'app' . DS . 'script' . DS . 'readmore.js'; ?> "></script> <script src="<?php echo ROOT . 'app' . DS . 'script' . DS . 'wall.js'; ?> "></script> <?php $feed = pathang::getInstance('basket')->Get('feed'); $profile_link = ROOT . $feed->username; $basket = pathang::getInstance('basket'); $token = null; if (isset(pathang::getInstance('session')->get('liveuser')->id)) { $liveuser_id = pathang::getInstance('session')->get('liveuser')->id; $token = pathang::getInstance('session')->get('liveuser')->access_token; } else { $liveuser_id = null; } $allowed_delete = $basket->get('allowed_delete'); ?> <div class="login-popup popup" ><b>Please Login to continue</b> <br> <a href="<?php echo ROOT; ?> user/login"><button class='btn btn-login'>login</button></a> <button class='btn btn-cancel'>cancel</button> </div> <div class="root" root="<?php echo ROOT; ?>
<style> </style> <?php $followers = pathang::getInstance('packet')->get('followers'); $count = pathang::getInstance('packet')->get('count'); $username = pathang::getInstance('node')->get('n1'); $check = 0; foreach ($followers as $follow) { $check = 1; break; } ?> <div class="follower-container"> <div class="block"> <a href="<?php echo ROOT . $username; ?> /followers"> <div class="follower-title">Followers <span class="follower-count"><?php echo $count; ?> </span></div> </a> <?php if (!$check) { echo '<div class="well">No member is following</div>'; } else { foreach ($followers as $user) { echo "<a href='" . $user->profile_link . "' id='tooltip' >\n\t\t\t<img src='" . $user->image . "' class='followers tooltip' title='" . $user->name . "' /></a>"; }