issue 72 Sending server environment information after agreement of xe admin user.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8581 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2011-07-08 07:45:51 +00:00
parent cb13f541e8
commit e0c298d958
7 changed files with 104 additions and 13 deletions

View file

@ -29,11 +29,13 @@
// Wanted to add a list of activated // Wanted to add a list of activated
$inserted_addons = $this->getInsertedAddons($site_srl); $inserted_addons = $this->getInsertedAddons($site_srl);
// Downloaded and installed add-on to the list of Wanted // Downloaded and installed add-on to the list of Wanted
$searched_list = FileHandler::readDir('./addons'); $searched_list = FileHandler::readDir('./addons','/^([a-zA-Z0-9-_]+)$/');
$searched_count = count($searched_list); $searched_count = count($searched_list);
if(!$searched_count) return; if(!$searched_count) return;
sort($searched_list); sort($searched_list);
$oAddonAdminController = &getAdminController('addon');
for($i=0;$i<$searched_count;$i++) { for($i=0;$i<$searched_count;$i++) {
// Add the name of // Add the name of
$addon_name = $searched_list[$i]; $addon_name = $searched_list[$i];
@ -51,7 +53,6 @@
// Check if a permossion is granted entered in DB // Check if a permossion is granted entered in DB
if(!in_array($addon_name, array_keys($inserted_addons))) { if(!in_array($addon_name, array_keys($inserted_addons))) {
// If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ) // If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ)
$oAddonAdminController = &getAdminController('addon');
$oAddonAdminController->doInsert($addon_name, $site_srl); $oAddonAdminController->doInsert($addon_name, $site_srl);
// Is activated // Is activated
} else { } else {

View file

@ -87,5 +87,61 @@
} }
$this->add('list', $list); $this->add('list', $list);
} }
}
?> function getEnv($type='WORKING') {
$skip = array(
'ext' => array('pcre','json','hash','dom','session','spl','standard','date','ctype','tokenizer','apache2handler','filter','posix','reflection','pdo')
,'module' => array('addon','admin','autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget')
,'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image' )
);
$info = array();
$info['type'] = ($type !='INSTALL' ? 'WORKING' : 'INSTALL');
$info['location'] = _XE_LOCATION_;
$info['package'] = _XE_PACKAGE_;
$info['host'] = $db_type->default_url ? $db_type->default_url : getFullUrl();
$info['app'] = $_SERVER['SERVER_SOFTWARE'];
$info['php'] = phpversion();
$db_info = Context::getDBInfo();
$info['db_type'] = $db_info->db_type;
$info['use_rewrite'] = $db_info->use_rewrite;
$info['use_db_session'] = $db_info->use_db_session == 'Y' ?'Y':'N';
$info['use_ssl'] = $db_info->use_ssl;
$info['phpext'] = '';
foreach (get_loaded_extensions() as $ext) {
$ext = strtolower($ext);
if(in_array($ext, $skip['ext'])) continue;
$info['phpext'] .= '|'. $ext;
}
$info['phpext'] = substr($info['phpext'],1);
$info['module'] = '';
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList();
foreach($module_list as $module){
if(in_array($module->module, $skip['module'])) continue;
$info['module'] .= '|'.$module->module;
}
$info['module'] = substr($info['module'],1);
$info['addon'] = '';
$oAddonAdminModel = &getAdminModel('addon');
$addon_list = $oAddonAdminModel->getAddonList();
foreach($addon_list as $addon){
if(in_array($addon->addon, $skip['addon'])) continue;
$info['addon'] .= '|'.$addon->addon;
}
$info['addon'] = substr($info['addon'],1);
$param = '';
foreach($info as $k => $v){
if($v) $param .= sprintf('&%s=%s',$k,urlencode($v));
}
$param = substr($param, 1);
return $param;
}
}

View file

@ -42,6 +42,8 @@
if($db_info->http_port) Context::set('http_port', $db_info->http_port); if($db_info->http_port) Context::set('http_port', $db_info->http_port);
if($db_info->https_port) Context::set('https_port', $db_info->https_port); if($db_info->https_port) Context::set('https_port', $db_info->https_port);
$this->showSendEnv();
} }
function loadSideBar() function loadSideBar()
@ -353,5 +355,29 @@
Context::set('layout','none'); Context::set('layout','none');
$this->setTemplateFile('config'); $this->setTemplateFile('config');
} }
function showSendEnv() {
if(Context::getResponseMethod() != 'HTML' && $_SESSION['agree_send_env'] != 'Y') return;
$server = 'http://collect.xpressengine.com/env/img.php?';
$path = './files/env/';
$install_env = $path . 'install';
if(file_exists(FileHandler::getRealPath($install_env))) {
$oAdminAdminModel = &getAdminModel('admin');
$params = $oAdminAdminModel->getEnv('INSTALL');
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params);
Context::addHtmlFooter($img);
FileHandler::removeFile($install_env_send);
FileHandler::writeFile($path.__ZBXE_VERSION__,'1');
} else if(!file_exists($path.__ZBXE_VERSION__)) {
$oAdminAdminModel = &getAdminModel('admin');
$params = $oAdminAdminModel->getEnv();
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params);
Context::addHtmlFooter($img);
FileHandler::removeDir($path);
FileHandler::writeFile($path.__ZBXE_VERSION__,'1');
}
}
} }
?>

