function convert($dbFileName, $sqlFileName) { $db = get_pdo($dbFileName); $f = get_file($sqlFileName); convert_data($db, $f, convert_schema($db, $f)); fclose($f); }
function get_file($date) { global $bzipped, $url, $RIR, $old_format; if ($old_format == "apnic") { $file = "{$RIR}-" . $date->format("Y-m-d"); } elseif (isset($old_format)) { $file = "{$RIR}." . $date->format("Ymd"); } else { $file = "delegated-{$RIR}-" . $date->format("Ymd"); } print $file . "\n"; if ($bzipped == "" || $bzipped == "none") { system("wget {$url}/{$file} 2>/dev/null"); } else { if ($bzipped == "gunzip") { system("wget {$url}/{$file}.gz 2>/dev/null"); system("{$bzipped} {$file}.gz"); } else { system("wget {$url}/{$file}.bz2 2>/dev/null"); system("{$bzipped} {$file}.bz2"); } } if (!file_exists($file)) { $newdate = new DateTime($date->format("Y-m-d")); $newdate->modify("1 day"); return get_file($newdate); } return $file; }
public function __construct($name) { parent::__construct(); $path = PATH . "/themes/" . $name . "/theme.xml"; // load the theme settings file if it exists if ($xml = get_file($path)) { // load xml object, and convert it to an array $settings = object2array(simplexml_load_string($xml)); } else { $settings = array(); } $path = PATH . "/themes/" . $name . "/macros.xml"; // load the theme settings file if it exists if ($xml = get_file($path)) { // load xml object, and convert it to an array $settings['macros'] = object2array(simplexml_load_string($xml)); } else { $settings['macros'] = array(); } $settings['path'] = $name; $settings['name'] = $name; foreach ($settings as $key => $value) { if ($value !== "" && $value !== " ") { $this->Settings[$key] = $value; } } }
/** * 访问 测评报告静态文件 */ function get_report_cache_html($params) { $code = isset($params['code']) ? trim($params['code']) : ''; if ($code == '') { die('404 not found'); } $code = urldecode(base64_decode($code)); list($rule_id, $uid, $subject_id) = explode('-', $code); $rule_id = !is_null($rule_id) ? intval($rule_id) : 0; if (!is_null($subject_id)) { $subject_id = intval($subject_id); } else { $subject_id = 0; } $uid = !is_null($uid) ? intval($uid) : 0; if (!$rule_id || !$uid) { die('404 not found'); } $cache_path = realpath('../../') . '/cache/html/interview_report'; $file_name = "{$cache_path}/{$rule_id}/{$uid}/{$subject_id}.html"; if (!file_exists($file_name)) { die('404 not found'); } echo get_file($file_name); }
static function get_version() { if (file::get_folder_path('framework') === false) { return; } return @file_get_contents(get_file('framework', 'VERSION')->get_path()); }
/** * Emulate get_attachment_image_src for HTML context * * @param string $size_or_img_name * @param string $image_size * @return string */ function get_attachment_image_src($size_or_img_name = 'thumbnail', $image_size = '') { $is_img = is_size_or_img($size_or_img_name); if ($is_img === true) { return get_file(BEA_IMG_SAMPLE_DIR . $size_or_img_name, $image_size); } $img_url = get_random_sample_img_url($size_or_img_name); return get_timthumb_url($img_url, $image_size); }
function get_module_description($module_name) { if (description_exists($module_name)) { return get_file(get_module_path($module_name) . '/' . get_constant('platform\\config\\interfac3::_valid_description_file')); } else { $error_msg = get_constant('\\platform\\config\\interfac3::_no_module_description_msg'); return $error_msg; } }
function plug_utmsrc($f = '', $o = '') { $d = get_file($f); $d = utmsrc_utf($d); //eco($d,1); $u = embed_detect($d, '<meta property="og:url" content="', '"', ''); //echo $u; return $u; }
function sendmail($addr, $subject, $body) { global $DOCUMENT_ROOT; $css = get_file($DOCUMENT_ROOT . '/styles/mail.css'); if ($css != '') { $css = '<style type="text/css">' . $css . '</style>'; } $src = '<html><head>' . $css . '</head><body>' . $body . '</body></html>'; mail($addr, $subject, $src, 'From: ' . config_get('bot-email') . "\n" . 'Content-Type: text/html; charset="UTF-8" '); }
function wiki_get_page_src($url, $action = '') { $file = wiki_get_indexfile($action); $url .= $file; $root = config_get('site-root'); $fn = "{$root}{$url}"; if (($src = get_file($fn)) == false) { return false; } return $src; }
function upurlsav($dr, $o, $u) { $u = ajxg($u); if (!is_image($u)) { return 'no'; } $ret = get_file($u); $nm = strrchr($u, '/'); $f = 'users/' . $dr . '/' . $nm; write_file($f, $ret); return 'ok'; }
protected final function access($d) { if ($d === false) { if (!($a = get_file(XFS . '.htda'))) { exit; } if ($b = get_file(XFS . '.htda_local')) { $a = $b; } $d = explode(',', decode($a[0])); } foreach (w('server login secret database') as $i => $k) { $this->_access[$k] = decode($d[$i]); } unset($d); return; }
function stack_folder($path, $namespace, $mask = null) { //record the folder path containing libs try { $directory = new \DirectoryIterator($path); } catch (Exception $e) { warning('filesystem', 'e001', $path); return; } //format eventual namespace //if namespace exist push namespace in stack as new javascript object if ($namespace != '') { $namespace = trim($namespace, '.'); get_transmission()->stack('if(!' . $namespace . '){' . $namespace . ' = {};}'); $namespace = $namespace . '.'; } //scan the folder //exit if there is NO item, item is NOT (a folder or a file), item IS "dot" folder foreach ($directory as $object) { //get path of item $pathname = $object->getPathname(); if ($object->isDir() && !$object->isDot()) { //get foldername $foldername = $object->getBasename(); //build new namespace $newnamespace = $namespace . $foldername; //send new path and new namespace back to the function stack_folder($pathname, $newnamespace); } else { if ($object->isFile()) { //apply mask rule if ($mask) { if (!preg_match('#' . $mask . '#', $pathname)) { continue; } } //get file content $filecontent = get_file($pathname); //add $namespace to the beginning of file content $filecontent = $namespace . $filecontent; //push javascript object with new namespace in stack get_transmission()->stack($filecontent); } } } }
public function updatenow(){ include('Update.class.php'); $version = './WQLData/version.php'; $ver = include($version); $ver = $ver['ver']; $hosturl = urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); $updatehost = 'http://demo.weiqianlong.com/update.php'; $updatehosturl = $updatehost . '?a=update&v=' . $ver . '&u=' . $hosturl; $updatenowinfo = file_get_contents($updatehosturl); if (strstr($updatenowinfo, 'zip')){ $pathurl = $updatehost . '?a=down&f=' . $updatenowinfo; $updatedir = './WQLData/logs/Temp/update'; delDirAndFile($updatedir); get_file($pathurl, $updatenowinfo, $updatedir); $updatezip = $updatedir . '/' . $updatenowinfo; $archive = new PclZip($updatezip); if ($archive -> extract(PCLZIP_OPT_PATH, './', PCLZIP_OPT_REPLACE_NEWER) == 0){ $updatenowinfo = "远程升级文件不存在.升级失败</font>"; }else{ $sqlfile = $updatedir . '/update.sql'; $sql = file_get_contents($sqlfile); if($sql){ $sql = str_replace("tp_", C('DB_PREFIX'), $sql); $Model = new Model(); error_reporting(0); foreach(split(";[\r\n]+", $sql) as $v){ @mysql_query($v); } } $updatenowinfo = "<font color=red>升级完成 {$sqlinfo}</font><span><a href=./index.php?g=System&m=Update>点击这里 查看是否还有升级包</a></span>"; } } delDirAndFile($updatedir); $this -> assign('updatenowinfo', $updatenowinfo); $this -> display(); }
public function load($v, $force = false) { if (!$this->allow && !$force) { return; } $filepath = $this->folder . $this->encrypt($v); $this->last = $v; if (!@file_exists($filepath)) { return false; } // Cache expiration time if (time() - @filemtime($filepath) < 3600) { if ($plain = get_file($filepath)) { return json_decode($plain[0], true); } } return $this->unload($v); }
public function __construct() { $sql = 'SELECT * FROM _config'; $this->config = sql_rowset($sql, 'config_name', 'config_value'); if ($this->v('site_disable')) { exit('not_running'); } $address = $this->v('site_address'); $host_addr = array_key(explode('/', array_key(explode('//', $address), 1)), 0); if ($host_addr != get_host()) { $allow_hosts = get_file(XFS . XCOR . 'store/domain_alias'); foreach ($allow_hosts as $row) { if (substr($row, 0, 1) == '#') { continue; } $remote = strpos($row, '*') === false; $row = !$remote ? str_replace('*', '', $row) : $row; $row = str_replace('www.', '', $row); if ($row == get_host()) { $sub = str_replace($row, '', get_host()); $sub = f($sub) ? $sub . '.' : ($remote ? 'www.' : ''); $address = str_replace($host_addr, $sub . $row, $address); $this->v('site_address', $address, true); break; } } } if (strpos($address, 'www.') !== false && strpos(get_host(), 'www.') === false && strpos($address, get_host())) { $page_protocol = array_key(explode('//', _page()), 0); $a = $this->v('site_address') . str_replace(str_replace('www.', '', $page_protocol . $address), '', _page()); redirect($a, false); } $this->cache_dir = XFS . XCOR . 'cache/'; if (is_remote() && @file_exists($this->cache_dir) && @is_writable($this->cache_dir) && @is_readable($this->cache_dir)) { $this->cache_f = true; } // // Load additional objects. // $this->email = _import('emailer'); $this->cache = _import('cache'); return; }
function create_faculty_file() { $fac_file = get_file(); // Get the html file if (empty($fac_file)) { return false; } preg_match('/<tbody(.+)tbody>/sm', $fac_file, $table); // Get the table $rows = preg_split('/<tr/', $table[0]); // Get each row array_shift($rows); // Get rid of the first element $fp = fopen(FACULTY_FILE, 'w'); // Open the file for writing if (empty($fp)) { return false; } if (@flock($fp, LOCK_EX)) { // Prevent multiple creations foreach ($rows as $row) { // Iterate through the rows $cols = preg_split('/<td/', $row); // Split up the columns $name = filter_name($cols[1]); // Get the name $area = filter_area($cols[2]); // Get the area of research $mail = filter_email($cols[3]); // Get the email fwrite($fp, "{$mail},{$name},{$area}\n"); // Write the output to the file } flock($fp, LOCK_UN); } else { fclose($fp); // Couldn't get lock return false; } fclose($fp); // Close the file return true; }
function test_xml($f) { $d = get_file($f); echo $enc = embed_detect(strtolower($d), 'encoding="', '"'); if (strtolower($enc) == 'utf-8') { $d = utf8_decode_b($d); } //echo substr_count($d,'<').'-'.substr_count($d,'>'); eco($d, 1); $r = simplexml_load_string($d); $xml = explode("\n", $f); if (!$r) { $rr = libxml_get_errors(); foreach ($rr as $er) { $ret .= display_xml_error($er, $xml); } libxml_clear_errors(); return $ret; } }
/** * 访问 测评报告静态文件 */ function get_report_cache_html($params) { $code = isset($params['code']) ? trim($params['code']) : ''; if ($code == '') { die('404 not found'); } $code = urldecode(base64_decode($code)); $arr = explode('-', $code); $id = ''; if (count($arr) == 4 && end($arr) == 1) { list($rule_id, $id, $subject_id) = $arr; $id = 'class_' . $id; } else { if (count($arr) == 4 && end($arr) == 2) { list($rule_id, $id, $subject_id) = $arr; $id = 'teacher_' . $id; } else { if (count($arr) == 4 && end($arr) == 3) { list($rule_id, $id, $subject_id) = $arr; $id = 'transcript_' . $id; } else { list($rule_id, $id, $subject_id) = $arr; } } } $rule_id = !is_null($rule_id) ? intval($rule_id) : 0; if (!is_null($subject_id)) { $subject_id = intval($subject_id); } else { $subject_id = 0; } if (!$rule_id || !$id) { die('404 not found'); } $cache_path = realpath('../../') . '/cache/html/report'; $file_name = "{$cache_path}/{$rule_id}/{$id}/{$subject_id}.html"; if (!file_exists($file_name)) { die('404 not found'); } echo get_file($file_name); }
function Editor_CreateDirContent($d) { $tplDir = $this->TemplatesDir(); $index = get_file($tplDir . '/index'); $up = content_get_up_to_root($d); $index = preg_replace('/\\$\\{up_to_root\\}/', $up, $index); create_file($d . '/index.php', $index); for ($i = 0; $i < count($this->scripts); $i++) { $s = $this->scripts[$i]; $mk = dirname($s['file']); if ($mk != '' && $mk != '.' && !file_exists($d . '/' . $mk)) { mkdir($d . '/' . $mk); chmod($d . '/' . $mk, 0775); } $src = get_file($tplDir . '/' . $s['script']); if (preg_match('/index\\.php$/', $s['file'])) { $src = preg_replace('/\\$\\{up_to_root\\}/', $up, $src); } create_file($d . '/' . $s['file'], $src); } }
function ch_get_illegal_modules() { $regedit = regedit::getInstance(); $info = array(); $info['type'] = 'get-modules-list'; $info['revision'] = $regedit->getVal("//modules/autoupdate/system_build"); $info['host'] = getServer('HTTP_HOST'); $info['ip'] = getServer('SERVER_ADDR'); $info['key'] = $regedit->getVal("//settings/keycode"); $url = base64_decode('aHR0cDovL3Vkb2QudW1paG9zdC5ydS91cGRhdGVzZXJ2ZXIv') . "?" . http_build_query($info, '', '&'); $result = get_file($url); $xml = new DOMDocument(); $xml->loadXML($result); $xpath = new DOMXPath($xml); $illegal_modules = array(); $no_active = $xpath->query("//module[not(@active)]"); foreach ($no_active as $module) { $illegal_modules[] = $module->getAttribute("name"); } unset($regedit, $info, $url, $result, $xml, $xpath, $no_active, $module); return $illegal_modules; }
$expires_offset = 31536000; // 1 year $out = ''; $wp_styles = new WP_Styles(); wp_default_styles($wp_styles); foreach ($load as $handle) { if (!array_key_exists($handle, $wp_styles->registered)) { continue; } $style = $wp_styles->registered[$handle]; $path = ABSPATH . $style->src; if ($rtl && !empty($style->extra['rtl'])) { // All default styles have fully independent RTL files. $path = str_replace('.min.css', '-rtl.min.css', $path); } $content = get_file($path) . "\n"; if (strpos($style->src, '/' . WPINC . '/css/') === 0) { $content = str_replace('../images/', '../' . WPINC . '/images/', $content); $content = str_replace('../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content); $content = str_replace('../fonts/', '../' . WPINC . '/fonts/', $content); $out .= $content; } else { $out .= str_replace('../images/', 'images/', $content); } } header('Content-Type: text/css; charset=UTF-8'); header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $expires_offset) . ' GMT'); header("Cache-Control: public, max-age={$expires_offset}"); if ($compress && !ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { header('Vary: Accept-Encoding'); // Handle proxies
$force_gzip = $compress && 'gzip' == $_GET['c']; $rtl = isset($_GET['dir']) && 'rtl' == $_GET['dir']; $expires_offset = 31536000; $out = ''; $wp_styles = new WP_Styles(); wp_default_styles($wp_styles); foreach ($load as $handle) { if (!array_key_exists($handle, $wp_styles->registered)) { continue; } $style = $wp_styles->registered[$handle]; $path = ABSPATH . $style->src; $content = get_file($path) . "\n"; if ($rtl && isset($style->extra['rtl']) && $style->extra['rtl']) { $rtl_path = is_bool($style->extra['rtl']) ? str_replace('.css', '-rtl.css', $path) : ABSPATH . $style->extra['rtl']; $content .= get_file($rtl_path) . "\n"; } $out .= str_replace('../images/', 'images/', $content); } header('Content-Type: text/css'); header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $expires_offset) . ' GMT'); header("Cache-Control: public, max-age={$expires_offset}"); if ($compress && !ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler')) { header('Vary: Accept-Encoding'); // Handle proxies if (false !== strpos(strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && !$force_gzip) { header('Content-Encoding: deflate'); $out = gzdeflate($out, 3); } elseif (false !== strpos(strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode')) { header('Content-Encoding: gzip'); $out = gzencode($out, 3);
* * Set this to error_reporting( -1 ) for debugging. */ error_reporting(0); $basepath = dirname(__FILE__); function get_file($path) { if (function_exists('realpath')) { $path = realpath($path); } if (!$path || !@is_file($path)) { return false; } return @file_get_contents($path); } $expires_offset = 31536000; // 1 year header('Content-Type: application/javascript; charset=UTF-8'); header('Vary: Accept-Encoding'); // Handle proxies header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $expires_offset) . ' GMT'); header("Cache-Control: public, max-age={$expires_offset}"); if (isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ($file = get_file($basepath . '/wp-tinymce.js.gz'))) { header('Content-Encoding: gzip'); echo $file; } else { // Back compat. This file shouldn't be used if this condition can occur (as in, if gzip isn't accepted). echo get_file($basepath . '/tinymce.min.js'); echo get_file($basepath . '/plugins/compat3x/plugin.min.js'); } exit;
<?php $basepath = dirname(__FILE__); while (@ob_end_clean()) { } function get_file($path) { if (function_exists('realpath')) { $path = realpath($path); } if (!$path || !@is_file($path)) { return ''; } return @file_get_contents($path); } $expires_offset = 31536000; header('Content-Type: application/x-javascript; charset=UTF-8'); header('Vary: Accept-Encoding'); // Handle proxies header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $expires_offset) . ' GMT'); header("Cache-Control: public, max-age={$expires_offset}"); if (isset($_GET['c']) && 1 == $_GET['c'] && !ini_get('zlib.output_compression') && false !== strpos(strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip')) { header('Content-Encoding: gzip'); echo get_file($basepath . '/wp-tinymce.js.gz'); } else { echo get_file($basepath . '/wp-tinymce.js'); } exit;
$key = bracket_escape($key, 1); // 1 - back $set[] = idf_escape($key) . " = " . (ereg('char|text', $fields[$key]["type"]) || $val != "" ? $adminer->processInput($fields[$key], $val) : "NULL"); } $query = table($TABLE) . " SET " . implode(", ", $set); $where2 = " WHERE " . where_check($unique_idf) . ($where ? " AND " . implode(" AND ", $where) : ""); $result = queries("UPDATE" . ($is_group ? " {$query}{$where2}" : limit1($query, $where2))); // can change row on a different page without unique key if (!$result) { break; } $affected += $connection->affected_rows; } queries_redirect(remove_from_uri(), lang('%d item(s) have been affected.', $affected), $result); } } elseif (is_string($file = get_file("csv_file", true))) { //! character set cookie("adminer_import", "output=" . urlencode($adminer_import["output"]) . "&format=" . urlencode($_POST["separator"])); $result = true; $cols = array_keys($fields); preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~', $file, $matches); $affected = count($matches[0]); begin(); $separator = $_POST["separator"] == "csv" ? "," : ($_POST["separator"] == "tsv" ? "\t" : ";"); foreach ($matches[0] as $key => $val) { preg_match_all("~((\"[^\"]*\")+|[^{$separator}]*){$separator}~", $val . $separator, $matches2); if (!$key && !array_diff($matches2[1], $cols)) { //! doesn't work with column names containing ",\n // first row corresponds to column names - use it for table structure $cols = $matches2[1]; $affected--;
$history_all =& get_session("queries"); $history =& $history_all[DB]; if (!$error && $_POST["clear"]) { $history = array(); adminer_redirect(remove_from_uri("history")); } page_header(isset($_GET["import"]) ? lang('Import') : lang('SQL command'), $error); if (!$error && $_POST) { $fp = false; if (!isset($_GET["import"])) { $query = $_POST["query"]; } elseif ($_POST["webfile"]) { $fp = @fopen(file_exists("adminer.sql") ? "adminer.sql" : "compress.zlib://adminer.sql.gz", "rb"); $query = $fp ? fread($fp, 1000000.0) : false; } else { $query = get_file("sql_file", true); } if (is_string($query)) { // get_file() returns error as number, fread() as false if (function_exists('memory_get_usage')) { @ini_set("memory_limit", max(ini_bytes("memory_limit"), 2 * strlen($query) + memory_get_usage() + 8000000.0)); // @ - may be disabled, 2 - substr and trim, 8e6 - other variables } if ($query != "" && strlen($query) < 1000000.0) { // don't add big queries $q = $query . (preg_match("~;[ \t\r\n]*\$~", $query) ? "" : ";"); //! doesn't work with DELIMITER | if (!$history || reset(end($history)) != $q) { // no repeated queries restart_session(); $history[] = array($q, time());
function GetNewsPost($id) { if (file_exists($this->files_dir . "/" . $id)) { OUT(get_file($this->files_dir . "/" . $id)); } else { die("no such file: " . $this->files_dir . "/" . $id); } }
$write['wr_link' . $i] = get_text($write['wr_link' . $i]); $link[$i] = $write['wr_link' . $i]; } if (strstr($write['wr_option'], 'html1')) { $html_checked = 'checked'; $html_value = 'html1'; } else { if (strstr($write['wr_option'], 'html2')) { $html_checked = 'checked'; $html_value = 'html2'; } } if (strstr($write['wr_option'], 'secret')) { $secret_checked = 'checked'; } $file = get_file($bo_table, $wr_id); } else { if ($w == 'r') { if (strstr($write['wr_option'], 'secret')) { $is_secret = true; $secret_checked = 'checked'; } $password_required = "required"; for ($i = 1; $i <= G5_LINK_COUNT; $i++) { $write['wr_link' . $i] = get_text($write['wr_link' . $i]); } } } } set_session('ss_bo_table', $_REQUEST['bo_table']); set_session('ss_wr_id', $_REQUEST['wr_id']);
function mk_sort($strfile, $strtxt, $strorder, $strobj='listing') { $file=get_file($strfile); $file.=$_GET['w']?'&w='.$_GET['w']:'&w=0'; $file.=$_GET['a']?'&a='.$_GET['a']:'&a=0'; $file.='&o='.$strorder; $desc=$_GET['d']?-1*$_GET['d']:-1; $file.='&d='.$desc; if ($_GET['o']==$strorder){ $img=($_GET['d']<0)?IMG_SORT_UP:IMG_SORT_DWN; $img='<img src="'.$img.'" border="0" align="absbottom" />'; }else{ $img=""; } return "<div onClick=\"ajpage('$file','$strobj')\" onMouseOver=\"className='hover'\" onMouseOut=\"className=''\">$strtxt$img</div>"; }