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"); }
public function __construct() { adminGateKeeper(); Admintab::deleteAll(); Cache::clear(); Cache::clear(); $plugins = Plugin::getAll(); if ($plugins) { foreach ($plugins as $plugin) { $plugin->enable(); } Cache::clear(); Cache::clear(); Cache::clear(); new SystemMessage("All possible plugins have been enabled."); } Systemvariable::set("setup_complete", false); $translations = getEntities(array("type" => "Translationentity")); if ($translations) { foreach ($translations as $translation) { $translation->delete(); } } forward("admin/plugins"); }
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"); } }
static function render($text, $type = null, $id = null, $instructions = null) { global $conf, $baseurl, $db; // Unfortunately dokuwiki also uses $conf $fs_conf = $conf; $conf = array(); // Dokuwiki generates some notices error_reporting(E_ALL ^ E_NOTICE); if (!$instructions) { include_once BASEDIR . '/plugins/dokuwiki/inc/parser/parser.php'; } require_once BASEDIR . '/plugins/dokuwiki/inc/common.php'; require_once BASEDIR . '/plugins/dokuwiki/inc/parser/xhtml.php'; // Create a renderer $Renderer = new Doku_Renderer_XHTML(); if (!is_string($instructions) || strlen($instructions) < 1) { $modes = p_get_parsermodes(); $Parser = new Doku_Parser(); // Add the Handler $Parser->Handler = new Doku_Handler(); // Add modes to parser foreach ($modes as $mode) { $Parser->addMode($mode['mode'], $mode['obj']); } $instructions = $Parser->parse($text); // Cache the parsed text if (!is_null($type) && !is_null($id)) { $fields = array('content' => serialize($instructions), 'type' => $type, 'topic' => $id, 'last_updated' => time()); $keys = array('type', 'topic'); //autoquote is always true on db class $db->Replace('{cache}', $fields, $keys); } } else { $instructions = unserialize($instructions); } $Renderer->smileys = getSmileys(); $Renderer->entities = getEntities(); $Renderer->acronyms = getAcronyms(); $Renderer->interwiki = getInterwiki(); $conf = $fs_conf; $conf['cachedir'] = FS_CACHE_DIR; // for dokuwiki $conf['fperm'] = 0600; $conf['dperm'] = 0700; // Loop through the instructions foreach ($instructions as $instruction) { // Execute the callback against the Renderer call_user_func_array(array(&$Renderer, $instruction[0]), $instruction[1]); } $return = $Renderer->doc; // Display the output if (Get::val('histring')) { $words = explode(' ', Get::val('histring')); foreach ($words as $word) { $return = html_hilight($return, $word); } } return $return; }
static function getNotificationCount($guid) { $access = getIgnoreAccess(); setIgnoreAccess(); $count = getEntities(array("type" => "Notification", "count" => true, "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid())))); setIgnoreAccess($access); return $count; }
static function get($name = false, $type = false) { $params = array("type" => "Metatag", "metadata_name_value_pairs" => array(array("name" => "metatag_name", "value" => $name), array("name" => "metatag_type", "value" => $type))); if ($name && $type) { return getEntity($params); } else { unset($params['metadata_name_value_pairs']); return getEntities($params); } }
public function __construct() { $limit = getInput("limit", 10); $offset = getInput("offset", 0); $count = getEntities(array("type" => "File", "count" => true, "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "NULL", "operand" => "!=")))); $files = listEntities(array("type" => "File", "limit" => $limit, "offset" => $offset, "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "NULL", "operand" => "!=")))); $pagination = display("page_elements/pagination", array("count" => $count, "offset" => $offset, "limit" => $limit, "url" => getSiteURL() . "files")); $page = drawPage(array("header" => "Files", "body" => $files, "footer" => $pagination, "button" => "<a href='" . getSiteURL() . "file/upload' class='btn btn-success'>Upload a File</a>")); $this->html = $page; }
public function __construct() { adminGateKeeper(); $metatags = getEntities(array("type" => "Metatag")); foreach ($metatags as $metatag) { $metatag->delete(); } Systemvariable::set("setup_complete", "false"); new SystemMessage("Default values have been loaded."); forward(); }
public function __construct() { adminGateKeeper(); $settings = getEntities(array("type" => "Setting")); foreach ($settings as $setting) { $setting->delete(); } Systemvariable::set("setup_complete", "false"); clearCache(); Cache::clear(); forward(); }
static function likers($guid) { $users = NULL; $likes = getEntities(array("type" => "Like", "metadata_name" => "container_guid", "metadata_value" => $guid, "limit" => 100)); if ($likes) { foreach ($likes as $like) { $users .= getEntity($like->owner_guid)->full_name . "
"; } return $users; } return false; }
public function __construct() { gateKeeper(); $email_users = array(); $container_guid = getInput("container_guid"); $topic = getEntity($container_guid); $category_guid = $topic->container_guid; $category = getEntity($category_guid); $description = getInput("comment"); $comment = new Forumcomment(); $comment->description = $description; $comment->container_guid = $container_guid; $comment->category_guid = $category_guid; $comment->owner_guid = getLoggedInUserGuid(); $comment->save(); new SystemMessage("Your comment has been posted."); new Activity(getLoggedInUserGuid(), "forum:comment:posted", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $topic->getURL(), $topic->title, truncate($comment->description)), $container_guid, $category->access_id); $all_comments = getEntities(array("type" => "Forumcomment", "metadata_name" => "container_guid", "metadata_value" => $container_guid)); $notify_users = array($topic->owner_guid); $container_owner_guid = $topic->owner_guid; $container_owner = getEntity($container_owner_guid); if ($container_owner->notify_when_forum_comment_topic_i_own == "email" || $container_owner->notify_when_forum_comment_topic_i_own == "both") { $email_users[] = $container_guid; } foreach ($all_comments as $comment) { $user_guid = $comment->owner_guid; $user = getEntity($user_guid); switch ($user->notify_when_forum_comment_topic_i_own) { case "both": $notify_users[] = $comment->owner_guid; $email_users[] = $comment->owner_guid; break; case "email": $email_users[] = $comment->owner_guid; break; case "site": $notify_users[] = $comment->owner_guid; break; case "none": break; } } $notify_users = array_unique($notify_users); foreach ($notify_users as $user_guid) { notifyUser("forumcomment", $container_guid, getLoggedInUserGuid(), $user_guid); } foreach ($email_users as $user) { $params = array("to" => array($user->full_name, $user->email), "from" => array(getSiteName(), getSiteEmail()), "subject" => "You have a new comment.", "body" => "You have a new comment. Click <a href='{$url}'>Here</a> to view it.", "html" => true); sendEmail($params); } forward(); }
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(); }
function __construct() { $guid = pageArray(2); $group = getEntity($guid); if (loggedInUserCanDelete($group)) { $group->delete(); } $memberships = getEntities(array("type" => "Groupmembership", "metadata_name" => "container_guid", "metadata_value" => $guid)); foreach ($memberships as $membership) { $membership->delete(); } new SystemMessage("Your group has been deleted."); forward("groups"); }
function __construct() { $guid = pageArray(2); $chat = getEntity($guid); if ($chat->user_one == getLoggedInUserGuid() || $chat->user_two == getLoggedInUserGuid()) { $messages = getEntities(array("type" => "Chatmessage", "metadata_name" => "container_guid", "metadata_value" => $guid)); if ($messages) { foreach ($messages as $message) { $message->delete(); } } } forward(); }
function __construct() { adminGateKeeper(); $logos = getEntities(array("type" => "Logo")); if ($logos) { foreach ($logos as $logo) { $logo->delete(); } } $logo = new Logo(); $logo->save(); $logo->createAvatar(); new SystemMessage("Your avatar has been uploaded."); forward("admin/logo"); }
public function members($return_guid = false) { $memberships = getEntities(array("type" => "Groupmembership", "metadata_name" => "group", "metadata_value" => $this->guid)); if ($memberships) { foreach ($memberships as $membership) { if (!$return_guid) { $members[] = getEntity($membership->member_guid); } else { $members[] = $membership->member_guid; } } return $members; } return false; }
static function getMenuItems() { $return = NULL; $pages = getEntities(array("type" => "Custompage", "order_by" => "weight")); if ($pages) { foreach ($pages as $page) { if ($page->label) { $return .= "<li>"; $return .= "<a href='" . getSiteURL() . "pages/" . $page->name . "'>" . display("output/editor", array("value" => $page->label)) . "</a>"; $return .= "</li>"; } } } return $return; }
function __construct() { $guid = pageArray(2); $topic = getEntity($guid); classGateKeeper($topic, "Forumtopic"); if (loggedInUserCanDelete($topic)) { $topic->delete(); $comments = getEntities(array("type" => "Comment", "metadata_name" => "container_guid", "metadata_value" => $guid)); foreach ($comments as $comment) { $comment->delete(); } new SystemMessage("Your topic has been deleted."); forward(); } }
function __construct() { $access = getIgnoreAccess(); setIgnoreAccess(); $system_settings = getEntities(array("type" => "Setting", "metadata_name" => "tab", "metadata_value" => "adsense")); setIgnoreAccess($access); if ($system_settings) { foreach ($system_settings as $setting) { $setting->value = getInput($setting->name); $setting->save(); } } clearCache(); forward("admin/adsense"); }
public function __construct() { $email = getInput("email"); $access = getIgnoreAccess(); setIgnoreAccess(); $user = getEntities(array("type" => "User", "metadata_name" => "email", "metadata_value" => $email, "limit" => 1)); setIgnoreAccess($access); if (!empty($user)) { $user = $user[0]; $user->sendPasswordResetLink(); forward("passwordResetEmailSent"); } else { new SystemMessage("No account with that email found."); forward(); } }
function __construct() { $guid = pageArray(2); $profile_status = getEntity($guid); if (loggedInUserCanDelete($profile_status)) { $profile_status->delete(); $comments = getEntities(array("type" => "Comment", "metadata_name" => "container_guid", "metadata_value" => $guid)); if ($comments) { foreach ($comments as $comment) { $comment->delete(); } } new SystemMessage("Your status post has been deleted."); } forward(); }
function __construct() { $guid = pageArray(2); $message = getEntity($guid); if ($message->to == getLoggedInUserGuid() || $message->from == getLoggedInUserGuid()) { $message_elements = getEntities(array("type" => "Messageelement", "metadata_name" => "container_guid", "metadata_value" => $message->guid)); if ($message_elements) { foreach ($message_elements as $element) { $element->delete(); } } $message->delete(); new SystemMessage("Your message has been deleted."); forward("messages"); } }
public function __construct() { $album_guid = pageArray(2); $album = getEntity($album_guid); if ($album->ownerIsLoggedIn()) { $photos = getEntities(array("type" => "Photo", "metadata_name" => "container_guid", "metadata_value" => $album_guid)); if ($photos) { foreach ($photos as $photo) { $photo->delete(); } } $album->delete(); new SystemMessage("Your album, and all photos it contained have been deleted."); forward("photos"); } }
public function __construct() { $access = getIgnoreAccess(); setIgnoreAccess(); $system_settings = getEntities(array("type" => "Setting")); setIgnoreAccess($access); if ($system_settings) { foreach ($system_settings as $setting) { $name = $setting->name; $value = getInput($name); $setting->value = $value; $setting->save(); } } clearCache(); forward("admin/general"); }
function __construct() { adminGateKeeper(); $users = getEntities(array("type" => "User")); foreach ($users as $user1) { foreach ($users as $user2) { $test = getEntity(array("type" => "friend", "metadata_name_value_pairs" => array(array("name" => "guid_one", "value" => $user1->guid), array("name" => "guid_two", "value" => $user2->guid)))); if (!$test) { // No friendship, let's create one. FriendsPlugin::addFriend($user1->guid, $user2->guid); } } } $plugin = getEntity(array("type" => "Plugin", "metadata_name" => "name", "metadata_value" => "everyoneFriends")); $plugin->status = "disabled"; $plugin->save(); forward("admin"); }
public function __construct() { adminGateKeeper(); $guid = getInput("guid"); $container_guid = getInput("container_guid"); $title = getInput("title"); $description = getInput("description"); $topic = getEntity($guid); $old_container_guid = $topic->container_guid; $topic->container_guid = $container_guid; $topic->title = $title; $topic->description = $description; $topic->save(); $comments = getEntities(array("type" => "Forumcomment", "metadata_name" => "category_guid", "metadata_value" => $old_container_guid)); foreach ($comments as $comment) { $comment->category_guid = $container_guid; $comment->save(); } forward("forum/topic/{$guid}"); }
public function __construct() { adminGateKeeper(); $guid = pageArray(2); $category = getEntity($guid); $comments = getEntities(array("type" => "Forumcomment", "metadata_name" => "category_guid", "metadata_value" => $guid)); $topics = getEntities(array("type" => "Forumtopic", "metadata_name" => "container_guid", "metadata_value" => $guid)); if ($comments) { foreach ($comments as $comment) { $comment->delete(); } } if ($topics) { foreach ($topics as $topic) { $topic->delete(); } } $category->delete(); new SystemMessage("Your category has been deleted."); forward("forum"); }
static function getGroups($user) { if ($user) { $return = array(); if (!is_object($user)) { $user = getEntity($user); } $memberships = getEntities(array("type" => "Groupmembership", "metadata_name" => "member_guid", "metadata_value" => $user->guid)); if (!$memberships) { return array(); } foreach ($memberships as $membership) { $group = getEntity($membership->group); if ($group->title) { $return[] = $group; } } return $return; } return array(); }