/** * Offer a session handler for the current session */ function handleSession() { session_save_path(site()->config()->session_path); ini_set('session.gc_probability', 1); $sessionHandler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler(\Idno\Core\site()->db()->getClient(), ['database' => 'idnosession', 'collection' => 'idnosession']); session_set_save_handler($sessionHandler, true); }
function post() { $this->flushBrowser(); \Idno\Core\site()->logging->log("Loading the user registration callback", LOGLEVEL_DEBUG); $contents = $this->getInput('content'); $auth_token = $this->getInput('auth_token'); $time = $this->getInput('time'); $signature = $this->getInput('signature'); $secret = \Idno\Core\site()->hub()->secret; $hmac = hash_hmac('sha1', $contents . $time . $auth_token, $secret); if ($hmac == $signature) { if ($contents = json_decode($contents)) { if (!empty($contents->user)) { if ($user = \Idno\Entities\User::getByUUID($contents->user)) { $user->hub_settings = array('token' => $contents->auth_token, 'secret' => $contents->secret); $user->save(); $result = array('status' => 'ok', 'message' => 'Credentials were stored.'); } else { $result = array('status' => 'fail', 'message' => 'Couldn\'t find user: '******'status' => 'fail', 'message' => 'No user was sent'); } } else { $result = array('status' => 'fail', 'message' => 'Contents were invalid'); } } if (empty($result)) { $result = array('status' => 'fail', 'message' => 'Signature does not match: ' . $signature . ', ' . $hmac); } echo json_encode($result); exit; }
function postContent() { if (!($user = \Idno\Core\site()->session()->currentUser())) { $this->setResponse(403); echo 'You must be logged in to approve IndieAuth requests.'; exit; } $me = $this->getInput('me'); $client_id = $this->getInput('client_id'); $redirect_uri = $this->getInput('redirect_uri'); $state = $this->getInput('state'); $scope = $this->getInput('scope'); if (!empty($me) && parse_url($me, PHP_URL_HOST) == parse_url($user->getURL(), PHP_URL_HOST)) { $indieauth_codes = $user->indieauth_codes; if (empty($indieauth_codes)) { $indieauth_codes = array(); } $code = md5(rand(0, 99999) . time() . $user->getUUID() . $client_id . $state . rand(0, 999999)); $indieauth_codes[$code] = array('me' => $me, 'redirect_uri' => $redirect_uri, 'scope' => $scope, 'state' => $state, 'client_id' => $client_id, 'issued_at' => time(), 'nonce' => mt_rand(1000000, pow(2, 30))); $user->indieauth_codes = $indieauth_codes; $user->save(); if (strpos($redirect_uri, '?') === false) { $redirect_uri .= '?'; } else { $redirect_uri .= '&'; } $redirect_uri .= http_build_query(array('code' => $code, 'state' => $state, 'me' => $me)); $this->forward($redirect_uri); } }
function registerPages() { \Idno\Core\site()->addPageHandler('/media/edit/?', '\\IdnoPlugins\\Media\\Pages\\Edit'); \Idno\Core\site()->addPageHandler('/media/edit/([A-Za-z0-9]+)/?', '\\IdnoPlugins\\Media\\Pages\\Edit'); \Idno\Core\site()->addPageHandler('/media/delete/([A-Za-z0-9]+)/?', '\\IdnoPlugins\\Media\\Pages\\Delete'); \Idno\Core\site()->template()->extendTemplate('shell/footer', 'media/shell/footer'); }
function postContent() { $this->adminGatekeeper(); // Admins only $action = $this->getInput('action'); switch ($action) { case 'add_rights': $uuid = $this->getInput('user'); if ($user = User::getByUUID($uuid)) { $user->setAdmin(true); $user->save(); \Idno\Core\site()->session()->addMessage($user->getTitle() . " was given administration rights."); } break; case 'remove_rights': $uuid = $this->getInput('user'); if ($user = User::getByUUID($uuid)) { $user->setAdmin(false); $user->save(); \Idno\Core\site()->session()->addMessage($user->getTitle() . " was stripped of their administration rights."); } break; case 'delete': $uuid = $this->getInput('user'); if ($user = User::getByUUID($uuid)) { if ($user->delete()) { \Idno\Core\site()->session()->addMessage($user->getTitle() . " was removed from your site."); } } break; case 'invite_users': $emails = $this->getInput('invitation_emails'); preg_match_all('/[a-z\\d._%+-]+@[a-z\\d.-]+\\.[a-z]{2,4}\\b/i', $emails, $matches); $invitation_count = 0; if (!empty($matches[0])) { if (is_array($matches[0])) { foreach ($matches[0] as $email) { if (filter_var($email, FILTER_VALIDATE_EMAIL)) { if (!($user = User::getByEmail($email))) { if ((new Invitation())->sendToEmail($email) !== 0) { $invitation_count++; } } } } } } if ($invitation_count > 1) { \Idno\Core\site()->session()->addMessage("{$invitation_count} invitations were sent."); } else { if ($invitation_count == 1) { \Idno\Core\site()->session()->addMessage("Your invitation was sent."); } else { \Idno\Core\site()->session()->addMessage("No email addresses were found or all the people you invited are already members of this site."); } } break; } $this->forward(\Idno\Core\site()->config()->getURL() . 'admin/users'); }
/** * Pings mentions from a given page to any linked pages * @param $pageURL Page URL * @param string $text The text to mine for links * @return int The number of pings that were sent out */ static function pingMentions($pageURL, $text) { // Load webmention-client require_once \Idno\Core\site()->config()->path . '/external/mention-client/mention-client.php'; $client = new \MentionClient($pageURL, $text); return $client->sendSupportedMentions(); }
function getContent() { $this->gatekeeper(); $user = \Idno\Core\site()->session()->currentUser(); $t = \Idno\Core\site()->template(); echo $t->__(array('title' => "Create your profile", 'body' => $t->__(array('user' => $user))->draw('onboarding/profile'), 'messages' => \Idno\Core\site()->session()->getAndFlushMessages()))->draw('shell/simple'); }
function postContent() { $this->adminGatekeeper(); // Admins only $title = $this->getInput('title'); $url = $this->getInput('url'); $path = $this->getInput('path'); $host = $this->getInput('host'); $open_registration = $this->getInput('open_registration'); if ($open_registration == 'true') { $open_registration = true; } else { $open_registration = false; } if (!empty($title)) { \Idno\Core\site()->config->config['title'] = $title; } if (!empty($url)) { \Idno\Core\site()->config->config['url'] = $url; } if (!empty($path)) { \Idno\Core\site()->config->config['path'] = $path; } if (!empty($host)) { \Idno\Core\site()->config->config['host'] = $host; } \Idno\Core\site()->config->config['open_registration'] = $open_registration; \Idno\Core\site()->config()->save(); $this->forward('/admin/'); }
function postContent() { $fwd = $this->getInput('fwd'); // Forward to a new page? if (empty($fwd)) { $fwd = \Idno\Core\site()->config()->url; } if ($user = \Idno\Entities\User::getByHandle($this->getInput('email'))) { } else { if ($user = \Idno\Entities\User::getByEmail($this->getInput('email'))) { } else { \Idno\Core\site()->triggerEvent('login/failure/nouser', array('method' => 'password', 'credentials' => array('email' => $this->getInput('email')))); $this->setResponse(401); } } if ($user instanceof \Idno\Entities\User) { if ($user->checkPassword(trim($this->getInput('password')))) { \Idno\Core\site()->triggerEvent('login/success', array('user' => $user)); // Trigger an event for auditing \Idno\Core\site()->session()->logUserOn($user); $this->forward($fwd); } else { \Idno\Core\site()->session()->addErrorMessage("Oops! It looks like your password isn't correct. Please try again."); \Idno\Core\site()->triggerEvent('login/failure', array('user' => $user)); $this->forward(\Idno\Core\site()->config()->getDisplayURL() . 'session/login/?fwd=' . urlencode($fwd)); } } else { \Idno\Core\site()->session()->addErrorMessage("Oops! We couldn't find your username or email address. Please check you typed it correctly and try again."); $this->forward(\Idno\Core\site()->config()->getDisplayURL() . 'session/login/?fwd=' . urlencode($fwd)); } }
function postContent() { $this->adminGatekeeper(); $hooks = $this->getInput('webhooks'); $titles = $this->getInput('titles'); $webhook_syndication = array(); if (is_array($hooks) && !empty($hooks)) { foreach ($hooks as $key => $hook) { $hook = trim($hook); if (!empty($hook)) { if (filter_var($hook, FILTER_VALIDATE_URL)) { if (!empty($titles[$key])) { $title = $titles[$key]; } else { $title = parse_url($hook, PHP_URL_HOST); } $webhook_syndication[] = array('url' => $hook, 'title' => $title); } else { \Idno\Core\site()->session()->addErrorMessage($hook . " doesn't seem to be a valid URL."); } } } } \Idno\Core\site()->config->webhook_syndication = $webhook_syndication; \Idno\Core\site()->config->save(); $this->forward(\Idno\Core\site()->config()->getDisplayURL() . 'admin/webhooks/'); }
function getContent() { $subject = $this->getInput('q'); $types = $this->getInput('types'); $subject = trim($subject); $offset = (int) $this->getInput('offset'); if (empty($types)) { $types = '!Idno\\Entities\\ActivityStreamPost'; } else { if (!is_array($types)) { $types = [$types]; } $types[] = '!Idno\\Entities\\ActivityStreamPost'; } if (!empty($subject)) { $regexObj = new \MongoRegex("/" . addslashes($subject) . "/i"); $items = \Idno\Common\Entity::getFromX($types, ['$or' => [['body' => $regexObj], ['title' => $regexObj], ['description' => $regexObj]]], [], 10, $offset); $count = \Idno\Common\Entity::countFromX($types, ['$or' => [['body' => $regexObj], ['title' => $regexObj], ['description' => $regexObj]]]); } else { $items = []; $subject = 'Search'; $count = 0; } $t = \Idno\Core\site()->template(); $t->__(array('title' => $subject, 'body' => $t->__(array('subject' => $subject, 'items' => $items, 'count' => $count, 'offset' => $offset))->draw('entity/search')))->drawPage(); }
/** * If this idno installation has a PubSubHubbub hub, send a publish notification to the hub * @param string $url * @return array */ static function publish($url) { if ($hub = \Idno\Core\site()->config()->hub) { return \Idno\Core\Webservice::post($hub, ['hub.mode' => 'publish', 'hub.url' => $url]); } return false; }
function getContent() { $this->gatekeeper(); // Logged-in users only if ($soundcloud = \Idno\Core\site()->plugins()->get('SoundCloud')) { if ($soundcloudAPI = $soundcloud->connect()) { /* @var \Services_Soundcloud $soundcloudAPI */ if ($access_code = $soundcloudAPI->accessToken($this->getInput('code'))) { $soundcloudAPI->setAccessToken($access_code['access_token']); $user_details = $soundcloudAPI->get('me'); $user_details = json_decode($user_details, true); $user = \Idno\Core\site()->session()->currentUser(); $username = $user_details['permalink']; \Idno\Core\site()->syndication()->registerServiceAccount('soundcloud', $user_details['permalink'], 'SoundCloud: ' . $user_details['username']); $user->soundcloud[$user_details['permalink']] = array('access_token' => $access_code['access_token'], 'username' => $user_details['username']); $user->save(); \Idno\Core\site()->session()->addMessage('Your Soundcloud account was connected.'); } } } if (!empty($_SESSION['onboarding_passthrough'])) { unset($_SESSION['onboarding_passthrough']); $this->forward(\Idno\Core\site()->config()->getURL() . 'begin/connect-forwarder'); } $this->forward(\Idno\Core\site()->config()->getDisplayURL() . 'account/soundcloud/'); }
function postContent() { $result = \Idno\Core\site()->session()->logUserOff(); \Idno\Core\site()->session()->addMessage("You've signed out. See you soon!"); $this->forward($_SERVER['HTTP_REFERER']); return $result; }
function postContent() { $this->createGatekeeper(); // User is logged in and can post content // Get variables $body = $this->getInput('body'); $object_uuid = $this->getInput('object'); $type = $this->getInput('type'); $user = \Idno\Core\site()->session()->currentUser(); if ($type != 'like') { $type = 'reply'; } if ($object = Entity::getByUUID($object_uuid)) { $has_liked = false; if ($type == 'like') { if ($like_annotations = $object->getAnnotations('like')) { foreach ($like_annotations as $like) { if ($like['owner_url'] == \Idno\Core\site()->session()->currentUser()->getURL()) { $object->removeAnnotation($like['permalink']); $object->save(); $has_liked = true; } } } } if (!$has_liked) { if ($object->addAnnotation($type, $user->getTitle(), $user->getURL(), $user->getIcon(), $body)) { $object->save(); } } $this->forward($object->getURL() . '#comments'); } }
/** * @return bool */ function saveDataFromInput() { if (empty($this->_id)) { $new = true; } else { $new = false; } $this->title = \Idno\Core\site()->currentPage()->getInput('title'); $this->body = \Idno\Core\site()->currentPage()->getInput('body'); $this->tags = \Idno\Core\site()->currentPage()->getInput('tags'); $this->data = \Idno\Core\site()->currentPage()->getInput('data'); $this->day = \Idno\Core\site()->currentPage()->getInput('day'); $this->setAccess('PUBLIC'); if ($time = \Idno\Core\site()->currentPage()->getInput('created')) { if ($time = strtotime($time)) { $this->created = $time; } } if ($this->save()) { if ($new) { $this->addToFeed(); } } return true; }
/** * Do we have WordPress information? * @return bool */ function hasWordPress() { if (!empty(\Idno\Core\site()->config()->wordpress)) { return true; } return false; }
function get($params = array()) { $this->gatekeeper(); // Logged-in users only if ($foursquare = \Idno\Core\site()->plugins()->get('Foursquare')) { $fsObj = $foursquare->connect(); $token = $fsObj->getAccessToken($this->getInput('code'), \Idno\Core\site()->config()->getDisplayURL() . 'foursquare/callback'); $fsObj->setAccessToken($token->access_token); $user = \Idno\Core\site()->session()->currentUser(); $fs_user = $fsObj->get('/users/self', array('v' => '20150103')); if (!empty($fs_user)) { $fs_user = $fs_user->response->user; $id = $fs_user->id; $name = $fs_user->firstName . ' ' . $fs_user->lastName; $user->foursquare[$id] = ['access_token' => $token->access_token, 'name' => $name, 'id' => $id]; } else { $user->foursquare = array('access_token' => $token->access_token); } $user->save(); \Idno\Core\site()->session()->addMessage('Your Foursquare account was connected.'); } if (!empty($_SESSION['onboarding_passthrough'])) { unset($_SESSION['onboarding_passthrough']); $this->forward(\Idno\Core\site()->config()->getURL() . 'begin/connect-forwarder'); } $this->forward(\Idno\Core\site()->config()->getURL() . 'account/foursquare/'); }
function post() { $this->adminGatekeeper(); $page = \IdnoPlugins\StaticPages\StaticPage::getByID($this->getInput('page')); $position = intval($this->getInput('position')); if (!$page) { // Not Found $this->setResponse(404); return; } if ($staticpages = \Idno\Core\site()->plugins()->get('StaticPages')) { $pages = $staticpages->getPagesByCategory($page->category); $old_position = array_search($page, $pages); if ($old_position === false || $position < 0 || $position >= count($pages)) { // Invalid Request $this->setResponse(400); } else { $page->priority = $pages[$position]->getPriority() + 1; $page->save(); for ($i = $position > $old_position ? $position : $position - 1; $i >= 0; $i--) { if ($i != $old_position) { $pages[$i]->priority = $pages[$i]->getPriority() + 2; $pages[$i]->save(); } } // Accepted $this->setResponse(202); } } }
function postContent() { $body = strip_tags($this->getInput('body')); $name = strip_tags($this->getInput('name')); $url = trim($this->getInput('url')); $url2 = trim($this->getInput('url-2')); $validator = $this->getInput('validator'); if (!empty($url2)) { $this->deniedContent(); } $this->referrerGatekeeper(); if (!empty($body) && !empty($name) && !empty($validator)) { if ($object = Entity::getByUUID($validator)) { if ($url = Webservice::sanitizeURL($url)) { if ($content = Webservice::get($url)) { if ($content['response'] == '200') { $icon = Webmention::getIconFromWebsiteContent($content['content'], $url); } } } if (empty($icon)) { $bn = hexdec(substr(md5($url), 0, 15)); $number = 1 + $bn % 5; $icon = \Idno\Core\site()->config()->url . 'gfx/users/default-' . str_pad($number, 2, '0', STR_PAD_LEFT) . '.png'; } $object->addAnnotation('reply', $name, $url, $icon, $body); $this->forward($object->getDisplayURL()); } } }
function postContent() { // TODO: change this to actual basic login, of course if ($user = \Idno\Entities\User::getByHandle($this->getInput('email'))) { } else { if ($user = \Idno\Entities\User::getByEmail($this->getInput('email'))) { } else { \Idno\Core\site()->triggerEvent('login/failure/nouser', ['method' => 'password', 'credentials' => ['email' => $this->getInput('email')]]); $this->setResponse(401); $this->forward('/session/login'); } } if ($user instanceof \Idno\Entities\User) { if ($user->checkPassword($this->getInput('password'))) { \Idno\Core\site()->triggerEvent('login/success', ['user' => $user]); // Trigger an event for auditing \Idno\Core\site()->session()->logUserOn($user); \Idno\Core\site()->session()->addMessage("You've signed in as {$user->getTitle()}."); $this->forward(); } else { \Idno\Core\site()->session()->addMessage("Oops! It looks like your password isn't correct. Please try again."); \Idno\Core\site()->triggerEvent('login/failure', ['user' => $user]); } } else { \Idno\Core\site()->session()->addMessage("Oops! We couldn't find your username or email address. Please check you typed it correctly and try again."); } }
public static function authenticate() { // Have we been provided with an access token if ($access_token = \Idno\Core\site()->currentPage()->getInput('access_token')) { // Get token if ($token = Token::getOne(['access_token' => $access_token])) { // Check expiry if ($token->isValid()) { // Token still valid, get the owner $owner = $token->getOwner(); if ($owner) { \Idno\Core\site()->session()->refreshSessionUser($owner); // Log user on, but avoid triggering hook and going into an infinite loop! // Save session scope $_SESSION['oauth2_token'] = $token; // Double check scope if ($owner->oauth2[$token->key]['scope'] != $token->scope) { throw new \Exception("Token scope doesn't match that which was previously granted!"); } return $owner; } else { \Idno\Core\site()->triggerEvent('login/failure', array('user' => $owner)); throw new \Exception("Token user could not be retrieved."); } } else { throw new \Exception("Access token {$access_token} has expired."); } } else { throw new \Exception("Access token {$access_token} does not match any stored token.", LOGLEVEL_ERROR); } } }
function getContent() { $this->gatekeeper(); // Logged-in users only if ($twitter = \Idno\Core\site()->plugins()->get('SoundCloud')) { if ($user = \Idno\Core\site()->session()->currentUser()) { if ($account = $this->getInput('remove')) { if (array_key_exists($account, $user->soundcloud)) { unset($user->soundcloud[$account]); } else { $user->soundcloud = false; } } else { $user->soundcloud = false; } $user->save(); \Idno\Core\site()->session()->refreshSessionUser($user); if (!empty($user->link_callback)) { error_log($user->link_callback); $this->forward($user->link_callback); exit; } } } $this->forward($_SERVER['HTTP_REFERER']); }
function getContent() { $this->createGatekeeper(); // This functionality is for logged-in users only $strDate = 'yesterday'; $yesterday = date('Ymd', strtotime($strDate)); // Are we loading an entity or does an entity with yesterday date already exists $moves_obj = \IdnoPlugins\Importmoves\Moves::getOneFromAll(array('day' => $yesterday)); if (!empty($moves_obj)) { $object = $moves_obj; } elseif (!empty($this->arguments)) { $object = \IdnoPlugins\Importmoves\Moves::getByID($this->arguments[0]); } else { $object = new \IdnoPlugins\Importmoves\Moves(); } $t = \Idno\Core\site()->template(); $body = $t->__(array('object' => $object))->draw('entity/Moves/edit'); if (empty($object)) { $title = 'publish your Moves summary'; } else { $title = 'Edit your Moves summary'; } if (!empty($this->xhr)) { echo $body; } else { $t->__(array('body' => $body, 'title' => $title))->drawPage(); } }
function postContent() { $this->adminGatekeeper(); // Admins only $plugin = $this->getInput('plugin'); $action = $this->getInput('action'); if (defined('KNOWN_MULTITENANT_HOST')) { $host = KNOWN_MULTITENANT_HOST; } if (preg_match('/^[a-zA-Z0-9]+$/', $plugin) && (file_exists(\Idno\Core\site()->config()->path . '/IdnoPlugins/' . $plugin) || !empty(\Idno\Core\site()->config()->external_plugin_path) && file_exists(\Idno\Core\site()->config()->external_plugin_path . '/IdnoPlugins/' . $plugin) || !empty($host) && file_exists(\Idno\Core\site()->config()->path . '/hosts/' . $host . '/IdnoPlugins/' . $plugin))) { switch ($action) { case 'install': \Idno\Core\site()->config->config['plugins'][] = $plugin; if (!empty(\Idno\Core\site()->config()->external_plugin_path) && file_exists(\Idno\Core\site()->config()->external_plugin_path . '/IdnoPlugins/' . $plugin)) { \Idno\Core\site()->config->config['directloadplugins'][$plugin] = \Idno\Core\site()->config()->external_plugin_path . '/IdnoPlugins/' . $plugin; } \Idno\Core\site()->session()->addMessage('The plugin was installed.'); break; case 'uninstall': if (($key = array_search($plugin, \Idno\Core\site()->config->config['plugins'])) !== false) { unset(\Idno\Core\site()->config->config['plugins'][$key]); unset(\Idno\Core\site()->config->config['directloadplugins'][$key]); \Idno\Core\site()->session()->addMessage('The plugin was uninstalled.'); } break; } \Idno\Core\site()->config->config['plugins'] = array_unique(\Idno\Core\site()->config->config['plugins']); \Idno\Core\site()->config()->save(); } $this->forward(\Idno\Core\site()->config()->getURL() . 'admin/plugins/'); }
function getContent() { // if me is not the logged in user, they'll need to enter their password if (!($user = \Idno\Core\site()->session()->currentUser())) { // Do login and redirect workflow $this->forward('/session/login?fwd=' . urlencode($this->currentUrl())); exit; } $headers = $this->getallheaders(); $me = $this->getInput('me'); $client_id = $this->getInput('client_id'); $redirect_uri = $this->getInput('redirect_uri'); $state = $this->getInput('state'); $scope = $this->getInput('scope'); if (empty($me) || parse_url($me, PHP_URL_HOST) != parse_url($user->getURL(), PHP_URL_HOST)) { $this->setResponse(403); echo $me . ' does not match the logged in user ' . $user->getURL() . '.'; exit; } $me_prime = $user->getURL(); $t = \Idno\Core\site()->template(); $t->body = $t->__(array('me' => $me_prime, 'client_id' => $client_id, 'pretty_id' => preg_replace('/^https?:\\/\\//', '', $client_id), 'scope' => $scope, 'redirect_uri' => $redirect_uri, 'state' => $state))->draw('indiepub/auth'); $t->title = empty($scope) ? 'Authenticate' : 'Authorize'; return $t->drawPage(); }
function registerPages() { \Idno\Core\site()->addPageHandler('/entry/edit/?', '\\IdnoPlugins\\Text\\Pages\\Edit'); \Idno\Core\site()->addPageHandler('/entry/edit/([A-Za-z0-9]+)/?', '\\IdnoPlugins\\Text\\Pages\\Edit'); \Idno\Core\site()->addPageHandler('/entry/delete/([A-Za-z0-9]+)/?', '\\IdnoPlugins\\Text\\Pages\\Delete'); \Idno\Core\site()->addPageHandler('/entry/([A-Za-z0-9]+)/.*', '\\Idno\\Pages\\Entity\\View'); }
function isHomepage() { if ($staticpages = \Idno\Core\site()->plugins()->get('StaticPages')) { return $staticpages->getCurrentHomepageId() == $this->getID(); } return false; }
function registerEvents() { \Idno\Core\site()->addEventHook('saved', function (\Idno\Core\Event $event) { $eventdata = $event->data(); if ($object = $eventdata['object']) { if (site()->session()->isLoggedOn()) { if (!empty(site()->session()->currentUser()->robot_state)) { $user = site()->session()->currentUser(); switch ($user->robot_state) { case '1': if (class_exists('IdnoPlugins\\Status') && $object instanceof \IdnoPlugins\Status) { $user->robot_state = '2a'; } else { $user->robot_state = '2b'; } self::$changed_state = 1; break; case '2a': if (class_exists('IdnoPlugins\\Photo') && $object instanceof \IdnoPlugins\Photo) { $user->robot_state = '3a'; } self::$changed_state = 1; break; case '2b': $user->robot_state = '3b'; self::$changed_state = 1; break; } $user->save(); site()->session()->refreshSessionUser($user); } } } }); }
function getContent() { $this->gatekeeper(); // Logged-in users only if ($importmoves = \Idno\Core\site()->plugins()->get('Importmoves')) { if ($user = \Idno\Core\site()->session()->currentUser()) { if ($remove = $this->getInput('remove')) { if (is_array($user->importmoves)) { if (array_key_exists($remove, $user->importmoves)) { unset($user->importmoves[$remove]); } } else { $user->importmoves = false; } } else { $user->importmoves = false; } $user->save(); \Idno\Core\site()->session()->refreshSessionUser($user); if (!empty($user->link_callback)) { error_log($user->link_callback); $this->forward($user->link_callback); exit; } } } $this->forward($_SERVER['HTTP_REFERER']); }