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 execute(&$controller, &$request) { $from_charset = $_POST['charset']; $to_charset = $_POST['newcharset']; $lang = $_POST['language']; $textdomain = mamboCore::get('rootPath') . "/language"; $language = new mamboLanguage($lang); $language->load(); $language->charset = $to_charset; $language->save(); $gettext_admin = new PHPGettextAdmin(); foreach ($language->files as $arr) { $gettext_admin->convert_charset($arr['domain'], $textdomain, $lang, $from_charset, $to_charset); $gettext_admin->message_format($arr['domain'], $textdomain, $lang); } #return $controller->redirect('index', 'language'); $request->set('task', 'edit'); $request->set('act', 'language'); $request->set('lang', $lang); $controller->view('edit'); # /*$admin = new PHPGettextAdmin(); $admin->convert_encoding($catalog, $from, $to); dump(iconv_get_encoding());*/ }
/** overloaded check function */ function check() { // filter malicious code $ignoreList = array('params'); $this->filter($ignoreList); // specific filters $callcheck = array('InputFilter', 'process'); if (!is_callable($callcheck)) { require_once mamboCore::get('mosConfig_absolute_path') . '/includes/phpInputFilter/class.inputfilter.php'; } // specific filters $iFilter =& new InputFilter(); if ($iFilter->badAttributeValue(array('href', $this->url))) { $this->_error = T_('Please provide a valid URL'); return false; } /** check for valid name */ if (trim($this->title) == '') { $this->_error = T_('Your web link must be given a title.'); return false; } if (!(eregi('http://', $this->url) || eregi('https://', $this->url) || eregi('ftp://', $this->url))) { $this->url = 'http://' . $this->url; } /** check for existing name */ $this->title = $this->_db->getEscaped($this->title); $this->catid = $this->_db->getEscaped($this->catid); $this->_db->setQuery("SELECT id FROM #__weblinks " . "\nWHERE title='{$this->title}' AND catid='{$this->catid}'"); $xid = intval($this->_db->loadResult()); if ($xid && $xid != intval($this->id)) { $this->_error = T_('There is already a web link that name, please try again.'); return false; } return true; }
function render(&$renderer, &$request) { $rows = array(); $languageDir = mamboCore::get('mosConfig_absolute_path') . "/language/"; $xmlFilesInDir = mosReadDirectory($languageDir, '.xml$'); $rowid = 0; foreach ($xmlFilesInDir as $xmlfile) { // Read the file to see if it's a valid template XML file $parser =& new mosXMLDescription($languageDir . $xmlfile); if ($parser->getType() != 'language') { continue; } $row = new StdClass(); $row->id = $rowid; $row->language = substr($xmlfile, 0, -4); $row->name = $parser->getName('language'); $row->creationdate = $parser->getCreationDate('language'); $row->author = $parser->getAuthor('language'); $row->copyright = $parser->getCopyright('language'); $row->authorEmail = $parser->getAuthorEmail('language'); $row->authorUrl = $parser->getAuthorUrl('language'); $row->version = $parser->getVersion('language'); $row->checked_out = 0; $row->mosname = strtolower(str_replace(" ", "_", $row->name)); $row->published = mamboCore::get('mosConfig_locale') == $row->language ? 1 : 0; $rows[] = $row; $rowid++; } $renderer->addvar('rows', $rows); $renderer->addvar('content', $renderer->fetch('table.tpl.php')); $renderer->display('form.tpl.php'); }
function editcatalog(&$renderer, &$request) { $lang = $request->get('lang'); $language = new mamboLanguage($lang); $domain = $request->get('domain'); $catalog = new PHPGettext_catalog($domain, mamboCore::get('rootPath') . "/language"); $catalog->setproperty('mode', _MODE_PO_); $catalog->setproperty('lang', $lang); $catalog->load(); $nplurals = 2; $_VERSION = new version(); if (strpos($catalog->headers['Last-Translator'], 'FULL NAME')) { $catalog->headers['Last-Translator'] = "Translation <*****@*****.**>"; } if (strpos($catalog->headers['Language-Team'], 'LANGUAGE')) { $catalog->headers['Language-Team'] = "Translation <*****@*****.**>"; } $catalog->headers['Project-Id-Version'] = $_VERSION->PRODUCT . ' ' . $_VERSION->RELEASE; $catalog->headers['Report-Msgid-Bugs-To'] = '*****@*****.**'; $catalog->headers['Plural-Forms'] = $language->plural_form['expression']; $catalog->headers['Content-Type'] = 'text/plain; charset=' . $language->charset; $renderer->addvar('header', sprintf(T_('Translate Catalog: %s [%s]'), $domain, $lang)); $renderer->addvar('nplurals', $language->plural_form['nplurals']); $renderer->addbyref('catalog', $catalog); $renderer->addvar('domain', $domain); $renderer->addvar('content', $renderer->fetch('editcatalog.tpl.php')); }
function authPlugin() { $my = mamboCore::get('currentUser'); $this->usertype = $my->usertype; $this->username = $my->username; $this->grp = $my->gid; $this->mainframe = mosMainFrame::getInstance(); }
function mamboLanguage($lang, $path = null) { $this->name = $lang; $this->path = $path; if (is_null($this->path)) { $this->path = mamboCore::get('rootPath') . '/language/'; } $this->load(); }
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 execute(&$controller, &$request) { $lang = $request->get('lang'); $language = new mamboLanguage($lang); //$language->load(true); $domain = $_POST['domain']; $textdomain = mamboCore::get('rootPath') . "/language"; $gettext_admin = new PHPGettextAdmin(true); $gettext_admin->compile($lang, $textdomain, $language->charset); $language->save(); return $controller->redirect('index', 'catalogs'); }
function render(&$renderer, &$request) { $lang = $request->get('lang'); $language =& new mamboLanguage($lang); $language->load(true); $session =& $request->session(); $col = isset($session['col']) ? $session['col'] : 'domain'; $asc = isset($session['asc']) ? $session['asc'] : 1; $order = array(); $files = $language->files; // search $search = $request->get('search'); if ($search !== '') { $ds = defined('DIRECTORY_SEPARATOR') ? DIRECTORY_SEPARATOR : '/'; $basePath = mamboCore::get('mosConfig_absolute_path'); $results = array(); foreach ($files as $file) { if ($file['filetype'] !== 'po') { continue; } $filename = preg_replace("/[\\/\\\\]+/", $ds, $basePath . $ds . $file['filename']); $content = file_get_contents($filename); $result = strpos($content, $search); if ($result !== false) { $results[] = $file; } } if (count($results) > 0) { $files = $results; } } // end search foreach ($files as $key => $row) { if ($row['filetype'] == 'po') { $catalogs[] = $row; } } // Obtain a list of columns foreach ($catalogs as $key => $row) { $order[$key] = $row[$col]; } array_multisort($order, $asc == 1 ? SORT_ASC : SORT_DESC, $catalogs); $renderer->addvar('col', $col); $renderer->addvar('asc', $asc); $renderer->addvar('rows', $catalogs); $renderer->addvar('header', sprintf(T_('Manage Translations: %s'), $lang)); $renderer->addvar('content', $renderer->fetch('catalogs.tpl.php')); $renderer->display('form.tpl.php'); }
function execute(&$controller, &$request) { $root = mamboCore::get('rootPath'); $live = mamboCore::get('mosConfig_live_site'); include $root . '/administrator/includes/pcl/pclzip.lib.php'; chdir($root); $lang = mosGetParam($_POST, 'lang', ''); $language = new mamboLanguage($lang); $language->load(true); $zipfile = "{$root}/media/MamboLanguage_{$lang}.zip"; $archive = new PclZip($zipfile); foreach ($language->files as $file) { $v_list = $archive->add($root . '/' . $file['filename'], PCLZIP_OPT_REMOVE_PATH, $root . 'language/'); if ($v_list == 0) { die("Error : " . $archive->errorInfo(true)); } } if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $UserAgent)) { $UserBrowser = "Opera"; } elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $UserAgent)) { $UserBrowser = "IE"; } else { $UserBrowser = ''; } $mime_type = 'application/x-zip'; $filename = "MamboLanguage_{$lang}.zip"; @ob_end_clean(); ob_start(); header('Content-Type: ' . $mime_type); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); if ($UserBrowser == 'IE') { header('Content-Disposition: inline; filename="' . $filename . '"'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } else { header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Pragma: no-cache'); } readfile($zipfile); ob_end_flush(); $fmanager =& mosFileManager::getInstance(); $fmanager->deleteFile($zipfile); exit(0); }
function execute(&$controller, &$request) { $lang = mosGetParam($_REQUEST, 'lang'); $root = mamboCore::get('rootPath'); $fp = fopen("../configuration.php", "r"); $config = ""; $session =& $request->session(); $langfile = $root . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR . $lang . '.xml'; $p = xml_parser_create(); xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($p, implode("", file($langfile)), $values); xml_parser_free($p); foreach ($values as $key => $value) { if ($value['tag'] == 'param') { $name = $value['attributes']['name']; $language[$name] = $value['attributes']['default']; } } while (!feof($fp)) { $buffer = fgets($fp, 4096); if (strstr($buffer, "\$mosConfig_locale =")) { $config .= "\$mosConfig_locale = '{$lang}';\n"; } elseif (strstr($buffer, "\$mosConfig_lang =")) { $locales = explode(",", $language['locale']); $config .= "\$mosConfig_lang = \"{$locales[3]}\";\n"; } else { $config .= $buffer; } } fclose($fp); if ($fp = fopen("../configuration.php", "w")) { fputs($fp, $config, strlen($config)); fclose($fp); $session['mosmsg'] = T_('Default Language succesfully updated!'); } else { $session['mosmsg'] = T_('Error! Make sure that configuration.php is writeable.'); } return $controller->redirect(); }
function language() { mosMenuBar::startTable(); if (!is_dir(mamboCore::get('rootPath') . '/language/untranslated') && $this->has_gettext) { mosMenuBar::customX('extract', 'query.png', 'query.png', T_('Scan Sources'), false); mosMenuBar::spacer(50); } mosMenuBar::custom('install', 'move.png', 'move_f2.png', T_('Install'), false); mosMenuBar::spacer(); mosMenuBar::custom('translate', 'edit.png', 'edit_f2.png', T_('Manage Translations'), true); mosMenuBar::spacer(); mosMenuBar::custom('export', 'upload.png', 'upload_f2.png', T_('Export')); mosMenuBar::spacer(); mosMenuBar::addNewX(); mosMenuBar::spacer(); mosMenuBar::editListX('edit'); mosMenuBar::spacer(); mosMenuBar::deleteList(); mosMenuBar::spacer(); #mosMenuBar::help( 'screen.languages.language' ); mosMenuBar::endTable(); }
/** * Constructor * Includes files needed for displaying tabs and sets cookie options * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes */ function mosTabs($useCookies) { $mosConfig_live_site = mamboCore::get('mosConfig_live_site'); echo "<link id=\"luna-tab-style-sheet\" type=\"text/css\" rel=\"stylesheet\" href=\"" . $mosConfig_live_site . "/includes/js/tabs/tabpane.css\" />"; echo "<script type=\"text/javascript\" src=\"" . $mosConfig_live_site . "/includes/js/tabs/tabpane.js\"></script>"; $this->useCookies = $useCookies; }
function saveMessage($option) { global $database, $mainframe, $my, $mosConfig_absolute_path; global $mosConfig_mailfrom, $mosConfig_fromname; require_once $mosConfig_absolute_path . "/includes/mambofunc.php"; $row = new mosMessage($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } require_once mamboCore::get('mosConfig_absolute_path') . '/includes/phpInputFilter/class.inputfilter.php'; $iFilter = new InputFilter(null, null, 1, 1); $row->subject = trim($iFilter->process($row->subject)); $row->message = trim($iFilter->process($row->message)); if (!$row->send()) { mosRedirect("index2.php?option=com_messages&mosmsg=" . $row->getError()); } $msg = $row->subject . ' - ' . $row->message; $sql = "SELECT a.id, a.name, a.email" . "\nFROM #__users AS a" . "\nWHERE a.sendEmail = '1'" . "\nAND a.id = '" . $row->user_id_to . "'"; $database->setQuery($sql); $rows = $database->loadObjectList(); if ($rows) { foreach ($rows as $row) { $recipient = $row->email; $subject = "New private message from " . $row->name; mosMail($mosConfig_mailfrom, $mosConfig_fromname, $recipient, $subject, $msg); } } mosRedirect("index2.php?option=com_messages"); }
function vcard() { $contact = new mosContact(); $contact->load($this->contact_id); $params = new mosParameters($contact->params); if (!$params->get('vcard')) { echo "<script>alert (\"" . T_('There are no vCards available for download.') . "\"); window.history.go(-1);</script>"; exit(0); } $name = explode(' ', $contact->name); $firstname = $name[0]; unset($name[0]); $last = count($name); if (isset($name[$last])) { $surname = $name[$last]; unset($name[$last]); } else { $surname = ''; } $middlename = trim(implode(' ', $name)); $v = new MambovCard(); $v->setPhoneNumber($contact->telephone, 'PREF;WORK;VOICE'); $v->setPhoneNumber($contact->fax, 'WORK;FAX'); $v->setName($surname, $firstname, $middlename, ''); $v->setAddress('', '', $contact->address, $contact->suburb, $contact->state, $contact->postcode, $contact->country, 'WORK;POSTAL'); $v->setEmail($contact->email_to); $v->setNote($contact->misc); $v->setURL(mamboCore::get('mosConfig_live_site'), 'WORK'); $v->setTitle($contact->con_position); $v->setOrg(mamboCore::get('mosConfig_sitename')); $filename = str_replace(' ', '_', $contact->name); $v->setFilename($filename); $output = $v->getVCard(mamboCore::get('mosConfig_sitename')); $filename = $v->getFileName(); // header info for page header('Content-Disposition: attachment; filename=' . $filename); header('Content-Length: ' . strlen($output)); header('Connection: close'); header('Content-Type: text/x-vCard; name=' . $filename); print $output; //mosRedirect('index.php'); }
/** * Loads all published modules from a specified position, a $style can be passed * to change the style of output * * @param string The position * @param int The style. 0=normal(default), 1=horiz, -1=no wrapper * @param bool TRUE when admin modules will loaded */ function mosLoadModules($position = 'left', $style = 0, $isAdmin = false) { $Itemid = mamboCore::get('Itemid'); $tp = mosGetParam($_GET, 'tp', 0); if ($tp) { echo '<div style="height:50px;background-color:#eee;margin:2px;padding:10px;border:1px solid #f00;color:#700;">'; echo $position; echo '</div>'; return; } $style = intval($style); $cache =& mosCache::getCache('com_content'); require_once mamboCore::get('mosConfig_absolute_path') . '/includes/frontend.html.php'; // check for buffered output if (!$this->_isBuffered) { $this->initModules($isAdmin); } if (isset($this->_modules[$position])) { $modules = $this->_modules[$position]; } else { $modules = array(); $style = 0; } if ($style == 1) { echo "<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n"; echo "<tr>\n"; } $prepend = $style == 1 ? "<td valign=\"top\">\n" : ''; $postpend = $style == 1 ? "</td>\n" : ''; $count = 1; foreach ($modules as $module) { $params =& new mosParameters($module->params); echo $prepend; if (substr("{$module->module}", 0, 4) == "mod_") { $modfunc = 'module2'; } else { $modfunc = 'module'; } if ($params->get('cache') == 1 and mamboCore::get('mosConfig_caching') == 1) { $cache->call("modules_html::{$modfunc}", $module, $params, $Itemid, $style, $this->_isBuffered); } else { modules_html::$modfunc($module, $params, $Itemid, $style, $count, $this->_isBuffered); } echo $postpend; $count++; } if ($style == 1) { echo "</tr>\n</table>\n"; } }
/** * Show the menu * @param string The current user type */ function show($usertype = '') { global $acl, $database; global $mosConfig_live_site, $mosConfig_enable_stats, $mosConfig_caching; // cache some acl checks $canConfig = $acl->acl_check('administration', 'config', 'users', $usertype); $manageTemplates = $acl->acl_check('administration', 'manage', 'users', $usertype, 'components', 'com_templates'); $manageTrash = $acl->acl_check('administration', 'manage', 'users', $usertype, 'components', 'com_trash'); $manageMenuMan = $acl->acl_check('administration', 'manage', 'users', $usertype, 'components', 'com_menumanager'); $manageLanguages = $acl->acl_check('administration', 'manage', 'users', $usertype, 'components', 'com_languages'); $installModules = $acl->acl_check('administration', 'install', 'users', $usertype, 'modules', 'all'); $editAllModules = $acl->acl_check('administration', 'edit', 'users', $usertype, 'modules', 'all'); $installMambots = $acl->acl_check('administration', 'install', 'users', $usertype, 'mambots', 'all'); $editAllMambots = $acl->acl_check('administration', 'edit', 'users', $usertype, 'mambots', 'all'); $installComponents = $acl->acl_check('administration', 'install', 'users', $usertype, 'components', 'all'); $editAllComponents = $acl->acl_check('administration', 'edit', 'users', $usertype, 'components', 'all'); $canMassMail = $acl->acl_check('administration', 'manage', 'users', $usertype, 'components', 'com_massmail'); $canManageUsers = $acl->acl_check('administration', 'manage', 'users', $usertype, 'components', 'com_users'); $query = "SELECT a.id, a.title, a.name," . "\nCOUNT(DISTINCT c.id) AS numcat, COUNT(DISTINCT b.id) AS numarc" . "\n FROM #__sections AS a" . "\n LEFT JOIN #__categories AS c ON c.section=a.id" . "\n LEFT JOIN #__content AS b ON b.sectionid=a.id AND b.state=-1" . "\n WHERE a.scope='content'" . "\n GROUP BY a.id" . "\n ORDER BY a.ordering"; $database->setQuery($query); $sections = $database->loadObjectList(); $nonemptySections = 0; if ($sections) { foreach ($sections as $section) { if ($section->numcat > 0) { $nonemptySections++; } } } $menuTypes = mosAdminMenus::menutypes(); ?> <div id="myMenuID"></div> <script language="JavaScript" type="text/javascript"> var myMenu = [ <?php // Home Sub-Menu ?> [null,'<?php echo T_('Home'); ?> ','index2.php',null,'<?php echo T_('Control Panel'); ?> '], _cmSplit, <?php // Site Sub-Menu ?> [null,'<?php echo T_('Site'); ?> ',null,null,'<?php echo T_('Site Management'); ?> ', <?php if ($canConfig) { ?> ['<img src="../includes/js/ThemeOffice/config.png" />','<?php echo T_('Global Configuration'); ?> ','index2.php?option=com_config&hidemainmenu=1',null,'<?php echo T_('Configuration'); ?> '], <?php } if ($manageLanguages) { ?> ['<img src="../includes/js/ThemeOffice/language.png" />','<?php echo T_('Language Manager'); ?> ','index2.php?option=com_languages',null,'<?php echo T_('Manage languages'); ?> '], <?php } ?> ['<img src="../includes/js/ThemeOffice/media.png" />','<?php echo T_('Media Manager'); ?> ','index2.php?option=com_media',null,'<?php echo T_('Manage Media Files'); ?> '], ['<img src="../includes/js/ThemeOffice/preview.png" />', '<?php echo T_('Preview'); ?> ', null, null, '<?php echo T_('Preview'); ?> ', ['<img src="../includes/js/ThemeOffice/preview.png" />','<?php echo T_('In New Window'); ?> ','<?php echo $mosConfig_live_site; ?> /index.php','_blank','<?php echo $mosConfig_live_site; ?> '], ['<img src="../includes/js/ThemeOffice/preview.png" />','<?php echo T_('Inline'); ?> ','index2.php?option=com_admin&task=preview',null,'<?php echo $mosConfig_live_site; ?> '], ['<img src="../includes/js/ThemeOffice/preview.png" />','<?php echo T_('Inline with Positions'); ?> ','index2.php?option=com_admin&task=preview2',null,'<?php echo $mosConfig_live_site; ?> '], ], ['<img src="../includes/js/ThemeOffice/globe1.png" />', '<?php echo T_('Statistics'); ?> ', null, null, '<?php echo T_('Site Statistics'); ?> ', <?php if ($mosConfig_enable_stats == 1) { ?> ['<img src="../includes/js/ThemeOffice/globe4.png" />', '<?php echo T_('Browser, OS, Domain'); ?> ', 'index2.php?option=com_statistics', null, '<?php echo T_('Browser, OS, Domain'); ?> '], ['<img src="../includes/js/ThemeOffice/globe3.png" />', '<?php echo T_('Page Impressions'); ?> ', 'index2.php?option=com_statistics&task=pageimp', null, '<?php echo T_('Page Impressions'); ?> '], <?php } ?> ['<img src="../includes/js/ThemeOffice/search_text.png" />', '<?php echo T_('Search Text'); ?> ', 'index2.php?option=com_statistics&task=searches', null, '<?php echo T_('Search Text'); ?> '] ], <?php if ($manageTemplates) { ?> ['<img src="../includes/js/ThemeOffice/template.png" />','<?php echo T_('Template Manager'); ?> ',null,null,'<?php echo T_('Change site template'); ?> ', ['<img src="../includes/js/ThemeOffice/template.png" />','<?php echo T_('Site Templates'); ?> ','index2.php?option=com_templates',null,'<?php echo T_('Change site template'); ?> '], ['<img src="../includes/js/ThemeOffice/template.png" />','<?php echo T_('Administrator Templates'); ?> ','index2.php?option=com_templates&client=admin',null,'<?php echo T_('Change admin template'); ?> '], ['<img src="../includes/js/ThemeOffice/template.png" />','<?php echo T_('Module Positions'); ?> ','index2.php?option=com_templates&task=positions',null,'<?php echo T_('Template positions'); ?> '] ], <?php } if ($manageTrash) { ?> ['<img src="../includes/js/ThemeOffice/trash.png" />','<?php echo T_('Trash Manager'); ?> ','index2.php?option=com_trash',null,'<?php echo T_('Manage Trash'); ?> '], <?php } if ($canManageUsers || $canMassMail) { ?> ['<img src="../includes/js/ThemeOffice/users.png" />','<?php echo T_('User Manager'); ?> ','index2.php?option=com_users&task=view',null,'<?php echo T_('Manage users'); ?> '], <?php } ?> ], <?php // Menu Sub-Menu ?> _cmSplit, [null,'<?php echo T_('Menu'); ?> ',null,null,'<?php echo T_('Menu Management'); ?> ', <?php if ($manageMenuMan) { ?> ['<img src="../includes/js/ThemeOffice/menus.png" />','<?php echo T_('Menu Manager'); ?> ','index2.php?option=com_menumanager',null,'<?php echo T_('Menu Manager'); ?> '], _cmSplit, <?php } foreach ($menuTypes as $menuType) { ?> ['<img src="../includes/js/ThemeOffice/menus.png" />','<?php echo $menuType; ?> ','index2.php?option=com_menus&menutype=<?php echo $menuType; ?> ',null,''], <?php } ?> ], _cmSplit, <?php // Content Sub-Menu ?> [null,'<?php echo T_('Content'); ?> ',null,null,'<?php echo T_('Content Management'); ?> ', <?php if (count($sections) > 0) { ?> ['<img src="../includes/js/ThemeOffice/edit.png" />','<?php echo T_('Content by Section'); ?> ',null,null,'<?php echo T_('Content Managers'); ?> ', <?php foreach ($sections as $section) { $txt = addslashes($section->title ? $section->title : $section->name); ?> ['<img src="../includes/js/ThemeOffice/document.png" />','<?php echo $txt; ?> ', null, null,'<?php echo $txt; ?> ', <?php if ($section->numcat) { ?> ['<img src="../includes/js/ThemeOffice/edit.png" />', '<?php echo $txt; ?> <?php echo T_('Items'); ?> ', 'index2.php?option=com_content§ionid=<?php echo $section->id; ?> ',null,null], <?php } ?> ['<img src="../includes/js/ThemeOffice/add_section.png" />', '<?php echo T_('Add/Edit'); ?> <?php echo $txt; ?> <?php echo T_('Categories'); ?> ', 'index2.php?option=com_categories§ion=<?php echo $section->id; ?> ',null, null], <?php if ($section->numarc) { ?> ['<img src="../includes/js/ThemeOffice/backup.png" />', '<?php echo $txt; ?> <?php echo T_('Archive'); ?> ', 'index2.php?option=com_content&task=showarchive§ionid=<?php echo $section->id; ?> ',null,null], <?php } ?> ], <?php } // foreach ?> ], _cmSplit, <?php } ?> ['<img src="../includes/js/ThemeOffice/edit.png" />','<?php echo T_('All Content Items'); ?> ','index2.php?option=com_content§ionid=0',null,'<?php echo T_('Manage Content Items'); ?> '], ['<img src="../includes/js/ThemeOffice/edit.png" />','<?php echo T_('Static Content Manager'); ?> ','index2.php?option=com_typedcontent',null,'<?php echo T_('Manage Typed Content Items'); ?> '], _cmSplit, ['<img src="../includes/js/ThemeOffice/add_section.png" />','<?php echo T_('Section Manager'); ?> ','index2.php?option=com_sections&scope=content',null,'<?php echo T_('Manage Content Sections'); ?> '], <?php if (count($sections) > 0) { ?> ['<img src="../includes/js/ThemeOffice/add_section.png" />','<?php echo T_('Category Manager'); ?> ','index2.php?option=com_categories§ion=content',null,'<?php echo T_('Manage Content Categories'); ?> '], <?php } ?> _cmSplit, ['<img src="../includes/js/ThemeOffice/home.png" />','<?php echo T_('Frontpage Manager'); ?> ','index2.php?option=com_frontpage',null,'<?php echo T_('Manage Frontpage Items'); ?> '], ['<img src="../includes/js/ThemeOffice/edit.png" />','<?php echo T_('Archive Manager'); ?> ','index2.php?option=com_content&task=showarchive§ionid=0',null,'<?php echo T_('Manage Archive Items'); ?> '], ], <?php // Components Sub-Menu if ($installComponents) { ?> _cmSplit, [null,'<?php echo T_('Components'); ?> ',null,null,'<?php echo T_('Component Management'); ?> ', ['<img src="../includes/js/ThemeOffice/install.png" />','<?php echo T_('Review/Uninstall'); ?> ','index2.php?option=com_installer&element=component',null,'<?php echo T_('Install/Uninstall components'); ?> '], _cmSplit, <?php $query = "SELECT * FROM #__components WHERE name <> 'frontpage' and name <> 'media manager' ORDER BY ordering,name"; $database->setQuery($query); $comps = $database->loadObjectList(); // component list $subs = array(); // sub menus // first pass to collect sub-menu items foreach ($comps as $row) { if ($row->parent) { if (!array_key_exists($row->parent, $subs)) { $subs[$row->parent] = array(); } $subs[$row->parent][] = $row; } } $topLevelLimit = 19; //You can get 19 top levels on a 800x600 Resolution $topLevelCount = 0; foreach ($comps as $row) { if ($editAllComponents | $acl->acl_check('administration', 'edit', 'users', $usertype, 'components', $row->option)) { if ($row->parent == 0 && (trim($row->admin_menu_link) || array_key_exists($row->id, $subs))) { $topLevelCount++; if ($topLevelCount > $topLevelLimit) { continue; } $name = addslashes($row->name); $alt = addslashes($row->admin_menu_alt); $link = $row->admin_menu_link ? "'index2.php?{$row->admin_menu_link}'" : "null"; echo "\t\t\t\t['<img src=\"../includes/{$row->admin_menu_img}\" />','{$name}',{$link},null,'{$alt}'"; if (array_key_exists($row->id, $subs)) { foreach ($subs[$row->id] as $sub) { echo ",\n"; $name = addslashes($sub->name); $alt = addslashes($sub->admin_menu_alt); $link = $sub->admin_menu_link ? "'index2.php?{$sub->admin_menu_link}'" : "null"; echo "\t\t\t\t\t['<img src=\"../includes/{$sub->admin_menu_img}\" />','{$name}',{$link},null,'{$alt}']"; } } echo "\n\t\t\t\t],\n"; } } } if ($topLevelLimit < $topLevelCount) { echo "\t\t\t\t['<img src=\"../includes/js/ThemeOffice/sections.png\" />','" . T_('More Components...') . "','index2.php?option=com_admin&task=listcomponents',null,'" . T_('More Components') . "'],\n"; } ?> ], <?php // Modules Sub-Menu if ($installModules | $editAllModules) { ?> _cmSplit, [null,'<?php echo T_('Modules'); ?> ',null,null,'<?php echo T_('Module Management'); ?> ', <?php if ($installModules) { ?> ['<img src="../includes/js/ThemeOffice/install.png" />', '<?php echo T_('Review/Uninstall'); ?> ', 'index2.php?option=com_installer&element=module', null, '<?php echo T_('Install custom modules'); ?> '], _cmSplit, <?php } if ($editAllModules) { ?> ['<img src="../includes/js/ThemeOffice/module.png" />', '<?php echo T_('Site Modules'); ?> ', "index2.php?option=com_modules", null, '<?php echo T_('Manage Site modules'); ?> '], ['<img src="../includes/js/ThemeOffice/module.png" />', '<?php echo T_('Administrator Modules'); ?> ', "index2.php?option=com_modules&client=admin", null, '<?php echo T_('Manage Administrator modules'); ?> '], <?php } ?> ], <?php } // if ($installModules | $editAllModules) } // if $installComponents // Mambots Sub-Menu if ($installMambots | $editAllMambots) { ?> _cmSplit, [null,'<?php echo T_('Mambots'); ?> ',null,null,'<?php echo T_('Mambot Management'); ?> ', <?php if ($installMambots) { ?> ['<img src="../includes/js/ThemeOffice/install.png" />', '<?php echo T_('Review/Uninstall'); ?> ', 'index2.php?option=com_installer&element=mambot', null, '<?php echo T_('Install custom mambot'); ?> '], _cmSplit, <?php } if ($editAllMambots) { ?> ['<img src="../includes/js/ThemeOffice/module.png" />', '<?php echo T_('Site Mambots'); ?> ', "index2.php?option=com_mambots", null, '<?php echo T_('Manage Site Mambots'); ?> '], <?php } ?> ], <?php } // Installer Sub-Menu if ($installModules) { ?> _cmSplit, [null,'<?php echo T_('Installers'); ?> ',null,null,'<?php echo T_('Installer List'); ?> ', ['<img src="../includes/js/ThemeOffice/install.png" />','<?php echo T_('Universal'); ?> ','index2.php?option=com_installer&element=universal&client=admin',null,'<?php echo T_('Install Any Plugin'); ?> '], <?php //this features uses simplexml which in not support pre php 5 if (phpversion() >= 5) { ?> ['<img src="../includes/js/ThemeOffice/install.png" />','<?php echo T_('Add-on Packages'); ?> ','index2.php?option=com_installer&task=addon&element=universal&client=admin',null,'<?php echo T_('Mambo Add-on Pakcages'); ?> '], <?php } ?> //Commenting out The Source option for now since it is not working... /* <?php if (ini_get('allow_url_fopen')) { ?> ['<img src="../includes/js/ThemeOffice/install.png" />','<?php echo T_('The Source'); ?> ','index2.php?option=com_installer&task=thesource&element=universal&client=admin',null,'<?php echo T_('Install from The Source'); ?> '], <?php } ?> */ ], <?php } // if ($installModules) // Messages Sub-Menu if ($canConfig) { ?> _cmSplit, [null,'<?php echo T_('Messages'); ?> ',null,null,'<?php echo T_('Messaging Management'); ?> ', ['<img src="../includes/js/ThemeOffice/messaging_inbox.png" />','<?php echo T_('Inbox'); ?> ','index2.php?option=com_messages',null,'<?php echo T_('Private Messages'); ?> '], ['<img src="../includes/js/ThemeOffice/messaging_config.png" />','<?php echo T_('Configuration'); ?> ','index2.php?option=com_messages&task=config&hidemainmenu=1',null,'<?php echo T_('Configuration'); ?> '] ], <?php // System Sub-Menu ?> _cmSplit, [null,'<?php echo T_('System'); ?> ',null,null,'<?php echo T_('System Management'); ?> ', <?php if ($canConfig) { ?> ['<img src="../includes/js/ThemeOffice/checkin.png" />', '<?php echo T_('Global Checkin'); ?> ', 'index2.php?option=com_checkin', null,'<?php echo T_('Check-in all checked-out items'); ?> '], ['<img src="../includes/js/ThemeOffice/sysinfo.png" />', '<?php echo T_('System Information'); ?> ', 'index2.php?option=com_admin&task=sysinfo', null, '<?php echo T_('View System Information'); ?> '], <?php //this features uses simplexml which in not support pre php 5 if (phpversion() >= 5) { ?> ['<img src="../includes/js/ThemeOffice/globe2.png" />', '<?php echo T_('Check for Updates'); ?> ', 'index2.php?option=com_admin&task=versioninfo', null, '<?php echo T_('Check for Updates'); ?> '], <?php } if ($mosConfig_caching) { ?> ['<img src="../includes/js/ThemeOffice/config.png" />','<?php echo T_('Clean Cache'); ?> ','index2.php?option=com_content&task=clean_cache',null,'<?php echo T_('Clean the content items cache'); ?> '], <?php } } ?> ], <?php } ?> _cmSplit, <?php // Help Sub-Menu if (file_exists(mamboCore::get('rootPath') . '/help/mambo.whatsnew.html')) { ?> [null,'<?php echo T_('Help'); ?> ','index2.php?option=com_admin&task=help',null,null]<?php } ?> ]; cmDraw ('myMenuID', myMenu, 'hbr', cmThemeOffice, 'ThemeOffice'); </script> <?php }
* as published by the Free Software Foundation; version 2 of the License. */ defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); ?> <script type="text/javascript"> function order(col, asc) { c = document.getElementById('col'); a = document.getElementById('asc'); c.value = col; a.value = asc; submitform('sort'); } </script> <script type="text/javascript" src="<?php echo mamboCore::get('mosConfig_live_site'); ?> /administrator/components/com_languages/languages.js"></script> <input type="hidden" id="col" name="col" value="" /> <input type="hidden" id="asc" name="asc" value="" /> <input type="hidden" id="catalogs" name="catalogs" value="1" /> <table width="100%"> <tr> <td width="100%"> </td> <td align="right"> <?php echo T_('Search:'); ?> </td> <td>
function mosInputFilter() { static $filter; if (!isset($filter)) { $filter = new InputFilter(); foreach (get_object_vars($filter) as $key => $value) { $this->{$key} = $value; } $filter = null; } $configuration =& mamboCore::getMamboCore(); $this->charset = $configuration->current_language->charset; // could handle this easier? }
function getItemid($id, $typed = 1, $link = 1, $bs = 1, $bc = 1, $gbs = 1) { $_Itemid = null; $menuhandler =& mosMenuHandler::getInstance(); if ($typed) { // Search for typed link $_Itemid = $menuhandler->getIDByTypeLink('content_typed', "index.php?option=com_content&task=view&id={$id}"); } if ($_Itemid == null and $link) { // Search for item link $_Itemid = $menuhandler->getIDByTypeLink('content_item_link', "index.php?option=com_content&task=view&id={$id}"); } $sectionid = $this->getSection($id); if ($_Itemid == null) { // Search in sections $_Itemid = $menuhandler->getIDByTypeCid('content_section', $sectionid); } if ($_Itemid == null) { // Search in sections $_Itemid = $menuhandler->getIDByTypeCid('content_blog_section', $sectionid); } if ($_Itemid == null) { // Search in sections $_Itemid = $menuhandler->getIDByTypeCid('content_blog_category', $sectionid); } if ($_Itemid == null and $gbs) { // Search in global blog section $_Itemid = $menuhandler->getIDByTypeCid('content_blog_section', 0); } /* if ($_Itemid == '') { // Search in global blog category $this->_db->setQuery( "SELECT id " ."\nFROM #__menu " ."\nWHERE type='content_blog_category' AND published='1' AND componentid=0" ); $_Itemid = $this->_db->loadResult(); } */ $catid = $this->getCategory($id); if ($_Itemid == null) { // Search in blog categories $_Itemid = $menuhandler->getIDByTypeCid('content_blog_category', $catid); } if ($_Itemid == null) { // Search in categories $_Itemid = $menuhandler->getIDByTypeCid('content_category', $catid); } if ($_Itemid == null) { // Search in main menu $menus = $menuhandler->getByParentOrder(0, 'mainmenu'); $home = $menus[0]; $_Itemid = $home->id; } if ($_Itemid) { return $_Itemid; } else { return mamboCore::get('Itemid'); } }
/** * @param object * @param object * @param int The menu item ID * @param int -1=show without wrapper and title, -2=x-mambo style */ function module2(&$module, &$params, $Itemid, $style = 0, $count = 0, $isBuffered = false) { global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_lang; global $mainframe, $database, $my; $mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path'); $m_handler =& mosModuleHandler::getInstance(); $isBuffered = $m_handler->get('_isBuffered'); $moduleclass_sfx = $params->get('moduleclass_sfx'); $number = ''; if ($count > 0) { $number = '<span>' . $count . '</span> '; } if ($style == -3) { // allows for rounded corners echo "\n<div class=\"module{$moduleclass_sfx}\"><div><div><div>"; if ($module->showtitle != 0) { echo "<h3>{$module->title}</h3>\n"; } if ($isBuffered) { echo $module->buffer; } else { include $mosConfig_absolute_path . '/modules/' . $module->module . '.php'; } if (isset($content)) { echo $content; } echo "\n\n</div></div></div></div>\n"; } else { if ($style == -2) { // headder and content encapsulated with div tag ?> <div class="moduletable<?php echo $moduleclass_sfx; ?> "> <?php if ($module->showtitle != 0) { ?> <h1><?php echo $module->title; ?> </h1> <?php } if ($isBuffered) { echo $module->buffer; } else { include $mosConfig_absolute_path . '/modules/' . $module->module . '.php'; } if (isset($content)) { echo $content; } ?> </div> <?php } else { if ($style == -1) { // show a naked module - no wrapper and no title if ($isBuffered) { if (isset($module->buffer)) { echo $module->buffer; } else { include $mosConfig_absolute_path . '/modules/' . $module->module . '.php'; } } else { include $mosConfig_absolute_path . '/modules/' . $module->module . '.php'; } if (isset($content)) { echo $content; } } else { ?> <table cellpadding="0" cellspacing="0" class="moduletable<?php echo $moduleclass_sfx; ?> "> <?php if ($module->showtitle != 0) { ?> <tr> <th valign="top"> <?php echo $module->title; ?> </th> </tr> <?php } ?> <tr> <td> <?php if ($isBuffered) { echo $module->buffer; } else { include $mosConfig_absolute_path . '/modules/' . $module->module . '.php'; } if (isset($content)) { echo $content; } ?> </td> </tr> </table> <?php } } } }
<?php /** * @package Mambo * @subpackage Content * @author Mambo Foundation Inc see README.php * @copyright Mambo Foundation Inc. * See COPYRIGHT.php for copyright notices and details. * @license GNU/GPL Version 2, see LICENSE.php * Mambo is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 of the License. */ /** ensure this file is being included by a parent file */ defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); $lang_path = mamboCore::get('rootPath') . '/language'; // code handling has been shifted into content.php require_once $mosConfig_absolute_path . '/components/com_content/content.php';
require_once $path; $configuration->doGzip(); } } else { $option = $configuration->determineOptionAndItemid(); $Itemid = $configuration->get('Itemid'); $mainframe =& new mosMainFrame($database, $option, '.'); if ($option == 'login') { $configuration->handleLogin(); } elseif ($option == 'logout') { $configuration->handleLogout(); } $session =& mosSession::getCurrent(); $my =& new mosUser(); $my->getSessionData(); mamboCore::set('currentUser', $my); $configuration->offlineCheck($my, $database); $gid = intval($my->gid); // gets template for page $cur_template = $mainframe->getTemplate(); require_once $configuration->rootPath() . '/includes/frontend.php'; require_once $configuration->rootPath() . '/includes/mambo.php'; require_once $configuration->rootPath() . '/includes/mambofunc.php'; require_once $configuration->rootPath() . '/includes/mamboHTML.php'; if ($indextype == 2 and $do_pdf == 1) { include_once 'includes/pdf.php'; exit; } /** detect first visit */ $mainframe->detect(); /** @global mosPlugin $_MAMBOTS */
/** * Compiles the help table of contents * @param string A specific keyword on which to filter the resulting list */ function getHelpTOC($helpsearch) { global $mosConfig_absolute_path; $helpurl = mosGetParam($GLOBALS, 'mosConfig_helpurl', ''); $helpurl = mamboCore::get('mosConfig_live_site'); $files = mosReadDirectory($mosConfig_absolute_path . '/help/', '\\.xml$|\\.html$'); $toc = array(); foreach ($files as $file) { $buffer = file_get_contents($mosConfig_absolute_path . '/help/' . $file); if (preg_match('#<title>(.*?)</title>#', $buffer, $m)) { $title = trim($m[1]); if ($title) { if ($helpurl) { // strip the extension #$file = preg_replace( '#\.xml$|\.html$#', '', $file ); } if ($helpsearch) { if (stripos(strip_tags($buffer), $helpsearch) !== false) { $toc[$file] = $title; } } else { $toc[$file] = $title; } } } } asort($toc); return $toc; }
break; case 3: $query = "SELECT a.id, a.title, a.sectionid, a.hits" . "\n FROM #__content AS a" . "\n WHERE ( a.state = '1' AND a.checked_out = '0' )" . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '" . $now . "' )" . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '" . $now . "' )" . ($access ? "\n AND a.access <= '" . $my->gid . "'" : '') . "\n ORDER BY a.hits DESC LIMIT {$count}"; $database->setQuery($query); $rows = $database->loadObjectList(); break; case 1: default: $query = "SELECT a.id, a.title, a.sectionid, a.catid, a.hits" . "\n FROM #__content AS a" . "\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id" . "\n WHERE ( a.state = '1' AND a.checked_out = '0' AND a.sectionid > '0' )" . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '" . $now . "' )" . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '" . $now . "' )" . ($access ? "\n AND a.access <= '" . $my->gid . "'" : '') . ($catid ? "\n AND ( a.catid IN (" . $catid . ") )" : '') . ($secid ? "\n AND ( a.sectionid IN (" . $secid . ") )" : '') . ($show_front == "0" ? "\n AND f.content_id IS NULL" : '') . "\n ORDER BY a.hits DESC LIMIT {$count}"; $database->setQuery($query); $rows = $database->loadObjectList(); break; } // needed to reduce queries used by getItemid for Content Items if ($type == 1 || $type == 3) { require_once mamboCore::get('mosConfig_absolute_path') . '/components/com_content/content.class.php'; $handler =& new contentHandler(); $bs = $handler->getBlogSectionCount(); $bc = $handler->getBlogCategoryCount(); $gbs = $handler->getGlobalBlogSectionCount(); } // Output ?> <ul class="mostread<?php echo $class_sfx; ?> "> <?php $menuhandler =& mosMenuHandler::getInstance(); if ($rows) { foreach ($rows as $row) {
$database->setQuery("DELETE FROM #__session WHERE session_id='" . $_SESSION['session_id'] . "'"); if (!$database->query()) { echo $database->stderr(); } } $name = ""; $fullname = ""; $id = ""; $session_id = ""; session_unregister("session_id"); session_unregister("session_user_id"); session_unregister("session_username"); session_unregister("session_usertype"); session_unregister("session_logintime"); if (session_is_registered("session_id")) { session_destroy(); } if (session_is_registered("session_user_id")) { session_destroy(); } if (session_is_registered("session_username")) { session_destroy(); } if (session_is_registered("session_usertype")) { session_destroy(); } if (session_is_registered("session_logintime")) { session_destroy(); } $configuration =& mamboCore::getMamboCore(); $configuration->redirect("../index.php");
// ----- Error configuration // 0 : PclZip Class integrated error handling // 1 : PclError external library error handling. By enabling this // you must ensure that you have included PclError library. // [2,...] : reserved for futur use define('PCLZIP_ERROR_EXTERNAL', 0); // ----- Optional static temporary directory // By default temporary files are generated in the script current // path. // If defined : // - MUST BE terminated by a '/'. // - MUST be a valid, already created directory // Samples : // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' ); // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' ); define('PCLZIP_TEMPORARY_DIR', mamboCore::get('rootPath') . '/media/'); // -------------------------------------------------------------------------------- // ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED ***** // -------------------------------------------------------------------------------- // ----- Global variables $g_pclzip_version = "2.5"; // ----- Error codes // -1 : Unable to open file in binary write mode // -2 : Unable to open file in binary read mode // -3 : Invalid parameters // -4 : File does not exist // -5 : Filename is too long (max. 255) // -6 : Not a valid zip file // -7 : Invalid extracted file size // -8 : Unable to create directory // -9 : Invalid archive extension
/** * Language uninstall method * @param int The id of the module * @param string The URL option * @param int The client id */ function language_uninstall($id, $option, $client = 0) { $id = str_replace(array('\\', '/'), '', $id); $basepath = mamboCore::get('mosConfig_absolute_path') . '/language/'; $xmlfile = $basepath . $id . '.xml'; // see if there is an xml install file, must be same name as element if (file_exists($xmlfile)) { $parser =& new mosUninstallXML($xmlfile); $parser->uninstall(); $ret = $parser->errors->getMaxLevel() < _MOS_ERROR_FATAL; HTML_installer::showInstallMessage($parser->errors->getErrors(), T_('Uninstall language - ') . ($ret ? T_('Success') : T_('Error')), returnTo($option, 'language', $client)); } else { $message = new mosError(T_('Language id empty, cannot remove files'), _MOS_ERROR_FATAL); HTML_installer::showInstallMessage($message, T_('Uninstall - error'), "index2.php?option=com_languages"); } exit; }
function mosIsRTL() { $core = mamboCore::getMamboCore(); if ($core->current_language->text_direction == "rtl") { return true; } else { return false; } }