This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,169 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('data/SugarBean.php');
require_once('include/OutboundEmail/OutboundEmail.php');
class Administration extends SugarBean {
var $settings;
var $table_name = "config";
var $object_name = "Administration";
var $new_schema = true;
var $module_dir = 'Administration';
var $config_categories = array(
// 'mail', // cn: moved to include/OutboundEmail
'disclosure', // appended to all outbound emails
'notify',
'system',
'portal',
'proxy',
'massemailer',
'ldap',
'captcha',
'sugarpdf',
);
var $checkbox_fields = Array("notify_send_by_default", "mail_smtpauth_req", "notify_on", 'portal_on', 'skypeout_on', 'system_mailmerge_on', 'proxy_auth', 'proxy_on', 'system_ldap_enabled','captcha_on');
function Administration() {
parent::SugarBean();
$this->setupCustomFields('Administration');
}
function retrieveSettings($category = FALSE, $clean=false) {
// declare a cache for all settings
$settings_cache = sugar_cache_retrieve('admin_settings_cache');
if($clean) {
$settings_cache = array();
}
// Check for a cache hit
if(!empty($settings_cache)) {
$this->settings = $settings_cache;
return $this;
}
$query = "SELECT category, name, value FROM {$this->table_name}";
$result = $this->db->query($query, true, "Unable to retrieve system settings");
if(empty($result)) {
return NULL;
}
while($row = $this->db->fetchByAssoc($result, -1, true)) {
if($row['category']."_".$row['name'] == 'ldap_admin_password' || $row['category']."_".$row['name'] == 'proxy_password')
$this->settings[$row['category']."_".$row['name']] = $this->decrypt_after_retrieve($row['value']);
else
$this->settings[$row['category']."_".$row['name']] = $row['value'];
}
// outbound email settings
$oe = new OutboundEmail();
$oe->getSystemMailerSettings();
foreach($oe->field_defs as $def) {
if(strpos($def, "mail_") !== false)
$this->settings[$def] = $oe->$def;
}
// At this point, we have built a new array that should be cached.
sugar_cache_put('admin_settings_cache',$this->settings);
return $this;
}
function saveConfig() {
// outbound email settings
$oe = new OutboundEmail();
foreach($_POST as $key => $val) {
$prefix = $this->get_config_prefix($key);
if(in_array($prefix[0], $this->config_categories)) {
if(is_array($val)){
$val=implode(",",$val);
}
$this->saveSetting($prefix[0], $prefix[1], $val);
}
if(strpos($key, "mail_") !== false) {
if(in_array($key, $oe->field_defs)) {
$oe->$key = $val;
}
}
}
//saving outbound email from here is probably redundant, adding a check to make sure
//smtpserver name is set.
if (!empty($oe->mail_smtpserver)) {
$oe->saveSystem();
}
$this->retrieveSettings(false, true);
}
function saveSetting($category, $key, $value) {
$result = $this->db->query("SELECT count(*) AS the_count FROM config WHERE category = '{$category}' AND name = '{$key}'");
$row = $this->db->fetchByAssoc( $result, -1, true );
$row_count = $row['the_count'];
if($category."_".$key == 'ldap_admin_password' || $category."_".$key == 'proxy_password')
$value = $this->encrpyt_before_save($value);
if( $row_count == 0){
$result = $this->db->query("INSERT INTO config (value, category, name) VALUES ('$value','$category', '$key')");
}
else{
$result = $this->db->query("UPDATE config SET value = '{$value}' WHERE category = '{$category}' AND name = '{$key}'");
}
return $this->db->getAffectedRowCount();
}
function get_config_prefix($str) {
return Array(substr($str, 0, strpos($str, "_")), substr($str, strpos($str, "_")+1));
}
}
?>

View File

@@ -0,0 +1,152 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description:
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
* Reserved. Contributor(s): ______________________________________..
*********************************************************************************/
require_once("include/entryPoint.php");
$json = getJSONObj();
$out = "";
switch($_REQUEST['adminAction']) {
///////////////////////////////////////////////////////////////////////////
//// REPAIRXSS
case "refreshEstimate":
include("include/modules.php"); // provide $moduleList
$target = $_REQUEST['bean'];
$count = 0;
$toRepair = array();
if($target == 'all') {
$hide = array('Activities', 'Home', 'iFrames', 'Calendar', 'Dashboard');
sort($moduleList);
$options = array();
foreach($moduleList as $module) {
if(!in_array($module, $hide)) {
$options[$module] = $module;
}
}
foreach($options as $module) {
if(!isset($beanFiles[$beanList[$module]]))
continue;
$file = $beanFiles[$beanList[$module]];
if(!file_exists($file))
continue;
require_once($file);
$bean = new $beanList[$module]();
$q = "SELECT count(*) as count FROM {$bean->table_name}";
$r = $bean->db->query($q);
$a = $bean->db->fetchByAssoc($r);
$count += $a['count'];
// populate to_repair array
$q2 = "SELECT id FROM {$bean->table_name}";
$r2 = $bean->db->query($q2);
$ids = '';
while($a2 = $bean->db->fetchByAssoc($r2)) {
$ids[] = $a2['id'];
}
$toRepair[$module] = $ids;
}
} elseif(in_array($target, $moduleList)) {
require_once($beanFiles[$beanList[$target]]);
$bean = new $beanList[$target]();
$q = "SELECT count(*) as count FROM {$bean->table_name}";
$r = $bean->db->query($q);
$a = $bean->db->fetchByAssoc($r);
$count += $a['count'];
// populate to_repair array
$q2 = "SELECT id FROM {$bean->table_name}";
$r2 = $bean->db->query($q2);
$ids = '';
while($a2 = $bean->db->fetchByAssoc($r2)) {
$ids[] = $a2['id'];
}
$toRepair[$target] = $ids;
}
$out = array('count' => $count, 'target' => $target, 'toRepair' => $toRepair);
break;
case "repairXssExecute":
if(isset($_REQUEST['bean']) && !empty($_REQUEST['bean']) && isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
include("include/modules.php"); // provide $moduleList
$target = $_REQUEST['bean'];
require_once($beanFiles[$beanList[$target]]);
$ids = $json->decode(from_html($_REQUEST['id']));
$count = 0;
foreach($ids as $id) {
if(!empty($id)) {
$bean = new $beanList[$target]();
$bean->retrieve($id);
$bean->new_with_id = false;
$bean->save(); // cleanBean() is called on save()
$count++;
}
}
$out = array('msg' => "success", 'count' => $count);
} else {
$out = array('msg' => "failure: bean or ID not defined");
}
break;
//// END REPAIRXSS
///////////////////////////////////////////////////////////////////////////
default:
die();
break;
}
$ret = $json->encode($out, true);
echo $ret;

View File

@@ -0,0 +1,154 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if (!is_admin($GLOBALS['current_user']))
{
sugar_die("Unauthorized access to administration.");
}
require_once('include/utils/zip_utils.php');
$form_action = "index.php?module=Administration&action=Backups";
$backup_dir = "";
$backup_zip = "";
$run = "confirm";
$input_disabled = "";
global $mod_strings;
$errors = array();
// process "run" commands
if( isset( $_REQUEST['run'] ) && ($_REQUEST['run'] != "") ){
$run = $_REQUEST['run'];
$backup_dir = $_REQUEST['backup_dir'];
$backup_zip = $_REQUEST['backup_zip'];
if( $run == "confirm" ){
if( $backup_dir == "" ){
$errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_ERROR'];
}
if( $backup_zip == "" ){
$errors[] = $mod_strings['LBL_BACKUP_FILENAME_ERROR'];
}
if( sizeof($errors) > 0 ){
return( $errors );
}
if( !is_dir( $backup_dir ) ){
if( !mkdir_recursive( $backup_dir ) ){
$errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_EXISTS'];
}
}
if( !is_writable( $backup_dir ) ){
$errors[] = $mod_strings['LBL_BACKUP_DIRECTORY_NOT_WRITABLE'];
}
if( is_file( "$backup_dir/$backup_zip" ) ){
$errors[] = $mod_strings['LBL_BACKUP_FILE_EXISTS'];
}
if( is_dir( "$backup_dir/$backup_zip" ) ){
$errors[] = $mod_strings['LBL_BACKUP_FILE_AS_SUB'];
}
if( sizeof( $errors ) == 0 ){
$run = "confirmed";
$input_disabled = "readonly";
}
}
else if( $run == "confirmed" ){
ini_set( "memory_limit", "-1" );
ini_set( "max_execution_time", "0" );
zip_dir( ".", "$backup_dir/$backup_zip" );
$run = "done";
}
}
if( sizeof($errors) > 0 ){
foreach( $errors as $error ){
print( "<font color=\"red\">$error</font><br>" );
}
}
if( $run == "done" ){
$size = filesize( "$backup_dir/$backup_zip" );
print( $mod_strings['LBL_BACKUP_FILE_STORED'] . " $backup_dir/$backup_zip ($size bytes).<br>\n" );
print( "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_BACKUP_BACK_HOME']. "</a>\n" );
}
else{
?>
<?php
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_BACKUPS_TITLE'], true);
echo $mod_strings['LBL_BACKUP_INSTRUCTIONS_1']; ?>
<br>
<?php echo $mod_strings['LBL_BACKUP_INSTRUCTIONS_2']; ?><br>
<form action="<?php print( $form_action );?>" method="post">
<table>
<tr>
<td><?php echo $mod_strings['LBL_BACKUP_DIRECTORY']; ?><br><i><?php echo $mod_strings['LBL_BACKUP_DIRECTORY_WRITABLE']; ?></i></td>
<td><input size="100" type="input" name="backup_dir" <?php print( $input_disabled );?> value="<?php print( $backup_dir );?>"/></td>
</tr>
<tr>
<td><?php echo $mod_strings['LBL_BACKUP_FILENAME']; ?></td>
<td><input type="input" name="backup_zip" <?php print( $input_disabled );?> value="<?php print( $backup_zip );?>"/></td>
</tr>
</table>
<input type=hidden name="run" value="<?php print( $run );?>" />
<?php
switch( $run ){
case "confirm":
?>
<input type="submit" value="<?php echo $mod_strings['LBL_BACKUP_CONFIRM']; ?>" />
<?php
break;
case "confirmed":
?>
<?php echo $mod_strings['LBL_BACKUP_CONFIRMED']; ?><br>
<input type="submit" value="<?php echo $mod_strings['LBL_BACKUP_RUN_BACKUP']; ?>" />
<?php
break;
}
?>
</form>
<?php
} // end if/else of $run options
$GLOBALS['log']->info( "Backups" );
?>

View File

@@ -0,0 +1,129 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
require_once('modules/Reports/Report.php');
$altered_cols = array (
'project_task'=>array('milestone_flag'),
'tasks'=>array('date_start_flag','date_due_flag','date_start','time_start','date_due','time_due'),
'calls'=>array('date_start', 'time_start'),
'meetings'=>array('date_start', 'time_start'),
'email_marketing'=>array('date_start', 'time_start'),
'emails'=>array('date_start', 'time_start', 'date_sent'),
'leads'=>array('do_not_call'),
'contacts'=>array('do_not_call'),
'prospects'=>array('do_not_call'),
'reports'=>array('is_published'),
);
//$bad_reports = array();
function checkEachColInArr ($arr, $full_table_list, $report_id, $report_name, $user_name){
foreach ($arr as $column) {
global $beanFiles;
if(empty($beanFiles)) {
include('include/modules.php');
}
if(is_array($column))
{
$module_name = $full_table_list[$column['table_key']]['module'];
}
if(!isset($module_name))
{
continue;
}
$bean_name = get_singular_bean_name($module_name);
require_once($beanFiles[$bean_name]);
$module = new $bean_name;
$table = $module->table_name;
$colName = $column['name'];
if((isset($altered_cols[$table]) && isset($altered_cols[$table][$colName]))
|| $colName == 'email1' || $colName == 'email2') {
echo $user_name.'------'.$report_name."------".$colName;
//array_push($bad_reports[$report_id], $column);
}
}
}
function displayBadReportsList() {
foreach($bad_reports as $key=>$cols) {
echo $key.'***'.$cols;
}
}
function checkReports() {
$savedReportBean = new SavedReport();
$savedReportQuery = "select * from saved_reports where deleted=0";
$result = $savedReportBean->db->query($savedReportQuery, true, "");
$row = $savedReportBean->db->fetchByAssoc($result);
while ($row != null) {
$saved_report_seed = new SavedReport();
$saved_report_seed->retrieve($row['id'], false);
$report = new Report($saved_report_seed->content);
$display_columns = $report->report_def['display_columns'];
$filters_def = $report->report_def['filters_def'];
$group_defs = $report->report_def['group_defs'];
if (!empty($report->report_def['order_by']))
$order_by = $report->report_def['order_by'];
else
$order_by = array();
$summary_columns = $report->report_def['summary_columns'];
$full_table_list = $report->report_def['full_table_list'];
$owner_user = new User();
$owner_user->retrieve($row['assigned_user_id']);
checkEachColInArr($display_columns, $full_table_list, $row['id'], $row['name'], $owner_user->name);
checkEachColInArr($group_defs, $full_table_list, $row['id'], $row['name'], $owner_user->name);
checkEachColInArr($order_by, $full_table_list, $row['id'], $row['name'], $owner_user->name);
checkEachColInArr($summary_columns, $full_table_list, $row['id'], $row['name'], $owner_user->name);
foreach($filters_def as $filters_def_row)
{
checkEachColInArr($filters_def_row, $full_table_list, $row['id'], $row['name'], $owner_user->name);
}
$row = $savedReportBean->db->fetchByAssoc($result);
}
}
checkReports();
//displayBadReportsList();
echo $mod_strings['LBL_DIAGNOSTIC_DONE'];

View File

@@ -0,0 +1,740 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/utils/array_utils.php');
/**
* @return bool
* @desc Creates the include language directory under the custom directory.
*/
function create_include_lang_dir()
{
$continue = true;
if(!is_dir('custom/include'))
{
$continue = sugar_mkdir('custom/include');
}
if($continue)
{
if(!is_dir("custom/include/language"))
{
$continue = sugar_mkdir("custom/include/language");
}
}
return $continue;
}
/**
* @return bool
* @param module string
* @desc Creates the module's language directory under the custom directory.
*/
function create_module_lang_dir($module)
{
$continue = true;
if(!is_dir('custom/modules'))
{
$continue = sugar_mkdir('custom/modules');
}
if($continue)
{
if(!is_dir("custom/modules/$module"))
{
$continue = sugar_mkdir("custom/modules/$module");
}
}
if($continue)
{
if(!is_dir("custom/modules/$module/language"))
{
$continue = sugar_mkdir("custom/modules/$module/language");
}
}
return $continue;
}
/**
* @return string&
* @param the_array array, language string, module string
* @desc Returns the contents of the customized language pack.
*/
function &create_field_lang_pak_contents($old_contents, $key, $value, $language, $module)
{
if(!empty($old_contents))
{
$old_contents = preg_replace("'[^\[\n\r]+\[\'{$key}\'\][^\;]+;[\ \r\n]*'i", '', $old_contents);
$contents = str_replace("\n?>","\n\$mod_strings['{$key}'] = '$value';\n?>", $old_contents);
}
else
{
$contents = "<?php\n"
. '// Creation date: ' . date('Y-m-d H:i:s') . "\n"
. "// Module: $module\n"
. "// Language: $language\n\n"
. "\$mod_strings['$key'] = '$value';"
. "\n?>";
}
return $contents;
}
/**
* @return string&
* @param the_array array, language string
* @desc Returns the contents of the customized language pack.
*/
function &create_dropdown_lang_pak_contents(&$the_array, $language)
{
$contents = "<?php\n" .
'// ' . date('Y-m-d H:i:s') . "\n" .
"// Language: $language\n\n" .
'$app_list_strings = ' .
var_export($the_array, true) .
";\n?>";
return $contents;
}
/**
* @return bool
* @param module string, key string, value string
* @desc Wrapper function that will create a field label for every language.
*/
function create_field_label_all_lang($module, $key, $value, $overwrite = false)
{
$languages = get_languages();
$return_value = false;
foreach($languages as $lang_key => $lang_value)
{
$return_value = create_field_label($module, $lang_key, $key, $value, $overwrite);
if(!$return_value)
{
break;
}
}
return $return_value;
}
/**
* @return bool
* @param module string, language string, key string, value string
* @desc Returns true if new field label can be created, false otherwise.
* Probable reason for returning false: new_field_key already exists.
*/
function create_field_label($module, $language, $key, $value, $overwrite=false)
{
$return_value = false;
$mod_strings = return_module_language($language, $module);
if(isset($mod_strings[$key]) && !$overwrite)
{
$GLOBALS['log']->info("Tried to create a key that already exists: $key");
}
else
{
$mod_strings = array_merge($mod_strings, array($key => $value));
$dirname = "custom/modules/$module/language";
$dir_exists = is_dir($dirname);
if(!$dir_exists)
{
$dir_exists = create_module_lang_dir($module);
}
if($dir_exists)
{
$filename = "$dirname/$language.lang.php";
if(is_file($filename)){
$handle = sugar_fopen($filename, 'rb');
$old_contents = fread($handle, filesize($filename));
fclose($handle);
}else{
$old_contents = '';
}
$handle = sugar_fopen($filename, 'wb');
if($handle)
{
$contents =create_field_lang_pak_contents($old_contents, $key,
$value, $language, $module);
if(fwrite($handle, $contents))
{
$return_value = true;
$GLOBALS['log']->info("Successful write to: $filename");
}
fclose($handle);
}
else
{
$GLOBALS['log']->info("Unable to write edited language pak to file: $filename");
}
}
else
{
$GLOBALS['log']->info("Unable to create dir: $dirname");
}
}
return $return_value;
}
/**
* @return bool
* @param dropdown_name string
* @desc Wrapper function that creates a dropdown type for all languages.
*/
function create_dropdown_type_all_lang($dropdown_name)
{
$languages = get_languages();
$return_value = false;
foreach($languages as $lang_key => $lang_value)
{
$return_value = create_dropdown_type($dropdown_name, $lang_key);
if(!$return_value)
{
break;
}
}
return $return_value;
}
/**
* @return bool
* @param app_list_strings array
* @desc Saves the app_list_strings to file in the 'custom' dir.
*/
function save_custom_app_list_strings_contents(&$contents, $language, $custom_dir_name = '')
{
$return_value = false;
$dirname = 'custom/include/language';
if(!empty($custom_dir_name))
$dirname = $custom_dir_name;
$dir_exists = is_dir($dirname);
if(!$dir_exists)
{
$dir_exists = create_include_lang_dir($dirname);
}
if($dir_exists)
{
$filename = "$dirname/$language.lang.php";
$handle = @sugar_fopen($filename, 'wt');
if($handle)
{
if(fwrite($handle, $contents))
{
$return_value = true;
$GLOBALS['log']->info("Successful write to: $filename");
}
fclose($handle);
}
else
{
$GLOBALS['log']->info("Unable to write edited language pak to file: $filename");
}
}
else
{
$GLOBALS['log']->info("Unable to create dir: $dirname");
}
if($return_value){
$cache_key = 'app_list_strings.'.$language;
sugar_cache_clear($cache_key);
}
return $return_value;
}
/**
* @return bool
* @param app_list_strings array
* @desc Saves the app_list_strings to file in the 'custom' dir.
*/
function save_custom_app_list_strings(&$app_list_strings, $language)
{
$return_value = false;
$dirname = 'custom/include/language';
$dir_exists = is_dir($dirname);
if(!$dir_exists)
{
$dir_exists = create_include_lang_dir($dirname);
}
if($dir_exists)
{
$filename = "$dirname/$language.lang.php";
$handle = @sugar_fopen($filename, 'wt');
if($handle)
{
$contents =create_dropdown_lang_pak_contents($app_list_strings,
$language);
if(fwrite($handle, $contents))
{
$return_value = true;
$GLOBALS['log']->info("Successful write to: $filename");
}
fclose($handle);
}
else
{
$GLOBALS['log']->info("Unable to write edited language pak to file: $filename");
}
}
else
{
$GLOBALS['log']->info("Unable to create dir: $dirname");
}
if($return_value){
$cache_key = 'app_list_strings.'.$language;
sugar_cache_clear($cache_key);
}
return $return_value;
}
function return_custom_app_list_strings_file_contents($language, $custom_filename = '')
{
$contents = '';
$filename = "custom/include/language/$language.lang.php";
if(!empty($custom_filename))
$filename = $custom_filename;
$handle = @sugar_fopen($filename, 'rt');
if($handle)
{
$contents = fread($handle, filesize($filename));
fclose($handle);
}
return $contents;
}
/**
* @return bool
* @param dropdown_name string, language string
* @desc Creates a new dropdown type.
*/
function create_dropdown_type($dropdown_name, $language)
{
$return_value = false;
$app_list_strings = return_app_list_strings_language($language);
if(isset($app_list_strings[$dropdown_name]))
{
$GLOBALS['log']->info("Tried to create a dropdown list key that already exists: $dropdown_name");
}
else
{
// get the contents of the custom app list strings file
$contents = return_custom_app_list_strings_file_contents($language);
// add the new dropdown_name to it
if($contents == '')
{
$new_contents = "<?php\n\$app_list_strings['$dropdown_name'] = array(''=>'');\n?>";
}
else
{
$new_contents = str_replace('?>', "\$app_list_strings['$dropdown_name'] = array(''=>'');\n?>", $contents);
}
// save the new contents to file
$return_value = save_custom_app_list_strings_contents($new_contents, $language);
}
return $return_value;
}
/**
* @return string&
* @param identifier string, pairs array, first_entry string, selected_key string
* @desc Generates the HTML for a dropdown list.
*/
function &create_dropdown_html($identifier, &$pairs, $first_entry='', $selected_key='')
{
$html = "<select name=\"$identifier\">\n";
if('' != $first_entry)
{
$html .= "<option name=\"\">$first_entry</option>\n";
}
foreach($pairs as $key => $value)
{
$html .= $selected_key == $key ?
"<option name=\"$key\" selected=\"selected\">$value</option>\n" :
"<option name=\"$key\">$value</option>\n";
}
$html .= "</select>\n";
return $html;
}
function dropdown_item_delete($dropdown_type, $language, $index)
{
$app_list_strings_to_edit = return_app_list_strings_language($language);
$dropdown_array =$app_list_strings_to_edit[$dropdown_type];
helper_dropdown_item_delete($dropdown_array, $index);
$contents = return_custom_app_list_strings_file_contents($language);
$new_contents = replace_or_add_dropdown_type($dropdown_type, $dropdown_array,
$contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
function helper_dropdown_item_delete(&$dropdown_array, $index)
{
// perform the delete from the array
$sliced_off_array = array_splice($dropdown_array, $index);
array_shift($sliced_off_array);
$dropdown_array = array_merge($dropdown_array, $sliced_off_array);
}
function dropdown_item_move_up($dropdown_type, $language, $index)
{
$app_list_strings_to_edit = return_app_list_strings_language($language);
$dropdown_array =$app_list_strings_to_edit[$dropdown_type];
if($index > 0 && $index < count($dropdown_array))
{
$key = '';
$value = '';
$i = 0;
reset($dropdown_array);
while(list($k, $v) = each($dropdown_array))
{
if($i == $index)
{
$key = $k;
$value = $v;
break;
}
$i++;
}
helper_dropdown_item_delete($dropdown_array, $index);
helper_dropdown_item_insert($dropdown_array, $index - 1, $key, $value);
// get the contents of the custom app list strings file
$contents = return_custom_app_list_strings_file_contents($language);
$new_contents = replace_or_add_dropdown_type($dropdown_type,
$dropdown_array, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
}
function dropdown_item_move_down($dropdown_type, $language, $index)
{
$app_list_strings_to_edit = return_app_list_strings_language($language);
$dropdown_array =$app_list_strings_to_edit[$dropdown_type];
if($index >= 0 && $index < count($dropdown_array) - 1)
{
$key = '';
$value = '';
$i = 0;
reset($dropdown_array);
while(list($k, $v) = each($dropdown_array))
{
if($i == $index)
{
$key = $k;
$value = $v;
break;
}
$i++;
}
helper_dropdown_item_delete($dropdown_array, $index);
helper_dropdown_item_insert($dropdown_array, $index + 1, $key, $value);
// get the contents of the custom app list strings file
$contents = return_custom_app_list_strings_file_contents($language);
$new_contents = replace_or_add_dropdown_type($dropdown_type,
$dropdown_array, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
}
function dropdown_item_insert($dropdown_type, $language, $index, $key, $value)
{
$app_list_strings_to_edit = return_app_list_strings_language($language);
$dropdown_array =$app_list_strings_to_edit[$dropdown_type];
helper_dropdown_item_insert($dropdown_array, $index, $key, $value);
// get the contents of the custom app list strings file
$contents = return_custom_app_list_strings_file_contents($language);
$new_contents = replace_or_add_dropdown_type($dropdown_type,
$dropdown_array, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
function helper_dropdown_item_insert(&$dropdown_array, $index, $key, $value)
{
$pair = array($key => $value);
if($index <= 0)
{
$dropdown_array = array_merge($pair, $dropdown_array);
}
if($index >= count($dropdown_array))
{
$dropdown_array = array_merge($dropdown_array, $pair);
}
else
{
$sliced_off_array = array_splice($dropdown_array, $index);
$dropdown_array = array_merge($dropdown_array, $pair);
$dropdown_array = array_merge($dropdown_array, $sliced_off_array);
}
}
function dropdown_item_edit($dropdown_type, $language, $key, $value)
{
$app_list_strings_to_edit = return_app_list_strings_language($language);
$dropdown_array =$app_list_strings_to_edit[$dropdown_type];
$dropdown_array[$key] = $value;
$contents = return_custom_app_list_strings_file_contents($language);
// get the contents of the custom app list strings file
$new_contents = replace_or_add_dropdown_type($dropdown_type,
$dropdown_array, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
function replace_or_add_dropdown_type($dropdown_type, &$dropdown_array,
&$file_contents)
{
$new_contents = "<?php\n?>";
$new_entry = override_value_to_string('app_list_strings',
$dropdown_type, $dropdown_array);
if(empty($file_contents))
{
// empty file, must create the php tags
$new_contents = "<?php\n$new_entry\n?>";
}
else
{
// existing file, try to replace
$new_contents = replace_dropdown_type($dropdown_type,
$dropdown_array, $file_contents);
$new_contents = dropdown_duplicate_check($dropdown_type, $new_contents);
if($new_contents == $file_contents)
{
// replace failed, append to end of file
$new_contents = str_replace("?>", '', $file_contents);
$new_contents .= "\n$new_entry\n?>";
}
}
return $new_contents;
}
function replace_or_add_app_string($name, $value,
&$file_contents)
{
$new_contents = "<?php\n?>";
$new_entry = override_value_to_string('app_strings',
$name, $value);
if(empty($file_contents))
{
// empty file, must create the php tags
$new_contents = "<?php\n$new_entry\n?>";
}
else
{
// existing file, try to replace
$new_contents = replace_app_string($name,
$value, $file_contents);
$new_contents = app_string_duplicate_check($name, $new_contents);
if($new_contents == $file_contents)
{
// replace failed, append to end of file
$new_contents = str_replace("?>", '', $file_contents);
$new_contents .= "\n$new_entry\n?>";
}
}
return $new_contents;
}
function dropdown_duplicate_check($dropdown_type, &$file_contents)
{
if(!empty($dropdown_type) &&
!empty($file_contents))
{
$pattern = '/\$app_list_strings\[\''. $dropdown_type .
'\'\][\ ]*=[\ ]*array[\ ]*\([^\)]*\)[\ ]*;/';
$result = array();
preg_match_all($pattern, $file_contents, $result);
if(count($result[0]) > 1)
{
$new_entry = $result[0][0];
$new_contents = preg_replace($pattern, '', $file_contents);
// Append the new entry.
$new_contents = str_replace("?>", '', $new_contents);
$new_contents .= "\n$new_entry\n?>";
return $new_contents;
}
return $file_contents;
}
return $file_contents;
}
function replace_dropdown_type($dropdown_type, &$dropdown_array,
&$file_contents)
{
$new_contents = $file_contents;
if(!empty($dropdown_type) &&
is_array($dropdown_array) &&
!empty($file_contents))
{
$pattern = '/\$app_list_strings\[\''. $dropdown_type .
'\'\][\ ]*=[\ ]*array[\ ]*\([^\)]*\)[\ ]*;/';
$replacement = override_value_to_string('app_list_strings',
$dropdown_type, $dropdown_array);
$new_contents = preg_replace($pattern, $replacement, $file_contents, 1);
}
return $new_contents;
}
function replace_app_string($name, $value,
&$file_contents)
{
$new_contents = $file_contents;
if(!empty($name) &&
is_string($value) &&
!empty($file_contents))
{
$pattern = '/\$app_strings\[\''. $name .'\'\][\ ]*=[\ ]*\'[^\']*\'[\ ]*;/';
$replacement = override_value_to_string('app_strings',
$name, $value);
$new_contents = preg_replace($pattern, $replacement, $file_contents, 1);
}
return $new_contents;
}
function app_string_duplicate_check($name, &$file_contents)
{
if(!empty($name) &&
!empty($file_contents))
{
$pattern = '/\$app_strings\[\''. $name .'\'\][\ ]*=[\ ]*\'[^\']*\'[\ ]*;/';
$result = array();
preg_match_all($pattern, $file_contents, $result);
if(count($result[0]) > 1)
{
$new_entry = $result[0][0];
$new_contents = preg_replace($pattern, '', $file_contents);
// Append the new entry.
$new_contents = str_replace("?>", '', $new_contents);
$new_contents .= "\n$new_entry\n?>";
return $new_contents;
}
return $file_contents;
}
return $file_contents;
}
?>

View File

@@ -0,0 +1,126 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once("include/JSON.php");
$json = new JSON();
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
$title = getClassicModuleTitle(
"Administration",
array(
"<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>",
translate('LBL_CONFIGURE_SHORTCUT_BAR')
),
true
);
$msg = "";
global $theme, $currentModule, $app_list_strings, $app_strings;
$GLOBALS['log']->info("Administration ConfigureShortcutBar view");
$actions_path = "include/DashletContainer/Containers/DCActions.php";
//If save is set, save then let the user know if the save worked.
if (!empty($_REQUEST['enabled_modules']))
{
$toDecode = html_entity_decode ($_REQUEST['enabled_modules'], ENT_QUOTES);
$modules = json_decode($toDecode);
$out = "<?php\n \$DCActions = \n" . var_export_helper ( $modules ) . ";";
if (!is_file("custom/" . $actions_path))
create_custom_directory("include/DashletContainer/Containers/");
if ( file_put_contents ( "custom/" . $actions_path, $out ) === false)
echo translate("LBL_SAVE_FAILED");
else {
echo "true";
}
} else {
include($actions_path);
//Start with the default module
$availibleModules = $DCActions;
//Add the ones currently on the layout
if (is_file('custom/' . $actions_path))
{
include('custom/' . $actions_path);
$availibleModules = array_merge($availibleModules, $DCActions);
}
//Next add the ones we detect as having quick create defs.
$modules = $app_list_strings['moduleList'];
foreach ($modules as $module => $modLabel)
{
if (is_file("modules/$module/metadata/quickcreatedefs.php") || is_file("custom/modules/$module/metadata/quickcreatedefs.php"))
$availibleModules[$module] = $module;
}
$availibleModules = array_diff($availibleModules, $DCActions);
$enabled = array();
foreach($DCActions as $mod)
{
$enabled[] = array("module" => $mod, 'label' => translate($mod));
}
$disabled = array();
foreach($availibleModules as $mod)
{
$disabled[] = array("module" => $mod, 'label' => translate($mod));
}
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('MOD', $GLOBALS['mod_strings']);
$this->ss->assign('title', $title);
$this->ss->assign('enabled_modules', $json->encode ( $enabled ));
$this->ss->assign('disabled_modules',$json->encode ( $disabled));
$this->ss->assign('description', translate("LBL_CONFIGURE_SHORTCUT_BAR"));
$this->ss->assign('msg', $msg);
echo $this->ss->fetch('modules/Administration/templates/ShortcutBar.tpl');
}
?>

View File

@@ -0,0 +1,116 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/Administration/Forms.php');
require_once ('include/SubPanel/SubPanelDefinitions.php') ;
require_once("modules/MySettings/TabController.php");
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
$mod_list_strings_key_to_lower = array_change_key_case($app_list_strings['moduleList']);
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
////////////////// Processing Save
//if coming from save, iterate through array and save into user preferences
$panels_to_show = '';
$panels_to_hide = '';
if(isset($_REQUEST['Save_or_Cancel']) && $_REQUEST['Save_or_Cancel']=='save'){
if(isset($_REQUEST['disabled_panels']))
$panels_to_hide = $_REQUEST['disabled_panels'];
//turn list into array
$hidpanels_arr = explode(',',$panels_to_hide);
$hidpanels_arr = TabController::get_key_array($hidpanels_arr);
//save list of subpanels to hide
SubPanelDefinitions::set_hidden_subpanels($hidpanels_arr);
echo "true";
} else
{
////////////////// Processing UI
//create title for form
$title = get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CONFIGURE_SUBPANELS'].":", true);
//get list of all subpanels and panels to hide
$panels_arr = SubPanelDefinitions::get_all_subpanels();
$hidpanels_arr = SubPanelDefinitions::get_hidden_subpanels();
if(!$hidpanels_arr || !is_array($hidpanels_arr)) $hidpanels_arr = array();
//create array of subpanels to show, used to create Drag and Drop widget
$enabled = array();
foreach ($panels_arr as $key)
{
if(empty($key)) continue;
$key = strtolower($key);
$enabled[] = array("module" => $key, "label" => $mod_list_strings_key_to_lower[$key]);
}
//now create array of panels to hide for use in Drag and Drop widget
$disabled = array();
foreach ($hidpanels_arr as $key)
{
if(empty($key)) continue;
$key = strtolower($key);
$disabled[] = array("module" => $key, "label" => $mod_list_strings_key_to_lower[$key]);
}
$this->ss->assign('title', $title);
$this->ss->assign('description', $mod_strings['LBL_CONFIG_SUBPANELS']);
$this->ss->assign('enabled_panels', json_encode($enabled));
$this->ss->assign('disabled_panels', json_encode($disabled));
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
//echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CONFIG_SUBPANELS'], true);
echo $this->ss->fetch('modules/Administration/ConfigureSubPanelsForm.tpl');
}
?>

View File

@@ -0,0 +1,169 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<script type="text/javascript" src="include/javascript/sugar_grp_yui_widgets.js"></script>
<link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan='100'><h2>{$title}</h2></td></tr>
<tr><td colspan='100'>
{$description}
</td></tr><tr><td><br></td></tr><tr><td colspan='100'>
<form name="ConfigureSubPanels" method="POST">
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="ConfigureSubPanels">
<input type="hidden" name="disabled_panels" value="">
<input type="hidden" name="enabled_panels" value="">
<input type="hidden" name="Save_or_Cancel" value="save">
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" onclick="SUGAR.saveSubpanelSettings();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
<input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.ConfigureSubPanels.action.value='';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
</td>
</tr>
</table>
<div class='add_table' style='margin-bottom:5px'>
<table id="ConfigureSubPanels" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
<tr>
<td width='1%'>
<div id="enabled_div"></div>
</td>
<td>
<div id="disabled_div"></div>
</td>
</tr>
</table>
</div>
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" onclick="SUGAR.saveSubpanelSettings();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
<input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.ConfigureSubPanels.action.value='';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
</td>
</tr>
</table>
</form>
<script type="text/javascript">
(function(){ldelim}
var Connect = YAHOO.util.Connect;
Connect.url = 'index.php';
Connect.method = 'POST';
Connect.timeout = 300000;
var enabled_modules = {$enabled_panels};
var disabled_modules = {$disabled_panels};
var lblEnabled = '{sugar_translate label="LBL_VISIBLE_PANELS"}';
var lblDisabled = '{sugar_translate label="LBL_HIDDEN_PANELS"}';
{literal}
SUGAR.subEnabledTable = new YAHOO.SUGAR.DragDropTable(
"enabled_div",
[{key:"label", label: lblEnabled, width: 200, sortable: false},
{key:"module", label: lblEnabled, hidden:true}],
new YAHOO.util.LocalDataSource(enabled_modules, {
responseSchema: {
fields : [{key : "module"}, {key : "label"}]
}
}),
{height: "300px"}
);
SUGAR.subDisabledTable = new YAHOO.SUGAR.DragDropTable(
"disabled_div",
[{key:"label", label: lblDisabled, width: 200, sortable: false},
{key:"module", label: lblDisabled, hidden:true}],
new YAHOO.util.LocalDataSource(disabled_modules, {
responseSchema: {
fields : [{key : "module"}, {key : "label"}]
}
}),
{height: "300px"}
);
SUGAR.subEnabledTable.disableEmptyRows = true;
SUGAR.subDisabledTable.disableEmptyRows = true;
SUGAR.subEnabledTable.addRow({module: "", label: ""});
SUGAR.subDisabledTable.addRow({module: "", label: ""});
SUGAR.subEnabledTable.render();
SUGAR.subDisabledTable.render();
SUGAR.saveSubpanelSettings = function()
{
var disabledTable = SUGAR.subDisabledTable;
var panels = "";
for(var i=0; i < disabledTable.getRecordSet().getLength(); i++){
var data = disabledTable.getRecord(i).getData();
if (data.module && data.module != '')
panels += "," + data.module;
}
panels = panels == "" ? panels : panels.substr(1);
ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
Connect.asyncRequest(
Connect.method,
Connect.url,
{success: SUGAR.saveCallBack},
SUGAR.util.paramsToUrl({
module: "Administration",
action: "ConfigureSubPanels",
Save_or_Cancel:'save',
disabled_panels: panels
}) + "to_pdf=1"
);
return true;
}
SUGAR.saveCallBack = function(o)
{
ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
if (o.responseText == "true")
{
window.location.assign('index.php?module=Administration&action=ConfigureSubPanels');
}
else
{
YAHOO.SUGAR.MessageBox.show({msg:o.responseText});
}
}
})();
{/literal}
</script>

View File

@@ -0,0 +1,94 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/Administration/Forms.php');
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
$title = get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CONFIGURE_TABS'].":", true);
global $theme, $currentModule, $app_list_strings, $app_strings;
$GLOBALS['log']->info("Administration ConfigureTabs view");
require_once("modules/MySettings/TabController.php");
$controller = new TabController();
$tabs = $controller->get_tabs_system();
$enabled= array();
foreach ($tabs[0] as $key=>$value)
{
$enabled[] = array("module" => $key, 'label' => translate($key));
}
$disabled = array();
foreach ($tabs[1] as $key=>$value)
{
$disabled[] = array("module" => $key, 'label' => translate($key));
}
$user_can_edit = $controller->get_users_can_edit();
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('MOD', $GLOBALS['mod_strings']);
$this->ss->assign('title', $title);
$this->ss->assign('user_can_edit', $user_can_edit);
$this->ss->assign('enabled_tabs', json_encode($enabled));
$this->ss->assign('disabled_tabs', json_encode($disabled));
$this->ss->assign('description', $mod_strings['LBL_CONFIG_TABS']);
echo $this->ss->fetch('modules/Administration/ConfigureTabs.tpl');
?>

View File

@@ -0,0 +1,141 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
<script type="text/javascript" src="include/javascript/sugar_grp_yui_widgets.js"></script>
<style>.yui-dt-scrollable .yui-dt-bd {ldelim}overflow-x: hidden;{rdelim}</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan='100'><h2>{$title}</h2></td></tr>
<tr><td colspan='100'>
{$description}
</td></tr><tr><td><br></td></tr><tr><td colspan='100'>
<form name="ConfigureTabs" method="POST" method="POST" action="index.php">
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="SaveTabs">
<input type="hidden" id="enabled_tabs" name="enabled_tabs" value="">
<input type="hidden" name="disabled_tabs" value="">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="SUGAR.saveConfigureTabs();this.form.action.value='SaveTabs'; " type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" >
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
</td>
</tr>
</table>
<input type='checkbox' name='user_edit_tabs' value=1 class='checkbox' {if !empty($user_can_edit)}CHECKED{/if}>&nbsp;<b onclick='document.EditView.user_edit_tabs.checked= !document.EditView.user_edit_tabs.checked' style='cursor:default'>{$MOD.LBL_ALLOW_USER_TABS}</b>
<div class='add_table' style='margin-bottom:5px'>
<table id="ConfigureTabs" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
<tr>
<td width='1%'>
<div id="enabled_div" class="enabled_tab_workarea">
</div>
</td>
<td>
<div id="disabled_div" class="disabled_tab_workarea">
</div>
</td>
</tr>
</table>
</div>
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="SUGAR.saveConfigureTabs();this.form.action.value='SaveTabs'; " type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" >
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
</td>
</tr>
</table>
</form>
<script type="text/javascript">
(function(){ldelim}
var enabled_modules = {$enabled_tabs};
var disabled_modules = {$disabled_tabs};
var lblEnabled = '{sugar_translate label="LBL_VISIBLE_TABS"}';
var lblDisabled = '{sugar_translate label="LBL_HIDDEN_TABS"}';
{literal}
SUGAR.enabledTabsTable = new YAHOO.SUGAR.DragDropTable(
"enabled_div",
[{key:"label", label: lblEnabled, width: 200, sortable: false},
{key:"module", label: lblEnabled, hidden:true}],
new YAHOO.util.LocalDataSource(enabled_modules, {
responseSchema: {
resultsList : "modules",
fields : [{key : "module"}, {key : "label"}]
}
}),
{height: "300px"}
);
SUGAR.disabledTabsTable = new YAHOO.SUGAR.DragDropTable(
"disabled_div",
[{key:"label", label: lblDisabled, width: 200, sortable: false},
{key:"module", label: lblDisabled, hidden:true}],
new YAHOO.util.LocalDataSource(disabled_modules, {
responseSchema: {
resultsList : "modules",
fields : [{key : "module"}, {key : "label"}]
}
}),
{height: "300px"}
);
SUGAR.enabledTabsTable.disableEmptyRows = true;
SUGAR.disabledTabsTable.disableEmptyRows = true;
SUGAR.enabledTabsTable.addRow({module: "", label: ""});
SUGAR.disabledTabsTable.addRow({module: "", label: ""});
SUGAR.enabledTabsTable.render();
SUGAR.disabledTabsTable.render();
SUGAR.saveConfigureTabs = function()
{
var enabledTable = SUGAR.enabledTabsTable;
var modules = [];
for(var i=0; i < enabledTable.getRecordSet().getLength(); i++){
var data = enabledTable.getRecord(i).getData();
if (data.module && data.module != '')
modules[i] = data.module;
}
YAHOO.util.Dom.get('enabled_tabs').value = YAHOO.lang.JSON.stringify(modules);
}
})();
{/literal}
</script>

View File

@@ -0,0 +1,71 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $theme;
global $currentModule;
global $gridline;
// echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_UPGRADE_TITLE'], true);
echo get_module_title('Customize Fields', 'Customize Fields', true);
?>
<table cellspacing="<?php echo $gridline; ?>" class="other view">
<tr>
<td>
<form>
Module Name:
<select>
<?php
foreach($moduleList as $module)
{
echo "<option>$module</option>";
}
?>
</select>
<input type="button" value="Edit" />
</form>
</td>
</tr>
</table>

View File

@@ -0,0 +1,63 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $theme;
global $currentModule;
global $gridline;
echo get_module_title('MigrateFields', $mod_strings['LBL_EXTERNAL_DEV_TITLE'], true);
?>
<p>
<table cellspacing="<?php echo $gridline;?>" class="other view">
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('ImportCustomFields','alt="'. $mod_strings['LBL_IMPORT_CUSTOM_FIELDS_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=ImportCustomFieldStructure" class="tabDetailViewDL2Link"><?php echo $mod_strings['LBL_IMPORT_CUSTOM_FIELDS_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_IMPORT_CUSTOM_FIELDS'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('ExportCustomFields','alt="'. $mod_strings['LBL_EXPORT_CUSTOM_FIELDS_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=ExportCustomFieldStructure" class="tabDetailViewDL2Link"><?php echo $mod_strings['LBL_EXPORT_CUSTOM_FIELDS_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_EXPORT_CUSTOM_FIELDS'] ; ?> </td>
</tr>
</table></p>

View File

@@ -0,0 +1,137 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<form name="Diagnostic" method="POST" action="index.php">
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="DiagnosticRun">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<input title="{MOD.LBL_DIAG_EXECUTE_BUTTON}" class="button" onclick="this.form.action.value='DiagnosticRun';" type="submit" name="button" value=" {MOD.LBL_DIAG_EXECUTE_BUTTON} " >
<input title="{MOD.LBL_DIAG_CANCEL_BUTTON}" class="button" onclick="this.form.action.value='index'; this.form.module.value='Administration'; " type="submit" name="button" value=" {MOD.LBL_DIAG_CANCEL_BUTTON} "></td>
</tr>
</table>
<BR>
<div id="table" style="visibility:visible">
<BR>
<table id="maintable" width="430" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
{NO_MYSQL_MESSAGE}
<tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_CONFIGPHP}</slot></td>
<td ><slot><input name='configphp' class="checkbox" type="checkbox" tabindex='1' checked></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_CUSTOMDIR}</slot></td>
<td ><slot><input name='custom_dir' class="checkbox" type="checkbox" tabindex='2' checked></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_PHPINFO}</slot></td>
<td ><slot><input name='phpinfo' class="checkbox" type="checkbox" tabindex='3' checked></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_MYSQLDUMPS}</slot></td>
<td ><slot><input name='mysql_dumps' class="checkbox" type="checkbox" tabindex='4' {MYSQL_CAPABLE}></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_MYSQLSCHEMA}</slot></td>
<td ><slot><input name='mysql_schema' class="checkbox" type="checkbox" tabindex='5' {MYSQL_CAPABLE}></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_MYSQLINFO}</slot></td>
<td ><slot><input name='mysql_info' class="checkbox" type="checkbox" tabindex='6' {MYSQL_CAPABLE}></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_MD5}</slot></td>
<td ><slot><input name='md5' class="checkbox" type="checkbox" tabindex='7' onclick="md5checkboxes()" checked></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_FILESMD5}</slot></td>
<td ><slot><input name='md5filesmd5' class="checkbox" type="checkbox" tabindex='8' ></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_CALCMD5}</slot></td>
<td ><slot><input name='md5calculated' class="checkbox" type="checkbox" tabindex='9' ></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_BLBF}</slot></td>
<td ><slot><input name='beanlistbeanfiles' class="checkbox" type="checkbox" tabindex='10' checked></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_SUGARLOG}</slot></td>
<td ><slot><input name='sugarlog' class="checkbox" type="checkbox" tabindex='11' checked></slot></td>
</tr><tr>
<td scope="row"><slot>{MOD.LBL_DIAGNOSTIC_VARDEFS}</slot></td>
<td ><slot><input name='vardefs' class="checkbox" type="checkbox" tabindex='11' checked></slot></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
{MYSQL_CAPABLE_CHECKBOXES}
<script type="text/javascript" language="Javascript">
var md5filesmd5_checked;
var md5calculated_checked;
function show(id) {
document.getElementById(id).style.display="block";
}
function md5checkboxes(){
if (document.Diagnostic.md5.checked == false){
md5filesmd5_checked = document.Diagnostic.md5filesmd5.checked;
md5calculated_checked = document.Diagnostic.md5calculated.checked;
document.Diagnostic.md5filesmd5.checked=false;
document.Diagnostic.md5calculated.checked=false;
document.Diagnostic.md5filesmd5.disabled=true;
document.Diagnostic.md5calculated.disabled=true;
}
else{
document.Diagnostic.md5filesmd5.disabled=false;
document.Diagnostic.md5calculated.disabled=false;
document.Diagnostic.md5filesmd5.checked=md5filesmd5_checked;
document.Diagnostic.md5calculated.checked=md5calculated_checked;
}
}
</script>
<!-- END: main -->

View File

@@ -0,0 +1,107 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $theme;
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
global $db;
if(empty($db)) {
$db = DBManagerFactory::getInstance();
}
echo getClassicModuleTitle(
"Administration",
array(
"<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>",
translate('LBL_DIAGNOSTIC_TITLE')
),
true
);
global $currentModule;
$GLOBALS['log']->info("Administration Diagnostic");
$xtpl=new XTemplate ('modules/Administration/Diagnostic.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
if($db->dbType != 'mysql'){
$xtpl->assign("NO_MYSQL_MESSAGE", "<tr><td class=\"dataLabel\"><slot><font color=red>".
$mod_strings['LBL_DIAGNOSTIC_NO_MYSQL'].
"</font></slot></td></tr><tr><td>&nbsp;</td></tr>");
$xtpl->assign("MYSQL_CAPABLE", "");
$xtpl->assign("MYSQL_CAPABLE_CHECKBOXES",
"<script type=\"text/javascript\" language=\"Javascript\"> ".
"document.Diagnostic.mysql_dumps.disabled=true;".
"document.Diagnostic.mysql_schema.disabled=true;".
"document.Diagnostic.mysql_info.disabled=true;".
"</script>"
);
}else{
$xtpl->assign("NO_MYSQL_MESSAGE", "");
$xtpl->assign("MYSQL_CAPABLE", "checked");
$xtpl->assign("MYSQL_CAPABLE_CHECKBOXES", "");
}
$xtpl->assign("RETURN_MODULE", "Administration");
$xtpl->assign("RETURN_ACTION", "index");
$xtpl->assign("MODULE", $currentModule);
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("ADVANCED_SEARCH_PNG", SugarThemeRegistry::current()->getImage('advanced_search','alt="'.$app_strings['LNK_ADVANCED_SEARCH'].'" border="0"'));
$xtpl->assign("BASIC_SEARCH_PNG", SugarThemeRegistry::current()->getImage('basic_search','alt="'.$app_strings['LNK_BASIC_SEARCH'].'" border="0"'));
$xtpl->parse("main");
$xtpl->out("main");
?>

View File

@@ -0,0 +1,73 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
echo getClassicModuleTitle(
"Administration",
array(
"<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>",
translate('LBL_DIAGNOSTIC_TITLE')
),
true
);
if(!isset($_REQUEST['file']) || !isset($_REQUEST['guid']))
{
echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
}
else
{
//Making sure someone doesn't pass a variable name as a false reference
// to delete a file
if(strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
{
die($mod_strings['LBL_DIAGNOSTIC_DELETE_DIE']);
}
if(file_exists("{$GLOBALS['sugar_config']['cache_dir']}diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip"))
{
unlink("{$GLOBALS['sugar_config']['cache_dir']}diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip");
rmdir("{$GLOBALS['sugar_config']['cache_dir']}diagnostic/".$_REQUEST['guid']);
echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
}
else
echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
}
print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN'] . "</a><br>";
?>

View File

@@ -0,0 +1,64 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
if(!isset($_REQUEST['guid']) || !isset($_REQUEST['time']))
{
die('Did not receive a filename to download');
}
$time = str_replace(array('.', '/', '\\'), '', $_REQUEST['time']);
$guid = str_replace(array('.', '/', '\\'), '', $_REQUEST['guid']);
$path = getcwd()."/{$GLOBALS['sugar_config']['cache_dir']}diagnostic/{$guid}/diagnostic{$time}.zip";
$filesize = filesize($path);
ob_clean();
header('Content-Description: File Transfer');
header('Content-type: application/octet-stream');
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Disposition: attachment; filename=$guid.zip");
header("Content-Transfer-Encoding: binary");
header("Content-Length: $filesize");
readfile($path);
?>

View File

@@ -0,0 +1,836 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once( 'include/utils/progress_bar_utils.php' );
require_once( 'include/utils/zip_utils.php' );
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
global $skip_md5_diff;
$skip_md5_diff = false;
set_time_limit(3600);
// get all needed globals
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $theme;
global $db;
if(empty($db)) {
$db = DBManagerFactory::getInstance();
}
global $current_user;
if(!is_admin($current_user)){
die($mod_strings['LBL_DIAGNOSTIC_ACCESS']);
}
global $sugar_config;
global $beanFiles;
//get sugar version and flavor
global $sugar_version;
global $sugar_flavor;
//guid used for directory path
global $sod_guid;
$sod_guid = create_guid();
//GET CURRENT DATETIME STAMP TO USE IN FILENAME
global $curdatetime;
$curdatetime = date("Ymd-His");
global $progress_bar_percent;
$progress_bar_percent = 0;
global $totalweight;
$totalweight = 0;
global $totalitems;
$totalitems = 0;
global $currentitems;
$currentitems = 0;
define("CONFIG_WEIGHT", 1);
define("CUSTOM_DIR_WEIGHT", 1);
define("PHPINFO_WEIGHT", 1);
define("MYSQL_DUMPS_WEIGHT", 2);
define("MYSQL_SCHEMA_WEIGHT", 3);
define("MYSQL_INFO_WEIGHT", 1);
define("MD5_WEIGHT", 5);
define("BEANLISTBEANFILES_WEIGHT", 1);
define("SUGARLOG_WEIGHT", 2);
define("VARDEFS_WEIGHT", 2);
//THIS MUST CHANGE IF THE NUMBER OF DIRECTORIES TRAVERSED TO GET TO
// THE DIAGNOSTIC CACHE DIR CHANGES
define("RETURN_FROM_DIAG_DIR", "../../../..");
global $getDumpsFrom;
$getDumpsFrom = Array();
global $cacheDir;
$cacheDir = "";
function sodUpdateProgressBar($itemweight){
global $progress_bar_percent;
global $totalweight;
global $totalitems;
global $currentitems;
$currentitems++;
if($currentitems == $totalitems)
update_progress_bar("diagnostic", 100, 100);
else
{
$progress_bar_percent += ($itemweight / $GLOBALS['totalweight'] * 100);
update_progress_bar("diagnostic", $progress_bar_percent, 100);
}
}
// expects a string containing the name of the table you would like to get the dump of
// expects there to already be a connection to mysql and the 'use database_name' to be done
// returns a string containing (in html) the dump of all rows
function getFullTableDump($tableName){
global $db;
$returnString = "<table border=\"1\">";
$returnString .= "<tr><b><center>Table ".$tableName."</center></b></tr>";
//get table field definitions
$definitions = array();
$def_result = $db->query("describe ".$tableName);
if(!$def_result)
{
return mysql_error();
}
else
{
$returnString .= "<tr><td><b>Row Num</b></td>";
$def_count = 0;
while($row = $db->fetchByAssoc($def_result))
{
$row = array_values($row);
$definitions[$def_count] = $row[0];
$def_count++;
$returnString .= "<td><b>".$row[0]."</b></td>";
}
$returnString .= "</tr>";
}
$td_result = $db->query("select * from ".$tableName);
if(!$td_result)
{
return mysql_error();
}
else
{
$row_counter = 1;
while($row = $db->fetchByAssoc($td_result))
{
$row = array_values($row);
$returnString .= "<tr>";
$returnString .= "<td>".$row_counter."</td>";
for($counter = 0; $counter < $def_count; $counter++){
$replace_val = false;
//perform this check when counter is set to two, which means it is on the 'value' column
if($counter == 2){
//if the previous "name" column value was set to smtppass, set replace_val to true
if(strcmp($row[$counter - 1], "smtppass") == 0 )
$replace_val = true;
//if the previous "name" column value was set to smtppass,
//and the "category" value set to ldap, set replace_val to true
if (strcmp($row[$counter - 2], "ldap") == 0 && strcmp($row[$counter - 1], "admin_password") == 0)
$replace_val = true;
//if the previous "name" column value was set to password,
//and the "category" value set to proxy, set replace_val to true
if(strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0 )
$replace_val = true;
}
if($replace_val)
$returnString .= "<td>********</td>";
else
$returnString .= "<td>".($row[$counter] == "" ? "&nbsp;" : $row[$counter])."</td>";
}
$row_counter++;
$returnString .= "</tr>";
}
}
$returnString .= "</table>";
return $returnString;
}
// Deletes the directory recursively
function deleteDir($dir)
{
if (substr($dir, strlen($dir)-1, 1) != '/')
$dir .= '/';
if ($handle = opendir($dir))
{
while ($obj = readdir($handle))
{
if ($obj != '.' && $obj != '..')
{
if (is_dir($dir.$obj))
{
if (!deleteDir($dir.$obj))
return false;
}
elseif (is_file($dir.$obj))
{
if (!unlink($dir.$obj))
return false;
}
}
}
closedir($handle);
if (!@rmdir($dir))
return false;
return true;
}
return false;
}
function prepareDiag()
{
global $getDumpsFrom;
global $cacheDir;
global $curdatetime;
global $progress_bar_percent;
global $skip_md5_diff;
global $sod_guid;
global $mod_strings;
echo getClassicModuleTitle(
"Administration",
array(
"<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>",
translate('LBL_DIAGNOSTIC_TITLE')
),
true
);
echo "<BR>";
echo $mod_strings['LBL_DIAGNOSTIC_EXECUTING'];
echo "<BR>";
//determine if files.md5 exists or not
if(file_exists('files.md5'))
$skip_md5_diff = false;
else
$skip_md5_diff = true;
// array of all tables that we need to pull rows from below
$getDumpsFrom = array('config' => 'config',
'fields_meta_data' => 'fields_meta_data',
'upgrade_history' => 'upgrade_history',
'versions' => 'versions',
);
//Creates the diagnostic directory in the cache directory
$cacheDir = create_cache_directory("diagnostic/");
$cacheDir = create_cache_directory("diagnostic/".$sod_guid);
$cacheDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/");
display_progress_bar("diagnostic", $progress_bar_percent, 100);
ob_flush();
}
function executesugarlog()
{
//BEGIN COPY SUGARCRM.LOG
//Copies the Sugarcrm log to our diagnostic directory
global $cacheDir;
require_once('include/SugarLogger/SugarLogger.php');
$logger = new SugarLogger();
if(!copy($logger->getLogFileNameWithPath(), $cacheDir.'/'.$logger->getLogFileName())) {
echo "Couldn't copy sugarcrm.log to cacheDir.<br>";
}
//END COPY SUGARCRM.LOG
//UPDATING PROGRESS BAR
sodUpdateProgressBar(SUGARLOG_WEIGHT);
}
function executephpinfo()
{
//BEGIN GETPHPINFO
//This gets phpinfo, writes to a buffer, then I write to phpinfo.html
global $cacheDir;
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_clean();
$handle = sugar_fopen($cacheDir."phpinfo.html", "w");
if(fwrite($handle, $phpinfo) === FALSE){
echo "Cannot write to file ".$cacheDir."phpinfo.html<br>";
}
fclose($handle);
//END GETPHPINFO
//UPDATING PROGRESS BAR
sodUpdateProgressBar(PHPINFO_WEIGHT);
}
function executeconfigphp()
{
//BEGIN COPY CONFIG.PHP
//store db_password in temp var so we can get config.php w/o making anyone angry
global $cacheDir; global $sugar_config;
$tempPass = $sugar_config['dbconfig']['db_password'];
$sugar_config['dbconfig']['db_password'] = '********';
//write config.php to a file
write_array_to_file("Diagnostic", $sugar_config, $cacheDir."config.php");
//restore db_password so everything still works
$sugar_config['dbconfig']['db_password'] = $tempPass;
//END COPY CONFIG.PHP
//UPDATING PROGRESS BAR
sodUpdateProgressBar(CONFIG_WEIGHT);
}
function executemysql($getinfo, $getdumps, $getschema)
{
//BEGIN GET DB INFO
global $getDumpsFrom;
global $curdatetime;
global $sugar_config;
global $progress_bar_percent;
global $sod_guid;
global $db;
if($db->dbType != "mysql") {
if($getinfo) sodUpdateProgressBar(MYSQL_INFO_WEIGHT);
if($getschema) sodUpdateProgressBar(MYSQL_SCHEMA_WEIGHT);
if($getdumps) sodUpdateProgressBar(MYSQL_DUMPS_WEIGHT);
return;
}
$mysqlInfoDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/MySQL/");
//create directory for table definitions
if($getschema)
$tablesSchemaDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/MySQL/TableSchema/");
//BEGIN GET MYSQL INFO
//make sure they checked the box to get basic info
if($getinfo)
{
ob_start();
echo "MySQL Version: ".(function_exists('mysqli_get_client_info') ? @mysqli_get_client_info() : @mysql_get_client_info())."<BR>";
echo "MySQL Host Info: ".(function_exists('mysqli_get_host_info') ? @mysqli_get_host_info($db->getDatabase()) : @mysql_get_host_info())."<BR>";
echo "MySQL Server Info: ".(function_exists('mysqli_get_client_info') ? @mysqli_get_client_info() : @mysql_get_client_info())."<BR>";
echo "MySQL Client Encoding: ".(function_exists('mysqli_character_set_name') ? @mysqli_character_set_name($db->getDatabase()) : @mysql_client_encoding())."<BR>";
/* Uncomment to get current processes as well
echo "<BR>MySQL Processes<BR>";
$res = $db->query('SHOW PROCESSLIST');
echo "<table border=\"1\"><tr><th>Id</th><th>Host</th><th>db</th><th>Command</th><th>Time</th></tr>";
if($db->getRowCount($res) > 0)
{
while($row = $db->fetchByAssoc($res))
{
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",
$row['Id'], $row['Host'], $row['db'], $row['Command'], $row['Time']
);
}
echo "</table><br>";
}
else
{
echo "</table>";
echo "No processes running<br>";
}
*/
echo "<BR>MySQL Character Set Settings<BR>";
$res = $db->query("show variables like 'character\_set\_%'");
echo "<table border=\"1\"><tr><th>Variable Name</th><th>Value</th></tr>";
while($row = $db->fetchByAssoc($res))
{
printf("<tr><td>%s</td><td>%s</td></tr>",
$row['Variable_name'], $row['Value']
);
}
echo "</table>";
$content = ob_get_contents();
ob_clean();
$handle = sugar_fopen($mysqlInfoDir."MySQL-General-info.html", "w");
if(fwrite($handle, $content) === FALSE){
echo "Cannot write to file ".$mysqlInfoDir."_MySQL-General-info.html<br>";
}
fclose($handle);
//BEGIN UPDATING PROGRESS BAR
sodUpdateProgressBar(MYSQL_INFO_WEIGHT);
//END UPDATING PROGRESS BAR
}
//END GET MYSQL INFO
if($getschema)
{
//BEGIN GET ALL TABLES SCHEMAS
$all_tables = $db->getTablesArray();
global $theme_path;
ob_start();
echo "<style>";
echo file_get_contents($theme_path."style.css");
echo "</style>";
foreach($all_tables as $tablename){
//setting up table header for each file
echo "<table border=\"0\" cellpadding=\"0\" class=\"tabDetailView\">";
echo "<tr>MySQL ".$tablename." Definitions:</tr>".
"<tr><td class=\"tabDetailViewDL\"><b>Field</b></td>".
"<td class=\"tabDetailViewDL\">Type</td>".
"<td class=\"tabDetailViewDL\">Null</td>".
"<td class=\"tabDetailViewDL\">Key</td>".
"<td class=\"tabDetailViewDL\">Default</td>".
"<td class=\"tabDetailViewDL\">Extra</td></tr>";
$describe = $db->query("describe ".$tablename);
while($inner_row = $db->fetchByAssoc($describe)){
$inner_row = array_values($inner_row);
echo "<tr><td class=\"tabDetailViewDF\"><b>".$inner_row[0]."</b></td>";
echo "<td class=\"tabDetailViewDF\">".$inner_row[1]."</td>";
echo "<td class=\"tabDetailViewDF\">".$inner_row[2]."</td>";
echo "<td class=\"tabDetailViewDF\">".$inner_row[3]."</td>";
echo "<td class=\"tabDetailViewDF\">".$inner_row[4]."</td>";
echo "<td class=\"tabDetailViewDF\">".$inner_row[5]."</td></tr>";
}
echo "</table>";
echo "<BR><BR>";
}
$content = ob_get_contents();
ob_clean();
$handle = sugar_fopen($tablesSchemaDir."MySQLTablesSchema.html", "w");
if(fwrite($handle, $content) === FALSE){
echo "Cannot write to file ".$tablesSchemaDir."MySQLTablesSchema.html<br>";
}
fclose($handle);
//END GET ALL TABLES SCHEMAS
//BEGIN UPDATING PROGRESS BAR
sodUpdateProgressBar(MYSQL_SCHEMA_WEIGHT);
//END UPDATING PROGRESS BAR
}
if($getdumps)
{
//BEGIN GET TABLEDUMPS
$tableDumpsDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/MySQL/TableDumps/");
foreach ($getDumpsFrom as $table)
{
ob_start();
//calling function defined above to get the string for dump
echo getFullTableDump($table);
$content = ob_get_contents();
ob_clean();
$handle = sugar_fopen($tableDumpsDir.$table.".html", "w");
if(fwrite($handle, $content) === FALSE){
echo "Cannot write to file ".$tableDumpsDir.$table."html<br>";
}
fclose($handle);
}
//END GET TABLEDUMPS
//BEGIN UPDATING PROGRESS BAR
sodUpdateProgressBar(MYSQL_DUMPS_WEIGHT);
//END UPDATING PROGRESS BAR
}
//END GET DB INFO
}
function executebeanlistbeanfiles()
{
//BEGIN CHECK BEANLIST FILES ARE AVAILABLE
global $cacheDir;
global $beanList;
global $beanFiles;
global $mod_strings;
ob_start();
echo $mod_strings['LBL_DIAGNOSTIC_BEANLIST_DESC'];
echo "<BR>";
echo "<font color=green>";
echo $mod_strings['LBL_DIAGNOSTIC_BEANLIST_GREEN'];
echo "</font>";
echo "<BR>";
echo "<font color=orange>";
echo $mod_strings['LBL_DIAGNOSTIC_BEANLIST_ORANGE'];
echo "</font>";
echo "<BR>";
echo "<font color=red>";
echo $mod_strings['LBL_DIAGNOSTIC_BEANLIST_RED'];
echo "</font>";
echo "<BR><BR>";
foreach ($beanList as $beanz)
{
if(!isset($beanFiles[$beanz]))
{
echo "<font color=orange>NO! --- ".$beanz." is not an index in \$beanFiles</font><br>";
}
else
{
if(file_exists($beanFiles[$beanz]))
echo "<font color=green>YES --- ".$beanz." file \"".$beanFiles[$beanz]."\" exists</font><br>";
else
echo "<font color=red>NO! --- ".$beanz." file \"".$beanFiles[$beanz]."\" does NOT exist</font><br>";
}
}
$content = ob_get_contents();
ob_clean();
$handle = sugar_fopen($cacheDir."beanFiles.html", "w");
if(fwrite($handle, $content) === FALSE){
echo "Cannot write to file ".$cacheDir."beanFiles.html<br>";
}
fclose($handle);
//END CHECK BEANLIST FILES ARE AVAILABLE
//BEGIN UPDATING PROGRESS BAR
sodUpdateProgressBar(BEANLISTBEANFILES_WEIGHT);
//END UPDATING PROGRESS BAR
}
function executecustom_dir()
{
//BEGIN ZIP AND SAVE CUSTOM DIRECTORY
global $cacheDir;
zip_dir("custom", $cacheDir."custom_directory.zip");
//END ZIP AND SAVE CUSTOM DIRECTORY
//BEGIN UPDATING PROGRESS BAR
sodUpdateProgressBar(CUSTOM_DIR_WEIGHT);
//END UPDATING PROGRESS BAR
}
function executemd5($filesmd5, $md5calculated)
{
//BEGIN ALL MD5 CHECKS
global $curdatetime;
global $skip_md5_diff;
global $sod_guid;
if(file_exists('files.md5'))
include( 'files.md5');
//create dir for md5s
$md5_directory = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/md5/");
//skip this if the files.md5 didn't exist
if(!$skip_md5_diff)
{
//make sure the files.md5
if($filesmd5)
if(!copy('files.md5', $md5_directory."files.md5"))
echo "Couldn't copy files.md5 to ".$md5_directory."<br>Skipping md5 checks.<br>";
}
$md5_string_calculated = generateMD5array('./');
if($md5calculated)
write_array_to_file('md5_string_calculated', $md5_string_calculated, $md5_directory."md5_array_calculated.php");
//if the files.md5 didn't exist, we can't do this
if(!$skip_md5_diff)
{
$md5_string_diff = array_diff($md5_string_calculated, $md5_string);
write_array_to_file('md5_string_diff', $md5_string_diff, $md5_directory."md5_array_diff.php");
}
//END ALL MD5 CHECKS
//BEGIN UPDATING PROGRESS BAR
sodUpdateProgressBar(MD5_WEIGHT);
//END UPDATING PROGRESS BAR
}
function executevardefs()
{
//BEGIN DUMP OF SUGAR SCHEMA (VARDEFS)
//END DUMP OF SUGAR SCHEMA (VARDEFS)
//BEGIN UPDATING PROGRESS BAR
//This gets the vardefs, writes to a buffer, then I write to vardefschema.html
global $cacheDir;
global $beanList;
global $beanFiles;
global $dictionary;
global $sugar_version;
global $sugar_db_version;
global $sugar_flavor;
ob_start();
foreach ( $beanList as $beanz ) {
// echo "Module: ".$beanz."<br>";
$path_parts = pathinfo( $beanFiles[ $beanz ] );
$vardefFileName = $path_parts[ 'dirname' ]."/vardefs.php";
if( file_exists( $vardefFileName )) {
// echo "<br>".$vardefFileName."<br>";
include_once( $vardefFileName );
}
}
echo "<html>";
echo "<BODY>";
echo "<H1>Schema listing based on vardefs</H1>";
echo "<P>Sugar version: ".$sugar_version." / Sugar DB version: ".$sugar_db_version." / Sugar flavor: ".$sugar_flavor;
echo "</P>";
echo "<style> th { text-align: left; } </style>";
$tables = array();
foreach($dictionary as $vardef) {
$tables[] = $vardef['table'];
$fields[$vardef['table']] = $vardef['fields'];
$comments[$vardef['table']] = $vardef['comment'];
}
asort($tables);
foreach($tables as $t) {
$name = $t;
if ( $name == "does_not_exist" )
continue;
$comment = $comments[$t];
echo "<h2>Table: $t</h2>
<p><i>{$comment}</i></p>";
echo "<table border=\"0\" cellpadding=\"3\" class=\"tabDetailView\">";
echo '<TR BGCOLOR="#DFDFDF">
<TD NOWRAP ALIGN=left class=\"tabDetailViewDL\">Column</TD>
<TD NOWRAP class=\"tabDetailViewDL\">Type</TD>
<TD NOWRAP class=\"tabDetailViewDL\">Length</TD>
<TD NOWRAP class=\"tabDetailViewDL\">Required</TD>
<TD NOWRAP class=\"tabDetailViewDL\">Comment</TD>
</TR>';
ksort( $fields[ $t ] );
foreach($fields[$t] as $k => $v) {
// we only care about physical tables ('source' can be 'non-db' or 'nondb' or 'function' )
if ( isset( $v[ 'source' ] ))
continue;
$columnname = $v[ 'name' ];
$columntype = $v[ 'type' ];
$columndbtype = $v[ 'dbType' ];
$columnlen = $v[ 'len' ];
$columncomment = $v[ 'comment' ];
$columnrequired = $v[ 'required' ];
if ( empty( $columnlen ) ) $columnlen = '<i>n/a</i>';
if ( empty( $columncomment ) ) $columncomment = '<i>(none)</i>';
if ( !empty( $columndbtype ) ) $columntype = $columndbtype;
if ( empty( $columnrequired ) || ( $columnrequired == false ))
$columndisplayrequired = 'no';
else
$columndisplayrequired = 'yes';
echo '<TR BGCOLOR="#FFFFFF" ALIGN=left>
<TD ALIGN=left class=\"tabDetailViewDF\">'.$columnname.'</TD>
<TD NOWRAP class=\"tabDetailViewDF\">'.$columntype.'</TD>
<TD NOWRAP class=\"tabDetailViewDF\">'.$columnlen.'</TD>
<TD NOWRAP class=\"tabDetailViewDF"\">'.$columndisplayrequired.'</TD>
<TD WRAP class=\"tabDetailViewDF\">'.$columncomment.'</TD></TR>';
}
echo "</table></p>";
}
echo "</body></html>";
$vardefFormattedOutput = ob_get_contents();
ob_clean();
$handle = sugar_fopen($cacheDir."vardefschema.html", "w");
if(fwrite($handle, $vardefFormattedOutput) === FALSE){
echo "Cannot write to file ".$cacheDir."vardefschema.html<br>";
}
fclose($handle);
sodUpdateProgressBar(VARDEFS_WEIGHT);
//END UPDATING PROGRESS BAR
}
function finishDiag(){
//BEGIN ZIP ALL FILES AND EXTRACT IN CACHE ROOT
global $cacheDir;
global $curdatetime;
global $sod_guid;
global $mod_strings;
chdir($cacheDir);
zip_dir(".", "../diagnostic".$curdatetime.".zip");
//END ZIP ALL FILES AND EXTRACT IN CACHE ROOT
chdir(RETURN_FROM_DIAG_DIR);
deleteDir($cacheDir);
print "<a href=\"index.php?module=Administration&action=DiagnosticDownload&guid=$sod_guid&time=$curdatetime\">".$mod_strings['LBL_DIAGNOSTIC_DOWNLOADLINK']."</a><BR>";
print "<a href=\"index.php?module=Administration&action=DiagnosticDelete&file=diagnostic".$curdatetime."&guid=".$sod_guid."\">".$mod_strings['LBL_DIAGNOSTIC_DELETELINK']."</a><br>";
}
//BEGIN check for what we are executing
$doconfigphp = ((empty($_POST['configphp']) || $_POST['configphp'] == 'off') ? false : true);
$docustom_dir = ((empty($_POST['custom_dir']) || $_POST['custom_dir'] == 'off') ? false : true);
$dophpinfo = ((empty($_POST['phpinfo']) || $_POST['phpinfo'] == 'off') ? false : true);
$domysql_dumps = ((empty($_POST['mysql_dumps']) || $_POST['mysql_dumps'] == 'off') ? false : true);
$domysql_schema = ((empty($_POST['mysql_schema']) || $_POST['mysql_schema'] == 'off') ? false : true);
$domysql_info = ((empty($_POST['mysql_info']) || $_POST['mysql_info'] == 'off') ? false : true);
$domd5 = ((empty($_POST['md5']) || $_POST['md5'] == 'off') ? false : true);
$domd5filesmd5 = ((empty($_POST['md5filesmd5']) || $_POST['md5filesmd5'] == 'off') ? false : true);
$domd5calculated = ((empty($_POST['md5calculated']) || $_POST['md5calculated'] == 'off') ? false : true);
$dobeanlistbeanfiles = ((empty($_POST['beanlistbeanfiles']) || $_POST['beanlistbeanfiles'] == 'off') ? false : true);
$dosugarlog = ((empty($_POST['sugarlog']) || $_POST['sugarlog'] == 'off') ? false : true);
$dovardefs = ((empty($_POST['vardefs']) || $_POST['vardefs'] == 'off') ? false : true);
//END check for what we are executing
//BEGIN items to calculate progress bar
$totalitems = 0;
$totalweight = 0;
if($doconfigphp) {$totalweight += CONFIG_WEIGHT; $totalitems++;}
if($docustom_dir) {$totalweight += CUSTOM_DIR_WEIGHT; $totalitems++;}
if($dophpinfo) {$totalweight += PHPINFO_WEIGHT; $totalitems++;}
if($domysql_dumps) {$totalweight += MYSQL_DUMPS_WEIGHT; $totalitems++;}
if($domysql_schema) {$totalweight += MYSQL_SCHEMA_WEIGHT; $totalitems++;}
if($domysql_info) {$totalweight += MYSQL_INFO_WEIGHT; $totalitems++;}
if($domd5) {$totalweight += MD5_WEIGHT; $totalitems++;}
if($dobeanlistbeanfiles) {$totalweight += BEANLISTBEANFILES_WEIGHT; $totalitems++;}
if($dosugarlog) {$totalweight += SUGARLOG_WEIGHT; $totalitems++;}
if($dovardefs) {$totalweight += VARDEFS_WEIGHT; $totalitems++;}
//END items to calculate progress bar
//prepare initial steps
prepareDiag();
if($doconfigphp)
{
echo $mod_strings['LBL_DIAGNOSTIC_GETCONFPHP']."<BR>";
executeconfigphp();
echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
}
if($docustom_dir)
{
echo $mod_strings['LBL_DIAGNOSTIC_GETCUSTDIR']."<BR>";
executecustom_dir();
echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
}
if($dophpinfo)
{
echo $mod_strings['LBL_DIAGNOSTIC_GETPHPINFO']."<BR>";
executephpinfo();
echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
}
if($domysql_info || $domysql_dumps || $domysql_schema)
{
echo $mod_strings['LBL_DIAGNOSTIC_GETTING'].
($domysql_info ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLINFO'] : " ").
($domysql_dumps ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTD'] : " ").
($domysql_schema ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTS'] : "...").
"<BR>";
executemysql($domysql_info, $domysql_dumps, $domysql_schema);
echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
}
if($domd5)
{
echo $mod_strings['LBL_DIAGNOSTIC_GETMD5INFO']."<BR>";
executemd5($domd5filesmd5, $domd5calculated);
echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
}
if($dobeanlistbeanfiles)
{
echo $mod_strings['LBL_DIAGNOSTIC_GETBEANFILES']."<BR>";
executebeanlistbeanfiles();
echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
}
if($dosugarlog)
{
echo $mod_strings['LBL_DIAGNOSTIC_GETSUGARLOG']."<BR>";
executesugarlog();
echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
}
if($dovardefs)
{
echo $mod_strings['LBL_DIAGNOSTIC_VARDEFS']."<BR>";
executevardefs();
echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
}
//finish up the last steps
finishDiag();
?>

View File

@@ -0,0 +1,158 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $db;
function displayAdminError($errorString){
$output = '<p class="error">' . $errorString .'</p>';
echo $output;
}
if(isset($_SESSION['rebuild_relationships'])){
displayAdminError(translate('MSG_REBUILD_RELATIONSHIPS', 'Administration'));
}
if(isset($_SESSION['rebuild_extensions'])){
displayAdminError(translate('MSG_REBUILD_EXTENSIONS', 'Administration'));
}
if (empty($license)){
$license=new Administration();
$license=$license->retrieveSettings('license');
}
if(!empty($_SESSION['HomeOnly'])){
displayAdminError(translate('FATAL_LICENSE_ALTERED', 'Administration'));
}
if(isset($license) && !empty($license->settings['license_msg_all'])){
displayAdminError(base64_decode($license->settings['license_msg_all']));
}
if ( (strpos($_SERVER["SERVER_SOFTWARE"],'Microsoft-IIS') !== false) && (php_sapi_name() == 'cgi-fcgi') && (ini_get('fastcgi.logging') != '0') ) {
displayAdminError(translate('FATAL_LICENSE_ALTERED', 'Administration'));
}
if(is_admin($current_user)){
if(!empty($_SESSION['COULD_NOT_CONNECT'])){
displayAdminError(translate('LBL_COULD_NOT_CONNECT', 'Administration') . ' '. $timedate->to_display_date_time($_SESSION['COULD_NOT_CONNECT']));
}
if(!empty($_SESSION['EXCEEDING_OC_LICENSES']) && $_SESSION['EXCEEDING_OC_LICENSES'] == true){
displayAdminError(translate('LBL_EXCEEDING_OC_LICENSES', 'Administration'));
}
if(isset($license) && !empty($license->settings['license_msg_admin'])){
// UUDDLRLRBA
//displayAdminError(base64_decode($license->settings['license_msg_admin']));
$GLOBALS['log']->fatal(base64_decode($license->settings['license_msg_admin']));
return;
}
//No SMTP server is set up Error.
$smtp_error = false;
$admin = new Administration();
$admin->retrieveSettings();
//If sendmail has been configured by setting the config variable ignore this warning
$sendMailEnabled = isset($sugar_config['allow_sendmail_outbound']) && $sugar_config['allow_sendmail_outbound'];
if(trim($admin->settings['mail_smtpserver']) == '' && !$sendMailEnabled) {
if($admin->settings['notify_on']) {
$smtp_error = true;
}
}
if($smtp_error) {
displayAdminError(translate('WARN_NO_SMTP_SERVER_AVAILABLE_ERROR','Administration'));
}
if(!empty($dbconfig['db_host_name']) || $sugar_config['sugar_version'] != $sugar_version ){
displayAdminError(translate('WARN_REPAIR_CONFIG', 'Administration'));
}
if( !isset($sugar_config['installer_locked']) || $sugar_config['installer_locked'] == false ){
displayAdminError(translate('WARN_INSTALLER_LOCKED', 'Administration'));
}
if(empty($GLOBALS['sugar_config']['admin_access_control'])){
if(isset($_SESSION['invalid_versions'])){
$invalid_versions = $_SESSION['invalid_versions'];
foreach($invalid_versions as $invalid){
displayAdminError(translate('WARN_UPGRADE', 'Administration'). $invalid['name'] .translate('WARN_UPGRADE2', 'Administration'));
}
}
if (isset($_SESSION['available_version'])){
if($_SESSION['available_version'] != $sugar_version)
{
displayAdminError(translate('WARN_UPGRADENOTE', 'Administration').$_SESSION['available_version_description']);
}
}
}
// if (!isset($_SESSION['dst_fixed']) || $_SESSION['dst_fixed'] != true) {
// $qDst = "SELECT count(*) AS dst FROM versions WHERE name = 'DST Fix'";
// $rDst = $db->query($qDst);
// $rowsDst = $db->fetchByAssoc($rDst);
// if($rowsDst['dst'] > 0) {
// $_SESSION['dst_fixed'] = true;
// } else {
// $_SESSION['dst_fixed'] = false;
// displayAdminError($app_strings['LBL_DST_NEEDS_FIXIN']);
// }
//
// }
if(isset($_SESSION['administrator_error']))
{
// Only print DB errors once otherwise they will still look broken
// after they are fixed.
displayAdminError($_SESSION['administrator_error']);
}
unset($_SESSION['administrator_error']);
}
?>

View File

@@ -0,0 +1,407 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $theme;
global $currentModule;
global $gridline;
global $timedate;
global $current_user;
global $db;
if ($db->dbType == 'oci8') {
echo "<BR>";
echo "<p>".$mod_strings['ERR_NOT_FOR_ORACLE']."</p>";
echo "<BR>";
sugar_die('');
}
if ($db->dbType == 'mssql') {
echo "<BR>";
echo "<p>".$mod_strings['ERR_NOT_FOR_MSSQL']."</p>";
echo "<BR>";
sugar_die('');
}
$display = '';
if(empty($db)) {
$db = DBManagerFactory::getInstance();
}
// check if this fix has been applied already
$qDone = "SELECT * FROM versions WHERE name = 'DST Fix'";
$rDone = $db->query($qDone);
$rowsDone = $db->getRowCount($rDone);
if($rowsDone > 0) {
$done = true;
} else {
$done = false;
}
// some inits:
$disabled = 'DISABLED';
$confirmed = 'false';
// apply the fix
if(!empty($_REQUEST['confirmed']) && $_REQUEST['confirmed'] == true) {
// blowaway vCal server cache
$qvCal = "TRUNCATE vcals";
$rvCal = $db->query($qvCal);
// disable refresh double-ups
$rDblCheck = $db->query($qDone);
$rowsDblCheck = $db->getRowCount($rDblCheck);
if($rowsDblCheck < 1) {
// majed's sql generation
$tables = array(
'calls'=>array(
'date_start'=>'time_start',
),
'meetings'=>array(
'date_start'=>'time_start',
),
'tasks'=>array(
'date_due'=>'time_due',
),
'project_task'=>array(
'date_due'=>'time_due',
),
'email_marketing'=>array(
'date_start'=>'time_start',
),
'emailman'=>array(
'send_date_time'=>'datetime',
)
);
$zone = $_REQUEST['server_timezone'];
$td = new TimeDate();
$startyear = 2004;
$maxyear = 2014;
$date_modified = gmdate($GLOBALS['timedate']->get_db_date_time_format());
$display = '';
foreach($tables as $table_name =>$table) {
//$display .= '<B>'. $table_name . '</b><BR>';
$year = $startyear;
for($year = $startyear; $year <= $maxyear; $year++) {
$range = $td->getDSTRange($year,$timezones[$zone]);
$startDateTime = explode(' ',$range['start']);
$endDateTime = explode(' ',$range['end']);
if($range) {
if( strtotime($range['start']) < strtotime($range['end'])) {
foreach($table as $date=>$time) {
$interval='PLUSMINUS INTERVAL 3600 second';
if($time != 'datetime'){
if ( ( $db->dbType == 'mysql' ) or ( $db->dbType == 'oci8' ) )
{
$field = "CONCAT($table_name.$date,' ', $table_name.$time)";
}
if ( $db->dbType == 'mssql' )
{
$field = "$table_name.$date + ' ' + $table_name.$time";
}
$updateBase= "UPDATE $table_name SET date_modified='$date_modified', $table_name.$date=LEFT($field $interval,10),";
$updateBase .= " $table_name.$time=RIGHT($field $interval,8)";
}else{
$field = "$table_name.$date";
$updateBase = "UPDATE $table_name SET date_modified='$date_modified', $table_name.$date = $table_name.$date $interval";
}
//BEGIN DATE MODIFIED IN DST WITH DATE OUT DST
$update = str_replace('PLUSMINUS', '+', $updateBase);
$queryInDST = $update ."
WHERE
$table_name.date_modified >= '{$range['start']}' AND $table_name.date_modified < '{$range['end']}'
AND ( $field < '{$range['start']}' OR $field >= '{$range['end']}' )";
$result = $db->query($queryInDST);
$count = $db->getAffectedRowCount();
//$display .= "$year - Records updated with date modified in DST with date out of DST: $count <br>";
//BEGIN DATE MODIFIED OUT DST WITH DATE IN DST
$update = str_replace('PLUSMINUS', '-', $updateBase);
$queryOutDST = $update ."
WHERE
( $table_name.date_modified < '{$range['start']}' OR $table_name.date_modified >= '{$range['end']}' )
AND $field >= '{$range['start']}' AND $field < '{$range['end']}' ";
$result = $db->query($queryOutDST);
$count = $db->getAffectedRowCount();
//$display .= "$year - Records updated with date modified out of DST with date in DST: $count <br>";
}
}else{
foreach($table as $date=>$time){
$interval='PLUSMINUS INTERVAL 3600 second';
if($time != 'datetime'){
if ( ( $this->db->dbType == 'mysql' ) or ( $this->db->dbType == 'oci8' ) )
{
$field = "CONCAT($table_name.$date,' ', $table_name.$time)";
}
if ( $this->db->dbType == 'mssql' )
{
$field = "$table_name.$date + ' ' + $table_name.$time";
}
$updateBase= "UPDATE $table_name SET $table_name.$date=LEFT($field $interval,10),";
$updateBase .= " $table_name.$time=RIGHT($field $interval,8)";
}else{
$field = "$table_name.$date";
$updateBase = "UPDATE $table_name SET $table_name.$date = $table_name.$date $interval";
}
//BEGIN DATE MODIFIED IN DST WITH DATE OUT OF DST
$update = str_replace('PLUSMINUS', '+', $updateBase);
$queryInDST = $update ."
WHERE
($table_name.date_modified >= '{$range['start']}' OR $table_name.date_modified < '{$range['end']}' )
AND $field < '{$range['start']}' AND $field >= '{$range['end']}'";
$result = $db->query($queryInDST);
$count = $db->getAffectedRowCount();
//$display .= "$year - Records updated with date modified in DST with date out of DST: $count <br>";
//BEGIN DATE MODIFIED OUT DST WITH DATE IN DST
$update = str_replace('PLUSMINUS', '-', $updateBase);
$queryOutDST = $update ."
WHERE
($table_name.date_modified < '{$range['start']}' AND $table_name.date_modified >= '{$range['end']}' )
AND
($field >= '{$range['start']}' OR $field < '{$range['end']}' )";
}
$result = $db->query($queryOutDST);
$count = $db->getAffectedRowCount();
//$display .= "$year - Records updated with date modified out of DST with date in DST: $count <br>";
}
}
} // end outer forloop
}// end foreach loop
}
$display .= "<br><b>".$mod_strings['LBL_DST_FIX_DONE_DESC']."</b>";
} elseif(!$done) { // show primary screen
$disabled = "";
$confirmed = 'true';
if(empty($timedate)) {
$timedate = new TimeDate();
}
require_once('include/timezone/timezones.php');
global $timezones;
$timezoneOptions = '';
ksort($timezones);
if(!isset($defaultServerZone)){
$defaultServerZone = lookupTimezone(0);
}
foreach($timezones as $key => $value) {
if(!empty($value['dstOffset'])) {
$dst = " (+DST)";
} else {
$dst = "";
}
if($key == $defaultServerZone){
$selected = 'selected';
}else{
$selected = '';
}
$gmtOffset = ($value['gmtOffset'] / 60);
if(!strstr($gmtOffset,'-')) {
$gmtOffset = "+".$gmtOffset;
}
$timezoneOptions .= "<option value='$key'".$selected.">".str_replace(array('_','North'), array(' ', 'N.'),$key). " (GMT".$gmtOffset.") ".$dst."</option>";
}
// descriptions and assumptions
$display = "
<tr>
<td width=\"20%\" class=\"tabDetailViewDL2\" nowrap align='right'><slot>
".$mod_strings['LBL_DST_FIX_TARGET']."
</slot></td>
<td class=\"tabDetailViewDF2\"><slot>
".$mod_strings['LBL_APPLY_DST_FIX_DESC']."
</slot></td>
</tr>
<tr>
<td width=\"20%\" class=\"tabDetailViewDL2\" nowrap align='right'><slot>
".$mod_strings['LBL_DST_BEFORE']."
</slot></td>
<td class=\"tabDetailViewDF2\"><slot>
".$mod_strings['LBL_DST_BEFORE_DESC']."
</slot></td>
</tr>
<tr>
<td width=\"20%\" class=\"tabDetailViewDL2\" nowrap align='right'><slot>
".$mod_strings['LBL_DST_FIX_CONFIRM']."
</slot></td>
<td class=\"tabDetailViewDF2\"><slot>
".$mod_strings['LBL_DST_FIX_CONFIRM_DESC']."
</slot></td>
</tr>
<tr>
<td width=\"20%\" class=\"tabDetailViewDL2\" nowrap align='right'><slot>
</slot></td>
<td class=\"tabDetailViewDF2\"><slot>
<table cellpadding='0' cellspacing='0' border='0'>
<tr>
<td class=\"tabDetailViewDF2\"><slot>
<b>".$mod_strings['LBL_DST_CURRENT_SERVER_TIME']."</b>
</td>
<td class=\"tabDetailViewDF2\"><slot>
".$timedate->to_display_time(date($GLOBALS['timedate']->get_db_date_time_format(), strtotime('now')), true, false)."
</td>
<tr>
</tr>
<td class=\"tabDetailViewDF2\"><slot>
<b>".$mod_strings['LBL_DST_CURRENT_SERVER_TIME_ZONE']."</b>
</td>
<td class=\"tabDetailViewDF2\"><slot>
".date("T")."<br>
</td>
</tr>
<tr>
<td class=\"tabDetailViewDF2\"><slot>
<b>".$mod_strings['LBL_DST_CURRENT_SERVER_TIME_ZONE_LOCALE']."</b>
</td>
<td class=\"tabDetailViewDF2\"><slot>
<select name='server_timezone'>".$timezoneOptions."</select><br>
</td>
</tr>
</table>
</slot></td>
</tr>";
} else { // fix has been applied - don't want to allow a 2nd pass
$display = $mod_strings['LBL_DST_FIX_DONE_DESC'];
$disabled = 'DISABLED';
$confirmed = 'false';
}
if(!empty($_POST['upgrade'])){
// enter row in versions table
$qDst = "INSERT INTO versions VALUES ('".create_guid()."', 0, '".gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime('now'))."', '".gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime('now'))."', '".$current_user->id."', '".$current_user->id."', 'DST Fix', '3.5.1b', '3.5.1b')";
$qRes = $db->query($qDst);
// record server's time zone locale for future upgrades
$qSTZ = "INSERT INTO config VALUES ('Update', 'server_timezone', '".$_REQUEST['server_timezone']."')";
$rSTZ = $db->query($qSTZ);
if(empty($_REQUEST['confirmed']) || $_REQUEST['confirmed'] == 'false') {
$display = $mod_strings['LBL_DST_FIX_DONE_DESC'];
$disabled = 'DISABLED';
$confirmed = 'false';
}
unset($_SESSION['GMTO']);
}
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_APPLY_DST_FIX'], true);
if(empty($disabled)){
?>
<h2>Step 1:</h2>
<table cellspacing="<?php echo $gridline;?>" class="other view">
<tr>
<td scope="row" width="20%">
<slot><?php echo $mod_strings['LBL_DST_FIX_USER']; ?></slot>
</td>
<td>
<slot>
<?php echo $mod_strings['LBL_DST_FIX_USER_TZ']; ?><br>
<input type='button' class='button' value='<?php echo $mod_strings['LBL_DST_SET_USER_TZ']; ?>' onclick='document.location.href="index.php?module=Administration&action=updateTimezonePrefs"'>
</slot>
</td>
</tr>
</table>
<?php }?>
<p>
<form name='DstFix' action='index.php' method='POST'>
<input type='hidden' name='module' value='Administration'>
<input type='hidden' name='action' value='DstFix'>
<?php
if(empty($disabled)){
echo "<h2>Step 2:</h2>";
}
?>
<table cellspacing="<?php echo $gridline;?>" class="other view">
<?php
echo $display;
if(empty($disabled)){
?>
<tr>
<td scope="row" width="20%">
<slot><?php echo $mod_strings['LBL_DST_UPGRADE']; ?></slot>
</td>
<td>
<slot>
<input type='checkbox' name='confirmed' value='true' checked="checked" />
<?php echo $mod_strings['LBL_DST_APPLY_FIX']; ?>
</slot>
</td>
</tr>
<?php } ?>
<tr>
<td scope="row" width="20%"></td>
<td>
<slot>
<?php
if(empty($disabled)){
echo "<input ".$disabled." title='".$mod_strings['LBL_APPLY_DST_FIX']."' accessKey='".$app_strings['LBL_SAVE_BUTTON_KEY']."' class=\"button\" onclick=\"this.form.action.value='DstFix';\" type=\"submit\" name=\"upgrade\" value='".$mod_strings['LBL_APPLY_DST_FIX']."' >";
}else{
echo "<input title='".$app_strings['LBL_DONE_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_DONE_BUTTON_KEY']."' class=\"button\" onclick=\"this.form.action.value='Upgrade'; this.form.module.value='Administration';\" type=\"submit\" name=\"done\" value='".$app_strings['LBL_DONE_BUTTON_LABEL']."'>";
}
?>
</slot>
</td>
</tr>
</table>
</form>

View File

@@ -0,0 +1,57 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$db = DBManagerFactory::getInstance();
$result = $db->query('SELECT * FROM fields_meta_data WHERE deleted = 0');
$fields = array();
$str = '';
while($row = $db->fetchByAssoc($result)){
foreach($row as $name=>$value){
$str.= "$name:::$value\n";
}
$str .= "DONE\n";
}
ob_get_clean();
header("Content-Disposition: attachment; filename=CustomFieldStruct.sugar");
header("Content-Type: text/txt; charset={$app_strings['LBL_CHARSET']}");
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header("Content-Length: ".strlen($str));
echo $str;
?>

View File

@@ -0,0 +1,78 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Contains a variety of utility functions specific to this module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
function get_chooser_js()
{
$the_script = <<<EOQ
<script type="text/javascript" language="Javascript">
<!-- to hide script contents from old browsers
function set_chooser()
{
var display_tabs_def = '';
for(i=0; i < object_refs['display_tabs'].options.length ;i++)
{
display_tabs_def += "display_tabs[]="+object_refs['display_tabs'].options[i].value+"&";
}
document.EditView.display_tabs_def.value = display_tabs_def;
}
// end hiding contents from old browsers -->
</script>
EOQ;
return $the_script;
}
?>

View File

@@ -0,0 +1,85 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(empty($_FILES)){
echo $mod_strings['LBL_IMPORT_CUSTOM_FIELDS_DESC'];
echo <<<EOQ
<br>
<br>
<form enctype="multipart/form-data" action="index.php" method="POST">
<input type='hidden' name='module' value='Administration'>
<input type='hidden' name='action' value='ImportCustomFieldStructure'>
{$mod_strings['LBL_IMPORT_CUSTOM_FIELDS_STRUCT']}: <input name="sugfile" type="file" />
<input type="submit" value="{$mod_strings['LBL_ICF_IMPORT_S']}" class='button'/>
</form>
EOQ;
}else{
$fmd = new FieldsMetaData();
echo $mod_strings['LBL_ICF_DROPPING'] . '<br>';
$lines = file($_FILES['sugfile']['tmp_name']);
$cur = array();
foreach($lines as $line){
if(trim($line) == 'DONE'){
$fmd->new_with_id = true;
echo 'Adding:'.$fmd->custom_module . '-'. $fmd->name. '<br>';
$fmd->db->query("DELETE FROM $fmd->table_name WHERE id='$fmd->id'");
$fmd->save(false);
$fmd = new FieldsMetaData();
}else{
$ln = explode(':::', $line ,2);
if(sizeof($ln) == 2){
$KEY = trim($ln[0]);
$fmd->$KEY = trim($ln[1]);
}
}
}
$_REQUEST['run'] = true;
$result = $fmd->db->query("SELECT count(*) field_count FROM $fmd->table_name");
$row = $fmd->db->fetchByAssoc($result);
echo 'Total Custom Fields :' . $row['field_count'] . '<br>';
include('modules/Administration/UpgradeFields.php');
}
?>

View File

@@ -0,0 +1,120 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description:
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
* Reserved. Contributor(s): ______________________________________..
* *******************************************************************************/
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
require_once('modules/Configurator/Configurator.php');
echo getClassicModuleTitle(
"Administration",
array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
$mod_strings['LBL_MANAGE_LOCALE'],
),
true
);
$cfg = new Configurator();
$sugar_smarty = new Sugar_Smarty();
$errors = '';
///////////////////////////////////////////////////////////////////////////////
//// HANDLE CHANGES
if(isset($_REQUEST['process']) && $_REQUEST['process'] == 'true') {
if(isset($_REQUEST['collation']) && !empty($_REQUEST['collation'])) {
//kbrill Bug #14922
if(array_key_exists('collation', $sugar_config['dbconfigoption']) && $_REQUEST['collation'] != $sugar_config['dbconfigoption']['collation']) {
$GLOBALS['db']->disconnect();
$GLOBALS['db']->connect();
}
$cfg->config['dbconfigoption']['collation'] = $_REQUEST['collation'];
}
$cfg->populateFromPost();
$cfg->handleOverride();
header('Location: index.php?module=Administration&action=index');
}
///////////////////////////////////////////////////////////////////////////////
//// DB COLLATION
if($GLOBALS['db']->dbType == 'mysql') {
// set sugar default if not set from before
if(!isset($sugar_config['dbconfigoption']['collation'])) {
$sugar_config['dbconfigoption']['collation'] = 'utf8_general_ci';
}
$sugar_smarty->assign('dbType', 'mysql');
$q = "SHOW COLLATION LIKE 'utf8%'";
$r = $GLOBALS['db']->query($q);
$collationOptions = '';
while($a = $GLOBALS['db']->fetchByAssoc($r)) {
$selected = '';
if($sugar_config['dbconfigoption']['collation'] == $a['Collation']) {
$selected = " SELECTED";
}
$collationOptions .= "\n<option value='{$a['Collation']}'{$selected}>{$a['Collation']}</option>";
}
$sugar_smarty->assign('collationOptions', $collationOptions);
}
//// END DB COLLATION
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// PAGE OUTPUT
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$sugar_smarty->assign('LANGUAGES', get_languages());
$sugar_smarty->assign("JAVASCRIPT",get_set_focus_js());
$sugar_smarty->assign('config', $sugar_config);
$sugar_smarty->assign('error', $errors);
$sugar_smarty->assign("exportCharsets", get_select_options_with_id($locale->getCharsetSelect(), $sugar_config['default_export_charset']));
//$sugar_smarty->assign('salutation', 'Mr.');
//$sugar_smarty->assign('first_name', 'John');
//$sugar_smarty->assign('last_name', 'Doe');
$sugar_smarty->assign('getNameJs', $locale->getNameJs());
$sugar_smarty->display('modules/Administration/Locale.tpl');
?>

View File

@@ -0,0 +1,216 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<script type="text/javascript">
var ERR_NO_SINGLE_QUOTE = '{$APP.ERR_NO_SINGLE_QUOTE}';
var cannotEq = "{$APP.ERR_DECIMAL_SEP_EQ_THOUSANDS_SEP}";
{literal}
function verify_data(formName) {
var f = document.getElementById(formName);
for(i=0; i<f.elements.length; i++) {
if(f.elements[i].value == "'") {
alert(ERR_NO_SINGLE_QUOTE + " " + f.elements[i].name);
return false;
}
}
// currency syntax
if (document.ConfigureSettings.default_number_grouping_seperator.value == document.ConfigureSettings.default_decimal_seperator.value) {
alert(cannotEq);
return false;
}
return true;
}
</script>
{/literal}
<BR>
<form id="ConfigureSettings" name="ConfigureSettings" enctype='multipart/form-data' method="POST"
action="index.php?module=Administration&action=Locale&process=true">
<span class='error'>{$error.main}</span>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="actionsContainer">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}"
accessKey="{$APP.LBL_SAVE_BUTTON_KEY}"
class="button primary"
type="submit"
name="save"
onclick="return verify_data('ConfigureSettings');"
value=" {$APP.LBL_SAVE_BUTTON_LABEL} " >
&nbsp;<input title="{$MOD.LBL_CANCEL_BUTTON_TITLE}" onclick="document.location.href='index.php?module=Administration&action=index'" class="button" type="button" name="cancel" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " > </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr><th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_LOCALE_DEFAULT_SYSTEM_SETTINGS}</h4></th>
</tr>
<tr>
<td scope="row" width="200">{$MOD.LBL_LOCALE_DEFAULT_DATE_FORMAT}: </td>
<td >
{html_options name='default_date_format' selected=$config.default_date_format options=$config.date_formats}
</td>
<td scope="row" width="200">{$MOD.LBL_LOCALE_DEFAULT_TIME_FORMAT}: </td>
<td >
{html_options name='default_time_format' selected=$config.default_time_format options=$config.time_formats}
</td>
</tr><tr>
<td scope="row">{$MOD.LBL_LOCALE_DEFAULT_LANGUAGE}: </td>
<td >
{html_options name='default_language' selected=$config.default_language options=$LANGUAGES}
</td>
</tr>
</tr><tr>
<td scope="row" valign="top">{$MOD.LBL_LOCALE_DEFAULT_NAME_FORMAT}: </td>
<td >
<input onkeyup="setPreview();" onkeydown="setPreview();" id="default_locale_name_format" type="text" name="default_locale_name_format" value="{$config.default_locale_name_format}">
<br>
{$MOD.LBL_LOCALE_NAME_FORMAT_DESC}
</td>
<td scope="row" valign="top">{$MOD.LBL_LOCALE_EXAMPLE_NAME_FORMAT}: </td>
<td valign="top"><input name="no_value" id="nameTarget" value="" style="border: none;" disabled></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr>
<th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_LOCALE_DEFAULT_CURRENCY}</h4></th>
</tr><tr>
<td scope="row" width="200">{$MOD.LBL_LOCALE_DEFAULT_CURRENCY_NAME}: </td>
<td >
<input type='text' size='25' name='default_currency_name' value='{$config.default_currency_name}' >
</td>
<td scope="row" width="200">{$MOD.LBL_LOCALE_DEFAULT_CURRENCY_SYMBOL}: </td>
<td >
<input type='text' size='4' name='default_currency_symbol' value='{$config.default_currency_symbol}' >
</td>
</tr><tr>
<td scope="row" width="200">{$MOD.LBL_LOCALE_DEFAULT_CURRENCY_ISO4217}: </td>
<td >
<input type='text' size='4' name='default_currency_iso4217' value='{$config.default_currency_iso4217}'>
</td>
<td scope="row">{$MOD.LBL_LOCALE_DEFAULT_NUMBER_GROUPING_SEP}: </td>
<td >
<input type='text' size='3' maxlength='1' name='default_number_grouping_seperator' value='{$config.default_number_grouping_seperator}'>
</td>
</tr><tr>
<td scope="row">{$MOD.LBL_LOCALE_DEFAULT_DECIMAL_SEP}: </td>
<td >
<input type='text' size='3' maxlength='1' name='default_decimal_seperator' value='{$config.default_decimal_seperator}'>
</td>
<td scope="row"></td>
<td ></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr><th align="left" scope="row" colspan="4"><h4>{$MOD.EXPORT}</h4></th>
</tr><tr>
<td nowrap width="10%" scope="row">{$MOD.EXPORT_DELIMITER}: </td>
<td width="25%" >
<input type='text' name='export_delimiter' size="5" value='{$config.export_delimiter}'>
</td>
<td nowrap width="10%" scope="row">{$MOD.EXPORT_CHARSET}: </td>
<td width="25%" >
<select name="default_export_charset">{$exportCharsets}</select>
</td>
<td nowrap width="10%" scope="row">{$MOD.DISABLE_EXPORT}: </td>
{if !empty($config.disable_export)}
{assign var='disable_export_checked' value='CHECKED'}
{else}
{assign var='disable_export_checked' value=''}
{/if}
<td width="25%" ><input type='hidden' name='disable_export' value='false'><input name='disable_export' type="checkbox" value="true" {$disable_export_checked}></td>
<td nowrap width="10%" scope="row">{$MOD.ADMIN_EXPORT_ONLY}: </td>
{if !empty($config.admin_export_only)}
{assign var='admin_export_only_checked' value='CHECKED'}
{else}
{assign var='admin_export_only_checked' value=''}
{/if}
<td width="20%" ><input type='hidden' name='admin_export_only' value='false'><input name='admin_export_only' type="checkbox" value="true" {$admin_export_only_checked}></td>
</tr>
</table>
{if $dbType == 'mysql'}
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr>
<th align="left" scope="row" colspan="2">
<h4>
{$MOD.LBL_LOCALE_DB_COLLATION_TITLE}
</h4>
</th>
</tr>
<tr>
<td scope="row" width="200">
{$MOD.LBL_LOCALE_DB_COLLATION}
</td>
<td scope="row">
<select name="collation" id="collation">{$collationOptions}</select>
</td>
</tr>
</table>
{/if}
<div style="padding-top: 2px;">
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" type="submit" name="save" value=" {$APP.LBL_SAVE_BUTTON_LABEL} " />
&nbsp;<input title="{$MOD.LBL_CANCEL_BUTTON_TITLE}" onclick="document.location.href='index.php?module=Administration&action=index'" class="button" type="button" name="cancel" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " />
</div>
{$JAVASCRIPT}
</form>
<script language="Javascript" type="text/javascript">
{$getNameJs}
</script>

View File

@@ -0,0 +1,45 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$module_menu = Array();

View File

@@ -0,0 +1,178 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
if(!is_admin($current_user)){
sugar_die('Admin Only');
}
function clearPasswordSettings() {
$_POST['passwordsetting_SystemGeneratedPasswordON'] = '';
$_POST['passwordsetting_generatepasswordtmpl'] = '';
$_POST['passwordsetting_lostpasswordtmpl'] = '';
$_POST['passwordsetting_forgotpasswordON'] = '0';
$_POST['passwordsetting_linkexpiration'] = '1';
$_POST['passwordsetting_linkexpirationtime'] = '30';
$_POST['passwordsetting_linkexpirationtype'] = '1';
$_POST['passwordsetting_systexpiration'] = '0';
$_POST['passwordsetting_systexpirationtime'] = '';
$_POST['passwordsetting_systexpirationtype'] = '0';
$_POST['passwordsetting_systexpirationlogin'] = '';
}
require_once('modules/Administration/Forms.php');
echo get_module_title(
$mod_strings['LBL_MODULE_NAME'],
$mod_strings['LBL_MANAGE_PASSWORD_TITLE'],
true
);
require_once('modules/Configurator/Configurator.php');
$configurator = new Configurator();
$sugarConfig = SugarConfig::getInstance();
$focus = new Administration();
$configurator->parseLoggerSettings();
$valid_public_key= true;
if(!empty($_POST['saveConfig'])){
if ($_POST['captcha_on'] == '1'){
$handle = @fopen("http://api.recaptcha.net/challenge?k=".$_POST['captcha_public_key']."&cachestop=35235354", "r");
$buffer ='';
if ($handle) {
while (!feof($handle)) {
$buffer .= fgets($handle, 4096);
}
fclose($handle);
}
$valid_public_key= substr($buffer, 1, 4) == 'var '? true : false;
}
if ($valid_public_key){
if (isset($_REQUEST['system_ldap_enabled']) && $_REQUEST['system_ldap_enabled'] == 'on') {
$_POST['system_ldap_enabled'] = 1;
clearPasswordSettings();
}
else
$_POST['system_ldap_enabled'] = 0;
if (isset($_REQUEST['ldap_group_checkbox']) && $_REQUEST['ldap_group_checkbox'] == 'on')
$_POST['ldap_group'] = 1;
else
$_POST['ldap_group'] = 0;
if (isset($_REQUEST['ldap_authentication_checkbox']) && $_REQUEST['ldap_authentication_checkbox'] == 'on')
$_POST['ldap_authentication'] = 1;
else
$_POST['ldap_authentication'] = 0;
if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime']) )
$_POST['passwordsetting_lockoutexpiration'] = 2;
$configurator->saveConfig();
$focus->saveConfig();
header('Location: index.php?module=Administration&action=index');
}
}
$focus->retrieveSettings();
require_once('include/SugarLogger/SugarLogger.php');
$sugar_smarty = new Sugar_Smarty();
// if no IMAP libraries available, disable Save/Test Settings
if(!function_exists('imap_open')) $sugar_smarty->assign('IE_DISABLED', 'DISABLED');
$config_strings=return_module_language($GLOBALS['current_language'],'Configurator');
$sugar_smarty->assign('CONF', $config_strings);
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$sugar_smarty->assign('config', $configurator->config);
$sugar_smarty->assign('error', $configurator->errors);
$sugar_smarty->assign('LANGUAGES', get_languages());
$sugar_smarty->assign("settings", $focus->settings);
if(!function_exists('mcrypt_cbc')){
$sugar_smarty->assign("LDAP_ENC_KEY_READONLY", 'readonly');
$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']);
}else{
$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
}
$sugar_smarty->assign("settings", $focus->settings);
if ($valid_public_key){
if(!empty($focus->settings['captcha_on'])){
$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
}else{
$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
}
}else{
$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
}
$sugar_smarty->assign("VALID_PUBLIC_KEY", $valid_public_key);
$res=$GLOBALS['sugar_config']['passwordsetting'];
require_once('include/SugarPHPMailer.php');
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
if($mail->Mailer == 'smtp' && $mail->Host ==''){
$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
}
else
$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '0');
$focus = new InboundEmail();
$focus->checkImap();
$storedOptions = unserialize(base64_decode($focus->stored_options));
$email_templates_arr = get_bean_select_array(true, 'EmailTemplate','name', '','name',true);
$create_case_email_template = (isset($storedOptions['create_case_email_template'])) ? $storedOptions['create_case_email_template'] : "";
$TMPL_DRPDWN_LOST =get_select_options_with_id($email_templates_arr, $res['lostpasswordtmpl']);
$TMPL_DRPDWN_GENERATE =get_select_options_with_id($email_templates_arr, $res['generatepasswordtmpl']);
$sugar_smarty->assign("TMPL_DRPDWN_LOST", $TMPL_DRPDWN_LOST);
$sugar_smarty->assign("TMPL_DRPDWN_GENERATE", $TMPL_DRPDWN_GENERATE);
$sugar_smarty->display('modules/Administration/PasswordManager.tpl');
?>

View File

@@ -0,0 +1,635 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<script type='text/javascript' src='include/javascript/overlibmws.js'></script>
<form name="ConfigurePasswordSettings" method="POST" action="index.php" >
<input type='hidden' name='action' value='PasswordManager'/>
<input type='hidden' name='module' value='Administration'/>
<input type='hidden' name='saveConfig' value='1'/>
<span class='error'>{$error.main}</span>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="actionsContainer">
<tr>
<td style="padding-bottom: 2px;" >
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" id="btn_save" type="submit" onclick="addcheck(form);return check_form('ConfigurePasswordSettings');" name="save" value="{$APP.LBL_SAVE_BUTTON_LABEL}" >
&nbsp;<input title="{$MOD.LBL_CANCEL_BUTTON_TITLE}" onclick="document.location.href='index.php?module=Administration&action=index'" class="button" type="button" name="cancel" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" >
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table id="sysGeneratedId" name="sysGeneratedName" width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr>
<th align="left" scope="row" colspan="4">
<h4>
{$MOD.LBL_PASSWORD_SYST_GENERATED_TITLE}
</h4>
</th>
</tr>
<tr>
<td scope="row" width='25%'>
{$MOD.LBL_PASSWORD_SYST_GENERATED_PWD_ON}:&nbsp{sugar_help text=$MOD.LBL_PASSWORD_SYST_GENERATED_PWD_HELP WIDTH=400}
</td>
<td >
{if ($config.passwordsetting.SystemGeneratedPasswordON ) == '1'}
{assign var='SystemGeneratedPasswordON' value='CHECKED'}
{else}
{assign var='SystemGeneratedPasswordON' value=''}
{/if}
<input type='hidden' name='passwordsetting_SystemGeneratedPasswordON' value='0'>
<input name='passwordsetting_SystemGeneratedPasswordON' id='SystemGeneratedPassword_checkbox' type='checkbox' value='1' {$SystemGeneratedPasswordON} onclick='enable_syst_generated_pwd(this);toggleDisplay("SystemGeneratedPassword_warning");'>
</td>
{if !($config.passwordsetting.SystemGeneratedPasswordON)}
{assign var='smtp_warning' value='none'}
{/if}
</tr>
<tr>
<td colspan="2" id='SystemGeneratedPassword_warning'scope="row" style='display:{$smtp_warning}';>
<i>{if $SMTP_SERVER_NOT_SET}&nbsp;&nbsp;&nbsp;&nbsp;{$MOD.ERR_SMTP_SERVER_NOT_SET}<br>{/if}
&nbsp;&nbsp;&nbsp;&nbsp;{$MOD.LBL_EMAIL_ADDRESS_REQUIRED_FOR_FEATURE}</i>
</td>
</tr>
<tr>
<td align="left" scope="row" colspan="4">
{$MOD.LBL_PASSWORD_SYST_EXPIRATION}
</td>
</tr>
<tr>
<td colspan='4'>
<table width="100%" id='syst_generated_pwd_table' border="0" cellspacing="1" cellpadding="0">
<tr>
{assign var='systexplogin' value=''}
{assign var='systexptime' value=''}
{assign var='systexpnone' value=''}
{if ($config.passwordsetting.systexpiration) == '0' || $config.passwordsetting.systexpiration==''}
{assign var='systexpnone' value='CHECKED'}
{/if}
{if ($config.passwordsetting.systexpiration) == '1'}
{assign var='systexptime' value='CHECKED'}
{/if}
{if ($config.passwordsetting.systexpiration) == '2'}
{assign var='systexplogin' value='CHECKED'}
{/if}
<td width='30%'>
<input type="radio" name="passwordsetting_systexpiration" value='0' {$systexpnone} onclick="form.passwordsetting_systexpirationtime.value='';form.passwordsetting_systexpirationlogin.value='';">
{$MOD.LBL_UW_NONE}
</td>
<td width='30%'>
<input type="radio" name="passwordsetting_systexpiration" id="required_sys_pwd_exp_time" value='1' {$systexptime} onclick="form.passwordsetting_systexpirationlogin.value='';">
{$MOD.LBL_PASSWORD_EXP_IN}
{assign var='sdays' value=''}
{assign var='sweeks' value=''}
{assign var='smonths' value=''}
{if ($config.passwordsetting.systexpirationtype ) == '1'}
{assign var='sdays' value='SELECTED'}
{/if}
{if ($config.passwordsetting.systexpirationtype ) == '7'}
{assign var='sweeks' value='SELECTED'}
{/if}
{if ($config.passwordsetting.systexpirationtype ) == '30'}
{assign var='smonths' value='SELECTED'}
{/if}
<input type='text' maxlength="3" and style="width:2em" name='passwordsetting_systexpirationtime' value='{$config.passwordsetting.systexpirationtime}'>
<SELECT NAME="passwordsetting_systexpirationtype">
<OPTION VALUE='1' {$sdays}>{$MOD.LBL_DAYS}
<OPTION VALUE='7' {$sweeks}>{$MOD.LBL_WEEKS}
<OPTION VALUE='30' {$smonths}>{$MOD.LBL_MONTHS}
</SELECT>
</td>
<td colspan='2' width='40%'>
<input type="radio" name="passwordsetting_systexpiration" id="required_sys_pwd_exp_login" value='2' {$systexplogin} onclick="form.passwordsetting_systexpirationtime.value='';">
{$MOD.LBL_PASSWORD_EXP_AFTER}
<input type='text' maxlength="3" and style="width:2em" name='passwordsetting_systexpirationlogin' value="{$config.passwordsetting.systexpirationlogin}">
{$MOD.LBL_PASSWORD_LOGINS}
</td>
</tr>
</table>
</td>
</tr>
</table>
<table id="userResetPassId" name="userResetPassName" width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr>
<th align="left" scope="row" colspan="2"><h4>{$MOD.LBL_PASSWORD_USER_RESET}</h4>
</th>
</tr>
<tr>
<td width="25%" scope="row">{$MOD.LBL_PASSWORD_FORGOT_FEATURE}:&nbsp{sugar_help text=$MOD.LBL_PASSWORD_FORGOT_FEATURE_HELP WIDTH=400}</td>
<td scope="row" width="25%" >
{if ($config.passwordsetting.forgotpasswordON ) == '1'}
{assign var='forgotpasswordON' value='CHECKED'}
{else}
{assign var='forgotpasswordON' value=''}
{/if}
<input type='hidden' name='passwordsetting_forgotpasswordON' value='0'>
<input name="passwordsetting_forgotpasswordON" id="forgotpassword_checkbox" value="1" class="checkbox" type="checkbox" onclick='forgot_password_enable(this); toggleDisplay("SystemGeneratedPassword_warning2");' {$forgotpasswordON}>
</td>
{if !($config.passwordsetting.forgotpasswordON)}
{assign var='smtp_warning_2' value='none'}
{/if}
</tr>
<tr><td colspan="4" id='SystemGeneratedPassword_warning2'scope="row" style='display:{$smtp_warning_2}';>
<i>{if $SMTP_SERVER_NOT_SET}&nbsp;&nbsp;&nbsp;&nbsp;{$MOD.ERR_SMTP_SERVER_NOT_SET}<br>{/if}
&nbsp;&nbsp;&nbsp;&nbsp;{$MOD.LBL_EMAIL_ADDRESS_REQUIRED_FOR_FEATURE}</i>
</td>
</tr>
<tr>
<td width="25%" scope="row">{$MOD.LBL_PASSWORD_LINK_EXPIRATION}:&nbsp{sugar_help text=$MOD.LBL_PASSWORD_LINK_EXPIRATION_HELP WIDTH=400}</td>
<td colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="forgot_password_table">
<tr>
{assign var='linkexptime' value=''}
{assign var='linkexpnone' value=''}
{if ($config.passwordsetting.linkexpiration) == '0'}
{assign var='linkexpnone' value='CHECKED'}
{/if}
{if ($config.passwordsetting.linkexpiration) == '1'}
{assign var='linkexptime' value='CHECKED'}
{/if}
<td width='30%'>
<input type="radio" name="passwordsetting_linkexpiration" value='0' {$linkexpnone} onclick="form.passwordsetting_linkexpirationtime.value='';">
{$MOD.LBL_UW_NONE}
</td>
<td width='30%'>
<input type="radio" name="passwordsetting_linkexpiration" id="required_link_exp_time" value='1' {$linkexptime}>
{$MOD.LBL_PASSWORD_LINK_EXP_IN}
{assign var='ldays' value=''}
{assign var='lweeks' value=''}
{assign var='lmonths' value=''}
{if ($config.passwordsetting.linkexpirationtype ) == '1'}
{assign var='ldays' value='SELECTED'}
{/if}
{if ($config.passwordsetting.linkexpirationtype ) == '60'}
{assign var='lweeks' value='SELECTED'}
{/if}
{if ($config.passwordsetting.linkexpirationtype ) == '1440'}
{assign var='lmonths' value='SELECTED'}
{/if}
<input type='text' maxlength="3" and style="width:2em" name='passwordsetting_linkexpirationtime' value='{$config.passwordsetting.linkexpirationtime}'>
<SELECT NAME="passwordsetting_linkexpirationtype">
<OPTION VALUE='1' {$ldays}>{$MOD.LBL_MINUTES}
<OPTION VALUE='60' {$lweeks}>{$MOD.LBL_HOURS}
<OPTION VALUE='1440' {$lmonths}>{$MOD.LBL_DAYS}
</SELECT>
</td width='40%'>
<td >
</td>
</tr>
</table>
</td>
</tr>
<tr>
{if !empty($settings.captcha_on) || !($VALID_PUBLIC_KEY)}
{assign var='captcha_checked' value='CHECKED'}
{else}
{assign var='captcha_checked' value=''}
{/if}
<td width="25%" scope="row">{$MOD.ENABLE_CAPTCHA}:&nbsp{sugar_help text=$MOD.LBL_CAPTCHA_HELP_TEXT WIDTH=400}</td>
<td scope="row" width="75%"><input type='hidden' name='captcha_on' value='0'><input name="captcha_on" id="captcha_id" value="1" class="checkbox" tabindex='1' type="checkbox" onclick='document.getElementById("captcha_config_display").style.display=this.checked?"":"none";' {$captcha_checked}></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4">
<div id="captcha_config_display" style="display:{$CAPTCHA_CONFIG_DISPLAY}">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="10%" scope="row">{$MOD.LBL_PUBLIC_KEY}<span class="required">*</span></td>
<td width="40%" ><input type="text" name="captcha_public_key" id="captcha_public_key" size="45" value="{$settings.captcha_public_key}" tabindex='1' onblur="this.value=this.value.replace(/^\s+/,'').replace(/\s+$/,'')"></td>
<td width="10%" scope="row">{$MOD.LBL_PRIVATE_KEY}<span class="required">*</span></td>
<td width="40%" ><input type="text" name="captcha_private_key" size="45" value="{$settings.captcha_private_key}" tabindex='1' onblur="this.value=this.value.replace(/^\s+/,'').replace(/\s+$/,'')"></td>
</tr>
</table>
</div>
</td>
</tr>
{if !($VALID_PUBLIC_KEY)}
<tr><td scope="row"><span class='error'>{$MOD.ERR_PUBLIC_CAPTCHA_KEY}</span></td></tr>
{/if}
</table>
<table id="emailTemplatesId" name="emailTemplatesName" width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr>
<th align="left" scope="row" colspan="4">
<h4>
{$MOD.LBL_PASSWORD_TEMPLATE}
</h4>
</th>
</tr>
<tr>
<td scope="row" width="35%">{$MOD.LBL_PASSWORD_GENERATE_TEMPLATE_MSG}: </td>
<td >
<slot>
<select tabindex='251' id="generatepasswordtmpl" name="passwordsetting_generatepasswordtmpl" {$IE_DISABLED}>{$TMPL_DRPDWN_GENERATE}</select>
<input type="button" class="button" onclick="javascript:open_email_template_form('generatepasswordtmpl')" value="{$MOD.LBL_PASSWORD_CREATE_TEMPLATE}" {$IE_DISABLED}>
<input type="button" value="{$MOD.LBL_PASSWORD_EDIT_TEMPLATE}" class="button" onclick="javascript:edit_email_template_form('generatepasswordtmpl')" name='edit_generatepasswordtmpl' id='edit_generatepasswordtmpl' style="{$EDIT_TEMPLATE}">
</slot>
</td>
<td ></td>
<td ></td>
</tr>
<tr>
<td scope="row">{$MOD.LBL_PASSWORD_LOST_TEMPLATE_MSG}: </td>
<td >
<slot>
<select tabindex='251' id="lostpasswordtmpl" name="passwordsetting_lostpasswordtmpl" {$IE_DISABLED}>{$TMPL_DRPDWN_LOST}</select>
<input type="button" class="button" onclick="javascript:open_email_template_form('lostpasswordtmpl')" value="{$MOD.LBL_PASSWORD_CREATE_TEMPLATE}" {$IE_DISABLED}>
<input type="button" value="{$MOD.LBL_PASSWORD_EDIT_TEMPLATE}" class="button" onclick="javascript:edit_email_template_form('lostpasswordtmpl')" name='edit_lostpasswordtmpl' id='edit_lostpasswordtmpl' style="{$EDIT_TEMPLATE}">
</slot>
</td>
<td ></td>
<td ></td>
</tr>
</table>
{if !empty($settings.system_ldap_enabled)}
{assign var='system_ldap_enabled_checked' value='CHECKED'}
{assign var='ldap_display' value='inline'}
{else}
{assign var='system_ldap_enabled_checked' value=''}
{assign var='ldap_display' value='none'}
{/if}
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th align="left" scope="row" colspan='3'><h4>{$MOD.LBL_LDAP_TITLE}</h4></th>
</tr>
<tr>
<td width="25%" scope="row" valign='middle'>
{$MOD.LBL_LDAP_ENABLE}{sugar_help text=$MOD.LBL_LDAP_HELP_TXT}
</td><td valign='middle'><input name="system_ldap_enabled" id="system_ldap_enabled" class="checkbox" type="checkbox" {$system_ldap_enabled_checked} onclick='toggleDisplay("ldap_display");enableDisablePasswordTable();'></td><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr>
<td colspan='4'>
<table cellspacing='0' cellpadding='1' id='ldap_display' style='display:{$ldap_display}' width='100%'>
<tr>
<td width='25%' scope="row" valign='top' nowrap>{$MOD.LBL_LDAP_SERVER_HOSTNAME} {sugar_help text=$MOD.LBL_LDAP_SERVER_HOSTNAME_DESC}</td>{$settings.proxy_host}
<td width='25%' align="left" valign='top'><input name="ldap_hostname" size='25' type="text" value="{$settings.ldap_hostname}"></td>
<td width='25%' scope="row" valign='top' nowrap>{$MOD.LBL_LDAP_SERVER_PORT} {sugar_help text=$MOD.LBL_LDAP_SERVER_PORT_DESC}</td>{$settings.proxy_port}
<td width='25%' align="left" valign='top' ><input name="ldap_port" size='6' type="text" value="{$settings.ldap_port}"></td>
</tr>
<tr>
<td scope="row" valign='middle' nowrap>{$MOD.LBL_LDAP_USER_DN} {sugar_help text=$MOD.LBL_LDAP_USER_DN_DESC}</td>
<td align="left" valign='middle'><input name="ldap_base_dn" size='35' type="text" value="{$settings.ldap_base_dn}"></td>
<td scope="row" valign='middle' nowrap>{$MOD.LBL_LDAP_USER_FILTER} {sugar_help text=$MOD.LBL_LDAP_USER_FILTER_DESC}</td>
<td align="left" valign='middle'><input name="ldap_login_filter" size='25' type="text" value="{$settings.ldap_login_filter}"></td>
</tr>
<tr>
<td scope="row" valign='top' nowrap>{$MOD.LBL_LDAP_BIND_ATTRIBUTE} {sugar_help text=$MOD.LBL_LDAP_BIND_ATTRIBUTE_DESC}</td>
<td align="left" valign='top'><input name="ldap_bind_attr" size='25' type="text" value="{$settings.ldap_bind_attr}"> </td>
<td scope="row" valign='middle' nowrap>{$MOD.LBL_LDAP_LOGIN_ATTRIBUTE} {sugar_help text=$MOD.LBL_LDAP_LOGIN_ATTRIBUTE_DESC}</td>
<td align="left" valign='middle'><input name="ldap_login_attr" size='25' type="text" value="{$settings.ldap_login_attr}"></td>
</tr>
<tr>
<td scope="row" valign='top'nowrap>{$MOD.LBL_LDAP_GROUP_MEMBERSHIP} {sugar_help text=$MOD.LBL_LDAP_GROUP_MEMBERSHIP_DESC}</td>
<td align="left" valign='top'>
{if !empty($settings.ldap_group)}
{assign var='ldap_group_checked' value='CHECKED'}
{assign var='ldap_group_display' value=''}
{else}
{assign var='ldap_group_checked' value=''}
{assign var='ldap_group_display' value='none'}
{/if}
<input name="ldap_group_checkbox" class="checkbox" type="checkbox" {$ldap_group_checked} onclick='toggleDisplay("ldap_group")'>
</td>
<td valign='middle' nowrap></td>
<td align="left" valign='middle'></td>
</tr>
<tr>
<td></td>
<td colspan='3'>
<span id='ldap_group' style='display:{$ldap_group_display}'>
<table width='100%'>
<tr>
<td width='25%' scope="row" valign='top'nowrap>{$MOD.LBL_LDAP_GROUP_DN} {sugar_help text=$MOD.LBL_LDAP_GROUP_DN_DESC}</td>
<td width='25%' align="left" valign='top'><input name="ldap_group_dn" size='20' type="text" value="{$settings.ldap_group_dn}"></td>
<td width='25%' scope="row" valign='top'nowrap>{$MOD.LBL_LDAP_GROUP_NAME} {sugar_help text=$MOD.LBL_LDAP_GROUP_NAME_DESC}</td>
<td width='25%' align="left" valign='top'><input name="ldap_group_name" size='20' type="text" value="{$settings.ldap_group_name}"></td>
</tr>
<tr>
<td scope="row" valign='top' nowrap>{$MOD.LBL_LDAP_GROUP_USER_ATTR} {sugar_help text=$MOD.LBL_LDAP_GROUP_USER_ATTR_DESC}</td>
<td align="left" valign='top'><input name="ldap_group_user_attr" size='20' type="text" value="{$settings.ldap_group_user_attr}"> </td>
<td scope="row" valign='top' nowrap>{$MOD.LBL_LDAP_GROUP_ATTR} {sugar_help text=$MOD.LBL_LDAP_GROUP_ATTR_DESC}</td>
<td align="left" valign='top'><input name="ldap_group_attr" size='20' type="text" value="{$settings.ldap_group_attr}"> </td>
</tr>
</table>
<br>
</span>
</td>
</tr>
<tr>
<td scope="row" valign='top'nowrap>{$MOD.LBL_LDAP_AUTHENTICATION} {sugar_help text=$MOD.LBL_LDAP_AUTHENTICATION_DESC}</td>
<td align="left" valign='top' >
{if !empty($settings.ldap_authentication)}
{assign var='ldap_authentication_checked' value='CHECKED'}
{assign var='ldap_authentication_display' value=''}
{else}
{assign var='ldap_authentication_checked' value=''}
{assign var='ldap_authentication_display' value='none'}
{/if}
<input name="ldap_authentication_checkbox" class="checkbox" type="checkbox" {$ldap_authentication_checked} onclick='toggleDisplay("ldap_authentication")'>
</td>
<td valign='middle' nowrap></td>
<td align="left" valign='middle'></td>
</tr>
<tr>
<td></td>
<td colspan='3'>
<span id='ldap_authentication' style='display:{$ldap_authentication_display}'>
<table width='100%' >
<tr>
<td width='25%' scope="row" valign='top'nowrap>{$MOD.LBL_LDAP_ADMIN_USER} {sugar_help text=$MOD.LBL_LDAP_ADMIN_USER_DESC}</td>
<td width='25%' align="left" valign='top'><input name="ldap_admin_user" size='20' type="text" value="{$settings.ldap_admin_user}"></td>
<td width='25%' scope="row" valign='middle' nowrap>{$MOD.LBL_LDAP_ADMIN_PASSWORD}</td>
<td width='25%' align="left" valign='middle'><input name="ldap_admin_password" size='20' type="password" value="{$settings.ldap_admin_password}"> </td>
</tr>
</table>
<br>
</span>
</td>
</tr>
<tr>
<td scope="row" valign='top' nowrap>{$MOD.LBL_LDAP_AUTO_CREATE_USERS} {sugar_help text=$MOD.LBL_LDAP_AUTO_CREATE_USERS_DESC}</td>
{if !empty($settings.ldap_auto_create_users)}
{assign var='ldap_auto_create_users_checked' value='CHECKED'}
{else}
{assign var='ldap_auto_create_users_checked' value=''}
{/if}
<td align="left" valign='top'><input type='hidden' name='ldap_auto_create_users' value='0'><input name="ldap_auto_create_users" value="1" class="checkbox" type="checkbox" {$ldap_auto_create_users_checked}></td>
<td valign='middle' nowrap></td>
<td align="left" valign='middle'></td>
</tr>
<tr>
<td scope="row" valign='middle' nowrap>{$MOD.LBL_LDAP_ENC_KEY} {sugar_help text=$LDAP_ENC_KEY_DESC}</td>
<td align="left" valign='middle'><input name="ldap_enc_key" size='35' type="password" value="{$settings.ldap_enc_key}" {$LDAP_ENC_KEY_READONLY}> </td>
<td valign='middle' nowrap></td>
<td align="left" valign='middle'></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
{if !empty($settings.system_ldap_enabled)}
{assign var='system_ldap_enabled_checked' value='CHECKED'}
{assign var='ldap_display' value='inline'}
{else}
{assign var='system_ldap_enabled_checked' value=''}
{assign var='ldap_display' value='none'}
{/if}
<div style="padding-top: 2px;">
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" id="btn_save" type="submit" onclick="addcheck(form);return check_form('ConfigurePasswordSettings');" name="save" value="{$APP.LBL_SAVE_BUTTON_LABEL}" />
&nbsp;<input title="{$MOD.LBL_CANCEL_BUTTON_TITLE}" onclick="document.location.href='index.php?module=Administration&action=index'" class="button" type="button" name="cancel" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" />
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
{$JAVASCRIPT}
{if !($VALID_PUBLIC_KEY)}
<script>
document.getElementById('captcha_public_key').focus();
document.getElementById('captcha_id').checked=true;
document.getElementById('forgotpassword_checkbox').checked=true;
</script>
{/if}
{literal}
<script>
function addcheck(form){{/literal}
addForm('ConfigurePasswordSettings');
if(document.getElementById('forgotpassword_checkbox').checked){literal}{{/literal}
addToValidate('ConfigurePasswordSettings', 'passwordsetting_linkexpirationtime', 'int', form.required_link_exp_time.checked,"{$MOD.ERR_PASSWORD_LINK_EXPIRE_TIME} ");
{literal}}{/literal}
if(document.getElementById('SystemGeneratedPassword_checkbox').checked){literal}{{/literal}
addToValidate('ConfigurePasswordSettings', 'passwordsetting_systexpirationtime', 'int', form.required_sys_pwd_exp_time.checked,"{$MOD.ERR_PASSWORD_EXPIRE_TIME}" );
addToValidate('ConfigurePasswordSettings', 'passwordsetting_systexpirationlogin', 'int', form.required_sys_pwd_exp_login.checked,"{$MOD.ERR_PASSWORD_EXPIRE_LOGIN}" );
{literal}}{/literal}
{literal} }
function open_email_template_form(fieldToSet) {
fieldToSetValue = fieldToSet;
URL="index.php?module=EmailTemplates&action=EditView&inboundEmail=true&show_js=1";
windowName = 'email_template';
windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';
win = window.open(URL, windowName, windowFeatures);
if(window.focus)
{
// put the focus on the popup if the browser supports the focus() method
win.focus();
}
}
function enableDisablePasswordTable() {
var ldapEnabled = document.getElementById("system_ldap_enabled").checked;
if (ldapEnabled) {
document.getElementById("emailTemplatesId").style.display = "none";
document.getElementById("sysGeneratedId").style.display = "none";
document.getElementById("userResetPassId").style.display = "none";
} else {
document.getElementById("emailTemplatesId").style.display = "";
document.getElementById("sysGeneratedId").style.display = "";
document.getElementById("userResetPassId").style.display = "";
}
} // if
function edit_email_template_form(templateField) {
fieldToSetValue = templateField;
var field=document.getElementById(templateField);
URL="index.php?module=EmailTemplates&action=EditView&inboundEmail=true&show_js=1";
if (field.options[field.selectedIndex].value != 'undefined') {
URL+="&record="+field.options[field.selectedIndex].value;
}
windowName = 'email_template';
windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';
win = window.open(URL, windowName, windowFeatures);
if(window.focus)
{
// put the focus on the popup if the browser supports the focus() method
win.focus();
}
}
function refresh_email_template_list(template_id, template_name) {
var field=document.getElementById(fieldToSetValue);
var bfound=0;
for (var i=0; i < field.options.length; i++) {
if (field.options[i].value == template_id) {
if (field.options[i].selected==false) {
field.options[i].selected=true;
}
field.options[i].text = template_name;
bfound=1;
}
}
//add item to selection list.
if (bfound == 0) {
var newElement=document.createElement('option');
newElement.text=template_name;
newElement.value=template_id;
field.options.add(newElement);
newElement.selected=true;
}
//enable the edit button.
var editButtonName = 'edit_generatepasswordtmpl';
if (fieldToSetValue == 'generatepasswordtmpl') {
editButtonName = 'edit_lostpasswordtmpl';
} // if
var field1=document.getElementById(editButtonName);
field1.style.visibility="visible";
var applyListToTemplateField = 'generatepasswordtmpl';
if (fieldToSetValue == 'generatepasswordtmpl') {
applyListToTemplateField = 'lostpasswordtmpl';
} // if
var field=document.getElementById(applyListToTemplateField);
if (bfound == 1) {
for (var i=0; i < field.options.length; i++) {
if (field.options[i].value == template_id) {
field.options[i].text = template_name;
} // if
} // for
} else {
var newElement=document.createElement('option');
newElement.text=template_name;
newElement.value=template_id;
field.options.add(newElement);
} // else
-->
}
function testregex(customregex)
{
try
{
var string = 'hello';
string.match(customregex.value);
}
catch(err)
{
alert(SUGAR.language.get("Administration", "ERR_INCORRECT_REGEX"));
setTimeout("document.getElementById('customregex').select()",10);
}
}
function toggleDisplay_2(id){
if(this.document.getElementById(id).style.display=='none'){
this.document.getElementById(id).style.display='';
this.document.getElementById(id+"_lbl").innerHTML='{/literal}{$MOD.LBL_HIDE_ADVANCED_OPTIONS}{literal}';
this.document.getElementById("regex_config_display_img").src = '{/literal}{sugar_getimagepath file="basic_search.gif"}{literal}';
}else{
this.document.getElementById(id).style.display='none'
this.document.getElementById(id+"_lbl").innerHTML='{/literal}{$MOD.LBL_SHOW_ADVANCED_OPTIONS}{literal}';
this.document.getElementById("regex_config_display_img").src = '{/literal}{sugar_getimagepath file="advanced_search.gif"}{literal}';
}
}
function forgot_password_enable(check){
var table_fields=document.getElementById('forgot_password_table');
var forgot_password_input=table_fields.getElementsByTagName('input');
var forgot_password_select=table_fields.getElementsByTagName('select');
if(check.checked){
for (i=0;i<forgot_password_input.length;i++)
forgot_password_input[i].disabled='';
for (j=0;j<forgot_password_select.length;j++)
forgot_password_select[j].disabled='';
document.ConfigurePasswordSettings.captcha_on[1].disabled='';
}else
{
document.ConfigurePasswordSettings.captcha_on[1].disabled='disabled';
document.ConfigurePasswordSettings.captcha_on[1].checked='';
document.getElementById("captcha_config_display").style.display='none';
for (i=0;i<forgot_password_input.length;i++)
forgot_password_input[i].disabled='disabled';
for (j=0;j<forgot_password_select.length;j++)
forgot_password_select[j].disabled='disabled';
}
}
function enable_syst_generated_pwd(check){
var table_fields=document.getElementById('syst_generated_pwd_table');
var syst_generated_pwd_input=table_fields.getElementsByTagName('input');
var syst_generated_pwd_select=table_fields.getElementsByTagName('select');
if(check.checked){
for (i=0;i<syst_generated_pwd_input.length;i++)
syst_generated_pwd_input[i].disabled='';
for (j=0;j<syst_generated_pwd_select.length;j++)
syst_generated_pwd_select[j].disabled='';
}else
{
for (i=0;i<syst_generated_pwd_input.length;i++)
syst_generated_pwd_input[i].disabled='disabled';
for (j=0;j<syst_generated_pwd_select.length;j++)
syst_generated_pwd_select[j].disabled='disabled';
}
}
forgot_password_enable(document.getElementById('forgotpassword_checkbox'));
enable_syst_generated_pwd(document.getElementById('SystemGeneratedPassword_checkbox'));
enableDisablePasswordTable();
</script>
{/literal}

View File

@@ -0,0 +1,456 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class RepairAndClear
{
public $module_list;
public $show_output;
protected $actions;
public $execute;
protected $module_list_from_cache;
public function repairAndClearAll($selected_actions, $modules, $autoexecute=false, $show_output=true)
{
global $mod_strings;
$this->module_list= $modules;
$this->show_output = $show_output;
$this->actions = $selected_actions;
$this->actions[] = 'repairDatabase';
$this->execute=$autoexecute;
//clear vardefs always..
$this->clearVardefs();
//first clear the language cache.
$this->clearLanguageCache();
foreach ($this->actions as $current_action)
switch($current_action)
{
case 'repairDatabase':
if(in_array($mod_strings['LBL_ALL_MODULES'], $this->module_list))
$this->repairDatabase();
else
$this->repairDatabaseSelectModules();
break;
case 'rebuildExtensions':
$this->rebuildExtensions();
break;
case 'clearTpls':
$this->clearTpls();
break;
case 'clearJsFiles':
$this->clearJsFiles();
break;
case 'clearDashlets':
$this->clearDashlets();
break;
case 'clearSugarFeedCache':
$this->clearSugarFeedCache();
break;
case 'clearThemeCache':
$this->clearThemeCache();
break;
case 'clearVardefs':
$this->clearVardefs();
break;
case 'clearJsLangFiles':
$this->clearJsLangFiles();
break;
case 'rebuildAuditTables':
$this->rebuildAuditTables();
break;
case 'clearSearchCache':
$this->clearSearchCache();
break;
case 'clearAll':
$this->clearTpls();
$this->clearJsFiles();
$this->clearVardefs();
$this->clearJsLangFiles();
$this->clearLanguageCache();
$this->clearDashlets();
$this->clearSugarFeedCache();
$this->clearSmarty();
$this->clearThemeCache();
$this->clearXMLfiles();
$this->clearSearchCache();
$this->rebuildExtensions();
$this->rebuildAuditTables();
$this->repairDatabase();
break;
}
}
/////////////OLD
public function repairDatabase()
{
global $dictionary, $mod_strings;
if(false == $this->show_output)
$_REQUEST['repair_silent']='1';
$_REQUEST['execute']=$this->execute;
$GLOBALS['reload_vardefs'] = true;
$hideModuleMenu = true;
include_once('modules/Administration/repairDatabase.php');
}
public function repairDatabaseSelectModules()
{
global $current_user, $mod_strings, $dictionary;
set_time_limit(3600);
include('include/modules.php'); //bug 15661
$db = DBManagerFactory::getInstance();
if (is_admin($current_user) || is_admin_for_any_module($current_user))
{
$export = false;
if($this->show_output) echo get_module_title($mod_strings['LBL_REPAIR_DATABASE'], $mod_strings['LBL_REPAIR_DATABASE'], true);
if($this->show_output) echo "<h1 id=\"rdloading\">{$mod_strings['LBL_REPAIR_DATABASE_PROCESSING']}</h1>";
ob_flush();
$sql = '';
if($this->module_list && !in_array($mod_strings['LBL_ALL_MODULES'],$this->module_list))
{
$repair_related_modules = array_keys($dictionary);
//repair DB
$dm = !empty($GLOBALS['sugar_config']['developerMode']);
$GLOBALS['sugar_config']['developerMode'] = true;
foreach($this->module_list as $bean_name)
{
if (isset($beanFiles[$bean_name]) && file_exists($beanFiles[$bean_name]))
{
require_once($beanFiles[$bean_name]);
$GLOBALS['reload_vardefs'] = true;
$focus = new $bean_name ();
#30273
if($focus->disable_vardefs == false) {
include('modules/' . $focus->module_dir . '/vardefs.php');
if($this->show_output)
print_r("<p>" .$mod_strings['LBL_REPAIR_DB_FOR'].' '. $bean_name . "</p>");
$sql .= $db->repairTable($focus, $this->execute);
}
}
}
$GLOBALS['sugar_config']['developerMode'] = $dm;
if ($this->show_output) echo "<script type=\"text/javascript\">document.getElementById('rdloading').style.display = \"none\";</script>";
if (isset ($sql) && !empty ($sql))
{
$qry_str = "";
foreach (explode("\n", $sql) as $line) {
if (!empty ($line) && substr($line, -2) != "*/") {
$line .= ";";
}
$qry_str .= $line . "\n";
}
if ($this->show_output){
echo "<h3>{$mod_strings['LBL_REPAIR_DATABASE_DIFFERENCES']}</h3>";
echo "<p>{$mod_strings['LBL_REPAIR_DATABASE_TEXT']}</p>";
echo "<form method=\"post\" action=\"index.php?module=Administration&amp;action=repairDatabase\">";
echo "<textarea name=\"sql\" rows=\"24\" cols=\"150\" id=\"repairsql\">$qry_str</textarea>";
echo "<br /><input type=\"submit\" value=\"".$mod_strings['LBL_REPAIR_DATABASE_EXECUTE']."\" name=\"raction\" /> <input type=\"submit\" name=\"raction\" value=\"".$mod_strings['LBL_REPAIR_DATABASE_EXPORT']."\" />";
}
}
else
if ($this->show_output) echo "<h3>{$mod_strings['LBL_REPAIR_DATABASE_SYNCED']}</h3>";
}
}
else
die('Admin Only Section');
}
public function rebuildExtensions()
{
global $mod_strings;
if($this->show_output) echo $mod_strings['LBL_QR_REBUILDEXT'];
global $current_user;
require_once('ModuleInstall/ModuleInstaller.php');
$mi = new ModuleInstaller();
$mi->rebuild_all(!$this->show_output);
// Remove the "Rebuild Extensions" red text message on admin logins
if($this->show_output)echo "Updating the admin warning message...<BR>";
// clear the database row if it exists (just to be sure)
$query = "DELETE FROM versions WHERE name='Rebuild Extensions'";
$GLOBALS['log']->info($query);
$GLOBALS['db']->query($query);
// insert a new database row to show the rebuild extensions is done
$id = create_guid();
$gmdate = gmdate($GLOBALS['timedate']->get_db_date_time_format());
$date_entered = db_convert("'$gmdate'", 'datetime');
$query = 'INSERT INTO versions (id, deleted, date_entered, date_modified, modified_user_id, created_by, name, file_version, db_version) '
. "VALUES ('$id', '0', $date_entered, $date_entered, '1', '1', 'Rebuild Extensions', '4.0.0', '4.0.0')";
$GLOBALS['log']->info($query);
$GLOBALS['db']->query($query);
// unset the session variable so it is not picked up in DisplayWarnings.php
if(isset($_SESSION['rebuild_extensions'])) {
unset($_SESSION['rebuild_extensions']);
}
}
//Cache Clear Methods
public function clearSmarty()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARSMARTY']}</h3>";
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'smarty/templates_c', '.tpl.php');
}
public function clearXMLfiles()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_XMLFILES']}</h3>";
$this->_clearCache($GLOBALS['sugar_config']['tmp_dir'], '.xml');
include('modules/Versions/ExpectedVersions.php');
global $expect_versions;
if (isset($expect_versions['Chart Data Cache'])) {
$version = new Version();
$version->retrieve_by_string_fields(array('name'=>'Chart Data Cache'));
$version->name = $expect_versions['Chart Data Cache']['name'];
$version->file_version = $expect_versions['Chart Data Cache']['file_version'];
$version->db_version = $expect_versions['Chart Data Cache']['db_version'];
$version->save();
}
}
public function clearDashlets()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARDASHLET']}</h3>";
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'dashlets', '.php');
}
public function clearThemeCache()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARTHEMECACHE']}</h3>";
SugarThemeRegistry::clearAllCaches();
}
public function clearSugarFeedCache()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARSUGARFEEDCACHE']}</h3>";
SugarFeed::flushBackendCache();
}
public function clearTpls()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARTEMPLATE']}</h3>";
if(!in_array( translate('LBL_ALL_MODULES'),$this->module_list) && !empty($this->module_list))
{
foreach($this->module_list as $module_name_singular )
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'modules/'.$this->_getModuleNamePlural($module_name_singular), '.tpl');
}
else
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'modules', '.tpl');
}
public function clearVardefs()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARVADEFS']}</h3>";
if(!empty($this->module_list) && is_array($this->module_list) && !in_array( translate('LBL_ALL_MODULES'),$this->module_list))
{
foreach($this->module_list as $module_name_singular )
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'modules/'.$this->_getModuleNamePlural($module_name_singular), 'vardefs.php');
}
else
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'modules', 'vardefs.php');
}
public function clearJsFiles()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARJS']}</h3>";
if(!in_array( translate('LBL_ALL_MODULES'),$this->module_list) && !empty($this->module_list))
{
foreach($this->module_list as $module_name_singular )
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'modules/'.$this->_getModuleNamePlural($module_name_singular), '.js');
}
else
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'modules', '.js');
}
public function clearJsLangFiles()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARJSLANG']}</h3>";
if(!in_array(translate('LBL_ALL_MODULES'),$this->module_list ) && !empty($this->module_list))
{
foreach($this->module_list as $module_name_singular )
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'jsLanguage/'.$this->_getModuleNamePlural($module_name_singular), '.js');
}
else
$this->_clearCache($GLOBALS['sugar_config']['cache_dir'].'jsLanguage', '.js');
}
/**
* Remove the language cache files from cache/modules/<module>/language
*/
public function clearLanguageCache()
{
global $mod_strings;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARLANG']}</h3>";
//clear cache using the list $module_list_from_cache
if ( !empty($this->module_list) && is_array($this->module_list) ) {
if( in_array(translate('LBL_ALL_MODULES'), $this->module_list))
{
LanguageManager::clearLanguageCache();
}
else { //use the modules selected thrut the select list.
foreach($this->module_list as $module_name)
LanguageManager::clearLanguageCache($module_name);
}
}
}
/**
* Remove the cache/modules/unified_search_modules.php
*/
public function clearSearchCache() {
global $mod_strings, $sugar_config;
if($this->show_output) echo "<h3>{$mod_strings['LBL_QR_CLEARSEARCH']}</h3>";
$search_dir='cache/';
if (!empty($sugar_config['cache_dir'])) {
$search_dir=$sugar_config['cache_dir'];
}
$src_file = $search_dir . 'modules/unified_search_modules.php';
if(file_exists($src_file)) {
unlink( "$src_file" );
}
}
//////////////////////////////////////////////////////////////
/////REPAIR AUDIT TABLES
public function rebuildAuditTables()
{
global $mod_strings;
include('include/modules.php'); //bug 15661
if($this->show_output) echo "<h3> {$mod_strings['LBL_QR_REBUILDAUDIT']}</h3>";
if(!in_array( translate('LBL_ALL_MODULES'), $this->module_list) && !empty($this->module_list))
{
foreach ($this->module_list as $bean_name){
echo $bean_name;
if( isset($beanFiles[$bean_name]) && file_exists($beanFiles[$bean_name])) {
require_once($beanFiles[$bean_name]);
$this->_rebuildAuditTablesHelper(new $bean_name());
}
}
} else if(in_array(translate('LBL_ALL_MODULES'), $this->module_list)) {
foreach ($beanFiles as $bean => $file){
if( file_exists($file)) {
require_once($file);
$this->_rebuildAuditTablesHelper(new $bean());
}
}
}
if($this->show_output) echo $mod_strings['LBL_DONE'];
}
private function _rebuildAuditTablesHelper($focus)
{
global $mod_strings;
// skip if not a SugarBean object
if ( !($focus instanceOf SugarBean) )
return;
if ($focus->is_AuditEnabled()) {
if (!$focus->db->tableExists($focus->get_audit_table_name())) {
if($this->show_output) echo $mod_strings['LBL_QR_CREATING_TABLE']." ".$focus->get_audit_table_name().' '.$mod_strings['LBL_FOR'].' '. $focus->object_name.'.<br/>';
$focus->create_audit_table();
} else {
if($this->show_output){
$echo=str_replace('%1$',$focus->object_name,$mod_strings['LBL_REBUILD_AUDIT_SKIP']);
echo $echo;
}
}
}else
if($this->show_output) echo $focus->object_name.$mod_strings['LBL_QR_NOT_AUDIT_ENABLED'];
}
///////////////////////////////////////////////////////////////
////END REPAIR AUDIT TABLES
///////////////////////////////////////////////////////////////
//// Recursively unlink all files of the given $extension in the given $thedir.
//
private function _clearCache($thedir, $extension)
{
if ($current = @opendir($thedir)) {
while (false !== ($children = readdir($current))) {
if ($children != "." && $children != "..") {
if (is_dir($thedir . "/" . $children)) {
$this->_clearCache($thedir . "/" . $children, $extension);
}
elseif (is_file($thedir . "/" . $children) && (substr_count($children, $extension))) {
unlink($thedir . "/" . $children);
}
}
}
}
}
/////////////////////////////////////////////////////////////
////////
private function _getModuleNamePlural($module_name_singular)
{
global $beanList;
while ($curr_module = current($beanList))
{
if ($curr_module == $module_name_singular)
return key($beanList); //name of the module, plural.
next($beanList);
}
}
}

View File

@@ -0,0 +1,57 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
include('include/modules.php');
global $beanFiles, $mod_strings;
echo $mod_strings['LBL_REBUILD_AUDIT_SEARCH'] . ' <BR>';
foreach ($beanFiles as $bean => $file)
{
if(strlen($file) > 0 && file_exists($file)) {
require_once($file);
$focus = new $bean();
if ($focus->is_AuditEnabled()) {
if (!$focus->db->tableExists($focus->get_audit_table_name())) {
printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name);
$focus->create_audit_table();
} else {
printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name);
}
}
}
}
echo $mod_strings['LBL_DONE'];
?>

View File

@@ -0,0 +1,57 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
-->
<!-- BEGIN: main -->
<p>
<form name="RebuildConfig" method="post" action="index.php">
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="RebuildConfig">
<input type="hidden" name="return_module" value="Administration">
<input type="hidden" name="return_action" value="RebuildConfig">
<input type="hidden" name="perform_rebuild" value="true">
<table cellspacing="{CELLSPACING}" class="other view">
<tr>
<td width="20%" scope="row">{LBL_CONFIG_CHECK}</td>
<td>{CONFIG_CHECK}</td>
</tr>
<tr>
<td scope="row">{LBL_PERFORM_REBUILD}</td>
<td><input type="submit" name="button" {DISABLE_CONFIG_REBUILD} value="{BTN_PERFORM_REBUILD}"></td>
</tr>
</table>
</form>
</p>
<!-- END: main -->

View File

@@ -0,0 +1,83 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $mod_strings;
// the initial settings for the template variables to fill
$config_check = '';
$config_file_ready = false;
$lbl_rebuild_config = $mod_strings['LBL_REBUILD_CONFIG'];
$btn_rebuild_config = $mod_strings['BTN_REBUILD_CONFIG'];
$disable_config_rebuild = 'disabled="disabled"';
// check the status of the config file
if( is_writable('config.php') ){
$config_check = $mod_strings['MSG_CONFIG_FILE_READY_FOR_REBUILD'];
$disable_config_rebuild = '';
$config_file_ready = true;
}
else {
$config_check = $mod_strings['MSG_MAKE_CONFIG_FILE_WRITABLE'];
}
// only do the rebuild if config file checks out and user has posted back
if( !empty($_POST['perform_rebuild']) && $config_file_ready ){
if ( rebuildConfigFile($sugar_config, $sugar_version) ) {
$config_check = $mod_strings['MSG_CONFIG_FILE_REBUILD_SUCCESS'];
$disable_config_rebuild = 'disabled="disabled"';
}
else {
$config_check = $mod_strings['MSG_CONFIG_FILE_REBUILD_FAILED'];
}
}
/////////////////////////////////////////////////////////////////////
// TEMPLATE ASSIGNING
$xtpl = new XTemplate('modules/Administration/RebuildConfig.html');
$xtpl->assign('LBL_CONFIG_CHECK', $mod_strings['LBL_CONFIG_CHECK']);
$xtpl->assign('CONFIG_CHECK', $config_check);
$xtpl->assign('LBL_PERFORM_REBUILD', $lbl_rebuild_config);
$xtpl->assign('DISABLE_CONFIG_REBUILD', $disable_config_rebuild);
$xtpl->assign('BTN_PERFORM_REBUILD', $btn_rebuild_config);
$xtpl->parse('main');
$xtpl->out('main');
?>

View File

@@ -0,0 +1,54 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $current_user;
$silent = isset($_REQUEST['silent']) ? true : false;
if(is_admin($current_user)){
global $mod_strings;
if (!$silent) { echo $mod_strings['LBL_REBUILD_DASHLETS_DESC']; }
if(is_file($GLOBALS['sugar_config']['cache_dir'].'dashlets/dashlets.php')) {
unlink($GLOBALS['sugar_config']['cache_dir'].'dashlets/dashlets.php');
}
require_once('include/Dashlets/DashletCacheBuilder.php');
$dc = new DashletCacheBuilder();
$dc->buildCache();
if( !$silent ) echo '<br><br><br><br>' . $mod_strings['LBL_REBUILD_DASHLETS_DESC_SUCCESS'];
}
else{
die('Admin Only Section');
}
?>

View File

@@ -0,0 +1,40 @@
<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $current_user;
if(is_admin($current_user)){
require_once("include/Expressions/updatecache.php");
}

View File

@@ -0,0 +1,82 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $current_user;
if(!is_admin($current_user)){
die('Unauthorized Access. Aborting.');
}
//make sure that db-type is oracle.
if ($GLOBALS['db']->dbType != "oci8") {
// die('Action not supported for your database.');
}
//find modules that have a full-text index and rebuild it.
global $beanFiles;
foreach ($beanFiles as $beanname=>$beanpath) {
require_once($beanpath);
$focus= new $beanname();
//skips beans based on same tables. user, employee and group are an example.
if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
continue;
} else {
$processed_tables[$focus->table_name]=$focus->table_name;
}
if(!empty($dictionary[$focus->object_name]['indices'])) {
$indices=$dictionary[$focus->object_name]['indices'];
} else {
$indices=array();
}
//clean vardef defintions.. removed indexes not value for this dbtype.
//set index name as the key.
$var_indices=array();
foreach ($indices as $definition) {
//database helpers do not know how to handle full text indices
if ($definition['type']=='fulltext') {
if (isset($definition['db']) and $definition['db'] != $GLOBALS['db']->dbType) {
continue;
}
echo "Rebuilding Index {$definition['name']} <BR/>";
$GLOBALS['db']->query('alter index ' .$definition['name'] . " REBUILD");
}
}
}
?>

View File

@@ -0,0 +1,60 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(is_admin($current_user)){
global $mod_strings, $sugar_config;
echo $mod_strings['LBL_REBUILD_JAVASCRIPT_LANG_DESC'];
$jsFiles = array();
getFiles($jsFiles, $sugar_config['cache_dir'] . 'jsLanguage');
foreach($jsFiles as $file) {
unlink($file);
}
if(empty($sugar_config['js_lang_version'])) $sugar_config['js_lang_version'] = 1;
else $sugar_config['js_lang_version'] += 1;
write_array_to_file( "sugar_config", $sugar_config, "config.php");
//remove lanugage cache files
LanguageManager::clearLanguageCache();
}
else{
die('Admin Only Section');
}
?>

View File

@@ -0,0 +1,150 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' ) ;
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
include ('include/modules.php') ;
global $db, $mod_strings ;
$log = & $GLOBALS [ 'log' ] ;
$query = "DELETE FROM relationships" ;
$db->query ( $query ) ;
//clear cache before proceeding..
VardefManager::clearVardef () ;
// loop through all of the modules and create entries in the Relationships table (the relationships metadata) for every standard relationship, that is, relationships defined in the /modules/<module>/vardefs.php
// SugarBean::createRelationshipMeta just takes the relationship definition in a file and inserts it as is into the Relationships table
// It does not override or recreate existing relationships
foreach ( $GLOBALS['beanFiles'] as $bean => $file )
{
if (strlen ( $file ) > 0 && file_exists ( $file ))
{
if (! class_exists ( $bean ))
{
require ($file) ;
}
$focus = new $bean ( ) ;
if ( $focus instanceOf SugarBean ) {
$table_name = $focus->table_name ;
$empty = '' ;
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_REBUILD_REL_PROC_META' ] . $focus->table_name . "..." ;
SugarBean::createRelationshipMeta ( $focus->getObjectName (), $db, $table_name, $empty, $focus->module_dir ) ;
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
}
}
}
// do the same for custom relationships (true in the last parameter to SugarBean::createRelationshipMeta) - that is, relationships defined in the custom/modules/<modulename>/Ext/vardefs/ area
foreach ( $GLOBALS['beanFiles'] as $bean => $file )
{
//skip this file if it does not exist
if(!file_exists($file)) continue;
if (! class_exists ( $bean ))
{
require ($file) ;
}
$focus = new $bean ( ) ;
if ( $focus instanceOf SugarBean ) {
$table_name = $focus->table_name ;
$empty = '' ;
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_REBUILD_REL_PROC_C_META' ] . $focus->table_name . "..." ;
SugarBean::createRelationshipMeta ( $focus->getObjectName (), $db, $table_name, $empty, $focus->module_dir, true ) ;
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
}
}
// finally, whip through the list of relationships defined in TableDictionary.php, that is all the relationships in the metadata directory, and install those
$dictionary = array ( ) ;
require ('modules/TableDictionary.php') ;
//for module installer incase we alredy loaded the table dictionary
if (file_exists ( 'custom/application/Ext/TableDictionary/tabledictionary.ext.php' ))
{
include ('custom/application/Ext/TableDictionary/tabledictionary.ext.php') ;
}
$rel_dictionary = $dictionary ;
foreach ( $rel_dictionary as $rel_name => $rel_data )
{
$table = $rel_data [ 'table' ] ;
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_REBUILD_REL_PROC_C_META' ] . $rel_name . "..." ;
SugarBean::createRelationshipMeta ( $rel_name, $db, $table, $rel_dictionary, '' ) ;
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
}
//clean relationship cache..will be rebuilt upon first access.
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_REBUILD_REL_DEL_CACHE' ] ;
Relationship::delete_cache () ;
//////////////////////////////////////////////////////////////////////////////
// Remove the "Rebuild Relationships" red text message on admin logins
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_REBUILD_REL_UPD_WARNING' ] ;
// clear the database row if it exists (just to be sure)
$query = "DELETE FROM versions WHERE name='Rebuild Relationships'" ;
$log->info ( $query ) ;
$db->query ( $query ) ;
// insert a new database row to show the rebuild relationships is done
$id = create_guid () ;
$gmdate = gmdate ($GLOBALS['timedate']->get_db_date_time_format()) ;
$date_entered = db_convert ( "'$gmdate'", 'datetime' ) ;
$query = 'INSERT INTO versions (id, deleted, date_entered, date_modified, modified_user_id, created_by, name, file_version, db_version) ' . "VALUES ('$id', '0', $date_entered, $date_entered, '1', '1', 'Rebuild Relationships', '4.0.0', '4.0.0')" ;
$log->info ( $query ) ;
$db->query ( $query ) ;
// unset the session variable so it is not picked up in DisplayWarnings.php
if (isset ( $_SESSION [ 'rebuild_relationships' ] ))
{
unset ( $_SESSION [ 'rebuild_relationships' ] ) ;
}
if (empty ( $_REQUEST [ 'silent' ] ))
echo $mod_strings [ 'LBL_DONE' ] ;
?>

View File

@@ -0,0 +1,76 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
echo get_module_title('Administration', $mod_strings['LBL_REBUILD_SCHEDULERS_TITLE'].":", true);
if(isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
require_once('install/install_utils.php');
$focus = new Scheduler();
$focus->rebuildDefaultSchedulers();
$admin_mod_strings = return_module_language($current_language, 'Administration');
?>
<table cellspacing="{CELLSPACING}" class="otherview">
<tr>
<td scope="row" width="35%"><?php echo $admin_mod_strings['LBL_REBUILD_SCHEDULERS_DESC_SUCCESS']; ?></td>
<td><a href="index.php?module=Administration&action=Upgrade"><?php echo $admin_mod_strings['LBL_RETURN']; ?></a></td>
</tr>
</table>
<?php
} else {
?>
<p>
<form name="RebuildSchedulers" method="post" action="index.php">
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="RebuildSchedulers">
<input type="hidden" name="return_module" value="Administration">
<input type="hidden" name="return_action" value="Upgrade">
<input type="hidden" name="perform_rebuild" value="true">
<table cellspacing="{CELLSPACING}" class="other view">
<tr>
<td scope="row" width="15%"><?php echo $mod_strings['LBL_REBUILD_SCHEDULERS_TITLE']; ?></td>
<td><input type="submit" name="button" value="<?php echo $mod_strings['LBL_REBUILD']; ?>"></td>
</tr>
<tr>
<td colspan="2" scope="row"><?php echo $mod_strings['LBL_REBUILD_SCHEDULERS_DESC']; ?></td>
</tr>
</table>
</form>
</p>
<?php
}
?>

View File

@@ -0,0 +1,75 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
require_once('modules/Calendar/DateTimeUtil.php');
global $timedate;
$callBean = new Call();
$callQuery = "SELECT * FROM calls where calls.status != 'Held' and calls.deleted=0";
//$callQuery = "SELECT * FROM calls where calls.name like '1' and calls.deleted=0";
$result = $callBean->db->query($callQuery, true, "");
$row = $callBean->db->fetchByAssoc($result);
while ($row != null) {
$date_time_start =DateTimeUtil::get_time_start($row['date_start']);
$date_time_end =DateTimeUtil::get_time_end($date_time_start,$row['duration_hours'], $row['duration_minutes']);
$date_end = gmdate("Y-m-d", $date_time_end->ts);
$updateQuery = "UPDATE calls set calls.date_end='{$date_end}' where calls.id='{$row['id']}'";
$call = new Call();
$call->db->query($updateQuery);
$row = $callBean->db->fetchByAssoc($result);
}
$meetingBean = new Meeting();
$meetingQuery = "SELECT * FROM meetings where meetings.status != 'Held' and meetings.deleted=0";
//$meetingQuery = "SELECT * FROM meetings where meetings.name like '1' and meetings.deleted=0";
$result = $meetingBean->db->query($meetingQuery, true, "");
$row = $meetingBean->db->fetchByAssoc($result);
while ($row != null) {
$date_time_start =DateTimeUtil::get_time_start($row['date_start']);
$date_time_end =DateTimeUtil::get_time_end($date_time_start,$row['duration_hours'], $row['duration_minutes']);
$date_end = gmdate("Y-m-d", $date_time_end->ts);
$updateQuery = "UPDATE meetings set meetings.date_end='{$date_end}' where meetings.id='{$row['id']}'";
$call = new Call();
$call->db->query($updateQuery);
$row = $callBean->db->fetchByAssoc($result);
}
echo $mod_strings['LBL_DIAGNOSTIC_DONE'];

View File

@@ -0,0 +1,145 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
//Check if current user has admin access
if(is_admin($current_user)) {
global $mod_strings;
//echo out processing message
echo '<br>'.$mod_strings['LBL_REPAIR_FIELD_CASING_PROCESSING'];
//store the affected entries
$database_entries = array();
$module_entries = array();
$query = "SELECT * FROM fields_meta_data";
$result = $GLOBALS['db']->query($query);
while($row = $GLOBALS['db']->fetchByAssoc($result)) {
$name = $row['name'];
$id = $row['id'];
$module_entries[$row['custom_module']] = true;
//Only run database SQL where the name or id casing does is not lowercased
if($name != strtolower($row['name'])) {
$database_entries[$row['custom_module']][$name] = $row;
}
}
//If we have database entries to process
if(!empty($database_entries)) {
foreach($database_entries as $module=>$entries) {
$table_name = strtolower($module) . '_cstm';
foreach($entries as $original_col_name=>$entry) {
echo '<br>'. string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_FIELD_META_DATA'], array($entry['name']));
$update_sql = "UPDATE fields_meta_data SET id = '" . $entry['custom_module'] . strtolower($entry['name']) . "', name = '" . strtolower($entry['name']) . "' WHERE id = '" . $entry['id'] . "'";
$GLOBALS['db']->query($update_sql);
echo '<br>'. string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_CUSTOM_TABLE'], array($entry['name'], $table_name));
if($GLOBALS['db']->dbType == 'mssql') {
$sql = "SP_RENAME '{$table_name}.{$entry['name']}', '" . strtolower($entry['name']) . "', 'COLUMN'";
$GLOBALS['db']->query($sql);
} else if($GLOBALS['db']->dbType == 'mysql') {
$entry['name'] = strtolower($entry['name']);
$GLOBALS['db']->alterColumn($table_name, $entry);
} else if($GLOBALS['db']->dbType == 'oci8') {
$sql = "ALTER TABLE \"" . strtoupper($table_name) ."\" RENAME COLUMN \"" . $entry['name'] . "\" TO \"" . strtolower($entry['name']) . "\"";
$GLOBALS['db']->query($sql);
}
}
}
}
//If we have metadata files to alter
if(!empty($module_entries)) {
$modules = array_keys($module_entries);
$views = array('basic_search', 'advanced_search', 'detailview', 'editview', 'quickcreate');
$class_names = array();
require_once ('include/TemplateHandler/TemplateHandler.php') ;
require_once('modules/ModuleBuilder/parsers/ParserFactory.php');
foreach($modules as $module) {
if(isset($GLOBALS['beanList'][$module])) {
$class_names[] = $GLOBALS['beanList'][$module];
}
$repairClass->module_list[] = $module;
foreach($views as $view) {
$parser = ParserFactory::getParser($view, $module);
if(isset($parser->_viewdefs['panels'])) {
foreach($parser->_viewdefs['panels'] as $panel_id=>$panel) {
foreach($panel as $row_id=>$row) {
foreach($row as $entry_id=>$entry) {
if(is_array($entry) && isset($entry['name'])) {
$parser->_viewdefs['panels'][$panel_id][$row_id][$entry_id]['name'] = strtolower($entry['name']);
}
}
}
}
} else {
//For basic_search and advanced_search views, just process the fields
foreach($parser->_viewdefs as $entry_id=>$entry) {
if(is_array($entry) && isset($entry['name'])) {
$parser->_viewdefs[$entry_id]['name'] = strtolower($entry['name']);
}
}
}
//Save the changes
$parser->handleSave(false);
} //foreach
//Now clear the cache of the .tpl files
TemplateHandler::clearCache($module);
} //foreach
echo '<br>'.$mod_strings['LBL_CLEAR_VARDEFS_DATA_CACHE_TITLE'];
require_once('modules/Administration/QuickRepairAndRebuild.php');
$repair = new RepairAndClear();
$repair->show_output = false;
$repair->module_list = array($class_names);
$repair->clearVardefs();
}
echo '<br>'.$mod_strings['LBL_DIAGNOSTIC_DONE'];
}
?>

View File

@@ -0,0 +1,71 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description:
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
* Reserved. Contributor(s): ______________________________________..
* *******************************************************************************/
$db = DBManagerFactory::getInstance();
$badAccts = array();
$q = "SELECT id, name, email_password FROM inbound_email WHERE deleted=0 AND status='Active'";
$r = $db->query($q);
while($a = $db->fetchByAssoc($r)) {
$ieX = new InboundEmail();
$ieX->retrieve($a['id']);
if(!$ieX->repairAccount()) {
// none of the iterations worked. flag for display
$badAccts[$a['id']] = $a['name'];
}
}
if(empty($badAccts)) {
echo $mod_strings['LBL_REPAIR_IE_SUCCESS'];
} else {
echo "<div class='error'>{$mod_strings['LBL_REPAIR_IE_FAILURE']}</div><br />";
foreach($badAccts as $id => $acctName) {
echo "<a href='index.php?module=InboundEmail&action=EditView&record={$id}' target='_blank'>{$acctName}</a><br />";
}
}
?>

View File

@@ -0,0 +1,252 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
///////////////////////////////////////////////////////////////////////////////
//// LOCAL UTILITY
function compare($table_name, $db_indexes, $var_indexes) {
global $add_index, $drop_index, $change_index;
if(empty($change_index))$change_index = array();
foreach ($var_indexes as $var_i_name=>$var_i_def) {
//find corresponding db index with same name
//else by columns in the index.
$sel_db_index = null;
$var_fields_string ='';
if(count($var_i_def['fields'])>0)
$var_fields_string = implode('',$var_i_def['fields']);
$field_list_match = false;
if(isset($db_indexes[$var_i_name])) {
$sel_db_index = $db_indexes[$var_i_name];
$db_fields_string = implode('', $db_indexes[$var_i_name]['fields']);
if(strcasecmp($var_fields_string, $db_fields_string)==0) {
$field_list_match=true;
}
} else {
//search by column list.
foreach ($db_indexes as $db_i_name=>$db_i_def) {
$db_fields_string=implode('',$db_i_def['fields']);
if(strcasecmp($var_fields_string , $db_fields_string)==0) {
$sel_db_index=$db_indexes[$db_i_name];
$field_list_match=true;
break;
}
}
}
//no matching index in database.
if(empty($sel_db_index)) {
$add_index[]=$GLOBALS['db']->helper->add_drop_constraint($table_name,$var_i_def);
continue;
}
if(!$field_list_match) {
//drop the db index and create new index based on vardef
$drop_index[]=$GLOBALS['db']->helper->add_drop_constraint($table_name,$sel_db_index,true);
$add_index[]=$GLOBALS['db']->helper->add_drop_constraint($table_name,$var_i_def);
continue;
}
//check for name match.
//it should not occur for indexes of type primary or unique.
if( $var_i_def['type'] != 'primary' and $var_i_def['type'] != 'unique' and $var_i_def['name'] != $sel_db_index['name']) {
//rename index.
$rename=$GLOBALS['db']->helper->rename_index($sel_db_index,$var_i_def,$table_name);
if(is_array($rename)) {
$change_index=array_merge($change_index,$rename);
} else {
$change_index[]=$rename;
}
continue;
}
}
}
//// END LOCAL UTILITY
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// PROCESS
if(!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
set_time_limit(3600);
/**
* Note: $_REQUEST['silent'] is set from ModuleInstaller::repair_indices();
*/
if(!isset($_REQUEST['silent'])) $_REQUEST['silent'] = false;
$add_index=array();
$drop_index=array();
$change_index=array();
global $current_user, $beanFiles, $dictionary, $sugar_config, $mod_strings;;
include_once ('include/database/DBManager.php');
$db = &DBManagerFactory::getInstance();
$processed_tables=array();
///////////////////////////////////////////////////////////////////////////////
//// PROCESS MODULE BEANS
(function_exists('logThis')) ? logThis("found ".count($beanFiles)." Beans to process") : "";
(function_exists('logThis')) ? logThis("found ".count($dictionary)." Dictionary entries to process") : "";
foreach ($beanFiles as $beanname=>$beanpath) {
require_once($beanpath);
$focus= new $beanname();
//skips beans based on same tables. user, employee and group are an example.
if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
continue;
} else {
$processed_tables[$focus->table_name]=$focus->table_name;
}
if(!empty($dictionary[$focus->object_name]['indices'])) {
$indices=$dictionary[$focus->object_name]['indices'];
} else {
$indices=array();
}
//clean vardef defintions.. removed indexes not value for this dbtype.
//set index name as the key.
$var_indices=array();
foreach ($indices as $definition) {
//database helpers do not know how to handle full text indices
if ($definition['type']=='fulltext') {
continue;
}
if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
$var_indices[$definition['name']] = $definition;
}
}
$db_indices=$focus->db->helper->get_indices($focus->table_name);
compare($focus->table_name,$db_indices,$var_indices);
}
//// END PROCESS MODULE BEANS
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// PROCESS RELATIONSHIP METADATA - run thru many to many relationship files too...
include('modules/TableDictionary.php');
foreach ($dictionary as $rel=>$rel_def) {
if(!empty($rel_def['indices'])) {
$indices=$rel_def['indices'];
} else {
$indices=array();
}
//clean vardef defintions.. removed indexes not value for this dbtype.
//set index name as the key.
$var_indices=array();
foreach ($indices as $definition) {
if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
$var_indices[$definition['name']] = $definition;
}
}
$db_indices=$focus->db->helper->get_indices($rel_def['table']);
compare($rel_def['table'],$db_indices,$var_indices);
}
//// END PROCESS RELATIONSHIP METADATA
///////////////////////////////////////////////////////////////////////////////
(function_exists('logThis')) ? logThis("RepairIndex: we have ".count($drop_index)." indices to DROP.") : "";
(function_exists('logThis')) ? logThis("RepairIndex: we have ".count($add_index)." indices to ADD.") : "";
(function_exists('logThis')) ? logThis("RepairIndex: we have ".count($change_index)." indices to CHANGE.") : "";
if((count($drop_index) > 0 or count($add_index) > 0 or count($change_index) > 0)) {
if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
}
$focus = new Account();
if(count($drop_index) > 0) {
if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROPPING'];
foreach ($drop_index as $statement) {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
$focus->db->query($statement);
}
} else {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROP'];
foreach ($drop_index as $statement) {
echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
}
}
}
if(count($add_index) > 0) {
if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADDING'];
foreach ($add_index as $statement) {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
$focus->db->query($statement);
}
} else {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADD'];
foreach ($add_index as $statement) {
echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
}
}
}
if(count($change_index) > 0) {
if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTERING'];
foreach ($change_index as $statement) {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
$focus->db->query($statement);
}
} else {
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTER'];
foreach ($change_index as $statement) {
echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
}
}
}
if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
}
} else {
(function_exists('logThis')) ? logThis("RepairIndex: Index definitions are in sync.") : "";
echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_SYNC'];
}

View File

@@ -0,0 +1,98 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(is_admin($current_user)){
global $mod_strings;
//echo out warning message and msgDiv
echo '<br>'.$mod_strings['LBL_REPAIR_JS_FILES_PROCESSING'];
echo'<div id="msgDiv"></div>';
//echo out script that will make an ajax call to process the files via callJSRepair.php
echo "<script>
var ajxProgress;
var showMSG = 'true';
//when called, this function will make ajax call to rebuild/repair js files
function callJSRepair() {
//begin main function that will be called
ajaxCall = function(){
//create success function for callback
success = function() {
//turn off loading message
ajaxStatus.hideStatus();
var targetdiv=document.getElementById('msgDiv');
targetdiv.innerHTML=SUGAR.language.get('Administration', 'LBL_REPAIR_JS_FILES_DONE_PROCESSING');
}//end success
//set loading message and create url
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_PROCESSING_REQUEST'));
postData = \"module=Administration&action=callJSRepair&js_admin_repair=".$_REQUEST['type']."&root_directory=".urlencode(getcwd())."\";
//if this is a call already in progress, then just return
if(typeof ajxProgress != 'undefined'){
return;
}
//make asynchronous call to process js files
var ajxProgress = YAHOO.util.Connect.asyncRequest('POST','index.php', {success: success, failure: success}, postData);
};//end ajaxCall method
//show loading status and make ajax call
// ajaxStatus.hideStatus();
// ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_PROCESSING_REQUEST'));
window.setTimeout('ajaxCall()', 2000);
return;
}
//call function, so it runs automatically
callJSRepair();
</script>";
}
?>

View File

@@ -0,0 +1,86 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $current_user;
if(is_admin($current_user)){
if(count($_POST)){
if(!empty($_POST['activate'])){
$status = '';
if($_POST['activate'] == 'false'){
$status = 'Inactive';
}else{
$status = 'Active';
}
}
$query = "UPDATE users SET status = '$status' WHERE id LIKE 'seed%'";
$GLOBALS['db']->query($query);
}
$query = "SELECT status FROM users WHERE id LIKE 'seed%'";
$result = $GLOBALS['db']->query($query);
$row = $GLOBALS['db']->fetchByAssoc($result, -1, true);
if(!empty($row['status'])){
$activate = 'false';
if($row['status'] == 'Inactive'){
$activate = 'true';
}
?>
<p>
<form name="RepairSeedUsers" method="post" action="index.php">
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="RepairSeedUsers">
<input type="hidden" name="return_module" value="Administration">
<input type="hidden" name="return_action" value="Upgrade">
<input type="hidden" name="activate" value="<?php echo $activate; ?>">
<table cellspacing="{CELLSPACING}" class="otherview">
<tr>
<td scope="row" width="30%"><?php echo $mod_strings['LBL_REPAIR_SEED_USERS_TITLE']; ?></td>
<td><input type="submit" name="button" value="<?php if($row['status'] == 'Inactive'){echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE'];}else{echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE'];} ?>"></td>
</tr>
</table>
</form>
</p>
<?php
}else{
echo 'No seed Users';
}
}
else{
die('Admin Only Section');
}
?>

View File

@@ -0,0 +1,88 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description:
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
* Reserved. Contributor(s): ______________________________________..
*********************************************************************************/
include("include/modules.php"); // provides $moduleList, $beanList, etc.
///////////////////////////////////////////////////////////////////////////////
//// UTILITIES
/**
* Cleans all SugarBean tables of XSS - no asynchronous calls. May take a LONG time to complete.
* Meant to be called from a Scheduler instance or other timed or other automation.
*/
function cleanAllBeans() {
}
//// END UTILITIES
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// PAGE OUTPUT
if(isset($runSilent) && $runSilent == true) {
// if called from Scheduler
cleanAllBeans();
} else {
$hide = array('Activities', 'Home', 'iFrames', 'Calendar', 'Dashboard');
sort($moduleList);
$options = array();
$options[] = $app_strings['LBL_NONE'];
$options['all'] = "--{$app_strings['LBL_TABGROUP_ALL']}--";
foreach($moduleList as $module) {
if(!in_array($module, $hide)) {
$options[$module] = $module;
}
}
$options = get_select_options_with_id($options, '');
$beanDropDown = "<select onchange='SUGAR.Administration.RepairXSS.refreshEstimate(this);' id='repairXssDropdown'>{$options}</select>";
echo get_module_title('Administration', $mod_strings['LBL_REPAIRXSS_TITLE'].":", true);
echo "<script>var done = '{$mod_strings['LBL_DONE']}';</script>";
$smarty = new Sugar_Smarty();
$smarty->assign("mod", $mod_strings);
$smarty->assign("beanDropDown", $beanDropDown);
$smarty->display("modules/Administration/templates/RepairXSS.tpl");
} // end else

View File

@@ -0,0 +1,80 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
$focus = new Administration();
// filter for relevant POST data and update config table
foreach ($_POST as $key => $val) {
$prefix = $focus->get_config_prefix($key);
if (in_array($prefix[0], $focus->config_categories)) {
if ( $prefix[0] == "license" )
{
if ( $prefix[1] == "expire_date" )
{
global $timedate;
$val = $timedate->swap_formats( $val, $timedate->get_date_format(), $timedate->dbDayFormat );
}
else
if ( $prefix[1] == "key" )
{
$val = trim($val); // bug 16860 tyoung - trim whitespace from the start and end of the licence key value
}
}
$focus->saveSetting($prefix[0], $prefix[1], $val);
}
}
header("Location: index.php?action={$_POST['return_action']}&module={$_POST['return_module']}");
?>

View File

@@ -0,0 +1,60 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
require_once('modules/MySettings/TabController.php');
$toDecode = html_entity_decode ($_REQUEST['enabled_tabs'], ENT_QUOTES);
$enabled_tabs = json_decode($toDecode);
$tabs = new TabController();
$tabs->set_system_tabs($enabled_tabs);
$tabs->set_users_can_edit(isset($_REQUEST['user_edit_tabs']) && $_REQUEST['user_edit_tabs'] == 1);
header("Location: index.php?module=Administration&action=ConfigureTabs");
?>

View File

@@ -0,0 +1,263 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $theme;
global $current_user;
global $currentModule;
switch ($_REQUEST['view']) {
case "support_portal":
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
$GLOBALS['log']->info("Administration SupportPortal");
$iframe_url = add_http("www.sugarcrm.com/network/redirect.php?tmpl=network");
$mod_title = $mod_strings['LBL_SUPPORT_TITLE'];
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_title, true);
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('iframeURL', $iframe_url);
echo $sugar_smarty->fetch('modules/Administration/SupportPortal.tpl');
break;
default:
$send_version = isset($_REQUEST['version']) ? $_REQUEST['version'] : "";
$send_edition = isset($_REQUEST['edition']) ? $_REQUEST['edition'] : "";
$send_lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "";
$send_module = isset($_REQUEST['help_module']) ? $_REQUEST['help_module'] : "";
$send_action = isset($_REQUEST['help_action']) ? $_REQUEST['help_action'] : "";
$send_key = isset($_REQUEST['key']) ? $_REQUEST['key'] : "";
$send_anchor = '';
// awu: Fixes the ProjectTasks pluralization issue -- must fix in later versions.
if ($send_module == 'ProjectTasks')
$send_module = 'ProjectTask';
if ($send_module == 'ProductCatalog')
$send_module = 'ProductTemplates';
if ($send_module == 'TargetLists')
$send_module = 'ProspectLists';
if ($send_module == 'Targets')
$send_module = 'Prospects';
$helpPath = 'modules/'.$send_module.'/language/'.$send_lang.'.help.'.$send_action.'.html';
$sugar_smarty = new Sugar_Smarty();
//if the language is english then be sure to skip this check, otherwise go to the support
//portal if the file is not found.
if ($send_lang != 'en_us' && file_exists($helpPath))
{
$sugar_smarty->assign('helpFileExists', TRUE);
$sugar_smarty->assign('helpPath', $helpPath);
$sugar_smarty->assign('helpBar', getHelpBar($send_module));
$sugar_smarty->assign('bookmarkScript', bookmarkJS());
$sugar_smarty->assign('title', $mod_strings['LBL_SUGARCRM_HELP'] . " - " . $send_module);
$sugar_smarty->assign('styleSheet', SugarThemeRegistry::current()->getCSS());
$sugar_smarty->assign('table', getTable());
$sugar_smarty->assign('endtable', endTable());
$sugar_smarty->assign('charset', $app_strings['LBL_CHARSET']);
echo $sugar_smarty->fetch('modules/Administration/SupportPortal.tpl');
} else {
if(empty($send_module)){
$send_module = 'toc';
}
$dev_status = 'GA';
//If there is an alphabetic portion between the decimal prefix and integer suffix, then use the
//value there as the dev_status value
$dev_status = getVersionStatus($GLOBALS['sugar_version']);
$send_version = getMajorMinorVersion($GLOBALS['sugar_version']);
$editionMap = array('ENT' => 'Enterprise', 'PRO' => 'Professional', 'CE' => 'Community_Edition');
if(!empty($editionMap[$send_edition])){
$send_edition = $editionMap[$send_edition];
}
//map certain modules
$sendModuleMap = array(
'administration' => array(
array('name' => 'Administration', 'action' => 'supportportal', 'anchor' => '1910574'),
array('name' => 'Administration', 'action' => 'updater', 'anchor' => '1910574'),
array('name' => 'Administration', 'action' => 'licensesettings', 'anchor' => '1910574'),
array('name' => 'Administration', 'action' => 'diagnostic', 'anchor' => '1111949'),
array('name' => 'Administration', 'action' => 'listviewofflineclient', 'anchor' => '1111949'),
array('name' => 'Administration', 'action' => 'enablewirelessmodules', 'anchor' => '1111949'),
array('name' => 'Administration', 'action' => 'backups', 'anchor' => '1111949'),
array('name' => 'Administration', 'action' => 'upgrade', 'anchor' => '1111949'),
array('name' => 'Administration', 'action' => 'locale', 'anchor' => '1111949'),
array('name' => 'Administration', 'action' => 'themesettings', 'anchor' => '1111949'),
array('name' => 'Administration', 'action' => 'passwordmanager', 'anchor' => '1446494'),
array('name' => 'Administration', 'action' => 'upgradewizard', 'anchor' => '1168410'),
array('name' => 'Administration', 'action' => 'configuretabs', 'anchor' => '1168410'),
array('name' => 'Administration', 'action' => 'configuresubpanels', 'anchor' => '1168410'),
array('name' => 'Administration', 'action' => 'wizard', 'anchor' => '1168410'),
),
'calls' => array(array('name' => 'Activities')),
'tasks' => array(array('name' => 'Activities')),
'meetings' => array(array('name' => 'Activities')),
'notes' => array(array('name' => 'Activities')),
'calendar' => array(array('name' => 'Activities')),
'configurator' => array(array('name' => 'Administration', 'anchor' => '1878359')),
'upgradewizard' => array(array('name' => 'Administration', 'anchor' => '1878359')),
'schedulers' => array(array('name' => 'Administration', 'anchor' => '1878359')),
'sugarfeed' => array(array('name' => 'Administration', 'anchor' => '1878359')),
'connectors' => array(array('name' => 'Administration', 'anchor' => '1878359')),
'trackers' => array(array('name' => 'Administration', 'anchor' => '1878359')),
'currencies' => array(array('name' => 'Administration', 'anchor' => '1878359')),
'aclroles' => array(array('name' => 'Administration', 'anchor' => '1916499')),
'roles' => array(array('name' => 'Administration', 'anchor' => '1916499')),
'teams' => array(array('name' => 'Administration', 'anchor' => '1916499')),
'users' => array(array('name' => 'Administration', 'anchor' => '1916499'), array('name' => 'Administration', 'action' => 'detailview', 'anchor' => '1916518')),
'modulebuilder' => array(array('name' => 'Administration', 'anchor' => '1168410')),
'studio' => array(array('name' => 'Administration', 'anchor' => '1168410')),
'workflow' => array(array('name' => 'Administration', 'anchor' => '1168410')),
'producttemplates' => array(array('name' => 'Administration', 'anchor' => '1957376')),
'productcategories' => array(array('name' => 'Administration', 'anchor' => '1957376')),
'producttypes' => array(array('name' => 'Administration', 'anchor' => '1957376')),
'manufacturers' => array(array('name' => 'Administration', 'anchor' => '1957376')),
'shippers' => array(array('name' => 'Administration', 'anchor' => '1957376')),
'taxrates' => array(array('name' => 'Administration', 'anchor' => '1957376')),
'releases' => array(array('name' => 'Administration', 'anchor' => '1868932')),
'timeperiods' => array(array('name' => 'Administration', 'anchor' => '1957639')),
'contracttypes' => array(array('name' => 'Administration', 'anchor' => '1957677')),
'contracttype' => array(array('name' => 'Administration', 'anchor' => '1957677')),
'emailman' => array(array('name' => 'Administration', 'anchor' => '1445484')),
'inboundemail' => array(array('name' => 'Administration', 'anchor' => '1445484')),
'emailtemplates' => array(array('name' => 'Emails')),
'prospects' => array(array('name' => 'Campaigns')),
'prospectlists' => array(array('name' => 'Campaigns')),
'reportmaker' => array(array('name' => 'Reports')),
'customqueries' => array(array('name' => 'Reports')),
'quotas' => array(array('name' => 'Forecasts')),
'projecttask' => array(array('name' => 'Projects')),
'project' => array(array('name' => 'Projects'), array('name' => 'Dashboard', 'action' => 'dashboard'), ),
'projecttemplate' => array(array('name' => 'Projects')),
'datasets' => array(array('name' => 'Reports')),
'dataformat' => array(array('name' => 'Reports')),
'employees' => array(array('name' => 'Administration', 'anchor' => '1957677')),
'kbdocuments' => array(array('name' => 'Administration', 'action' => 'kbadminview', 'anchor' => '1957677')),
);
if(!empty($sendModuleMap[strtolower($send_module)])){
$mappings = $sendModuleMap[strtolower($send_module)];
foreach($mappings as $map){
if(!empty($map['action'])){
if($map['action'] == strtolower($send_action)){
$send_module = $map['name'];
if(!empty($map['anchor'])){
$send_anchor = $map['anchor'];
}
}
}else{
$send_module = $map['name'];
if(!empty($map['anchor'])){
$send_anchor = $map['anchor'];
}
}
}
//$send_module = $sendModuleMap[strtolower($send_module)];
}
$sendUrl = "http://www.sugarcrm.com/crm/product_doc.php?edition={$send_edition}&version={$send_version}&lang={$send_lang}&module={$send_module}&help_action={$send_action}&status={$dev_status}&key={$send_key}&anchor={$send_anchor}";
if(!empty($send_anchor)){
$sendUrl .= "&anchor=".$send_anchor;
}
$iframe_url = $sendUrl;
header("Location: {$iframe_url}");
//$sugar_smarty->assign('helpFileExists', FALSE);
//$sugar_smarty->assign('iframeURL', $iframe_url);
}
break;
}
function getHelpBar($moduleName)
{
global $mod_strings;
$helpBar = "<table width='100%'><tr><td align='right'>" .
"<a href='javascript:window.print()'>" . $mod_strings['LBL_HELP_PRINT'] . "</a> - " .
"<a href='mailto:?subject=" . $mod_strings['LBL_SUGARCRM_HELP'] . "&body=" . rawurlencode(getCurrentURL()) . "'>" . $mod_strings['LBL_HELP_EMAIL'] . "</a> - " .
"<a href='#' onmousedown=\"createBookmarkLink('" . $mod_strings['LBL_SUGARCRM_HELP'] . " - " . $moduleName . "', '" . getCurrentURL() . "'" .")\">" . $mod_strings['LBL_HELP_BOOKMARK'] . "</a>" .
"</td></tr></table>";
return $helpBar;
}
function getTable()
{
$table = "<table class='tabForm'><tr><td>";
return $table;
}
function endTable()
{
$endtable = "</td></tr></table>";
return $endtable;
}
function bookmarkJS() {
$script =
<<<EOQ
<script type="text/javascript" language="JavaScript">
<!-- Begin
function createBookmarkLink(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}
// End -->
</script>
EOQ;
return $script;
}
?>

View File

@@ -0,0 +1,61 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{if $helpFileExists}
<html>
<head>
<title>{$title}</title>
{$styleSheet}
<meta http-equiv="Content-Type" content="text/html; charset={$charset}">
</head>
<body onLoad='window.focus();'>
{$helpBar}
<table class='edit view'>
<tr>
<td>{include file="$helpPath"}</td>
</tr>
</table>
{$bookmarkScript}
</body>
</html>
{else}
<IFRAME frameborder="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF" SRC="{$iframeURL}" NAME="SUGARIFRAME" ID="SUGARIFRAME" WIDTH="100%" height="1000"></IFRAME>
{/if}

View File

@@ -0,0 +1,101 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<form name="updates" method="POST" action="index.php" >
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="Updater">
<input type="hidden" name="useraction">
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.useraction.value='Save';" type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " > <input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} "></td>
<td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th align="left" scope="row" colspan="2"><h4>{MOD.LBL_UPDATE_TITLE}</h4></th>
</tr>
<tr>
<td colspan=2 ><slot><p>{MOD.HEARTBEAT_MESSAGE}</p></slot></td>
</tr>
<!-- BEGIN: stats -->
<tr>
<td colspan=2 class="checkbox"><input type="checkbox" name='beat' tabindex='4' {SEND_STAT_CHECKED} >{MOD.LBL_SEND_STAT}</td>
</tr><tr>
<td colspan=2>&nbsp;</td>
</tr>
<!-- END: stats -->
<tr>
<td colspan=2 class="checkbox"><input type="checkbox" name='type' tabindex='1' {AUTOMATIC_CHECKED} value="automatic" >{MOD.LBL_UPDATE_CHECK_TYPE}
</td>
</tr><tr>
<td colspan=2>&nbsp;</td>
</tr><tr>
<td colspan=2 style="padding-bottom: 2px;"><input title="{MOD.LBL_CHECK_NOW_TITLE}" onclick="this.form.useraction.value='CheckNow';" type="submit" name="checknow" value=" {MOD.LBL_CHECK_NOW_LABEL} " ><br></td>
</tr>
<!-- BEGIN: updates -->
<tr>
<td scope="row" align='center'>{MOD.LBL_AVAILABLE_UPDATES}</td><td scope="row" > {MOD.LBL_UPDATE_DESCRIPTIONS}</td>
</tr>
<!-- BEGIN: version -->
<tr>
<td scope="row" align='center'>{VERSION.version}</td><td>{VERSION.description}</td>
</tr>
<!-- END: version -->
<!-- END: updates -->
<!-- BEGIN: noupdates -->
<tr>
<td scope="row" >{MOD.LBL_UPTODATE} </td>
</tr>
<!-- END: noupdates -->
</table>
</td></tr>
</table>
</form>
<!-- END: main -->

View File

@@ -0,0 +1,117 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $current_user;
global $sugar_config;
$xtpl=new XTemplate ('modules/Administration/Updater.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
if (isset($_REQUEST['useraction']) && ($_REQUEST['useraction']=='Save' || $_REQUEST['useraction']=='CheckNow')) {
if(!empty($_REQUEST['type']) && $_REQUEST['type'] == 'automatic') {
set_CheckUpdates_config_setting('automatic');
}else{
set_CheckUpdates_config_setting('manual');
}
$beat=false;
if(!empty($_REQUEST['beat'])) {
$beat=true;
}
if ($beat != get_sugarbeat()) {
set_sugarbeat($beat);
}
}
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CONFIGURE_UPDATER'], true);
if (get_sugarbeat()) $xtpl->assign("SEND_STAT_CHECKED", "checked");
if (get_CheckUpdates_config_setting()=='automatic') {
$xtpl->assign("AUTOMATIC_CHECKED", "checked");
}
if (isset($_REQUEST['useraction']) && $_REQUEST['useraction']=='CheckNow') {
check_now(get_sugarbeat());
loadLicense();
}
$xtpl->parse('main.stats');
$has_updates= false;
if(!empty($license->settings['license_latest_versions'])){
$encodedVersions = $license->settings['license_latest_versions'];
$versions = unserialize(base64_decode( $encodedVersions));
include('sugar_version.php');
if(!empty($versions)){
foreach($versions as $version){
if($version['version'] > $sugar_version )
{
$has_updates = true;
$xtpl->assign("VERSION", $version);
$xtpl->parse('main.updates.version');
}
}
}
if(!$has_updates){
$xtpl->parse('main.noupdates');
}else{
$xtpl->parse('main.updates');
}
}
//return module and index.
$xtpl->assign("RETURN_MODULE", "Administration");
$xtpl->assign("RETURN_ACTION", "index");
$xtpl->parse("main");
$xtpl->out("main");
?>

View File

@@ -0,0 +1,143 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $currentModule;
global $gridline;
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_UPGRADE_TITLE'], true);
$str1="";
if ($GLOBALS['db']->dbType=='oci8') {
$str1='<tr><td scope="row">';
$str1.=SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_REPAIR_ORACLE_FULLTEXT'].'" align="absmiddle" border="0"');
$str1.='&nbsp;<a href="./index.php?module=Administration&action=RebuildFulltextIndices">' . $mod_strings['LBL_REPAIR_ORACLE_FULLTEXT'] .'</a></td>';
$str1.='<td>' .$mod_strings['LBL_REPAIR_ORACLE_FULLTEXT_DESC'] . '</td></tr>';
}
?>
<p>
<table class="other view">
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_QUICK_REPAIR_AND_REBUILD'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=repair"><?php echo $mod_strings['LBL_QUICK_REPAIR_AND_REBUILD']; ?></a></td>
<td> <?php echo $mod_strings['LBL_QUICK_REPAIR_AND_REBUILD_DESC'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_EXPAND_DATABASE_COLUMNS'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=expandDatabase"><?php echo $mod_strings['LBL_EXPAND_DATABASE_COLUMNS']; ?></a></td>
<td> <?php echo $mod_strings['LBL_EXPAND_DATABASE_COLUMNS_DESC'] ; ?> </td>
</tr>
<tr>
<?php
$server_software = $_SERVER["SERVER_SOFTWARE"];
if(strpos($server_software,'Microsoft-IIS') === false) {
?>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_HTACCESS'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=UpgradeAccess"><?php echo $mod_strings['LBL_REBUILD_HTACCESS']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_HTACCESS_DESC'] ; ?> </td>
<?php
} else {
?>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_WEBCONFIG'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=UpgradeIISAccess"><?php echo $mod_strings['LBL_REBUILD_WEBCONFIG']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_WEBCONFIG_DESC'] ; ?> </td>
<?php
}
?>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_CONFIG'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RebuildConfig"><?php echo $mod_strings['LBL_REBUILD_CONFIG']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_CONFIG_DESC'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_REL_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RebuildRelationship"><?php echo $mod_strings['LBL_REBUILD_REL_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_REL_DESC'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_SCHEDULERS_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RebuildSchedulers"><?php echo $mod_strings['LBL_REBUILD_SCHEDULERS_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_SCHEDULERS_DESC_SHORT'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_DASHLETS_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RebuildDashlets"><?php echo $mod_strings['LBL_REBUILD_DASHLETS_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_DASHLETS_DESC_SHORT'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_JAVASCRIPT_LANG_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RebuildJSLang"><?php echo $mod_strings['LBL_REBUILD_JAVASCRIPT_LANG_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_JAVASCRIPT_LANG_DESC_SHORT'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_JS_FILES_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairJSFile&type=replace" onclick="return confirm('<?php echo $mod_strings['WARN_POSSIBLE_JS_OVERWRITE']; ?>');"><?php echo $mod_strings['LBL_REBUILD_JS_FILES_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_JS_FILES_DESC_SHORT'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_CONCAT_JS_FILES_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairJSFile&type=concat" ><?php echo $mod_strings['LBL_REBUILD_CONCAT_JS_FILES_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_CONCAT_JS_FILES_DESC_SHORT'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Rebuild','alt="'. $mod_strings['LBL_REBUILD_JS_MINI_FILES_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairJSFile&type=mini" onclick="return confirm('<?php echo $mod_strings['WARN_POSSIBLE_JS_OVERWRITE']; ?>');"><?php echo $mod_strings['LBL_REBUILD_JS_MINI_FILES_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REBUILD_JS_MINI_FILES_DESC_SHORT'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_REPAIR_JS_FILES_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairJSFile&type=repair"><?php echo $mod_strings['LBL_REPAIR_JS_FILES_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REPAIR_JS_FILES_DESC_SHORT'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_REPAIR_FIELD_CASING_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairFieldCasing&type=repair"><?php echo $mod_strings['LBL_REPAIR_FIELD_CASING_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REPAIR_FIELD_CASING_DESC_SHORT'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_REPAIR_ROLES'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=ACL&action=install_actions"><?php echo $mod_strings['LBL_REPAIR_ROLES']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REPAIR_ROLES_DESC'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_REPAIR_IE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairIE"><?php echo $mod_strings['LBL_REPAIR_IE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REPAIR_IE_DESC'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_REPAIR_XSS'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairXSS"><?php echo $mod_strings['LBL_REPAIR_XSS']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REPAIRXSS_TITLE'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_REPAIR_ACTIVITIES'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairActivities"><?php echo $mod_strings['LBL_REPAIR_ACTIVITIES']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REPAIR_ACTIVITIES_DESC'] ; ?> </td>
</tr>
<tr>
<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('Repair','alt="'. $mod_strings['LBL_REPAIR_SEED_USERS_TITLE'].'" align="absmiddle" border="0"'); ?>&nbsp;<a href="./index.php?module=Administration&action=RepairSeedUsers"><?php echo $mod_strings['LBL_REPAIR_SEED_USERS_TITLE']; ?></a></td>
<td> <?php echo $mod_strings['LBL_REPAIR_SEED_USERS_DESC'] ; ?> </td>
</tr>
</table></p>

View File

@@ -0,0 +1,150 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $mod_strings;
global $sugar_config;
$ignoreCase = (substr_count(strtolower($_SERVER['SERVER_SOFTWARE']), 'apache/2') > 0)?'(?i)':'';
$htaccess_file = getcwd() . "/.htaccess";
$contents = '';
$restrict_str = <<<EOQ
# BEGIN SUGARCRM RESTRICTIONS
RedirectMatch 403 {$ignoreCase}.*\.log$
RedirectMatch 403 {$ignoreCase}/+not_imported_.*\.txt
RedirectMatch 403 {$ignoreCase}/+(soap|cache|xtemplate|data|examples|include|log4php|metadata|modules)/+.*\.(php|tpl)
RedirectMatch 403 {$ignoreCase}/+emailmandelivery\.php
RedirectMatch 403 {$ignoreCase}/+cache/+upload
RedirectMatch 403 {$ignoreCase}/+cache/+diagnostic
RedirectMatch 403 {$ignoreCase}/+files\.md5$
# END SUGARCRM RESTRICTIONS
EOQ;
if(file_exists($htaccess_file)){
$fp = fopen($htaccess_file, 'r');
$skip = false;
while($line = fgets($fp)){
if(preg_match("/\s*#\s*BEGIN\s*SUGARCRM\s*RESTRICTIONS/i", $line))$skip = true;
if(!$skip)$contents .= $line;
if(preg_match("/\s*#\s*END\s*SUGARCRM\s*RESTRICTIONS/i", $line))$skip = false;
}
}
$status = file_put_contents($htaccess_file, $contents . $restrict_str);
if( !$status ){
echo '<p>' . $mod_strings['LBL_HT_NO_WRITE'] . '<span class=stop>$htaccess_file</span></p>\n';
echo '<p>' . $mod_strings['LBL_HT_NO_WRITE_2'] . '</p>\n';
echo "$redirect_str";
}
// cn: bug 9365 - security for filesystem
$uploadDir='';
$uploadHta='';
if (empty($GLOBALS['sugar_config']['upload_dir'])) {
$GLOBALS['sugar_config']['upload_dir']='cache/upload/';
}
$uploadDir = getcwd()."/".$sugar_config['upload_dir'];
if(file_exists($uploadDir)){
$uploadHta = $uploadDir.".htaccess";
}
else{
mkdir_recursive($uploadDir);
if(is_dir($uploadDir)){
$uploadHta = $uploadDir.".htaccess";
}
}
$denyAll =<<<eoq
<Directory>
Order Deny,Allow
Deny from all
</Directory>
eoq;
if(file_exists($uploadHta) && filesize($uploadHta)) {
// file exists, parse to make sure it is current
if(is_writable($uploadHta) && ($fpUploadHta = @sugar_fopen($uploadHta, "r+"))) {
$oldHtaccess = fread($fpUploadHta, filesize($uploadHta));
// use a different regex boundary b/c .htaccess uses the typicals
if(!preg_match("=".$denyAll."=", $oldHtaccess)) {
$oldHtaccess .= $denyAll;
}
rewind($fpUploadHta);
fwrite($fpUploadHta, $oldHtaccess);
ftruncate($fpUploadHta, ftell($fpUploadHta));
fclose($fpUploadHta);
} else {
$htaccess_failed = true;
}
} else {
// no .htaccess yet, create a fill
if($fpUploadHta = @sugar_fopen($uploadHta, "w")) {
fputs($fpUploadHta, $denyAll);
fclose($fpUploadHta);
} else {
$htaccess_failed = true;
}
}
include('modules/Versions/ExpectedVersions.php');
global $expect_versions;
if (isset($expect_versions['htaccess'])) {
$version = new Version();
$version->retrieve_by_string_fields(array('name'=>'htaccess'));
$version->name = $expect_versions['htaccess']['name'];
$version->file_version = $expect_versions['htaccess']['file_version'];
$version->db_version = $expect_versions['htaccess']['db_version'];
$version->save();
}
/* Commenting out as this shows on upgrade screen
* echo "\n" . $mod_strings['LBL_HT_DONE']. "<br />\n";
*/
?>

View File

@@ -0,0 +1,153 @@
<?php
if(!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once ('modules/DynamicFields/DynamicField.php');
require_once ('modules/DynamicFields/FieldCases.php');
global $db;
if (!isset ($db)) {
$db = DBManagerFactory:: getInstance();
}
global $dbManager;
if (!isset ($dbManager)) {
$dbManager = DBManagerFactory::getInstance();
}
$result = $db->query('SELECT * FROM fields_meta_data WHERE deleted = 0 ORDER BY custom_module');
$modules = array ();
/*
* get the real field_meta_data
*/
while ($row = $db->fetchByAssoc($result)) {
$the_modules = $row['custom_module'];
if (!isset ($modules[$the_modules])) {
$modules[$the_modules] = array ();
}
$modules[$the_modules][$row['name']] = $row['name'];
}
$simulate = false;
if (!isset ($_REQUEST['run'])) {
$simulate = true;
echo "SIMULATION MODE - NO CHANGES WILL BE MADE EXCEPT CLEARING CACHE";
}
foreach ($modules as $the_module => $fields) {
$class_name = $beanList[$the_module];
echo "<br><br>Scanning $the_module <br>";
require_once ($beanFiles[$class_name]);
$mod = new $class_name ();
if (!$db->tableExists($mod->table_name."_cstm")) {
$mod->custom_fields = new DynamicField();
$mod->custom_fields->setup($mod);
$mod->custom_fields->createCustomTable();
}
if ($db->dbType == 'oci8') {
} elseif ($db->dbType == 'mssql') {
$def_query="SELECT col.name as field, col_type.name as type, col.is_nullable, col.precision as data_precision, col.max_length as data_length, col.scale data_scale";
$def_query.=" FROM sys.columns col";
$def_query.=" join sys.types col_type on col.user_type_id=col_type.user_type_id ";
$def_query.=" where col.object_id = (select object_id(sys.schemas.name + '.' + sys.tables.name)";
$def_query.=" from sys.tables join sys.schemas on sys.schemas.schema_id = sys.tables.schema_id";
$def_query.=" where sys.tables.name='".$mod->table_name."_cstm')";
$result = $db->query($def_query);
}
else {
$result = $db->query("DESCRIBE $mod->table_name"."_cstm");
}
while ($row = $db->fetchByAssoc($result)) {
$col = strtolower(empty ($row['Field']) ? $row['field'] : $row['Field']);
$the_field = $mod->custom_fields->getField($col);
$type = strtolower(empty ($row['Type']) ? $row['type'] : $row['Type']);
if ($db->dbType == 'oci8' or $db->dbType == 'mssql') {
if ($row['data_precision']!= '' and $row['data_scale']!='') {
$type.='(' . $row['data_precision'];
if (!empty($row['data_scale'])) {
$type.=',' . $row['data_scale'];
}
$type.=')';
} else {
if ($row['data_length']!= '' && (strtolower($row['type'])=='varchar' or strtolower($row['type'])=='varchar2')) {
$type.='(' . $row['data_length'] . ')';
}
}
}
if (!isset ($fields[$col]) && $col != 'id_c') {
if (!$simulate) {
$db->query("ALTER TABLE $mod->table_name"."_cstm DROP COLUMN $col");
}
unset ($fields[$col]);
echo "Dropping Column $col from $mod->table_name"."_cstm for module $the_module<br>";
} else {
if ($col != 'id_c') {
//$db_data_type = $dbManager->helper->getColumnType(strtolower($the_field->data_type));
$db_data_type = strtolower(str_replace(' ' , '', $the_field->get_db_type()));
$type = strtolower(str_replace(' ' , '', $type));
if (strcmp($db_data_type,$type) != 0) {
echo "Fixing Column Type for $col changing $type to ".$db_data_type."<br>";
if (!$simulate) {
$db->query($the_field->get_db_modify_alter_table($mod->table_name.'_cstm'));
}
}
}
unset ($fields[$col]);
}
}
echo sizeof($fields)." field(s) missing from $mod->table_name"."_cstm<br>";
foreach ($fields as $field) {
echo "Adding Column $field to $mod->table_name"."_cstm<br>";
if (!$simulate)
$mod->custom_fields->add_existing_custom_field($field);
}
}
DynamicField :: deleteCache();
echo '<br>Done<br>';
if ($simulate) {
echo '<a href="index.php?module=Administration&action=UpgradeFields&run=true">Execute non-simulation mode</a>';
}
?>

View File

@@ -0,0 +1,286 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
// The history of upgrades on the system
class UpgradeHistory extends SugarBean
{
var $new_schema = true;
var $module_dir = 'Administration';
// Stored fields
var $id;
var $filename;
var $md5sum;
var $type;
var $version;
var $status;
var $date_entered;
var $name;
var $description;
var $id_name;
var $manifest;
var $enabled;
var $table_name = "upgrade_history";
var $object_name = "UpgradeHistory";
var $column_fields = Array( "id", "filename", "md5sum", "type", "version", "status", "date_entered" );
function delete()
{
$this->dbManager->query( "delete from " . $this->table_name . " where id = '" . $this->id . "'" );
}
function UpgradeHistory()
{
parent::SugarBean();
$this->disable_row_level_security = true;
}
function getAllOrderBy($orderBy){
$query = "SELECT id FROM " . $this->table_name . " ORDER BY ".$orderBy;
return $this->getList($query);
}
/**
* Given a name check if it exists in the table
* @param name the unique key from the manifest
* @param id the id of the item you are comparing to
* @return upgrade_history object if found, null otherwise
*/
function checkForExisting($patch_to_check){
$uh = new UpgradeHistory();
if($patch_to_check != null){
if(empty($patch_to_check->id_name)){
$where = " WHERE name = '$patch_to_check->name' ";
}else{
$where = " WHERE id_name = '$patch_to_check->id_name' ";
}
if(!empty($patch_to_check->id)){
$where .= " AND id != '$patch_to_check->id' ";
}else{
$where .= " AND id is not null ";
}
$query = "SELECT id FROM " . $this->table_name . " ". $where;
$result = $uh->db->query($query);
if(empty($result)){
return null;
}
$row = $uh->db->fetchByAssoc($result);
if(empty($row)){
return null;
}
if(!empty($row['id'])){
return $uh->retrieve($row['id']);
}
}
return null;
}
/**
* Check if this is an upgrade, if it is then return the latest version before this installation
*/
function determineIfUpgrade($id_name, $version){
$query = "SELECT id, version FROM " . $this->table_name . " WHERE id_name = '$id_name' ORDER BY date_entered DESC";
$result = $this->db->query($query);
if(empty($result)){
return null;
}else{
$temp_version = 0;
$id = '';
while($row = $this->db->fetchByAssoc($result))
{
if(!$this->is_right_version_greater(explode('.', $row['version']), explode('.', $temp_version))){
$temp_version = $row['version'];
$id = $row['id'];
}
}//end while
if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false))
return array('id' => $id, 'version' => $temp_version);
else
return null;
}
}
function getAll()
{
$query = "SELECT id FROM " . $this->table_name . " ORDER BY date_entered desc";
return $this->getList($query);
}
function getList($query){
return( parent::build_related_list( $query, $this ) );
}
function findByMd5( $var_md5 )
{
$query = "SELECT id FROM " . $this->table_name . " where md5sum = '$var_md5'";
return( parent::build_related_list( $query, $this ) );
}
function UninstallAvailable($patch_list, $patch_to_check)
{
//before we even go through the list, let us try to see if we find a match.
$history_object = $this->checkForExisting($patch_to_check);
if($history_object != null){
if((!empty($history_object->id_name) && !empty($patch_to_check->id_name) && strcmp($history_object->id_name, $patch_to_check->id_name) == 0) || strcmp($history_object->name, $patch_to_check->name) == 0){
//we have found a match
//if the patch_to_check version is greater than the found version
return ($this->is_right_version_greater(explode('.', $history_object->version), explode('.', $patch_to_check->version)));
}else{
return true;
}
}
//we will only go through this loop if we have not found another UpgradeHistory object
//with a matching unique_key in the database
foreach($patch_list as $more_recent_patch)
{
if($more_recent_patch->id == $patch_to_check->id)
break;
//we will only resort to checking the files if we cannot find the unique_keys
//or the unique_keys do not match
$patch_to_check_backup_path = clean_path(remove_file_extension(from_html($patch_to_check->filename))).'-restore';
$more_recent_patch_backup_path = clean_path(remove_file_extension(from_html($more_recent_patch->filename))).'-restore';
if($this->foundConflict($patch_to_check_backup_path, $more_recent_patch_backup_path) &&
($more_recent_patch->date_entered >= $patch_to_check->date_entered)){
return false;
}
}
return true;
}
function foundConflict($check_path, $recent_path)
{
if(is_file($check_path))
{
if(file_exists($recent_path))
return true;
else
return false;
}
elseif(is_dir($check_path))
{
$status = false;
$d = dir( $check_path );
while( $f = $d->read() )
{
if( $f == "." || $f == ".." )
continue;
$status = $this->foundConflict("$check_path/$f", "$recent_path/$f");
if($status)
break;
}
$d->close();
return( $status );
}
return false;
}
/**
* Given a left version and a right version, determine if the right hand side is greater
*
* @param left the client sugar version
* @param right the server version
*
* return true if the right version is greater or they are equal
* false if the left version is greater
*/
function is_right_version_greater($left, $right, $equals_is_greater = true){
if(count($left) == 0 && count($right) == 0){
return $equals_is_greater;
}
else if(count($left) == 0 || count($right) == 0){
return true;
}
else if($left[0] == $right[0]){
array_shift($left);
array_shift($right);
return $this->is_right_version_greater($left, $right, $equals_is_greater);
}
else if($left[0] < $right[0]){
return true;
}
else
return false;
}
/**
* Given an array of id_names and versions, check if the dependencies are installed
*
* @param dependencies an array of id_name, version to check if these dependencies are installed
* on the system
*
* @return not_found an array of id_names that were not found to be installed on the system
*/
function checkDependencies($dependencies = array()){
$not_found = array();
foreach($dependencies as $dependent){
$found = false;
$query = "SELECT id FROM $this->table_name WHERE id_name = '".$dependent['id_name']."'";
$matches = $this->getList($query);
if(0 != sizeof($matches)){
foreach($matches as $match){
if($this->is_right_version_greater(explode('.', $match->version), explode('.', $dependent['version']))){
$found = true;
break;
}//fi
}//rof
}//fi
if(!$found){
$not_found[] = $dependent['id_name'];
}//fi
}//rof
return $not_found;
}
function retrieve($id = -1, $encode=true,$deleted=true) {
return parent::retrieve($id,$encode,false); //ignore the deleted filter. the table does not have the deleted column in it.
}
}
?>

View File

@@ -0,0 +1,42 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('install/install_utils.php');
handleWebConfig();

View File

@@ -0,0 +1,366 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(!is_admin($GLOBALS['current_user'])){
sugar_die('Admin Only Section');
}
require_once('modules/Administration/UpgradeWizardCommon.php');
require_once('ModuleInstall/PackageManager/PackageManagerDisplay.php');
require_once('ModuleInstall/ModuleScanner.php');
global $mod_strings;
$uh = new UpgradeHistory();
function unlinkTempFiles() {
global $sugar_config;
@unlink($_FILES['upgrade_zip']['tmp_name']);
@unlink(getAbsolutePath($sugar_config['upload_dir'].$_FILES['upgrade_zip']['name'],true));
}
// make sure dirs exist
foreach( $GLOBALS['subdirs'] as $subdir ){
mkdir_recursive( "$base_upgrade_dir/$subdir" );
}
// get labels and text that are specific to either Module Loader or Upgrade Wizard
if( $view == "module") {
$uploaddLabel = $mod_strings['LBL_UW_UPLOAD_MODULE'];
$descItemsQueued = $mod_strings['LBL_UW_DESC_MODULES_QUEUED'];
$descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
}
else {
$uploaddLabel = $mod_strings['LBL_UPLOAD_UPGRADE'];
$descItemsQueued = $mod_strings['DESC_FILES_QUEUED'];
$descItemsInstalled = $mod_strings['DESC_FILES_INSTALLED'];
}
//
// check that the upload limit is set to 6M or greater
//
define('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES', 6 * 1024 * 1024); // 6 Megabytes
$upload_max_filesize = ini_get('upload_max_filesize');
$upload_max_filesize_bytes = return_bytes($upload_max_filesize);
if($upload_max_filesize_bytes < constant('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES'))
{
$GLOBALS['log']->debug("detected upload_max_filesize: $upload_max_filesize");
print('<p class="error">' . $mod_strings['MSG_INCREASE_UPLOAD_MAX_FILESIZE'] . ' '
. get_cfg_var('cfg_file_path') . "</p>\n");
}
//
// process "run" commands
//
if( isset( $_REQUEST['run'] ) && ($_REQUEST['run'] != "") ){
$run = $_REQUEST['run'];
if( $run == "upload" ){
$perform = false;
if(isset($_REQUEST['release_id']) && $_REQUEST['release_id'] != ""){
require_once('ModuleInstall/PackageManager.php');
$pm = new PackageManager();
$tempFile = $pm->download('','',$_REQUEST['release_id'], getAbsolutePath($sugar_config['upload_dir'],true));
$perform = true;
$base_filename = urldecode($tempFile);
}
elseif(!empty($_REQUEST['load_module_from_dir'])){
//copy file to proper location then call performSetup
$tempFile = getAbsolutePath($sugar_config['upload_dir'].$_REQUEST['upgrade_zip_escaped'],true);
copy($_REQUEST['load_module_from_dir'].'/'.$_REQUEST['upgrade_zip_escaped'], $tempFile);
$perform = true;
$base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] );
}else if( empty( $_FILES['upgrade_zip']['tmp_name'] ) ){
echo $mod_strings['ERR_UW_NO_UPLOAD_FILE'];
}
else{
$ext = end(explode(".", $_FILES['upgrade_zip']['name']));
if($ext === $_FILES['upgrade_zip']['name'] || $ext != 'zip' || !move_uploaded_file($_FILES['upgrade_zip']['tmp_name'], getAbsolutePath($sugar_config['upload_dir'].$_FILES['upgrade_zip']['name'],true))) {
unlinkTempFiles();
sugar_die("Invalid Package");
} else {
$tempFile = getAbsolutePath($sugar_config['upload_dir'].$_FILES['upgrade_zip']['name'],true);
$perform = true;
$base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] );
}
}
if($perform){
$manifest_file = extractManifest( $tempFile );
if(is_file($manifest_file))
{
//SCAN THE MANIFEST FILE TO MAKE SURE NO COPIES OR ANYTHING ARE HAPPENING IN IT
$ms = new ModuleScanner();
$fileIssues = $ms->scanFile($manifest_file);
if(!empty($fileIssues)){
echo '<h2>' . $mod_strings['ML_MANIFEST_ISSUE'] . '</h2><br>';
$ms->displayIssues();
die();
}
require_once( $manifest_file );
validate_manifest( $manifest );
$upgrade_zip_type = $manifest['type'];
// exclude the bad permutations
if( $view == "module" )
{
if ($upgrade_zip_type != "module" && $upgrade_zip_type != "theme" && $upgrade_zip_type != "langpack")
{
unlinkTempFiles();
die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']);
}
}
elseif( $view == "default" )
{
if($upgrade_zip_type != "patch" )
{
unlinkTempFiles();
die($mod_strings['ERR_UW_ONLY_PATCHES']);
}
}
//$base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] );
$base_filename = preg_replace( "#\\\\#", "/", $base_filename );
$base_filename = basename( $base_filename );
mkdir_recursive( "$base_upgrade_dir/$upgrade_zip_type" );
$target_path = "$base_upgrade_dir/$upgrade_zip_type/$base_filename";
$target_manifest = remove_file_extension( $target_path ) . "-manifest.php";
if( isset($manifest['icon']) && $manifest['icon'] != "" ){
$icon_location = extractFile( $tempFile ,$manifest['icon'] );
$path_parts = pathinfo( $icon_location );
copy( $icon_location, remove_file_extension( $target_path ) . "-icon." . $path_parts['extension'] );
}
if( copy( $tempFile , $target_path ) ){
copy( $manifest_file, $target_manifest );
$GLOBALS['ML_STATUS_MESSAGE'] = $base_filename.$mod_strings['LBL_UW_UPLOAD_SUCCESS'];
}
else{
$GLOBALS['ML_STATUS_MESSAGE'] = $mod_strings['ERR_UW_UPLOAD_ERROR'];
}
}
else
{
unlinkTempFiles();
die($mod_strings['ERR_UW_NO_MANIFEST']);
}
}
}
else if( $run == $mod_strings['LBL_UW_BTN_DELETE_PACKAGE'] ){
if(!empty ($_REQUEST['install_file']) ){
die($mod_strings['ERR_UW_NO_UPLOAD_FILE']);
}
$delete_me = hashToFile($delete_me);
$checkFile = clean_path(trim(strtolower($delete_me)));
if(false !== strpos($checkFile, '.zip')) { // is zip file?
if(false !== strpos($checkFile, $sugar_config['upload_dir'])) { // is in upload dir?
if(false === strpos($checkFile, "..")) { // no dir navigation
if(!file_exists($checkFile)) { // file exists?
if(unlink($delete_me)) { // successful deletion?
echo "Package $delete_me has been removed.<br>";
} else {
die("Problem removing package $delete_me.");
}
} else {
die("<span class='error'>File to be deleted does not exist.</span>");
}
} else {
die("<span class='error'>Path is trying to navigate folders.</span>");
}
} else {
die("<span class='error'>File is not located in SugarCRM's upload cache directory.</span>");
}
} else {
die("<span class='error'>File is not a zipped archive.</span>");
}
}
}
if( $view == "module") {
print( get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_LOADER_TITLE'], true) );
}
else {
print( get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'].": ".$mod_strings['LBL_UPGRADE_WIZARD_TITLE'], true) );
}
// upload link
if(!empty($GLOBALS['sugar_config']['use_common_ml_dir']) && $GLOBALS['sugar_config']['use_common_ml_dir'] && !empty($GLOBALS['sugar_config']['common_ml_dir'])){
//rrs
$form = '<form name="move_form" action="index.php?module=Administration&view=module&action=UpgradeWizard" method="post" ><input type=hidden name="run" value="upload" /><input type=hidden name="load_module_from_dir" id="load_module_from_dir" value="'.$GLOBALS['sugar_config']['common_ml_dir'].'" /><input type=hidden name="upgrade_zip_escaped" value="" />';
$form .= '<br>'.$mod_strings['LBL_MODULE_UPLOAD_DISABLE_HELP_TEXT'].'</br>';
$form .='<table width="100%" class="edit view"><tr><th align="left">'.$mod_strings['LBL_ML_NAME'].'</th><th align="left">'.$mod_strings['LBL_ML_ACTION'].'</th></tr>';
if ($handle = opendir($GLOBALS['sugar_config']['common_ml_dir'])) {
while (false !== ($filename = readdir($handle))) {
if($filename == '.' || $filename == '..' || !preg_match("#.*\.zip\$#", $filename)) {
continue;
}
$form .= '<tr><td>'.$filename.'</td><td><input type=button class="button" value="'.$mod_strings['LBL_UW_BTN_UPLOAD'].'" onClick="document.move_form.upgrade_zip_escaped.value = escape( \''.$filename.'\');document.move_form.submit();" /></td></tr>';
}
}
$form .= '</table></form>';
//rrs
}else{
$form =<<<eoq
<form name="the_form" enctype="multipart/form-data" action="{$form_action}" method="post" >
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr><td>
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr><td style="white-space:nowrap; padding-right: 10px !important;">
{$uploaddLabel}
<input type="file" name="upgrade_zip" size="40" />
</td>
<td>
<input type=button class="button" value="{$mod_strings['LBL_UW_BTN_UPLOAD']}" onClick="document.the_form.upgrade_zip_escaped.value = escape( document.the_form.upgrade_zip.value );document.the_form.submit();" />
<input type=hidden name="run" value="upload" />
<input type=hidden name="upgrade_zip_escaped" value="" />
</td>
</tr>
</table></td></tr></table>
</form>
eoq;
}
$hidden_fields = "<input type=hidden name=\"run\" value=\"upload\" />";
$hidden_fields .= "<input type=hidden name=\"mode\"/>";
$form2 = PackageManagerDisplay::buildPackageDisplay($form, $hidden_fields, $form_action, array('module'));
$form3 =<<<eoq3
eoq3;
echo $form2.$form3;
// scan for new files (that are not installed)
/*print( "$descItemsQueued<br>\n");
print( "<ul>\n" );
$upgrade_contents = findAllFiles( "$base_upgrade_dir", array() );
$upgrades_available = 0;
print( "<table>\n" );
print( "<tr><th></th><th align=left>{$mod_strings['LBL_ML_NAME']}</th><th>{$mod_strings['LBL_ML_TYPE']}</th><th>{$mod_strings['LBL_ML_VERSION']}</th><th>{$mod_strings['LBL_ML_PUBLISHED']}</th><th>{$mod_strings['LBL_ML_UNINSTALLABLE']}</th><th>{$mod_strings['LBL_ML_DESCRIPTION']}</th></tr>\n" );
foreach($upgrade_contents as $upgrade_content)
{
if(!preg_match("#.*\.zip\$#", $upgrade_content))
{
continue;
}
$upgrade_content = clean_path($upgrade_content);
$the_base = basename($upgrade_content);
$the_md5 = md5_file($upgrade_content);
$md5_matches = $uh->findByMd5($the_md5);
if(0 == sizeof($md5_matches))
{
$target_manifest = remove_file_extension( $upgrade_content ) . '-manifest.php';
require_once($target_manifest);
$name = empty($manifest['name']) ? $upgrade_content : $manifest['name'];
$version = empty($manifest['version']) ? '' : $manifest['version'];
$published_date = empty($manifest['published_date']) ? '' : $manifest['published_date'];
$icon = '';
$description = empty($manifest['description']) ? 'None' : $manifest['description'];
$uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes';
$type = getUITextForType( $manifest['type'] );
$manifest_type = $manifest['type'];
if($view == 'default' && $manifest_type != 'patch')
{
continue;
}
if($view == 'module'
&& $manifest_type != 'module' && $manifest_type != 'theme' && $manifest_type != 'langpack')
{
continue;
}
if(empty($manifest['icon']))
{
$icon = getImageForType( $manifest['type'] );
}
else
{
$path_parts = pathinfo( $manifest['icon'] );
$icon = "<img src=\"" . remove_file_extension( $upgrade_content ) . "-icon." . $path_parts['extension'] . "\">";
}
$upgrades_available++;
print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$published_date</td><td>$uninstallable</td><td>$description</td>\n" );
$upgrade_content = urlencode($upgrade_content);
$form2 =<<<eoq
<form action="{$form_action}_prepare" method="post">
<td><input type=submit name="btn_mode" onclick="this.form.mode.value='Install';this.form.submit();" value="{$mod_strings['LBL_UW_BTN_INSTALL']}" /></td>
<input type=hidden name="install_file" value="{$upgrade_content}" />
<input type=hidden name="mode"/>
</form>
<form action="{$form_action}" method="post">
<td><input type=submit name="run" value="{$mod_strings['LBL_UW_BTN_DELETE_PACKAGE']}" /></td>
<input type=hidden name="install_file" value="{$upgrade_content}" />
</form>
</tr>
eoq;
echo $form2;
}
}
print( "</table>\n" );
if( $upgrades_available == 0 ){
print($mod_strings['LBL_UW_NONE']);
}
print( "</ul>\n" );
?>
*/
$GLOBALS['log']->info( "Upgrade Wizard view");
?>
</td>
</tr>
</table></td></tr></table>

View File

@@ -0,0 +1,261 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/utils/db_utils.php');
require_once('include/utils/zip_utils.php');
// increase the cuttoff time to 1 hour
ini_set("max_execution_time", "3600");
if( isset( $_REQUEST['view'] ) && ($_REQUEST['view'] != "") ){
$view = $_REQUEST['view'];
if( $view != "default" && $view != "module" ){
die($mod_strings['ERR_UW_INVALID_VIEW']);
}
}
else{
die($mod_strings['ERR_UW_NO_VIEW']);
}
$form_action = "index.php?module=Administration&view=" . $view . "&action=UpgradeWizard";
$base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
$base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
$GLOBALS['subdirs'] = array('full', 'langpack', 'module', 'patch', 'theme', 'temp');
// array of special scripts that are executed during (un)installation-- key is type of script, value is filename
if(!defined('SUGARCRM_PRE_INSTALL_FILE'))
{
define('SUGARCRM_PRE_INSTALL_FILE', 'scripts/pre_install.php');
define('SUGARCRM_POST_INSTALL_FILE', 'scripts/post_install.php');
define('SUGARCRM_PRE_UNINSTALL_FILE', 'scripts/pre_uninstall.php');
define('SUGARCRM_POST_UNINSTALL_FILE', 'scripts/post_uninstall.php');
}
$script_files = array(
"pre-install" => constant('SUGARCRM_PRE_INSTALL_FILE'),
"post-install" => constant('SUGARCRM_POST_INSTALL_FILE'),
"pre-uninstall" => constant('SUGARCRM_PRE_UNINSTALL_FILE'),
"post-uninstall" => constant('SUGARCRM_POST_UNINSTALL_FILE'),
);
function extractFile( $zip_file, $file_in_zip ){
global $base_tmp_upgrade_dir;
if(empty($base_tmp_upgrade_dir)){
$base_tmp_upgrade_dir = $GLOBALS['sugar_config']['upload_dir'] . "upgrades/temp";
}
$my_zip_dir = mk_temp_dir( $base_tmp_upgrade_dir );
unzip_file( $zip_file, $file_in_zip, $my_zip_dir );
return( "$my_zip_dir/$file_in_zip" );
}
function extractManifest( $zip_file ){
return( extractFile( $zip_file, "manifest.php" ) );
}
function getInstallType( $type_string ){
// detect file type
global $subdirs;
foreach( $subdirs as $subdir ){
if( preg_match( "#/$subdir/#", $type_string ) ){
return( $subdir );
}
}
// return empty if no match
return( "" );
}
function getImageForType( $type ){
$icon = "";
switch( $type ){
case "full":
$icon = SugarThemeRegistry::current()->getImage("Upgrade", "" );
break;
case "langpack":
$icon = SugarThemeRegistry::current()->getImage("LanguagePacks", "" );
break;
case "module":
$icon = SugarThemeRegistry::current()->getImage("ModuleLoader", "" );
break;
case "patch":
$icon = SugarThemeRegistry::current()->getImage("PatchUpgrades", "" );
break;
case "theme":
$icon = SugarThemeRegistry::current()->getImage("Themes", "" );
break;
default:
break;
}
return( $icon );
}
function getLanguagePackName( $the_file ){
require_once( "$the_file" );
if( isset( $app_list_strings["language_pack_name"] ) ){
return( $app_list_strings["language_pack_name"] );
}
return( "" );
}
function getUITextForType( $type ){
$type = 'LBL_UW_TYPE_'.strtoupper($type);
global $mod_strings;
return $mod_strings[$type];
}
function getUITextForMode( $mode ){
$mode = 'LBL_UW_MODE_'.strtoupper($mode);
global $mod_strings;
return $mod_strings[$mode];
}
/**
* @deprecated
* @todo this function doesn't seemed to be used anymore; trying kill this off
*/
function run_upgrade_wizard_sql( $script ){
global $unzip_dir;
global $sugar_config;
$db_type = $sugar_config['dbconfig']['db_type'];
$script = str_replace( "%db_type%", $db_type, $script );
if( !run_sql_file( "$unzip_dir/$script" ) ){
die( "{$mod_strings['ERR_UW_RUN_SQL']} $unzip_dir/$script" );
}
}
function validate_manifest( $manifest ){
// takes a manifest.php manifest array and validates contents
global $subdirs;
global $sugar_version;
global $sugar_flavor;
global $mod_strings;
if( !isset($manifest['type']) ){
die($mod_strings['ERROR_MANIFEST_TYPE']);
}
$type = $manifest['type'];
if( getInstallType( "/$type/" ) == "" ){
die($mod_strings['ERROR_PACKAGE_TYPE']. ": '" . $type . "'." );
}
if( isset($manifest['acceptable_sugar_versions']) ){
$version_ok = false;
$matches_empty = true;
if( isset($manifest['acceptable_sugar_versions']['exact_matches']) ){
$matches_empty = false;
foreach( $manifest['acceptable_sugar_versions']['exact_matches'] as $match ){
if( $match == $sugar_version ){
$version_ok = true;
}
}
}
if( !$version_ok && isset($manifest['acceptable_sugar_versions']['regex_matches']) ){
$matches_empty = false;
foreach( $manifest['acceptable_sugar_versions']['regex_matches'] as $match ){
if( preg_match( "/$match/", $sugar_version ) ){
$version_ok = true;
}
}
}
if( !$matches_empty && !$version_ok ){
die( $mod_strings['ERROR_VERSION_INCOMPATIBLE'] . $sugar_version );
}
}
if( isset($manifest['acceptable_sugar_flavors']) && sizeof($manifest['acceptable_sugar_flavors']) > 0 ){
$flavor_ok = false;
foreach( $manifest['acceptable_sugar_flavors'] as $match ){
if( $match == $sugar_flavor ){
$flavor_ok = true;
}
}
if( !$flavor_ok ){
die( $mod_strings['ERROR_FLAVOR_INCOMPATIBLE'] . $sugar_flavor );
}
}
}
function getDiffFiles($unzip_dir, $install_file, $is_install = true, $previous_version = ''){
//require_once($unzip_dir . '/manifest.php');
global $installdefs;
if(!empty($previous_version)){
//check if the upgrade path exists
if(!empty($upgrade_manifest)){
if(!empty($upgrade_manifest['upgrade_paths'])){
if(!empty($upgrade_manifest['upgrade_paths'][$previous_version])){
$installdefs = $upgrade_manifest['upgrade_paths'][$previous_version];
}
}//fi
}//fi
}//fi
$modified_files = array();
if(!empty($installdefs['copy'])){
foreach($installdefs['copy'] as $cp){
$cp['to'] = clean_path(str_replace('<basepath>', $unzip_dir, $cp['to']));
$restore_path = remove_file_extension(urldecode($install_file))."-restore/";
$backup_path = clean_path($restore_path.$cp['to'] );
//check if this file exists in the -restore directory
if(file_exists($backup_path)){
//since the file exists, then we want do an md5 of the install version and the file system version
$from = $backup_path;
$needle = $restore_path;
if(!$is_install){
$from = str_replace('<basepath>', $unzip_dir, $cp['from']);
$needle = $unzip_dir;
}
$files_found = md5DirCompare($from.'/', $cp['to'].'/', array('.svn'), false);
if(count($files_found > 0)){
foreach($files_found as $key=>$value){
$modified_files[] = str_replace($needle, '', $key);
}
}
}//fi
}//rof
}//fi
return $modified_files;
}
?>

View File

@@ -0,0 +1,555 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/Administration/UpgradeWizardCommon.php');
require_once('modules/Configurator/Configurator.php');
function UWrebuild() {
$log =& $GLOBALS['log'];
$db =& $GLOBALS['db'];
$log->info('Deleting Relationship Cache. Relationships will automatically refresh.');
echo "
<div id='rrresult'></div>
<script>
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject(\"Msxml2.XMLHTTP\");
} catch (e) {
try {
xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp = false;
}
}
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4) {
document.getElementById('rrresult').innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('GET', 'index.php?module=Administration&action=RebuildRelationship&to_pdf=true', true);
xmlhttp.send(null);
</script>";
$log->info('Rebuilding everything.');
require_once('ModuleInstall/ModuleInstaller.php');
$mi = new ModuleInstaller();
$mi->rebuild_all();
$query = "DELETE FROM versions WHERE name='Rebuild Extensions'";
$log->info($query);
$db->query($query);
// insert a new database row to show the rebuild extensions is done
$id = create_guid();
$gmdate = gmdate($GLOBALS['timedate']->get_db_date_time_format());
$date_entered = db_convert("'$gmdate'", 'datetime');
$query = 'INSERT INTO versions (id, deleted, date_entered, date_modified, modified_user_id, created_by, name, file_version, db_version) '
. "VALUES ('$id', '0', $date_entered, $date_entered, '1', '1', 'Rebuild Extensions', '4.0.0', '4.0.0')";
$log->info($query);
$db->query($query);
}
unset($_SESSION['rebuild_relationships']);
unset($_SESSION['rebuild_extensions']);
$log =& $GLOBALS['log'];
$db =& $GLOBALS['db'];
// process commands
if( !isset($_REQUEST['mode']) || ($_REQUEST['mode'] == "") ){
die($mod_strings['ERR_UW_NO_MODE']);
}
$mode = $_REQUEST['mode'];
if( !isset($_REQUEST['version']) ){
die($mod_strings['ERR_UW_NO_MODE']);
}
$version = $_REQUEST['version'];
if( !isset($_REQUEST['copy_count']) || ($_REQUEST['copy_count'] == "") ){
die($mod_strings['ERR_UW_NO_FILES']);
}
if( !isset($_REQUEST['unzip_dir']) || ($_REQUEST['unzip_dir'] == "") ){
die($mod_strings['ERR_UW_NO_TEMP_DIR']);
}
$unzip_dir = $_REQUEST['unzip_dir'];
if(empty($_REQUEST['install_file'])){
die($mod_strings['ERR_UW_NO_INSTALL_FILE']);
}
$install_file = hashToFile($_REQUEST['install_file'] );
$install_type = getInstallType( $install_file );
$id_name = '';
if(isset($_REQUEST['id_name'])){
$id_name = $_REQUEST['id_name'];
}
$s_manifest = '';
if(isset($_REQUEST['s_manifest'])){
$s_manifest = $_REQUEST['s_manifest'];
}
$previous_version = '';
if(isset($_REQUEST['previous_version'])){
$previous_version = $_REQUEST['previous_version'];
}
$previous_id = '';
if(isset($_REQUEST['previous_id'])){
$previous_id = $_REQUEST['previous_id'];
}
if( $install_type != "module" ){
if( !isset($_REQUEST['zip_from_dir']) || ($_REQUEST['zip_from_dir'] == "") ){
$zip_from_dir = ".";
}
else{
$zip_from_dir = $_REQUEST['zip_from_dir'];
}
if( !isset($_REQUEST['zip_to_dir']) || ($_REQUEST['zip_to_dir'] == "") ){
$zip_to_dir = ".";
}
else{
$zip_to_dir = $_REQUEST['zip_to_dir'];
}
}
$remove_tables = 'true';
if(isset($_REQUEST['remove_tables'])){
$remove_tables = $_REQUEST['remove_tables'];
}
$overwrite_files = true;
if(isset($_REQUEST['radio_overwrite'])){
$overwrite_files = (($_REQUEST['radio_overwrite'] == 'do_not_overwrite') ? false : true);
}
//rrs
$author = '';
$is_uninstallable = true;
$name = '';
$description = '';
if($install_type == 'module'){
$is_uninstallable = $_REQUEST['is_uninstallable'];
$name = $_REQUEST['name'];
$description = $_REQUEST['description'];
}
$file_action = "";
$uh_status = "";
$rest_dir = clean_path( remove_file_extension($install_file)."-restore");
$files_to_handle = array();
if(!empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan']) && $install_type != 'patch'){
require_once('ModuleInstall/ModuleScanner.php');
$ms = new ModuleScanner();
$ms->scanPackage($unzip_dir);
if($ms->hasIssues()){
$ms->displayIssues();
sugar_cleanup(true);
}
}
//
// execute the PRE scripts
//
if($install_type == 'patch' || $install_type == 'module')
{
switch($mode)
{
case 'Install':
$file = "$unzip_dir/" . constant('SUGARCRM_PRE_INSTALL_FILE');
if(is_file($file))
{
print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
include($file);
pre_install();
}
break;
case 'Uninstall':
$file = "$unzip_dir/" . constant('SUGARCRM_PRE_UNINSTALL_FILE');
if(is_file($file))
{
print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
include($file);
pre_uninstall();
}
break;
default:
break;
}
}
//
// perform the action
//
for( $iii = 0; $iii < $_REQUEST['copy_count']; $iii++ ){
if( isset($_REQUEST["copy_" . $iii]) && ($_REQUEST["copy_" . $iii] != "") ){
$file_to_copy = $_REQUEST["copy_" . $iii];
$src_file = clean_path( "$unzip_dir/$zip_from_dir/$file_to_copy" );
$sugar_home_dir = getCwd();
$dest_file = clean_path( "$sugar_home_dir/$zip_to_dir/$file_to_copy" );
if($zip_to_dir != '.')
$rest_file = clean_path("$rest_dir/$zip_to_dir/$file_to_copy");
else
$rest_file = clean_path("$rest_dir/$file_to_copy");
switch( $mode ){
case "Install":
mkdir_recursive( dirname( $dest_file ) );
if($install_type=="patch" && is_file($dest_file))
{
if(!is_dir(dirname( $rest_file )))
mkdir_recursive( dirname( $rest_file ) );
copy( $dest_file, $rest_file);
sugar_touch( $rest_file, filemtime($dest_file) );
}
if( !copy( $src_file, $dest_file ) ){
die( $mod_strings['ERR_UW_COPY_FAILED'].$src_file.$mod_strings['LBL_TO'].$dest_file);
}
$uh_status = "installed";
break;
case "Uninstall":
if($install_type=="patch" && is_file($rest_file))
{
copy( $rest_file, $dest_file);
sugar_touch( $dest_file, filemtime($rest_file) );
}
elseif(file_exists($dest_file) && !unlink($dest_file))
{
die($mod_strings['ERR_UW_REMOVE_FAILED'].$dest_file);
}
$uh_status = "uninstalled";
break;
default:
die("{$mod_strings['LBL_UW_OP_MODE']} '$mode' {$mod_strings['ERR_UW_NOT_RECOGNIZED']}." );
}
$files_to_handle[] = clean_path( "$zip_to_dir/$file_to_copy" );
}
}
switch( $install_type ){
case "langpack":
if( !isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "") ){
die($mod_strings['ERR_UW_NO_LANG']);
}
if( !isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "") ){
die($mod_strings['ERR_UW_NO_LANG_DESC']);
}
if( $mode == "Install" || $mode=="Enable" ){
$sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] );
}
else if( $mode == "Uninstall" || $mode=="Disable" ){
$new_langs = array();
$old_langs = $sugar_config['languages'];
foreach( $old_langs as $key => $value ){
if( $key != $_REQUEST['new_lang_name'] ){
$new_langs += array( $key => $value );
}
}
$sugar_config['languages'] = $new_langs;
$default_sugar_instance_lang = 'en_us';
if($current_language == $_REQUEST['new_lang_name']){
$_SESSION['authenticated_user_language'] =$default_sugar_instance_lang;
$lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
}
if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){
$cfg = new Configurator();
$cfg->config['languages'] = $new_langs;
$cfg->config['default_language'] = $default_sugar_instance_lang;
$cfg->handleOverride();
$lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
}
}
ksort( $sugar_config );
if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){
die($mod_strings['ERR_UW_CONFIG_FAILED']);
}
break;
case "module":
require_once( "ModuleInstall/ModuleInstaller.php" );
$mi = new ModuleInstaller();
switch( $mode ){
case "Install":
//here we can determine if this is an upgrade or a new version
if(!empty($previous_version)){
$mi->install( "$unzip_dir", true, $previous_version);
}else{
$mi->install( "$unzip_dir" );
}
break;
case "Uninstall":
if($remove_tables == 'false')
$GLOBALS['mi_remove_tables'] = false;
else
$GLOBALS['mi_remove_tables'] = true;
$mi->uninstall( "$unzip_dir" );
break;
case "Disable":
if(!$overwrite_files)
$GLOBALS['mi_overwrite_files'] = false;
else
$GLOBALS['mi_overwrite_files'] = true;
$mi->disable( "$unzip_dir" );
break;
case "Enable":
if(!$overwrite_files)
$GLOBALS['mi_overwrite_files'] = false;
else
$GLOBALS['mi_overwrite_files'] = true;
$mi->enable( "$unzip_dir" );
break;
default:
break;
}
$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
if(is_file($file))
{
print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
include($file);
post_install();
}
break;
case "full":
// purposely flow into "case: patch"
case "patch":
switch($mode)
{
case 'Install':
$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
if(is_file($file))
{
print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
include($file);
post_install();
}
UWrebuild();
break;
case 'Uninstall':
$file = "$unzip_dir/" . constant('SUGARCRM_POST_UNINSTALL_FILE');
if(is_file($file)) {
print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
include($file);
post_uninstall();
}
if(is_dir($rest_dir))
{
rmdir_recursive($rest_dir);
}
UWrebuild();
break;
default:
break;
}
require( "sugar_version.php" );
$sugar_config['sugar_version'] = $sugar_version;
ksort( $sugar_config );
if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) )
{
die($mod_strings['ERR_UW_UPDATE_CONFIG']);
}
break;
default:
break;
}
switch( $mode ){
case "Install":
$file_action = "copied";
// if error was encountered, script should have died before now
$new_upgrade = new UpgradeHistory();
//determine if this module has already been installed given the unique_key to
//identify the module
// $new_upgrade->checkForExisting($unique_key);
if(!empty($previous_id)){
$new_upgrade->id = $previous_id;
$uh = new UpgradeHistory();
$uh->retrieve($previous_id);
if(is_file($uh->filename)) {
unlink($uh->filename);
}
}
$new_upgrade->filename = $install_file;
$new_upgrade->md5sum = md5_file( $install_file );
$new_upgrade->type = $install_type;
$new_upgrade->version = $version;
$new_upgrade->status = "installed";
$new_upgrade->name = $name;
$new_upgrade->description = $description;
$new_upgrade->id_name = $id_name;
$new_upgrade->manifest = $s_manifest;
$new_upgrade->save();
//Check if we need to show a page for the user to finalize their install with.
if (is_file("$unzip_dir/manifest.php"))
{
include("$unzip_dir/manifest.php");
if (!empty($manifest['post_install_url']))
{
$url_conf = $manifest['post_install_url'];
if (is_string($url_conf))
$url_conf = array('url' => $url_conf);
if (isset($url_conf['type']) && $url_conf['type'] == 'popup')
{
echo '<script type="text/javascript">window.open("' . $url_conf['url']
. '","' . (empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']) . '","'
. 'height=' . (empty($url_conf['height']) ? '500' : $url_conf['height']) . ','
. 'width=' . (empty($url_conf['width']) ? '800' : $url_conf['width']) . '");</script>';
} else
{
echo '<iframe src="' . $url_conf['url'] . '" '
. 'width="' . (empty($url_conf['width']) ? '100%' : $url_conf['width']) . '" '
. 'height="' . (empty($url_conf['height']) ? '500px' : $url_conf['height']) . '"></iframe>';
}
}
}
break;
case "Uninstall":
$file_action = "removed";
$uh = new UpgradeHistory();
$the_md5 = md5_file( $install_file );
$md5_matches = $uh->findByMd5( $the_md5 );
if( sizeof( $md5_matches ) == 0 ){
die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." );
}
foreach( $md5_matches as $md5_match ){
$md5_match->delete();
}
break;
case "Disable":
$file_action = "disabled";
$uh = new UpgradeHistory();
$the_md5 = md5_file( $install_file );
$md5_matches = $uh->findByMd5( $the_md5 );
if( sizeof( $md5_matches ) == 0 ){
die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." );
}
foreach( $md5_matches as $md5_match ){
$md5_match->enabled = 0;
$md5_match->save();
}
break;
case "Enable":
$file_action = "enabled";
$uh = new UpgradeHistory();
$the_md5 = md5_file( $install_file );
$md5_matches = $uh->findByMd5( $the_md5 );
if( sizeof( $md5_matches ) == 0 ){
die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." );
}
foreach( $md5_matches as $md5_match ){
$md5_match->enabled = 1;
$md5_match->save();
}
break;
}
// present list to user
?>
<form action="<?php print( $form_action ); ?>" method="post">
<?php
echo "<div>";
print( getUITextForType($install_type) . " ". getUITextForMode($mode) . " ". $mod_strings['LBL_UW_SUCCESSFULLY']);
echo "<br>";
echo "<br>";
print( "<input type=submit value=\"{$mod_strings['LBL_UW_BTN_BACK_TO_MOD_LOADER']}\" /><br>" );
echo "</div>";
echo "<br>";
if(isset($lang_changed_string))
print($lang_changed_string);
if ($install_type != "module" && $install_type != "langpack"){
if( sizeof( $files_to_handle ) > 0 ){
echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'this.style.display="none"; toggleDisplay("more");\' id="all_text"><img src="'.SugarThemeRegistry::current()->getImageURL('advanced_search.gif').'"> Show Details</div><div id=\'more\' style=\'display: none\'>
<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'document.getElementById("all_text").style.display=""; toggleDisplay("more");\'><img name="options" src="'.SugarThemeRegistry::current()->getImageURL('basic_search.gif').'"> Hide Details</div><br>';
print( "{$mod_strings['LBL_UW_FOLLOWING_FILES']} $file_action:<br>\n" );
print( "<ul id=\"subMenu\">\n" );
foreach( $files_to_handle as $file_to_copy ){
print( "<li>$file_to_copy<br>\n" );
}
print( "</ul>\n" );
echo '</div>';
}
else if( $mode != 'Disable' && $mode !='Enable' ){
print( "{$mod_strings['LBL_UW_NO_FILES_SELECTED']} $file_action.<br>\n" );
}
print($mod_strings['LBL_UW_UPGRADE_SUCCESSFUL']);
print( "<input class='button' type=submit value=\"{$mod_strings['LBL_UW_BTN_BACK_TO_UW']}\" />\n" );
}
?>
</form>
<?php
$GLOBALS['log']->info( "Upgrade Wizard patches" );
?>

View File

@@ -0,0 +1,537 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/Administration/UpgradeWizardCommon.php');
unset($_SESSION['rebuild_relationships']);
unset($_SESSION['rebuild_extensions']);
// process commands
if(empty($_REQUEST['install_file'])){
die( "File to install not specified." );
}
if( !isset($_REQUEST['mode']) || ($_REQUEST['mode'] == "") ){
die( "No mode specified." );
}
$unzip_dir = mk_temp_dir( $base_tmp_upgrade_dir );
$install_file = hashToFile($_REQUEST['install_file']);
$hidden_fields = "";
$new_lang_name = "";
$new_lang_desc = "";
$mode = $_REQUEST['mode'];
$hidden_fields .= "<input type=hidden name=\"mode\" value=\"$mode\"/>";
$install_type = getInstallType( $install_file );
$version = "";
$previous_version = "";
$show_files = true;
$zip_from_dir = ".";
$zip_to_dir = ".";
$zip_force_copy = array();
$license_file = $unzip_dir.'/LICENSE.txt';
$readme_file = $unzip_dir.'/README.txt';
$require_license = false;
$found_readme = false;
$author = '';
$name = '';
$description = '';
$is_uninstallable = true;
$id_name = '';
$dependencies = array();
$remove_tables = 'true';
unzip( $install_file, $unzip_dir );
if($install_type == 'module' && $mode != 'Uninstall'){
if(file_exists($license_file)){
$require_license = true;
}
}
//Scan the unzip dir for unsafe files
if(!empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan']) && $install_type != 'patch'){
require_once('ModuleInstall/ModuleScanner.php');
$ms = new ModuleScanner();
$ms->scanPackage($unzip_dir);
if($ms->hasIssues()){
$ms->displayIssues();
sugar_cleanup(true);
}
}
// assumption -- already validated manifest.php at time of upload
require_once( "$unzip_dir/manifest.php" );
if( isset( $manifest['copy_files']['from_dir'] ) && $manifest['copy_files']['from_dir'] != "" ){
$zip_from_dir = $manifest['copy_files']['from_dir'];
}
if( isset( $manifest['copy_files']['to_dir'] ) && $manifest['copy_files']['to_dir'] != "" ){
$zip_to_dir = $manifest['copy_files']['to_dir'];
}
if( isset( $manifest['copy_files']['force_copy'] ) && $manifest['copy_files']['force_copy'] != "" ){
$zip_force_copy = $manifest['copy_files']['force_copy'];
}
if( isset( $manifest['version'] ) ){
$version = $manifest['version'];
}
if( isset( $manifest['author'] ) ){
$author = $manifest['author'];
}
if( isset( $manifest['name'] ) ){
$name = $manifest['name'];
}
if( isset( $manifest['description'] ) ){
$description = $manifest['description'];
}
if( isset( $manifest['is_uninstallable'] ) ){
$is_uninstallable = $manifest['is_uninstallable'];
}
if(isset($installdefs) && isset( $installdefs['id'] ) ){
$id_name = $installdefs['id'];
}
if( isset( $manifest['dependencies']) ){
$dependencies = $manifest['dependencies'];
}
if( isset( $manifest['remove_tables']) ){
$remove_tables = $manifest['remove_tables'];
}
if($remove_tables != 'prompt'){
$hidden_fields .= "<input type=hidden name=\"remove_tables\" value='".$remove_tables."'>";
}
if(file_exists($readme_file) || !empty($manifest['readme'])){
$found_readme = true;
}
$uh = new UpgradeHistory();
//check dependencies first
if(!empty($dependencies)){
$not_found = $uh->checkDependencies($dependencies);
if(!empty($not_found) && count($not_found) > 0){
die( $mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]");
}//fi
}
switch( $install_type ){
case "full":
case "patch":
if( !is_writable( "config.php" ) ){
die( $mod_strings['ERR_UW_CONFIG'] );
}
break;
case "theme":
break;
case "langpack":
// find name of language pack: find single file in include/language/xx_xx.lang.php
$d = dir( "$unzip_dir/$zip_from_dir/include/language" );
while( $f = $d->read() ){
if( $f == "." || $f == ".." ){
continue;
}
else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){
$new_lang_name = $match[1];
}
}
if( $new_lang_name == "" ){
die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file );
}
$hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>";
$new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" );
if( $new_lang_desc == "" ){
die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." );
}
$hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>";
if( !is_writable( "config.php" ) ){
die( $mod_strings['ERR_UW_CONFIG'] );
}
break;
case "module":
$previous_install = array();
if(!empty($id_name) & !empty($version))
$previous_install = $uh->determineIfUpgrade($id_name, $version);
$previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version'];
$previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id'];
$show_files = false;
//rrs pull out unique_key
$hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>";
$hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>";
$hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>";
$hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>";
$hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>";
$hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>";
$hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>";
break;
default:
die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type );
}
$new_files = findAllFilesRelative( "$unzip_dir/$zip_from_dir", array() );
$hidden_fields .= "<input type=hidden name=\"version\" value=\"$version\"/>";
$serial_manifest = array();
$serial_manifest['manifest'] = (isset($manifest) ? $manifest : '');
$serial_manifest['installdefs'] = (isset($installdefs) ? $installdefs : '');
$serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : '');
$hidden_fields .= "<input type=hidden name=\"s_manifest\" value='".base64_encode(serialize($serial_manifest))."'>";
// present list to user
?>
<form action="<?php print( $form_action . "_commit" ); ?>" name="files" method="post" onSubmit="return validateForm(<?php print($require_license); ?>);">
<?php
if(empty($new_studio_mod_files)) {
if(!empty($mode) && $mode == 'Uninstall')
echo $mod_strings['LBL_UW_UNINSTALL_READY'];
else if($mode == 'Disable')
echo $mod_strings['LBL_UW_DISABLE_READY'];
else if($mode == 'Enable')
echo $mod_strings['LBL_UW_ENABLE_READY'];
else
echo $mod_strings['LBL_UW_PATCH_READY'];
}
else {
echo $mod_strings['LBL_UW_PATCH_READY2'];
echo '<input type="checkbox" onclick="toggle_these(0, ' . count($new_studio_mod_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
foreach($new_studio_mod_files as $the_file) {
$new_file = clean_path( "$zip_to_dir/$the_file" );
print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\"> " . $new_file . "</li>");
$count++;
}
}
echo '<br>';
if($require_license){
$fh = sugar_fopen($license_file, 'r');
$contents = fread($fh, filesize($license_file));
fclose($fh);
$readme_contents = '';
if($found_readme){
if(file_exists($readme_file) && filesize($readme_file) > 0){
$fh = sugar_fopen($readme_file, 'r');
$readme_contents = fread($fh, filesize($readme_file));
fclose($fh);
}elseif(!empty($manifest['readme'])){
$readme_contents = $manifest['readme'];
}
}
$license_final =<<<eoq2
<table width='100%'>
<tr>
<td colspan="3"><ul class="tablist">
<li id="license_li" class="active"><a id="license_link" class="current" href="javascript:selectTabCSS('license');">{$mod_strings['LBL_LICENSE']}</a></li>
<li class="active" id="readme_li"><a id="readme_link" href="javascript:selectTabCSS('readme');">{$mod_strings['LBL_README']}</a></li>
</ul></td>
</tr>
</table>
<div id='license_div'>
<table>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top" colspan=2>
<b>{$mod_strings['LBL_MODULE_LICENSE']}</b>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan=2>
<textarea cols="100" rows="8" readonly>{$contents}</textarea>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan=2>
<input type='radio' id='radio_license_agreement_accept' name='radio_license_agreement' value='accept'>{$mod_strings['LBL_ACCEPT']}&nbsp;
<input type='radio' id='radio_license_agreement_reject' name='radio_license_agreement' value='reject' checked>{$mod_strings['LBL_DENY']}
</td>
</tr></table>
</div>
<div id='readme_div' style='display: none;'>
<table>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top" colspan=2>
<b>{$mod_strings['LBL_README']}</b>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan=2>
<textarea cols="100" rows="8" readonly>{$readme_contents}</textarea>
</td>
</tr>
</table>
</div>
eoq2;
echo $license_final;
echo "<br>";
}
switch( $mode ){
case "Install":
if( $install_type == "langpack") {
print( $mod_strings['LBL_UW_LANGPACK_READY'] );
echo '<br><br>';
}
break;
case "Uninstall":
if( $install_type == "langpack" ){
print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] );
echo '<br><br>';
}
else if($install_type != "module"){
print( $mod_strings['LBL_UW_FILES_REMOVED'] );
}
break;
case "Disable":
if( $install_type == "langpack" ){
print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] );
echo '<br><br>';
}
break;
case "Enable":
if( $install_type == "langpack" ){
print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] );
echo '<br><br>';
}
break;
}
?>
<input type=submit value="<?php echo $mod_strings['LBL_ML_COMMIT'];?>" class="button" />
<input type=button value="<?php echo $mod_strings['LBL_ML_CANCEL'];?>" class="button" onClick="location.href='index.php?module=Administration&action=UpgradeWizard&view=module';"/>
<?php
if($remove_tables == 'prompt' && $mode == 'Uninstall'){
print ("<br/><br/>");
print ("<input type='radio' id='remove_tables_true' name='remove_tables' value='true' checked>".$mod_strings['ML_LBL_REMOVE_TABLES']."&nbsp;");
print ("<input type='radio' id='remove_tables_false' name='remove_tables' value='false'>".$mod_strings['ML_LBL_DO_NOT_REMOVE_TABLES']."<br>");
}
$count = 0;
if( $show_files == true ){
$count = 0;
$new_studio_mod_files = array();
$new_sugar_mod_files = array();
$cache_html_files = findAllFilesRelative( "{$GLOBALS['sugar_config']['cache_dir']}layout", array());
foreach($new_files as $the_file) {
if(substr(strtolower($the_file), -5, 5) == '.html' && in_array($the_file, $cache_html_files))
array_push($new_studio_mod_files, $the_file);
else
array_push($new_sugar_mod_files, $the_file);
}
echo '<script>
function toggle_these(start, end, ca) {
while(start < end) {
elem = eval("document.forms.files.copy_" + start);
if(!ca.checked) elem.checked = false;
else elem.checked = true;
start++;
}
}
</script>';
global $theme;
echo '<br/><br/>';
echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;'.(($mode == 'Enable' || $mode == 'Disable')?'display:none;':'').'" onclick=\'this.style.display="none"; toggleDisplay("more");\'id="all_text">
'.' <img src="'.SugarThemeRegistry::current()->getImageURL('advanced_search.gif').'">'.$mod_strings['LBL_UW_SHOW_DETAILS'].'</div><div id=\'more\' style=\'display: none\'>
<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'document.getElementById("all_text").style.display=""; toggleDisplay("more");\'>'
.' <img name="options" src="'.SugarThemeRegistry::current()->getImageURL('basic_search.gif').'">'.$mod_strings['LBL_UW_HIDE_DETAILS'].'</div><br>';
echo '<input type="checkbox" checked onclick="toggle_these(' . count($new_studio_mod_files) . ',' . count($new_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
echo '<ul>';
foreach( $new_sugar_mod_files as $the_file ){
$highlight_start = "";
$highlight_end = "";
$checked = "";
$disabled = "";
$unzip_file = "$unzip_dir/$zip_from_dir/$the_file";
$new_file = clean_path( "$zip_to_dir/$the_file" );
$forced_copy = false;
if( $mode == "Install" ){
$checked = "checked";
foreach( $zip_force_copy as $pattern ){
if( preg_match("#" . $pattern . "#", $unzip_file) ){
$disabled = "disabled=\"true\"";
$forced_copy = true;
}
}
if( !$forced_copy && is_file( $new_file ) && (md5_file( $unzip_file ) == md5_file( $new_file )) ){
$disabled = "disabled=\"true\"";
//$checked = "";
}
if( $checked != "" && $disabled != "" ){ // need to put a hidden field
print( "<input name=\"copy_$count\" type=\"hidden\" value=\"" . $the_file . "\">\n" );
}
print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end );
if( $checked == "" && $disabled != "" ){ // need to explain this file hasn't changed
print( " (no changes)" );
}
print( "<br>\n" );
}
else if( $mode == "Uninstall" && file_exists( $new_file ) ){
if( md5_file( $unzip_file ) == md5_file( $new_file ) ){
$checked = "checked=\"true\"";
}
else{
$highlight_start = "<font color=red>";
$highlight_end = "</font>";
}
print( "<li><input name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end . "<br>\n" );
}
$count++;
}
print( "</ul>\n" );
}
// echo '</div>';
if($mode == "Disable" || $mode == "Enable"){
//check to see if any files have been modified
$modified_files = getDiffFiles($unzip_dir, $install_file, ($mode == 'Enable'), $previous_version);
if(count($modified_files) > 0){
//we need to tell the user that some files have been modified since they last did an install
echo '<script>' .
'function handleFileChange(){';
if(count($modified_files) > 0){
echo 'if(document.getElementById("radio_overwrite_files") != null && document.getElementById("radio_do_not_overwrite_files") != null){
var overwrite = false;
if(document.getElementById("radio_overwrite_files").checked){
overwrite = true
}
}
return true;';
}else{
echo 'return true;';
}
echo '}</script>';
print('<b>'.$mod_strings['ML_LBL_OVERWRITE_FILES'].'</b>');
print('<table><td align="left" valign="top" colspan=2>');
print("<input type='radio' id='radio_overwrite_files' name='radio_overwrite' value='overwrite'>{$mod_strings['LBL_OVERWRITE_FILES']}&nbsp;");
print("<input type='radio' id='radio_do_not_overwrite_files' name='radio_overwrite' value='do_not_overwrite' checked>{$mod_strings['LBL_DO_OVERWRITE_FILES']}");
print("</td></tr></table>");
print('<ul>');
foreach($modified_files as $modified_file){
print('<li>'.$modified_file.'</li>');
}
print('</ul>');
}else{
echo '<script>' .
'function handleFileChange(){';
echo 'return true;';
echo '}</script>';
}
}else{
echo '<script>' .
'function handleFileChange(){';
echo 'return true;';
echo '}</script>';
}
echo '<script>' .
'function validateForm(process){'.
'return (handleCommit(process) && handleFileChange());'.
'}'.
'function handleCommit(process){
if(process == 1) {
if(document.getElementById("radio_license_agreement_reject") != null && document.getElementById("radio_license_agreement_accept") != null){
var accept = false;
if(document.getElementById("radio_license_agreement_accept").checked){
accept = true
}
if(!accept){
//do not allow the form to submit
alert("'.$mod_strings['ERR_UW_ACCEPT_LICENSE'].'");
return false;
}
}
}
return true;
}
var keys = [ "license","readme"];
function selectTabCSS(key){
for( var i=0; i<keys.length;i++)
{
var liclass = "";
var linkclass = "";
if ( key == keys[i])
{
var liclass = "active";
var linkclass = "current";
document.getElementById(keys[i]+"_div").style.display = "block";
}else{
document.getElementById(keys[i]+"_div").style.display = "none";
}
document.getElementById(keys[i]+"_li").className = liclass;
document.getElementById(keys[i]+"_link").className = linkclass;
}
tabPreviousKey = key;
}
</script>';
$fileHash = fileToHash($install_file );
?>
<?php print( $hidden_fields ); ?>
<input type=hidden name="copy_count" value="<?php print( $count );?>"/>
<input type=hidden name="run" value="commit" />
<input type=hidden name="install_file" value="<?php echo $fileHash; ?>" />
<input type=hidden name="unzip_dir" value="<?php echo $unzip_dir; ?>" />
<input type=hidden name="zip_from_dir" value="<?php echo $zip_from_dir; ?>" />
<input type=hidden name="zip_to_dir" value="<?php echo $zip_to_dir; ?>" />
</form>
<?php
$GLOBALS['log']->info( "Upgrade Wizard patches" );
?>

View File

@@ -0,0 +1,38 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$action_view_map['themesettings'] = 'themesettings';
$action_view_map['repair'] = 'repair';

View File

@@ -0,0 +1,84 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
**this is the ajax call that is called from RebuildJSLang.php. It processes
**the Request object in order to call correct methods for repairing/rebuilding JSfiles
*Note that minify.php has already been included as part of index.php, so no need to include again.
*/
//set default root directory
$from = getcwd();
if(isset($_REQUEST['root_directory']) && !empty($_REQUEST['root_directory'])){
$from = $_REQUEST['root_directory'];
}
//this script can take a while, change max execution time to 10 mins
$tmp_time = ini_get('max_execution_time');
ini_set('max_execution_time','600');
//figure out which commands to call.
if($_REQUEST['js_admin_repair'] == 'concat' ){
//concatenate mode, call the files that will concatenate javascript group files
$_REQUEST['js_rebuild_concat'] = 'rebuild';
require_once('jssource/minify.php');
}else{
$_REQUEST['root_directory'] = getcwd();
require_once('jssource/minify.php');
if($_REQUEST['js_admin_repair'] == 'replace'){
//should replace compressed JS with source js
reverseScripts("$from/jssource/src_files","$from");
}elseif($_REQUEST['js_admin_repair'] == 'mini'){
//should replace compressed JS with minified version of source js
reverseScripts("$from/jssource/src_files","$from");
BackUpAndCompressScriptFiles("$from","",false);
ConcatenateFiles("$from");
}elseif($_REQUEST['js_admin_repair'] == 'repair'){
//should compress existing javascript (including changes done) without overwriting original source files
BackUpAndCompressScriptFiles("$from","",false);
ConcatenateFiles("$from");
}
}
//set execution time back to what it was
ini_set('max_execution_time',$tmp_time);
?>

View File

@@ -0,0 +1,76 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $sugar_config, $mod_strings;
print( $mod_strings['LBL_CLEAR_CHART_DATA_CACHE_FINDING'] . "<br>" );
$search_dir='cache/';
if (!empty($sugar_config['cache_dir'])) {
$search_dir=$sugar_config['cache_dir'];
}
$all_src_files = findAllFiles($search_dir.'/xml', array() );
print( $mod_strings['LBL_CLEAR_CHART_DATA_CACHE_DELETING1'] . "<br>" );
foreach( $all_src_files as $src_file ){
if (preg_match('/\.xml$/',$src_file))
{
print( $mod_strings['LBL_CLEAR_CHART_DATA_CACHE_DELETING2'] . " $src_file<BR>" ) ;
unlink( "$src_file" );
}
}
include('modules/Versions/ExpectedVersions.php');
global $expect_versions;
if (isset($expect_versions['Chart Data Cache'])) {
$version = new Version();
$version->retrieve_by_string_fields(array('name'=>'Chart Data Cache'));
$version->name = $expect_versions['Chart Data Cache']['name'];
$version->file_version = $expect_versions['Chart Data Cache']['file_version'];
$version->db_version = $expect_versions['Chart Data Cache']['db_version'];
$version->save();
}
echo "\n--- " . $mod_strings['LBL_DONE'] . "---<br />\n";
?>

View File

@@ -0,0 +1,169 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $current_user,$beanFiles;
set_time_limit(3600);
$db = & DBManagerFactory::getInstance();
if ($db->dbType == 'oci8') {
echo "<BR>";
echo "<p>".$mod_strings['ERR_NOT_FOR_ORACLE']."</p>";
echo "<BR>";
sugar_die('');
}
if ($db->dbType == 'mysql') {
echo "<BR>";
echo "<p>".$mod_strings['ERR_NOT_FOR_MYSQL']."</p>";
echo "<BR>";
sugar_die('');
}
if(is_admin($current_user) || isset($from_sync_client)){
$execute = false;
$export = false;
if(isset($_REQUEST['do_action'])){
switch($_REQUEST['do_action']){
case 'display':
break;
case 'execute':
$execute = true;
break;
case 'export':
header('Location: index.php?module=Administration&action=expandDatabase&do_action=do_export&to_pdf=true');
die();
case 'do_export':
$export = true;
break;
}
if(!$export && empty($_REQUEST['repair_silent'])){
echo get_module_title($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], $mod_strings['LBL_EXPAND_DATABASE_COLUMNS'].':'.$_REQUEST['do_action'], true);
}
$alter_queries = array();
$restore_quries = array();
$sql = "SELECT SO.name AS table_name, SC.name AS column_name, CONVERT(int, SC.length) AS length, SC.isnullable, type_name(SC.xusertype) AS type
FROM sys.sysobjects AS SO INNER JOIN sys.syscolumns AS SC ON SC.id = SO.id
WHERE (SO.type = 'U')
AND (type_name(SC.xusertype) IN ('varchar', 'char', ' text '))
AND (SC.name NOT LIKE '%_id') AND (SC.name NOT LIKE 'id_%') AND (SC.name <> 'id')
ORDER BY SO.name, column_name";
$result = $db->query($sql);
$theAlterQueries = '';
$theRestoreQueries = '';
$alter_queries = array();
while ($row = $db->fetchByAssoc($result)) {
$length = (int)$row['length'];
if($length < 255) {
$newLength = ($length * 3 < 255) ? $length * 3 : 255;
$sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')';
$theAlterQueries .= $sql . "\n";
$alter_queries[] = $sql;
$sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')';
$theRestoreQueries .= $sql2 . "\n";
}
} //while
//If there are no ALTER queries to run, echo message
if(count($alter_queries) == 0) {
echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND'];
} else {
// Create a backup file to restore columns to original length
if($execute) {
$fh = sugar_fopen('restoreExpand.sql', 'w');
if(-1 == fwrite($fh, $theRestoreQueries)) {
$GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
} else {
$GLOBALS['log']->info($mod_strings['LBL_CREATE_RESOTRE_FILE']);
echo($mod_strings['LBL_CREATE_RESOTRE_FILE']);
}
foreach($alter_queries as $key=>$value) {
$db->query($value);
}
}
if($export) {
header("Content-Disposition: attachment; filename=expandSugarDB.sql");
header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header("Content-Length: ".strlen($theAlterQueries));
echo $theAlterQueries;
die();
} else {
if(empty($_REQUEST['repair_silent'])) {
echo nl2br($theAlterQueries);
}
}
} //if-else
} // end do_action
if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
if(!file_exists('restoreExpand.sql')) {
echo " <b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br>
<form name='repairdb'>
<input type='hidden' name='action' value='expandDatabase'>
<input type='hidden' name='module' value='Administration'>
<select name='do_action'>
<option value='display'>".$mod_strings['LBL_REPAIR_DISPLAYSQL']."
<option value='export'>".$mod_strings['LBL_REPAIR_EXPORTSQL']."
<option value='execute'>".$mod_strings['LBL_REPAIR_EXECUTESQL']."
</select><input type='submit' class='button' value='".$mod_strings['LBL_GO']."'>
</form><br><br>
".$mod_strings['LBL_EXPAND_DATABASE_TEXT'];
} else {
echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
} //if-else
} //if
}else{
die('Admin Only Section');
}
?>

View File

@@ -0,0 +1,61 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
-->
<!-- BEGIN: main -->
<!-- BEGIN: group -->
<p>{GROUP_HEADER}{GROUP_DESC}
<table class="other view">
<!-- BEGIN: row -->
<tr>
<!-- BEGIN: col -->
<td width="20%" scope="row">{ITEM_HEADER_IMAGE}&nbsp;<a href='{ITEM_URL}' class="tabDetailViewDL2Link">{ITEM_HEADER_LABEL}</a></td>
<td>{ITEM_DESCRIPTION}</td>
<!-- END: col -->
<!-- BEGIN: empty -->
<td scope="row">&nbsp;</td>
<td>&nbsp;</td>
<!-- END: empty -->
</tr>
<!-- END: row -->
</table>
</p>
<!-- END: group -->
<!-- END: main -->

View File

@@ -0,0 +1,155 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $currentModule;
global $current_language;
global $current_user;
global $sugar_flavor;
if (!is_admin($current_user) && !is_admin_for_any_module($current_user))
{
sugar_die("Unauthorized access to administration.");
}
echo get_module_title(translate('LBL_MODULE_NAME','Administration'),
translate('LBL_MODULE_NAME','Administration'), true);
//get the module links..
require('modules/Administration/metadata/adminpaneldefs.php');
global $admin_group_header; ///variable defined in the file above.
$tab = array();
$header_image = array();
$url = array();
$label_tab = array();
$description = array();
$group = array();
$sugar_smarty = new Sugar_Smarty();
$values_3_tab = array();
$admin_group_header_tab = array();
$j=0;
foreach ($admin_group_header as $key=>$values) {
$module_index = array_keys($values[3]);
$addedHeaderGroups = array();
foreach ($module_index as $mod_key=>$mod_val) {
if(
(!isset($addedHeaderGroups[$values[0]]))) {
$admin_group_header_tab[]=$values;
$group_header_value=get_form_header(translate($values[0],'Administration'),$values[1],$values[2]);
$group[$j][0] = '<table cellpadding="0" cellspacing="0" width="100%" class="h3Row"><tr ><td width="20%" valign="bottom"><h3>' . translate($values[0]) . '</h3></td></tr>';
$addedHeaderGroups[$values[0]] = 1;
if (isset($values[4]))
$group[$j][1] = '<tr><td style="padding-top: 3px; padding-bottom: 5px;">' . translate($values[4]) . '</td></tr></table>';
else
$group[$j][2] = '</tr></table>';
$colnum=0;
$i=0;
$fix = array_keys($values[3]);
if(count($values[3])>1){
//////////////////
$tmp_array = $values[3];
$return_array = array();
foreach ($tmp_array as $mod => $value){
$keys = array_keys($value);
foreach ($keys as $key){
$return_array[$key] = $value[$key];
}
}
$values_3_tab[]= $return_array;
$mod = $return_array;
}
else {
$mod = $values[3][$fix[0]];
$values_3_tab[]= $mod;
}
foreach ($mod as $link_idx =>$admin_option) {
if(!empty($GLOBALS['admin_access_control_links']) && in_array($link_idx, $GLOBALS['admin_access_control_links'])){
continue;
}
$colnum+=1;
$header_image[$j][$i]= SugarThemeRegistry::current()->getImage($admin_option[0],'alt="' . translate($admin_option[1],'Administration') .'" border="0" align="absmiddle"');
$url[$j][$i] = $admin_option[3];
$label = translate($admin_option[1],'Administration');
if(!empty($admin_option['additional_label']))$label.= ' '. $admin_option['additional_label'];
if(!empty($admin_option[4])){
$label = ' <font color="red">'. $label . '</font>';
}
$label_tab[$j][$i]= $label;
$description[$j][$i]= translate($admin_option[2],'Administration');
if (($colnum % 2) == 0) {
$tab[$j][$i]= ($colnum % 2);
}
else {
$tab[$j][$i]= 10;
}
$i+=1;
}
//if the loop above ends with an odd entry add a blank column.
if (($colnum % 2) != 0) {
$tab[$j][$i]= 10;
}
$j+=1;
}
}
}
$sugar_smarty->assign('MY_FRAME',"<iframe class='teamNoticeBox' src='http://www.sugarcrm.com/crm/product/gopro/admin' width='100%' height='315px'></iframe>");
$sugar_smarty->assign("VALUES_3_TAB", $values_3_tab);
$sugar_smarty->assign("ADMIN_GROUP_HEADER", $admin_group_header_tab);
$sugar_smarty->assign("GROUP_HEADER", $group);
$sugar_smarty->assign("ITEM_HEADER_IMAGE", $header_image);
$sugar_smarty->assign("ITEM_URL", $url);
$sugar_smarty->assign("ITEM_HEADER_LABEL",$label_tab);
$sugar_smarty->assign("ITEM_DESCRIPTION", $description);
$sugar_smarty->assign("COLNUM", $tab);
echo $sugar_smarty->fetch('modules/Administration/index.tpl');
?>

View File

@@ -0,0 +1,89 @@
{* <!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
-->
*}
<div class="dashletPanelMenu">
<div class="hd"><div class="tl"></div><div class="hd-center"></div><div class="tr"></div></div>
<div class="bd">
<div class="ml"></div>
<div class="bd-center">
<div class="screen">
{$MY_FRAME}
{foreach from=$ADMIN_GROUP_HEADER key=j item=val1}
{if isset($GROUP_HEADER[$j][1])}
<p>{$GROUP_HEADER[$j][0]}{$GROUP_HEADER[$j][1]}
<table class="other view">
{else}
<p>{$GROUP_HEADER[$j][0]}{$GROUP_HEADER[$j][2]}
<table class="other view">
{/if}
{assign var='i' value=0}
{foreach from=$VALUES_3_TAB[$j] key=link_idx item=admin_option}
{if isset($COLNUM[$j][$i])}
<tr>
<td width="20%" scope="row">{$ITEM_HEADER_IMAGE[$j][$i]}&nbsp;<a href='{$ITEM_URL[$j][$i]}' class="tabDetailViewDL2Link">{$ITEM_HEADER_LABEL[$j][$i]}</a></td>
<td width="30%">{$ITEM_DESCRIPTION[$j][$i]}</td>
{assign var='i' value=$i+1}
{if $COLNUM[$j][$i] == '0'}
<td width="20%" scope="row">{$ITEM_HEADER_IMAGE[$j][$i]}&nbsp;<a href='{$ITEM_URL[$j][$i]}' class="tabDetailViewDL2Link">{$ITEM_HEADER_LABEL[$j][$i]}</a></td>
<td width="30%">{$ITEM_DESCRIPTION[$j][$i]}</td>
{else}
<td width="20%" scope="row">&nbsp;</td>
<td width="30%">&nbsp;</td>
{/if}
</tr>
{/if}
{assign var='i' value=$i+1}
{/foreach}
</table>
<p/>
{/foreach}
</div>
</div>
<div class="mr"></div>
</div>
<div class="ft"><div class="bl"></div><div class="ft-center"></div><div class="br"></div></div>
</div>

View File

@@ -0,0 +1,39 @@
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(typeof(SUGAR)=='undefined'){var SUGAR={};}
SUGAR.Administration={Async:{},RepairXSS:{toRepair:new Object,currentRepairObject:"",currentRepairIds:new Array(),repairedCount:0,numberToFix:25,refreshEstimate:function(select){this.toRepair=new Object();this.repairedCount=0;var button=document.getElementById('repairXssButton');var selected=select.value;var totalDisplay=document.getElementById('repairXssDisplay');var counter=document.getElementById('repairXssCount');var repaired=document.getElementById('repairXssResults');var repairedCounter=document.getElementById('repairXssResultCount');if(selected!="0"){button.style.display='inline';repairedCounter.value=0;AjaxObject.startRequest(callbackRepairXssRefreshEstimate,"&adminAction=refreshEstimate&bean="+selected);}else{button.style.display='none';totalDisplay.style.display='none';repaired.style.display='none';counter.value=0;repaired.value=0;}},executeRepair:function(){if(this.toRepair){if(this.currentRepairIds.length<1){if(!this.loadRepairQueue()){alert(done);return;}}
var beanIds=new Array();for(var i=0;i<this.numberToFix;i++){if(this.currentRepairIds.length>0){beanIds.push(this.currentRepairIds.pop());}}
var beanId=JSON.stringifyNoSecurity(beanIds);AjaxObject.startRequest(callbackRepairXssExecute,"&adminAction=repairXssExecute&bean="+this.currentRepairObject+"&id="+beanId);}},loadRepairQueue:function(){var loaded=false;this.currentRepairObject='';this.currentRepairIds=new Array();for(var bean in this.toRepair){if(this.toRepair[bean].length>0){this.currentRepairObject=bean;this.currentRepairIds=this.toRepair[bean];loaded=true;}}
this.toRepair[this.currentRepairObject]=new Array();return loaded;}}}

View File

@@ -0,0 +1,37 @@
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
var AjaxObject={ret:'',currentRequestObject:null,timeout:30000,forceAbort:false,_reset:function(){this.timeout=30000;this.forceAbort=false;},handleFailure:function(o){alert('asynchronous call failed.');},startRequest:function(callback,args,forceAbort){if(this.currentRequestObject!=null){if(this.forceAbort==true||callback.forceAbort==true){YAHOO.util.Connect.abort(this.currentRequestObject,null,false);}}
this.currentRequestObject=YAHOO.util.Connect.asyncRequest('POST',"./index.php?module=Administration&action=Async&to_pdf=true",callback,args);this._reset();},refreshEstimate:function(o){this.ret=JSON.parse(o.responseText);document.getElementById('repairXssDisplay').style.display='inline';document.getElementById('repairXssCount').value=this.ret.count;SUGAR.Administration.RepairXSS.toRepair=this.ret.toRepair;},showRepairXssResult:function(o){var resultCounter=document.getElementById('repairXssResultCount');this.ret=JSON.parse(o.responseText);document.getElementById('repairXssResults').style.display='inline';if(this.ret.msg=='success'){SUGAR.Administration.RepairXSS.repairedCount+=this.ret.count;resultCounter.value=SUGAR.Administration.RepairXSS.repairedCount;}else{resultCounter.value=this.ret;}
SUGAR.Administration.RepairXSS.executeRepair();}};var callbackRepairXssRefreshEstimate={success:AjaxObject.refreshEstimate,failure:AjaxObject.handleFailure,timeout:AjaxObject.timeout,scope:AjaxObject};var callbackRepairXssExecute={success:AjaxObject.showRepairXssResult,failure:AjaxObject.handleFailure,timeout:AjaxObject.timeout,scope:AjaxObject};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$searchFields['Administration'] =
array (
'user_name' => array(
'query_type'=>'default',
'operator' => 'subquery',
'subquery' => 'SELECT users.id FROM users WHERE users.deleted=0 and users.user_name LIKE',
'db_field'=>array('user_id')),
);
?>

View File

@@ -0,0 +1,195 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $current_user,$admin_group_header;
//users and security.
$admin_option_defs=array();
$admin_option_defs['Users']['user_management']= array('Users','LBL_MANAGE_USERS_TITLE','LBL_MANAGE_USERS','./index.php?module=Users&action=index');
$admin_option_defs['Users']['roles_management']= array('Roles','LBL_MANAGE_ROLES_TITLE','LBL_MANAGE_ROLES','./index.php?module=ACLRoles&action=index');
$admin_option_defs['Administration']['password_management']= array('Password','LBL_MANAGE_PASSWORD_TITLE','LBL_MANAGE_PASSWORD','./index.php?module=Administration&action=PasswordManager');
$admin_group_header[]= array('LBL_USERS_TITLE','',false,$admin_option_defs, 'LBL_USERS_DESC');
//Sugar Connect
$admin_option_defs=array();
$license_key = 'no_key';
$admin_option_defs['Administration']['support']= array('Support','LBL_SUPPORT_TITLE','LBL_SUPPORT','./index.php?module=Administration&action=SupportPortal&view=support_portal');
//$admin_option_defs['documentation']= array('OnlineDocumentation','LBL_DOCUMENTATION_TITLE','LBL_DOCUMENTATION','./index.php?module=Administration&action=SupportPortal&view=documentation&help_module=Administration&edition='.$sugar_flavor.'&key='.$server_unique_key.'&language='.$current_language);
$admin_option_defs['Administration']['update'] = array('sugarupdate','LBL_SUGAR_UPDATE_TITLE','LBL_SUGAR_UPDATE','./index.php?module=Administration&action=Updater');
$admin_option_defs['Administration']['documentation']= array('OnlineDocumentation','LBL_DOCUMENTATION_TITLE','LBL_DOCUMENTATION',
'javascript:void window.open("index.php?module=Administration&action=SupportPortal&view=documentation&help_module=Administration&edition='.$sugar_flavor.'&key='.$server_unique_key.'&language='.$current_language.'", "helpwin","width=600,height=600,status=0,resizable=1,scrollbars=1,toolbar=0,location=0")');
if(!empty($license->settings['license_latest_versions'])){
$encodedVersions = $license->settings['license_latest_versions'];
$versions = unserialize(base64_decode( $encodedVersions));
include('sugar_version.php');
if(!empty($versions)){
foreach($versions as $version){
if($version['version'] > $sugar_version )
{
$admin_option_defs['Administration']['update'][] ='red';
if(!isset($admin_option_defs['Administration']['update']['additional_label']))$admin_option_defs['Administration']['update']['additional_label']= '('.$version['version'].')';
}
}
}
}
$admin_group_header[]= array('LBL_SUGAR_NETWORK_TITLE','',false,$admin_option_defs, 'LBL_SUGAR_NETWORK_DESC');
//system.
$admin_option_defs=array();
$admin_option_defs['Administration']['configphp_settings']= array('Administration','LBL_CONFIGURE_SETTINGS_TITLE','LBL_CONFIGURE_SETTINGS','./index.php?module=Configurator&action=EditView');
if(!defined('TEMPLATE_URL')){
$admin_option_defs['Administration']['upgrade_wizard']= array('Upgrade','LBL_UPGRADE_WIZARD_TITLE','LBL_UPGRADE_WIZARD','./index.php?module=UpgradeWizard&action=index');
}
$admin_option_defs['Administration']['locale']= array('Currencies','LBL_MANAGE_LOCALE','LBL_LOCALE','./index.php?module=Administration&action=Locale&view=default');
$admin_option_defs['Administration']['backup_management']= array('Backups','LBL_BACKUPS_TITLE','LBL_BACKUPS','./index.php?module=Administration&action=Backups');
$admin_option_defs['Administration']['currencies_management']= array('Currencies','LBL_MANAGE_CURRENCIES','LBL_CURRENCY','./index.php?module=Currencies&action=index');
$admin_option_defs['Administration']['repair']= array('Repair','LBL_UPGRADE_TITLE','LBL_UPGRADE','./index.php?module=Administration&action=Upgrade');
$admin_option_defs['Administration']['scheduler'] = array('Schedulers','LBL_SUGAR_SCHEDULER_TITLE','LBL_SUGAR_SCHEDULER','./index.php?module=Schedulers&action=index');
$admin_option_defs['Administration']['diagnostic']= array('Diagnostic','LBL_DIAGNOSTIC_TITLE','LBL_DIAGNOSTIC_DESC','./index.php?module=Administration&action=Diagnostic');
// Theme Enable/Disable
$admin_option_defs['Administration']['theme_settings']=array('icon_AdminThemes','LBL_THEME_SETTINGS','LBL_THEME_SETTINGS_DESC','./index.php?module=Administration&action=ThemeSettings');
$admin_option_defs['Administration']['feed_settings']=array('icon_SugarFeed','LBL_SUGARFEED_SETTINGS','LBL_SUGARFEED_SETTINGS_DESC','./index.php?module=SugarFeed&action=AdminSettings');
// Connector Integration
$admin_option_defs['Administration']['connector_settings']=array('icon_Connectors','LBL_CONNECTOR_SETTINGS','LBL_CONNECTOR_SETTINGS_DESC','./index.php?module=Connectors&action=ConnectorSettings');
//$admin_option_defs['module_loader'] = array('ModuleLoader','LBL_MODULE_LOADER_TITLE','LBL_MODULE_LOADER','./index.php?module=Administration&action=UpgradeWizard&view=module');
$admin_group_header[]= array('LBL_ADMINISTRATION_HOME_TITLE','',false,$admin_option_defs, 'LBL_ADMINISTRATION_HOME_DESC');
//email manager.
$admin_option_defs=array();
$admin_option_defs['Emails']['mass_Email_config']= array('EmailMan','LBL_MASS_EMAIL_CONFIG_TITLE','LBL_MASS_EMAIL_CONFIG_DESC','./index.php?module=EmailMan&action=config');
$admin_option_defs['Campaigns']['campaignconfig']= array('Campaigns','LBL_CAMPAIGN_CONFIG_TITLE','LBL_CAMPAIGN_CONFIG_DESC','./index.php?module=EmailMan&action=campaignconfig');
$admin_option_defs['Emails']['mailboxes']= array('InboundEmail','LBL_MANAGE_MAILBOX','LBL_MAILBOX_DESC','./index.php?module=InboundEmail&action=index');
$admin_option_defs['Campaigns']['mass_Email']= array('EmailMan','LBL_MASS_EMAIL_MANAGER_TITLE','LBL_MASS_EMAIL_MANAGER_DESC','./index.php?module=EmailMan&action=index');
$admin_group_header[]= array('LBL_EMAIL_TITLE','',false,$admin_option_defs, 'LBL_EMAIL_DESC');
//studio.
$admin_option_defs=array();
$admin_option_defs['studio']['studio']= array('Studio','LBL_STUDIO','LBL_STUDIO_DESC','./index.php?module=ModuleBuilder&action=index&type=studio');
if(isset($GLOBSALS['beanFiles']['iFrame'])) {
$admin_option_defs['Administration']['portal']= array('iFrames','LBL_IFRAME','DESC_IFRAME','./index.php?module=iFrames&action=index');
}
$admin_option_defs['Administration']['rename_tabs']= array('RenameTabs','LBL_RENAME_TABS','LBL_CHANGE_NAME_TABS',"./index.php?action=wizard&module=Studio&wizard=StudioWizard&option=RenameTabs");
$admin_option_defs['Administration']['moduleBuilder']= array('ModuleBuilder','LBL_MODULEBUILDER','LBL_MODULEBUILDER_DESC','./index.php?module=ModuleBuilder&action=index&type=mb');
$admin_option_defs['Administration']['configure_tabs']= array('ConfigureTabs','LBL_CONFIGURE_TABS','LBL_CHOOSE_WHICH','./index.php?module=Administration&action=ConfigureTabs');
$admin_option_defs['Administration']['module_loader'] = array('ModuleLoader','LBL_MODULE_LOADER_TITLE','LBL_MODULE_LOADER','./index.php?module=Administration&action=UpgradeWizard&view=module');
$admin_option_defs['Administration']['configure_panels']= array('ConfigureSubPanels','LBL_CONFIGURE_SUBPANELS','LBL_CHOOSE_WHICH_SUBS','./index.php?module=Administration&action=ConfigureSubPanels');
$admin_option_defs['any']['dropdowneditor']= array('Dropdown','LBL_DROPDOWN_EDITOR','DESC_DROPDOWN_EDITOR','./index.php?module=ModuleBuilder&action=index&type=dropdowns');
$admin_option_defs['any']['configure_group_tabs']= array('ConfigureTabs','LBL_CONFIGURE_GROUP_TABS','LBL_CONFIGURE_GROUP_TABS_DESC','./index.php?action=wizard&module=Studio&wizard=StudioWizard&option=ConfigureGroupTabs');
//$admin_option_defs['migrate_custom_fields']= array('MigrateFields','LBL_EXTERNAL_DEV_TITLE','LBL_EXTERNAL_DEV_DESC','./index.php?module=Administration&action=Development');
$admin_group_header[]= array('LBL_STUDIO_TITLE','',false,$admin_option_defs, 'LBL_TOOLS_DESC');
//bug tracker.
$admin_option_defs=array();
$admin_option_defs['Bugs']['bug_tracker']= array('Releases','LBL_MANAGE_RELEASES','LBL_RELEASE','./index.php?module=Releases&action=index');
$admin_group_header[]= array('LBL_BUG_TITLE','',false,$admin_option_defs, 'LBL_BUG_DESC');
if(file_exists('custom/modules/Administration/Ext/Administration/administration.ext.php')){
require_once('custom/modules/Administration/Ext/Administration/administration.ext.php');
}
//For users with MLA access we need to find which entries need to be shown.
//lets process the $admin_group_header and apply all the access control rules.
$access = get_admin_modules_for_user($current_user);
foreach ($admin_group_header as $key=>$values) {
$module_index = array_keys($values[3]); //get the actual links..
foreach ($module_index as $mod_key=>$mod_val) {
if (is_admin($current_user) ||
in_array($mod_val, $access) ||
$mod_val=='studio'||
($mod_val=='Forecasts' && in_array('ForecastSchedule', $access)) ||
($mod_val =='any')
) {
if(!is_admin($current_user)&& isset($values[3]['Administration'])){
unset($values[3]['Administration']);
}
if(displayStudioForCurrentUser() == false) {
unset($values[3]['studio']);
}
if(displayWorkflowForCurrentUser() == false) {
unset($values[3]['any']['workflow_management']);
}
// Need this check because Quotes and Products share the header group
if(!in_array('Quotes', $access)&& isset($values[3]['Quotes'])){
unset($values[3]['Quotes']);
}
if(!in_array('Products', $access)&& isset($values[3]['Products'])){
unset($values[3]['Products']);
}
// Need this check because Emails and Campaigns share the header group
if(!in_array('Campaigns', $access)&& isset($values[3]['Campaigns'])){
unset($values[3]['Campaigns']);
}
//////////////////
} else {
//hide the link
unset($admin_group_header[$key][3][$mod_val]);
}
}
}
?>

View File

@@ -0,0 +1,37 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$ncc_config = array('value' => '1.2');
?>

View File

@@ -0,0 +1,163 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $current_user, $beanFiles;
set_time_limit(3600);
$db = DBManagerFactory::getInstance();
if (is_admin($current_user) || isset ($from_sync_client) || is_admin_for_any_module($current_user)) {
isset($_REQUEST['execute'])? $execute=$_REQUEST['execute'] : $execute= false;
$export = false;
if (sizeof($_POST) && isset ($_POST['raction'])) {
if (isset ($_POST['raction']) && strtolower($_POST['raction']) == "export") {
//jc - output buffering is being used. if we do not clean the output buffer
//the contents of the buffer up to the length of the repair statement(s)
//will be saved in the file...
ob_clean();
header("Content-Disposition: attachment; filename=repairSugarDB.sql");
header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Content-Length: " . strlen($_POST['sql']));
//jc:7347 - for whatever reason, html_entity_decode is choking on converting
//the html entity &#039; to a single quote, so we will use str_replace
//instead
$sql = str_replace('&#039;',"'", $_POST['sql']);
//echo html_entity_decode($_POST['sql']);
echo $sql;
}
elseif (isset ($_POST['raction']) && strtolower($_POST['raction']) == "execute") {
$sql = str_replace(
array(
"\n",
'&#039;',
),
array(
'',
"'",
),
preg_replace('#(/\*.+?\*/\n*)#', '', $_POST['sql'])
);
foreach (explode(";", $sql) as $stmt) {
$stmt = trim($stmt);
if (!empty ($stmt)) {
$db->query($stmt,true,'Executing repair query: ');
}
}
echo "<h3>{$mod_strings['LBL_REPAIR_DATABASE_SYNCED']}</h3>";
}
} else {
if (!$export && empty ($_REQUEST['repair_silent'])) {
if ( empty($hideModuleMenu) )
echo get_module_title($mod_strings['LBL_REPAIR_DATABASE'], $mod_strings['LBL_REPAIR_DATABASE'], true);
echo "<h1 id=\"rdloading\">{$mod_strings['LBL_REPAIR_DATABASE_PROCESSING']}</h1>";
ob_flush();
}
$sql = '';
VardefManager::clearVardef();
$repairedTables = array();
foreach ($beanFiles as $bean => $file) {
if(file_exists($file)){
require_once ($file);
unset($GLOBALS['dictionary'][$bean]);
$focus = new $bean ();
if (($focus instanceOf SugarBean) && !isset($repairedTables[$focus->table_name])) {
$sql .= $db->repairTable($focus, $execute);
$repairedTables[$focus->table_name] = true;
}
}
}
$olddictionary = $dictionary;
unset ($dictionary);
include ('modules/TableDictionary.php');
foreach ($dictionary as $meta) {
$tablename = $meta['table'];
if (isset($repairedTables[$tablename])) continue;
$fielddefs = $meta['fields'];
$indices = $meta['indices'];
$sql .= $db->repairTableParams($tablename, $fielddefs, $indices, $execute);
$repairedTables[$tablename] = true;
}
$dictionary = $olddictionary;
if (empty ($_REQUEST['repair_silent'])) {
echo "<script type=\"text/javascript\">document.getElementById('rdloading').style.display = \"none\";</script>";
if (isset ($sql) && !empty ($sql)) {
$qry_str = "";
foreach (explode("\n", $sql) as $line) {
if (!empty ($line) && substr($line, -2) != "*/") {
$line .= ";";
}
$qry_str .= $line . "\n";
}
$ss = new Sugar_Smarty();
$ss->assign('MOD', $GLOBALS['mod_strings']);
$ss->assign('qry_str', $qry_str);
echo $ss->fetch('modules/Administration/templates/RepairDatabase.tpl');
} else {
echo "<h3>{$mod_strings['LBL_REPAIR_DATABASE_SYNCED']}</h3>";
}
}
}
} else {
die('Admin Only Section');
}

View File

@@ -0,0 +1,96 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $mod_strings;
global $current_language;
$smarty = new Sugar_Smarty();
$temp_bean_list = $beanList;
asort($temp_bean_list);
$values= array_values($temp_bean_list);
$output= array_keys($temp_bean_list);
$output_local = array();
if($current_language != 'en_us') {
foreach($output as $temp_out) {
$output_local[] = translate($temp_out);
}
} else {
$output_local = $output;
}
//sort($output);
//sort($values);
$values=array_merge(array($mod_strings['LBL_ALL_MODULES']), $values);
$output= array_merge(array($mod_strings['LBL_ALL_MODULES']),$output_local);
$checkbox_values=array(
'clearTpls',
'clearJsFiles',
'clearVardefs',
'clearJsLangFiles',
'clearDashlets',
'clearSugarFeedCache',
'clearThemeCache',
'rebuildAuditTables',
'rebuildExtensions',
'clearLangFiles',
'clearSearchCache',
'clearPDFFontCache',
//'repairDatabase'
);
$checkbox_output = array( $mod_strings['LBL_QR_CBOX_CLEARTPL'],
$mod_strings['LBL_QR_CBOX_CLEARJS'],
$mod_strings['LBL_QR_CBOX_CLEARVARDEFS'],
$mod_strings['LBL_QR_CBOX_CLEARJSLANG'],
$mod_strings['LBL_QR_CBOX_CLEARDASHLET'],
$mod_strings['LBL_QR_CBOX_CLEARSUGARFEEDCACHE'],
$mod_strings['LBL_QR_CBOX_CLEARTHEMECACHE'],
$mod_strings['LBL_QR_CBOX_REBUILDAUDIT'],
$mod_strings['LBL_QR_CBOX_REBUILDEXT'],
$mod_strings['LBL_QR_CBOX_CLEARLANG'],
$mod_strings['LBL_QR_CBOX_CLEARSEARCH'],
$mod_strings['LBL_QR_CBOX_CLEARPDFFONT'],
//$mod_strings['LBL_QR_CBOX_DATAB'],
);
$smarty->assign('checkbox_values', $checkbox_values);
$smarty->assign('values', $values);
$smarty->assign('output', $output);
$smarty->assign('MOD', $mod_strings);
$smarty->assign('checkbox_output', $checkbox_output);
$smarty->assign('checkbox_values', $checkbox_values);
$smarty->display("modules/Administration/templates/QuickRepairAndRebuild.tpl");
?>

View File

@@ -0,0 +1,55 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $sugar_config, $mod_strings;
$search_dir='cache/';
if (!empty($sugar_config['cache_dir'])) {
$search_dir=$sugar_config['cache_dir'];
}
$src_file = $search_dir . 'modules/unified_search_modules.php';
if(file_exists($src_file)) {
print( $mod_strings['LBL_CLEAR_UNIFIED_SEARCH_CACHE_DELETING1'] . "<br>" );
print( $mod_strings['LBL_CLEAR_UNIFIED_SEARCH_CACHE_DELETING2'] . " $src_file<BR>" ) ;
unlink( "$src_file" );
}
echo "\n--- " . $mod_strings['LBL_DONE'] . "---<br />\n";
?>

View File

@@ -0,0 +1,48 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<form>
<h3>{$MOD.LBL_QUICK_REPAIR_TITLE}</h3><br/>
<input type="hidden" name="action" value="QuickRepairAndRebuild"/>
<input type="hidden" name="subaction" value="repairAndClearAll"/> <!--Switch based on $_REQUEST type!-->
<input type="hidden" name="module" value="Administration"/>
{html_options multiple ="1" size="10" name=repair_module[] values=$values output=$output selected=$MOD.LBL_ALL_MODULES}
<br/><br/>
{html_checkboxes name="selected_actions" values = $checkbox_values output = $checkbox_output separator="<br />" selected=$checkbox_values }
<br/>
<input class="button" type="submit" value="{$MOD.LBL_REPAIR}"/>
</form>

View File

@@ -0,0 +1,47 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<h3>{$MOD.LBL_REPAIR_DATABASE_DIFFERENCES}</h3>
<p>{$MOD.LBL_REPAIR_DATABASE_TEXT}</p>
<form name="RepairDatabaseForm" method="post">
<input type="hidden" name="module" value="Administration"/>
<input type="hidden" name="action" value="repairDatabase"/>
<input type="hidden" name="raction" value="execute"/>
<textarea name="sql" rows="24" cols="150" id="repairsql">{$qry_str}</textarea>
<br/>
<input type="button" class="button" value="{$MOD.LBL_REPAIR_DATABASE_EXECUTE}" onClick="document.RepairDatabaseForm.submit();"/>
<input type="button" class="button" value="{$MOD.LBL_REPAIR_DATABASE_EXPORT}" onClick="document.RepairDatabaseForm.raction.value='export'; document.RepairDatabaseForm.submit();"/>

View File

@@ -0,0 +1,60 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<script src="./modules/Administration/javascript/Administration.js"></script>
<script src="./modules/Administration/javascript/Async.js"></script>
<script src="./include/JSON.js"></script>
<div>
{$mod.LBL_REPAIRXSS_INSTRUCTIONS}
</div>
<br>
<div id="cleanXssMain">
{$beanDropDown} <div id="repairXssButton" style="display:none;">
<input type="button" class="button" onclick="SUGAR.Administration.RepairXSS.executeRepair();" value=" {$mod.LBL_EXECUTE} ">
</div>
</div>
<br>
<div id="repairXssDisplay" style="display:none;">
<input size='5' type="text" disabled id="repairXssCount" value="0"> {$mod.LBL_REPAIRXSS_COUNT}
</div>
<br>
<div id="repairXssResults" style="display:none;">
<input size='5' type="text" disabled id="repairXssResultCount" value="0"> {$mod.LBL_REPAIRXSS_REPAIRED}
</div>

View File

@@ -0,0 +1,169 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<script type="text/javascript" src="include/javascript/sugar_grp_yui_widgets.js"></script>
<link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
<style>.yui-dt-scrollable .yui-dt-bd {ldelim}overflow-x: hidden;{rdelim}</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan='100'><h2>{$title}</h2></td></tr>
<tr><td><i class="info">{$msg}</i></td></tr>
<td colspan='100'>
{if empty($msg)}
<form name="ConfigureShortcutBar" method="POST" method="POST" action="index.php">
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="ConfigureShortcutBar">
<input type="hidden" id="enabled_modules" name="enabled_modules" value="">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="SUGAR.saveShortcutBar();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" >
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
</td>
</tr>
</table>
<div class='add_table' style='margin-bottom:5px'>
<table id="ConfigureTabs" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
<tr>
<td width='1%'>
<div id="enabled_div"></div>
</td>
<td>
<div id="disabled_div"></div>
</td>
</tr>
</table>
</div>
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="SUGAR.saveShortcutBar();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" >
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
</td>
</tr>
</table>
</form>
<script type="text/javascript">
(function(){ldelim}
var Connect = YAHOO.util.Connect;
Connect.url = 'index.php';
Connect.method = 'POST';
Connect.timeout = 300000;
var enabled_modules = {$enabled_modules};
var disabled_modules = {$disabled_modules};
var lblEnabled = '{sugar_translate label="LBL_ACTIVE_MODULES"}';
var lblDisabled = '{sugar_translate label="LBL_DISABLED_MODULES"}';
{literal}
SUGAR.prodEnabledTable = new YAHOO.SUGAR.DragDropTable(
"enabled_div",
[{key:"label", label: lblEnabled, width: 200, sortable: false},
{key:"module", label: lblEnabled, hidden:true}],
new YAHOO.util.LocalDataSource(enabled_modules, {
responseSchema: {
resultsList : "modules",
fields : [{key : "module"}, {key : "label"}]
}
}),
{height: "300px"}
);
SUGAR.prodDisabledTable = new YAHOO.SUGAR.DragDropTable(
"disabled_div",
[{key:"label", label: lblDisabled, width: 200, sortable: false},
{key:"module", label: lblDisabled, hidden:true}],
new YAHOO.util.LocalDataSource(disabled_modules, {
responseSchema: {
resultsList : "modules",
fields : [{key : "module"}, {key : "label"}]
}
}),
{height: "300px"}
);
SUGAR.prodEnabledTable.disableEmptyRows = true;
SUGAR.prodDisabledTable.disableEmptyRows = true;
SUGAR.prodEnabledTable.addRow({module: "", label: ""});
SUGAR.prodDisabledTable.addRow({module: "", label: ""});
SUGAR.prodEnabledTable.render();
SUGAR.prodDisabledTable.render();
SUGAR.saveShortcutBar = function()
{
var enabledTable = SUGAR.prodEnabledTable;
var modules = [];
if ( enabledTable.getRecordSet().getLength() > 11) //Max 10 + empty line
{
alert('{/literal}{sugar_translate label="LBL_ERROR_PROD_BAR_NUM_MODULES"}{literal}');
return false;
}
for(var i=0; i < enabledTable.getRecordSet().getLength(); i++){
var data = enabledTable.getRecord(i).getData();
if (data.module && data.module != '')
modules[i] = data.module;
}
ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
//YAHOO.SUGAR.MessageBox.show({title:"saving",msg:"Saving",close:false})
Connect.asyncRequest(
Connect.method,
Connect.url,
{success: SUGAR.saveCallBack},
'to_pdf=1&module=Administration&action=ConfigureShortcutBar&enabled_modules=' + YAHOO.lang.JSON.stringify(modules)
);
return true;
}
SUGAR.saveCallBack = function(o)
{
ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
if (o.responseText == "true")
{
window.location.assign('index.php?module=Administration&action=ConfigureShortcutBar');
}
else
{
YAHOO.SUGAR.MessageBox.show({msg:o.responseText});
}
}
})();
{/literal}
</script>
{/if}

View File

@@ -0,0 +1,148 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<script type="text/javascript" src="include/javascript/sugar_grp_yui_widgets.js"></script>
<link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
<form name="themeSettings" method="POST">
<input type="hidden" name="module" value="Administration">
<input type="hidden" name="action" value="ThemeSettings">
<input type="hidden" name="disabled_themes" value="">
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" onclick="SUGAR.saveThemeSettings();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
<input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.themeSettings.action.value='';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
</td>
</tr>
</table>
<div class='add_table' style='margin-bottom:5px'>
<table id="themeSettings" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
<tr>
<td width='1%'>
<div id="enabled_div"></div>
</td>
<td>
<div id="disabled_div"></div>
</td>
</tr>
</table>
</div>
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" onclick="SUGAR.saveThemeSettings();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
<input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.themeSettings.action.value='';" type="submit" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
</td>
</tr>
</table>
</form>
<script type="text/javascript">
(function(){ldelim}
var Connect = YAHOO.util.Connect;
Connect.url = 'index.php';
Connect.method = 'POST';
Connect.timeout = 300000;
var enabled_modules = {$enabled_modules};
var disabled_modules = {$disabled_modules};
var lblEnabled = '{sugar_translate label="LBL_ACTIVE_THEMES"}';
var lblDisabled = '{sugar_translate label="LBL_DISABLED_THEMES"}';
{literal}
SUGAR.themeEnabledTable = new YAHOO.SUGAR.DragDropTable(
"enabled_div",
[{key:"theme", label: lblEnabled, width: 200, sortable: false},
{key:"dir", hidden:true}],
new YAHOO.util.LocalDataSource(enabled_modules, {
responseSchema: {fields : [{key : "theme"}, {key : "dir"}]}
}),
{height: "300px"}
);
SUGAR.themeDisabledTable = new YAHOO.SUGAR.DragDropTable(
"disabled_div",
[{key:"theme", label: lblDisabled, width: 200, sortable: false},
{key:"dir", hidden:true}],
new YAHOO.util.LocalDataSource(disabled_modules, {
responseSchema: {fields : [{key : "theme"}, {key : "dir"}]}
}),
{height: "300px"}
);
SUGAR.themeEnabledTable.disableEmptyRows = true;
SUGAR.themeDisabledTable.disableEmptyRows = true;
SUGAR.themeEnabledTable.addRow({module: "", label: ""});
SUGAR.themeDisabledTable.addRow({module: "", label: ""});
SUGAR.themeEnabledTable.render();
SUGAR.themeDisabledTable.render();
SUGAR.saveThemeSettings = function()
{
var disabledTable = SUGAR.themeDisabledTable;
var themes = [];
for(var i=0; i < disabledTable.getRecordSet().getLength(); i++){
var data = disabledTable.getRecord(i).getData();
if (data.dir && data.dir != '')
themes[i] = data.dir;
}
ajaxStatus.showStatus(SUGAR.language.get('Administration', 'LBL_SAVING'));
Connect.asyncRequest(
Connect.method,
Connect.url,
{success: SUGAR.saveCallBack},
'to_pdf=1&module=Administration&action=ThemeSettings&disabled_themes=' + YAHOO.lang.JSON.stringify(themes)
);
return true;
}
SUGAR.saveCallBack = function(o)
{
ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_DONE'));
if (o.responseText == "true")
{
window.location.assign('index.php?module=Administration&action=ThemeSettings');
}
else
{
YAHOO.SUGAR.MessageBox.show({msg:o.responseText});
}
}
})();
{/literal}
</script>

View File

@@ -0,0 +1,53 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require("include/modules.php");
foreach ($beanFiles as $Classname => $filename){
// Find the name of the file generated by the updateclass script
$pos=strrpos($filename,"/");
$Newfilename=substr_replace($filename, 'SugarCore.', $pos+1, 0);
//delete the new SugarBean that extends CoreBean and replace it by the old one undoing all the changes
if (file_exists($Newfilename)){
unlink($filename);
$handle = file_get_contents($Newfilename);
$data = preg_replace("/class SugarCore".$Classname."/", 'class '.$Classname, $handle);
$data1 = preg_replace("/function SugarCore".$Classname."/", 'function '.$Classname, $data);
file_put_contents($Newfilename,$data1);
rename($Newfilename,$filename);
}
}
?>

View File

@@ -0,0 +1,171 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
?>
<form action='index.php' method="POST">
<input type='hidden' name='action' value='updateTimezonePrefs'>
<input type='hidden' name='module' value='Administration'>
<table>
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
$prompt_users = 'checked';
if(isset($_POST['preview']) && !isset($_POST['prompt_users'])){
$prompt_users = '';
}
$result = $db->query("SELECT id, user_preferences, user_name FROM users");
$execute = false;
// loop through user preferences and check for "bad" elements; rebuild preferences array and update database
if(isset($_POST['execute'])){
$execute = true;
}
$serverTimeZone = lookupTimezone(0);
while ($row = $db->fetchByAssoc($result)) {
$adjustment = 'none';
if(isset($_POST[$row['id'].'adjust'])){
$adjustment = $_POST[$row['id'].'adjust'];
}
$string = "Preview";
if($execute)$string = "Updating";
echo "<tr><td> $string timezone preferences for user <b>{$row['user_name']}</b>...</td><td>";
$prefs = array();
$newprefs = array();
$prefs = unserialize(base64_decode($row['user_preferences']));
$setTo = '';
$alreadySet = '';
if(!empty($prefs)){
foreach ($prefs as $key => $val) {
if ($key == 'timez') {
if(empty($prefs['timezone']) && $val != ''){
$hourAdjust = $adjustment;
if($hourAdjust == 'none'){
$hourAdjust = 0;
}
$selectedZone = lookupTimezone($prefs['timez'] + $hourAdjust);
if(!empty($selectedZone)){
$newprefs['timezone'] = $selectedZone;
$newprefs['timez'] = $val;
$setTo = $selectedZone;
if(empty($prompt_users)){
$newprefs['ut']=1;
}else{
$newprefs['ut']=0;
}
}else{
$newprefs['timezone'] = $serverTimeZone;
$newprefs['timez'] = $val;
$setTo = $serverTimeZone;
if(empty($prompt_users)){
$newprefs['ut']=1;
}else{
$newprefs['ut']=0;
}
}
}else{
$newprefs[$key] = $val;
if(!empty($prefs['timezone'])){
$alreadySet = 'Previously Set - '. $prefs['timezone'];
}
}
}else{
$newprefs[$key] = $val;
}
}
if($execute){
$newstr = mysql_real_escape_string(base64_encode(serialize($newprefs)));
$db->query("UPDATE users SET user_preferences = '{$newstr}' WHERE id = '{$row['id']}'");
}
}
if(!empty($setTo)){
echo $setTo;
}else{
if(!empty($alreadySet)){
echo $alreadySet;
}else{
echo $serverTimeZone;
$prefs['timezone'] = $serverTimeZone;
}
}
echo "</td><td>";
if(!empty($setTo)){
echo "Adjust: ";
if($execute){
if(isset($_POST[$row['id'].'adjust'])){
echo $adjustment;
}
}else{
echo "<select name='{$row['id']}adjust'>";
echo get_select_options_with_id(array('-1'=>'-1', 'none'=>'0', '1'=>'+1'), $adjustment.'');
echo '</select>';
}
echo ' hour';
}
echo ' </td><td>';
echo "</tr>";
$the_old_prefs[] = $prefs;
$the_new_prefs[] = $newprefs;
unset($prefs);
unset($newprefs);
unset($newstr);
}
echo "</table>";
if($execute){
echo "<br>All timezone preferences updated!<br><br>";
}else{
echo "Prompt users on login to confirm:<input type='checkbox' name='prompt_users' value='1' $prompt_users><br>";
echo "<input class='button' type='submit' name='execute' value='Execute'>&nbsp; <input class='button' type='submit' name='preview' value='Preview'>";
}
echo "&nbsp;<input class='button' type='button' name='Done' value='Done' onclick='document.location.href=\"index.php?action=DstFix&module=Administration\"'>";
?>
</form>

View File

@@ -0,0 +1,109 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require("include/modules.php");
require_once("include/utils/sugar_file_utils.php");
foreach ($beanFiles as $classname => $filename){
if (file_exists($filename)){
// Rename the class and its constructor adding SugarCore at the beginning (Ex: class SugarCoreCall)
$handle = file_get_contents($filename);
$patterns = array ('/class '.$classname.'/','/function '.$classname.'/');
$replace = array ('class SugarCore'.$classname,'function SugarCore'.$classname);
$data = preg_replace($patterns,$replace, $handle);
sugar_file_put_contents($filename,$data);
// Rename the SugarBean file into SugarCore.SugarBean (Ex: SugarCore.Call.php)
$pos=strrpos($filename,"/");
$newfilename=substr_replace($filename, 'SugarCore.', $pos+1, 0);
sugar_rename($filename,$newfilename);
//Create a new SugarBean that extends CoreBean
$fileHandle = sugar_fopen($filename, 'w') ;
$newclass = <<<FABRICE
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(!class_exists('$classname')){
if (file_exists('custom/$filename')){
require('custom/$filename');
}
else{
require('$newfilename');
class $classname extends SugarCore$classname{}
}
}
?>
FABRICE;
fwrite($fileHandle, $newclass);
fclose($fileHandle);
}
}
?>

View File

@@ -0,0 +1,421 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
require_once('include/utils/encryption_utils.php');
function getSystemInfo($send_usage_info=true){
global $sugar_config;
global $db, $authLevel, $administration;
$info=array();
$info = getBaseSystemInfo($send_usage_info);
if($send_usage_info){
if($authLevel > 0){
if(isset($_SERVER['SERVER_ADDR']))
$info['ip_address'] = $_SERVER['SERVER_ADDR'];
else
$info['ip_address'] = '127.0.0.1';
}
$info['application_key']=$sugar_config['unique_key'];
$info['php_version']=phpversion();
if(isset($_SERVER['SERVER_SOFTWARE'])) {
$info['server_software'] = $_SERVER['SERVER_SOFTWARE'];
} // if
//get user count.
$user_list = get_user_array(false, "Active", "", false, null, " AND is_group=0 AND portal_only=0 ", false);
$info['users']=count($user_list);
if(empty($administration)){
$administration = new Administration();
}
$administration->retrieveSettings('system');
$info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):'';
$query="select count(*) count from users where status='Active' and deleted=0 and is_admin='1'";
$result=$db->query($query, 'fetching admin count', false);
$row = $db->fetchByAssoc($result);
if(!empty($row)) {
$info['admin_users'] = $row['count'];
}
if(empty($authLevel)){
$authLevel = 0;
}
$query="select count(*) count from users";
$result=$db->query($query, 'fetching all users count', false);
$row = $db->fetchByAssoc($result);
if(!empty($row)) {
$info['registered_users'] = $row['count'];
}
$lastMonth = db_convert("'".date($GLOBALS['timedate']->get_db_date_time_format() , strtotime('-1 month')) . "'", 'datetime');
if( !$send_usage_info){
$info['users_active_30_days'] = -1;
}
else{
$query = "SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND tracker.date_modified >= $lastMonth";
$result=$db->query($query, 'fetching last 30 users count', false);
$row = $db->fetchByAssoc($result);
$info['users_active_30_days'] = $row['user_count'];
}
if(!$send_usage_info){
$info['latest_tracker_id'] = -1;
}else{
$query="select id from tracker order by date_modified desc";
$id=$db->getOne($query,'fetching most recent tracker entry',false);
if ( $id !== false )
$info['latest_tracker_id'] = $id;
}
$dbManager = &DBManagerFactory::getInstance();
$info['db_type']=$sugar_config['dbconfig']['db_type'];
$info['db_version']=$dbManager->version();
}
if(file_exists('distro.php')){
include('distro.php');
if(!empty($distro_name))$info['distro_name'] = $distro_name;
}
$info['auth_level'] = $authLevel;
$info['os'] = php_uname('s');
$info['os_version'] = php_uname('r');
$info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone');
$info['timezone'] = date('e');
if($info['timezone'] == 'e'){
$info['timezone'] = date('T');
}
return $info;
}
function getBaseSystemInfo($send_usage_info=true){
global $authLevel;
include('sugar_version.php');
$info=array();
if($send_usage_info){
$info['sugar_db_version']=$sugar_db_version;
}
$info['sugar_version']=$sugar_version;
$info['sugar_flavor']=$sugar_flavor;
$info['auth_level'] = $authLevel;
return $info;
}
function check_now($send_usage_info=true, $get_request_data=false, $response_data = false, $from_install=false ) {
global $sugar_config, $timedate;
global $db, $license;
$return_array=array();
if(!$from_install && empty($license))loadLicense(true);
if(!$response_data){
if($from_install){
$info = getBaseSystemInfo(false);
}else{
$info = getSystemInfo($send_usage_info);
}
require_once('include/nusoap/nusoap.php');
$GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
$sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15);
$ping = $sclient->call('sugarPing', array());
if(empty($ping) || $sclient->getError()){
$sclient = '';
}
if(empty($sclient)){
$GLOBALS['log']->debug('USING HTTP TO CONNECT TO HEARTBEAT');
$sclient = new nusoapclient('http://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15);
}
$key = '4829482749329';
$encoded = sugarEncode($key, serialize($info));
if($get_request_data){
$request_data = array('key'=>$key, 'data'=>$encoded);
return serialize($request_data);
}
$encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
}else{
$encodedResult = $response_data['data'];
$key = $response_data['key'];
}
if($response_data || !$sclient->getError()){
$serializedResultData = sugarDecode($key,$encodedResult);
$resultData = unserialize($serializedResultData);
if($response_data && empty($resultData))$resultData['validation'] = 'invalid validation key';
}else
{
$resultData = array();
$resultData['versions'] = array();
}
if($response_data || !$sclient->getError() )
{
if(!empty($resultData['msg'])){
if(!empty($resultData['msg']['admin'])){
$license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
}else{
$license->saveSetting('license', 'msg_admin','');
}
if(!empty($resultData['msg']['all'])){
$license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
}else{
$license->saveSetting('license', 'msg_all','');
}
}else{
$license->saveSetting('license', 'msg_admin','');
$license->saveSetting('license', 'msg_all','');
}
$license->saveSetting('license', 'last_validation', 'success');
unset($_SESSION['COULD_NOT_CONNECT']);
}
else
{
$resultData = array();
$resultData['versions'] = array();
$license->saveSetting('license', 'last_connection_fail', gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$license->saveSetting('license', 'last_validation', 'no_connection');
if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){
$license->saveSetting('license', 'vk_end_date', gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false))));
}
$_SESSION['COULD_NOT_CONNECT'] =gmdate($GLOBALS['timedate']->get_db_date_time_format());
}
if(!empty($resultData['versions'])){
$license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
}else{
$resultData['versions'] = array();
$license->saveSetting('license', 'latest_versions','') ;
}
include('sugar_version.php');
if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version']) && $resultData['versions'][0]['version'] < $sugar_version)
{
$resultData['versions'][0]['version'] = $sugar_version;
$resultData['versions'][0]['description'] = "You have the latest version.";
}
return $resultData['versions'];
}
function set_CheckUpdates_config_setting($value) {
$admin=new Administration();
$admin->saveSetting('Update','CheckUpdates',$value);
}
/* return's value for the 'CheckUpdates' config setting
* if the setting does not exist one gets created with a default value of automatic.
*/
function get_CheckUpdates_config_setting() {
$checkupdates='automatic';
$admin=new Administration();
$admin=$admin->retrieveSettings('Update',true);
if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) {
$admin->saveSetting('Update','CheckUpdates','automatic');
} else {
$checkupdates=$admin->settings['Update_CheckUpdates'];
}
return $checkupdates;
}
function set_last_check_version_config_setting($value) {
$admin=new Administration();
$admin->saveSetting('Update','last_check_version',$value);
}
function get_last_check_version_config_setting() {
$admin=new Administration();
$admin=$admin->retrieveSettings('Update');
if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) {
return null;
} else {
return $admin->settings['Update_last_check_version'];
}
}
function set_last_check_date_config_setting($value) {
$admin=new Administration();
$admin->saveSetting('Update','last_check_date',$value);
}
function get_last_check_date_config_setting() {
$admin=new Administration();
$admin=$admin->retrieveSettings('Update');
if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) {
return 0;
} else {
return $admin->settings['Update_last_check_date'];
}
}
function set_sugarbeat($value) {
global $sugar_config;
$_SUGARBEAT="sugarbeet";
$sugar_config[$_SUGARBEAT] = $value;
write_array_to_file( "sugar_config", $sugar_config, "config.php" );
}
function get_sugarbeat() {
global $sugar_config;
$_SUGARBEAT="sugarbeet";
if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) {
return false;
}
return true;
}
function shouldCheckSugar(){
global $license;
if(
get_CheckUpdates_config_setting() == 'automatic' ){
return true;
}
return false;
}
function loadLicense($firstLogin=false){
$GLOBALS['license']=new Administration();
$GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin);
}
function loginLicense(){
global $current_user, $license, $authLevel;
loadLicense(true);
$authLevel = 0;
if (shouldCheckSugar()) {
$last_check_date=get_last_check_date_config_setting();
$current_date_time=time();
$time_period=3*23*3600 ;
if (($current_date_time - $last_check_date) > $time_period
) {
$version = check_now(get_sugarbeat());
unset($_SESSION['license_seats_needed']);
loadLicense();
set_last_check_date_config_setting("$current_date_time");
include('sugar_version.php');
if(!empty($version)&& count($version) == 1 && $version[0]['version'] > $sugar_version && is_admin($current_user))
{
//set session variables.
$_SESSION['available_version']=$version[0]['version'];
$_SESSION['available_version_description']=$version[0]['description'];
set_last_check_version_config_setting($version[0]['version']);
}
}
}
}
?>

View File

@@ -0,0 +1,121 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* Searches through the installed relationships to find broken self referencing one-to-many relationships
* (wrong field used in the subpanel, and the left link not marked as left)
*/
function upgrade_custom_relationships($modules = array())
{
global $current_user, $moduleList;
if (!is_admin($current_user)) die('Admin Only Section');
require_once("modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php");
require_once("modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php");
if (empty($modules))
$modules = $moduleList;
foreach($modules as $module)
{
$depRels = new DeployedRelationships($module);
$relList = $depRels->getRelationshipList();
foreach($relList as $relName)
{
$relObject = $depRels->get($relName);
$def = $relObject->getDefinition();
//We only need to fix self referencing one to many relationships
if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many")
{
$layout_defs = array();
if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
continue;
//Find the extension file containing the vardefs for this relationship
foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
{
if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
{
$dictionary = array($module => array("fields" => array()));
$filePath = "custom/Extension/modules/$module/Ext/Vardefs/$file";
include($filePath);
if(isset($dictionary[$module]["fields"][$relName]))
{
$rhsDef = $dictionary[$module]["fields"][$relName];
//Update the vardef for the left side link field
if (!isset($rhsDef['side']) || $rhsDef['side'] != 'left')
{
$rhsDef['side'] = 'left';
$fileContents = file_get_contents($filePath);
$out = preg_replace(
'/\$dictionary[\w"\'\[\]]*?' . $relName . '["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
'$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";",
$fileContents
);
file_put_contents($filePath, $out);
}
}
}
}
//Find the extension file containing the subpanel definition for this relationship
foreach(scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
{
if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
{
$layout_defs = array($module => array("subpanel_setup" => array()));
$filePath = "custom/Extension/modules/$module/Ext/Layoutdefs/$file";
include($filePath);
foreach($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
{
if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName)
{
$fileContents = file_get_contents($filePath);
$out = preg_replace(
'/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]' . $relName . '[\'"],/s',
"'get_subpanel_data' => '{$def["join_key_lhs"]}',",
$fileContents
);
file_put_contents($filePath, $out);
}
}
}
}
}
}
}
}
if (isset($_REQUEST['execute']) && $_REQUEST['execute'])
upgrade_custom_relationships();

View File

@@ -0,0 +1,148 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$dictionary['Administration'] = array('table' => 'config', 'comment' => 'System table containing system-wide definitions'
,'fields' => array (
'category' =>
array (
'name' => 'category',
'vname' => 'LBL_LIST_SYMBOL',
'type' => 'varchar',
'len' => '32',
'comment' => 'Settings are grouped under this category; arbitraily defined based on requirements'
),
'name' =>
array (
'name' => 'name',
'vname' => 'LBL_LIST_NAME',
'type' => 'varchar',
'len' => '32',
'comment' => 'The name given to the setting'
),
'value' =>
array (
'name' => 'value',
'vname' => 'LBL_LIST_RATE',
'type' => 'text',
'comment' => 'The value given to the setting'
),
), 'indices'=>array( array('name'=>'idx_config_cat', 'type'=>'index', 'fields'=>array('category')),)
);
$dictionary['UpgradeHistory'] = array(
'table' => 'upgrade_history', 'comment' => 'Tracks Sugar upgrades made over time; used by Upgrade Wizard and Module Loader',
'fields' => array (
'id' => array (
'name' => 'id',
'type' => 'id',
'required' => true,
'reportable' => false,
'comment' => 'Unique identifier'
),
'filename' => array (
'name' => 'filename',
'type' => 'varchar',
'len' => '255',
'comment' => 'Cached filename containing the upgrade scripts and content'
),
'md5sum' => array (
'name' => 'md5sum',
'type' => 'varchar',
'len' => '32',
'comment' => 'The MD5 checksum of the upgrade file'
),
'type' => array (
'name' => 'type',
'type' => 'varchar',
'len' => '30',
'comment' => 'The upgrade type (module, patch, theme, etc)'
),
'status' => array (
'name' => 'status',
'type' => 'varchar',
'len' => '50',
'comment' => 'The status of the upgrade (ex: "installed")',
),
'version' => array (
'name' => 'version',
'type' => 'varchar',
'len' => '10',
'comment' => 'Version as contained in manifest file'
),
'name' => array (
'name' => 'name',
'type' => 'varchar',
'len' => '255',
),
'description' => array (
'name' => 'description',
'type' => 'text',
),
'id_name' => array (
'name' => 'id_name',
'type' => 'varchar',
'len' => '255',
'comment' => 'The unique id of the module'
),
'manifest' => array (
'name' => 'manifest',
'type' => 'longtext',
'comment' => 'A serialized copy of the manifest file.'
),
'date_entered' => array (
'name' => 'date_entered',
'type' => 'datetime',
'required'=>true,
'comment' => 'Date of upgrade or module load'
),
'enabled' => array(
'name' => 'enabled',
'type' => 'bool',
'len' => '1',
'default' => '1',
),
),
'indices' => array(
array('name'=>'upgrade_history_pk', 'type'=>'primary', 'fields'=>array('id')),
array('name'=>'upgrade_history_md5_uk', 'type'=>'unique', 'fields'=>array('md5sum')),
),
);
?>

View File

@@ -0,0 +1,60 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/Administration/QuickRepairAndRebuild.php');
class ViewRepair extends SugarView
{
/**
* @see SugarView::display()
*/
public function display()
{
$randc = new RepairAndClear();
$randc->repairAndClearAll(array('clearAll'),array(translate('LBL_ALL_MODULES')), false,true);
echo <<<EOHTML
<br /><br /><a href="index.php?module=Administration&action=index">{$GLOBALS['mod_strings']['LBL_DIAGNOSTIC_DELETE_RETURN']}</a>
EOHTML;
}
}

View File

@@ -0,0 +1,117 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/Administration/Forms.php');
require_once('modules/Configurator/Configurator.php');
require_once('include/MVC/View/SugarView.php');
class AdministrationViewThemesettings extends SugarView
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".$mod_strings['LBL_MODULE_NAME']."</a>",
$mod_strings['LBL_THEME_SETTINGS']
);
}
/**
* @see SugarView::process()
*/
public function process()
{
global $current_user;
if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
if (isset($_REQUEST['disabled_themes']) ) {
$toDecode = html_entity_decode ($_REQUEST['disabled_themes'], ENT_QUOTES);
$disabledThemes = json_decode($toDecode, true);
if ( ($key = array_search(SugarThemeRegistry::current()->__toString(),$disabledThemes)) !== FALSE ) {
unset($disabledThemes[$key]);
}
$_REQUEST['disabled_themes'] = implode(',',$disabledThemes);
$configurator = new Configurator();
$configurator->config['disabled_themes'] = $_REQUEST['disabled_themes'];
$configurator->handleOverride();
echo "true";
} else {
parent::process();
}
}
/**
* display the form
*/
public function display()
{
global $mod_strings, $app_strings, $current_user;
if ( !is_admin($current_user) )
sugar_die('Admin Only');
$enabled = array();
foreach(SugarThemeRegistry::availableThemes() as $dir => $theme)
{
$enabled[] = array("theme" => $theme, "dir" => $dir);
}
$disabled = array();
foreach(SugarThemeRegistry::unAvailableThemes() as $dir => $theme)
{
$disabled[] = array("theme" => $theme, "dir" => $dir);
}
$this->ss->assign('enabled_modules', json_encode($enabled));
$this->ss->assign('disabled_modules', json_encode($disabled));
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$this->ss->assign('currentTheme', SugarThemeRegistry::current());
echo $this->getModuleTitle();
echo $this->ss->fetch('modules/Administration/templates/themeSettings.tpl');
}
}