本文整理汇总了PHP中loggedIn函数的典型用法代码示例。如果您正苦于以下问题:PHP loggedIn函数的具体用法?PHP loggedIn怎么用?PHP loggedIn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loggedIn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
if (loggedIn()) {
new MenuItem(array("name" => "reportThis", "label" => "<i class='icon ion-flag'></i>", "menu" => "header_right", "title" => "Report This", "page" => "reportThis?p=" . currentURL()));
}
new Admintab("reported_content");
}
示例2: __construct
public function __construct()
{
new Accesshandler("friends");
if (loggedIn()) {
new MenuItem(array("name" => "friends", "label" => translate("friends"), "page" => "friends", "menu" => "my_account", "weight" => 50));
new MenuItem(array("name" => "friend_requests", "label" => translate("friend_requests"), "page" => "Friendrequests", "menu" => "my_account", "weight" => 100));
new Usersetting(array("name" => "notify_when_friend_request_sent", "field_type" => "dropdown", "options" => array("email" => "Email", "site" => "Site", "both" => "Both", "none" => "None"), "tab" => "notifications", "default_value" => "both"));
new Usersetting(array("name" => "notify_when_friend_request", "field_type" => "dropdown", "options" => array("email" => "Email", "site" => "Site", "both" => "Both", "none" => "None"), "tab" => "notifications", "default_value" => "both"));
if (currentPage() == "profile" && pageArray(1)) {
if (pageArray(1) != getLoggedInUserGuid()) {
if (!FriendsPlugin::requestSent(getLoggedInUserGuid(), pageArray(1))) {
if (!FriendsPlugin::friends(pageArray(1), getLoggedInUserGuid())) {
new MenuItem(array("name" => "add_friend", "label" => translate("add_friend"), "page" => addTokenToURL("action/addFriend/" . pageArray(1)), "menu" => "profile", "weight" => 10, "link_class" => "list-group-item list-group-item-info confirm"));
} else {
new MenuItem(array("name" => "remove_friend", "label" => translate("remove_friend"), "page" => addTokenToURL("action/removeFriend/" . pageArray(1)), "menu" => "profile", "weight" => 10, "link_class" => "list-group-item list-group-item-warning confirm"));
}
} else {
new MenuItem(array("name" => "friend_request_sent", "label" => translate("friendship_requested"), "page" => "friend", "menu" => "profile", "weight" => 20, "link_class" => "list-group-item confirm"));
}
}
}
}
new ViewExtension("profile/left", "friends/profile", "after");
new ViewExtension('pages/home_stats', 'pages/friend_stats');
new ViewExtension("user/buttons", "friends/friend_button");
}
示例3: init
public function init($file)
{
if (!loggedIn()) {
return false;
}
if (!is_a($file, "SocialApparatus\\File")) {
return false;
}
$product = getEntity($file->container_guid);
if (!is_a($product, "SocialApparatus\\Product")) {
return false;
}
$user = getLoggedInUser();
if ($user->stripe_cust) {
\Stripe\Stripe::setApiKey(EcommercePlugin::secretKey());
$orders = \Stripe\Order::all(array("limit" => 300, "customer" => $user->stripe_cust));
foreach ($orders['data'] as $order) {
foreach ($order->items as $item) {
if ($item->description != "Taxes (included)" && $item->description != "Free shipping") {
$sku = $item->parent;
if ($sku == $product->stripe_sku) {
return true;
}
}
}
}
}
return false;
}
示例4: init
public function init()
{
if (loggedIn()) {
return true;
}
return false;
}
示例5: requireLogin
function requireLogin()
{
// prevents unauthorised access to the registered users pages...called on the controllers for these pages...
if (!loggedIn()) {
header('Location: ?page=redirect');
}
}
示例6: __construct
public function __construct()
{
$title = $body = $button = NULL;
switch (pageArray(1)) {
case "all":
default:
if (loggedIn()) {
$admin_groups = Setting::get("admin_groups");
if (!$admin_groups) {
$admin_groups = "users";
}
if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
$button = "<a href='" . getSiteURL() . "groups/create' class='btn btn-success'>Create a Group</a>";
}
}
$title = "Groups";
$body = display("pages/groups");
break;
case "create":
$admin_groups = Setting::get("admin_groups");
if (!$admin_groups) {
$admin_groups = "user";
}
if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
$title = "Create a Group";
$body = drawForm(array("name" => "create_group", "action" => "createGroup", "method" => "post", "files" => true));
}
break;
case "view":
$guid = pageArray(2);
$group = getEntity($guid);
$edit_url = getSiteURL() . "groups/edit/{$guid}";
$delete_url = addTokenToURL(getSiteURL() . "action/deleteGroup/{$guid}");
if ($group->ownerIsLoggedIn()) {
$button = "<a href='{$edit_url}' class='btn btn-warning'>Edit Group</a>";
$button .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete Group</a>";
}
if (GroupsPlugin::loggedInUserCanJoin($group)) {
$join_group_url = addTokenToURL(getSiteURL() . "action/JoinGroup/" . $group->guid);
$button .= "<a href='{$join_group_url}' class='btn btn-success confirm'>Join Group</a>";
}
if ($group->loggedInUserIsMember() && $group->owner_guid != getLoggedInUserGuid()) {
$leave_group_url = addTokenToURL(getSiteURL() . "action/LeaveGroup/" . $group->guid);
$button .= "<a href='{$leave_group_url}' class='btn btn-danger confirm'>Leave Group</a>";
}
$title = $group->title;
$body = display("pages/group");
break;
case "edit":
$guid = pageArray(2);
$group = getEntity($guid);
$title = "Edit " . $group->title;
$body = drawForm(array("name" => "edit_group", "action" => "editGroup", "method" => "post", "files" => true));
break;
}
$this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button));
}
示例7: __construct
public function __construct()
{
$title = $body = $buttons = $breadcrumbs = NULL;
switch (pageArray(1)) {
default:
$body = display("pages/forum");
$title = "Forum Categories";
if (adminLoggedIn()) {
$add_category_url = getSiteURL() . "forum/add_category";
$buttons = "<a href='{$add_category_url}' class='btn btn-danger'>Add a Category</a>";
}
$breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"));
break;
case 'add_category':
adminGateKeeper();
$body = drawForm(array("name" => "add_category", "method" => "post", "action" => "addCategory"));
$title = "Add a Forum Category";
break;
case 'category':
$guid = pageArray(2);
if ($guid) {
$category = getEntity($guid);
$body = display("forum/category");
if (loggedIn()) {
$add_topic_url = getSiteURL() . "forum/add_topic/{$guid}";
$buttons = "<a href='{$add_topic_url}' class='btn btn-success'>Add Topic</a>";
}
}
$breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"), array("link" => getSiteURL() . "forum/category/" . $category->guid, "label" => $category->title));
break;
case "add_topic":
gateKeeper();
$category_guid = pageArray(2);
$category = getEntity($category_guid);
$body = drawForm(array("name" => "add_topic", "method" => "post", "action" => "addTopic"));
$title = "Add a topic to {$category->title}";
break;
case "topic":
$topic = getEntity(pageArray(2));
$category = getEntity($topic->container_guid);
$breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"), array("link" => getSiteURL() . "forum/category/" . $category->guid, "label" => $category->title), array("link" => getSiteURL() . "forum/topic/" . $topic->guid, "label" => $topic->title));
$body = display("forum/topic");
break;
case "editCategory":
adminGateKeeper();
$title = "Edit Forum Category";
$body = drawForm(array("name" => "edit_category", "method" => "post", "action" => "editCategory'"));
break;
case "editTopic":
adminGateKeeper();
$title = "Edit Forum Topic";
$body = drawForm(array("name" => "edit_topic", "method" => "post", "action" => "editTopic"));
break;
}
$this->html = drawPage(array("header" => $title, "body" => $body, "button" => $buttons, "breadcrumbs" => $breadcrumbs));
}
示例8: __construct
public function __construct()
{
new CSS("files", getSitePath() . "core_plugins/files/assets/css/files.css", 600);
new FooterJS("files", getSiteURL() . "core_plugins/files/assets/js/files.js", 600, true);
if (loggedIn()) {
new StorageType("File", "path", "text");
new StorageType("File", "description", "text");
new StorageType("File", "filename", "text");
new StorageType("File", "file_location", "text");
}
}
示例9: __construct
public function __construct()
{
parent::__construct();
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->library('hash');
$this->load->library('email');
$this->load->library('random');
if (!loggedIn()) {
return redirect('home');
}
}
示例10: __construct
function __construct()
{
if (loggedIn()) {
$count = self::countUnread();
new MenuItem(array("name" => "messages", "page" => "messages", "label" => "Messages <span class='badge'>{$count}</span> ", "menu" => "my_account", "weight" => 100));
}
new CSS("messages", getSitePath() . "core_plugins/messages/assets/css/style.css", 400000);
new FooterJS("messages", getSiteURL() . "core_plugins/messages/assets/js/messages.js", 5000, true);
new StorageType("MessageElement", "subject", "text");
new StorageType("MessageElement", "message", "text");
new StorageType("Message", "subject", "text");
new Usersetting(array("name" => "notify_when_message", "field_type" => "dropdown", "options" => array("email" => "Email", "site" => "Site", "both" => "Both", "none" => "None"), "tab" => "notifications", "default_value" => "both"));
}
示例11: __construct
public function __construct()
{
if (loggedIn()) {
new MenuItem(array("name" => "profile", "label" => "My Profile", "page" => "profile/" . getLoggedInUserGuid(), "menu" => "my_account", "weight" => 0));
if (currentPage() == "profile" && pageArray(1) == getLoggedInUserGuid()) {
new MenuItem(array("name" => "edit_profile", "label" => "Edit Profile", "menu" => "profile", "page" => "editProfile", "list_class" => "active", "link_class" => "list-group-item list-group-item-danger"));
} elseif (currentPage() == "home" && loggedIn()) {
new MenuItem(array("name" => "view_my_profile", "label" => "View My Profile", "menu" => "profile", "page" => "profile/" . getLoggedInUserGuid(), "weight" => 10));
new MenuItem(array("name" => "edit_profile", "label" => "Edit My Profile", "menu" => "profile", "page" => "editProfile", "link_class" => "list-group-item", "weight" => 20));
if (isEnabledPlugin("members")) {
new MenuItem(array("name" => "members", "label" => "Browse Members", "menu" => "profile", "page" => "members", "weight" => 30));
}
if (isEnabledPlugin("inviteFriends")) {
new MenuItem(array("name" => "invite_friends", "label" => translate("invite_your_friends"), "menu" => "profile", "page" => "members", "weight" => 40));
}
}
if (currentPage() == "profile" && adminLoggedIn()) {
if (adminLoggedIn()) {
$guid = pageArray(1);
$user = getEntity($guid);
if (is_a($user, "SocialApparatus\\User")) {
if (!isAdmin($user)) {
new MenuItem(array("name" => "delete", "label" => "Delete User", "page" => "action/deleteUser/{$guid}", "menu" => "profile", "weight" => 100000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
new MenuItem(array("name" => "login_as", "label" => "Login As", "page" => "action/loginas/{$guid}", "menu" => "profile", "weight" => 90000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
if ($user->banned == "true") {
new MenuItem(array("name" => "unban", "label" => "Unban", "page" => "action/unbanUser/{$guid}", "menu" => "profile", "weight" => 80000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
} else {
new MenuItem(array("name" => "ban", "label" => "Ban", "page" => "action/banUser/{$guid}", "menu" => "profile", "weight" => 80000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
}
}
}
}
}
}
if (currentPage() == "profile") {
new CSS("profile", getSitePath() . "core_plugins/profile/assets/css/profile.css");
new FooterJS('profile', getSiteURL() . 'core_plugins/profile/assets/js/profile.js', 900, true);
}
if (currentPage() == "admin") {
new ViewExtension("admin/tabs", "admin_tabs/profile_fields");
}
new ProfileField("first_name", "First Name", "text", false, false, "form-control", "default", 10);
new ProfileField("last_name", "Last Name", "text", false, false, "form-control", "default", 20);
new ProfileField("gender", "Gender", "dropdown", array("Male" => "Male", "Female" => "Female"));
new ProfileField("birthday", "Birthday", "date");
new ProfileField("about", "About Me", "textarea");
new ProfileField("hobbies", "Hobbies", "tags");
new StorageType("User", "about", "text");
new ViewExtension("profile/right", "profile/activity");
}
示例12: importCSV
public function importCSV($course_code, $course_dep, $filename)
{
if (!loggedIn() || privilege() == NULL || privilege() == 'admin') {
return 0;
}
$file = fopen($filename, "r");
$count = 0;
while (($data = fgetcsv($file, 10000, ",")) !== FALSE) {
$count++;
if ($count > 1) {
$save = $this->newEntry($data[0], $course_code, $course_dep, $data[1], $data[2]);
}
}
fclose($file);
return 1;
}
示例13: __construct
public function __construct()
{
global $database;
$this->competitions = $database->getAllCompetitions();
$this->pages = $database->getAllPages();
if (loggedIn()) {
$this->userGroups = $database->getUserGroups($_SESSION['userID']);
$this->userGroupNames = array();
foreach ($this->userGroups as $groupId) {
$this->userGroupNames[$groupId] = $database->getGroupName($groupId);
}
$this->money = $database->getMoney($_SESSION['userID']);
$user = new \User($_SESSION['userID']);
$this->score = number_format((double) $user->getScore(), 2, '.', '.');
}
}
示例14: __construct
function __construct()
{
if (loggedIn()) {
if (currentPage() == "profile") {
if (isEnabledPlugin("Friends")) {
$user_one = pageArray(1);
$user_two = getLoggedInUserGuid();
if (FriendsPlugin::friends($user_one, $user_two)) {
new MenuItem(array("name" => "chat", "menu" => "profile", "label" => "Chat", "page" => "action/CreateChat/" . $user_one, "link_class" => "list-group-item list-group-item-success"));
}
}
}
}
new ViewExtension("page_elements/foot", "chat/chat_boxes");
new CSS("chat", getSitePath() . "core_plugins/chat/assets/css/chat.css", 400);
new FooterJS("chat", getSiteURL() . "core_plugins/chat/assets/js/chat.js", 400, true);
new Usersetting(array("name" => "notify_offline_chat", "field_type" => "dropdown", "options" => array("yes" => "Yes", "no" => "No"), "default_value" => "yes", "tab" => "notifications"));
}
示例15: login
public function login()
{
if (loggedIn()) {
return redirect('home');
}
$this->form_validation->set_rules('username', 'Login', 'required|trim|callback_check_username');
$this->form_validation->set_rules('password', 'Mot de passe', 'required|trim|callback_check_password');
$this->form_validation->set_message('required', 'Le champ %s est obligatoire');
if ($this->form_validation->run() == false) {
$data['NOTOPBAR'] = true;
$data['NOSIDEBAR'] = true;
$data['title'] = 'Connexion';
$this->render('login', $data);
} else {
// Start the session and redirect
$user = $this->user_model->getUserByUsername($this->input->post('username'));
$sess_array = array('id' => $user->userId, 'username' => $user->username, 'role' => $user->role);
$this->session->set_userdata('login', $sess_array);
return redirect('home');
}
}