/** * Removes Group from the list stored in the session * * @param mixed group_arg String containing group id, * or array containing list of groups to delete */ function deleteGroup($group_arg) { $this->foowd->track('smdoc_group->deleteGroup', $group_arg); $session_groups = new input_session('user_groups', REGEX_GROUP); $changed = $this->_deleteGroup($session_groups->value, $group_arg); if ($changed) { $session_groups->set($session_groups->value); } $this->foowd->track(); return $changed; }
/** * Get list of workspaces within system. * * @return array Returns an array of workspace titles indexed by workspaceid. */ function getWorkspaceList() { $session_wklist = new input_session('workspaceList', NULL); if (isset($session_wklist->value)) { return $session_wklist->value; } $workspaceArray = array(0 => $this->config_settings['workspace']['workspace_base_name']); $where['OR'][] = array('index' => 'classid', 'op' => '=', 'value' => WORKSPACE_CLASS_ID); $where['OR'][] = array('index' => 'classid', 'op' => '=', 'value' => TRANSLATION_CLASS_ID); $indices = array('objectid', 'title'); $workspaces = $this->getObjList($indices, NULL, $where, 'title', NULL, FALSE, FALSE); foreach ($workspaces as $workspace) { $workspaceArray[$workspace['objectid']] = htmlspecialchars($workspace['title']); } $session_wklist->set($workspaceArray); return $session_wklist->value; }
/** * Initializes array containing objectid, icon, and language code * for each defined translation * @static * @param smdoc $foowd Reference to the foowd environment object. * @param bool $forceRefresh Force refresh of session cache. */ function initialize($foowd, $forceRefresh = FALSE) { $foowd->track('smdoc_translation::initialize', $forceRefresh); $session_links = new input_session('lang_links', NULL); $session_langs = new input_session('languages', NULL); if (isset($session_links->value) && isset($session_langs->value) && !$forceRefresh) { $foowd->track(); return; } $default_title = getConstOrDefault('TRANSLATION_DEFAULT_LANGUAGE', 'en_US'); $default_icon = getConstOrDefault('TRANSLATION_DEFAULT_LANGUAGE_ICON', ''); $links = array(); $languages = array(); $url_arr['class'] = 'smdoc_translation'; $url_arr['method'] = 'enter'; $url_arr['langid'] = ''; $url = getURI($url_arr); // Add elements for the default translation $the_url = '<a href="' . $url . '0">'; if (!empty($default_icon)) { $the_url .= '<img src="' . $default_icon . '" '; $the_url .= 'alt="' . $default_title . '" '; $the_url .= 'title="' . $default_title . '" '; $the_rul .= ' />'; } else { $the_url .= $default_title; } $the_url .= '</a>'; $links[0] = $the_url; $languages[0] = $default_title; // Fetch available translations // no limit, retrieve objects, and don't bother with workspaces. $index[] = 'object'; $where['classid'] = TRANSLATION_CLASS_ID; $order = 'title'; $t_objects =& $foowd->getObjList($index, NULL, $where, $order, NULL, TRUE, FALSE); // Add each translation to the list foreach ($t_objects as $trans_obj) { $the_url = '<a href="' . $url . $trans_obj->objectid . '">'; if (isset($trans_obj->language_icon)) { $the_url .= '<img src="' . $trans_obj->language_icon . '" '; $the_url .= 'title="' . $trans_obj->title . '" '; $the_url .= 'alt="' . $trans_obj->title . '" />'; } else { $the_url .= $trans_obj->title; } $the_url .= '</a>'; $links[$trans_obj->objectid] = $the_url; $languages[$trans_obj->objectid] = $trans_obj->title; unset($trans_obj); } $session_links->set($links); $session_langs->set($languages); $foowd->track(); }
/** * Log out the user. * * @static * @param smdoc $foowd Reference to the foowd environment object. * @param string authType The type of user authentication to use. * @return int 0 = cookie logged out successfully<br /> * 1 = http logged out successfully<br /> * 2 = ip auth, can not log out<br /> * 3 = user already logged out<br /> * 4 = http log out failed due to browser<br /> */ function logout(&$foowd) { if ($foowd->user->isAnonymous()) { return 3; } // user already logged out $foowd->user = base_user::fetchAnonymousUser($foowd); $session_userinfo = new input_session('userinfo', NULL, NULL, true); $session_userinfo->set(NULL); return 0; // logged out successfully }