function pieform_element_rolepermissions_get_value(Pieform $form, $element) { /*{{{*/ if (isset($element['value'])) { return $element['value']; } if (isset($element['defaultvalue'])) { $value = $element['defaultvalue']; } else { $value = group_get_default_artefact_permissions($element['group']); } if ($form->is_submitted()) { $global = $form->get_property('method') == 'get' ? $_GET : $_POST; $prefix = $form->get_name() . '_' . $element['name'] . '_p'; foreach ($value as $r => $perms) { foreach (array_keys(get_object_vars($perms)) as $p) { if ($r != 'admin') { $value[$r]->{$p} = param_boolean($prefix . '_' . $r . '_' . $p); } } } } return $value; }
* @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('INSTITUTIONALSTAFF', 1); define('MENUITEM', 'configusers/usersearch'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; define('TITLE', get_string('usersearch', 'admin')); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'admin'); define('SECTION_PAGE', 'usersearch'); require_once 'searchlib.php'; $search = (object) array('query' => trim(param_variable('query', '')), 'f' => param_alpha('f', null), 'l' => param_alpha('l', null), 'sortby' => param_alpha('sortby', 'firstname'), 'sortdir' => param_alpha('sortdir', 'asc'), 'loggedin' => param_alpha('loggedin', 'any'), 'loggedindate' => param_variable('loggedindate', strftime(get_string('strftimedatetimeshort'))), 'duplicateemail' => param_boolean('duplicateemail', false)); $offset = param_integer('offset', 0); $limit = param_integer('limit', 10); if ($USER->get('admin') || $USER->get('staff')) { $institutions = get_records_array('institution', '', '', 'displayname'); $search->institution = param_alphanum('institution', 'all'); } else { $institutionnames = array_keys(array_merge($USER->get('admininstitutions'), $USER->get('staffinstitutions'))); $institutions = get_records_select_array('institution', 'name IN (' . join(',', array_fill(0, count($institutionnames), '?')) . ')', $institutionnames, 'displayname'); } $loggedintypes = array(); $loggedintypes[] = array('name' => 'any', 'string' => get_string('anyuser', 'admin')); $loggedintypes[] = array('name' => 'ever', 'string' => get_string('usershaveloggedin', 'admin')); $loggedintypes[] = array('name' => 'never', 'string' => get_string('usershaveneverloggedin', 'admin')); $loggedintypes[] = array('name' => 'since', 'string' => get_string('usershaveloggedinsince', 'admin')); $loggedintypes[] = array('name' => 'notsince', 'string' => get_string('usershavenotloggedinsince', 'admin'));
* @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('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');
* @subpackage core * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz * */ // TODO fix title of this page // TODO check security of this page define('INTERNAL', 1); require_once dirname(dirname(__FILE__)) . '/init.php'; require_once 'pieforms/pieform.php'; require_once 'view.php'; require_once get_config('libroot') . 'group.php'; define('TITLE', get_string('changemyviewlayout', 'view')); $id = param_integer('id'); $new = param_boolean('new'); $category = param_alpha('c', ''); $view = new View($id); $numcolumns = $view->get('numcolumns'); $currentlayout = $view->get('layout'); $back = !$USER->get_account_preference('addremovecolumns'); $group = $view->get('group'); $institution = $view->get('institution'); View::set_nav($group, $institution); if (!$USER->can_edit_view($view)) { throw new AccessDeniedException(); } // if not set, use equal width layout for that number of columns if (!$currentlayout) { $currentlayout = $numcolumns == 2 ? 1 : ($numcolumns == 3 ? 4 : 7); }
* @author Gregor Anzelj * @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. * @copyright (C) 2010-2013 Gregor Anzelj <*****@*****.**> * */ define('INTERNAL', true); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'skin'); define('SECTION_PAGE', 'design'); require_once dirname(dirname(__FILE__)) . '/init.php'; require_once 'skin.php'; require_once 'pieforms/pieform.php'; safe_require('artefact', 'file'); $fieldset = param_alpha('fs', 'viewskin'); $designsiteskin = param_boolean('site', false); if (!can_use_skins(null, $designsiteskin)) { throw new FeatureNotEnabledException(); } if ($designsiteskin) { define('ADMIN', 1); if (!$USER->get('admin')) { $SESSION->add_error_msg(get_string('accessforbiddentoadminsection')); redirect(); } define('MENUITEM', 'configsite/siteskins'); $goto = '/admin/site/skins.php'; $redirect = '/admin/site/skins.php'; } else { define('MENUITEM', 'myportfolio/skins'); $goto = '/skin/index.php';
* @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ /** * returns shared views in a given group id */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; safe_require('blocktype', 'groupviews'); require_once get_config('libroot') . 'view.php'; require_once get_config('libroot') . 'group.php'; require_once get_config('libroot') . 'pieforms/pieform.php'; $offset = param_integer('offset', 0); $groupid = param_integer('group'); $editing = param_boolean('editing', false); $group_homepage_view = group_get_homepage_view($groupid); $bi = group_get_homepage_view_groupview_block($groupid); if (!can_view_view($group_homepage_view)) { json_reply(true, get_string('accessdenied', 'error')); } $configdata = $bi->get('configdata'); if (!isset($configdata['showsharedviews'])) { $configdata['showsharedviews'] = 1; } $limit = isset($configdata['count']) ? intval($configdata['count']) : 5; $limit = $limit > 0 ? $limit : 5; // Find out what order to sort them by (default is titles) if (!isset($configdata['sortsharedviewsby']) || $configdata['sortsharedviewsby'] == PluginBlocktypeGroupViews::SORTBY_TITLE) { $sortsharedviewsby = 'v.title'; } else {
/** * Builds data for the artefact chooser. * * This builds three pieces of information: * * - HTML containing table rows * - Pagination HTML and Javascript * - The total number of artefacts found * - Artefact fields to return */ public static function build_artefactchooser_data($data, $group = null, $institution = null) { global $USER; // If lazyload is set, immediately return an empty resultset // In the case of forms using lazyload, lazyload is set to false by subsequent requests via ajax, // for example in views/artefactchooser.json.php, at which time the full resultset is returned. if (isset($data['lazyload']) && $data['lazyload']) { $result = ''; $pagination = build_pagination(array('id' => $data['name'] . '_pagination', 'class' => 'ac-pagination', 'url' => View::make_base_url() . (param_boolean('s') ? '&s=1' : ''), 'count' => 0, 'limit' => 0, 'offset' => 0, 'datatable' => $data['name'] . '_data', 'jsonscript' => 'view/artefactchooser.json.php', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'extradata' => array('value' => $data['defaultvalue'], 'blocktype' => $data['blocktype'], 'group' => $group, 'institution' => $institution))); return array($result, $pagination, 0, 0, array()); } $search = ''; if (!empty($data['search']) && param_boolean('s')) { $search = param_variable('search', ''); // Maybe later, depending on performance - don't search if there's // not enough characters. Prompts should be added to the UI too. //if (strlen($search) < 3) { // $search = ''; //} } $data['search'] = $search; $data['offset'] -= $data['offset'] % $data['limit']; safe_require('blocktype', $data['blocktype']); $blocktypeclass = generate_class_name('blocktype', $data['blocktype']); $data['sortorder'] = array(array('fieldname' => 'title', 'order' => 'ASC')); if (method_exists($blocktypeclass, 'artefactchooser_get_sort_order')) { $data['sortorder'] = call_static_method($blocktypeclass, 'artefactchooser_get_sort_order'); } list($artefacts, $totalartefacts) = self::get_artefactchooser_artefacts($data, $USER, $group, $institution); $selectone = $data['selectone']; $value = $data['defaultvalue']; $elementname = $data['name']; $template = $data['template']; $returnfields = isset($data['returnfields']) ? $data['returnfields'] : null; $returnartefacts = array(); $result = ''; if ($artefacts) { if (!empty($data['ownerinfo'])) { require_once get_config('docroot') . 'artefact/lib.php'; $userid = $group || $institution ? null : $USER->get('id'); foreach (artefact_get_owner_info(array_keys($artefacts)) as $k => $v) { if ($artefacts[$k]->owner !== $userid || $artefacts[$k]->group !== $group || $artefacts[$k]->institution !== $institution) { $artefacts[$k]->ownername = $v->name; $artefacts[$k]->ownerurl = $v->url; } } } foreach ($artefacts as &$artefact) { safe_require('artefact', get_field('artefact_installed_type', 'plugin', 'name', $artefact->artefacttype)); if (method_exists($blocktypeclass, 'artefactchooser_get_element_data')) { $artefact = call_static_method($blocktypeclass, 'artefactchooser_get_element_data', $artefact); } // Build the radio button or checkbox for the artefact $formcontrols = ''; if ($selectone) { $formcontrols .= '<input type="radio" class="radio" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '" value="' . hsc($artefact->id) . '"'; if ($value == $artefact->id) { $formcontrols .= ' checked="checked"'; } $formcontrols .= '>'; } else { $formcontrols .= '<input type="checkbox" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '[' . hsc($artefact->id) . ']"'; if ($value && in_array($artefact->id, $value)) { $formcontrols .= ' checked="checked"'; } $formcontrols .= ' class="artefactid-checkbox checkbox">'; $formcontrols .= '<input type="hidden" name="' . hsc($elementname) . '_onpage[]" value="' . hsc($artefact->id) . '" class="artefactid-onpage">'; } $smarty = smarty_core(); $smarty->assign('artefact', $artefact); $smarty->assign('elementname', $elementname); $smarty->assign('formcontrols', $formcontrols); $result .= $smarty->fetch($template) . "\n"; if ($returnfields) { $returnartefacts[$artefact->id] = array(); foreach ($returnfields as $f) { if ($f == 'safedescription') { $returnartefacts[$artefact->id]['safedescription'] = clean_html($artefact->description); continue; } if ($f == 'attachments') { // Check if the artefact has attachments - we need to update the instance config form // to have those attachments selected. $attachment_ids = get_column('artefact_attachment', 'attachment', 'artefact', $artefact->id); $returnartefacts[$artefact->id]['attachments'] = $attachment_ids; continue; } $returnartefacts[$artefact->id][$f] = $artefact->{$f}; } } } if ($returnfields && !empty($data['getblocks'])) { // Get ids of the blocks containing these artefacts $blocks = get_records_select_array('view_artefact', 'artefact IN (' . join(',', array_fill(0, count($artefacts), '?')) . ')', array_keys($artefacts)); if (!empty($blocks)) { // For each artefact, attach a list of block ids of all the blocks // that contain it. foreach ($blocks as $block) { if (empty($returnartefacts[$block->artefact]['blocks'])) { $returnartefacts[$block->artefact]['blocks'] = array(); } $returnartefacts[$block->artefact]['blocks'][] = $block->block; } } } } $pagination = build_pagination(array('id' => $elementname . '_pagination', 'class' => 'ac-pagination', 'url' => View::make_base_url() . (param_boolean('s') ? '&s=1' : ''), 'count' => $totalartefacts, 'limit' => $data['limit'], 'offset' => $data['offset'], 'datatable' => $elementname . '_data', 'jsonscript' => 'view/artefactchooser.json.php', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'extradata' => array('value' => $value, 'blocktype' => $data['blocktype'], 'group' => $group, 'institution' => $institution))); return array($result, $pagination, $totalartefacts, $data['offset'], $returnartefacts); }
$view = new View(array('urlid' => $pageurl, 'ownerurlid' => $profile)); } else { if ($homepage = param_alphanumext('homepage', null)) { $view = new View(array('urlid' => $pageurl, 'groupurlid' => $homepage)); } else { throw new ViewNotFoundException(get_string('viewnotfoundexceptiontitle', 'error')); } } $viewid = $view->get('id'); } else { $viewid = param_integer('id'); } } } $new = param_boolean('new'); $showmore = param_boolean('showmore'); if (!$showmore) { $showmore = 0; } if (!isset($view)) { $view = new View($viewid); } if (!can_view_view($view)) { $errorstr = param_integer('objection', null) ? get_string('accessdeniedobjection', 'error') : get_string('accessdenied', 'error'); throw new AccessDeniedException($errorstr); } else { // To save the atime in the db - make it a millisecond in the past // so it differs from the atime in the View constructor and so triggers // the saving of the atime change. Can't use $view->set('dirty', true) // as that will also get the view object to update the mtime which is not // what we want.
* @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', 'artefact'); define('SECTION_PLUGINNAME', 'internal'); define('SECTION_PAGE', 'validate'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; require_once 'pieforms/pieform.php'; safe_require('artefact', 'internal'); define('TITLE', get_string('emailactivation', 'artefact.internal')); $email = param_variable('email'); $key = param_variable('key'); $decline = param_boolean('decline'); $row = get_record('artefact_internal_profile_email', 'email', $email, 'key', $key, null, null, 'owner,artefact,email,verified,' . db_format_tsfield('expiry')); if ($row) { if ($decline) { delete_records_select('artefact_internal_profile_email', 'verified=0 AND key=? AND email=?', array($key, $email)); $SESSION->add_ok_msg(get_string('emailactivationdeclined', 'artefact.internal')); redirect(get_config('wwwroot')); } if ($row->expiry > time()) { if ($row->artefact) { $artefact = new ArtefactTypeEmail($row->artefact); } else { $artefact = new ArtefactTypeEmail(); } $artefact->set('owner', $row->owner); $artefact->set('title', $row->email);
function editview_submit(Pieform $form, $values) { global $view, $SESSION; if (param_boolean('back')) { redirect('/view/blocks.php?id=' . $view->get('id') . '&new=' . $new); } $view->set('title', $values['title']); $view->set('description', $values['description']); $view->set('tags', $values['tags']); if (isset($values['ownerformat']) && $view->get('owner')) { $view->set('ownerformat', $values['ownerformat']); } $view->commit(); if ($values['new']) { $redirecturl = '/view/access.php?id=' . $view->get('id') . '&new=1'; } else { $SESSION->add_ok_msg(get_string('viewsavedsuccessfully', 'view')); if ($view->get('group')) { $redirecturl = '/view/groupviews.php?group=' . $view->get('group'); } else { if ($view->get('institution')) { $redirecturl = '/view/institutionviews.php?institution=' . $view->get('institution'); } else { $redirecturl = '/view/index.php'; } } } redirect($redirecturl); }
* @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. * */ /** * This displays a pdf in an <iframe> * */ define('INTERNAL', 1); define('PUBLIC', 1); require dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/init.php'; require_once get_config('docroot') . '/artefact/lib.php'; $fileid = param_integer('file'); $viewid = param_integer('view'); $editing = param_boolean('editing', false); $ingroup = param_boolean('ingroup', false); if (!artefact_in_view($fileid, $viewid)) { throw new AccessDeniedException(''); } if (!can_view_view($viewid)) { throw new AccessDeniedException(''); } $file = artefact_instance_from_id($fileid); if (!$file instanceof ArtefactTypeFile) { throw new NotFoundException(); } $urlbase = get_config('wwwroot'); if (get_config('cleanurls') && get_config('cleanurlusersubdomains') && !$editing && !$ingroup) { $view = new View($viewid); $viewauthor = new User(); $viewauthor->find_by_id($view->get('owner'));
<?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); define('INSTITUTIONALSTAFF', 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->f = param_alpha('f', null); $params->l = param_alpha('l', null); $params->sortby = param_alpha('sortby', 'firstname'); $params->sortdir = param_alpha('sortdir', 'asc'); $params->loggedin = param_alpha('loggedin', 'any'); $params->loggedindate = param_variable('loggedindate', null); $params->duplicateemail = param_boolean('duplicateemail', false); $offset = param_integer('offset', 0); $limit = param_integer('limit', 10); list($html, $columns, $pagination, $search) = build_admin_user_search_results($params, $offset, $limit); json_reply(false, array('message' => null, 'data' => array('tablerows' => $html, 'pagination' => $pagination['html'], 'pagination_js' => $pagination['javascript'])));
/** * Builds data for the artefact chooser. * * This builds three pieces of information: * * - HTML containing table rows * - Pagination HTML and Javascript * - The total number of artefacts found */ public static function build_artefactchooser_data($data, $group = null, $institution = null) { global $USER; $search = ''; if (!empty($data['search']) && param_boolean('s')) { $search = param_variable('search', ''); // Maybe later, depending on performance - don't search if there's // not enough characters. Prompts should be added to the UI too. //if (strlen($search) < 3) { // $search = ''; //} } $data['search'] = $search; $data['offset'] -= $data['offset'] % $data['limit']; safe_require('blocktype', $data['blocktype']); $blocktypeclass = generate_class_name('blocktype', $data['blocktype']); $data['sortorder'] = array(array('fieldname' => 'title', 'order' => 'ASC')); if (method_exists($blocktypeclass, 'artefactchooser_get_sort_order')) { $data['sortorder'] = call_static_method($blocktypeclass, 'artefactchooser_get_sort_order'); } list($artefacts, $totalartefacts) = self::get_artefactchooser_artefacts($data, $USER, $group, $institution); $selectone = $data['selectone']; $value = $data['defaultvalue']; $elementname = $data['name']; $template = $data['template']; $result = ''; if ($artefacts) { foreach ($artefacts as &$artefact) { safe_require('artefact', get_field('artefact_installed_type', 'plugin', 'name', $artefact->artefacttype)); if (method_exists($blocktypeclass, 'artefactchooser_get_element_data')) { $artefact = call_static_method($blocktypeclass, 'artefactchooser_get_element_data', $artefact); } // Build the radio button or checkbox for the artefact $formcontrols = ''; if ($selectone) { $formcontrols .= '<input type="radio" class="radio" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '" value="' . hsc($artefact->id) . '"'; if ($value == $artefact->id) { $formcontrols .= ' checked="checked"'; } $formcontrols .= '>'; } else { $formcontrols .= '<input type="checkbox" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '[' . hsc($artefact->id) . ']"'; if ($value && in_array($artefact->id, $value)) { $formcontrols .= ' checked="checked"'; } $formcontrols .= ' class="artefactid-checkbox checkbox">'; $formcontrols .= '<input type="hidden" name="' . hsc($elementname) . '_onpage[]" value="' . hsc($artefact->id) . '" class="artefactid-onpage">'; } $smarty = smarty_core(); $smarty->assign('artefact', $artefact); $smarty->assign('elementname', $elementname); $smarty->assign('formcontrols', $formcontrols); $result .= $smarty->fetch($template) . "\n"; } } $pagination = build_pagination(array('id' => $elementname . '_pagination', 'class' => 'ac-pagination', 'url' => View::make_base_url() . (param_boolean('s') ? '&s=1' : ''), 'count' => $totalartefacts, 'limit' => $data['limit'], 'offset' => $data['offset'], 'datatable' => $elementname . '_data', 'jsonscript' => 'view/artefactchooser.json.php', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'extradata' => array('value' => $value, 'blocktype' => $data['blocktype'], 'group' => $group, 'institution' => $institution))); return array($result, $pagination, $totalartefacts, $data['offset']); }
<?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 'init.php'; $showhomeinfo = (int) param_boolean('showhomeinfo'); $result = array(); $USER->set_account_preference('showhomeinfo', $showhomeinfo); json_reply(false, $result);
$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; }
<?php /** * * @package mahara * @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)); }
* * @package mahara * @subpackage skin * @author Gregor Anzelj * @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. * @copyright (C) 2010-2013 Gregor Anzelj <*****@*****.**> * */ define('INTERNAL', true); require_once dirname(dirname(__FILE__)) . '/init.php'; require_once 'skin.php'; require_once get_config('docroot') . 'artefact/file/lib.php'; $exportid = param_integer('id', 0); // id(s) of skin(s) to be exported... $exportsiteskins = param_boolean('site', false); if (!can_use_skins(null, $exportsiteskins)) { throw new FeatureNotEnabledException(); } if ($exportid == 0) { if ($exportsiteskins) { // We are exporting site skins... $exportskins = get_records_array('skin', 'type', 'site'); $xmlfilename = 'siteskins'; } else { // We are exporting user skins... $exportskins = get_records_array('skin', 'owner', $USER->get('id')); $xmlfilename = 'myskins'; } } else { $exportskins = get_record('skin', 'id', $exportid, 'owner', $USER->get('id'));
* @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 * */ define('INTERNAL', 1); define('ADMIN', 1); define('JSON', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; json_headers(); $type = param_alpha('type'); // external list or admin file $name = param_variable('name'); $linkedto = param_variable('linkedto'); $itemid = param_variable('itemid'); $public = (int) param_boolean('public'); $data = new StdClass(); if ($type == 'sitefile') { // Get file id. $data->file = $linkedto; } else { if ($type == 'externallink') { $data->url = $linkedto; } else { // Bad menu item type json_reply('local', get_string('badmenuitemtype', 'admin')); } } $data->title = $name; if ($itemid == 'new') { $data->public = $public;
if (param_boolean('last', false)) { delete_records('config', 'field', '_upgrade'); } json_reply(false, $data); exit; } catch (Exception $e) { list($texttrace, $htmltrace) = log_build_backtrace($e->getTrace()); $data['errormessage'] = $e->getMessage() . '<br>' . $htmltrace; $data['error'] = true; if (table_exists(new XMLDBTable('config'))) { delete_records('config', 'field', '_upgrade'); } json_reply('local', $data); exit; } } else { // Nothing to upgrade. This can happen when a plugin upgrade was found // in the original list of upgrades generated on admin/upgrade.php, but // the core upgrade has already upgraded that plugin, so we're trying to // upgrade it again. // It seems a bit wrong. For one thing, the core upgrade probably // shouldn't upgrade plugins past the version that was current at the // time the core upgrade was written. $data['error'] = false; $data['message'] = get_string('nothingtoupgrade', 'admin'); if (param_boolean('last', false)) { delete_records('config', 'field', '_upgrade'); } json_reply(false, $data); exit; }
define('ADMIN', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; define('TITLE', get_string('institutions', 'admin')); require_once 'pieforms/pieform.php'; require_once get_config('docroot') . '/lib/htmloutput.php'; // CHECK FOR CANCEL BEFORE THE 'REQUIRED' PARAMS: $cancel = param_boolean('c'); if ($cancel) { execute_javascript_and_close(); } // NOT CANCELLING? OK - OTHER PARAMS THEN: $institution = param_variable('i'); $plugin = param_variable('p'); $add = param_boolean('add'); $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) {
define('SECTION_PAGE', 'groupviews'); require dirname(dirname(__FILE__)) . '/init.php'; require_once get_config('libroot') . 'view.php'; require_once get_config('libroot') . 'group.php'; require_once 'pieforms/pieform.php'; //@todo: group menu; group sideblock $limit = param_integer('limit', 5); $offset = param_integer('offset', 0); define('GROUP', param_integer('group')); $group = group_current_group(); if (!is_logged_in() && !$group->public) { throw new AccessDeniedException(); } define('TITLE', $group->name . ' - ' . get_string('groupviews', 'view')); $member = group_user_access($group->id); $shared = param_boolean('shared', 0) && $member; $can_edit = group_user_can_edit_views($group->id); $smarty = smarty(); $smarty->assign('heading', $group->name); if ($can_edit) { $data = View::get_myviews_data($limit, $offset, $group->id); } else { $data = View::view_search(null, null, (object) array('group' => $group->id), null, $limit, $offset); } $userid = $USER->get('id'); $pagination = build_pagination(array('url' => get_config('wwwroot') . 'view/groupviews.php?group=' . $group->id, 'count' => $data->count, 'limit' => $limit, 'offset' => $offset, 'resultcounttextsingular' => get_string('view', 'view'), 'resultcounttextplural' => get_string('views', 'view'))); $smarty->assign('groupviews', 1); $smarty->assign('member', $member); $smarty->assign('views', $data->data); $smarty->assign('pagination', $pagination['html']); $smarty->assign('createviewform', pieform(create_view_form($group->id)));
$smarty->display('view/changetheme.tpl'); exit; } $smarty = smarty(array('views', 'tinymce', 'paginator', 'tablerenderer', 'artefact/file/js/filebrowser.js', 'lib/pieforms/static/core/pieforms.js', 'blocktype/creativecommons/js/creativecommons.js'), $stylesheets, false, $extraconfig); // The list of categories for the tabbed interface $smarty->assign('category_list', $view->build_category_list($category, $new)); // The list of blocktypes for the default category $smarty->assign('blocktype_list', $view->build_blocktype_list($category)); // Tell smarty we're editing rather than just rendering $smarty->assign('editing', true); // Work out what action is being performed. This is used to put a hidden submit // button right at the very start of the form, so that hitting enter in any // form fields will cause the correct action to be performed foreach (array_keys($_POST + $_GET) as $key) { if (substr($key, 0, 7) == 'action_') { if (param_boolean('s')) { // When configuring a blockinstance and the search tab is open, // pressing enter should search $key = str_replace('configureblockinstance', 'acsearch', $key); if (substr($key, -2) == '_x') { $key = substr($key, 0, -2); } } $smarty->assign('action_name', $key); break; } } $smarty->assign('maintitle', TITLE); $smarty->assign('displaylink', $displaylink); $smarty->assign('formurl', get_config('wwwroot') . 'view/blocks.php'); $smarty->assign('category', $category);
/** * * @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); define('INSTITUTIONALADMIN', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; require_once 'pieforms/pieform/elements/bytes.php'; $instid = param_integer('instid'); $disabled = param_boolean('disabled', false); $definst = get_field('auth_instance', 'id', 'institution', 'mahara'); $record = get_record_sql('SELECT i.name, i.defaultquota FROM {institution} i JOIN {auth_instance} ai ON (i.name = ai.institution) WHERE ai.id = ?', array($instid)); if (!$USER->get('admin') && !$USER->is_institutional_admin($record->name)) { json_reply(true, 'You are not an administrator for institution ' . $record->name); return; } if ($definst && $instid == $definst) { $quota = get_config_plugin('artefact', 'file', 'defaultquota'); } else { $quota = $record->defaultquota; if (!$quota) { $quota = get_config_plugin('artefact', 'file', 'defaultquota'); } } $data = array('data' => $disabled ? display_size($quota) : pieform_element_bytes_get_bytes_from_bytes($quota), 'error' => false, 'message' => null);
* @package mahara * @subpackage core * @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 * */ define('INTERNAL', 1); define('MENUITEM', 'myportfolio/collection'); 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); $id = param_integer('id', 0); $data = null; if ($data = get_record_select('collection', 'id = ?', array($id))) { $collection = new Collection($id, (array) $data); if (!$USER->can_edit_collection($collection)) { $SESSION->add_error_msg(get_string('canteditdontown')); redirect('/collection/'); } } // if not a new collection if (!$new) { define('COLLECTION', $id); define('TITLE', $collection->get('name') . ': ' . get_string('edittitleanddesc', 'collection')); } else { define('TITLE', get_string('edittitleanddesc', 'collection'));
/** * Check if the form is supposed to be collapsed * @param array $element The element to render * @return boolean if the fieldset should be collapsed */ function pieform_is_collapsed(Pieform $form, $element) { $formname = $form->get_name(); $iscollapsed = !empty($element['collapsed']); // if name element is not set, element should not be collapsed if (!isset($element['name'])) { return false; } $valid = param_alphanumext('fs', null) !== $element['name']; // Work out whether any of the children have errors on them foreach ($element['elements'] as $subelement) { if (isset($subelement['error'])) { return false; // collapsible element should be open } } if (isset($element['name'])) { $openparam = $formname . '_' . $element['name'] . '_open'; } if ($iscollapsed && $valid && !param_boolean($openparam, false)) { return true; } return false; }
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package mahara * @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 * */ define('INTERNAL', 1); define('ADMIN', 1); define('JSON', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; $public = param_boolean('public'); safe_require('artefact', 'file'); $result = array(); $result['adminfiles'] = ArtefactTypeFile::get_admin_files($public); if (empty($result['adminfiles'])) { $result['adminfiles'] = null; } $result['error'] = false; $result['message'] = false; json_headers(); echo json_encode($result);
/** * This function handles filebrowser actions, such as uploading files, deleting files, creating folders, etc. * It piggybacks on the surrounding pieform but bypasses the normal Pieforms validation process. * * @param Pieform $form * @param array $element * @return mixed */ function pieform_element_filebrowser_doupdate(Pieform $form, $element) { require_once 'license.php'; $result = null; $prefix = $form->get_name() . '_' . $element['name']; // Since this is executed before normal pieforms validation, we'll redundantly call the validation here try { $sesskey = param_variable('sesskey', null); pieform_validate($form, array('sesskey' => $sesskey)); } catch (Exception $e) { return array('error' => true, 'message' => $e->getMessage()); } $delete = param_variable($prefix . '_delete', null); if (is_array($delete)) { $keys = array_keys($delete); return pieform_element_filebrowser_delete($form, $element, (int) $keys[0]); } $resizeonuploaduserenable = param_variable($prefix . '_resizeonuploaduserenable', null); if (!empty($resizeonuploaduserenable)) { $resizeimage = 1; } else { $resizeimage = 0; } $update = param_variable($prefix . '_update', null); if (is_array($update)) { $keys = array_keys($update); $artefactid = (int) $keys[0]; $edit_title = param_variable($prefix . '_edit_title'); $namelength = strlen($edit_title); if (!$namelength) { return array('edit' => $artefactid, 'error' => true, 'message' => get_string('filenamefieldisrequired1', 'artefact.file')); } else { if ($namelength > 1024) { return array('edit' => $artefactid, 'error' => true, 'message' => get_string('nametoolong', 'artefact.file')); } } $data = array('artefact' => $artefactid, 'title' => $edit_title, 'description' => param_variable($prefix . '_edit_description'), 'tags' => param_variable($prefix . '_edit_tags'), 'folder' => $element['folder'], 'allowcomments' => param_boolean($prefix . '_edit_allowcomments')); if (get_config('licensemetadata')) { $data = array_merge($data, array('license' => license_coalesce(null, param_variable($prefix . '_edit_license'), param_variable($prefix . '_edit_license_other', null)), 'licensor' => param_variable($prefix . '_edit_licensor'), 'licensorurl' => param_variable($prefix . '_edit_licensorurl'))); } if ($form->get_property('group')) { $data['permissions'] = array('admin' => (object) array('view' => true, 'edit' => true, 'republish' => true)); foreach ($_POST as $k => $v) { if (preg_match('/^' . $prefix . '_permission:([a-z]+):([a-z]+)$/', $k, $m)) { if (!isset($data['permissions'][$m[1]])) { $data['permissions'][$m[1]] = new stdClass(); } $data['permissions'][$m[1]]->{$m[2]} = (bool) $v; } } } return pieform_element_filebrowser_update($form, $element, $data); } $move = param_variable($prefix . '_move', null); if (!empty($move)) { return pieform_element_filebrowser_move($form, $element, array('artefact' => (int) $move, 'newparent' => param_integer($prefix . '_moveto'), 'folder' => $element['folder'])); } $createfolder = param_variable($prefix . '_createfolder', null); if (!empty($createfolder)) { $createfolder_name = param_variable($prefix . '_createfolder_name'); $namelength = strlen($createfolder_name); if (!$namelength) { return array('error' => true, 'message' => get_string('foldernamerequired', 'artefact.file')); } else { if ($namelength > 1024) { return array('error' => true, 'message' => get_string('nametoolong', 'artefact.file')); } } return pieform_element_filebrowser_createfolder($form, $element, array('title' => $createfolder_name, 'folder' => $element['folder'])); } // {$prefix}_upload is set in all browsers except safari when javascript is // on (and set in all browsers when it's not) $upload = param_variable($prefix . '_upload', null); if (!empty($upload)) { if (empty($_FILES['userfile']['name'])) { return array('error' => true, 'message' => get_string('filenamefieldisrequired', 'artefact.file'), 'browse' => 1); } else { if (is_array($_FILES['userfile']['name'])) { foreach ($_FILES['userfile']['name'] as $filename) { if (empty($filename)) { // TODO, how to specify which file is in error... return array('error' => true, 'message' => get_string('filenamefieldisrequired', 'artefact.file'), 'browse' => 1); } } } } } if (!empty($_FILES['userfile']['name'])) { if (!is_array($_FILES['userfile']['name'])) { if (!empty($_POST['_userfile']) && is_array($_POST['_userfile'])) { // renaming file for drag and drop $_FILES['userfile']['name'] = $_POST['_userfile']['name']; $_FILES['userfile']['type'] = $_POST['_userfile']['type']; } if (strlen($_FILES['userfile']['name']) > 1024) { return array('error' => true, 'message' => get_string('nametoolong', 'artefact.file')); } else { if ($element['config']['uploadagreement'] && !param_boolean($prefix . '_notice', false)) { return array('error' => true, 'message' => get_string('youmustagreetothecopyrightnotice', 'artefact.file'), 'browse' => 1); } } $data = array('userfile' => $_FILES['userfile'], 'uploadnumber' => param_integer($prefix . '_uploadnumber'), 'uploadfolder' => $element['folder'] ? $element['folder'] : null, 'uploadfoldername' => param_variable($prefix . '_foldername'), 'resizeonuploaduserenable' => $resizeimage); if (get_config('licensemetadata') && param_variable('dropzone')) { $data = array_merge($data, array('license' => license_coalesce(null, param_variable($prefix . '_license'), param_variable($prefix . '_license_other', null)), 'licensor' => param_variable($prefix . '_licensor'), 'licensorurl' => param_variable($prefix . '_licensorurl'))); } else { if (get_config('licensemetadata')) { $data = array_merge($data, array('license' => license_coalesce(null, param_variable($prefix . '_edit_license'), param_variable($prefix . '_edit_license_other', null)), 'licensor' => param_variable($prefix . '_edit_licensor'), 'licensorurl' => param_variable($prefix . '_edit_licensorurl'))); } } $result = pieform_element_filebrowser_upload($form, $element, $data); // If it's a non-js upload, automatically select the newly uploaded file. $result['browse'] = 1; if (!$form->submitted_by_js() && !$result['error'] && !empty($element['config']['select'])) { if (isset($element['selectcallback']) && is_callable($element['selectcallback'])) { $element['selectcallback']($result['highlight']); } else { $result['select'] = $result['highlight']; } } return $result; } else { if (!empty($_FILES['userfile']['name'][0])) { if ($element['config']['uploadagreement'] && !param_boolean($prefix . '_notice', false)) { return array('error' => true, 'message' => get_string('youmustagreetothecopyrightnotice', 'artefact.file'), 'browse' => 1); } $result = array('multiuploads' => array()); $size = sizeof($_FILES['userfile']['name']); for ($i = 0; $i < $size; $i++) { if (strlen($_FILES['userfile']['name'][$i]) > 1024) { return array('error' => true, 'message' => get_string('nametoolong', 'artefact.file')); } $data = array('userfile' => $_FILES['userfile'], 'userfileindex' => $i, 'uploadnumber' => param_integer($prefix . '_uploadnumber') - ($size - $i - 1), 'uploadfolder' => $element['folder'] ? $element['folder'] : null, 'uploadfoldername' => param_variable($prefix . '_foldername'), 'resizeonuploaduserenable' => $resizeimage); if (get_config('licensemetadata')) { $data = array_merge($data, array('license' => license_coalesce(null, param_variable($prefix . '_license'), param_variable($prefix . '_license_other', null)), 'licensor' => param_variable($prefix . '_licensor'), 'licensorurl' => param_variable($prefix . '_licensorurl'))); } $result['multiuploads'][$i] = pieform_element_filebrowser_upload($form, $element, $data); // TODO, what to do here... // If it's a non-js upload, automatically select the newly uploaded file. $result['multiuploads'][$i]['browse'] = 1; if (!$form->submitted_by_js() && !$result['multiuploads'][$i]['error'] && !empty($element['config']['select'])) { if (isset($element['selectcallback']) && is_callable($element['selectcallback'])) { $element['selectcallback']($result['multiuploads'][$i]['highlight']); } else { $result['multiuploads'][$i]['select'] = $result['multiuploads'][$i]['highlight']; } } $result['multiuploads'][$i]['folder'] = $element['folder']; } return $result; } } } if (!$form->submitted_by_js()) { $select = param_variable($prefix . '_select', null); if (is_array($select)) { $keys = array_keys($select); $add = (int) $keys[0]; if (isset($element['selectcallback']) && is_callable($element['selectcallback'])) { try { $element['selectcallback']($add); } catch (ArtefactNotFoundException $e) { $result = array('error' => true, 'message' => get_string('selectingfailed', 'artefact.file')); return $result; } } else { $result['select'] = $add; } $result['message'] = get_string('fileadded', 'artefact.file'); $result['browse'] = 1; return $result; } $unselect = param_variable($prefix . '_unselect', null); if (is_array($unselect)) { $keys = array_keys($unselect); $del = (int) $keys[0]; if (isset($element['unselectcallback']) && is_callable($element['unselectcallback'])) { try { $element['unselectcallback']($del); } catch (ArtefactNotFoundException $e) { $result = array('error' => true, 'message' => get_string('removingfailed', 'artefact.file')); return $result; } } else { $result['unselect'] = $del; } $result['message'] = get_string('fileremoved', 'artefact.file'); return $result; } $edit = param_variable($prefix . '_edit', null); if (is_array($edit)) { $keys = array_keys($edit); $result['edit'] = (int) $keys[0]; return $result; } if (param_variable('browse', 0) && !param_variable($prefix . '_cancelbrowse', 0)) { $result['browse'] = 1; return $result; } } $changeowner = param_variable($prefix . '_changeowner', null); if (!empty($changeowner)) { $result = pieform_element_filebrowser_changeowner($form, $element); $result['browse'] = 1; return $result; } $newfolder = param_variable($prefix . '_changefolder', null); if (!is_null($newfolder) && is_numeric($newfolder)) { $result = pieform_element_filebrowser_changefolder($form, $element, $newfolder); $result['browse'] = 1; $result['folder'] = $newfolder; return $result; } }
public function instance_config_store(Pieform $form, $values) { global $SESSION, $USER; // Destroy form values we don't care about unset($values['sesskey']); unset($values['blockinstance']); unset($values['action_configureblockinstance_id_' . $this->get('id')]); unset($values['blockconfig']); unset($values['id']); unset($values['change']); unset($values['new']); if (isset($values['retractable'])) { switch ($values['retractable']) { case BlockInstance::RETRACTABLE_YES: $values['retractable'] = 1; $values['retractedonload'] = 0; break; case BlockInstance::RETRACTABLE_RETRACTED: $values['retractable'] = 1; $values['retractedonload'] = 1; break; case BlockInstance::RETRACTABLE_NO: default: $values['retractable'] = 0; $values['retractedonload'] = 0; break; } } // make sure that user is allowed to publish artefact. This is to stop // hacking of form value to attach other users private data. $badattachment = false; if (!empty($values['artefactid'])) { $badattachment = !$this->verify_attachment_permissions($values['artefactid']); } if (!empty($values['artefactids'])) { $badattachment = !$this->verify_attachment_permissions($values['artefactids']); } if ($badattachment) { $result['message'] = get_string('unrecoverableerror', 'error'); $form->set_error(null, $result['message']); $form->reply(PIEFORM_ERR, $result); exit; } $redirect = '/view/blocks.php?id=' . $this->get('view'); if (param_boolean('new', false)) { $redirect .= '&new=1'; } if ($category = param_alpha('c', '')) { $redirect .= '&c=' . $category; } $result = array('goto' => $redirect); if (is_callable(array(generate_class_name('blocktype', $this->get('blocktype')), 'instance_config_save'))) { try { $values = call_static_method(generate_class_name('blocktype', $this->get('blocktype')), 'instance_config_save', $values, $this); } catch (MaharaException $e) { $result['message'] = $e instanceof UserException ? $e->getMessage() : get_string('unrecoverableerror', 'error'); $form->set_error(null, $result['message']); $form->reply(PIEFORM_ERR, $result); } } $title = isset($values['title']) ? $values['title'] : ''; unset($values['title']); // A block may return a list of other blocks that need to be // redrawn after configuration of this block. $torender = !empty($values['_redrawblocks']) && $form->submitted_by_js() ? $values['_redrawblocks'] : array(); unset($values['_redrawblocks']); $this->set('configdata', $values); $this->set('title', $title); $this->commit(); try { $rendered = $this->render_editing(false, false, $form->submitted_by_js()); } catch (HTMLPurifier_Exception $e) { $message = get_string('blockconfigurationrenderingerror', 'view') . ' ' . $e->getMessage(); $form->reply(PIEFORM_ERR, array('message' => $message)); } $result = array('error' => false, 'message' => get_string('blockinstanceconfiguredsuccessfully', 'view'), 'data' => $rendered, 'blockid' => $this->get('id'), 'viewid' => $this->get('view'), 'goto' => $redirect); // Render all the other blocks in the torender list $result['otherblocks'] = array(); foreach ($torender as $blockid) { if ($blockid != $result['blockid']) { $otherblock = new BlockInstance($blockid); $result['otherblocks'][] = array('blockid' => $blockid, 'data' => $otherblock->render_editing(false, false, true)); } } $form->reply(PIEFORM_OK, $result); }
* * @package mahara * @subpackage core * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz * */ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(__FILE__)) . '/init.php'; json_headers(); $data = new StdClass(); $data->view = param_integer('view'); $data->artefact = param_integer('artefact', null); $data->message = param_variable('message'); $data->public = param_boolean('public') ? 1 : 0; $data->attachment = param_integer('attachment', null); $data->author = $USER->get('id'); $data->ctime = db_format_timestamp(time()); if ($data->artefact) { $table = 'artefact_feedback'; } else { $table = 'view_feedback'; } if (!insert_record($table, $data, 'id', true)) { json_reply('local', get_string('addfeedbackfailed', 'view')); } require_once 'activity.php'; activity_occurred('feedback', $data); json_reply(false, get_string('feedbacksubmitted', 'view'));
*/ define('INTERNAL', 1); define('JSON', 1); require dirname(dirname(__FILE__)) . '/init.php'; require_once 'searchlib.php'; safe_require('search', 'internal'); try { $query = param_variable('query'); } catch (ParameterException $e) { json_reply('missingparameter', 'Missing parameter \'query\''); } $limit = param_integer('limit', 20); $offset = param_integer('offset', 0); $allfields = param_boolean('allfields'); $group = param_integer('group', 0); $includeadmins = param_boolean('includeadmins', true); $orderby = param_variable('orderby', 'firstname'); $options = array('orderby' => $orderby); if ($group) { $options['group'] = $group; $options['includeadmins'] = $includeadmins; $data = search_user($query, $limit, $offset, $options); } else { $data = search_user($query, $limit, $offset, $options); } if ($data['data']) { foreach ($data['data'] as &$result) { $result = array('id' => $result['id'], 'name' => $result['name']); } } json_reply(false, $data);