/** * Renders the footer * * @return string */ public function getDisplay() { $retval = ''; $this->_setHistory(); if ($this->_isEnabled) { if (!$this->_isAjax && !$this->_isMinimal) { // Link to itself to replicate windows including frameset if (!isset($GLOBALS['checked_special'])) { $GLOBALS['checked_special'] = false; } if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special'] && !$this->_isAjax) { $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME')); $url = PMA_generate_common_url($url_params, 'text', ''); $this->_scripts->addCode("\n // Store current location in hash part\n // of URL to allow direct bookmarking\n setURLHash('{$url}');\n "); $retval .= $this->_getSelfLink($url_params); } $retval .= $this->_getDebugMessage(); $retval .= $this->_getErrorMessages(); $retval .= $this->_scripts->getDisplay(); // Include possible custom footers if (file_exists(CUSTOM_FOOTER_FILE)) { ob_start(); include CUSTOM_FOOTER_FILE; $retval .= ob_get_contents(); ob_end_clean(); } } if (!$this->_isAjax) { $retval .= "</body></html>"; } } return $retval; }
protected static function parseBbcode($str, $special_code, $strip = true) { if (static::$_bbcode_parser === null) { $bbcode = new \StringParser_BBCode(); // add list of bbcode for formatting $codes = []; $codes[] = ['code', 'simple_replace', null, ['start_tag' => '<code>', 'end_tag' => '</code>'], 'code', ['block', 'inline'], []]; $codes[] = ['spoiler', 'simple_replace', null, ['start_tag' => '<span class="spoiler">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['sub', 'simple_replace', null, ['start_tag' => '<sub>', 'end_tag' => '</sub>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['sup', 'simple_replace', null, ['start_tag' => '<sup>', 'end_tag' => '</sup>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['b', 'simple_replace', null, ['start_tag' => '<b>', 'end_tag' => '</b>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['i', 'simple_replace', null, ['start_tag' => '<em>', 'end_tag' => '</em>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['m', 'simple_replace', null, ['start_tag' => '<tt class="code">', 'end_tag' => '</tt>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['o', 'simple_replace', null, ['start_tag' => '<span class="overline">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['s', 'simple_replace', null, ['start_tag' => '<span class="strikethrough">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['u', 'simple_replace', null, ['start_tag' => '<span class="underline">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']]; $codes[] = ['EXPERT', 'simple_replace', null, ['start_tag' => '<span class="expert">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']]; foreach ($codes as $code) { if ($strip) { $code[1] = 'callback_replace'; $code[2] = '\\Comment::stripUnusedBbcode'; // this also fixes pre/code } $bbcode->addCode($code[0], $code[1], $code[2], $code[3], $code[4], $code[5], $code[6]); } static::$_bbcode_parser = $bbcode; } // if $special == true, add special bbcode if ($special_code === true) { static::$_bbcode_parser->addCode('moot', 'simple_replace', null, ['start_tag' => '', 'end_tag' => ''], 'inline', ['block', 'inline'], []); static::$_bbcode_parser->addCode('fortune', 'usecontent?', '\\Comment::parseBbcodeAttr', ['usecontent_param' => 'color'], 'inline', ['block', 'inline'], []); } return static::$_bbcode_parser->parse($str); }
function tagend_extension_code($attr, $data) { $err = $this->checkAttributes($attr, array("role", "position")); if (PEAR::isError($err)) { return $err; } $role = isset($attr["role"]) ? $attr["role"] : "code"; $position = isset($attr["position"]) ? $attr["position"] : "bottom"; if (isset($attr["src"])) { return $this->extension->addCode($role, $position, CodeGen_Tools_Indent::linetrim(file_get_contents($attr["src"]))); } else { return $this->extension->addCode($role, $position, CodeGen_Tools_Indent::linetrim($data)); } }
/** * Loads common scripts * * @return void */ private function _addDefaultScripts() { // Localised strings $params = array('lang' => $GLOBALS['lang']); if (isset($GLOBALS['db'])) { $params['db'] = $GLOBALS['db']; } $this->_scripts->addFile('jquery/jquery-1.8.3.min.js'); $this->_scripts->addFile('whitelist.php' . PMA_URL_getCommon($params), false, true); $this->_scripts->addFile('ajax.js'); $this->_scripts->addFile('keyhandler.js'); $this->_scripts->addFile('jquery/jquery-ui-1.9.2.custom.min.js'); $this->_scripts->addFile('jquery/jquery.sprintf.js'); $this->_scripts->addFile('jquery/jquery.cookie.js'); $this->_scripts->addFile('jquery/jquery.mousewheel.js'); $this->_scripts->addFile('jquery/jquery.event.drag-2.2.js'); $this->_scripts->addFile('jquery/jquery-ui-timepicker-addon.js'); $this->_scripts->addFile('jquery/jquery.ba-hashchange-1.3.js'); $this->_scripts->addFile('jquery/jquery.debounce-1.0.5.js'); $this->_scripts->addFile('jquery/jquery.menuResizer-1.0.js'); // Cross-framing protection if ($GLOBALS['cfg']['AllowThirdPartyFraming'] === false) { $this->_scripts->addFile('cross_framing_protection.js'); } $this->_scripts->addFile('rte.js'); if ($GLOBALS['cfg']['SendErrorReports'] !== 'never') { $this->_scripts->addFile('tracekit/tracekit.js'); $this->_scripts->addFile('error_report.js'); } // Here would not be a good place to add CodeMirror because // the user preferences have not been merged at this point $this->_scripts->addFile('messages.php' . PMA_URL_getCommon($params)); // Append the theme id to this url to invalidate // the cache on a theme change. Though this might be // unavailable for fatal errors. if (isset($_SESSION['PMA_Theme'])) { $theme_id = urlencode($_SESSION['PMA_Theme']->getId()); } else { $theme_id = 'default'; } $this->_scripts->addFile('get_image.js.php?theme=' . $theme_id); $this->_scripts->addFile('doclinks.js'); $this->_scripts->addFile('functions.js'); $this->_scripts->addFile('navigation.js'); $this->_scripts->addFile('indexes.js'); $this->_scripts->addFile('common.js'); $this->_scripts->addCode($this->getJsParamsCode()); }
/** * Renders the footer * * @return string */ public function getDisplay() { $retval = ''; $this->_setHistory(); if ($this->_isEnabled) { if (!$this->_isAjax) { $retval .= "</div>"; } if (!$this->_isAjax && !$this->_isMinimal) { if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && empty($GLOBALS['checked_special']) && !$this->_isAjax) { $url = $this->getSelfUrl('unencoded'); $header = PMA_Response::getInstance()->getHeader(); $scripts = $header->getScripts()->getFiles(); $menuHash = $header->getMenu()->getHash(); // prime the client-side cache $this->_scripts->addCode(sprintf('AJAX.cache.primer = {' . ' url: "%s",' . ' scripts: %s,' . ' menuHash: "%s"' . '};', PMA_escapeJsString($url), json_encode($scripts), PMA_escapeJsString($menuHash))); $url = $this->getSelfUrl(); $retval .= $this->_getSelfLink($url); } $retval .= $this->_getDebugMessage(); $retval .= $this->getErrorMessages(); $retval .= $this->_scripts->getDisplay(); if ($GLOBALS['cfg']['DBG']['demo']) { $retval .= '<div id="pma_demo">'; $retval .= $this->_getDemoMessage(); $retval .= '</div>'; } // Include possible custom footers if (file_exists(CUSTOM_FOOTER_FILE)) { $retval .= '<div id="pma_footer">'; ob_start(); include CUSTOM_FOOTER_FILE; $retval .= ob_get_contents(); ob_end_clean(); $retval .= '</div>'; } } if (!$this->_isAjax) { $retval .= "</body></html>"; } } return $retval; }
/** * Generates the header * * @return string The header */ public function getDisplay() { $retval = ''; if (!$this->_headerIsSent) { if (!$this->_isAjax && $this->_isEnabled) { $this->sendHttpHeaders(); $retval .= $this->_getHtmlStart(); $retval .= $this->_getMetaTags(); $retval .= $this->_getLinkTags(); $retval .= $this->_getTitleTag(); $title = PMA_sanitize(PMA_escapeJsString($this->_getPageTitle()), false, true); $this->_scripts->addCode("if (typeof(parent.document) != 'undefined'" . " && typeof(parent.document) != 'unknown'" . " && typeof(parent.document.title) == 'string')" . "{" . "parent.document.title = '{$title}'" . "}"); if ($this->_userprefsOfferImport) { $this->_scripts->addFile('config.js'); } $retval .= $this->_scripts->getDisplay(); $retval .= $this->_getBodyStart(); // Include possible custom headers if (file_exists(CUSTOM_HEADER_FILE)) { ob_start(); include CUSTOM_HEADER_FILE; $retval .= ob_get_contents(); ob_end_clean(); } // offer to load user preferences from localStorage if ($this->_userprefsOfferImport) { include_once './libraries/user_preferences.lib.php'; $retval .= PMA_userprefsAutoloadGetHeader(); } // pass configuration for hint tooltip display // (to be used by PMA_createqTip in js/functions.js) if (!$GLOBALS['cfg']['ShowHint']) { $retval .= '<span id="no_hint" class="hide"></span>'; } $retval .= $this->_getWarnings(); if ($this->_menuEnabled && $GLOBALS['server'] > 0) { $retval .= $this->_menu->getDisplay(); } $retval .= $this->_addRecentTable($GLOBALS['db'], $GLOBALS['table']); } } return $retval; }
/** * Loads common scripts * * @return void */ private function _addDefaultScripts() { $this->_scripts->addFile('jquery/jquery-1.8.3.js'); $this->_scripts->addFile('ajax.js'); $this->_scripts->addFile('keyhandler.js'); $this->_scripts->addFile('jquery/jquery-ui-1.9.2.custom.js'); $this->_scripts->addFile('jquery/jquery.sprintf.js'); $this->_scripts->addFile('jquery/jquery.cookie.js'); $this->_scripts->addFile('jquery/jquery.mousewheel.js'); $this->_scripts->addFile('jquery/jquery.event.drag-2.2.js'); $this->_scripts->addFile('jquery/jquery-ui-timepicker-addon.js'); $this->_scripts->addFile('jquery/jquery.ba-hashchange-1.3.js'); $this->_scripts->addFile('jquery/jquery.debounce-1.0.5.js'); $this->_scripts->addFile('jquery/jquery.menuResizer-1.0.js'); $this->_scripts->addFile('rte.js'); // Here would not be a good place to add CodeMirror because // the user preferences have not been merged at this point // Localised strings $params = array('lang' => $GLOBALS['lang']); if (isset($GLOBALS['db'])) { $params['db'] = $GLOBALS['db']; } $this->_scripts->addFile('messages.php' . PMA_generate_common_url($params)); // Append the theme id to this url to invalidate // the cache on a theme change. Though this might be // unavailable for fatal errors. if (isset($_SESSION['PMA_Theme'])) { $theme_id = urlencode($_SESSION['PMA_Theme']->getId()); } else { $theme_id = 'default'; } $this->_scripts->addFile('get_image.js.php?theme=' . $theme_id); $this->_scripts->addFile('functions.js'); $this->_scripts->addFile('navigation.js'); $this->_scripts->addFile('indexes.js'); $this->_scripts->addFile('common.js'); $this->_scripts->addCode($this->getJsParamsCode()); }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of \Models\Client (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setClientId($this->getClientId()); $copyObj->setClientSecret($this->getClientSecret()); $copyObj->setGrantTypes($this->getGrantTypes()); $copyObj->setRedirectUri($this->getRedirectUri()); $copyObj->setScope($this->getScope()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getTokens() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addToken($relObj->copy($deepCopy)); } } foreach ($this->getCodes() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCode($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * Outputs data * * @access public * @param mixed $asset The asset * @param string $group Group * @param bool $default If the group should be the default __{$asset}__ only * @return void */ public function output($asset = null, $group = null, $default = false, $just_link = false) { $this->super->benchmark->mark("assets::output(" . $asset . "/" . $group . ")_start"); $output = ''; $files = array(); $file_names = array(); if (is_null($asset)) { return; } // Override $group if ($default == true) { $group = $this->default_group[$asset]; } // All files? if (is_null($group)) { if (isset($this->queue[$asset])) { foreach ($this->queue[$asset] as $group => $details) { $output .= $this->output($asset, $group, $default, $just_link); } return $output; } } else { if (!isset($this->outputted)) { $this->outputted = array(); } if (!isset($this->outputted[$asset])) { $this->outputted[$asset] = array(); } if (in_array($group, $this->outputted[$asset])) { //return; } else { if (isset($this->queue[$asset][$group])) { $files = $this->queue[$asset][$group]; $this->outputted[$asset][] = $group; } else { return; } } } if (empty($files)) { return; } $file_names = array(); // Try and find the actual files: foreach ($files as $index => $value) { $found = false; $file = $value['file']; foreach ($this->path[$asset] as $location) { if (file_exists($location . DIRECTORY_SEPARATOR . $file)) { $found = true; $files[$index]['path'] = reduce_double_slashes($location . DIRECTORY_SEPARATOR); } } // Uh oh if (!isset($files[$index]['path'])) { // Check if a module has been specified $path = ''; $module = $this->super->router->get_module(); // Is this in a sub-folder? If so, parse out the filename and path. if (($last_slash = strrpos($file, '/')) !== FALSE) { $path = substr($file, 0, ++$last_slash - 1); $file = substr($file, $last_slash); } $_file = modules::file_path($module, $this->dir[$asset] . DIRECTORY_SEPARATOR . $path, $file); if (is_null($_file)) { $segments = explode(DIRECTORY_SEPARATOR, $path); $module = $segments[0]; array_shift($segments); $path = implode(DIRECTORY_SEPARATOR, $segments); $_file = modules::file_path($module, $this->dir[$asset] . DIRECTORY_SEPARATOR . $path, $file); } if (!is_null($_file)) { $found = true; $files[$index]['file'] = basename($_file); $files[$index]['path'] = reduce_double_slashes(dirname($_file)) . DIRECTORY_SEPARATOR; } } if ($found) { $file_names[] = $file; } else { unset($files[$index]); } } $cache_name = sha1(implode(',', $file_names)) . '.' . current($this->config['file_types'][$asset]); $cache_path = reduce_double_slashes($this->config['cache_path'] . DIRECTORY_SEPARATOR . $this->config['paths'][$asset] . DIRECTORY_SEPARATOR . $cache_name); // Keep regenerating cache if development mode if (ENVIRONMENT == 'development' || !$this->super->cache->file->get($cache_path)) { $output = ''; $time = time(); switch ($asset) { case 'styles': $finished = array(); if ($this->config['enable_less'] == true) { $this->_init_lesscss(); foreach ($files as $file) { //var_dump($this->path[$asset] . $file['file']); // Search for less files.. if (preg_match('/\\.less/i', $file['file'])) { $output .= $this->_lesscss->compileFile($file['path'] . $file['file']); /* $file_names = array(); foreach($this->_less->imported as $file) { $file_names[] = end(explode('/', $file)); } */ $finished[$asset][] = $file['file']; } } } foreach ($files as $file) { if (!in_array($file['file'], $finished[$asset])) { $output .= file_get_contents($file['path'] . $file['file']) . "\n"; } } if ($this->config['minify_styles'] == true) { $this->_init_styles_compressor(); $output = styles_compressor::process($output); } break; case 'scripts': foreach ($files as $file) { $output .= file_get_contents($file['path'] . $file['file']) . "\n"; } if ($this->config['minify_scripts'] == true) { $this->_init_scripts_compressor(); $output = scripts_compressor::process($output); } if ($this->config['minify_scripts_closure'] == true) { $this->_init_scripts_closure(); $output = $this->_closure->addCode($output)->simpleMode()->write(); } break; } $output = "/**\n" . " * " . $cache_name . "\n *\n" . (ENVIRONMENT !== 'production' ? " * @includes\t" . implode(",\n *\t\t", $file_names) . "\n *\n" : '') . " * @version\tv" . $time . "\n" . " * @copyright\t(c) " . date('Y') . "\n" . " */\n" . $output; $this->super->cache->file->save($cache_path, $output, 0, 0775); } else { $meta = $this->super->cache->file->get_metadata($cache_path); $time = $meta['mtime']; } $link = prep_url($this->url[$asset] . $cache_name . ($this->config['version_date'] == true ? '?v' . $time : '')); if ($just_link == true) { $return = $link; } else { switch ($asset) { case 'styles': $return = link_tag($link); break; case 'scripts': $return = script_tag($link); break; default: $return = ''; break; } } $this->super->benchmark->mark("assets::output(" . $asset . "/" . $group . ")_end"); return $return; }