* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz * */ define('INTERNAL', 1); define('ADMIN', 1); define('MENUITEM', 'configextensions/pluginadmin'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; define('TITLE', get_string('pluginadmin', 'admin')); require_once 'pieforms/pieform.php'; $plugintype = param_alpha('plugintype'); $pluginname = param_variable('pluginname'); define('SECTION_PLUGINTYPE', $plugintype); define('SECTION_PLUGINNAME', $pluginname); define('SECTION_PAGE', 'pluginconfig'); safe_require($plugintype, $pluginname); if ($sesskey = param_alphanum('sesskey', '')) { if ($sesskey != $USER->get('sesskey')) { throw new UserException('Invalid sesskey'); } } $enable = param_integer('enable', 0); $disable = param_integer('disable', 0); if ($disable && !call_static_method(generate_class_name($plugintype, $pluginname), 'can_be_disabled')) { throw new UserException("Plugin {$plugintype} {$pluginname} cannot be disabled"); } if ($enable || $disable) { if ($plugintype == 'blocktype') { if (strpos($pluginname, '/') !== false) { list($artefact, $pluginname) = split('/', $pluginname); // Don't enable blocktypes unless the artefact plugin that provides them is also enabled if ($enable && !get_field('artefact_installed', 'active', 'name', $artefact)) {
/** * Process view changes. This function is used both by the json stuff and * by normal posts */ public function process_changes($category = '', $new = 0) { global $SESSION, $USER; // Security // TODO this might need to be moved below the requestdata check below, to prevent non owners of the view being // rejected if (!$USER->can_edit_view($this)) { throw new AccessDeniedException(get_string('canteditdontown', 'view')); } if (!count($_POST) && count($_GET) < 3) { return; } $action = ''; foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'action_') { $action = substr($key, 7); break; } else { if (substr($key, 0, 37) == 'cancel_action_configureblockinstance_' && param_integer('removeoncancel', 0)) { $action = 'removeblockinstance_' . substr($key, 37); break; } } } // TODO Scan GET for an action. The only action that is GETted is // confirming deletion of a blockinstance. It _should_ be a POST, but // that can be fixed later. if (!$action) { foreach ($_GET as $key => $value) { if (substr($key, 0, 7) == 'action_') { $action = substr($key, 7); } } } $viewtheme = param_variable('viewtheme', ''); if ($viewtheme && $viewtheme != $this->get('theme')) { $action = 'changetheme'; $values = array('theme' => $viewtheme); } if (empty($action)) { return; } form_validate(param_alphanum('sesskey', null)); if (!isset($values)) { $actionstring = $action; $action = substr($action, 0, strpos($action, '_')); $actionstring = substr($actionstring, strlen($action) + 1); // Actions from <input type="image"> buttons send an _x and _y if (substr($actionstring, -2) == '_x' || substr($actionstring, -2) == '_y') { $actionstring = substr($actionstring, 0, -2); } $values = self::get_values_for_action($actionstring); } $result = null; switch ($action) { // the view class method is the same as the action, // but I've left these here in case any additional // parameter handling has to be done. case 'addblocktype': // requires action_addblocktype (blocktype in separate parameter) $values['blocktype'] = param_alpha('blocktype', null); break; case 'removeblockinstance': // requires action_removeblockinstance_id_\d if (!defined('JSON')) { if (!($sure = param_boolean('sure'))) { $yesform = '<form action="' . get_config('wwwroot') . '/view/blocks.php" class="text-inline">' . '<input type="hidden" name="id" value="' . $this->get('id') . '">' . '<input type="hidden" name="c" value="file">' . '<input type="hidden" name="action_' . $action . '_' . $actionstring . '" value="1">' . '<input type="hidden" name="sure" value="1">' . '<input type="hidden" name="sesskey" value="' . $USER->get('sesskey') . '">' . '<input class="submit btn btn-primary" type="submit" name="removeblock_submit" value="' . get_string('yes') . '">' . '</form>'; $baselink = get_config('wwwroot') . 'view/blocks.php?id=' . $this->get('id') . '&c=' . $category . '&new=' . $new; $SESSION->add_info_msg(get_string('confirmdeleteblockinstance', 'view') . ' ' . $yesform . ' <a href="' . $baselink . '">' . get_string('no') . '</a>', false); redirect($baselink); exit; } } break; case 'configureblockinstance': // requires action_configureblockinstance_id_\d_column_\d_order_\d // requires action_configureblockinstance_id_\d_column_\d_order_\d case 'acsearch': // requires action_acsearch_id_\d if (!defined('JSON')) { $this->blockinstance_currently_being_configured = $values['id']; // And we're done here for now return; } case 'moveblockinstance': // requires action_moveblockinstance_id_\d_row_\d_column_\d_order_\d // requires action_moveblockinstance_id_\d_row_\d_column_\d_order_\d case 'addcolumn': // requires action_addcolumn_\d_row_\d_before_\d // requires action_addcolumn_\d_row_\d_before_\d case 'removecolumn': // requires action_removecolumn_\d_row_\d_column_\d // requires action_removecolumn_\d_row_\d_column_\d case 'changetheme': case 'updatecustomlayoutpreview': case 'addcustomlayout': break; default: throw new InvalidArgumentException(get_string('noviewcontrolaction', 'error', $action)); } $message = ''; $success = false; try { $values['returndata'] = defined('JSON'); $returndata = $this->{$action}($values); // Tell the watchlist that the view changed $data = (object) array('view' => $this->get('id')); if (!defined('JSON')) { $message = $this->get_viewcontrol_ok_string($action); } $success = true; } catch (Exception $e) { // if we're in ajax land, just throw it // the handler will deal with the message. if (defined('JSON')) { throw $e; } $message = $this->get_viewcontrol_err_string($action) . ': ' . $e->getMessage(); } if (!defined('JSON')) { // set stuff in the session and redirect $fun = 'add_ok_msg'; if (!$success) { $fun = 'add_error_msg'; } $SESSION->{$fun}($message); redirect('/view/blocks.php?id=' . $this->get('id') . '&c=' . $category . '&new=' . $new); } return array('message' => $message, 'data' => $returndata); }
/** * Get institution name by checking which 'institution theme' a user is allocated to see * and if that theme has sitepages set. * Or if a lastinstitution cookie is set. Or if an institution url parameter is set. * Defaults to 'mahara'. * * @return string Institution name */ public function sitepages_institutionname_by_theme($page) { // get institution when logged in if ($this->is_logged_in()) { if ($theme = $this->get('institutiontheme')) { if (!empty($theme->institutionname)) { // check to see if institution is using it's own site pages or default site pages if ($institution = get_record('institution', 'name', $theme->institutionname)) { if (get_config_institution($institution->name, 'sitepages_' . $page)) { return get_config_institution($institution->name, 'sitepages_' . $page); } } else { return $theme->institutionname; } } else { return 'mahara'; } } } // or from url if ($institution = param_alphanum('institution', null)) { return $institution; } // or from cookie if ($institution = get_cookie('lastinstitution')) { return $institution; } return 'mahara'; }
function progressbar_sideblock($preview = false) { global $USER; // TODO: Remove this URL param from here, and when previewing pass institution // by function param instead $institution = param_alphanum('i', null); if (is_array($USER->institutions) && count($USER->institutions) > 0) { // Get all institutions where user is member $institutions = array(); foreach ($USER->institutions as $inst) { if (empty($inst->suspended)) { $institutions = array_merge($institutions, array($inst->institution => $inst->displayname)); } } // Set user's first institution in case that institution isn't // set yet or user is not member of currently set institution. if (!$institution || !array_key_exists($institution, $institutions)) { $institution = key(array_slice($institutions, 0, 1)); } } else { $institutions = array(); $institution = 'mahara'; } // Set appropriate preview according to institution, if the institutio is selected // If the institution isn't selected then show preview for first institution, which // is also selected as a default value in institution selection box if ($preview) { $default = get_column('institution', 'name'); // TODO: Remove this URL param from here, and when previewing pass institution // by function param instead $institution = param_alphanum('institution', $default[0]); } // We need to check to see if any of the institutions have profile completeness to allow // the select box to work correctly for users with more than one institution $multiinstitutionprogress = false; $counting = null; if (!empty($institutions)) { foreach ($institutions as $key => $value) { if ($result = get_records_select_assoc('institution_config', 'institution=? and field like \'progressbaritem_%\'', array($key), 'field', 'field, value')) { $multiinstitutionprogress = true; if ($key == $institution) { $counting = $result; break; } } } } else { $counting = get_records_select_assoc('institution_config', 'institution=? and field like \'progressbaritem_%\'', array($institution), 'field', 'field, value'); } // Get artefacts that count towards profile completeness if ($counting) { // Without locked ones (site locked and institution locked) $sitelocked = (array) get_column('institution_locked_profile_field', 'profilefield', 'name', 'mahara'); $instlocked = (array) get_column('institution_locked_profile_field', 'profilefield', 'name', $institution); $locked = $sitelocked + $instlocked; foreach ($locked as $l) { unset($counting["progressbaritem_internal_{$l}"]); } $totalcounting = 0; foreach ($counting as $c) { $totalcounting = $totalcounting + $c->value; } // Get all artefacts for progressbar and create data structure $data = array(); // For the artefact_get_progressbar_items function, we want them indexed by plugin // and then subindexed by artefact. For most other purposes, having them indexed // by config name is sufficient $onlytheseplugins = array(); foreach ($counting as $key => $obj) { // This one has no value. So remove it from the list. if (!$obj->value) { unset($counting[$key]); continue; } $parts = explode('_', $obj->field); $plugin = $parts[1]; $item = $parts[2]; if (empty($onlytheseplugins[$plugin])) { $onlytheseplugins[$plugin] = array(); } $onlytheseplugins[$plugin][$item] = $item; } $progressbaritems = artefact_get_progressbar_items($onlytheseplugins); // Get the data link about every item foreach ($progressbaritems as $pluginname => $itemlist) { foreach ($itemlist as $artefactname => $item) { $itemname = "progressbaritem_{$pluginname}_{$artefactname}"; $c = $counting[$itemname]; $target = $c->value; $completed = 0; $data[$itemname] = array('artefact' => $artefactname, 'link' => progressbar_artefact_link($pluginname, $artefactname), 'counting' => $target, 'completed' => $completed, 'display' => (bool) $c->value, 'label' => progressbar_artefact_task_label($pluginname, $artefactname, $target, $completed)); } } if ($preview) { $percent = 0; } else { // Since this is not a preview, gather data about the users' actual progress, // and update the records we placed in $data. // Get a list of all the basic artefact types in this progress bar. $nonmeta = array(); foreach ($progressbaritems as $plugin => $pluginitems) { foreach ($pluginitems as $itemname => $item) { if (!$item->ismeta) { $nonmeta[] = $itemname; } } } if ($nonmeta) { // To reduce the number of queries, we gather data about all the user's artefacts // at once. (Metaartefacts are handled separately, below) $insql = "'" . implode("','", $nonmeta) . "'"; $sql = "SELECT artefacttype, (select plugin from {artefact_installed_type} ait where ait.name=a.artefacttype) as plugin, COUNT(*) AS completed\n FROM {artefact} a\n WHERE owner = ?\n AND artefacttype in ({$insql})\n GROUP BY artefacttype"; $normalartefacts = get_records_sql_array($sql, array($USER->get('id'))); if (!$normalartefacts) { $normalartefacts = array(); } } else { // No basic artefacts in this one, so we just use an empty array for this. $normalartefacts = array(); } $totalcompleted = 0; $metaartefacts = array(); foreach ($progressbaritems as $plugin => $pluginitems) { if (is_array($records = artefact_get_progressbar_metaartefacts($plugin, $pluginitems))) { foreach ($records as $record) { $record->plugin = $plugin; array_push($metaartefacts, $record); } } } foreach (array_merge($normalartefacts, $metaartefacts) as $record) { $itemname = "progressbaritem_{$record->plugin}_{$record->artefacttype}"; // It's not an item we're tracking, so skip it. if (!array_key_exists($itemname, $counting)) { continue; } $target = $counting[$itemname]->value; $remaining = max(0, $target - $record->completed); // Override the data for this item $data[$itemname]['completed'] = $record->completed; $data[$itemname]['display'] = $remaining > 0; $data[$itemname]['label'] = $label = get_string('progress_' . $record->artefacttype, 'artefact.' . $record->plugin, $remaining); if ($target > 0) { $totalcompleted = $totalcompleted + min($target, $record->completed); } } $percent = round($totalcompleted / $totalcounting * 100); if ($percent > 100) { $percent = 100; } } return array('data' => $data, 'percent' => $percent, 'preview' => $preview, 'count' => $preview ? 1 : count($institutions), 'institutions' => $institutions, 'institution' => $institution, 'totalcompleted' => !empty($totalcompleted) ? $totalcompleted : 0, 'totalcounting' => $totalcounting); } else { if ($multiinstitutionprogress) { return array('data' => null, 'percent' => 0, 'preview' => $preview, 'count' => $preview ? 1 : count($institutions), 'institutions' => $institutions, 'institution' => $institution, 'totalcompleted' => 0, 'totalcounting' => 0); } } return array('data' => null, 'percent' => 0, 'preview' => $preview, 'count' => 1, 'institutions' => null, 'institution' => 'mahara'); }
define('PUBLIC', 1); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'view'); define('SECTION_PAGE', 'view'); require dirname(dirname(__FILE__)) . '/init.php'; require_once get_config('libroot') . 'view.php'; require_once get_config('libroot') . 'collection.php'; require_once get_config('libroot') . 'objectionable.php'; require_once 'institution.php'; require_once 'group.php'; safe_require('artefact', 'comment'); safe_require('artefact', 'file'); // access key for roaming teachers $mnettoken = $SESSION->get('mnetuser') ? param_alphanum('mt', null) : null; // access key for logged out users $usertoken = is_null($mnettoken) && get_config('allowpublicviews') ? param_alphanum('t', null) : null; if ($mnettoken) { if (!($viewid = get_view_from_token($mnettoken, false))) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } } else { if ($usertoken) { if (!($viewid = get_view_from_token($usertoken, true))) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } } else { if ($pageurl = param_alphanumext('page', null)) { if ($profile = param_alphanumext('profile', null)) { $view = new View(array('urlid' => $pageurl, 'ownerurlid' => $profile)); } else { if ($homepage = param_alphanumext('homepage', null)) {
*/ define('INTERNAL', 1); define('INSTITUTIONALADMIN', 1); define('MENUITEM', 'managegroups/archives'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; define('TITLE', get_string('archivedsubmissions', 'admin')); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'admin'); define('SECTION_PAGE', 'archives'); require_once 'searchlib.php'; $search = (object) array('query' => trim(param_variable('query', '')), 'sortby' => param_alpha('sortby', 'firstname'), 'sortdir' => param_alpha('sortdir', 'asc')); $offset = param_integer('offset', 0); $limit = param_integer('limit', 10); if ($USER->get('admin')) { $institutions = get_records_array('institution', '', '', 'displayname'); $search->institution = param_alphanum('institution', 'all'); } else { $institutionnames = array_keys($USER->get('admininstitutions')); $institutions = get_records_select_array('institution', 'suspended = 0 AND name IN (' . join(',', array_fill(0, count($institutionnames), '?')) . ')', $institutionnames, 'displayname'); } list($html, $columns, $pagination, $search) = build_admin_archived_submissions_results($search, $offset, $limit); $js = <<<EOF addLoadEvent(function() { var p = {$pagination['javascript']} new UserSearch(p); }) EOF; $smarty = smarty(array('adminexportqueue', 'paginator'), array(), array('ascending' => 'mahara', 'descending' => 'mahara')); $smarty->assign('search', $search); $smarty->assign('limit', $limit);
$edit = param_boolean('edit'); $json = param_boolean('j'); $instanceid = param_variable('id', 0); // IF WE'RE EDITING OR CREATING AN AUTHORITY: if ($institution && $plugin) { $classname = 'PluginAuth' . ucfirst(strtolower($plugin)); safe_require('auth', strtolower($plugin)); $has_instance_config = call_static_method($classname, 'has_instance_config'); if (false == $has_instance_config && $add) { // We've been asked to add an instance of an auth plugin that has no // config options. We've been called by an AJAX request, so we just // add the instance and generate an acknowledgement. // The session key has not been checked yet, because this page doesn't // define JSON try { form_validate(param_alphanum('sesskey', null)); } catch (UserException $e) { json_reply(true, $e->getMessage()); } $authinstance = new stdClass(); // Get the auth instance with the highest priority number (which is // the instance with the lowest priority). // TODO: rethink 'priority' as a fieldname... it's backwards!! $lastinstance = get_records_array('auth_instance', 'institution', $institution, 'priority DESC', '*', '0', '1'); if ($lastinstance == false) { $authinstance->priority = 0; } else { $authinstance->priority = $lastinstance[0]->priority + 1; } $authinstance->instancename = $plugin; $authinstance->institution = $institution;
$elements[$name] = array('title' => $name, 'type' => 'text'); } } if ($authtype == 'user') { $username = param_alphanum('wsusername', ''); $password = param_alphanum('wspassword', ''); $elements['wsusername'] = array('title' => 'wsusername', 'type' => 'text', 'value' => $username); $elements['wspassword'] = array('title' => 'wspassword', 'type' => 'text', 'value' => $password); if ($username) { $params[] = 'wsusername='******'wspassword='******'wstoken', ''); $elements['wstoken'] = array('title' => 'wstoken', 'type' => 'text', 'value' => $wstoken); if ($wstoken) { $params[] = 'wstoken=' . $wstoken; } } $nextaction = get_string('execute', 'auth.webservice'); } } $elements['submit'] = array('type' => 'submitcancel', 'value' => array($nextaction, get_string('cancel')), 'goto' => get_config('wwwroot') . 'webservice/testclient.php'); if (!empty($elements['protocol']['options'])) { $form = pieform(array('name' => 'testclient', 'renderer' => 'table', 'type' => 'div', 'successcallback' => 'testclient_submit', 'elements' => $elements)); } else { $form = ''; } $smarty = smarty();
<?php /** * * @package mahara * @subpackage core * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(__FILE__)) . '/init.php'; json_headers(); $instance = param_alphanum('instance'); if (isset($_SESSION['progress_meters'][$instance])) { $data = $_SESSION['progress_meters'][$instance]; if ($data['finished']) { $SESSION->set_progress($instance, FALSE); } } else { $data = array(); } json_reply(false, array('data' => $data));
define('SECTION_PLUGINNAME', 'view'); define('SECTION_PAGE', 'view'); require dirname(dirname(__FILE__)) . '/init.php'; require_once get_config('libroot') . 'view.php'; require_once get_config('libroot') . 'collection.php'; require_once get_config('libroot') . 'objectionable.php'; require_once 'institution.php'; require_once 'group.php'; safe_require('artefact', 'comment'); // access key for roaming teachers $mnettoken = $SESSION->get('mnetuser') ? param_alphanum('mt', null) : null; // access key for logged out users // OVERWRITE 1: replacement, changed from: //$usertoken = (is_null($mnettoken) && get_config('allowpublicviews')) ? param_alphanum('t', null) : null; // to: $usertoken = is_null($mnettoken) ? param_alphanum('t', null) : null; // END OVERWRITE 1 if ($mnettoken) { if (!($viewid = get_view_from_token($mnettoken, false))) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } } else { if ($usertoken) { if (!($viewid = get_view_from_token($usertoken, true))) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } } else { if ($pageurl = param_alphanumext('page', null)) { if ($profile = param_alphanumext('profile', null)) { $view = new View(array('urlid' => $pageurl, 'ownerurlid' => $profile)); } else {
* @subpackage artefact-survey * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2010-2011 Gregor Anzelj <*****@*****.**> * */ define('INTERNAL', true); define('MENUITEM', 'content/surveys'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'survey'); define('SECTION_PAGE', 'edit'); require_once dirname(dirname(dirname(__FILE__))) . '/init.php'; require_once 'pieforms/pieform.php'; safe_require('artefact', 'survey'); $id = param_integer('id'); $fieldset = param_alphanum('fs', 'tab1'); $is_survey = get_field('artefact', 'artefacttype', 'id', $id) == 'survey' ? true : false; $user_is_owner = $USER->get('id') == get_field('artefact', 'owner', 'id', $id) ? true : false; if (!$is_survey) { throw new ArtefactNotFoundException(get_string('artefactnotsurvey', 'artefact.survey')); } if (!$user_is_owner) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } $survey = null; try { $survey = artefact_instance_from_id($id); } catch (Exception $e) { } if ($USER->get('id') != $survey->get('owner')) { $SESSION->add_error_msg(get_string('canteditdontown'));
<?php /** * * @package mahara * @subpackage core * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; require_once 'searchlib.php'; $params = new StdClass(); $params->query = trim(param_variable('query', '')); $params->institution = param_alphanum('institution', null); $params->lastinstitution = param_alphanum('lastinstitution', null); $params->requested = param_integer('requested', null); $params->invitedby = param_integer('invitedby', null); $params->member = param_integer('member', null); $limit = param_integer('limit', 100); json_headers(); $data = get_institutional_admin_search_results($params, $limit); $data['error'] = false; $data['message'] = null; echo json_encode($data); exit;
<?php /** * * @package mahara * @subpackage admin * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('ADMIN', 1); define('INSTITUTIONALADMIN', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; require_once 'searchlib.php'; $search = (object) array('query' => '', 'sortby' => 'firstname', 'sortdir' => 'asc', 'archivedsubmissions' => true); $search->institution = param_alphanum('institution', null); if (!empty($search->institution)) { if (!$USER->get('admin') && !$USER->is_institutional_admin($search->institution)) { throw new AccessDeniedException(); } } $results = get_admin_user_search_results($search, 0, false); if (!empty($results['data'])) { $csvfields = array('username', 'email', 'firstname', 'lastname', 'preferredname', 'submittedto', 'specialid', 'filetitle', 'filepath', 'filename', 'archivectime'); $USER->set_download_file(generate_csv($results['data'], $csvfields), 'archivedsubmissions.csv', 'text/csv'); redirect(get_config('wwwroot') . 'download.php'); } $SESSION->add_error_msg(get_string('nocsvresults', 'admin')); redirect(get_config('wwwroot') . 'admin/groups/archives.php?institution=' . $search->institution);
* @author Mike Kelly UAL <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(__FILE__)) . '/init.php'; require_once 'imagebrowser.php'; $change = param_boolean('change', false); $viewid = param_integer('id', 0); $forumpostid = param_integer('post', 0); $groupid = param_integer('group', 0); $institution = param_alphanum('institution', 0); $blogid = param_alphanum('blogid', 0); $fileid = param_alphanum('selected', null); $changebrowsetab = param_integer('imgbrowserconf_artefactid_changeowner', 0); // Folder value is 0 when returning to Home folder $changefolder = param_exists('imgbrowserconf_artefactid_changefolder') ? true : false; $uploadimg = param_integer('imgbrowserconf_artefactid_upload', 0); $formsubmit = param_exists('action_submitimage') ? true : false; $formcancel = param_exists('cancel_action_submitimage') ? true : false; if ($forumpostid && !$groupid) { $sql = "SELECT g.id\n FROM {group} g\n INNER JOIN {interaction_instance} ii ON ii.group = g.id\n INNER JOIN {interaction_forum_topic} ift ON ift.forum = ii.id\n INNER JOIN {interaction_forum_post} ifp ON ifp.topic = ift.id\n WHERE ifp.id = ?\n AND ifp.deleted = 0"; $groupid = get_field_sql($sql, array($forumpostid)); } if ($blogid) { safe_require('artefact', 'blog'); $blogobj = new ArtefactTypeBlog($blogid); $institution = $blogobj->get('institution'); $institution = !empty($institution) ? $institution : 0;
* @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(__FILE__)) . '/init.php'; require_once get_config('libroot') . 'view.php'; $group = param_integer('group', null); $institution = param_alphanum('institution', null); $views = new StdClass(); $views->query = trim(param_variable('viewquery', '')); $views->ownerquery = trim(param_variable('ownerquery', '')); $views->offset = param_integer('viewoffset', 0); $views->limit = param_integer('viewlimit', 10); $views->group = param_integer('group', null); $views->institution = param_alphanum('institution', null); $views->copyableby = (object) array('group' => $group, 'institution' => $institution); if (!($group || $institution)) { $views->copyableby->owner = $USER->get('id'); } $searchcollection = param_integer('searchcollection', null); $sort[] = array('column' => 'title', 'desc' => 0); if ($searchcollection) { array_unshift($sort, array('column' => 'collection', 'desc' => 0, 'tablealias' => 'cv')); $views->collection = $searchcollection; } $views->sort = (object) $sort; View::get_templatesearch_data($views); json_reply(false, array('message' => null, 'data' => array('table' => $views->html, 'pagination' => $views->pagination['html'], 'count' => $views->count)));
/** * * @package mahara * @subpackage interaction-forum * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('PUBLIC', 1); define('MENUITEM', 'groups/forums'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; $forum = $topic = 0; $key = param_alphanum('key', ''); $subscriptiontype = 'forum'; $forum = param_integer('forum', 0); if (!$forum) { $subscriptiontype = 'topic'; $topic = param_integer('topic'); } $goto = $USER->is_logged_in() ? $subscriptiontype == 'forum' ? '/interaction/forum/view.php?id=' . $forum : '/interaction/forum/topic.php?id=' . $topic : '/index.php'; if ($key || $USER->is_logged_in()) { // get record from forum subscriptions for this key if ($key) { $subscription = get_record('interaction_forum_subscription_' . $subscriptiontype, 'key', $key); } else { $subscription = get_record('interaction_forum_subscription_' . $subscriptiontype, 'user', $USER->get('id'), $subscriptiontype, ${$subscriptiontype}); } if (!$subscription) {
*/ define('INTERNAL', 1); define('MENUITEM', 'groups'); require dirname(dirname(__FILE__)) . '/init.php'; require_once get_config('docroot') . 'interaction/lib.php'; require_once 'pieforms/pieform.php'; require_once 'group.php'; $id = param_integer('id', 0); if (!empty($id)) { $instance = interaction_instance_from_id($id); $plugin = $instance->get('plugin'); $groupid = (int) $instance->get('group'); define('TITLE', get_string('edittitle', 'interaction.' . $plugin)); } else { $instance = null; $plugin = param_alphanum('plugin'); $groupid = param_integer('group'); define('TITLE', get_string('addtitle', 'interaction.' . $plugin)); } define('GROUP', $groupid); $group = group_current_group(); safe_require('interaction', $plugin); $membership = group_user_access($groupid); if ($membership != 'admin') { throw new AccessDeniedException(get_string('notallowedtoeditinteractions', 'group')); } $returnto = param_alpha('returnto', 'view'); $elements = array_merge(PluginInteraction::instance_config_base_form($plugin, $group, $instance), call_static_method(generate_class_name('interaction', $plugin), 'instance_config_form', $group, $instance), array('submit' => array('type' => 'submitcancel', 'value' => array(get_string('save'), get_string('cancel')), 'goto' => get_config('wwwroot') . 'interaction/' . $plugin . (isset($instance) && $returnto != 'index' ? '/view.php?id=' . $instance->get('id') : '/index.php?group=' . $groupid)))); $js = call_static_method(generate_class_name('interaction', $plugin), 'instance_config_js', $group, $instance); // save, validate and cancelhandlers are in interaction/lib.php $form = pieform(array('name' => 'edit_interaction', 'plugintype' => 'interaction', 'pluginname' => $plugin, 'elements' => $elements));
/** * Service Users edit form * * @return html */ function service_users_edit_form() { global $THEME, $USER; $editicon = 'icon icon-pencil prm'; $deleteicon = 'icon icon-trash prm text-danger'; $form = array('name' => 'webservices_users', 'elementclasses' => false, 'successcallback' => 'webservices_users_submit', 'renderer' => 'multicolumntable', 'elements' => array('username' => array('title' => ' ', 'datatable' => true, 'type' => 'html', 'value' => get_string('username', 'auth.webservice')), 'institution' => array('title' => ' ', 'datatable' => true, 'type' => 'html', 'value' => get_string('institution')), 'servicename' => array('title' => ' ', 'datatable' => true, 'type' => 'html', 'value' => get_string('servicename', 'auth.webservice')), 'enabled' => array('title' => ' ', 'datatable' => true, 'type' => 'html', 'value' => get_string('enabled')), 'wssigenc' => array('title' => ' ', 'datatable' => true, 'type' => 'html', 'value' => get_string('titlewssigenc', 'auth.webservice')), 'functions' => array('title' => ' ', 'datatable' => true, 'type' => 'html', 'value' => get_string('functions', 'auth.webservice')), 'actions' => array('title' => ' ', 'datatable' => true, 'type' => 'html', 'value' => ''))); $dbusers = get_records_sql_array('SELECT eu.id as id, eu.userid as userid, eu.wssigenc AS wssigenc, eu.externalserviceid as externalserviceid, eu.institution as institution, u.username as username, es.name as name, es.enabled as enabled FROM {external_services_users} AS eu LEFT JOIN {usr} AS u ON eu.userid = u.id LEFT JOIN {external_services} AS es ON eu.externalserviceid = es.id ORDER BY eu.id', array()); if (!empty($dbusers)) { foreach ($dbusers as $user) { $dbinstitution = get_record('institution', 'name', $user->institution); if ($USER->is_admin_for_user($user->id)) { $user_url = get_config('wwwroot') . 'admin/users/edit.php?id=' . $user->userid; } else { $user_url = get_config('wwwroot') . 'user/view.php?id=' . $user->userid; } $form['elements']['id' . $user->id . '_username'] = array('value' => '<a href="' . $user_url . '">' . $user->username . '</a>', 'type' => 'html', 'key' => $user->id); $form['elements']['id' . $user->id . '_institution'] = array('value' => $dbinstitution->displayname, 'type' => 'html', 'key' => $user->id); $form['elements']['id' . $user->id . '_servicename'] = array('value' => $user->name, 'type' => 'html', 'key' => $user->id); $form['elements']['id' . $user->id . '_enabled'] = array('value' => $user->enabled == 1 ? display_icon('enabled') : display_icon('disabled'), 'type' => 'html', 'class' => 'center', 'key' => $user->id); $form['elements']['id' . $user->id . '_wssigenc'] = array('value' => $user->wssigenc == 1 ? display_icon('enabled') : display_icon('disabled'), 'type' => 'html', 'class' => 'center', 'key' => $user->id); $functions = get_records_array('external_services_functions', 'externalserviceid', $user->externalserviceid); $function_list = array(); if ($functions) { foreach ($functions as $function) { $dbfunction = get_record('external_functions', 'name', $function->functionname); $function_list[] = '<a href="' . get_config('wwwroot') . 'webservice/wsdoc.php?id=' . $dbfunction->id . '">' . $function->functionname . '</a>'; } } $form['elements']['id' . $user->id . '_functions'] = array('value' => implode(', ', $function_list), 'type' => 'html', 'key' => $user->id); // edit and delete buttons $form['elements']['id' . $user->id . '_actions'] = array('value' => pieform(array('name' => 'webservices_user_edit_' . $user->id, 'renderer' => 'div', 'elementclasses' => false, 'successcallback' => 'webservices_user_submit', 'class' => 'form-as-button pull-left', 'jsform' => false, 'elements' => array('suid' => array('type' => 'hidden', 'value' => $user->id), 'action' => array('type' => 'hidden', 'value' => 'edit'), 'submit' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-default btn-sm', 'value' => '<span class="' . $editicon . '"></span>' . get_string('edit'), 'elementtitle' => get_string('editspecific', 'mahara', $user->username))))) . pieform(array('name' => 'webservices_user_delete_' . $user->id, 'renderer' => 'div', 'elementclasses' => false, 'successcallback' => 'webservices_user_submit', 'class' => 'form-as-button pull-left', 'jsform' => false, 'elements' => array('suid' => array('type' => 'hidden', 'value' => $user->id), 'action' => array('type' => 'hidden', 'value' => 'delete'), 'submit' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-default btn-sm', 'value' => '<span class="' . $deleteicon . '"></span>' . get_string('delete'), 'elementtitle' => get_string('deletespecific', 'mahara', $user->username))))), 'type' => 'html', 'key' => $user->id, 'class' => 'webserviceconfigcontrols btn-group'); } } else { // no results so hide headings $form['elements'] = array(); } $username = ''; if ($user = param_integer('user', 0)) { $dbuser = get_record('usr', 'id', $user); if (!empty($dbuser)) { $username = $dbuser->username; } } else { $username = param_alphanum('username', ''); } $pieform = new pieform($form); return $pieform->build(false) . '<div id="user_add">' . pieform(array('name' => 'webservices_user_generate', 'renderer' => 'div', 'successcallback' => 'webservices_user_submit', 'jsform' => false, 'action' => get_config('wwwroot') . 'webservice/admin/index.php', 'elements' => array('userid' => array('type' => 'autocomplete', 'title' => get_string('username') . ': ', 'ajaxurl' => get_config('wwwroot') . 'webservice/admin/users.json.php', 'multiple' => true, 'allowclear' => true, 'ajaxextraparams' => array(), 'extraparams' => array('maximumSelectionLength' => 1), 'width' => '280px'), 'action' => array('type' => 'hidden', 'value' => 'add'), 'submit' => array('type' => 'submit', 'class' => 'submit btn-primary last', 'value' => get_string('add'))))) . '</div>'; }
define('SECTION_PAGE', 'webservicelogs'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; require_once 'webservicessearchlib.php'; define('TITLE', get_string('webservices_title', 'auth.webservice')); require_once 'pieforms/pieform.php'; $userquery = param_variable('userquery', null); $username = !empty($userquery) ? get_field('usr', 'username', 'id', $userquery) : ''; $functionquery = param_variable('functionquery', null); $functionname = !empty($functionquery) ? get_field('external_functions', 'name', 'id', $functionquery) : ''; $search = (object) array('userquery' => $username, 'functionquery' => $functionname, 'protocol' => trim(param_alphanumext('protocol', 'all')), 'authtype' => trim(param_alphanum('authtype', 'all')), 'onlyerrors' => 'on' == param_alphanum('onlyerrors', 'off') ? 1 : 0, 'sortby' => param_alpha('sortby', 'timelogged'), 'sortdir' => param_alpha('sortdir', 'desc'), 'offset' => param_integer('offset', 0), 'limit' => param_integer('limit', 10)); if ($USER->get('admin')) { $institutions = get_records_array('institution', '', '', 'displayname'); $search->institution = param_alphanum('institution', 'all'); } else { $institutions = get_records_select_array('institution', "name IN ('" . join("','", array_keys($USER->get('admininstitutions'))) . "')", null, 'displayname'); $search->institution_requested = param_alphanum('institution_requested', 'all'); } list($html, $columns, $searchurl, $pagination) = build_webservice_log_search_results($search); $institutionselect = ''; if (count($institutions) > 1) { $selecttype = $USER->get('admin') ? 'institution' : 'institution_requested'; $options = array('all' => get_string('All')); foreach ($institutions as $institution) { $options[$institution->name] = $institution->displayname; } $institutionfield = array($selecttype => array('type' => 'select', 'title' => get_string('Institution', 'admin'), 'defaultvalue' => !empty($search->institution) ? $search->institution : 'all', 'options' => $options)); $institutionselect = array_shift($institutionfield); } $protocoloptions = array('all' => get_string('All')); $protocols = array('REST', 'XML-RPC', 'SOAP'); foreach ($protocols as $protocol) {
$reason = param_variable('reason'); try { suspend_user($id, $reason); } catch (MaharaException $e) { json_reply('local', get_string('suspendfailed', 'admin') . ': ' . $e->getMessage()); } json_reply(false, get_string('usersuspended', 'admin')); } if ($action == 'search') { require_once 'searchlib.php'; $params = new StdClass(); $params->query = trim(param_variable('query', '')); $params->institution = param_alphanum('institution', null); $params->f = param_alpha('f', null); $params->l = param_alpha('l', null); $params->institution_requested = param_alphanum('institution_requested', null); $offset = param_integer('offset', 0); $limit = param_integer('limit', 10); $sortby = param_alpha('sortby', 'firstname'); $sortdir = param_alpha('sortdir', 'asc'); json_headers(); if (param_boolean('raw', false)) { $data = get_admin_user_search_results($params, $offset, $limit, $sortby, $sortdir); } else { $data['data'] = build_admin_user_search_results($params, $offset, $limit, $sortby, $sortdir); } $data['error'] = false; $data['message'] = null; echo json_encode($data); exit; }
* @copyright (C) 2010-2013 Gregor Anzelj <*****@*****.**> * */ define('INTERNAL', 1); define('ADMIN', 1); define('MENUITEM', 'configsite/sitefonts'); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'admin'); define('SECTION_PAGE', 'editfont'); require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php'; require_once 'pieforms/pieform.php'; define('TITLE', get_string('editfont', 'skin')); if (!get_config('skins')) { throw new FeatureNotEnabledException(); } $font = param_alphanum('font'); $fontdata = get_record('skin_fonts', 'name', $font); if ($fontdata == false) { throw new AccessDeniedException("Font not found"); } $form = pieform(array('name' => 'editfontform', 'plugintype' => 'artefact', 'pluginname' => 'skin', 'elements' => array('fontname' => array('type' => 'hidden', 'value' => $font), 'fonttitle' => array('type' => 'text', 'title' => get_string('fontname', 'skin'), 'defaultvalue' => !empty($fontdata->title) ? $fontdata->title : null), 'fontnotice' => array('type' => 'text', 'title' => get_string('fontnotice', 'skin'), 'description' => get_string('fontnoticedescription', 'skin'), 'defaultvalue' => !empty($fontdata->notice) ? $fontdata->notice : null), 'fonttype' => array('type' => 'radio', 'title' => get_string('fonttype', 'skin'), 'defaultvalue' => !empty($fontdata->onlyheading) && $fontdata->onlyheading == 1 ? 'heading' : 'text', 'options' => array('text' => get_string('headingandtext', 'skin'), 'heading' => get_string('headingonly', 'skin'))), 'genericfont' => array('type' => 'select', 'title' => get_string('genericfontfamily', 'skin'), 'defaultvalue' => !empty($fontdata->genericfont) ? $fontdata->genericfont : 'sans-serif', 'options' => array('serif' => 'serif', 'sans-serif' => 'sans-serif', 'monospace' => 'monospace', 'cursive' => 'cursive', 'fantasy' => 'fantasy'), 'rules' => array('required' => true)), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('save', 'mahara'), get_string('cancel', 'mahara')), 'goto' => get_config('wwwroot') . 'admin/site/fonts.php')))); $smarty = smarty(array('tablerenderer')); $smarty->assign('form', $form); $smarty->assign('PAGEHEADING', hsc(TITLE)); $smarty->display('form.tpl'); function editfontform_submit(Pieform $form, $values) { global $USER, $SESSION; update_record('skin_fonts', array('title' => $values['fonttitle'], 'notice' => $values['fontnotice'], 'onlyheading' => $values['fonttype'] == 'heading' ? 1 : 0, 'fontstack' => '\'' . escape_css_string($values['fonttitle']) . '\'', 'genericfont' => $values['genericfont']), array('name' => $values['fontname'])); $SESSION->add_ok_msg(get_string('fontedited', 'skin')); redirect('/admin/site/fonts.php');
* @subpackage admin * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz * */ // NOTE: This script is VERY SIMILAR to the adminusers.php script, a bug fixed // here might need to be fixed there too. define('INTERNAL', 1); define('INSTITUTIONALADMIN', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; define('TITLE', get_string('institutionstaff', 'admin')); require_once 'pieforms/pieform.php'; define('MENUITEM', 'manageinstitutions/institutionstaff'); require_once 'institution.php'; $s = institution_selector_for_page(param_alphanum('institution', false), get_config('wwwroot') . 'admin/users/institutionstaff.php'); $institution = $s['institution']; $smarty = smarty(); if ($institution === false) { $smarty->display('admin/users/noinstitutions.tpl'); exit; } // Get users who are currently staff $staffusers = get_column_sql('SELECT ui.usr FROM {usr_institution} ui LEFT JOIN {usr} u ON ui.usr = u.id WHERE ui.staff = 1 AND ui.institution = ? AND u.deleted = 0', array($institution)); $form = array('name' => 'staffusers', 'elements' => array('users' => array('type' => 'userlist', 'title' => get_string('staffusers', 'admin'), 'defaultvalue' => $staffusers, 'filter' => false, 'lefttitle' => get_string('institutionmembers', 'admin'), 'righttitle' => get_string('institutionstaff', 'admin'), 'searchparams' => array('limit' => 100, 'query' => '', 'member' => 1, 'institution' => $institution), 'searchscript' => 'admin/users/userinstitutionsearch.json.php'), 'institution' => array('type' => 'hidden', 'value' => $institution), 'submit' => array('type' => 'submit', 'value' => get_string('submit')))); function staffusers_submit(Pieform $form, $values)
* @subpackage core * @author Mike Kelly UAL <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(__FILE__)) . '/init.php'; require_once 'imagebrowser.php'; $change = param_boolean('change', false); $viewid = param_integer('id', 0); $forumpostid = param_integer('post', 0); $groupid = param_integer('group', 0); $institution = param_alphanum('institution', 0); $blogid = param_alphanum('blogid', 0); $changebrowsetab = param_integer('imgbrowserconf_artefactid_changeowner', 0); // Folder value is 0 when returning to Home folder $changefolder = param_exists('imgbrowserconf_artefactid_changefolder') ? true : false; $uploadimg = param_integer('imgbrowserconf_artefactid_upload', 0); $formsubmit = param_exists('action_submitimage') ? true : false; $formcancel = param_exists('cancel_action_submitimage') ? true : false; if ($forumpostid && !$groupid) { $sql = "SELECT g.id\n FROM {group} g\n INNER JOIN {interaction_instance} ii ON ii.group = g.id\n INNER JOIN {interaction_forum_topic} ift ON ift.forum = ii.id\n INNER JOIN {interaction_forum_post} ifp ON ifp.topic = ift.id\n WHERE ifp.id = ?\n AND ifp.deleted = 0"; $groupid = get_field_sql($sql, array($forumpostid)); } if ($blogid) { safe_require('artefact', 'blog'); $blogobj = new ArtefactTypeBlog($blogid); $institution = $blogobj->get('institution'); }
if (preg_match('/^delete\\-(\\d+)$/', $k, $m)) { delete_records('notification_internal_activity', 'id', $m[1], 'usr', $USER->get('id')); $count++; } } } catch (Exception $e) { db_rollback(); json_reply('local', get_string('failedtodeletenotifications', 'activity') . ': ' . $e->getMessage()); } db_commit(); safe_require('notification', 'internal'); json_reply(false, array('message' => get_string('deletednotifications', 'activity', $count), 'count' => $count, 'newunreadcount' => call_static_method(generate_class_name('notification', 'internal'), 'unread_count', $USER->get('id')))); } } // normal processing $type = param_alphanum('type', 'all'); $limit = param_integer('limit', 10); $offset = param_integer('offset', 0); $userid = $USER->get('id'); if ($type == 'all') { $count = count_records('notification_internal_activity', 'usr', $userid); $sql = 'SELECT a.*, at.name AS type,at.plugintype, at.pluginname FROM {notification_internal_activity} a JOIN {activity_type} at ON a.type = at.id WHERE a.usr = ? ORDER BY ctime DESC'; $records = get_records_sql_array($sql, array($userid), $offset, $limit); } else { if ($type == 'adminmessages' && $USER->get('admin')) { $count = count_records_select('notification_internal_activity', 'usr = ? AND type IN ( SELECT id FROM {activity_type} WHERE admin = ?)', array($userid, 1)); $sql = 'SELECT a.*, at.name AS type,at.plugintype, at.pluginname FROM {notification_internal_activity} a JOIN {activity_type} at ON a.type = at.id
* @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('PUBLIC', 1); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'site'); define('SECTION_PAGE', 'register'); require 'init.php'; require_once 'pieforms/pieform.php'; require_once 'lib/antispam.php'; require_once 'lib/institution.php'; define('TITLE', get_string('register')); $key = param_alphanum('key', null); /* * This page handles three different tasks: * 1) Showing a visitor the registration form * 2) Telling the visitor to check their e-mail for a message * 3) Given a key, display profile information to edit * * It uses the session to store some state */ if (!session_id()) { session_start(); } // Logged in people can't register. If someone passes a key however, log the // user out and see if this key registers someone if (is_logged_in()) { if ($key) {
exit; } $institution = param_alphanum('institution', false); if (!$institution || !$USER->can_edit_institution($institution)) { $institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value']; } else { if (!empty($institution)) { $institutionelement['defaultvalue'] = $institution; } } // Show either requesters, members, or nonmembers on the left hand side $usertype = param_alpha('usertype', 'requesters'); $usertypeselectorelements = array('usertype' => array('type' => 'select', 'title' => get_string('userstodisplay', 'admin'), 'options' => array('requesters' => get_string('institutionusersrequesters', 'admin'), 'nonmembers' => get_string('institutionusersnonmembers', 'admin'), 'lastinstitution' => get_string('institutionuserslastinstitution', 'admin'), 'members' => get_string('institutionusersmembers', 'admin'), 'invited' => get_string('institutionusersinvited', 'admin')), 'defaultvalue' => $usertype)); if ($usertype == 'lastinstitution') { // Change intitution dropdown to show possible last insitutions $lastinstitution = param_alphanum('lastinstitution', false); $usertypeselectorelements['lastinstitution'] = get_institution_selector(false, true); $usertypeselectorelements['lastinstitution']['title'] = get_string('lastinstitution', 'admin'); if ($lastinstitution) { $usertypeselectorelements['lastinstitution']['defaultvalue'] = $lastinstitution; } else { $lastinstitution = $usertypeselectorelements['lastinstitution']['defaultvalue']; } } $usertypeselector = pieform(array('name' => 'usertypeselect', 'checkdirtychange' => false, 'elements' => $usertypeselectorelements)); if ($usertype == 'requesters') { // LHS shows users who have requested membership, RHS shows users to be added $userlistelement = array('title' => get_string('addnewmembers', 'admin'), 'lefttitle' => get_string('usersrequested', 'admin'), 'righttitle' => get_string('userstoaddorreject', 'admin'), 'searchparams' => array('requested' => 1)); $submittext = get_string('addmembers', 'admin'); } else { if ($usertype == 'members') {
safe_require('artefact', 'blog'); require_once get_config('libroot') . 'pieforms/pieform.php'; if (!PluginArtefactBlog::is_active()) { throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('blog', 'artefact.blog'))); } $id = param_integer('id', null); if ($blogpost = param_integer('blogpost', null)) { $post = ArtefactTypeBlogPost::get_post_data($blogpost); $id = $post->blogid; $limit = 1; $setlimit = 1; $offset = $post->offset; } $institutionname = null; $title = ''; if ($institution = param_alphanum('institution', null)) { if ($institution == 'mahara') { $institutionname = $institution; if (!$USER->get('admin')) { throw new AccessDeniedException(); } $title = get_string('siteblogs', 'artefact.blog'); } else { $s = institution_selector_for_page($institution, get_config('wwwroot') . 'artefact/blog/view/index.php'); $institutionname = $s['institution']; if (!($USER->get('admin') || $USER->is_institutional_admin())) { throw new AccessDeniedException(); } $title = get_string('institutionblogs', 'artefact.blog'); } } else {
$institutionname = $institution; if (!$USER->get('admin')) { throw new AccessDeniedException(); } $institutiontitle = get_string('siteblogs', 'artefact.blog'); } else { $s = institution_selector_for_page($institution, get_config('wwwroot') . 'artefact/blog/index.php'); $institutionname = $s['institution']; if (!($USER->get('admin') || $USER->is_institutional_admin())) { throw new AccessDeniedException(); } $institutiontitle = get_string('institutionblogs', 'artefact.blog'); } $blogs->institution = $institutionname; } else { if ($groupid = param_alphanum('group', null)) { $blogs->group = $groupid; $group = get_record('group', 'id', $groupid, 'deleted', 0); $subsectionheading = get_string('Blogs', 'artefact.blog'); define('TITLE', $group->name); } else { define('TITLE', get_string('Blogs', 'artefact.blog')); } } PluginArtefactBlog::set_blog_nav($institution, $institutionname, $groupid); list($blogs->count, $blogs->data) = ArtefactTypeBlog::get_blog_list($blogs->limit, $blogs->offset, $blogs->institution, $blogs->group); if (empty($blogs->institution) && empty($blogs->group)) { if (!$USER->get_account_preference('multipleblogs')) { $extra = !empty($institution) ? '?institution=' . $institution : ''; $extra = !empty($group) ? '?group=' . $group : ''; redirect(get_config('wwwroot') . 'artefact/blog/view/index.php' . $extra);
* */ define('INTERNAL', 1); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'collection'); define('SECTION_PAGE', 'edit'); require dirname(dirname(__FILE__)) . '/init.php'; require_once 'pieforms/pieform.php'; require_once 'collection.php'; $new = param_boolean('new', 0); $copy = param_boolean('copy', 0); if ($new) { // if creating a new collection $owner = null; $groupid = param_integer('group', 0); $institutionname = param_alphanum('institution', false); if (empty($groupid) && empty($institutionname)) { $owner = $USER->get('id'); } $collection = new Collection(null, array('owner' => $owner, 'group' => $groupid, 'institution' => $institutionname)); define('SUBTITLE', get_string('edittitleanddesc', 'collection')); } else { // if editing an existing or copied collection $id = param_integer('id'); $collection = new Collection($id); $owner = $collection->get('owner'); $groupid = $collection->get('group'); $institutionname = $collection->get('institution'); define('SUBTITLE', $collection->get('name') . ': ' . get_string('edittitleanddesc', 'collection')); } if ($collection->is_submitted()) {
/** * * @package mahara * @subpackage core * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('PUBLIC', 1); define('JSON', 1); define('NOSESSKEY', 1); require dirname(dirname(__FILE__)) . '/init.php'; $institution = param_alphanum('institution', 'mahara'); if (empty($institution)) { // if '0' is passed via the form we display the default terms and conditions $institution = 'mahara'; } $useterms = false; if ($institution != 'mahara') { // try to fetch institution's terms and conditions $useterms = get_record_sql("SELECT sc.content FROM {site_content} sc\n LEFT JOIN {institution_config} ic ON ic.value = sc.institution\n WHERE ic.field = ?\n AND sc.name = ?\n AND ic.institution = ?", array('sitepages_termsandconditions', 'termsandconditions', $institution)); } if (empty($useterms)) { // get the default terms and conditions $useterms = get_record_sql("SELECT content FROM {site_content}\n WHERE institution = ?\n AND name = ?", array($institution, 'termsandconditions')); } json_headers(); print json_encode($useterms);