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 render() { //calling a model class and tiggering a method $model = pathang::getModel('sample'); $model->renderView(); //changing the parameters of kite to load a different page with a color $request = pathang::getInstance('request'); $request->page = 'color'; $request->color = 'blue'; pathang::render('sample', 'render'); }
public function admin() { $n2 = strtoupper(pathang::getInstance('node')->get('n2')); $liveuser_id = null; $liveuser = pathang::GetInstance('session')->get('liveuser'); if ($liveuser) { $liveuser_id = $liveuser->id; } $isadmin = pathang::getModel('userlog')->isAdmin($liveuser_id); if (!$isadmin) { pathang::GetInstance('pathang')->SITE->PAGE = 'login'; $basket = pathang::GetInstance('basket'); $basket->set('heading', 'Restricted Access !'); $basket->set('message', 'You dont have enough privilege to acces this page. Sorry for the inconvenience. '); pathang::render('general', 'errorpage'); exit; } else { if ($n2 == null) { $n2 = 'main'; } pathang::getController('admin')->{$n2}(); } }
public function checkToken($token) { $string = str_rot13($token); $peices = explode('t', $string); $time_stamp = date('Y-m-d H:i:s', $peices[0]); $uid = $peices[1]; $status = pathang::getModel('userlog')->validateTimestamp($uid, $time_stamp); return $status; }
public function emailCheck() { $email = pathang::getInstance('request')->filterHTMLSQL('email'); $checkEmail = pathang::getModel('userlog')->emailCheck($email); if ($checkEmail) { echo 1; } else { echo 0; } }
public function notifications() { $basket = pathang::getInstance('basket'); $request = pathang::getInstance('request'); $snippet = $request->get('snippet'); $user = pathang::getInstance('node')->get('n1'); $limit = pathang::GetInstance('pathang')->FEEDSTACK->NOTIFICATION_CENTER_COUNT; if ($request->get('limit')) { $limit = $request->get('limit'); } $liveuser = null; if (pathang::getInstance('session')->get('liveuser')) { $liveuser = pathang::getInstance('session')->get('liveuser')->username; $uid = pathang::getInstance('session')->get('liveuser')->id; } if ($user == $liveuser) { $notify = pathang::getModel('profile')->getUserNotifications($user, $limit); $notifyObj = new stdclass(); if (isset($notify)) { foreach ($notify as $a => $b) { $notifyTemp = new stdClass(); foreach ($b as $c => $d) { $notifyTemp->{$c} = $d; } $notifyTemp->time_stamp = pathang::getHelper('feedprocess')->ago($notifyTemp->time_stamp); $notifyObj->{$a} = $notifyTemp; } } $notifyTemp2 = new stdclass(); $notifyTemp2->unread = pathang::GetModel('profile')->getUnreadNotificationCount($uid); $notifyTemp2->messages = $notifyObj; if ($snippet) { return $notifyTemp2; } $basket->set('notify', $notifyObj); pathang::getInstance('pathang')->SITE->PAGE = 'members'; pathang::render('profile', 'notifications'); //update notifacations read pathang::GetModel('profile')->updateReadNotifications($uid); } else { pathang::getInstance('pathang')->SITE->PAGE = 'login'; $basket->set('heading', 'Restricted Access'); $basket->set('message', 'You dont have enough permission to access this page.'); pathang::render('general', 'errorpage'); exit; } }
public function deleteComment() { $request = pathang::getInstance('request'); $comment_id = $request->get('comment_id'); //check for validity of access token pathang::getHelper('userlog')->ajaxAuthentication(); pathang::getModel('feed')->deleteFeedComment($comment_id); return 1; }
public function notify() { $request = pathang::GetInstance('request'); $target = $request->get('target'); $agent = $request->get('agent'); $action = $request->get('action'); $uid = $request->get('uid'); //check for validity of access token pathang::getHelper('userlog')->ajaxAuthentication(); pathang::getModel('usermain')->saveNotification($uid, $agent, $target, $action); }