function __construct() { adminGateKeeper(); $ip = pageArray(2); if ($ip) { new BlacklistIp($ip); $params = array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "ip1", "value" => $ip), array("name" => "ip2", "value" => $ip)), "metadata_name_value_pairs_operand" => "OR"); $users = getEntities($params); $tables = Dbase::getAllTables(false); foreach ($users as $user) { new BlacklistEmail($user->email); $guid = $user->guid; foreach ($tables as $table) { $entities = getEntities(array("type" => $table, "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => $guid), array("name" => "container_guid", "value" => $guid)), "metadata_name_value_pairs_operand" => "OR")); if ($entities) { foreach ($entities as $entity) { $entity->delete(); } } } $user->delete(); } new SystemMessage("Ip {$ip} has been banned, and all users using it have been deleted."); forward("home"); } }
function __construct() { adminGateKeeper(); $guid = pageArray(2); $product = getEntity($guid); \Stripe\Stripe::setApiKey(EcommercePlugin::secretKey()); if ($product->interval != "one_time") { try { $plan = \Stripe\Plan::retrieve($guid); $plan->delete(); } catch (Exception $e) { forward(); } } else { if ($product->stripe_sku) { $sku = \Stripe\SKU::retrieve($product->stripe_sku); $sku->delete(); } if ($product->stripe_product_id) { $stripe_product = \Stripe\Product::retrieve($product->stripe_product_id); $stripe_product->delete(); } } $product->delete(); new SystemMessage("Your product has been deleted."); forward("store"); }
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"); }
public function __construct() { if (!pageArray(2)) { forward("admin/plugins"); } $guid = pageArray(2); adminGateKeeper(); $plugin = getEntity($guid); classGateKeeper($plugin, "Plugin"); $plugin->status = "disabled"; $plugin->save(); Cache::clear(); Cache::clear(); Admintab::deleteAll(); Setting::updateSettingsTable(); clearCache(); Cache::clear(); Systemvariable::set("setup_complete", false); $translations = getEntities(array("type" => "Translationentity")); if ($translations) { foreach ($translations as $translation) { $translation->delete(); } } new SystemMessage("Your plugin has been disabled."); forward("admin/plugins"); }
public function __construct() { if (!pageArray(2) || !pageArray(3)) { return false; } $email = pageArray(2); $code = pageArray(3); runHook("action:verify_email:before"); $access = getIgnoreAccess(); setIgnoreAccess(); $user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "email_verification_code", "value" => $code)))); setIgnoreAccess($access); if (!$user) { new SystemMessage(translate("system_message:email_could_not_be_verified")); forward("home"); } $user = $user[0]; $user->email_verification_code = NULL; $user->verified = "true"; $user->save(); runHook("action:verify_email:after"); new SystemMessage(translate("system_message:email_verified")); new Activity($user->guid, "activity:joined", array($user->getURL(), $user->full_name)); forward("login"); }
public function __construct() { $guid = pageArray(2); adminGateKeeper(); $plugin = getEntity($guid); Setting::updateSettingsTable(); clearCache(); Cache::clear(); Cache::clear(); if ($plugin->enable()) { new SystemMessage("Plugin Enabled"); new Cache("enabled_plugins_", false, "site"); new Cache("enabled_plugins_reversed", false, "site"); Systemvariable::set("setup_complete", false); forward("admin/plugins"); } Setting::updateSettingsTable(); clearCache(); Cache::clear(); Cache::clear(); Admintab::deleteAll(); $translations = getEntities(array("type" => "Translationentity")); if ($translations) { foreach ($translations as $translation) { $translation->delete(); } } new SystemMessage("Your plugin can't be enabled. Check requirements"); forward("admin/plugins"); }
function __construct() { $order_id = pageArray(1); $header = "Order Details"; $subheader = "Order #: " . $order_id; $body = display("pages/order"); $this->html = drawPage(array("header" => $header, "subheader" => $subheader, "body" => $body)); }
function __construct() { gateKeeper(); $guid = pageArray(2); BlockUserPlugin::block($guid); new SystemMessage("User has been blocked."); forward(); }
function __construct() { $invoice_id = pageArray(1); $header = "Invoice Details"; $subheader = "Invoice #" . $invoice_id; $body = display("pages/invoice"); $this->html = drawPage(array("header" => $header, "subheader" => $subheader, "body" => $body)); }
function __construct() { adminGateKeeper(); $guid = pageArray(2); $page = getEntity($guid); $page->delete(); new SystemMessage("Your page has been deleted."); forward("admin/custom_pages"); }
function __construct() { adminGateKeeper(); $guid = pageArray(2); $report = getEntity($guid); $report->closed = true; $report->save(); forward("admin/reported_content"); }
public function __construct() { adminGateKeeper(); $guid = pageArray(2); $activity = getEntity($guid); $activity->delete(); new SystemMessage("Your activity has been deleted."); forward(); }
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)); }
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)); }
function __construct() { adminGateKeeper(); $guid = pageArray(2); $user = getEntity($guid); $user->banned = "false"; $user->save(); new SystemMessage("You have successfully unbanned a user."); forward("home"); }
function __construct() { $guid = pageArray(2); $membership = getEntity(array("type" => "Groupmembership", "metadata_name_value_pairs" => array(array("name" => "group", "value" => $guid), array("name" => "member_guid", "value" => getLoggedInUserGuid())))); if ($membership) { $membership->delete(); new SystemMessage("You have successfully left the group"); } forward(); }
/** * Creates html for admin page */ public function __construct() { adminGateKeeper(); $tab = pageArray(1); if (!$tab) { $tab = "general"; } $body = display("pages/admin", array("tab" => $tab)); $this->html = drawPage(array("header" => translate("title:admin_panel"), "body" => $body)); }
function __construct() { adminGateKeeper(); $guid = pageArray(2); $user = getEntity($guid); $user->banned = "true"; $user->save(); new SystemMessage(translate("ban:user:success:system:message")); forward("home"); }
public function __construct() { adminGateKeeper(); $guid = pageArray(2); $user = getEntity($guid); $user->logOut(); $user->logIn(); new SystemMessage("You are now logged in as " . $user->full_name); forward("home"); }
function __construct() { $this->html = NULL; $name = pageArray(1); $page = getEntity(array("type" => "Custompage", "metadata_name" => "name", "metadata_value" => $name)); if ($page) { $title = $page->title; $body = display("output/editor", array("value" => $page->body)); $this->html = drawPage($title, $body); } }
public function __construct() { $guid = pageArray(1); if (!$guid) { forward("profile/" . getLoggedInUserGuid()); } $user = getEntity($guid); classGateKeeper($user, "User"); $body = display("pages/profile", array("guid" => $guid)); $this->html = drawPage(NULL, $body); }
public function __construct() { $guid = pageArray(2); $entity = getEntity($guid); classGateKeeper($entity, "Videoalbum"); if (loggedInUserCanDelete($entity)) { $entity->delete(); } new SystemMessage('Your video album and all videos it contained have been deleted.'); forward("videos"); }
public function __construct() { $guid = pageArray(2); $request = getEntity($guid); classGateKeeper($request, "Friendrequest"); if ($request->ownerIsLoggedIn()) { $request->status = "withdrawn"; $request->save(); new SystemMessage("Your friend request has been withdrawn."); forward(); } }
public function __construct() { $guid = pageArray(2); $photo = getEntity($guid); $album_guid = $photo->container_guid; $album = getEntity($album_guid); if ($photo->ownerIsLoggedIn()) { $photo->delete(); new SystemMessage("Your photo has been deleted."); } forward($album->getURL()); }
public function __construct() { $guid = pageArray(2); $video = getEntity($guid); classGateKeeper($video, "Video"); $album_guid = $video->container_guid; if (loggedInUserCanDelete($video)) { $video->delete(); new SystemMessage("Your video has been deleted."); } forward("videos/albums/view/{$album_guid}"); }
public function __construct() { $guid = pageArray(2); $request = getEntity($guid); classGateKeeper($request, "Friendrequest"); if ($request->guid_two == getLoggedInUserGuid()) { $request->status = "declined"; $request->save(); new SystemMessage("You have successfully declined this friend request."); } forward(); }
function __construct() { $guid = pageArray(2); $cart = Cache::get("cart", "session"); if (!$cart) { $cart = array(); } unset($cart[$guid]); Cache::set("cart", $cart, "session"); new SystemMessage("Your item has been removed from your cart."); forward(); }
function __construct() { gateKeeper(); $user = getLoggedInUser(); $subscription = pageArray(2); if ($subscription && $user->stripe_cust) { \Stripe\Stripe::setApiKey(EcommercePlugin::secretKey()); $cu = \Stripe\Customer::retrieve($user->stripe_cust); $cu->subscriptions->retrieve($subscription)->cancel(); new SystemMessage("Your subscription has been canceled."); } forward(); }
function __construct() { gateKeeper(); $guid = pageArray(2); $blog = getEntity($guid); classGateKeeper($blog, "blog"); $owner_guid = $blog->owner_guid; if ($owner_guid == getLoggedInUserGuid()) { $blog->delete(); new SystemMessage("Your blog has been deleted"); forward("blogs"); } }
public function __construct() { $guid = pageArray(2); if (getLoggedInUserGuid() == $guid) { $notifications = getEntities(array("type" => "Notification", "owner_guid" => $guid)); if ($notifications) { foreach ($notifications as $notification) { $notification->delete(); } } } forward(); }