} if (isset($_GET['read']) && $show_file_or_dir && AJAX_request()) { file_exists_str($_GET['read']); if (in_array(extension($_GET['read']), $_extensions[1]) || count($_extensions[1]) == 0) { header('Content-type: text/html; charset=' . $charset); die(_read($_GET['read'])); } else { die($lang[7]); } } if (isset($_GET['write']) && $show_file_or_dir && AJAX_request()) { file_exists_str($_POST['write']); if (in_array(extension($_POST['write']), $_extensions[1]) || count($_extensions[1]) == 0) { header('Content-type: text/html; charset=' . $charset); $txtData = isset($_POST['txt']) ? $_POST['txt'] : ''; die(_write($_POST['write'], $txtData)); } else { die($lang[7]); } } if (isset($_GET['uploadfile']) && AJAX_request()) { $response = array(); if (isset($_FILES["inputFileUpload"]) && !empty($_FILES["inputFileUpload"]["name"])) { if (is_array($_FILES['inputFileUpload']['name']) || is_object($_FILES['inputFileUpload']['name'])) { foreach ($_FILES['inputFileUpload']['name'] as $n => $name) { if (!empty($name)) { $tmp_name = basename($name); $tmp_size = $_FILES["inputFileUpload"]["size"][$n]; $tmp_type = $_FILES["inputFileUpload"]["type"][$n]; $error = $_FILES["inputFileUpload"]["error"][$n]; $name_ = $_FILES["inputFileUpload"]["name"][$n];
function update_core($step = '1', $v) { global $dbprefix, $SQL, $lang, $config; $ftp = $this->check_what_method(); $v = $v['version_number']; //$this->f_method = 'zfile'; //standard if ($ftp && $this->is_ftp_supported) { $this->f_method = 'kftp'; if (!empty($config['ftp_info'])) { $ftp_info = @unserialize($config['ftp_info']); $this->info = $ftp_info; } else { $this->f_method = 'zfile'; //return to file } } $this->check_connect(); switch ($step) { case '1': //....... download files # code... if (file_exists(PATH . $config['foldername'] . '/' . 'aupdatekleeja' . $v . '.tar')) { return true; } $b_url = empty($_SERVER['SERVER_NAME']) ? $config['siteurl'] : $_SERVER['SERVER_NAME']; if (defined("DEV_STAGE")) { $data = fetch_remote_file('http://localhost/saanina-kleeja/check_vers2/?i=' . urlencode($b_url)); } else { $data = fetch_remote_file('http://www.kleeja.com/check_vers2/?i=' . urlencode($b_url)); } if ($data != false) { //then ..write new file $re = $this->f > _write(PATH . $config['foldername'] . '/' . 'aupdatekleeja' . $v . '.tar', $data); if ($this->f->check()) { $this->zipped_files = $this->f->push('aupdate' . $v); return 'zipped'; } return $re; } else { return false; } break; case '2': //extract / untar return $this->untar(PATH . $config['foldername'] . '/' . 'aupdatekleeja' . $v . '.tar', PATH); break; case '3': //database include PATH . 'cache/sqlupdate_' . $v . '.php'; if ($config['db_version'] >= DB_VERSION && !defined('DEV_STAGE')) { $update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . '</span>'; } // //is there any sqls // $SQL->show_errors = false; if (isset($update_sqls) && sizeof($update_sqls) > 0) { $err = ''; foreach ($update_sqls as $name => $sql_content) { $err = ''; $SQL->query($sql_content); $err = $SQL->get_error(); if (strpos($err[1], 'Duplicate') !== false || $err[0] == '1062' || $err[0] == '1060') { $sql = "UPDATE `{$dbprefix}config` SET `value` = '" . DB_VERSION . "' WHERE `name` = 'db_version'"; $SQL->query($sql); $update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . '</span>'; $complete_upate = false; } } return $update_msgs_arr; } else { return false; } break; case '4': //functions include PATH . 'cache/sqlupdate_' . $v . '.php'; if ($config['db_version'] >= DB_VERSION && !defined('DEV_STAGE')) { return 'updated'; } // //is there any functions // if (isset($update_functions) && sizeof($update_functions) > 0) { foreach ($update_functions as $n) { call_user_func($n); } return true; } else { return false; } break; case '5': include PATH . 'cache/sqlupdate_' . $v . '.php'; // //is there any notes // $NOTES_CUP = false; if (isset($update_notes) && sizeof($update_notes) > 0) { $i = 1; $NOTES_CUP = array(); foreach ($update_notes as $n) { $NOTES_CUP[$i] = $n; ++$i; } } return $NOTES_CUP; break; case '6': //finish delete temps show results # code... break; } }
function narrate(array $dialog, $tabs = 2) { _write(sprintf('%s%s', $tabs > 0 ? str_repeat("\t", $tabs) : '', implode(PHP_EOL, $dialog)), $tabs); }
$js = ''; foreach (array(1 => 'base', 5 => 'detect', 10 => 'polyfill', 15 => 'cls', 20 => 'math', 25 => 'date', 30 => 'util', 35 => 'local', 40 => 'network', 45 => 'style', 50 => 'css', 55 => 'key', 60 => 'event', 70 => 'win', 80 => 'query', 90 => 'dom', 100 => 'template', 110 => 'i18n', 120 => 'vali', 130 => 'ani', 140 => 'img', 150 => 'ga', 900 => 'boot') as $k => $v) { $js .= _read($path . substr('0' . $k, -3) . '_' . $v . '.js', "r") . "\n"; } _write(realpath('') . '/build.js', $header . $js . $footer); require_once dirname(__FILE__) . '/JSMin.php'; $min = JavaScriptMinifier::minify($js); _write(realpath('') . '/min.js', $header . $min . $footer); $root = isset($_GET['root']) && $_GET['root'] == 'true' ? TRUE : FALSE; switch (isset($_GET['live']) ? $_GET['live'] : 'full') { case 'min': _write(realpath('./..') . '/index.js', $header . $min . $footer); $live = 'min'; if ($root) { _write(realpath('./../..') . '/index.js', $header . $min . $footer); } break; case 'full': _write(realpath('./..') . '/index.js', $header . $js . $footer); $live = 'full'; if ($root) { _write(realpath('./../..') . '/index.js', $header . $js . $footer); } break; default: $live = 'none'; } echo 'full:<a href="build.js" target="_blank">build.js</a><br>minify:<a href="min.js" target="_blank">min.js</a>' . '<br>lived(' . $live . '):<a href="http://js.bsapi.co/2/" target="_blank">http://js.bsapi.co/2/</a>'; if ($root) { echo '<br>root changed:<a href="http://js.bsapi.co/2/" target="_blank">http://js.bsapi.co/</a>'; }
/** * Console confirmation prompt * @param string $message The confirmation message * @param string|array $input The input to be allowed or to be checked against * @return boolean TRUE if it is passed; otherwise FALSE */ public function confirm($message = 'Are you sure? Type "yes" or "y" to continue:', $input = array('yes', 'y')) { _write(trim($message) . ' '); $handle = fopen("php://stdin", "r"); $line = fgets($handle); $line = strtolower(trim($line)); if (is_string($input) && $line == $input) { fclose($handle); return true; } if (is_array($input) && in_array($line, $input)) { fclose($handle); return true; } fclose($handle); return false; }
} // split of dbname (mostly for SSI) $pref = explode('.', $db_prefix); if (!empty($pref[1])) { $pref = $pref[1]; } else { $pref = $db_prefix; } // Load the SMF DB Functions db_extend('packages'); db_extend('extra'); /******************** * Define the tables * *********************/ $tabledate = array('portamx_settings', 'portamx_blocks', 'portamx_categories', 'portamx_articles'); // loop througt each table foreach ($tabledate as $tblname) { // check if the table exist _write('Processing Table "' . $pref . $tblname . '".<br />'); $tablelist = $smcFunc['db_list_tables'](false, $pref . $tblname); if (!empty($tablelist) && in_array($pref . $tblname, $tablelist)) { // drop table $smcFunc['db_drop_table']('{db_prefix}' . $tblname); _write('.. Table "' . $pref . $tblname . '" successful dropped.<br /><br />'); } else { _write('.. Table "' . $pref . $tblname . '" not exist.<br /></br />'); } } // done _write('dbremove done.');