/** * @param string The URL option */ function showInstalledModules($_option) { global $database, $mosConfig_absolute_path, $adminLanguage; $filter = mosGetParam($_POST, 'filter', ''); $select[] = mosHTML::makeOption('', $adminLanguage->A_COMP_MOD_ALL); $select[] = mosHTML::makeOption('0', $adminLanguage->A_MENU_SITE_MOD); $select[] = mosHTML::makeOption('1', $adminLanguage->A_INSTALL_MOD_ADMIN_MOD); $lists['filter'] = mosHTML::selectList($select, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter); if ($filter == NULL) { $and = ''; } else { if (!$filter) { $and = "\n AND client_id = '0'"; } else { if ($filter) { $and = "\n AND client_id = '1'"; } } } $database->setQuery("SELECT id, module, client_id" . "\n FROM #__modules" . "\n WHERE module LIKE 'mod_%' AND iscore='0'" . $and . "\n GROUP BY module, client_id" . "\n ORDER BY client_id, module"); $rows = $database->loadObjectList(); $id = 0; foreach ($rows as $row) { // path to module directory if ($row->client_id == "1") { $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "administrator/modules"); } else { $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "modules"); } // xml file for module $xmlfile = $moduleBaseDir . "/" . $row->module . ".xml"; $xmlDoc =& new DOMIT_Lite_Document(); $xmlDoc->resolveErrors(true); if (!$xmlDoc->loadXML($xmlfile, false, true)) { continue; } $element =& $xmlDoc->documentElement; if ($element->getTagName() != 'mosinstall') { continue; } if ($element->getAttribute("type") != "module") { continue; } $element =& $xmlDoc->getElementsByPath('creationDate', 1); $row->creationdate = $element ? $element->getText() : ''; $element =& $xmlDoc->getElementsByPath('author', 1); $row->author = $element ? $element->getText() : ''; $element =& $xmlDoc->getElementsByPath('copyright', 1); $row->copyright = $element ? $element->getText() : ''; $element =& $xmlDoc->getElementsByPath('authorEmail', 1); $row->authorEmail = $element ? $element->getText() : ''; $element =& $xmlDoc->getElementsByPath('authorUrl', 1); $row->authorUrl = $element ? $element->getText() : ''; $element =& $xmlDoc->getElementsByPath('version', 1); $row->version = $element ? $element->getText() : ''; $rows[$id] = $row; $id++; } HTML_module::showInstalledModules($rows, $_option, $id, $xmlfile, $lists); }
/** * Draws the menu to edit a menu item */ function _EDIT($type) { global $id; $hs = ''; if (!$id) { $cid = mosGetParam($_POST, 'cid', array(0)); $id = $cid[0]; } $menutype = mosGetParam($_REQUEST, 'menutype', 'mainmenu'); mosMenuBar::startTable(); if (!$id) { $link = 'index2.php?option=com_menus&menutype=' . $menutype . '&task=new&hidemainmenu=1'; mosMenuBar::back(T_('Back'), $link); mosMenuBar::spacer(); } mosMenuBar::save(); mosMenuBar::spacer(); mosMenuBar::apply(); mosMenuBar::spacer(); if ($id) { // for existing content items the button is renamed `close` mosMenuBar::cancel('cancel', T_('Close')); } else { mosMenuBar::cancel(); } mosMenuBar::spacer(); mosMenuBar::help($type); mosMenuBar::endTable(); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editSection($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for section $lists['componentid'] = mosAdminMenus::Section($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_section_menu_html::editSection($menu, $lists, $params, $option); }
function saveMenu($option) { global $database; $params = mosGetParam($_POST, 'params', ''); $secids = mosGetParam($_POST, 'secid', array()); $secid = implode(',', $secids); $params[sectionid] = $secid; if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = implode("\n", $txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (count($secids) == 1 && $secids[0] != "") { $row->link = str_replace("id=0", "id=" . $secids[0], $row->link); $row->componentid = $secids[0]; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype='{$row->menutype}' AND parent='{$row->parent}'"); mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype); }
/** * Draws the menu to edit a menu item */ function _EDIT() { global $id; if (!$id) { $cid = josGetArrayInts('cid'); $id = $cid[0]; } $menutype = strval(mosGetParam($_REQUEST, 'menutype', 'mainmenu')); mosMenuBar::startTable(); if (!$id) { $link = 'index2.php?option=com_menus&menutype=' . $menutype . '&task=new&hidemainmenu=1&' . josSpoofValue() . '=1'; mosMenuBar::back('Back', $link); mosMenuBar::spacer(); } mosMenuBar::save(); mosMenuBar::spacer(); mosMenuBar::apply(); mosMenuBar::spacer(); if ($id) { // for existing content items the button is renamed `close` mosMenuBar::cancel('cancel', 'Close'); } else { mosMenuBar::cancel(); } mosMenuBar::spacer(); mosMenuBar::help('screen.menus.edit'); mosMenuBar::endTable(); }
function execute(&$controller, &$request) { if (isset($_POST['catalogs'])) { $_REQUEST['act'] = 'language'; } $controller->redirect('index', mosGetParam($_REQUEST, 'act', $act)); }
/** * Saves the record from an edit form submit * @param string The current GET/POST option */ function saveSyndicate($option) { global $database; josSpoofCheck(); $params = mosGetParam($_POST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $id = intval(mosGetParam($_POST, 'id', '17')); $row = new mosComponent($database); $row->load($id); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $msg = 'Settings successfully Saved'; mosRedirect('index2.php?option=' . $option, $msg); }
function bc_loadBanner() { $pos = mosGetParam($_REQUEST, 'pos', ''); $style = mosGetParam($_REQUEST, 'st', 0); $no_html = mosGetParam($_REQUEST, 'no_html', 0); $format = mosGetParam($_REQUEST, 'format', null); //raw $tmpl = mosGetParam($_REQUEST, 'tmpl', null); //component $dynamic = mosGetParam($_REQUEST, 'dyn', 0); if (!$pos) { return; } if ($dynamic) { //set no caching in browser, this is for dynamic reloading of banner header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); } if ($format == "raw") { //show RAW output, what are 1.5 parameters for render function torender raw output? echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" . "\n<html xmlns=\"http://www.w3.org/1999/xhtml\">" . "\n<head>" . "\n<title></title>" . "\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />" . "\n<meta name=\"robots\" content=\"noindex, nofollow\" />" . "\n</head>" . "\n<body>\n"; } // Include the syndicate functions only once jimport('joomla.application.module.helper'); $modules =& JModuleHelper::getModules($pos); $total = count($modules); for ($i = 0; $i < $total; $i++) { JModuleHelper::renderModule($modules[$i]); } if ($format == "raw") { echo "\n</body>\n</html>"; } }
function show_poll_vote_form($Itemid) { global $database; $Itemid = mosGetParam($_REQUEST, 'Itemid', 0); $query1 = "SELECT p.id, p.title" . "\nFROM #__polls AS p, #__poll_menu AS pm" . "\nWHERE (pm.menuid='{$Itemid}' OR pm.menuid='0') AND p.id=pm.pollid" . "\nAND p.published=1"; $database->setQuery($query1); $polls = $database->loadObjectList(); if ($database->getErrorNum()) { echo "MB " . $database->stderr(true); return; } if ($polls) { foreach ($polls as $poll) { if ($poll->id && $poll->title) { $query = "SELECT id, text FROM #__poll_data" . "\nWHERE pollid='{$poll->id}' AND text <> ''" . "\nORDER BY id"; $database->setQuery($query); if (!($options = $database->loadObjectList())) { echo "MD " . $database->stderr(true); return; } poll_vote_form_html($poll, $options, $Itemid); } } } }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editCategory($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_archive_category'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for category $lists['componentid'] = mosAdminMenus::Category($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_archive_category_menu_html::editCategory($menu, $lists, $params, $option); }
function execute(&$controller, &$request) { $iso639 = strtolower(mosGetParam($_POST, 'iso639')); $iso3166 = mosGetParam($_POST, 'iso3166_2'); $iso3166_3 = mosGetParam($_POST, 'iso3166_3'); $lang = $iso639; $lang .= strlen($iso3166) == 2 ? '_' . $iso3166 : ''; $root = mamboCore::get('rootPath'); $langfile = $root . '/language/' . $lang . '.xml'; switch ($_POST['act']) { case 'language': if (file_exists($langfile)) { $this->updatelanguage($lang); } else { $this->createlanguage($iso639, $iso3166, $iso3166_3); } return $controller->redirect('index', 'language'); break; case 'catalogs': default: $this->updatecatalog(false); return $controller->redirect('index', 'catalogs'); break; } }
/** * function to sanitize input values from arrays * * This function provides a way to sanitize inputs, should be used to obtain values from * _POST, _GET, _COOKIES, etc; a default value can be passed to be used in case that not * values are founded to the element, a binary mask can be passed to discard some of test, *, this value is matched with _MOS_NOTRIM, _MOS_ALLOWHTML and, _MOS_ALLOWRAW, currently * 3 test are do it, trim, strip html and convert the value to numeric when is possible. * * Example of use: * * To get task variable from the URL and select the view like default task, you can use: * * <code>$task = mosGetParam ($_GET,"task","view");</code> * * To get task variable from the URL, select the view like default task, allows HTML and * without trim you can use : * * <code>$task = mosGetParam ($_GET,"task","view",_MOS_NOTRIM+_MOS_ALLOWHTML);</code> * * @acces public * @param array &$arr reference to array which contains the value * @param string $name name of element searched * @param mixed $def default value to use if nothing is founded * @param int $mask mask to select checks that will do it * @return mixed value from the selected element or default value if nothing was found */ function mosGetParam(&$arr, $name, $def = null, $mask = 0) { if (isset($arr[$name])) { if (is_array($arr[$name])) { foreach ($arr[$name] as $key => $element) { $result[$key] = mosGetParam($arr[$name], $key, $def, $mask); } } else { $result = $arr[$name]; if (!($mask & _MOS_NOTRIM)) { $result = trim($result); } if (!is_numeric($result)) { if (!($mask & _MOS_ALLOWHTML)) { $result = strip_tags($result); } if (!($mask & _MOS_ALLOWRAW)) { if (is_numeric($def)) { $result = intval($result); } } } if (!get_magic_quotes_gpc()) { $result = addslashes($result); } } return $result; } else { return $def; } }
function licenseDocumentForm(&$links, &$paths, &$data, $inline = 0) { $action = _taskLink('license_result', mosGetParam($_REQUEST, 'gid', 0), array('bid' => $data->id)); ob_start(); ?> <form action="<?php echo $action; ?> " method="POST" enctype="multipart/form-data"> <input type="hidden" name="inline" value="<?php echo $inline; ?> " /> <input type="radio" name="agree" value="0" checked /><?php echo _DML_DONT_AGREE; ?> <input type="radio" name="agree" value="1" /><?php echo _DML_AGREE; ?> <input name="submit" value="<?php echo _DML_PROCEED; ?> " type="submit" /> </form> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
function fetchMethodForm($uid, $step, $update = false) { global $task; switch ($step) { case 2: $lists = array(); $lists['action'] = _taskLink($task, $uid, array('step' => $step + 1), false); $lists['url'] = ''; $lists['localfile'] = ''; return HTML_DMUploadMethod::transferFileForm($lists); break; case 3: $url = stripslashes(mosGetParam($_REQUEST, 'url', 'http://')); $file = stripslashes(mosGetParam($_REQUEST, 'localfile', '')); $err = DMUploadMethod::transferFileProcess($uid, $step, $url, $file); if ($err['_error']) { _returnTo($task, $err['_errmsg'], '', array("method" => 'transfer', "step" => $step - 1, "localfile" => $file, "url" => DOCMAN_Utils::safeEncodeURL($url))); } $catid = $update ? 0 : $uid; $docid = $update ? $uid : 0; return fetchEditDocumentForm($docid, $file->name, $catid); break; default: break; } return true; }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ public static function editSection($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator"); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for section $lists['componentid'] = mosAdminMenus::Section($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_section_menu_html::editSection($menu, $lists, $params, $option); }
function sendMail() { global $database, $my, $acl, $adminLanguage; global $mosConfig_sitename, $mosConfig_debug; global $mosConfig_mailfrom, $mosConfig_fromname; $n = 0; $message_body = mosGetParam($_POST, 'mm_message', ''); $message_body = stripslashes($message_body); $subject = mosGetParam($_POST, 'mm_subject', ''); $gou = mosGetParam($_POST, 'mm_group', NULL); $recurse = mosGetParam($_POST, 'mm_recurse', 'NO_RECURSE'); if (!$message_body || !$subject || $gou === null) { mosRedirect("index2.php?option=com_massmail&mosmsg=" . $adminLanguage->A_COMP_MASS_FILL); } // get users in the group out of the acl $to = $acl->get_group_objects($gou, 'ARO', $recurse); $rows = array(); if (count($to['users']) || $gou === '0') { // Get sending email address $database->setQuery("SELECT email FROM #__users WHERE id='{$my->id}'"); $my->email = $database->loadResult(); // Get all users email and group except for senders $database->setQuery("SELECT email FROM #__users" . "\n WHERE id != '{$my->id}'" . ($gou !== '0' ? " AND id IN (" . implode(',', $to['users']) . ")" : "")); $rows = $database->loadObjectList(); // Build e-mail message format $message_header = sprintf(_MASSMAIL_MESSAGE, $mosConfig_sitename); $message = $message_header . $message_body; $subject = $mosConfig_sitename . ' / ' . stripslashes($subject); //Send email foreach ($rows as $row) { mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message); } } mosRedirect("index2.php", $adminLanguage->A_COMP_MASS_SENT . " " . count($rows) . " " . $adminLanguage->A_COMP_MASS_USERS); }
function fetchMethodForm($uid, $step, $update) { global $task; switch ($step) { case 2: $lists = array(); $lists['action'] = _taskLink($task, $uid, array('step' => $step + 1), false); return HTML_DMUploadMethod::uploadFileForm($lists); break; case 3: //upload file //$file = mosGetParam(DOCMAN_Utils::stripslashes($_FILES), 'upload'); $file_upload = mosGetParam($_FILES, 'upload'); $err = DMUploadMethod::uploadFileProcess($uid, $step, $file); if ($err['_error']) { _returnTo($task, $err['_errmsg'], '', array('step' => $step - 1, 'method' => 'http')); } $catid = $update ? 0 : $uid; $docid = $update ? $uid : 0; return fetchEditDocumentForm($docid, $file->name, $catid); break; default: break; } return true; }
function saveMenu($option) { global $database; $params = mosGetParam($_POST, 'params', ''); $params[url] = mosGetParam($_POST, 'url', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = implode("\n", $txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype='{$row->menutype}' AND parent='{$row->parent}'"); mosRedirect("index2.php?option={$option}&menutype={$row->menutype}"); }
function prepare($field_name) { $this->is_prepared = 0; $bbfile = mosGetParam($_FILES, $field_name, null); if (!extension_loaded('zlib')) { return "Error! zlib library unavailable"; } if (!$bbfile) { return _JLMS_EM_SELECT_FILE; } $bbfile_name = $bbfile['name']; if (empty($bbfile_name)) { return _JLMS_EM_SELECT_FILE; } if (strcmp(substr($bbfile_name, -4, 1), ".")) { return _JLMS_EM_BAD_FILEEXT; } if (strcmp(substr($bbfile_name, -4), ".zip")) { return _JLMS_EM_BAD_FILEEXT; } $tmp_name = $bbfile['tmp_name']; if (!file_exists($tmp_name)) { return _JLMS_EM_UPLOAD_SIZE_ERROR; } else { #$this->$bb_filelocation = $tmp_name; } if (preg_match("/.zip\$/", strtolower($bbfile_name))) { $zipFile = new pclZip($tmp_name); $zipContentArray = $zipFile->listContent(); $exp_xml_file = false; foreach ($zipContentArray as $thisContent) { if (preg_match('~.(php.*|phtml)$~i', $thisContent['filename'])) { return _JLMS_EM_READ_PACKAGE_ERROR; } if ($thisContent['filename'] == 'imsmanifest.xml') { $exp_xml_file = true; } } if ($exp_xml_file == false) { return "Could not find a Course XML setup file in the package."; } } else { return _JLMS_EM_BAD_FILEEXT; } $config =& JFactory::getConfig(); $tmp_dest = $config->getValue('config.tmp_path') . DS . $bbfile['name']; $tmp_src = $bbfile['tmp_name']; // Move uploaded file jimport('joomla.filesystem.file'); $uploaded = JFile::upload($tmp_src, $tmp_dest); if ($uploaded) { $this->bb_file_media_name = ''; $this->bb_file_tmp_name = $tmp_dest; $this->is_prepared = 1; return ''; } else { return 'File not found'; } }
/** * Gets a parameter value from the $_REQUEST object * * @param string $paramName The parameter name * @param string $defaultValue The default value (null if not specified) * @return mixed The parameter value */ function getParam($paramName, $defaultValue = null) { if (!defined('_JEXEC')) { return mosGetParam($_REQUEST, $paramName, $defaultValue); } else { return JRequest::getVar($paramName, $defaultValue); } }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('The module {$menu->title} is currently being edited by another administrator'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'content_typed'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('id=', $menu->link); $query = "SELECT a.title, a.title_alias" . "\n FROM #__content AS a" . "\n WHERE a.id = '" . $temp[1] . "'"; $database->setQuery($query); $content = $database->loadObjectlist(); // outputs item name, category & section instead of the select list if ($content[0]->title_alias) { $alias = ' (<i>' . $content[0]->title_alias . '</i>)'; } else { $alias = ''; } $lists['content'] = '<input type="hidden" name="content_typed" value="' . $temp[1] . '" />' . $content[0]->title . $alias; $contents = ''; } else { $query = "SELECT a.id AS value, CONCAT( a.title, '(', a.title_alias, ')' ) AS text" . "\n FROM #__content AS a" . "\n WHERE a.state = '1'" . "\n AND a.sectionid = '0'" . "\n AND a.catid = '0'" . "\n ORDER BY a.id, a.title"; $database->setQuery($query); $contents = $database->loadObjectList(); // Create a list of links $lists['content'] = mosHTML::selectList($contents, 'content_typed', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'component'); content_menu_html::edit($menu, $lists, $params, $option, $contents); }
/** * Set the information to allow a session to persist */ function persist() { global $mainframe; $usercookie = mosGetParam($_COOKIE, 'usercookie', null); if ($usercookie) { // Remember me cookie exists. Login with usercookie info. $mainframe->login($usercookie['username'], $usercookie['password']); } }
function pollAddVote($uid) { global $database, $mosConfig_offset, $Itemid; /* $params = new stdClass(); if ( $Itemid ) { $component = new mosComponent( $database ); $component->load( $Itemid ); $params =& new mosParameters( $component->params ); $params->set( 'redirect', 1 ); $redirect = $params->get( 'redirect' ); } */ $redirect = 1; $sessioncookie = mosGetParam($_REQUEST, 'sessioncookie', ''); if (!$sessioncookie) { echo '<h3>' . _ALERT_ENABLED . '"</h3>'; echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">'; return; } $poll = new mosPoll($database); if (!$poll->load($uid)) { echo '<h3>' . _NOT_AUTH . '</h3>'; echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">'; return; } $cookiename = "voted{$poll->id}"; $voted = mosGetParam($_COOKIE, $cookiename, '0'); //if ($voted) { // echo "<h3>"._ALREADY_VOTE."</h3>"; // echo "<input class=\"button\" type=\"button\" value=\""._CMN_CONTINUE."\" onClick=\"window.history.go(-1);\">"; // return; //} $voteid = mosGetParam($_POST, 'voteid', 0); if (!$voteid) { echo "<h3>" . _NO_SELECTION . "</h3>"; echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">'; return; } setcookie($cookiename, '1', time() + $poll->lag); $database->setQuery("UPDATE #__poll_data SET hits=hits + 1" . "\n WHERE pollid='{$poll->id}' AND id='{$voteid}'"); $database->query(); $database->setQuery("UPDATE #__polls SET voters=voters + 1" . "\n WHERE id='{$poll->id}'"); $database->query(); $now = date("Y-m-d G:i:s"); $database->setQuery("INSERT INTO #__poll_date SET date='{$now}', vote_id='{$voteid}',\tpoll_id='{$poll->id}'"); $database->query(); if ($redirect) { mosRedirect(sefRelToAbs('index.php?option=com_poll&task=results&id=' . $uid), _THANKS); } else { echo '<h3>' . _THANKS . '</h3>'; echo '<form action="" method="GET">'; echo '<input class="button" type="button" value="' . _BUTTON_RESULTS . '" onClick="window.location=\'' . sefRelToAbs('index.php?option=com_poll&task=results&id=' . $uid) . '\'">'; echo '</form>'; } }
function ALD_process_toolbar() { $page = mosGetParam($_REQUEST, 'page', ''); switch ($page) { case 'save_config': default: ALD_toolbar::_DEFAULT(); break; } }
function execute(&$controller, &$request) { $langpath = mamboCore::get('rootPath') . '/language/'; if ($_POST['lang'] && $_POST['lang'] != 'en') { $language =& new mamboLanguage($_POST['lang']); @unlink($langpath . 'glossary/' . $_POST['lang'] . '.' . $language->charset . '.po'); @unlink($langpath . $_POST['lang'] . '.xml'); $this->rmdir($langpath . $_POST['lang']); } $controller->redirect('index', mosGetParam($_REQUEST, 'act', 'language')); }
function redirect($id) { global $database; $menu = new mosMenu($database); $menu->bind($_POST); $menuid = mosGetParam($_POST, 'menuid', 0); if ($menuid) { $menu->id = $menuid; } $menu->checkin(); mosRedirect('index2.php?option=com_typedcontent&task=edit&id=' . $id); }
function licenseDocumentProcess($uid) { // this needs to use REQUEST , so onBeforeDownload plugins can use redirect $accepted = mosGetParam($_REQUEST, 'agree', 0); $inline = mosGetParam($_REQUEST, 'inline', 0); $doc = new DOCMAN_Document($uid); if ($accepted) { download($doc, $inline); } else { _returnTo('view_cat', _DML_YOU_MUST, $doc->getData('catid')); } }
function mosToolbar() { if ($this->act = mosGetParam($_REQUEST, 'act', 'containers')) { } else { $this->act = 'containers'; } if ($this->task = mosGetParam($_REQUEST, 'task', 'list')) { } else { $this->task = 'list'; } $this->makeBar(); }
function pollAddVote($uid) { global $database; // simple spoof check security josSpoofCheck(0, 'poll'); $redirect = 1; $sessionCookieName = mosMainFrame::sessionCookieName(); $sessioncookie = mosGetParam($_REQUEST, $sessionCookieName, ''); if (!$sessioncookie) { echo '<h3>' . _ALERT_ENABLED . '</h3>'; echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">'; return; } $poll = new mosPoll($database); if (!$poll->load((int) $uid)) { echo '<h3>' . _NOT_AUTH . '</h3>'; echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">'; return; } $cookiename = "voted{$poll->id}"; $voted = mosGetParam($_COOKIE, $cookiename, '0'); if ($voted) { echo "<h3>" . _ALREADY_VOTE . "</h3>"; echo "<input class=\"button\" type=\"button\" value=\"" . _CMN_CONTINUE . "\" onClick=\"window.history.go(-1);\">"; return; } $voteid = intval(mosGetParam($_POST, 'voteid', 0)); if (!$voteid) { echo "<h3>" . _NO_SELECTION . "</h3>"; echo '<input class="button" type="button" value="' . _CMN_CONTINUE . '" onClick="window.history.go(-1);">'; return; } setcookie($cookiename, '1', time() + $poll->lag); $query = "UPDATE #__poll_data" . "\n SET hits = hits + 1" . "\n WHERE pollid = " . (int) $poll->id . "\n AND id = " . (int) $voteid; $database->setQuery($query); $database->query(); $query = "UPDATE #__polls" . "\n SET voters = voters + 1" . "\n WHERE id = " . (int) $poll->id; $database->setQuery($query); $database->query(); $now = _CURRENT_SERVER_TIME; $query = "INSERT INTO #__poll_date" . "\n SET date = " . $database->Quote($now) . ", vote_id = " . (int) $voteid . ", poll_id = " . (int) $poll->id; $database->setQuery($query); $database->query(); if ($redirect) { mosRedirect(sefRelToAbs('index.php?option=com_poll&task=results&id=' . $uid), _THANKS); } else { echo '<h3>' . _THANKS . '</h3>'; echo '<form action="" method="GET">'; echo '<input class="button" type="button" value="' . _BUTTON_RESULTS . '" onClick="window.location=\'' . sefRelToAbs('index.php?option=com_poll&task=results&id=' . $uid) . '\'">'; echo '</form>'; } }
function save() { global $my, $mainframe, $database, $option, $priTask, $subTask; global $WBG_CONFIG, $wbGalleryDB_cat, $wbGallery_admin; // Check Writeable if (!is_writable($wbGallery_admin . '/config.php')) { echo "<script> alert('Permission Denied for config.php'); window.history.go(-1); </script>\n"; exit; } // Save Old Configuration $bakFile = $wbGallery_admin . '/config_bak.' . date('Y-m-d') . '.php'; if (!file_exists($bakFile) && !copy($wbGallery_admin . '/config.php', $bakFile)) { echo "<script> alert('Failed to Create Backup Copy of Configuration {$bakFile}'); window.history.go(-1); </script>\n"; exit; } // Process Configuration Values $exLines = array(); $exLines[] = '<?php' . "\n"; $exLines[] = 'defined(\'_VALID_MOS\') or die(\'Restricted access\');' . "\n"; $exLines[] = '$WBG_CONFIG = new stdClass();'; $wbgConfig = mosGetParam($_REQUEST, 'wbgconf'); // Prepare Output & Count Active Types $img_types = 0; foreach ($wbgConfig as $k => $v) { $exLines[] = '$WBG_CONFIG->' . $k . " = '" . addslashes($v) . "';"; if (preg_match('/^save_/', $k) && (int) $v) { $img_types++; } } // Write New Configuration $fp = fopen($wbGallery_admin . '/config.php', 'w'); fwrite($fp, join("\n", $exLines)); fclose($fp); // If No Types Active, Flag Error and Force Return... if (!$img_types) { $subTask = 'error'; $errorMsg = 'No Image Types where set to Active!\\nAt Least (1) Type is Required, or else nothing will be stored when you try and add images!'; } // Redirect switch ($subTask) { case 'save': mosRedirect('index2.php?option=' . $option, 'Configuration Saved Successfully'); break; case 'error': echo "<script> alert('Error: {$errorMsg}'); document.location='index2.php?option={$option}&task=setup'; </script>\n"; exit; break; default: mosRedirect('index2.php?option=' . $option . '&task=setup', 'Configuration Saved Successfully'); break; } }