public function GetOutput() { $yams = YAMS::GetInstance(); $YEM = YamsErrorMgr::GetInstance(); $YLM = YamsLangMgr::GetInstance(); // Load the module template $tpl = new Templator(); $success = $tpl->LoadTemplateFromFile('yams/module/yams.module.tpl.html'); if (!$success) { return; } if (YamsUtils::IsHTTPS()) { $protocol = 'https://'; } else { $protocol = 'http://'; } $requestURL = YamsUtils::Escape($protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); // Define the placholders $tpl->RegisterPlaceholder('form_action', '[+request_url+]'); $tpl->RegisterPlaceholder('error_messages', $YEM->GetOutput()); $tpl->RegisterPlaceholder('lang_chooser', $YLM->GetOutput()); // Parse non-language placeholders $tpl->Parse(NULL, true); $tpl->ClearStoredPlaceholders(); // Register global placeholders... $tpl->RegisterPlaceholder('request_url', $requestURL); $tpl->RegisterPlaceholder('modx_manager_theme', $modx->config['manager_theme']); $tpl->RegisterPlaceholder('modx_site_url', $modx->config['site_url']); $tpl->RegisterPlaceholder('modx_charset', $modx->config['modx_charset']); $tpl->RegisterPlaceholder('yams_contact_en_url', 'http://nashi.podzone.org/en/contact.xhtml'); $tpl->RegisterPlaceholder('yams_contact_fr_url', 'http://nashi.podzone.org/fr/contact.xhtml'); $tpl->RegisterPlaceholder('yams_contact_ja_url', 'http://nashi.podzone.org/ja/contact.xhtml'); $tpl->RegisterPlaceholder('yams_donate_en_url', 'http://nashi.podzone.org/en/donate.xhtml'); $tpl->RegisterPlaceholder('yams_donate_fr_url', 'http://nashi.podzone.org/fr/donate.xhtml'); $tpl->RegisterPlaceholder('yams_donate_ja_url', 'http://nashi.podzone.org/ja/donate.xhtml'); $tpl->RegisterPlaceholder('yams_package_url', 'http://modxcms.com/extras/package/?package=543'); $tpl->RegisterPlaceholder('yams_forums_url', 'http://modxcms.com/forums/index.php/board,381.0.html'); $tpl->RegisterPlaceholder('yams_author_url', 'http://modxcms.com/forums/index.php?action=profile;u=12570'); $tpl->RegisterPlaceholder('yams_author', '<a href="[+yams_author_url+]" target="_blank">PMS</a>'); $tpl->RegisterPlaceholder('yams_copyright', '<a href="http://nashi.podzone.org/" target="_blank">Nashi Power</a> 2009'); $tpl->RegisterPlaceholder('yams_licence', 'GPL v3'); $tpl->RegisterPlaceholder('yams_version', YamsUtils::Escape($yams->GetVersion())); // Parse language text... $YLM->ParseLanguageText($tpl); // Temporarily comment out this line so it's easy to find missing placeholders... // $tpl->RemovePlaceholdersFromTpl( NULL, true ); return $tpl->GetTpl(); }
private function GetHostName() { // Get the host name of the request... $hostName = $_SERVER['HTTP_HOST']; $stripPort = $_SERVER['SERVER_PORT'] != 80 && !YamsUtils::IsHTTPS(); if ($stripPort) { // Strip the port $hostName = preg_replace('/' . preg_quote(':' . $_SERVER['SERVER_PORT'], '/') . '/' . $this->itsUTF8Modifier, '', $hostName); } return $hostName; }
$data = array('tmplvarid' => $modx->db->escape($tvId), 'contentid' => $modx->db->escape($id), 'value' => $modx->db->escape($tvVal)); $success = $modx->db->insert($data, $modx->getFullTableName('site_tmplvar_contentvalues')); if ($success) { $errorText[] = 'Copied content from ' . $tv . ' field to newly created ' . YamsUtils::Escape($multiLangTV) . ' for document ' . $id . '.'; } else { $errorText[] = 'Failed to copy content from ' . $tv . ' field to newly created ' . YamsUtils::Escape($multiLangTV) . ' for document ' . $id . '.'; } } } } } } } } } if (!YamsUtils::IsHTTPS()) { $protocol = 'http://'; } else { $protocol = 'https://'; } $errorOutput = ''; // Define the placholders if (count($errorText) > 0) { foreach ($errorText as $index => $message) { $errorText[$index] = YamsUtils::Escape($message); } $errorOutput = '<p class="warning">' . implode('<br />', $errorText) . '</p>'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php