Inheritance: extends Controller
    public function install()
    {
        $install = new Install($this->m_db);
        if ($install->init()) {
            echo '<h2>Installation succeeded.</h2>
						<p><a href="./">Go to application</a><p>';
        } else {
            echo '<h2>Installation failed.</h2>';
        }
    }
 public function testManageTicketClosed()
 {
     global $DB;
     $DB->connect();
     $Install = new Install();
     $Install->testInstall(0);
     $this->manageTicket();
     $this->states();
     $this->groups();
     $this->totaltimeEnddateOfTicket();
     $this->displayGroups();
 }
 /**
  * Executes the plug-in test.
  * @param $pluginCategory string
  * @param $pluginDir string
  * @param $pluginName string
  * @param $filterGroups array
  */
 protected function executePluginTest($pluginCategory, $pluginDir, $pluginName, $filterGroups)
 {
     // Make sure that the xml configuration is valid.
     $filterConfigFile = 'plugins/' . $pluginCategory . '/' . $pluginDir . '/filter/' . PLUGIN_FILTER_DATAFILE;
     $this->validateXmlConfig(array('./' . $filterConfigFile, './lib/pkp/' . $filterConfigFile));
     // Make sure that data from earlier tests is being deleted first.
     $filterDao =& DAORegistry::getDAO('FilterDAO');
     /* @var $filterDao FilterDAO */
     foreach ($filterGroups as $filterGroupSymbolic) {
         foreach ($filterDao->getObjectsByGroup($filterGroupSymbolic) as $filter) {
             $filterDao->deleteObject($filter);
         }
         foreach ($filterDao->getObjectsByGroup($filterGroupSymbolic, 0, true) as $filter) {
             $filterDao->deleteObject($filter);
         }
     }
     $filterGroupDao =& DAORegistry::getDAO('FilterGroupDAO');
     /* @var $filterGroupDao FilterGroupDAO */
     foreach ($filterGroups as $filterGroupSymbolic) {
         $filterGroupDao->deleteObjectBySymbolic($filterGroupSymbolic);
     }
     // Mock request and router.
     import('lib.pkp.classes.core.PKPRouter');
     import('classes.core.Request');
     $mockRequest = $this->getMock('Request', array('getRouter', 'getUser'));
     $router = new PKPRouter();
     $mockRequest->expects($this->any())->method('getRouter')->will($this->returnValue($router));
     $mockRequest->expects($this->any())->method('getUser')->will($this->returnValue(null));
     Registry::set('request', $mockRequest);
     // Instantiate the installer.
     import('classes.install.Install');
     $installFile = './lib/pkp/tests/plugins/testPluginInstall.xml';
     $params = $this->getConnectionParams();
     $installer = new Install($params, $installFile, true);
     // Parse the plug-ins version.xml.
     import('lib.pkp.classes.site.VersionCheck');
     self::assertFileExists($versionFile = './plugins/' . $pluginCategory . '/' . $pluginDir . '/version.xml');
     self::assertArrayHasKey('version', $versionInfo =& VersionCheck::parseVersionXML($versionFile));
     self::assertType('Version', $pluginVersion =& $versionInfo['version']);
     $installer->setCurrentVersion($pluginVersion);
     // Install the plug-in.
     self::assertTrue($installer->execute());
     // Reset the hook registry.
     Registry::set('hooks', $nullVar = null);
     // Test whether the installation is idempotent.
     self::assertTrue($installer->execute());
     // Test whether the filter groups have been installed.
     foreach ($filterGroups as $filterGroupSymbolic) {
         // Check the group.
         self::assertType('FilterGroup', $filterGroupDao->getObjectBySymbolic($filterGroupSymbolic), $filterGroupSymbolic);
     }
 }
示例#4
0
/**
 * Initialize database constants to connect
 *
 * @param Install $install Installer
 *
 * @return void
 */
function initDbConstants($install)
{
    define('TYPE_DB', $install->getDbType());
    define('PREFIX_DB', $install->getTablesPrefix());
    define('USER_DB', $install->getDbUser());
    define('PWD_DB', $install->getDbPass());
    define('HOST_DB', $install->getDbHost());
    define('PORT_DB', $install->getDbPort());
    define('NAME_DB', $install->getDbName());
}
示例#5
0
 /**
  * Test
  *
  * @return void
  */
 public function testOnBootstrap()
 {
     $oldAdapter = GlobalAdapterFeature::getStaticAdapter();
     $this->config->setValue('debug_is_active', 1);
     $this->config->setValue('session_lifetime', 3600);
     $this->config->setValue('cookie_domain', 'got-cms.com');
     $this->config->setValue('session_handler', CoreConfig::SESSION_DATABASE);
     $this->assertNull($this->object->onBootstrap(Registry::get('Application')->getMvcEvent()));
     GlobalAdapterFeature::setStaticAdapter($oldAdapter);
 }
