function copy_vendor() { if (!file_exists($this->export_location . '/public/vendor/')) { mkdir($this->export_location . '/public/vendor/', 0777, true); } recurse_copy(WWW_FOLDER . '/public/vendor', $this->export_location . '/public/vendor'); echo '{"status":"success", "message":"Vendor files copied."}'; }
function recurse_copy($source, $dest) { // Check for symlinks if (is_link($source)) { return symlink(readlink($source), $dest); } // Simple copy for a file if (is_file($source)) { return copy($source, $dest); } // Make destination directory if (!is_dir($dest)) { mkdir($dest); } // Loop through the folder $dir = dir($source); while (false !== ($entry = $dir->read())) { // Skip pointers if ($entry == '.' || $entry == '..') { continue; } // Deep copy directories recurse_copy("{$source}/{$entry}", "{$dest}/{$entry}"); } // Clean up $dir->close(); return true; }
function changeWidgetDir($newDir) { $defaultDir = str_replace('//', '/', str_replace('\\', '/', dirname(plugin_dir_path(__FILE__)))) . '/custom-widgets/'; if (empty($newDir) || get_option('preset-cdwd') == TRUE || get_option('widgetdir') == '/') { $newDir = $defaultDir; $dirchange = TRUE; } $newDir = str_replace('//', '/', str_replace('\\', '/', $newDir)); $wpdir = str_replace('//', '/', str_replace('\\', '/', wp_upload_dir())); $plugindir = str_replace('//', '/', str_replace('\\', '/', dirname(plugin_dir_path(__FILE__)))); if (WPWM_DEBUG == 1) { $error = TRUE; $errmsg = "Debug Mode enabled, unrestricted directory changes permitted"; } else { if (strstr($newDir, $plugindir) == FALSE) { $error = TRUE; $errmsg = " ERROR-Custom Widget Directory must be within Wordpress manager plugin directory. The default had been set instead of " . $newDir . '<br/>'; $newDir = dirname(plugin_dir_path(__FILE__)) . '/custom-widgets/'; $dirchange = TRUE; } } $dirchange = TRUE; $newDir = str_replace('//', '/', str_replace('\\', '/', $newDir)); if (file_exists($newDir) == FALSE) { $dirDiff = true; mkdir($newDir, 0755); $user = exec(whoami); chown($newDir, $user); } $sourceDir = get_option('widgetdir'); if (file_exists($sourceDir)) { $sourceDir = str_replace('//', '/', str_replace('\\', '/', $sourceDir)); if (strcmp($sourceDir, $wpdir['basedir']) != 0) { $contents = scandir($sourceDir); if (SUBSTR($newDir, -1) != '/') { $newDir .= '/'; } foreach ($contents as $widgets) { if ($widgets != "." && $widgets != "..") { recurse_copy($sourceDir, $newDir); } } if ($sourceDir != $newDir) { if ($sourceDir != $defaultDir) { $check = recursiveRemove($sourceDir); } } } } update_option('widgetdir', $newDir); msgDisplay($error, $errmsg, $dirchange, $dirDiff); }
public function main() { if (!is_dir($this->targetDir)) { throw new BuildException("Invalid symlink target {$this->targetDir}"); } foreach ($this->items as $item) { // if there's a source dir set, we're assuming everything is coming from that dir $sourceItem = $this->sourceDir ? $this->sourceDir . '/' . $item : $item; if (!recurse_copy($sourceItem, $this->targetDir . '/' . $item)) { throw new BuildException("Failed copying from {$sourceItem} to " . $this->targetDir); } } }
public function recurse_copy($src, $dst) { $hm = openhm($src); @mkhm($dst); while (false !== ($file = readhm($hm))) { if ($file != '.' && $file != '..') { if (is_hm($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { copy($src . '/' . $file, $dst . '/' . $file); } } } closehm($hm); }
function recurse_copy($src, $dst) { $dir = opendir($src); @mkdir($dst, '01777', TRUE); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { copy($src . '/' . $file, $dst . '/' . $file); } } } closedir($dir); }
/** * Taken from: http://php.net/manual/en/function.copy.php * * Recursively copies a directory from $src to $dst. * If $dst does not exist it is created. * Omits .svn directories. * Omits .git directories. **/ function recurse_copy($src, $dst) { $dir = opendir($src); @mkdir($dst, 0775, true); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..' && $file != '.svn' && $file != '.git') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { copy($src . '/' . $file, $dst . '/' . $file); } } } closedir($dir); }
/** * A recursive function to copy all subdirectories and their contents. * @param $src The source directory * @param $dst The target directory */ function WPPortfolio_fileCopyRecursive($src, $dst) { $dir = opendir($src); @mkdir($dst); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { copy($src . '/' . $file, $dst . '/' . $file); } } } // end while closedir($dir); }
function recurse_copy($src, $dst) { $success = true; $dir = opendir($src); @mkdir($dst); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { $success = $success && recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { $success = $success && copy($src . '/' . $file, $dst . '/' . $file); } } } closedir($dir); return $success; }
protected function recurse_copy_files($src, $dst) { $dir = opendir($src); if (!file_exists($dst)) { mkdir($dst, 0777, true); } while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { copy($src . '/' . $file, $dst . '/' . $file); } } } closedir($dir); }
/** * @param string $source * @param string $destination * * @see http://stackoverflow.com/a/2050909/736809 */ function recurse_copy($source, $destination) { $dir = opendir($source); @mkdir($destination); while (false !== ($file = readdir($dir))) { if (!in_array($file, ['.', '..'])) { if (is_dir($source . '/' . $file)) { recurse_copy(sprintf('%s/%s', $source, $file), sprintf('%s/%s', $destination, $file)); //recurse_copy($source . '/' . $file,$destination . '/' . $file); } else { copy(sprintf('%s/%s', $source, $file), sprintf('%s/%s', $destination, $file)); //copy($source . '/' . $file, $destination . '/' . $file); } } } closedir($dir); }
function recurse_copy($dossier, $demoUrlDir) { $dir = opendir($dossier); if (!file_exists($demoUrlDir)) { @mkdir($demoUrlDir); } while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { /* Add */ if (is_dir($dossier . '/' . $file)) { recurse_copy($dossier . '/' . $file, $demoUrlDir . '/' . $file); } else { copy($dossier . '/' . $file, $demoUrlDir . '/' . $file); } } } closedir($dir); }
protected function filecopy($tmpFolder) { $dir0s = ob_scandir($tmpFolder); // copy module to cubi/upgrade folder foreach ($dir0s as $dir0) { $dirs = ob_scandir($tmpFolder . "/{$dir0}"); foreach ($dirs as $dir) { $srcDir = $tmpFolder . "/{$dir0}/{$dir}"; $dstDir = $dir == 'modules' ? OPENBIZ_APP_PATH . "/upgrade/modules" : OPENBIZ_APP_PATH . "/{$dir}"; echo "copy {$srcDir} to {$dstDir} \n"; recurse_copy($srcDir, $dstDir); if ($dir == 'modules') { $this->_upgradeModules = ob_scandir($srcDir); } } } //print_r($this->_upgradeModules); }
public function createProject($projectName, $projectDir) { ControllerTray::instance()->renderLayout = false; $this->data->success = false; $this->data->projectName = $projectName; if (!\Fstab::instance()->addProject($projectName, $projectDir)) { return false; } \Fstab::instance()->save(); $commonProject = \Path::instance()->evaluate("common.template.prj"); $projectPath = \Path::instance()->evaluate(":{$projectName}.root") . "{$projectDir}"; if (!is_dir($projectPath)) { if (!recurse_copy($commonProject, $projectPath)) { $this->data->success = false; } else { $this->data->success = true; } } }
function recurse_copy($src, $dst) { $dir = opendir($src); @mkdir($dst); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); echo 'Copying: ' . $src . '/' . $file . ' to ' . $dst . '/' . $file . '<br />'; } else { copy($src . '/' . $file, $dst . '/' . $file); echo 'Copying: ' . $src . '/' . $file . ' to ' . $dst . '/' . $file . '<br />'; } //end if/else } //end out if } //end while loop closedir($dir); }
function recurse_copy($src, $dst) { $dir = opendir($src); @mkdir($dst); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { if (!recurse_copy($src . '/' . $file, $dst . '/' . $file)) { return false; } } else { if (!copy($src . '/' . $file, $dst . '/' . $file)) { return false; } } } } closedir($dir); return true; }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { $vm_admin_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'; if ($route == "install") { $media_path = JPATH_ROOT . DS . 'media' . DS . 'com_zasilkovna' . DS; recurse_copy($media_path . 'admin' . DS . 'com_virtuemart' . DS, $vm_admin_path . DS); foreach (array('en-GB', 'cs-CZ', 'sk-SK') as $langCode) { recurse_copy($media_path . 'admin' . DS . $langCode . '.plg_vmshipment_zasilkovna.ini', JPATH_ADMINISTRATOR . DS . 'language' . DS . $langCode . DS . $langCode . '.plg_vmshipment_zasilkovna.ini'); } $db =& JFactory::getDBO(); $q = "CREATE TABLE IF NOT EXISTS #__virtuemart_zasilkovna_branches (\n `id` int(10) NOT NULL,\n `name_street` varchar(200) NOT NULL,\n `currency` text NOT NULL,\n `country` varchar(10) NOT NULL\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; $db->setQuery($q); $db->query(); $q = "CREATE TABLE IF NOT EXISTS `#__virtuemart_shipment_plg_zasilkovna` (\n\t\t\t\t\t\t\t `id` int(1) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t `virtuemart_order_id` int(11) unsigned DEFAULT NULL,\n\t\t\t\t\t\t\t `virtuemart_shipmentmethod_id` mediumint(1) unsigned DEFAULT NULL,\n\t\t\t\t\t\t\t `order_number` char(32) DEFAULT NULL,\n\t\t\t\t\t\t\t `zasilkovna_packet_id` decimal(10,0) DEFAULT NULL,\n\t\t\t\t\t\t\t `zasilkovna_packet_price` decimal(15,2) DEFAULT NULL,\n\t\t\t\t\t\t\t `branch_id` decimal(10,0) DEFAULT NULL,\n\t\t\t\t\t\t\t `branch_currency` char(5) DEFAULT NULL,\n\t\t\t\t\t\t\t `branch_name_street` varchar(500) DEFAULT NULL,\n\t\t\t\t\t\t\t `email` varchar(255) DEFAULT NULL,\n\t\t\t\t\t\t\t `phone` varchar(255) DEFAULT NULL,\n\t\t\t\t\t\t\t `first_name` varchar(255) DEFAULT NULL,\n\t\t\t\t\t\t\t `last_name` varchar(255) DEFAULT NULL,\n\t\t\t\t\t\t\t `address` varchar(255) DEFAULT NULL,\n\t\t\t\t\t\t\t `city` varchar(255) DEFAULT NULL,\n\t\t\t\t\t\t\t `zip_code` varchar(255) DEFAULT NULL,\n\t\t\t\t\t\t\t `virtuemart_country_id` varchar(255) DEFAULT NULL,\n\t\t\t\t\t\t\t `adult_content` smallint(1) DEFAULT '0',\n\t\t\t\t\t\t\t `is_cod` smallint(1) DEFAULT NULL,\n\t\t\t\t\t\t\t `exported` smallint(1) DEFAULT NULL,\n\t\t\t\t\t\t\t `printed_label` smallint(1) DEFAULT '0',\n\t\t\t\t\t\t\t `shipment_name` varchar(5000) DEFAULT NULL,\n\t\t\t\t\t\t\t `shipment_cost` decimal(10,2) DEFAULT NULL,\n\t\t\t\t\t\t\t `shipment_package_fee` decimal(10,2) DEFAULT NULL,\n\t\t\t\t\t\t\t `tax_id` smallint(1) DEFAULT NULL,\n\t\t\t\t\t\t\t `created_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t\t `created_by` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t\t `modified_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t\t `modified_by` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t\t `locked_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t\t `locked_by` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='zasilkovna';"; $db->setQuery($q); $db->query(); $q = "INSERT INTO #__virtuemart_adminmenuentries (`module_id`, `parent_id`, `name`, `link`, `depends`, `icon_class`, `ordering`, `published`, `tooltip`, `view`, `task`) VALUES\n (5, 0, 'ZASILKOVNA', '', '', 'vmicon vmicon-16-zasilkovna', 1, 1, '', 'zasilkovna', '');"; $db->setQuery($q); $db->query(); } }
/** * Recursive copy entire Directory * * @param string $src * @param string $dst * @param boolean $overwrite */ function recurse_copy($src, $dst, $overwrite = false) { $dir = opendir($src); @mkdir($dst); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { if (is_file($dst . "/" . $file) && $overwrite) { if ($overwrite) { unlink($dst . "/" . $file); copy($src . '/' . $file, $dst . '/' . $file); } } else { copy($src . '/' . $file, $dst . '/' . $file); } } } } closedir($dir); }
function recurse_copy($src, $dst) { $dir = @opendir($src); if (!$dir) { return false; } if (@mkdir($dst, 0777)) { while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { if (!@copy($src . '/' . $file, $dst . '/' . $file)) { return false; } } } } } else { return false; } closedir($dir); return true; }
public static function InsertToDB($request) { global $db_connection; global $link_to_report_images; global $link_to_report_files; $author_id = $db_connection->real_escape_string($request->author_id); $name = $db_connection->real_escape_string($request->name); $res = $db_connection->query("INSERT INTO `" . self::$table . "` (`author_id`, `name`) VALUES ('" . $author_id . "', '" . $name . "')"); if (!$res) { echo $db_connection->error; return false; } $id = $db_connection->insert_id; $request->text_block = preg_replace('/tmp_(\\d+)\\//', $id . '/', $request->text_block); $text_block = $db_connection->real_escape_string($request->text_block); $res = $db_connection->query("UPDATE `" . self::$table . "` SET `text_block`=\"" . $text_block . "\" WHERE `id`=" . $id); if (!$res) { echo $db_connection->error; $db_connection->query("DELETE FROM `" . self::$table . "` WHERE `id` = " . $id); return false; } $request->id = $id; $upload_path = ''; recurse_copy($link_to_report_images . 'tmp_' . GetUserID(), $link_to_report_images . $id); recurse_copy($link_to_report_files . 'tmp_' . GetUserID(), $link_to_report_files . $id); $receiver_emails = []; foreach ($request->recipient_ids as $key => $aim) { $received = User::FetchBy(['select_list' => 'received_reports, email', 'is_unique' => true, 'eq_conds' => ['id' => $aim]]); if (Error::IsError($received)) { echo Error::ToString($received); return false; } $tmp = $received->GetReceivedReports(); array_push($tmp, $id . ''); $rc = $db_connection->query("UPDATE users SET received_reports = '" . $db_connection->real_escape_string(json_encode($tmp)) . "' WHERE id = " . $aim); if (!$rc) { echo $db_connection->error; return false; } array_push($receiver_emails, $received->GetEmail()); } $sended = User::FetchBy(['select_list' => 'sended_reports', 'is_unique' => true, 'eq_conds' => ['id' => $request->GetAuthorID()]]); if (Error::IsError($sended)) { echo Error::ToString($sended); return false; } $tmp = $sended->GetSendedReports(); array_push($tmp, $id . ''); $rc = $db_connection->query("UPDATE users SET sended_reports = '" . $db_connection->real_escape_string(json_encode($tmp)) . "' WHERE id = " . $request->GetAuthorID()); if (!$rc) { echo $db_connection->error; return false; } $receiver_emails = array_unique($receiver_emails); foreach ($receiver_emails as $key => $email) { $subject = 'New report on lgmis.cs.msu.ru'; $message = '<html>'; $message .= '<head><title>New report from on your name</title></head>'; $message .= '<body>'; $message .= '<table width="100%" align="center">'; $message .= '<tr><td>You can see more information about this report: <a href="' . $request->ToHTMLFullVersLite() . '">go on site</a></td></tr>'; $message .= '</table>'; $message .= '</body>'; $message .= '</html>'; $headers = 'From: LGMIS Admin <*****@*****.**>' . PHP_EOL . 'Reply-To: <*****@*****.**>' . PHP_EOL . 'X-Mailer: PHP/' . phpversion() . 'MIME-Version: 1.0' . PHP_EOL . 'Content-type: text/html; charset=UTF-8' . PHP_EOL; if (!mail($email, $subject, $message, $headers, '-f no-reply@lgmis.cs.msu.ru')) { echo 'error:' . error_get_last(); return false; } } return true; }
public function doUpdate() { $cannotWrite=0; //if (!class_exists('ZipArchive')) { //$this->error('您的服务器不支持php zip扩展,请配置好此扩展再来升级', U('System/main')); //} if (!isset($_GET['ignore'])) { if (!is_writable(($_SERVER['DOCUMENT_ROOT'] . '/Saivi'))) { $cannotWrite=1; $this->error('您的服务器Saivi文件夹不可写入,设置好再升级', U('System/main')); } if (!is_writable(($_SERVER['DOCUMENT_ROOT'] . '/tpl'))) { $this->error('您的服务器tpl文件夹不可写入,设置好再升级', U('System/main')); } } $now = time(); $updateRecord = M('System_info')->order('lastsqlupdate DESC')->find(); $key = $this->key; $url = ((((($this->server_url . '?act=server&key=') . $key) . '&lastversion=') . $updateRecord['version']) . '&domain=') . $this->topdomain; $remoteStr = @Saivi_getcontents($url); $rt = json_decode($remoteStr, 1); if (intval($rt['success']) < 1) { if (intval($rt['success']) == 0) { if (!isset($_GET['ignore'])) { $this->success('检查更新了:' . $rt['msg'], U('System/doSqlUpdate')); } else { $this->success('检查更新了:' . $rt['msg'], U('System/doSqlUpdate', array('ignore' => 1))); } } else { $this->error($rt['msg'], U('System/main')); } } else { $locationZipPath = (RUNTIME_PATH . $now) . '.zip'; $filename = ((((($this->server_url . '?act=server&getFile=1&key=') . $key) . '&lastversion=') . $updateRecord['version']) . '&domain=') . $this->topdomain; file_put_contents($locationZipPath, @Saivi_getcontents($filename)); //$zip = new ZipArchive(); $zip = new PclZip($locationZipPath); //$rs = $zip->open($locationZipPath); //if ($rs !== TRUE) { //$this->error('解压失败!Error Code:' . $rs); //} // $cacheUpdateDirName='caches_upgrade'.date('Ymd',time()); if(!file_exists(RUNTIME_PATH.$cacheUpdateDirName)) { @mkdir(RUNTIME_PATH.$cacheUpdateDirName,0777); } // $list = $zip->extract(PCLZIP_OPT_PATH,RUNTIME_PATH.$cacheUpdateDirName); //$zip->extractTo(RUNTIME_PATH.$cacheUpdateDirName); recurse_copy(RUNTIME_PATH.$cacheUpdateDirName,$_SERVER['DOCUMENT_ROOT']); //$zip->close(); //delete if (!$cannotWrite){ @deletedir(RUNTIME_PATH.$cacheUpdateDirName); } @unlink($locationZipPath); if ($rt['time']) { M('System_info')->where(array('version' => $updateRecord['version']))->save(array('version' => $rt['time'])); M('Update_record')->add(array('msg' => $rt['msg'], 'time' => $rt['time'], 'type' => $rt['type'])); } if (isset($_GET['ignore'])) { $this->success('进入下一步:' . $rt['msg'], U('System/doUpdate', array('ignore' => 1))); } else { $this->success('进入下一步:' . $rt['msg'], U('System/doUpdate')); } } }
function recurse_copy($copy_as_new, $src, $dst) { $dir = opendir($src); @mkdir($dst); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($copy_as_new, $src . '/' . $file, $dst . '/' . $file); } else { $dstfile = $dst . '/' . $file; if (in_array(realpath($dstfile), $copy_as_new)) { $dstfile .= ".new"; } if (!copy($src . '/' . $file, $dstfile)) { return false; } } } } closedir($dir); return true; }
protected function copyResourceFiles() { $this->log("Copy resource files to /cubi/resources folder."); $module = $this->name; $modulePath = MODULE_PATH . "/{$module}"; $resourceFolder = $modulePath . "/resource"; $targetFolder = APP_HOME . "/resources/{$module}"; // copy resource/* to /cubi/resources/module_name/ recurse_copy($resourceFolder, $targetFolder); }
function recurse_copy($src, $dst) { if (is_file($src)) { $_DIRNAME = pathinfo($dst, PATHINFO_DIRNAME); if (!file_exists($_DIRNAME)) { @mkdir($_DIRNAME, 0777, true); } return @copy($src, $dst); } $dir = opendir($src); if (!file_exists($dst)) { @mkdir($dst, 0777, true); } while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { copy($src . '/' . $file, $dst . '/' . $file); } } } closedir($dir); }
check_admin_referer('rtl_theme_maker_plugin'); $location = "options-general.php?page=rtl_theme_maker"; // based on the location of your sub-menu page if ($referer = wp_get_referer()) { if (FALSE !== strpos($referer, $location)) { $location = remove_query_arg(array('message'), $referer); } } // clear $_POST array if needed unset($_POST['_wpnonce'], $_POST['_wp_http_referer'], $_POST['save_options']); update_option('rtl_theme_maker_options', $_POST); $location = add_query_arg('message', 1, $location); // $theme_dir = isset($_POST['theme']) ? stripcslashes($_POST['theme']) : ''; $theme_dir = '../wp-content/themes/' . $theme_dir; recurse_copy($theme_dir, $theme_dir . '-rtl'); // redirect after header definitions - cannot use wp_redirect($location); $rtl_theme_maker->javascript_redirect($location); exit; } $messages[1] = __('RTL Theme Maker created a new RTL theme, <a href="themes.php">go to the theme page</a>', 'rtl_theme_maker'); if (isset($_GET['message']) && (int) $_GET['message']) { $message = $messages[$_GET['message']]; $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); } $options = get_option('rtl_theme_maker_options'); $title = __('RTL Theme Maker', 'rtl_theme_maker'); $example_text = isset($options['example_text']) ? stripcslashes($options['example_text']) : ''; ?> <div class="wrap"> <?php
public function doUpdate() { @set_time_limit(0); //?document_root? $cannotWrite = 0; $notSupportZip = 0; if (!class_exists('ZipArchive')) { //$this->error('您的服务器不支持php zip扩展,请配置好此扩展再来升级',U('System/main')); $notSupportZip = 1; } if (!isset($_GET['ignore'])) { if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/PigCms')) { $cannotWrite = 1; $this->error('您的服务器PigCms文件夹不可写入,设置好再升级', U('System/main')); } if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/PigCms/Lib/Action')) { $cannotWrite = 1; $this->error('您的服务器/PigCms/Lib/Action文件夹不可写入,设置好再升级', U('System/main')); } if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/tpl')) { $this->error('您的服务器tpl文件夹不可写入,设置好再升级', U('System/main')); } if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/tpl/User/default')) { $this->error('您的服务器/tpl/User/default文件夹不可写入,设置好再升级', U('System/main')); } } /* require_once('test.php'); if (!class_exists('test')){ $this->success('检查更新',U('System/doSqlUpdate')); } */ // $now = time(); $updateRecord = M('System_info')->order('lastsqlupdate DESC')->find(); $key = $this->key; $url = $this->server_url . 'server.php?key=' . $key . '&lastversion=' . $updateRecord['version'] . '&domain=' . $this->topdomain . '&dirtype=' . $this->dirtype; $remoteStr = @pigcms_getcontents($url); // $rt = json_decode($remoteStr, 1); if (intval($rt['success']) < 1) { if (intval($rt['success']) == 0) { if (!isset($_GET['ignore'])) { $this->success('继续检查更新了,不要关闭,跳是正常的' . $rt['msg'], U('System/doSqlUpdate')); } else { $this->success('继续检查更新了,不要关闭,跳是正常的' . $rt['msg'], U('System/doSqlUpdate', array('ignore' => 1))); } } else { $this->success($rt['msg'], U('System/main')); } } else { file_put_contents(CONF_PATH . $rt['fileid'] . '.txt', json_encode($rt)); $locationZipPath = CONF_PATH . $rt['fileid'] . '_' . $now . '.zip'; //$filename=$this->server_url.'server.php?getFile=1&key='.$key.'&lastversion='.$updateRecord['version'].'&domain='.$this->topdomain.'&dirtype='.$this->dirtype; $filename = $this->server_url2 . $rt['filepath']; $fileStr = @pigcms_getcontents($filename); if (!$fileStr) { $fileStr = @file_get_contents($filename); } if (!$fileStr) { $this->error('竟然获取不到文件'); } file_put_contents(CONF_PATH . $rt['fileid'] . '.txt', json_encode($rt)); file_put_contents($locationZipPath, $fileStr); // $cacheUpdateDirName2 = 'caches_upgrade' . date('Ym', time()); $cacheUpdateDirName = 'caches_upgrade' . date('Ymd', time()) . time(); if ($notSupportZip) { $archive = new PclZip($locationZipPath); if ($archive->extract(PCLZIP_OPT_PATH, CONF_PATH . $cacheUpdateDirName, PCLZIP_OPT_REPLACE_NEWER) == 0) { $this->error("Error : " . $archive->errorInfo(true)); } } else { $zip = new ZipArchive(); $rs = $zip->open($locationZipPath); if ($rs !== TRUE) { $err = '解压失败_2!Error Code:' . $rs . '!'; //$this->error('解压失败_2!Error Code:'. $rs); } } // if (!file_exists(CONF_PATH . $cacheUpdateDirName)) { @mkdir(CONF_PATH . $cacheUpdateDirName, 0777); @mkdir(CONF_PATH . $cacheUpdateDirName2, 0777); } // if (!$notSupportZip) { $zip->extractTo(CONF_PATH . $cacheUpdateDirName); $zip->extractTo(CONF_PATH . $cacheUpdateDirName2); $zip->close(); } recurse_copy(CONF_PATH . $cacheUpdateDirName, $_SERVER['DOCUMENT_ROOT']); //delete if (!$cannotWrite) { deletedir(CONF_PATH . $cacheUpdateDirName); } //@unlink($locationZipPath); //record to database if ($rt['time']) { M('System_info')->where(array('version' => $updateRecord['version']))->save(array('version' => $rt['time'])); M('Update_record')->add(array('msg' => $rt['msg'], 'time' => $rt['time'], 'type' => $rt['type'])); } if (isset($_GET['ignore'])) { $this->success($err . '进入下一步(不要关闭,等待完成,跳是正常的):' . $rt['msg'], U('System/doUpdate', array('ignore' => 1))); } else { $this->success($err . '进入下一步(不要关闭,等待完成,跳是正常的):' . $rt['msg'], U('System/doUpdate')); } } }
public function createImageThumbnails() { recurse_copy(PIMCORE_PLUGINS_PATH . "/CoreShop/install/thumbnails/image", PIMCORE_WEBSITE_PATH . "/var/config/imagepipelines", true); }
function recurse_copy($src, $dst) { $dir = opendir($src); @mkdir($dst); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($src . '/' . $file)) { recurse_copy($src . '/' . $file, $dst . '/' . $file); } else { echo "Copying {$src}/{$file} -> {$dst}/{$file} ... "; if (copy($src . '/' . $file, $dst . '/' . $file)) { echo "Done.\n"; } else { return false; } } } } closedir($dir); return true; }
public function doUpdate() { $cannotWrite = 0; if (!class_exists('ZipArchive')) { $this->error('您的服务器不支持php zip扩展,请配置好此扩展再来升级', U('System/main')); } if (!isset($_GET['ignore'])) { if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/PigCms')) { $cannotWrite = 1; $this->error('您的服务器PigCms文件夹不可写入,设置好再升级', U('System/main')); } if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/PigCms/Lib/Action')) { $cannotWrite = 1; $this->error('您的服务器/PigCms/Lib/Action文件夹不可写入,设置好再升级', U('System/main')); } if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/tpl')) { $this->error('您的服务器tpl文件夹不可写入,设置好再升级', U('System/main')); } if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/tpl/User/default')) { $this->error('您的服务器/tpl/User/default文件夹不可写入,设置好再升级', U('System/main')); } } $now = time(); $updateRecord = M('System_info')->order('lastsqlupdate DESC')->find(); $key = $this->key; $url = $this->server_url . 'server.php?key=' . $key . '&lastversion=' . $updateRecord['version'] . '&domain=' . $this->topdomain . '&dirtype=' . $this->dirtype; $remoteStr = @pigcms_getcontents($url); $rt = json_decode($remoteStr, 1); if (intval($rt['success']) < 1) { if (intval($rt['success']) == 0) { if (!isset($_GET['ignore'])) { $this->success('继续检查更新了,不要关闭,跳是正常的' . $rt['msg'], U('System/doSqlUpdate')); } else { $this->success('继续检查更新了,不要关闭,跳是正常的' . $rt['msg'], U('System/doSqlUpdate', array('ignore' => 1))); } } else { $this->success($rt['msg'], U('System/main')); } } else { $locationZipPath = RUNTIME_PATH . $now . '.zip'; $filename = $this->server_url . 'server.php?getFile=1&key=' . $key . '&lastversion=' . $updateRecord['version'] . '&domain=' . $this->topdomain . '&dirtype=' . $this->dirtype; @file_put_contents($locationZipPath, @pigcms_getcontents($filename)); $zip = new ZipArchive(); $rs = $zip->open($locationZipPath); if ($rs !== TRUE) { $this->error('解压失败_2!Error Code:' . $rs); } $cacheUpdateDirName = 'caches_upgrade' . date('Ymd', time()); if (!file_exists(RUNTIME_PATH . $cacheUpdateDirName)) { @mkdir(RUNTIME_PATH . $cacheUpdateDirName, 0777); } $zip->extractTo(RUNTIME_PATH . $cacheUpdateDirName); recurse_copy(RUNTIME_PATH . $cacheUpdateDirName, $_SERVER['DOCUMENT_ROOT']); $zip->close(); if (!$cannotWrite) { @deletedir(RUNTIME_PATH . $cacheUpdateDirName); } @unlink($locationZipPath); if ($rt['time']) { M('System_info')->where(array('version' => $updateRecord['version']))->save(array('version' => $rt['time'])); M('Update_record')->add(array('msg' => $rt['msg'], 'time' => $rt['time'], 'type' => $rt['type'])); } if (isset($_GET['ignore'])) { $this->success('进入下一步(不要关闭,等待完成,跳是正常的):' . $rt['msg'], U('System/doUpdate', array('ignore' => 1))); } else { $this->success('进入下一步(不要关闭,等待完成,跳是正常的):' . $rt['msg'], U('System/doUpdate')); } } }
<?php include '../../config.php'; # Include all function include 'includes/function.php'; $path = $_POST['path']; $new_path = $_POST['new_path']; $dir_file_name = substr($path, strlen(dirname($path)) + 1); if (isset($_POST['move'])) { rename($path, dontEraseMe($ADRESS . $new_path . $dir_file_name)); } else { if (is_file($path)) { copy($path, dontEraseMe($ADRESS . $new_path . $dir_file_name)); } else { recurse_copy($path, dontEraseMe($ADRESS . $new_path . $dir_file_name)); } } $adress = $URL . '/index.php?dir=' . substr(dirname($path), strlen($ADRESS) + 1) . '/'; header('Location: ' . $adress); exit;