function getTrackbackRDFView($blogid, $info) { $buf = new Utils_OutputWriter(); $buf->buffer('<!--' . CRLF); $buf->buffer('<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' . CRLF); $buf->buffer(' xmlns:dc="http://purl.org/dc/elements/1.1/"' . CRLF); $buf->buffer(' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">' . CRLF); $buf->buffer('<rdf:Description' . CRLF); $buf->buffer(' rdf:about="' . $info['permalink'] . '"' . CRLF); $buf->buffer(' dc:identifier="' . $info['permalink'] . '"' . CRLF); $buf->buffer(' dc:title="' . $info['title'] . '"' . CRLF); $buf->buffer(' trackback:ping="' . $info['trackbackURL'] . '" />' . CRLF); $buf->buffer('</rdf:RDF>' . CRLF); $buf->buffer('-->' . CRLF); return $buf->_buffer; }
function writeConfigFile($settings, $description = null) { $context = Model_Context::getInstance(); $writer = new Utils_OutputWriter(); $database = $context->getAllFromNamespace('database'); $service = $context->getAllFromNamespace('service'); $memcached = $context->getAllFromNamespace('memcached'); $config = array(); $contents = "<?php" . CRLF . "ini_set('display_errors', 'off');" . CRLF; // Database information. It is not allow to modify. $config['server'] = $database['server']; $config['database'] = $database['database']; $config['username'] = $database['username']; $config['password'] = $database['password']; $config['dbms'] = $database['dbms']; $config['prefix'] = $database['prefix']; foreach ($config as $item => $value) { $contents .= "\$database['" . $item . "'] = '" . $value . "';" . (array_key_exists($item, $description) ? " // " . $description[$item] : "") . CRLF; } $config = array(); $config['type'] = $service['type']; $config['domain'] = $service['domain']; $config['path'] = $service['path']; foreach ($config as $item => $value) { $contents .= "\$service['" . $item . "'] = '" . $value . "';" . (array_key_exists($item, $description) ? " // " . $description[$item] : "") . CRLF; } if (!empty($memcached) && array_key_exists('server', $memcached)) { $contents .= "\$memcached['server'] = '" . $memcached['server'] . "';" . CRLF; } // Service-specific information. foreach ($settings as $item => $value) { if ($item == 'serviceURL') { $contents .= "\$serviceURL = '" . $value . "';" . (array_key_exists($item, $description) ? " // " . $description[$item] : "") . CRLF; } else { if ($value === true || $value === false || is_numeric($value)) { if ($value === true) { $value = 'true'; } else { if ($value === false) { $value = 'false'; } } $contents .= "\$service['" . $item . "'] = " . $value . ";" . (array_key_exists($item, $description) ? " // " . $description[$item] : "") . CRLF; } else { $contents .= "\$service['" . $item . "'] = '" . $value . "';" . (array_key_exists($item, $description) ? " // " . $description[$item] : "") . CRLF; } } } $contents .= "?>" . CRLF; if (!is_writable(ROOT . "/config.php")) { return _f('파일 쓰기 권한이 없습니다. 웹서버가 %1 파일의 쓰기 권한을 가지고 있는지 확인하세요.', 'config.php'); } $writer->openFile(ROOT . "/config.php"); if ($writer->write($contents) === false) { $writer->close(); return _t('실패했습니다.'); } $writer->close(); return true; }
<?php /// Copyright (c) 2004-2016, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) $IV = array('GET' => array('includeFileContents' => array(array('true', 'false')))); require ROOT . '/library/preprocessor.php'; set_time_limit(0); $includeFileContents = Validator::getBool(@$_GET['includeFileContents']); $writer = new Utils_OutputWriter(); if (defined('__TEXTCUBE_BACKUP__')) { if (!file_exists(__TEXTCUBE_CACHE_DIR__ . '/backup')) { mkdir(__TEXTCUBE_CACHE_DIR__ . '/backup'); @chmod(__TEXTCUBE_CACHE_DIR__ . '/backup', 0777); } if (!is_dir(__TEXTCUBE_CACHE_DIR__ . '/backup')) { exit; } if ($writer->openFile(__TEXTCUBE_CACHE_DIR__ . "/backup/{$blogid}.xml")) { } else { exit; } } else { if ($writer->openStdout()) { header('Content-Disposition: attachment; filename="Textcube-Backup-' . getBlogName($blogid) . "-" . Timestamp::getDate() . '.xml"'); header('Content-Description: Textcube Backup Data'); header('Content-Transfer-Encoding: binary'); header('Content-Type: application/xml'); } else { exit; }