示例#6
0
 private function dbLink()
 {
     if (!empty($this->error)) {
         return false;
     }
     try {
         self::$dbh = new PDO("mysql:host=" . $this->options['dbHost'] . ";dbname=" . $this->options['dbName'], $this->options['dbUser'], $this->options['dbPass']);
         self::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
         $this->error = '<div class="alert alert-error">' . _('Database error: ') . $e->getMessage() . '</div>';
     }
     $this->existingTables();
 }
示例#7
0
function main($ini_file)
{
    $install = new Install($ini_file);
    $response = $install->step1();
    if (is_array($response)) {
        $install->print_errors($response);
    }
    $response = $install->step2();
    if (is_array($response)) {
        $install->print_errors($response);
    }
    $response = $install->step3();
    if (is_array($response)) {
        $install->print_errors($response);
    }
    $response = $install->step4();
    if (is_array($response)) {
        $install->print_errors($response);
    }
    exit(1);
}
 /**
  * Perform installation.
  */
 function install()
 {
     $installer = new Install($this->params);
     $installer->setLogger($this);
     if ($installer->execute()) {
         if (count($installer->getNotes()) > 0) {
             printf("\nRelease Notes\n");
             printf("----------------------------------------\n");
             foreach ($installer->getNotes() as $note) {
                 printf("%s\n\n", $note);
             }
         }
         if (!$installer->wroteConfig()) {
             printf("\nNew config.inc.php:\n");
             printf("----------------------------------------\n");
             echo $installer->getConfigContents();
             printf("----------------------------------------\n");
         }
         $newVersion =& $installer->getNewVersion();
         printf("Successfully installed version %s\n", $newVersion->getVersionString(false));
     } else {
         printf("ERROR: Installation failed: %s\n", $installer->getErrorString());
     }
 }
 /**
  * Singleton.
  */
 protected function init()
 {
     $install = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_install', Install::get_called_class());
     $uninstall = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_uninstall', Uninstall::get_called_class());
     $update = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_update', Update::get_called_class());
     $admin = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_admin', Admin::get_called_class());
     $shortcode = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_shortcode', ShortCode::get_called_class());
     $view = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_view', View::get_called_class());
     $install::get_instance();
     $uninstall::get_instance();
     $update::get_instance();
     $admin::get_instance();
     $shortcode::get_instance();
     $view::get_instance();
     add_image_size(VA_SOCIALBUZZ_PREFIX . 'thumbnail', '980', '9999', false);
     // Recommend you don't use this short code registering your own post data.
     add_shortcode('socialbuzz', array(&$this, 'add_shortcode'));
     if (!is_admin()) {
         add_action('wp_enqueue_scripts', array(&$this, 'wp_enqueue_scripts'), 15);
         add_filter('the_content', array(&$this, 'the_content'));
     }
 }
