set_time_limit(0); require_once 'config.inc.php'; require_once 'include/utils/utils.php'; require_once 'include/database/PearDatabase.php'; require 'copydirr.inc.php'; require 'modules/Memdays/MemdaysDataPopulator.php'; global $root_directory; global $adb; /// if (isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '') { $current_language = $_SESSION['authenticated_user_language']; } else { $current_language = $default_language; } copydirr($root_directory . "modules/Memdays/Smarty/templates/", $root_directory . "Smarty/templates/"); //增加cache/application/language/zh_cn.lang.php中所需要的选项 $language_file_path = $root_directory . "cache/application/language/" . $current_language . ".lang.php"; if (!is_file($language_file_path)) { touch($language_file_path); } $language_file_path = $root_directory . "cache/application/language/" . $current_language . ".lang.php"; if (!is_file($language_file_path)) { touch($language_file_path); } if (is_writable($language_file_path)) { $custom_app_strings = return_custom_application_language($current_language); $custom_applist_strings = return_custom_app_list_strings_language($current_language); if (is_array($custom_app_strings) && count($custom_app_strings) > 0 || is_array($custom_applist_strings) && count($custom_applist_strings) > 0) { $bk = chr(10); // The sign of line break
$libraries = array('net', 'serial', 'video', 'dxf', 'pdf', 'sound', 'io'); $lib_dir = DISTDIR . 'libraries'; // Create Library index $index = CONTENTDIR . "api_en/libraries/index.html"; $page = new LocalPage('Libraries', 'Libraries', 'Libraries', '../'); $page->content(file_get_contents($index)); writeFile('distribution/libraries/index.html', $page->out()); // For each Library foreach ($libraries as $lib) { $source = "api_en/LIB_{$lib}"; $destination = "libraries/{$lib}"; //make_necessary_directories(DISTDIR.$destination.'/images/include'); $index = CONTENTDIR . $source . '/index.html'; $page = new LocalPage(ucfirst($lib) . ' \\ Libraries', 'Libraries', 'Libraries', '../../'); $page->content(file_get_contents($index)); writeFile('distribution/' . $destination . '/index.html', $page->out()); } if (is_dir(DISTDIR . 'libraries/images')) { rmdir(DISTDIR . 'libraries/images'); } mkdir(DISTDIR . 'libraries/images', 0755); copydirr(CONTENTDIR . "api_en/libraries/images", DISTDIR . 'libraries/images'); $benchmark_end = microtime_float(); $execution_time = round($benchmark_end - $benchmark_start, 4); ?> <h2>Local library generation successful!</h2> <p>Generated files in <?php echo $execution_time; ?> seconds.</p>
function copy_media() { if (file_exists($this->data_dir)) { if (!copydirr($this->data_dir, EXAMPLESDIR . '/')) { echo "Could not copy" . EXAMPLESDIR . '/' . "<br />"; } } else { //echo "No data here: " . $this->data_dir . "<br />"; } }
<?php require_once '../config.php'; require_once 'lib/Translation.class.php'; require_once './contributions.php'; $benchmark_start = microtime_float(); $tools_dir = 'reference/tools'; $index = CONTENTDIR . "api_en/tools/index.html"; $page = new Page('Tools', 'Tools', 'Tools'); $page->content(file_get_contents($index)); //make_necessary_directories(BASEDIR.$tools_dir.'/images/include.php'); writeFile($tools_dir . '/index.html', $page->out()); if (!is_dir(BASEDIR . $tools_dir . '/images')) { mkdir(BASEDIR . $tools_dir . '/images', 0757); } copydirr(CONTENTDIR . "api_en/tools/images", BASEDIR . $tools_dir . '/images'); // copy over the files for the contributed libraries copy(CONTENTDIR . "static/tools.html", BASEDIR . $tools_dir . '/tools.html'); $benchmark_end = microtime_float(); $execution_time = round($benchmark_end - $benchmark_start, 4); ?> <h2>Tool Generation Successful</h2> <p>Generated files in <?php echo $execution_time; ?> seconds.</p>
function copydirr($fromDir, $toDir, $chmod = 0757, $verbose = false) { //* Check for some errors $errors = array(); $messages = array(); if (!is_writable($toDir)) { $errors[] = 'target ' . $toDir . ' is not writable'; } if (!is_dir($toDir)) { $errors[] = 'target ' . $toDir . ' is not a directory'; } if (!is_dir($fromDir)) { $errors[] = 'source ' . $fromDir . ' is not a directory'; } if (!empty($errors)) { if ($verbose) { foreach ($errors as $err) { echo '<strong>Error</strong>: ' . $err . '<br />'; } } return false; } //*/ $exceptions = array('.', '..'); //* Processing $handle = opendir($fromDir); while (false !== ($item = readdir($handle))) { if (!in_array($item, $exceptions)) { //* cleanup for trailing slashes in directories destinations $from = str_replace('//', '/', $fromDir . '/' . $item); $to = str_replace('//', '/', $toDir . '/' . $item); //*/ if (is_file($from)) { if (@copy($from, $to)) { chmod($to, $chmod); touch($to, filemtime($from)); // to track last modified time $messages[] = 'File copied from ' . $from . ' to ' . $to; } else { $errors[] = 'cannot copy file from ' . $from . ' to ' . $to; } } if (is_dir($from)) { if (@mkdir($to)) { chmod($to, $chmod); $messages[] = 'Directory created: ' . $to; } else { $errors[] = 'cannot create directory ' . $to; } copydirr($from, $to, $chmod, $verbose); } } } closedir($handle); //*/ //* Output if ($verbose) { foreach ($errors as $err) { echo '<strong>Error</strong>: ' . $err . '<br />'; } foreach ($messages as $msg) { echo $msg . '<br />'; } } //*/ return true; }
<?php require_once '../config.php'; require_once 'lib/Translation.class.php'; $benchmark_start = microtime_float(); $tools_dir = DISTDIR . 'tools'; // Create Tools index $index = CONTENTDIR . "api_en/tools/index.html"; $page = new LocalPage('Tools', 'Tools', 'Tools', '../'); $page->content(file_get_contents($index)); writeFile('distribution/tools/index.html', $page->out()); // Create folder for images and copy them over if (is_dir(DISTDIR . 'tools/images')) { rmdir(DISTDIR . 'tools/images'); } mkdir(DISTDIR . 'tools/images', 0755); copydirr(CONTENTDIR . 'api_en/tools/images', DISTDIR . 'tools/images'); // Copy file for the contributed Tools require_once './contributions.php'; copy(CONTENTDIR . "static/tools.html", DISTDIR . 'tools/tools.html'); $benchmark_end = microtime_float(); $execution_time = round($benchmark_end - $benchmark_start, 4); ?> <h2>Local tool generation successful!</h2> <p>Generated files in <?php echo $execution_time; ?> seconds.</p>
$source = CONTENTDIR; $path = BASEDIR; $where = CONTENTDIR; $there = CONTENTDIR; putenv('HOME=' . CONTENTDIR); //`cd $there && /usr/bin/svn update curated.xml`; //`cd $there && /usr/bin/svn update curated_images/`; // Switch from SVN to GIT, 14 FEB 2013 // Disabled for now, so we can test generate scripts without pulling latest from repo. -SM //`cd $path && /usr/bin/git pull https://github.com/processing/processing-docs/`; // Copy over the images for the tutorials index if (!is_dir($path . 'exhibition/images')) { mkdir($path . 'exhibition/images', '0757'); } if (is_dir($path . 'exhibition/images')) { copydirr($source . 'curated_images', $path . 'exhibition/images', null, 0757, true); } /******************************************** CURATED ***/ function get_curated($curated, $start = 0, $num = 12) { // output html $html = '<table width="448" cellspacing="0" cellpadding="0" border="0">'; $j = 0; for ($i = $start; $i < $start + $num; $i++) { if ($curated[$i]) { if ($j % 2 == 0) { $html .= '<tr>'; } $html .= '<td>' . $curated[$i]->display() . '</td>'; if ($j % 2 != 0) { $html .= '</tr>';
/** * This file is responsible for * - unpacking the archives inside of the component directories * - running SQL updates * - finishing the installation * * @version $Id: install.php 1388 2008-04-23 17:58:17Z soeren_nb $ * @package VirtueMart * @subpackage core * @copyright Copyright (C) 2004-2008 soeren - All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ function installvirtuemart($install_type, $install_sample_data = false) { global $database, $mosConfig_absolute_path, $mosConfig_mailfrom, $VM_LANG, $mosConfig_dirperms, $mosConfig_live_site; @ini_set('memory_limit', '32M'); if (empty($mosConfig_mailfrom)) { $mosConfig_mailfrom = "*****@*****.**"; } $messages = array(); $frontend_dir = $mosConfig_absolute_path . "/components/com_virtuemart"; $frontend_file = $frontend_dir . "/frontend_files.tar.gz"; $admin_dir = $mosConfig_absolute_path . "/administrator/components/com_virtuemart"; $admin_file = $admin_dir . "/admin_files.tar.gz"; // Check if the Archives are there if (file_exists($frontend_file) && file_exists($admin_file)) { echo '<div align="left" style="max-height:200px;overflow:auto;border:#ccca43;background-color:#fcff88;"><h2>Atualizar Log</h2>'; /** UNPACK THE ARCHIVES **/ require_once $mosConfig_absolute_path . "/administrator/components/com_virtuemart/Tar.php"; // Workaround for Window$ if (strstr($mosConfig_absolute_path, ":")) { $path_begin = substr($mosConfig_absolute_path, strpos($mosConfig_absolute_path, ":") + 1, strlen($mosConfig_absolute_path)); $mosConfig_absolute_path = str_replace("//", "/", $path_begin); } // Now let's re-declare the paths for Window$ $frontend_dir = $mosConfig_absolute_path . "/components/com_virtuemart"; $frontend_file = $frontend_dir . "/frontend_files.tar.gz"; $admin_dir = $mosConfig_absolute_path . "/administrator/components/com_virtuemart"; $admin_file = $admin_dir . "/admin_files.tar.gz"; $frontend = $backend = false; $frontend_archive = new Archive_Tar($frontend_file, "gz"); $admin_archive = new Archive_Tar($admin_file, "gz"); /* Don't show errors for either version of Joomla right now * The install displays errors even on a successful installation // Don't show errors on Joomla! 1.5 (errors appear even on a successful extraction) // if( !class_exists( 'JConfig' ) ) { // $frontend_archive->setErrorHandling(PEAR_ERROR_PRINT); // $admin_archive->setErrorHandling(PEAR_ERROR_PRINT); // } * */ // Extract the files $frontend_result = $frontend_archive->extract($frontend_dir . '/'); $backend_result = $admin_archive->extract($admin_dir . '/'); // Just say everything went well $frontend_result = $backend_result = true; // Assume the extraction was successfull for Joomla! 1.5 if (class_exists('JConfig')) { $frontend_result = $backend_result = true; } if ($frontend_result) { $frontend = true; $messages[] = "Arquivos do Frontend extraídos com sucesso."; if (@unlink($frontend_file)) { $messages[] = "Arquivos do Frontend excluídos com sucesso."; } } if ($backend_result) { $backend = true; $messages[] = "Arquivos do Backend extraídos com sucesso"; if (@unlink($admin_file)) { $messages[] = "Arquivos do Backend excluídos com sucesso."; } } if (!$frontend || !$backend) { echo "<span class=\"message\">Ocorreram erros ao decompactar os arquivos.</span>"; } /** END UNPACKING ARCHIVES */ } elseif (!is_dir($frontend_dir . "/js") || !is_dir($admin_dir . "/classes")) { die("<span class=\"message\"><strong>ERRO!<br/>\n\t\ta)</strong> No Archive Files and <br/>\n\t\t<strong>b)</strong> no directory structure for VirtueMart.<br/><br/>\n\t\tO que há de errado? Ou você descompacta todos os arquivos e faça upload deles ou (você pode instalar com o Safe Mode em OFF).\n\t\t</span>"); } if (!file_exists($admin_dir . '/classes/ps_database.php') || !file_exists($admin_dir . '/sql/sql.virtuemart.php')) { echo '<h2>Erro Crítico:</h2> <p class="message">Alguns arquivos principais do VirtueMart estão faltando, mas eles são necessários para instalar e executar o VirtueMart. Se você receber esta mensagem, é recomendável a <a href="http://virtuemart.net/documentation/User_Manual/Manual_Installation.html" target="_blank">leitura do Manual de Instalação</a> do VirtueMart!</p> <p><a href="index2.php">Clique aqui para retornar ao Joomla!</a></p>'; exit; } require $admin_dir . '/classes/ps_database.php'; $db = new ps_DB(); defined('VM_TABLEPREFIX') or define('VM_TABLEPREFIX', 'vm'); /** * Query SECTION * */ // UPDATE FROM mambo-phpShop 1.1 if ($install_type == 'update11') { include_once $admin_dir . "/sql/sql.update.from.mambo-phpshop-1.1.php"; include_once $admin_dir . "/sql/sql.update.from.mambo-phpshop-1.2-RC2.to.1.2-stable-pl3.php"; include_once $admin_dir . "/sql/sql.update.mambo-phpshop-1.2-stable-pl3.to.virtuemart.php"; include_once $admin_dir . "/sql/sql.update.virtuemart-1.0.x.to.virtuemart-1.0.3.php"; include_once $admin_dir . "/sql/sql.update.VM-1.0.x_to_VM-1.1.0.php"; } elseif ($install_type == 'update12') { include_once $admin_dir . "/sql/sql.update.from.mambo-phpshop-1.2-RC2.to.1.2-stable-pl3.php"; include_once $admin_dir . "/sql/sql.update.mambo-phpshop-1.2-stable-pl3.to.virtuemart.php"; include_once $admin_dir . "/sql/sql.update.virtuemart-1.0.x.to.virtuemart-1.0.3.php"; include_once $admin_dir . "/sql/sql.update.VM-1.0.x_to_VM-1.1.0.php"; } elseif ($install_type == 'update12pl3') { include_once $admin_dir . "/sql/sql.update.mambo-phpshop-1.2-stable-pl3.to.virtuemart.php"; include_once $admin_dir . "/sql/sql.update.virtuemart-1.0.x.to.virtuemart-1.0.3.php"; include_once $admin_dir . "/sql/sql.update.VM-1.0.x_to_VM-1.1.0.php"; } elseif ($install_type == 'updatevm10x') { include_once $admin_dir . "/sql/sql.update.virtuemart-1.0.x.to.virtuemart-1.0.3.php"; include_once $admin_dir . "/sql/sql.update.virtuemart-1.0.3.to.virtuemart-1.0.5.php"; include_once $admin_dir . "/sql/sql.update.VM-1.0.x_to_VM-1.1.0.php"; } elseif ($install_type == 'newinstall') { /* Rename the cfg-dist file to cfg */ $dist_file = dirname(__FILE__) . "/virtuemart.cfg-dist.php"; $cfg_file = dirname(__FILE__) . "/virtuemart.cfg.php"; if (!@rename($dist_file, $cfg_file)) { $messages[] = "Erro Fatal: Ocorreu um erro ao RENOMEAR o ARQUIVO DE CONFIGURAÇÃO do VirtueMart!"; $messages[] = "Por favor, renomeie {$dist_file} para {$cfg_file} manualmente!!"; } require_once $admin_dir . '/sql/sql.virtuemart.php'; } // SAMPLE DATA! if ($install_sample_data) { include_once $admin_dir . '/sql/sql.sampledata.php'; } elseif ($install_type == 'newinstall') { /*** Delete the Sample Product - Images ***/ @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/1aa8846d3cfe3504b2ccaf7c23bb748f.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/1b0c96d67abdbea648cd0ea96fd6abcb.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/1ff5f2527907ca86103288e1b7cc3446.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/7a36a05526e93964a086f2ddf17fc609.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/8cb8d644ef299639b7eab25829d13dbc.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/8d886c5855770cc01a3b8a2db57f6600.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/9a4448bb13e2f7699613b2cfd7cd51ad.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/520efefd6d7977f91b16fac1149c7438.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/8147a3a9666aec0296525dbd81f9705e.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/8716aefc3b0dce8870360604e6eb8744.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/480655b410d98a5cc3bef3927e786866.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/578563851019e01264a9b40dcf1c4ab6.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/a04395a8aefacd9c1659ebca4dbfd4ba.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/b4a748303d0d996b29d5a1e1d1112537.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/c3a5bf074da14f30c849d13a2dd87d2c.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/c70a3f47baf9a4020aeeee919eb3fda4.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/cca3cd5db813ee6badf6a3598832f2fc.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/dccb8223891a17d752bfc1477d320da9.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/e614ba08c3ee0c2adc62fd9e5b9440eb.jpg"); @unlink($mosConfig_absolute_path . "/components/com_virtuemart/shop_image/product/ffd5d5ace2840232c8c32de59553cd8d.jpg"); } /** * mambo-phpShop => VirtueMart * * Section to copy your images, * and convert important entries * and place redirection files to keep your links * like &option=com_phpshop&product_id=1&Itemid=45 alive. */ if ($install_type != 'newinstall' && is_dir($mosConfig_absolute_path . '/components/com_phpshop')) { require_once $mosConfig_absolute_path . '/administrator/components/com_virtuemart/install.copy.php'; // COPY all Images from /componentes/com_phpshop/shop_image/* // TO /components/com_virtuemart/shop_image/* $fromDir = $mosConfig_absolute_path . '/components/com_phpshop/shop_image'; $toDir = $mosConfig_absolute_path . '/components/com_virtuemart/shop_image'; $perms = 0777; umask(022); copydirr($fromDir, $toDir, $perms, true); // COPY templates from /administrator/components/com_phpshop/templates // TO /administrator/components/com_virtuemart/templates $fromDir = $mosConfig_absolute_path . '/administrator/components/com_phpshop/html/templates'; $toDir = $mosConfig_absolute_path . '/administrator/components/com_virtuemart/html/templates'; copydirr($fromDir, $toDir, $perms, true); // COPY&RENAME the configuration file phpshop.cfg.php // TO virtuemart.cfg.php AND replace 'com_phpshop' by 'com_virtuemart' $fromDir = $mosConfig_absolute_path . '/administrator/components/com_phpshop'; $toDir = $mosConfig_absolute_path . '/administrator/components/com_virtuemart'; $config_contents = str_replace('com_phpshop', 'com_virtuemart', file_get_contents($fromDir . '/phpshop.cfg.php')); $config_contents .= "<?php\n@define('VM_TABLEPREFIX', 'vm' );\ndefine('VM_PRICE_SHOW_PACKAGING_PRICELABEL', '1' );\ndefine('VM_PRICE_SHOW_INCLUDINGTAX', '1' );\ndefine('VM_PRICE_ACCESS_LEVEL', 'Public Frontend' );\ndefine('VM_SILENT_REGISTRATION', '1');\n?>"; file_put_contents($toDir . '/virtuemart.cfg.php', $config_contents); // BACKUP // phpshop.php TO phpshop~.php. // AND phpshop_parser.php TO phpshop_parser~.php. $fromDir = $mosConfig_absolute_path . '/components/com_phpshop'; if (!is_writable($fromDir . '/phpshop.php')) { @chmod($fromDir . '/phpshop.php', '0777'); } if (!is_writable($fromDir . '/phpshop_parser.php')) { @chmod($fromDir . '/phpshop_parser.php', '0777'); } if (!rename($fromDir . '/phpshop.php', $fromDir . '/phpshop~.php')) { } // CREATE A NEW FILE 'phpshop.php', to handle permanent Redirect to // FROM index.php?option=com_phpshop&... // TO index.php?option=com_virtuemart&... $contents = "<?php\nif( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) {\n\tdie( 'Acesso direto a '.basename(__FILE__).' não é permitido.' );\n}\n\nglobal \$mosConfig_absolute_path;\n\n\$newURL = str_replace( 'com_phpshop', 'com_virtuemart', \$_SERVER['QUERY_STRING'] );\n\nheader( 'HTTP/1.1 301 Moved Permanently' );\nheader( 'Location: '.\$mosConfig_live_site.\"/\".basename( \$_SERVER['PHP_SELF'] ).'?'.\$newURL );\nexit();\n\n?>\n"; if (file_put_contents($fromDir . '/phpshop.php', $contents)) { $messages[] = "Estabelecido o redirecionamento dos links do antigo phpshop para os links do novo virtuemart"; } else { $messages[] = "Aviso: Não foi possível estabelecer o redirecionamento dos links do antigo phpshop para os links do novo virtuemart"; } rename($fromDir . '/phpshop_parser.php', $fromDir . '/phpshop_parser~.php'); $contents = "<?php\nif( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) {\n\tdie( 'Acesso direto a '.basename(__FILE__).' não é permitido.' );\n}\nglobal \$mosConfig_absolute_path;\n\ninclude( \$mosConfig_absolute_path.'/components/com_virtuemart/virtuemart_parser.php' );\n\n?>\n"; if (file_put_contents($fromDir . '/phpshop_parser.php', $contents)) { $messages[] = "Conexão estabelecida entre o antigo phpshop_parser e o novo virtuemart_parser"; } else { $messages[] = "Aviso: Não foi possível estabelecer uma conexão entre o antigo phpshop_parser e o novo virtuemart_parser"; } // DELETE the Admin-Link to "mambo-phpShop" in the Backend. // Note: You can delete the directories // /componentes/com_phpshop // AND /administrator/componentes/com_phpshop // with the mamboXplorer when no longer needed! $database->setQuery('DELETE FROM #__components WHERE link LIKE \'%option=com_phpshop%\''); $database->query(); } //Check if the VirtueMart component has an Entry in the Administration => Components Menu $database->setQuery("SELECT id FROM `#__components` WHERE `link` LIKE '%option=com_virtuemart%'"); $id = $database->loadResult(); if (empty($id)) { $database->setQuery("INSERT INTO `#__components` ( `id` , `name` , `link` , `menuid` , `parent` , `admin_menu_link` , `admin_menu_alt` , `option` , `ordering` , `admin_menu_img` , `iscore` )\n\t\t\t\t\t\t\tVALUES ('', 'VirtueMart', 'option=com_virtuemart', '0', '0', 'option=com_virtuemart', 'VirtueMart', 'com_virtuemart', '0', 'js/ThemeOffice/component.png', '0');"); $database->query(); } // Finally insert the version number into the database include_once $mosConfig_absolute_path . '/administrator/components/com_virtuemart/version.php'; global $VMVERSION; $VMVERSION = new vmVersion(); $database->setQuery('SELECT id FROM `#__components` WHERE name = \'virtuemart_version\''); $old_version = $database->loadResult(); if ($old_version) { $database->setQuery('UPDATE `#__components` SET params = \'RELEASE=' . $VMVERSION->RELEASE . ' DEV_STATUS=' . $VMVERSION->DEV_STATUS . '\' WHERE name = \'virtuemart_version\''); $database->query(); } else { $database->setQuery('INSERT INTO `#__components` (name, parent, params ) VALUES ( \'virtuemart_version\', 9999, \'RELEASE=' . $VMVERSION->RELEASE . ' DEV_STATUS=' . $VMVERSION->DEV_STATUS . '\')'); $database->query(); } if (!empty($messages)) { echo '<ul style="list-style-type: disc;list-style-position: inside;">'; foreach ($messages as $message) { echo "<li>{$message}</li>"; } echo '</ul>'; } echo '</div>'; }
<?php require_once '../config.php'; require 'lib/Translation.class.php'; $benchmark_start = microtime_float(); // make overview page $source = CONTENTDIR . "api_en/environment/"; $path = REFERENCEDIR . "/environment/"; make_necessary_directories($path . "images/file"); $page = new Page("Environment (IDE)", "Environment", "Environment", '../../'); $page->content(file_get_contents($source . "index.html")); $page->language("en"); writeFile('reference/environment/index.html', $page->out()); copydirr($source . '/images', $path . '/images'); $benchmark_end = microtime_float(); $execution_time = round($benchmark_end - $benchmark_start, 4); ?> <h2>Environment page generation Successful</h2> <p>Generated files in <?php echo $execution_time; ?> seconds.</p>
function uploadPackage() { $absolute_path = JPATH_ROOT; //echo $absolute_path; $userfile = JRequest::getVar('userfile', null, 'files', 'array'); if (!$userfile) { exit; } //echo $userfile_name; $msg = ''; move_uploaded_file($userfile['tmp_name'], $absolute_path . '/tmp/' . $userfile['name']); //$resultdir = uploadFile( $userfile['tmp_name'], $userfile['name'], $msg ); $msg = extractArchive($userfile['name']); if (file_exists($msg . "/swmenufree.xml")) { $upload_version = get_Version($msg . "/swmenufree.xml"); } else { $upload_version = 0; } // echo $msg; $current_version = get_Version($absolute_path . '/administrator/components/com_swmenufree/swmenufree.xml'); //echo $upload_version; if ($current_version < $upload_version) { if (copydirr($msg . "/admin/", $absolute_path . '/administrator/components/com_swmenufree', false)) { unlink($absolute_path . '/administrator/components/com_swmenufree/swmenufree.xml'); unlink($absolute_path . '/administrator/components/com_swmenufree/admin.swmenufree.php'); copy($msg . "/swmenufree.xml", $absolute_path . '/administrator/components/com_swmenufree/swmenufree.xml'); $message = _SW_COMPONENT_SUCCESS; } else { $message = _SW_COMPONENT_FAIL; } } else { $message = _SW_INVALID_FILE; } sw_deldir($msg); unlink($absolute_path . "/tmp/" . $userfile['name']); echo "<dl id=\"system-message\"><dt class=\"message\">Message</dt>\n\t\t<dd class=\"message message fade\"><ul><li>" . $message . "</li>\n\t </ul></dd></dl>\n"; //editCSS($id, $option); upgrade('com_swmenufree'); }
//`cd $where && /usr/bin/svn update libraries.html`; // Switch from SVN to GIT, 14 FEB 2013 `cd {$path} && /usr/bin/git pull https://github.com/processing/processing-web/`; $libraries = array('net', 'serial', 'video', 'dxf', 'pdf'); $lib_dir = REFERENCEDIR . 'libraries/'; // Create Index $index = CONTENTDIR . "api_en/libraries/index.html"; $page = new Page('Libraries', 'Libraries'); $page->content(file_get_contents($index)); make_necessary_directories(BASEDIR . $lib_dir . '/images/include.php'); writeFile($lib_dir . 'index.html', $page->out()); if (is_dir($lib_dir . 'images')) { rmdir($lib_dir . 'images'); } mkdir($lib_dir . 'images', 0755); copydirr(CONTENTDIR . "api_en/libraries/images", $lib_dir . 'images'); // copy over the file for the contributed libraries require_once './contributions.php'; copy(CONTENTDIR . "static/libraries.html", $lib_dir . 'libraries.html'); // For each Library foreach ($libraries as $lib) { $source = "api_en/LIB_{$lib}"; $destination = "libraries/{$lib}"; make_necessary_directories(REFERENCEDIR . $destination . '/images/include'); // template and copy index $index = CONTENTDIR . $source . '/index.html'; if ($lib == 'pdf' || $lib == 'dxf') { //$page = new Page(strtoupper($lib) . ' \\ Libraries', 'Libraries', 'Library-index'); $page = new Page(strtoupper($lib) . ' \\ Libraries', 'Libraries'); } else { //$page = new Page(ucfirst($lib) . ' \\ Libraries', 'Library-index');
<?php require_once '../config.php'; require 'lib/Translation.class.php'; $benchmark_start = microtime_float(); $source = CONTENTDIR . "api_en/environment/"; $path = DISTDIR . "/environment/"; $page = new LocalPage('Environment (IDE)', 'Environment', 'Environment', '../'); $page->content(file_get_contents($source . 'index.html')); $page->language('en'); writeFile($path . 'index.html', $page->out()); if (is_dir(DISTDIR . 'environment/images')) { rmdir(DISTDIR . 'environment/images'); } mkdir(DISTDIR . 'environment/images', 0755); copydirr($source . 'images', DISTDIR . 'environment/images'); $benchmark_end = microtime_float(); $execution_time = round($benchmark_end - $benchmark_start, 4); ?> <h2>Local environment page generation successful!</h2> <p>Generated files in <?php echo $execution_time; ?> seconds.</p>
if ($imgs == 'true') { $newpath = $path . 'tutorials/' . $directory . '/imgs'; if (!is_dir($newpath)) { mkdir($newpath, 0757); } if (is_dir($newpath)) { copydirr($source . $directory . '/imgs', $newpath, null, 0757, true); } } if ($code == 'true') { $newpath = $path . 'tutorials/' . $directory . '/code'; if (!is_dir($newpath)) { mkdir($newpath, 0757); } if (is_dir($newpath)) { copydirr($source . $directory . '/code', $newpath, null, 0757, true); } } } } $benchmark_end = microtime_float(); $execution_time = round($benchmark_end - $benchmark_start, 4); ?> <h2>Static page generation Successful</h2> <h2>Updated <?php echo $where; ?> </h2> <p>Generated files in <?php echo $execution_time;
copydirr($source . 'curves/code', $path . 'learning/curves/code', true, 0757, true); } $page = new Page("Anatomy", "Tutorials"); $page->content(file_get_contents($source . "anatomy/index.html")); writeFile('learning/anatomy/index.html', $page->out()); if (!is_dir($path . 'learning/anatomy/imgs')) { mkdir($path . 'learning/anatomy/imgs', '0757'); } if (is_dir($path . 'learning/anatomy/imgs')) { copydirr($source . 'anatomy/imgs', $path . 'learning/anatomy/imgs', null, 0757, true); } if (!is_dir($path . 'learning/anatomy/code')) { mkdir($path . 'learning/anatomy/code', '0757'); } if (is_dir($path . 'learning/anatomy/code')) { copydirr($source . 'anatomy/code', $path . 'learning/anatomy/code', true, 0757, true); } $benchmark_end = microtime_float(); $execution_time = round($benchmark_end - $benchmark_start, 4); ?> <h2>Static page generation Successful</h2> <h2>Updated <?php echo $where; ?> </h2> <p>Generated files in <?php echo $execution_time; ?> seconds.</p> <!--<p>Page put here: <?php
$page->content(file_get_contents($source . "books.html")); writeFile('books/index.html', $page->out()); // Copy over the errata file for Processing: A Programming Handbook... copy($source . 'processing-errata.txt', $path . 'books/processing-errata.txt'); // Copy over the media.zip file for Getting Started with Processing... copy($source . 'media.zip', $path . 'books/media.zip'); $page = new Page("Copyright", "Copyright"); $page->content(file_get_contents($source . "copyright.html")); writeFile('copyright.html', $page->out()); // Copy over the images for the shop index if (!is_dir($path . 'shop')) { mkdir($path . 'shop', 0757); } if (!is_dir($path . 'shop/imgs')) { mkdir($path . 'shop/imgs', 0757); } if (is_dir($path . 'shop/imgs')) { copydirr($source . 'shop/imgs', $path . 'shop/imgs', null, 0757, false); } $page = new Page("Shop", "Shop"); $page->content(file_get_contents($source . 'shop/' . "index.html")); writeFile('shop/index.html', $page->out()); $benchmark_end = microtime_float(); $execution_time = round($benchmark_end - $benchmark_start, 4); ?> <h2>Static page generation Successful</h2> <p>Generated files in <?php echo $execution_time; ?> seconds.</p>
function uploadPackage() { global $mainframe; $absolute_path = JPATH_ROOT; //echo $absolute_path; $userfile = JRequest::getVar('userfile', null, 'files', 'array'); if (!$userfile) { exit; } $userfile_name = $userfile['name']; //echo $userfile_name; $msg = ''; move_uploaded_file($userfile['tmp_name'], $absolute_path . '/media/' . $userfile['name']); //$resultdir = uploadFile( $userfile['tmp_name'], $userfile['name'], $msg ); $msg = extractArchive($userfile['name']); if (file_exists($msg . "/swmenupro.xml")) { $upload_version = get_Version($msg . "/swmenupro.xml"); } else { $upload_version = 0; } //echo $upload_version; //echo $msg."/swmenupro.xml"; $current_version = get_Version($absolute_path . '/administrator/components/com_swmenupro/swmenupro.xml'); //echo $current_version; if ($current_version < $upload_version) { if (copydirr($msg . "/admin/", $absolute_path . '/administrator/components/com_swmenupro', 0757, false)) { unlink($absolute_path . '/administrator/components/com_swmenupro/swmenupro.xml'); copy($msg . "/swmenupro.xml", $absolute_path . '/administrator/components/com_swmenupro/swmenupro.xml'); $message = _SW_COMPONENT_SUCCESS; } else { $message = _SW_COMPONENT_FAIL; } } else { $message = _SW_INVALID_FILE; } sw_deldir($msg); unlink($absolute_path . "/media/" . $userfile['name']); $mainframe->redirect("index.php?&option=com_swmenupro&task=upgrade", $message); }