View file

@ -29,11 +29,14 @@
{ {
global $lang; global $lang;
$requestVars = Context::gets('lgpl_agree', 'enviroment_gather'); $requestVars = Context::gets('lgpl_agree', 'enviroment_gather');
if($requestVars->lgpl_agree != 'on') if($requestVars->lgpl_agree != 'Y') {
return new Object('-1', $lang->msg_license_agreement_alert); return new Object('-1', $lang->msg_license_agreement_alert);
}
$_SESSION['lgpl_agree'] = $requestVars->lgpl_agree; $_SESSION['lgpl_agree'] = $requestVars->lgpl_agree;
$_SESSION['enviroment_gather'] = $requestVars->enviroment_gather; if($requestVars->enviroment_gather=='Y') {
FileHandler::writeFile('./files/env/install','1');
}
$url = getNotEncodedUrl('', 'act', 'dispInstallCheckEnv'); $url = getNotEncodedUrl('', 'act', 'dispInstallCheckEnv');
header('location:'.$url); header('location:'.$url);
@ -183,6 +186,12 @@
// Display a message that installation is completed // Display a message that installation is completed
$this->setMessage('msg_install_completed'); $this->setMessage('msg_install_completed');
if($_SESSION['enviroment_gather'] == 'Y'){
$oAdminAdminController = &getAdminController('admin');
$oAdminAdminController->_sendServerEnv();
unset($_SESSION['enviroment_gather']);
}
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
header('location:'.$returnUrl); header('location:'.$returnUrl);
@ -517,4 +526,3 @@
} }
} }
?>

View file

@ -1,8 +1,6 @@
<?php <?php
class installModel extends install { class installModel extends install {
function init() {
}
var $pwd; var $pwd;
function getSFTPList() function getSFTPList()

View file

@ -8,11 +8,11 @@
<input type="hidden" name="act" value="procInstallAgreement" /> <input type="hidden" name="act" value="procInstallAgreement" />
<input type="hidden" id="agree_license_text" value="{$lang->install_license_desc['lgpl']}" /> <input type="hidden" id="agree_license_text" value="{$lang->install_license_desc['lgpl']}" />
<div class="desc"> <div class="desc">
<p><input type="checkbox" name="lgpl_agree" class="iCheck" id="lgpl" /> <label for="lgpl">{$lang->lgpl_agree}</label> - <a href="{$lang->lgpl_license_url}" target="_blank">{$lang->read_all}</a></p> <p><input type="checkbox" name="lgpl_agree" value="Y" class="iCheck" id="lgpl" /> <label for="lgpl">{$lang->lgpl_agree}</label> - <a href="{$lang->lgpl_license_url}" target="_blank">{$lang->read_all}</a></p>
<p>{$lang->license_agreement_desc}</p> <p>{$lang->license_agreement_desc}</p>
</div> </div>
<div class="desc"> <div class="desc">
<p><input type="checkbox" name="enviroment_gather" class="iCheck" id="env" /> <label for="env">{$lang->intall_env_agreement}</label></p> <p><input type="checkbox" name="enviroment_gather" value="Y" class="iCheck" id="env" /> <label for="env">{$lang->intall_env_agreement}</label></p>
<p>{$lang->intall_env_agreement_desc}</p> <p>{$lang->intall_env_agreement_desc}</p>
</div> </div>
<div class="btnArea"> <div class="btnArea">

View file

@ -983,7 +983,7 @@
// Create DB Object // Create DB Object
$oDB = &DB::getInstance(); $oDB = &DB::getInstance();
// Get a list of downloaded and installed modules // Get a list of downloaded and installed modules
$searched_list = FileHandler::readDir('./modules'); $searched_list = FileHandler::readDir('./modules', '/^([a-zA-Z0-9_-]+)$/');
sort($searched_list); sort($searched_list);
$searched_count = count($searched_list); $searched_count = count($searched_list);
@ -994,6 +994,8 @@
$module_name = $searched_list[$i]; $module_name = $searched_list[$i];
$path = ModuleHandler::getModulePath($module_name); $path = ModuleHandler::getModulePath($module_name);
if(!is_dir(FileHandler::getRealPath($path))) continue;
// Get the number of xml files to create a table in schemas // Get the number of xml files to create a table in schemas
$tmp_files = FileHandler::readDir($path."schemas", '/(\.xml)$/'); $tmp_files = FileHandler::readDir($path."schemas", '/(\.xml)$/');
$table_count = count($tmp_files); $table_count = count($tmp_files);