示例#10
0
文件: DB.php 项目: phpscr/usvn
    protected function setUp()
    {
        parent::setUp();
        $params = array('host' => 'localhost', 'username' => 'usvn-test', 'password' => 'usvn-test', 'dbname' => 'usvn-test');
        if (getenv('DB') == "PDO_SQLITE" || getenv('DB') === false) {
            $this->_clean();
            Install::installDb('tests/db.ini', dirname(__FILE__) . '/../../SQL/', 'localhost', 'usvn-test', 'usvn-test', 'tests/usvn.db', 'usvn_', 'PDO_SQLITE', false);
            $params['dbname'] = "tests/usvn.db";
            $this->db = Zend_Db::factory('PDO_SQLITE', $params);
            file_put_contents('tests/test.ini', '
database.adapterName = "PDO_SQLITE"
database.prefix = "usvn_"
database.options.host = "localhost"
database.options.username = "******"
database.options.password = "******"
database.options.dbname = "' . getcwd() . '/tests/usvn.db"
subversion.passwd = "' . getcwd() . '/tests/htpasswd"
', FILE_APPEND);
        } else {
            $this->db = Zend_Db::factory(getenv('DB'), $params);
            $this->_clean();
            Install::installDb('tests/db.ini', dirname(__FILE__) . '/../../SQL/', 'localhost', 'usvn-test', 'usvn-test', 'usvn-test', 'usvn_', getenv('DB'), false);
            file_put_contents('tests/test.ini', '
database.adapterName = "' . getenv('DB') . '"
database.prefix = "usvn_"
database.options.host = "localhost"
database.options.username = "******"
database.options.password = "******"
database.options.dbname = "usvn-test"
subversion.passwd = "' . getcwd() . '/tests/htpasswd"
', FILE_APPEND);
        }
        Zend_Db_Table::setDefaultAdapter($this->db);
        USVN_Db_Table::$prefix = "usvn_";
        $config = new USVN_Config_Ini('tests/test.ini', 'general');
        Zend_Registry::set('config', $config);
    }
示例#11
0
<?php

require_once '__conf.php';
require_once 'inc/Connection.class.php';
require_once 'inc/Install.class.php';
require_once 'inc/ServiceTree.class.php';
session_start();
function_exists('curl_init') or die('cURL module not found.');
$dbh = Connection::GetDatabase();
Install::CheckDbTables($dbh);
$colors = ServiceTree::GetColors($dbh);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<link rel="icon" type="image/x-icon" href="img/favicon.ico"/>
	<?php 
require_once 'i18n/i18n.php';
i18n_set_map('en', $LANG);
?>
	<style type="text/css">
		html,body { height:100%; margin:0; overflow:hidden; }
		body,table,input,select { font:10pt Arial; color:#181818; }
		a { color:#1853AD; }
		a:hover { color:#FE5E00; }
		hr { height:1px; border:0; color:#CCC; background-color:#CCC; }
		div#theBigOne { width:100%; height:100%; background:url('img/serpro.png') no-repeat bottom right; }
		#treeLoading { position:fixed; top:50%; left:50%; margin-top:-75px; margin-left:-75px; }
		/*canvas#treePlot { width:100%; height:100%; }*/
示例#12
0
 /**
  *
  */
 private function initTranslator()
 {
     if (isset($_GET['lang']) && (file_exists("installer/lang/" . $_GET['lang'] . ".php") || $_GET['lang'] == "en")) {
         self::$lang = $_GET['lang'];
         $_SESSION['lang'] = self::$lang;
     } else {
         if (isset($_SESSION['lang']) && (file_exists("installer/lang/" . $_SESSION['lang'] . ".php") || $_SESSION['lang'] == "en")) {
             self::$lang = $_SESSION['lang'];
         } else {
             self::$lang = "en";
         }
     }
     if (self::$lang !== "en") {
         self::$langTexts = (include "installer/lang/" . self::$lang . ".php");
     }
 }
 /**
  * Installs the uploaded plugin
  * @param $path string path to plugin Directory
  * @param $templateMgr reference to template manager
  * @return boolean
  */
 function installPlugin($path, &$templateMgr)
 {
     $this->validate();
     $versionFile = $path . VERSION_FILE;
     $templateMgr->assign('error', true);
     $templateMgr->assign('pageHierarchy', $this->setBreadcrumbs(true));
     $pluginVersion =& VersionCheck::getValidPluginVersionInfo($versionFile, $templateMgr);
     if (is_null($pluginVersion)) {
         return false;
     }
     assert(is_a($pluginVersion, 'Version'));
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     /* @var $versionDao VersionDAO */
     $installedPlugin = $versionDao->getCurrentVersion($pluginVersion->getProductType(), $pluginVersion->getProduct(), true);
     if (!$installedPlugin) {
         $pluginLibDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . strtr($pluginVersion->getProductType(), '.', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $pluginVersion->getProduct();
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . strtr($pluginVersion->getProductType(), '.', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $pluginVersion->getProduct();
         // Copy the plug-in from the temporary folder to the
         // target folder.
         // Start with the library part (if any).
         $libPath = $path . DIRECTORY_SEPARATOR . 'lib';
         if (is_dir($libPath)) {
             if (!FileManager::copyDir($libPath, $pluginLibDest)) {
                 $templateMgr->assign('message', 'manager.plugins.copyError');
                 return false;
             }
             // Remove the library part of the temporary folder.
             FileManager::rmtree($libPath);
         }
         // Continue with the application-specific part (mandatory).
         if (!FileManager::copyDir($path, $pluginDest)) {
             $templateMgr->assign('message', 'manager.plugins.copyError');
             return false;
         }
         // Remove the temporary folder.
         FileManager::rmtree(dirname($path));
         // Upgrade the database with the new plug-in.
         $installFile = $pluginDest . INSTALL_FILE;
         if (!is_file($installFile)) {
             $installFile = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'defaultPluginInstall.xml';
         }
         assert(is_file($installFile));
         $params = $this->_setConnectionParams();
         $installer = new Install($params, $installFile, true);
         $installer->setCurrentVersion($pluginVersion);
         if (!$installer->execute()) {
             // Roll back the copy
             if (is_dir($pluginLibDest)) {
                 FileManager::rmtree($pluginLibDest);
             }
             if (is_dir($pluginDest)) {
                 FileManager::rmtree($pluginDest);
             }
             $templateMgr->assign('message', array('manager.plugins.installFailed', $installer->getErrorString()));
             return false;
         }
         $message = array('manager.plugins.installSuccessful', $pluginVersion->getVersionString());
         $templateMgr->assign('message', $message);
         $templateMgr->assign('uploaded', true);
         $templateMgr->assign('error', false);
         $versionDao->insertVersion($pluginVersion, true);
         return true;
     } else {
         if ($this->_checkIfNewer($pluginVersion->getProductType(), $pluginVersion->getProduct(), $pluginVersion)) {
             $templateMgr->assign('message', 'manager.plugins.pleaseUpgrade');
             return false;
         } else {
             $templateMgr->assign('message', 'manager.plugins.installedVersionOlder');
             return false;
         }
     }
 }
示例#14
0
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once 'install.class.php';
include_once 'db.class.php';
@ini_set("display_erros", "Off");
@ini_set("display_startup_errors", "Off");
error_reporting(0);
$install = new Install();
# installation configiration
define("SP_UPGRADE_VERSION", '2.0.0');
define("SP_INSTALL_DIR", getcwd());
define("SP_CONFIG_FILE", "config/sp-config.php");
define("SP_UPGRADE_DB_FILE", SP_INSTALL_DIR . "/data/upgrade.sql");
define("SP_UPGRADE_DB_LANG_FILE", SP_INSTALL_DIR . "/data/textlang.sql");
define("SP_INSTALL_CONFIG_FILE", SP_INSTALL_DIR . "/../" . SP_CONFIG_FILE);
$install->showDefaultHeader();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "proceedupgrade":
            $install->proceedUpgrade($_POST);
            break;
    }
} else {
示例#15
0
<?php

set_time_limit(0);
include_once "config.inc.php";
include_once "templates/header.html";
include_once "templates/install_manager_sidebar.html";
$mysql = new Mysql();
$install = new Install();
$monitor = new NodeMonitor();
if (!@$_GET['action']) {
    echo '<div class="span10">
	' . $lang['chooseLeftSidebar'] . '
	</div>';
} elseif ($_GET['action'] == "Install") {
    if (!$_GET['ip']) {
        echo '<div class=span10>';
        echo '<h2>' . $lang['chooseInstallHost'] . '</h2>';
        $sql = "select * from ehm_hosts order by create_time desc";
        $mysql->Query($sql);
        echo '<table class="table table-striped">';
        echo '<thead>
                <tr>
                  <th>#</th>
                  <th>' . $lang['hostname'] . '</th>
                  <th>' . $lang['ipAddr'] . '</th>
                  <th>' . $lang['nodeRole'] . '</th>
                  <th>' . $lang['createTime'] . '</th>
                  <th>' . $lang['action'] . '</th>
                </tr>
                </thead>
                <tbody>';
示例#16
0
 /**
  * Installs an extracted plugin
  * @param $path string path to plugin Directory
  * @param $errorMsg string Reference to string receiving error message
  * @return Version|null Version of installed plugin on success
  */
 function installPlugin($path, &$errorMsg)
 {
     $versionFile = $path . '/' . PLUGIN_VERSION_FILE;
     $pluginVersion = VersionCheck::getValidPluginVersionInfo($versionFile, $errorMsg);
     if (!$pluginVersion) {
         return null;
     }
     $versionDao = DAORegistry::getDAO('VersionDAO');
     /* @var $versionDao VersionDAO */
     $installedPlugin = $versionDao->getCurrentVersion($pluginVersion->getProductType(), $pluginVersion->getProduct(), true);
     if (!$installedPlugin) {
         $pluginLibDest = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/' . strtr($pluginVersion->getProductType(), '.', '/') . '/' . $pluginVersion->getProduct();
         $pluginDest = Core::getBaseDir() . '/' . strtr($pluginVersion->getProductType(), '.', '/') . '/' . $pluginVersion->getProduct();
         // Copy the plug-in from the temporary folder to the
         // target folder.
         // Start with the library part (if any).
         $libPath = $path . '/lib';
         $fileManager = new FileManager();
         if (is_dir($libPath)) {
             if (!$fileManager->copyDir($libPath, $pluginLibDest)) {
                 $errorMsg = __('manager.plugins.copyError');
                 return null;
             }
             // Remove the library part of the temporary folder.
             $fileManager->rmtree($libPath);
         }
         // Continue with the application-specific part (mandatory).
         if (!$fileManager->copyDir($path, $pluginDest)) {
             $errorMsg = __('manager.plugins.copyError');
             return null;
         }
         // Remove the temporary folder.
         $fileManager->rmtree(dirname($path));
         // Upgrade the database with the new plug-in.
         $installFile = $pluginDest . '/' . PLUGIN_INSTALL_FILE;
         if (!is_file($installFile)) {
             $installFile = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/xml/defaultPluginInstall.xml';
         }
         assert(is_file($installFile));
         $params = $this->_getConnectionParams();
         $installer = new Install($params, $installFile, true);
         $installer->setCurrentVersion($pluginVersion);
         if (!$installer->execute()) {
             // Roll back the copy
             if (is_dir($pluginLibDest)) {
                 $fileManager->rmtree($pluginLibDest);
             }
             if (is_dir($pluginDest)) {
                 $fileManager->rmtree($pluginDest);
             }
             $errorMsg = __('manager.plugins.installFailed', array('errorString' => $installer->getErrorString()));
             return null;
         }
         $versionDao->insertVersion($pluginVersion, true);
         return $pluginVersion;
     } else {
         if ($this->_checkIfNewer($pluginVersion->getProductType(), $pluginVersion->getProduct(), $pluginVersion)) {
             $errorMsg = __('manager.plugins.pleaseUpgrade');
         } else {
             $errorMsg = __('manager.plugins.installedVersionOlder');
         }
     }
     return null;
 }
示例#17
0
//实例化模型类
$sql = "CREATE DATABASE IF NOT EXISTS `" . $config['DB_NAME'] . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
$model->query($sql);
//如果指定数据库不存在,则尝试创建
$model->db->select_db($config['DB_NAME']);
//选择数据库
$ins = new Install();
//实例化数据库安装类
$DB_PREFIX = in($_POST['DB_PREFIX']);
if (empty($DB_PREFIX)) {
    $DB_PREFIX = 'dc_';
}
if ($_POST['test']) {
    $sql_array = Install::mysql('../data/test.sql', 'dc_', $DB_PREFIX);
} else {
    $sql_array = Install::mysql('../data/db.sql', 'dc_', $DB_PREFIX);
}
//执行数据库操作
foreach ($sql_array as $sql) {
    $model->db->query($sql);
    //安装数据
}
//修改配置文件
$config_array = array();
foreach ($config as $key => $value) {
    $config_array["config['" . $key . "']"] = $value;
}
if (!set_config($config_array)) {
    cpError::show('配置文件写入失败!');
}
//安装成功,创建锁定文件
示例#18
0
 * WoWRoster.net WoWRoster
 *
 * Roster plugin admin
 *
 *
 * @copyright  2002-2011 WoWRoster.net
 * @license    http://www.gnu.org/licenses/gpl.html   Licensed under the GNU General Public License v3.
 * @package    WoWRoster
 * @subpackage RosterCP
 */
if (!defined('IN_ROSTER') || !defined('IN_ROSTER_ADMIN')) {
    exit('Detected invalid access to this file!');
}
include ROSTER_ADMIN . 'roster_config_functions.php';
include ROSTER_LIB . 'install.lib.php';
$installer = new Install('plugins');
$installer->conf_table = 'plugin_config';
$op = isset($_POST['op']) ? $_POST['op'] : '';
$id = isset($_POST['id']) ? $_POST['id'] : '';
switch ($op) {
    case 'deactivate':
        processActive($id, 0);
        break;
    case 'activate':
        processActive($id, 1);
        break;
    case 'process':
        $processed = processPlugin();
        break;
    default:
        break;
示例#19
0
}
// 检测数据库链接
$pdo = check_db_connection($db_config);
if (!$pdo) {
    return;
}
// 写phinx配置
$phinx_config = file_get_contents(INSTALL_PATH . '/phinx.yml.sample');
foreach ($db_config as $k => $v) {
    $phinx_config = str_replace("%({$k})s", $v, $phinx_config);
}
file_put_contents(ENTRY_PATH . "/phinx.yml", $phinx_config);
// 同步数据表结构 及权限节点
display_loading("migrating database schema, please wait for a moment");
ob_start();
$migrate = new Install(0);
$migrate->up();
ob_end_clean();
echo "\nData schema migrated success, fill your company and super-user info\n\n";
// 公司及管理员信息
echo "Your company name: ";
$company_name = fgets(STDIN);
$sign_id = 10000;
$user_info = ['realname' => 'Administrator', 'email' => '', 'login' => 'admin', 'password' => ''];
/*
 * 1、 写公司信息
 * 2、 写公司部门信息
 * 3、 写超级管理信息
 * 4、 更新超级管理权限
 * 5、 更新公司超级管理
 * 6、 写应用表
示例#20
0
 /**
  * Perform installation.
  */
 function execute()
 {
     $templateMgr = TemplateManager::getManager($this->_request);
     $installer = new Install($this->_data);
     if ($installer->execute()) {
         if (!$installer->wroteConfig()) {
             // Display config file contents for manual replacement
             $templateMgr->assign(array('writeConfigFailed' => true, 'configFileContents' => $installer->getConfigContents()));
         }
         $templateMgr->display('install/installComplete.tpl');
     } else {
         switch ($installer->getErrorType()) {
             case INSTALLER_ERROR_DB:
                 $this->dbInstallError($installer->getErrorMsg());
                 break;
             default:
                 $this->installError($installer->getErrorMsg());
                 break;
         }
     }
     $installer->destroy();
 }
示例#21
0
$disable_database_connection = TRUE;
require_once '../../includes/global.inc.php';
$authenticate = FALSE;
require_once Environment::getBasePath() . 'includes/Interface.inc.php';
$smarty->assign('title', TTi18n::gettext($title = '2. System Check Acceptance'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'data', 'external_installer')));
if (DEPLOYMENT_ON_DEMAND == FALSE) {
    $cache->clean();
    //Clear all cache.
}
$smarty->clear_all_cache();
$install_obj = new Install();
if ($install_obj->isInstallMode() == FALSE) {
    Redirect::Page(URLBuilder::getURL(NULL, 'install.php'));
}
$action = Misc::findSubmitButton();
switch ($action) {
    case 'phpinfo':
        phpinfo();
        exit;
        break;
    case 'back':
        Debug::Text('Back', __FILE__, __LINE__, __METHOD__, 10);
        Redirect::Page(URLBuilder::getURL(NULL, 'install.php'));
        break;
    case 'next':
        Debug::Text('Next', __FILE__, __LINE__, __METHOD__, 10);
示例#22
0
<?php

include_once 'modules/install/class_install.php';
$install = new Install();
function WriteMenuEntries()
{
    global $smarty, $res, $db, $dsp, $MenuCallbacks;
    if ($db->num_rows($res) == 0) {
        $dsp->AddDoubleRow("", "<i>- keine -</i>");
    } else {
        while ($row = $db->fetch_array($res)) {
            $smarty->assign('action', $row["action"]);
            $smarty->assign('file', $row["file"]);
            $smarty->assign('id', $row["id"]);
            $smarty->assign('caption', $row["caption"]);
            $smarty->assign('hint', $row["hint"]);
            $smarty->assign('link', $row["link"]);
            $smarty->assign('pos', $row["pos"]);
            $smarty->assign('module', $_GET['module']);
            $boxid = '';
            if ($row['level'] == 0) {
                $boxid = 'Boxid: <input type="text" name="boxid[' . $row['id'] . ']" value="' . $row['boxid'] . '" size="2" />';
            }
            $smarty->assign('boxid', $boxid);
            $needed_config = "<option value=\"\">-" . t('keine') . "-</option>";
            $res2 = $db->qry("SELECT cfg_key FROM %prefix%config WHERE cfg_type = 'boolean' OR cfg_type = 'int' ORDER BY cfg_key");
            if ($MenuCallbacks) {
                foreach ($MenuCallbacks as $MenuCallback) {
                    $MenuCallback == $row["needed_config"] ? $selected = " selected" : ($selected = "");
                    $needed_config .= "<option value=\"{$MenuCallback}\"{$selected}>{$MenuCallback}</option>";
                }
示例#23
0
<?php

/* ---------- Upgrade database ---------- */
/* functions */
require dirname(__FILE__) . '/../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Install = new Install($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# admin user is required
$User->is_admin(true);
# try to upgrade database
if ($Install->upgrade_database() === true) {
    # print success
    $Result->show("success", _("Database upgraded successfully! <a class='btn btn-sm btn-default' href='" . create_link('dashboard') . "'>Dashboard</a>"), false);
    # migrate settings
    $User->migrate_domain_settings();
    $User->migrate_ldap_settings();
    # check for possible errors
    if (sizeof($errors = $Tools->verify_database()) > 0) {
        $esize = sizeof($errors['tableError']) + sizeof($errors['fieldError']);
        print '<div class="alert alert-danger">' . "\n";
        # print table errors
        if (isset($errors['tableError'])) {
            print '<strong>' . _('Missing table') . 's:</strong>' . "\n";
            print '<ul class="fix-table">' . "\n";
            foreach ($errors['tableError'] as $table) {
示例#24
0
文件: install.php 项目: jiangti/usvn
 /**
  * Get apache configuration
  *
  * @param string Path to the USVN config file
  * @return string apache config
  */
 public static function getApacheConfig($config_file)
 {
     $config = Install::_loadConfig($config_file);
     $path = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $config->subversion->path . DIRECTORY_SEPARATOR);
     $location = preg_replace('#http[s]?://[^/]*#', '', $config->subversion->url);
     $location = str_replace('//', '/', $location);
     $res = "<Location {$location}>\n";
     $res .= "\tErrorDocument 404 default\n";
     $res .= "\tDAV svn\n";
     if (substr($config->subversion->url, 0, 8) == 'https://') {
         $res .= "\tSSLRequireSSL\n";
     }
     $res .= "\tRequire valid-user\n";
     $res .= "\tSVNParentPath " . $path . "svn\n";
     $res .= "\tSVNListParentPath off\n";
     $res .= "\tAuthType Basic\n";
     $res .= "\tAuthName \"" . $config->site->title . "\"\n";
     $res .= "\tAuthUserFile " . $config->subversion->passwd . "\n";
     $res .= "\tAuthzSVNAccessFile " . $config->subversion->authz . "\n";
     $res .= "</Location>\n";
     return $res;
 }
示例#25
0
文件: index.php 项目: hard990/altocms
     *
     * @access protected
     * @return null
     */
    protected function SavePath()
    {
        $sLocalConfigFile = $this->sConfigDir . '/' . self::LOCAL_CONFIG_FILE_NAME;
        $this->SaveConfig('path.root.url', $this->_getPathRootUrl(), $sLocalConfigFile);
        //$this->SaveConfig('path.root.dir', $this->_getPathRootDir(), $sLocalConfigFile);
        $aDirs = array();
        $sDirs = trim(str_replace('http://' . $_SERVER['HTTP_HOST'], '', $this->_getPathRootUrl()), '/');
        if ($sDirs != '') {
            $aDirs = explode('/', $sDirs);
            $this->SaveConfig('path.runtime.url', '/' . $sDirs . '/_run/', $sLocalConfigFile);
            $this->SaveConfig('path.runtime.dir', $this->_getPathRootDir() . '_run/', $sLocalConfigFile);
        }
        $this->SaveConfig('path.offset_request_url', count($aDirs), $sLocalConfigFile);
    }
    protected function _getPathRootUrl()
    {
        return F::UrlBase() . str_replace('/install/index.php', '', $_SERVER['PHP_SELF']) . '/';
    }
    protected function _getPathRootDir()
    {
        return str_replace('\\', '/', ALTO_DIR) . '/';
    }
}
session_start();
$oInstaller = new Install();
$oInstaller->Run();
// EOF
示例#26
0
<?php

/**
 *	Post-installation submit
 */
# functions
require dirname(__FILE__) . '/../../functions/functions.php';
# objects
$Database = new Database_PDO();
$Admin = new Admin($Database, false);
$Install = new Install($Database);
$User = new User($Database);
$Result = new Result();
# only permit if Admin user has default pass !!!
$admin = $Admin->fetch_object("users", "username", "Admin");
if ($admin->password != '$6$rounds=3000$JQEE6dL9NpvjeFs4$RK5X3oa28.Uzt/h5VAfdrsvlVe.7HgQUYKMXTJUsud8dmWfPzZQPbRbk8xJn1Kyyt4.dWm4nJIYhAV2mbOZ3g.') {
    $Result->show("danger", "Not allowed!", true);
} else {
    # check lenghts
    if (strlen($_POST['password1']) < 8) {
        $Result->show("danger", _("Password must be at least 8 characters long!"), true);
    }
    if (strlen($_POST['password2']) < 8) {
        $Result->show("danger", _("Password must be at least 8 characters long!"), true);
    }
    # check password match
    if ($_POST['password1'] != $_POST['password2']) {
        $Result->show("danger", _("Passwords do not match"), true);
    }
    # Crypt password
    $_POST['password1'] = $User->crypt_user_pass($_POST['password1']);
 /**
  * Installs the uploaded plugin
  * @param $path string path to plugin Directory
  * @param $templateMgr reference to template manager
  * @return boolean
  */
 function installPlugin($path, &$templateMgr)
 {
     $this->validate();
     $versionFile = $path . VERSION_FILE;
     $templateMgr->assign('error', true);
     $templateMgr->assign('path', 'install');
     $pluginVersion =& VersionCheck::getValidPluginVersionInfo($versionFile, $templateMgr);
     if (is_null($pluginVersion)) {
         return false;
     }
     assert(is_a($pluginVersion, 'Version'));
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     $installedPlugin = $versionDao->getCurrentVersion($pluginVersion->getProduct(), true);
     if (!$installedPlugin) {
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . strtr($pluginVersion->getProductType(), '.', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $pluginVersion->getProduct();
         if (!FileManager::copyDir($path, $pluginDest)) {
             $templateMgr->assign('message', 'manager.plugins.copyError');
             return false;
         }
         // If plugin has an install.xml file, update database with it
         $installFile = $pluginDest . INSTALL_FILE;
         if (FileManager::fileExists($installFile)) {
             $params = $this->setConnectionParams();
             $installer = new Install($params, $installFile, true);
             $installer->setCurrentVersion($pluginVersion);
             if (!$installer->execute()) {
                 // Roll back the copy
                 FileManager::rmtree($pluginDest);
                 $templateMgr->assign('message', array('manager.plugins.installFailed', $installer->getErrorString()));
                 return false;
             }
         }
         $message = array('manager.plugins.installSuccessful', $pluginVersion->getVersionString());
         $templateMgr->assign('message', $message);
         $templateMgr->assign('uploaded', true);
         $templateMgr->assign('error', false);
         $versionDao->insertVersion($pluginVersion, true);
         return true;
     } else {
         if ($this->checkIfNewer($pluginVersion->getProduct(), $pluginVersion)) {
             $templateMgr->assign('message', 'manager.plugins.pleaseUpgrade');
             return false;
         } else {
             $templateMgr->assign('message', 'manager.plugins.installedVersionOlder');
             return false;
         }
     }
 }
示例#28
0
文件: step4.php 项目: nubzzz/newznab
<?php

require_once '../lib/installpage.php';
require_once '../lib/install.php';
$page = new Installpage();
$page->title = "Save Settings";
$cfg = new Install();
if (!$cfg->isInitialized()) {
    header("Location: index.php");
    die;
}
$cfg = $cfg->getSession();
$cfg->saveConfigCheck = $cfg->saveConfig();
if ($cfg->saveConfigCheck === false) {
    $cfg->error = true;
}
$cfg->saveLockCheck = $cfg->saveInstallLock();
if ($cfg->saveLockCheck === false) {
    $cfg->error = true;
}
if (!$cfg->error) {
    $cfg->setSession();
}
$page->smarty->assign('cfg', $cfg);
$page->smarty->assign('page', $page);
$page->content = $page->smarty->fetch('step4.tpl');
$page->render();
示例#29
0
文件: updates.php 项目: ssrsfs/blg
 *
 * admin-side updates controller
 */
// load installed packages
foreach (glob(TYPEF_SOURCE_DIR . '/packages/*.xml') as $file) {
    $xml = simplexml_load_file($file);
    if (!$xml) {
        continue;
    }
    $package = array('name' => (string) $xml['name'], 'title' => (string) $xml->title[0], 'revision' => (string) $xml['revision'], 'version' => (string) $xml['version'], 'packagexml' => basename($file));
    // check for updates
    $package['newestversion'] = Install::GetNewestVersion($package['name']);
    if (false !== $package['newestversion']) {
        $package['packageurl'] = TYPEF_PROVIDER . "/download/{$package['name']}-{$package['newestversion']}.tar.gz";
        $package['available'] = true;
        if (Install::EnumerateVersion($package['version']) >= Install::EnumerateVersion($package['newestversion'])) {
            $package['uptodate'] = true;
        }
    } else {
        $package['newest'] = null;
        $package['available'] = false;
    }
    // check all files in package for customizations
    $package['customized'] = false;
    foreach ($xml->file as $xfile) {
        $file = (string) $xfile;
        $installedHash = (string) $xfile['md5'];
        if ($installedHash && file_exists(TYPEF_DIR . "/{$file}")) {
            $currentHash = md5(file_get_contents(TYPEF_DIR . "/{$file}"));
            if ($installedHash != $currentHash) {
                $package['customized'] = true;
示例#30
0
 /**
  * 安装处理
  */
 public function importing()
 {
     $data = in($_POST);
     $configDb = $data['DB'];
     if (strpos($configDb['DB_HOST'], ':') !== false) {
         $db_host = explode(':', $configDb['DB_HOST']);
         $configDb['DB_HOST'] = $db_host[0];
         $configDb['DB_PORT'] = $db_host[1];
     } else {
         $configDb['DB_PORT'] = '3306';
     }
     $link = @mysql_connect($configDb['DB_HOST'] . ':' . $configDb['DB_PORT'], $configDb['DB_USER'], $configDb['DB_PWD']);
     if (!$link) {
         $this->msg('数据库连接失败,请检查连接信息是否正确!', false);
     }
     $mysqlInfo = @mysql_get_server_info($link);
     if ($mysqlInfo < '5.0') {
         $this->msg('MySql版本低于5.0,无法继续安装!', false);
     }
     $status = @mysql_select_db($configDb['DB_NAME'], $link);
     if (!$status) {
         $this->msg('数据库' . $configDb['DB_NAME'] . '不存在,请检查数据库!', false);
     }
     if ($data['agree'] != 1) {
         $this->msg('请认真阅读并同意安装协议!', false);
     }
     //设置表前缀
     $dbPrefix = $configDb['DB_PREFIX'];
     if (empty($dbPrefix)) {
         $dbPrefix = 'ecs_';
     }
     $dbData = ROOT_PATH . 'data/install.sql';
     $sqlData = Install::mysql($dbData, 'ecs_', $dbPrefix);
     //更新安装sql文件
     if (!model('Install')->get_column($configDb, $dbPrefix . 'order_info', 'mobile_pay')) {
         $sqlData[] = "ALTER TABLE `" . $dbPrefix . "order_info` ADD COLUMN `mobile_order` int(1) UNSIGNED NOT NULL DEFAULT 0,ADD COLUMN `mobile_pay` int(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `discount`;";
     }
     $sqlData[] = "UPDATE `" . $dbPrefix . "touch_shop_config` SET `value` = '" . str_replace('/mobile', '', __URL__) . "' where `code`='shop_url';";
     if (!model('Install')->runSql($configDb, $sqlData)) {
         $this->msg('数据导入失败,请检查后手动删除数据库重新安装!', false);
     }
     model('Install')->filter_column($configDb, 'touch_shop_config');
     //配置shop_config
     $this->set_config($configDb);
     $this->msg('安装成功!', true);
 }