Skip to content
Browse files

Release 6.4.0

  • Loading branch information...
1 parent 4811d33 commit dba70b917a6e560b3c84deefffd30c5b554f00b5 John Mertic committed
Showing with 3,576 additions and 3,154 deletions.
  1. +108 −91 ModuleInstall/PackageManager/PackageController.php
  2. +39 −68 ModuleInstall/PackageManager/PackageManager.php
  3. +59 −59 ModuleInstall/PackageManager/PackageManagerComm.php
  4. +8 −3 ModuleInstall/PackageManager/PackageManagerDisplay.php
  5. +4 −5 ModuleInstall/PackageManager/PackageManagerDownloader.php
  6. +1 −1 ModuleInstall/PackageManager/tpls/ModuleLoaderListView.tpl
  7. +19 −18 ModuleInstall/PackageManager/tpls/PackageManagerScripts.tpl
  8. +12 −10 XTemplate/xtpl.php
  9. +11 −0 Zend/Http/Response/Stream.php
  10. +1 −1 Zend/Oauth/Provider.php
  11. +0 −1 cache/upload/index.html
  12. +14 −6 cron.php
  13. +1 −1 custom/index.html
  14. +7 −3 data/BeanFactory.php
  15. +4 −4 data/Link.php
  16. +5 −2 data/Link2.php
  17. +1 −0 data/Relationships/EmailAddressRelationship.php
  18. +7 −2 data/Relationships/M2MRelationship.php
  19. +5 −4 data/Relationships/One2MBeanRelationship.php
  20. +1 −0 data/Relationships/One2MRelationship.php
  21. +4 −0 data/Relationships/One2OneBeanRelationship.php
  22. +4 −0 data/Relationships/One2OneRelationship.php
  23. +5 −1 data/Relationships/RelationshipFactory.php
  24. +2 −3 data/Relationships/SugarRelationship.php
  25. +176 −435 data/SugarBean.php
  26. +0 −1 data/upload/index.html
  27. +14 −22 download.php
  28. +906 −864 files.md5
  29. +77 −73 include/Dashlets/Dashlet.php
  30. +13 −5 include/Dashlets/DashletGeneric.php
  31. +55 −53 include/Dashlets/DashletGenericChart.php
  32. +3 −1 include/Dashlets/DashletGenericConfigure.tpl
  33. +33 −24 include/Dashlets/DashletGenericDisplay.tpl
  34. +10 −18 include/Dashlets/DashletRssFeedTitle.php
  35. +78 −75 include/DetailView/DetailView.php
  36. +9 −5 include/DetailView/DetailView.tpl
  37. +22 −18 include/DetailView/DetailView2.php
  38. +13 −11 include/EditView/EditView.php
  39. +41 −14 include/EditView/EditView.tpl
  40. +9 −3 include/EditView/EditView2.php
  41. +6 −2 include/EditView/PopupQuickCreate.php
  42. +12 −8 include/EditView/QuickCreate.php
  43. +15 −11 include/EditView/SubpanelQuickCreate.php
  44. +14 −10 include/EditView/SubpanelQuickEdit.php
  45. +34 −31 include/EditView/SugarVCR.php
  46. +5 −5 include/JSON.php
  47. +61 −53 include/ListView/ListView.php
  48. +16 −10 include/ListView/ListViewDCMenu.tpl
  49. +55 −38 include/ListView/ListViewData.php
  50. +62 −18 include/ListView/ListViewDisplay.php
  51. +22 −14 include/ListView/ListViewGeneric.tpl
  52. +14 −11 include/ListView/ListViewNoMassUpdate.tpl
  53. +15 −9 include/ListView/ListViewPagination.tpl
  54. +1 −0 include/ListView/ListViewSmarty.php
  55. +19 −19 include/ListView/ListViewXTPL.php
  56. +91 −13 include/Localization/Localization.php
  57. +10 −9 include/MVC/Controller/ControllerFactory.php
  58. +6 −3 include/MVC/Controller/SugarController.php
  59. +2 −0 include/MVC/Controller/action_view_map.php
  60. +7 −11 include/MVC/SugarApplication.php
  61. +11 −11 include/MVC/SugarModule.php
  62. +123 −40 include/MVC/View/SugarView.php
  63. +34 −30 include/MVC/View/ViewFactory.php
  64. +1 −1 include/MVC/View/tpls/Importvcard.tpl
  65. +93 −0 include/MVC/View/tpls/gsdetail.tpl
  66. +205 −0 include/MVC/View/views/view.gs.php
  67. +9 −9 include/MVC/View/views/view.list.php
  68. +2 −1 include/MVC/View/views/view.modulelistmenu.php
  69. +21 −31 include/MVC/View/views/view.popup.php
  70. +20 −4 include/MVC/View/views/view.quickcreate.php
  71. +23 −4 include/MVC/View/views/view.quickedit.php
  72. +24 −21 include/MassUpdate.php
  73. +5 −4 include/MySugar/DashletsDialog/DashletsDialog.php
  74. +10 −12 include/MySugar/MySugar.php
  75. +15 −15 include/MySugar/tpls/MySugar.tpl
  76. +7 −7 include/MySugar/tpls/addDashletsDialog.tpl
  77. +2 −2 include/MySugar/tpls/retrievePage.tpl
  78. +35 −41 include/OutboundEmail/OutboundEmail.php
  79. +60 −61 include/Popups/PopupSmarty.php
  80. +53 −45 include/Popups/tpls/PopupGeneric.tpl
  81. +4 −4 include/Popups/tpls/header.tpl
  82. +24 −45 include/SearchForm/SearchForm.php
  83. +547 −586 include/SearchForm/SearchForm2.php
Sorry, we could not display the entire diff because too many files (1,133) changed.
View
199 ModuleInstall/PackageManager/PackageController.php
@@ -38,32 +38,32 @@
require_once('ModuleInstall/PackageManager/PackageManager.php');
class PackageController{
var $_pm;
-
+
/**
* Constructor: this class is called from the the ajax call and handles invoking the correct
* functionality on the server.
*/
function PackageController(){
- $this->_pm = new PackageManager();
+ $this->_pm = new PackageManager();
}
-
+
function performBasicSearch(){
$json = getJSONobj();
$search_term = '';
$node_id = '';
if(isset($_REQUEST['search_term'])) {
- $search_term = nl2br($_REQUEST['search_term']);
- }
+ $search_term = nl2br($_REQUEST['search_term']);
+ }
if(isset($_REQUEST['node_id'])) {
- $node_id = nl2br($_REQUEST['node_id']);
- }
+ $node_id = nl2br($_REQUEST['node_id']);
+ }
$xml = PackageManager::getPackages($node_id);
echo 'result = ' . $json->encode(array('packages' => $xml));
}
-
+
/**
* Retrieve a list of packages which belong to the corresponding category
- *
+ *
* @param category_id this is passed via POST and is the category id of packages
* we wish to retrieve
* @return packages xml string consisting of the packages and releases which belong to
@@ -72,14 +72,14 @@ function performBasicSearch(){
function getPackages(){
$json = getJSONobj();
$category_id = '';
-
+
if(isset($_REQUEST['category_id'])) {
- $category_id = nl2br($_REQUEST['category_id']);
- }
+ $category_id = nl2br($_REQUEST['category_id']);
+ }
$xml = PackageManager::getPackages($category_id);
echo 'result = ' . $json->encode(array('package_output' => $xml));
}
-
+
/**
* Obtain a list of releases from the server. This function is currently used for generating the patches/langpacks for upgrade wizard
* as well as during installation
@@ -90,16 +90,16 @@ function getReleases(){
$package_id = '';
$types = '';
if(isset($_REQUEST['category_id'])) {
- $category_id = nl2br($_REQUEST['category_id']);
- }
+ $category_id = nl2br($_REQUEST['category_id']);
+ }
if(isset($_REQUEST['package_id'])) {
- $package_id = nl2br($_REQUEST['package_id']);
- }
+ $package_id = nl2br($_REQUEST['package_id']);
+ }
if(isset($_REQUEST['types'])) {
- $types = nl2br($_REQUEST['types']);
- }
+ $types = nl2br($_REQUEST['types']);
+ }
$types = explode(',', $types);
-
+
$filter = array();
$count = count($types);
$index = 1;
@@ -110,35 +110,35 @@ function getReleases(){
$type_str .= ",";
$index++;
}
-
+
$filter = array('type' => $type_str);
- $filter = PackageManager::toNameValueList($filter);
+ $filter = PackageManager::toNameValueList($filter);
$releases = PackageManager::getReleases($category_id, $package_id, $filter);
$nodes = array();
$release_map = array();
foreach($releases['packages'] as $release){
$release = PackageManager::fromNameValueList($release);
- $nodes[] = array('description' => $release['description'], 'version' => $release['version'], 'build_number' => $release['build_number'], 'id' => $release['id']);
+ $nodes[] = array('description' => $release['description'], 'version' => $release['version'], 'build_number' => $release['build_number'], 'id' => $release['id']);
$release_map[$release['id']] = array('package_id' => $release['package_id'], 'category_id' => $release['category_id']);
- }
+ }
$_SESSION['ML_PATCHES'] = $release_map;
echo 'result = ' . $json->encode(array('releases' => $nodes));
}
-
+
/**
* Obtain a promotion from the depot
*/
function getPromotion(){
$json = getJSONobj();
-
+
$header = PackageManager::getPromotion();
-
+
echo 'result = ' . $json->encode(array('promotion' => $header));
}
-
+
/**
* Download the given release
- *
+ *
* @param category_id this is passed via POST and is the category id of the release we wish to download
* @param package_id this is passed via POST and is the package id of the release we wish to download
* @param release_id this is passed via POST and is the release id of the release we wish to download
@@ -151,29 +151,29 @@ function download(){
$category_id = '';
$release_id = '';
if(isset($_REQUEST['package_id'])) {
- $package_id = nl2br($_REQUEST['package_id']);
- }
+ $package_id = nl2br($_REQUEST['package_id']);
+ }
if(isset($_REQUEST['category_id'])) {
- $category_id = nl2br($_REQUEST['category_id']);
+ $category_id = nl2br($_REQUEST['category_id']);
}
if(isset($_REQUEST['release_id'])) {
- $release_id = nl2br($_REQUEST['release_id']);
+ $release_id = nl2br($_REQUEST['release_id']);
}
$GLOBALS['log']->debug("PACKAGE ID: ".$package_id);
$GLOBALS['log']->debug("CATEGORY ID: ".$category_id);
$GLOBALS['log']->debug("RELEASE ID: ".$release_id);
- $result = $this->_pm->download($category_id, $package_id, $release_id, getcwd().'/'.$sugar_config['upload_dir']);
+ $result = $this->_pm->download($category_id, $package_id, $release_id);
$GLOBALS['log']->debug("RESULT: ".print_r($result,true));
$success = 'false';
if($result != null){
$GLOBALS['log']->debug("Performing Setup");
$this->_pm->performSetup($result, 'module', false);
$GLOBALS['log']->debug("Complete Setup");
- $success = 'true';
+ $success = 'true';
}
- echo 'result = ' . $json->encode(array('success' => $success));
- }
-
+ echo 'result = ' . $json->encode(array('success' => $success));
+ }
+
/**
* Retrieve a list of categories that are subcategories to the selected category
*
@@ -184,25 +184,25 @@ function getCategories(){
$json = getJSONobj();
$node_id = '';
if(isset($_REQUEST['category_id'])) {
- $node_id = nl2br($_REQUEST['category_id']);
- }
+ $node_id = nl2br($_REQUEST['category_id']);
+ }
$GLOBALS['log']->debug("NODE ID: ".$node_id);
$nodes = PackageManager::getCategories($node_id);
- echo 'result = ' . $json->encode(array('nodes' => $nodes));
+ echo 'result = ' . $json->encode(array('nodes' => $nodes));
}
-
+
function getNodes(){
$json = getJSONobj();
$category_id = '';
if(isset($_REQUEST['category_id'])) {
- $category_id = nl2br($_REQUEST['category_id']);
- }
+ $category_id = nl2br($_REQUEST['category_id']);
+ }
$GLOBALS['log']->debug("CATEGORY ID: ".$category_id);
$nodes = PackageManager::getModuleLoaderCategoryPackages($category_id);
$GLOBALS['log']->debug(var_export($nodes, true));
- echo 'result = ' . $json->encode(array('nodes' => $nodes));
+ echo 'result = ' . $json->encode(array('nodes' => $nodes));
}
-
+
/**
* Check the SugarDepot for updates for the given type as passed in via POST
* @param type the type to check for
@@ -212,8 +212,8 @@ function checkForUpdates(){
$json = getJSONobj();
$type = '';
if(isset($_REQUEST['type'])) {
- $type = nl2br($_REQUEST['type']);
- }
+ $type = nl2br($_REQUEST['type']);
+ }
$pm = new PackageManager();
$updates = $pm->checkForUpdates();
$nodes = array();
@@ -221,7 +221,7 @@ function checkForUpdates(){
if(!empty($updates)){
foreach($updates as $update){
$update = PackageManager::fromNameValueList($update);
- $nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']);
+ $nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']);
$release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']);
}
}
@@ -231,24 +231,24 @@ function checkForUpdates(){
if(!empty($releases['packages'])){
foreach($releases['packages'] as $update){
$update = PackageManager::fromNameValueList($update);
- $nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']);
+ $nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']);
$release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']);
}
}
$_SESSION['ML_PATCHES'] = $release_map;
- echo 'result = ' . $json->encode(array('updates' => $nodes));
+ echo 'result = ' . $json->encode(array('updates' => $nodes));
}
-
+
function getLicenseText(){
$json = getJSONobj();
$file = '';
if(isset($_REQUEST['file'])) {
- $file = hashToFile($_REQUEST['file']);
- }
- $GLOBALS['log']->debug("FILE : ".$file);
- echo 'result = ' . $json->encode(array('license_display' => PackageManagerDisplay::buildLicenseOutput($file)));
- }
-
+ $file = hashToFile($_REQUEST['file']);
+ }
+ $GLOBALS['log']->debug("FILE : ".$file);
+ echo 'result = ' . $json->encode(array('license_display' => PackageManagerDisplay::buildLicenseOutput($file)));
+ }
+
/**
* build the list of modules that are currently in the staging area waiting to be installed
*/
@@ -257,24 +257,24 @@ function getPackagesInStaging(){
$json = getJSONobj();
echo 'result = ' . $json->encode(array('packages' => $packages));
- }
-
+ }
+
/**
* build the list of modules that are currently in the staging area waiting to be installed
*/
function performInstall(){
$file = '';
if(isset($_REQUEST['file'])) {
- $file = hashToFile($_REQUEST['file']);
- }
- if(!empty($file)){
+ $file = hashToFile($_REQUEST['file']);
+ }
+ if(!empty($file)){
$this->_pm->performInstall($file);
}
$json = getJSONobj();
echo 'result = ' . $json->encode(array('result' => 'success'));
}
-
+
function authenticate(){
$json = getJSONobj();
$username = '';
@@ -282,75 +282,92 @@ function authenticate(){
$servername = '';
$terms_checked = '';
if(isset($_REQUEST['username'])) {
- $username = nl2br($_REQUEST['username']);
- }
+ $username = nl2br($_REQUEST['username']);
+ }
if(isset($_REQUEST['password'])) {
- $password = nl2br($_REQUEST['password']);
+ $password = nl2br($_REQUEST['password']);
}
if(isset($_REQUEST['servername'])) {
- $servername = $_REQUEST['servername'];
+ $servername = $_REQUEST['servername'];
}
if(isset($_REQUEST['terms_checked'])) {
- $terms_checked = $_REQUEST['terms_checked'];
+ $terms_checked = $_REQUEST['terms_checked'];
if($terms_checked == 'on')
- $terms_checked = true;
+ $terms_checked = true;
}
if(!empty($username) && !empty($password)){
$password = md5($password);
$result = PackageManager::authenticate($username, $password, $servername, $terms_checked);
if(!is_array($result) && $result == true)
- $status = 'success';
+ $status = 'success';
else
- $status = $result['faultstring'];
+ $status = $result['faultstring'];
}else{
- $status = 'failed';
+ $status = 'failed';
}
-
- echo 'result = ' . $json->encode(array('status' => $status));
+
+ echo 'result = ' . $json->encode(array('status' => $status));
}
-
+
function getDocumentation(){
$json = getJSONobj();
$package_id = '';
$release_id = '';
-
+
if(isset($_REQUEST['package_id'])) {
- $package_id = nl2br($_REQUEST['package_id']);
+ $package_id = nl2br($_REQUEST['package_id']);
}
if(isset($_REQUEST['release_id'])) {
- $release_id = nl2br($_REQUEST['release_id']);
- }
-
+ $release_id = nl2br($_REQUEST['release_id']);
+ }
+
$documents = PackageManager::getDocumentation($package_id, $release_id);
$GLOBALS['log']->debug("DOCUMENTS: ".var_export($documents, true));
echo 'result = ' . $json->encode(array('documents' => $documents));
}
-
+
function downloadedDocumentation(){
$json = getJSONobj();
$document_id = '';
-
+
if(isset($_REQUEST['document_id'])) {
- $document_id = nl2br($_REQUEST['document_id']);
+ $document_id = nl2br($_REQUEST['document_id']);
}
- $GLOBALS['log']->debug("Downloading Document: ".$document_id);
+ $GLOBALS['log']->debug("Downloading Document: ".$document_id);
PackageManagerComm::downloadedDocumentation($document_id);
- echo 'result = ' . $json->encode(array('result' => 'true'));
+ echo 'result = ' . $json->encode(array('result' => 'true'));
+ }
+
+ /**
+ * Remove metadata files such as foo-manifest
+ * Enter description here ...
+ * @param unknown_type $file
+ * @param unknown_type $meta
+ */
+ protected function rmMetaFile($file, $meta)
+ {
+ $metafile = pathinfo($file, PATHINFO_DIRNAME)."/". pathinfo($file, PATHINFO_FILENAME)."-$meta.php";
+ if(file_exists($metafile)) {
+ unlink($metafile);
+ }
}
-
+
function remove(){
$json = getJSONobj();
$file = '';
-
+
if(isset($_REQUEST['file'])) {
- $file = urldecode(hashToFile($_REQUEST['file']));
- }
+ $file = urldecode(hashToFile($_REQUEST['file']));
+ }
$GLOBALS['log']->debug("FILE TO REMOVE: ".$file);
if(!empty($file)){
unlink($file);
+ foreach(array("manifest", "icon") as $meta) {
+ $this->rmMetaFile($file, $meta);
+ }
}
- echo 'result = ' . $json->encode(array('result' => 'true'));
+ echo 'result = ' . $json->encode(array('result' => 'true'));
}
}
?>
View
107 ModuleInstall/PackageManager/PackageManager.php
@@ -39,29 +39,21 @@
define("CREDENTIAL_USERNAME", "username");
define("CREDENTIAL_PASSWORD", "password");
-
-
-
-
require_once('include/nusoap/nusoap.php');
-
require_once('include/utils/zip_utils.php');
-
require_once('ModuleInstall/PackageManager/PackageManagerDisplay.php');
require_once('ModuleInstall/ModuleInstaller.php');
-
require_once('include/entryPoint.php');
require_once('ModuleInstall/PackageManager/PackageManagerComm.php');
-
- class PackageManager{
+class PackageManager{
var $soap_client;
/**
* Constructor: In this method we will initialize the nusoap client to point to the hearbeat server
*/
function PackageManager(){
- $this->db = & DBManagerFactory::getInstance();
+ $this->db = DBManagerFactory::getInstance();
}
function initializeComm(){
@@ -191,22 +183,16 @@ function getReleases($category_id, $package_id, $filter = array()){
* @param release_id the release_id to download
* @return filename - the path to which the zip file was saved
*/
- function download($category_id, $package_id, $release_id, $save_dir = ''){
+ public function download($category_id, $package_id, $release_id)
+ {
$GLOBALS['log']->debug('RELEASE _ID: '.$release_id);
if(!empty($release_id)){
$filename = PackageManagerComm::addDownload($category_id, $package_id, $release_id);
if($filename){
$GLOBALS['log']->debug('RESULT: '.$filename);
PackageManagerComm::errorCheck();
- $filepath = PackageManagerComm::performDownload($filename, $save_dir);
+ $filepath = PackageManagerComm::performDownload($filename);
return $filepath;
- /*if(!empty($result) && !empty($result['filename']) && !empty($save_dir)){
- $GLOBALS['log']->debug('Saving Package to: '.$save_dir);
- $GLOBALS['log']->debug('Saving package to the local file system:'.$result['filename']);
- return write_encoded_file ($result, $save_dir);
- }else{
- return null;
- }*/
}
}else{
return null;
@@ -374,9 +360,9 @@ function extractFile( $zip_file, $file_in_zip, $base_tmp_upgrade_dir){
function extractManifest( $zip_file,$base_tmp_upgrade_dir ) {
global $sugar_config;
- $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
+ $base_upgrade_dir = sugar_cached("/upgrades");
$base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
- return( $this->extractFile( $zip_file, "manifest.php",$base_tmp_upgrade_dir ) );
+ return $this->extractFile( $zip_file, "manifest.php",$base_tmp_upgrade_dir );
}
function validate_manifest( $manifest ){
@@ -453,7 +439,7 @@ function performSetup($tempFile, $view = 'module', $display_messages = true){
global $sugar_config;
$base_filename = urldecode($tempFile);
$GLOBALS['log']->debug("BaseFileName: ".$base_filename);
- $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
+ $base_upgrade_dir = sugar_cached("/upgrades");
$base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
$manifest_file = $this->extractManifest( $base_filename,$base_tmp_upgrade_dir);
$GLOBALS['log']->debug("Manifest: ".$manifest_file);
@@ -513,14 +499,14 @@ function performSetup($tempFile, $view = 'module', $display_messages = true){
function unlinkTempFiles() {
global $sugar_config;
@unlink($_FILES['upgrade_zip']['tmp_name']);
- @unlink(getcwd().'/'.$sugar_config['upload_dir'].$_FILES['upgrade_zip']['name']);
+ @unlink("upload://".$_FILES['upgrade_zip']['name']);
}
function performInstall($file, $silent=true){
global $sugar_config;
global $mod_strings;
global $current_language;
- $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
+ $base_upgrade_dir = sugar_cached("/upgrades");
$base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
if(!file_exists($base_tmp_upgrade_dir)){
mkdir_recursive($base_tmp_upgrade_dir, true);
@@ -586,7 +572,7 @@ function performUninstall($name){
global $sugar_config;
global $mod_strings;
global $current_language;
- $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
+ $base_upgrade_dir = sugar_cached("/upgrades");
$base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
if(!isset($GLOBALS['mi_remove_tables']))$GLOBALS['mi_remove_tables'] = true;
$unzip_dir = mk_temp_dir( $base_tmp_upgrade_dir );
@@ -623,19 +609,24 @@ function getImageForType( $type ){
$icon = "";
switch( $type ){
case "full":
- $icon = SugarThemeRegistry::current()->getImage("Upgrade", "" );
+ $icon = SugarThemeRegistry::current()->getImage("Upgrade", "" ,null,null,'.gif', "Upgrade");
+
break;
case "langpack":
- $icon = SugarThemeRegistry::current()->getImage("LanguagePacks", "" );
+ $icon = SugarThemeRegistry::current()->getImage("LanguagePacks", "",null,null,'.gif',"Language Packs" );
+
break;
case "module":
- $icon = SugarThemeRegistry::current()->getImage("ModuleLoader", "" );
+ $icon = SugarThemeRegistry::current()->getImage("ModuleLoader", "" ,null,null,'.gif', "Module Loader");
+
break;
case "patch":
- $icon = SugarThemeRegistry::current()->getImage("PatchUpgrades", "" );
+ $icon = SugarThemeRegistry::current()->getImage("PatchUpgrades", "",null,null,'.gif', "Patch Upgrades" );
+
break;
case "theme":
- $icon = SugarThemeRegistry::current()->getImage("Themes", "" );
+ $icon = SugarThemeRegistry::current()->getImage("Themes", "",null,null,'.gif', "Themes" );
+
break;
default:
break;
@@ -647,43 +638,32 @@ function getPackagesInStaging($view = 'module'){
global $sugar_config;
global $current_language;
$uh = new UpgradeHistory();
- $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
- $base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
- $uContent = findAllFiles( "$base_upgrade_dir", array() , false, 'zip',$base_tmp_upgrade_dir);
- //other variations of zip file i.e. ZIP, zIp,zIP,Zip,ZIp,ZiP
- $extns = array( 'ZIP','ZIp','ZiP','Zip','zIP','zIp','ziP');
- foreach($extns as $extn){
- $uContent = array_merge($uContent,findAllFiles( "$base_upgrade_dir", array() , false, $extn,$base_tmp_upgrade_dir));
- }
+ $base_upgrade_dir = "upload://upgrades";
+ $base_tmp_upgrade_dir = sugar_cached("upgrades/temp");
+ $uContent = findAllFiles( $base_upgrade_dir, array() , false, 'zip');
$upgrade_contents = array();
$content_values = array_values($uContent);
$alreadyProcessed = array();
foreach($content_values as $val){
if(empty($alreadyProcessed[$val])){
$upgrade_contents[] = $val;
- $alreadyProcessed["$val"] = true;
+ $alreadyProcessed[$val] = true;
}
}
$upgrades_available = 0;
$packages = array();
$mod_strings = return_module_language($current_language, "Administration");
- foreach($upgrade_contents as $upgrade_content)
- {
- if(!preg_match("#.*\.zip\$#", strtolower($upgrade_content)) || preg_match("#.*./zips/.*#", strtolower($upgrade_content)))
- {
+ foreach($upgrade_contents as $upgrade_content) {
+ if(!preg_match('#.*\.zip$#', strtolower($upgrade_content)) || preg_match("#.*./zips/.*#", strtolower($upgrade_content))) {
continue;
}
- $upgrade_content = clean_path($upgrade_content);
- // Bug 22285 - fix for UNC paths
- if ( substr($upgrade_content,0,2) == '\\\\' )
- $upgrade_content = '\\\\'.$upgrade_content;
$the_base = basename($upgrade_content);
$the_md5 = md5_file($upgrade_content);
$md5_matches = $uh->findByMd5($the_md5);
$file_install = $upgrade_content;
- if(0 == sizeof($md5_matches))
+ if(empty($md5_matches))
{
$target_manifest = remove_file_extension( $upgrade_content ) . '-manifest.php';
require_once($target_manifest);
@@ -702,44 +682,35 @@ function getPackagesInStaging($view = 'module'){
}
//check dependencies first
- if(!empty($dependencies)){
-
+ if(!empty($dependencies)) {
$uh = new UpgradeHistory();
$not_found = $uh->checkDependencies($dependencies);
if(!empty($not_found) && count($not_found) > 0){
$file_install = 'errors_'.$mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]";
- }//fi
+ }
}
- if($view == 'default' && $manifest_type != 'patch')
- {
+ if($view == 'default' && $manifest_type != 'patch') {
continue;
}
if($view == 'module'
- && $manifest_type != 'module' && $manifest_type != 'theme' && $manifest_type != 'langpack')
- {
+ && $manifest_type != 'module' && $manifest_type != 'theme' && $manifest_type != 'langpack') {
continue;
}
- if(empty($manifest['icon'])){
+ if(empty($manifest['icon'])) {
$icon = $this->getImageForType( $manifest['type'] );
- }else{
+ } else {
$path_parts = pathinfo( $manifest['icon'] );
$icon = "<img src=\"" . remove_file_extension( $upgrade_content ) . "-icon." . $path_parts['extension'] . "\">";
}
$upgrades_available++;
- // uploaded file in cache/upload
- $fileS = explode('/', $upgrade_content);
- $c = count($fileS);
- $fileName = (isset($fileS[$c-1]) && !empty($fileS[$c-1])) ? $fileS[$c-1] : $fileS[$c-2];
- $upload_file = $sugar_config['upload_dir'].$fileName;
-
- $upgrade_content = urlencode($upgrade_content);
- $upload_content = urlencode($upload_file);
- $packages[] = array('name' => $name, 'version' => $version, 'published_date' => $published_date, 'description' => $description, 'uninstallable' =>$uninstallable, 'type' => $type, 'file_install' => fileToHash($file_install), 'file' => fileToHash($upgrade_content), 'upload_file' => $upload_content);
+ $packages[] = array('name' => $name, 'version' => $version, 'published_date' => $published_date,
+ 'description' => $description, 'uninstallable' =>$uninstallable, 'type' => $type,
+ 'file' => fileToHash($upgrade_content), 'file_install' => fileToHash($upgrade_content));
}//fi
}//rof
return $packages;
@@ -747,7 +718,7 @@ function getPackagesInStaging($view = 'module'){
function getLicenseFromFile($file){
global $sugar_config;
- $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
+ $base_upgrade_dir = sugar_cached("/upgrades");
$base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
$license_file = $this->extractFile($file, 'LICENSE.txt', $base_tmp_upgrade_dir);
if(is_file($license_file)){
@@ -785,7 +756,7 @@ function getinstalledPackages($types = array('module', 'langpack')){
$packages = array();
$upgrades_installed = 0;
$uh = new UpgradeHistory();
- $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
+ $base_upgrade_dir = sugar_cached("/upgrades");
$base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
foreach($installeds as $installed)
{
View
118 ModuleInstall/PackageManager/PackageManagerComm.php
@@ -40,25 +40,25 @@
define("HTTPS_URL", "https://depot.sugarcrm.com/depot/SugarDepotSoap.php");
define("ACTIVE_STATUS", "ACTIVE");
-class PackageManagerComm{
+class PackageManagerComm{
/**
* Initialize the soap client and store in the $GLOBALS object for use
- *
+ *
* @param login designates whether we want to try to login after we initialize or not
- */
- function initialize($login = true){
- if(empty($GLOBALS['SugarDepot'])){
+ */
+ function initialize($login = true){
+ if(empty($GLOBALS['SugarDepot'])){
$GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
$soap_client = new nusoapclient(HTTPS_URL, false);
$ping = $soap_client->call('sugarPing', array());
$GLOBALS['SugarDepot'] = $soap_client;
- }
+ }
//if we do not have a session, then try to login
if($login && empty($_SESSION['SugarDepotSessionID'])){
- PackageManagerComm::login();
+ PackageManagerComm::login();
}
}
-
+
/**
* Check for errors in the response or error_str
*/
@@ -68,10 +68,10 @@ function errorCheck(){
$GLOBALS['log']->fatal($GLOBALS['SugarDepot']->response);
}
}
-
+
/**
* Set the credentials for use during login
- *
+ *
* @param username Mambo username
* @param password Mambo password
* @param download_key User's download key
@@ -79,9 +79,9 @@ function errorCheck(){
function setCredentials($username, $password, $download_key){
$_SESSION['SugarDepotUsername'] = $username;
$_SESSION['SugarDepotPassword'] = $password;
- $_SESSION['SugarDepotDownloadKey'] = $download_key;
+ $_SESSION['SugarDepotDownloadKey'] = $download_key;
}
-
+
/**
* Clears out the session so we can reauthenticate.
*/
@@ -93,7 +93,7 @@ function clearSession(){
////////// BEGIN: Base Functions for Communicating with the depot
/**
* Login to the depot
- *
+ *
* @return true if successful, false otherwise
*/
function login($terms_checked = true){
@@ -114,7 +114,7 @@ function login($terms_checked = true){
if(!empty($terms_version))
$params['terms_version'] = $terms_version;
- $result = $GLOBALS['SugarDepot']->call('depotLogin', array(array('user_name' => $credentials['username'], 'password' => $credentials['password']),'info'=>$info, 'params' => $params));
+ $result = $GLOBALS['SugarDepot']->call('depotLogin', array(array('user_name' => $credentials['username'], 'password' => $credentials['password']),'info'=>$info, 'params' => $params));
PackageManagerComm::errorCheck();
if(!is_array($result))
$_SESSION['SugarDepotSessionID'] = $result;
@@ -124,29 +124,29 @@ function login($terms_checked = true){
else
return $_SESSION['SugarDepotSessionID'];
}
-
+
/**
* Logout from the depot
*/
function logout(){
PackageManagerComm::initialize();
- $result = $GLOBALS['SugarDepot']->call('depotLogout', array('session_id' => $_SESSION['SugarDepotSessionID']));
- }
-
+ $result = $GLOBALS['SugarDepot']->call('depotLogout', array('session_id' => $_SESSION['SugarDepotSessionID']));
+ }
+
/**
* Get all promotions from the depot
*/
function getPromotion(){
PackageManagerComm::initialize();
//check for fault first and then return
- $name_value_list = $GLOBALS['SugarDepot']->call('depotGetPromotion', array('session_id' => $_SESSION['SugarDepotSessionID']));
+ $name_value_list = $GLOBALS['SugarDepot']->call('depotGetPromotion', array('session_id' => $_SESSION['SugarDepotSessionID']));
return $name_value_list;
- }
-
+ }
+
/**
* A generic function which given a category_id some filter will
* return an object which contains categories and packages
- *
+ *
* @param category_id the category_id to fetch
* @param filter a filter which will limit theh number of results returned
* @return categories_and_packages
@@ -157,10 +157,10 @@ function getCategoryPackages($category_id, $filter = array()){
//check for fault
return $GLOBALS['SugarDepot']->call('depotGetCategoriesPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter));
}
-
+
/**
* Return a list of child categories to the parent specified in category_id
- *
+ *
* @param category_id the parent category_id
* @param filter a filter which will limit theh number of results returned
* @return categories_and_packages
@@ -171,53 +171,53 @@ function getCategories($category_id, $filter = array()){
//check for fault
return $GLOBALS['SugarDepot']->call('depotGetCategories', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter));
}
-
+
/**
* Return a list of packages which belong to the parent category_id
- *
+ *
* @param category_id the category_id to fetch
* @param filter a filter which will limit theh number of results returned
* @return packages
* @see packages
- */
+ */
function getPackages($category_id, $filter = array()){
PackageManagerComm::initialize();
//check for fault
return $GLOBALS['SugarDepot']->call('depotGetPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter));
}
-
+
/**
* Return a list of releases belong to a package
- *
+ *
* @param category_id the category_id to fetch
* @param package_id the package id which the release belongs to
* @return packages
* @see packages
- */
+ */
function getReleases($category_id, $package_id, $filter = array()){
PackageManagerComm::initialize();
//check for fault
- return $GLOBALS['SugarDepot']->call('depotGetReleases', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'filter' => $filter));
+ return $GLOBALS['SugarDepot']->call('depotGetReleases', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'filter' => $filter));
}
-
+
/**
* Download a given release
- *
+ *
* @param category_id the category_id to fetch
* @param package_id the package id which the release belongs to
* @param release_id the release we want to download
* @return download
* @see download
- */
+ */
function download($category_id, $package_id, $release_id){
PackageManagerComm::initialize();
//check for fault
- return $GLOBALS['SugarDepot']->call('depotDownloadRelease', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'release_id' => $release_id));
+ return $GLOBALS['SugarDepot']->call('depotDownloadRelease', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'release_id' => $release_id));
}
-
+
/**
* Add a requested download to the queue
- *
+ *
* @param category_id the category_id to fetch
* @param package_id the package id which the release belongs to
* @param release_id the release we want to download
@@ -226,82 +226,82 @@ function download($category_id, $package_id, $release_id){
function addDownload($category_id, $package_id, $release_id){
PackageManagerComm::initialize();
//check for fault
- return $GLOBALS['SugarDepot']->call('depotAddDownload', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'release_id' => $release_id, 'download_key' => '123'));
+ return $GLOBALS['SugarDepot']->call('depotAddDownload', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'release_id' => $release_id, 'download_key' => '123'));
}
-
+
/**
* Call the PackageManagerDownloader function which uses curl in order to download the specified file
- *
+ *
* @param filename the file to download
* @return path to downloaded file
*/
- function performDownload($filename, $save_dir){
+ static public function performDownload($filename){
PackageManagerComm::initialize();
//check for fault
$GLOBALS['log']->debug("Performing download from depot: Session ID: ".$_SESSION['SugarDepotSessionID']." Filename: ".$filename);
- return PackageManagerDownloader::download($_SESSION['SugarDepotSessionID'], $filename, $save_dir);
+ return PackageManagerDownloader::download($_SESSION['SugarDepotSessionID'], $filename);
}
-
+
/**
* Retrieve documentation for the given release or package
- *
+ *
* @param package_id the specified package to retrieve documentation
* @param release_id the specified release to retrieve documentation
- *
+ *
* @return documents
*/
function getDocumentation($package_id, $release_id){
PackageManagerComm::initialize();
//check for fault
- return $GLOBALS['SugarDepot']->call('depotGetDocumentation', array('session_id' => $_SESSION['SugarDepotSessionID'], 'package_id' => $package_id, 'release_id' => $release_id));
+ return $GLOBALS['SugarDepot']->call('depotGetDocumentation', array('session_id' => $_SESSION['SugarDepotSessionID'], 'package_id' => $package_id, 'release_id' => $release_id));
}
-
+
function getTermsAndConditions(){
PackageManagerComm::initialize(false);
return $GLOBALS['SugarDepot']->call('depotTermsAndConditions',array());
}
-
+
/**
* Log that the user has clicked on a document
- *
+ *
* @param document_id the document the user has clicked on
*/
function downloadedDocumentation($document_id){
PackageManagerComm::initialize();
//check for fault
$GLOBALS['log']->debug("Logging Document: ".$document_id);
- $GLOBALS['SugarDepot']->call('depotDownloadedDocumentation', array('session_id' => $_SESSION['SugarDepotSessionID'], 'document_id' => $document_id));
+ $GLOBALS['SugarDepot']->call('depotDownloadedDocumentation', array('session_id' => $_SESSION['SugarDepotSessionID'], 'document_id' => $document_id));
}
/**
* Send the list of installed objects, could be patches, or modules, .. to the depot and allow the depot to send back
* a list of corresponding updates
- *
+ *
* @param objects_to_check an array of name_value_lists which contain the appropriate values
* which will allow the depot to check for updates
- *
- * @return array of name_value_lists of corresponding updates
+ *
+ * @return array of name_value_lists of corresponding updates
*/
function checkForUpdates($objects_to_check){
PackageManagerComm::initialize();
//check for fault
- return $GLOBALS['SugarDepot']->call('depotCheckForUpdates', array('session_id' => $_SESSION['SugarDepotSessionID'], 'objects' => $objects_to_check));
+ return $GLOBALS['SugarDepot']->call('depotCheckForUpdates', array('session_id' => $_SESSION['SugarDepotSessionID'], 'objects' => $objects_to_check));
}
/**
* Ping the server to determine if we have established proper communication
- *
+ *
* @return true if we can communicate with the server and false otherwise
- */
+ */
function isAlive(){
PackageManagerComm::initialize(false);
-
+
$status = $GLOBALS['SugarDepot']->call('sugarPing', array());
if(empty($status) || $GLOBALS['SugarDepot']->getError() || $status != ACTIVE_STATUS){
- return false;
+ return false;
}else{
return true;
}
- }
+ }
////////// END: Base Functions for Communicating with the depot
////////////////////////////////////////////////////////
}
View
11 ModuleInstall/PackageManager/PackageManagerDisplay.php
@@ -100,7 +100,8 @@ function buildPackageDisplay($form1, $hidden_fields, $form_action, $types = arra
}else{
$form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'style='display:none;'>";
}
- $form2 .= "</td><td align='left'><div id='workingStatusDiv' style='display:none;'>".SugarThemeRegistry::current()->getImage("sqsWait","border='0' align='bottom'")."</div></td><td align='right'>";
+ $form2 .= "</td><td align='left'><div id='workingStatusDiv' style='display:none;'>".SugarThemeRegistry::current()->getImage("sqsWait","border='0' align='bottom'",null,null,'.gif',"Loading")."</div></td><td align='right'>";
+
if($isAlive){
$form2 .= "<slot><a class=\"listViewTdToolsS1\" id='href_animate' onClick=\"PackageManager.toggleDiv('span_animate_server_div', 'catview');\"><span id='span_animate_server_div'><img src='".SugarThemeRegistry::current()->getImageURL('basic_search.gif')."' width='8' height='8' border='0'>&nbsp;Collapse</span></a></slot>";
}else{
@@ -163,7 +164,8 @@ function buildPatchDisplay($form1, $hidden_fields, $form_action, $types = array(
if($show_login){
$form2 .= "<input type='button' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>";
}
- $form2 .= "</td><td align='right'><div id='workingStatusDiv' style='display:none;'>".SugarThemeRegistry::current()->getImage("sqsWait","border='0' align='bottom'")."</div></td></tr><tr><td colspan='2'>";
+ $form2 .= "</td><td align='right'><div id='workingStatusDiv' style='display:none;'>".SugarThemeRegistry::current()->getImage("sqsWait","border='0' align='bottom'",null,null,'.gif',"Loading")."</div></td></tr><tr><td colspan='2'>";
+
$loginViewStyle = ($isAlive ? 'none' : 'block');
$selectViewStyle = ($isAlive ? 'block' : 'none');
$form2 .= "<div id='selectView' style='display:".$selectViewStyle."'>";
@@ -375,7 +377,8 @@ function getDisplayScript($install = false, $type = 'module', $releases = null,
$install = 0;
}
$ss->assign('INSTALLATION', $install);
- $ss->assign('WAIT_IMAGE', SugarThemeRegistry::current()->getImage("loading","border='0' align='bottom'"));
+ $ss->assign('WAIT_IMAGE', SugarThemeRegistry::current()->getImage("loading","border='0' align='bottom'",null,null,'.gif',"Loading"));
+
$ss->assign('sugar_version', $sugar_version);
$ss->assign('js_custom_version', $sugar_config['js_custom_version']);
$ss->assign('IS_ALIVE', $isAlive);
@@ -437,6 +440,8 @@ function getDisplayScript($install = false, $type = 'module', $releases = null,
$ss->assign('ML_FILEGRIDINSTALLED_COLUMN',$filegridinstalled_column_ary);
//end
+ $ss->assign('SHOW_IMG', SugarThemeRegistry::current()->getImage('advanced_search', 'border="0"', 8, 8, '.gif', 'Show'));
+ $ss->assign('HIDE_IMG', SugarThemeRegistry::current()->getImage('basic_search', 'border="0"', 8, 8, '.gif', 'Hide'));
$str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageManagerScripts.tpl');
return $str;
}
View
9 ModuleInstall/PackageManager/PackageManagerDownloader.php
@@ -36,22 +36,21 @@
define('PACKAGE_MANAGER_DOWNLOAD_SERVER', 'https://depot.sugarcrm.com/depot/');
define('PACKAGE_MANAGER_DOWNLOAD_PAGE', 'download.php');
-define('PACKAGE_MANAGER_DOWNLOAD_PATH', '../'.$GLOBALS['sugar_config']['upload_dir']);
class PackageManagerDownloader{
-
+
/**
* Using curl we will download the file from the depot server
- *
+ *
* @param session_id the session_id this file is queued for
* @param file_name the file_name to download
* @param save_dir (optional) if specified it will direct where to save the file once downloaded
* @param download_sever (optional) if specified it will direct the url for the download
- *
+ *
* @return the full path of the saved file
*/
function download($session_id, $file_name, $save_dir = '', $download_server = ''){
if(empty($save_dir)){
- $save_dir = PACKAGE_MANAGER_DOWNLOAD_PATH;
+ $save_dir = "upload://";
}
if(empty($download_server)){
$download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER;
View
2 ModuleInstall/PackageManager/tpls/ModuleLoaderListView.tpl
@@ -63,7 +63,7 @@
{/if}
<tr id='package_tr_{$package_id}' height='20' class='{$_rowColor}S1'>
- <td scope='row' align='left' valign='top'><a class="listViewTdToolsS1" onclick="PackageManager.toggle_div('{$package_id}')" valign='top'><span id='span_toggle_package_{$package_id}'><img src='{sugar_getimagepath file="advanced_search.gif"}' width='8' height='8' alt='Advanced' border='0'>&nbsp;</span></a></td>
+ <td dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddscope='row' align='left' valign='top'><a class="listViewTdToolsS1" onclick="PackageManager.toggle_div('{$package_id}')" valign='top'><span id='span_toggle_package_{$package_id}'>{sugar_getimage name="advanced_search" ext=".gif" width="8" height="8" alt=$app_strings.LBL_ADVANCED_SEARCH other_attributes='border="0" '}&nbsp;</span></a></td>
{counter start=0 name="colCounter" print=false assign="colCounter"}
{foreach from=$displayColumns key=col item=params}
<td scope='row' align='{$params.align|default:'left'}' valign='top'><span sugar="sugar{$colCounter}b">
View
37 ModuleInstall/PackageManager/tpls/PackageManagerScripts.tpl
@@ -35,7 +35,7 @@
********************************************************************************/
*}
-<script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
+{sugar_getscript file="cache/include/javascript/sugar_grp_yui_widgets.js"}
{literal}
<script>
/*
@@ -286,9 +286,10 @@ if(typeof PackageManager == 'undefined') {
PackageManager.hideWaiting();
},
toggleLowerDiv: function(outer_div, animate_div){
- var show_img = "<img src='{sugar_getimagepath file='advanced_search.gif'}' width='8' height='8' alt='Expand' border='0'>";
- var hide_img = "<img src='{sugar_getimagepath file='basic_search.gif'}' width='8' height='8' alt='Collapse' border='0'>";
-
+ {/literal}
+ var show_img = '{$SHOW_IMG}';
+ var hide_img = '{$HIDE_IMG}';
+ {literal}
var spn = document.getElementById(outer_div);
var anim_div = document.getElementById(animate_div);
@@ -300,9 +301,10 @@ if(typeof PackageManager == 'undefined') {
spn.innerHTML =(anim_div.style.display == 'none') ? show_img+"&nbsp;Expand" : hide_img+"&nbsp;Collapse";
},
toggleDiv: function(outer_div, animate_div){
- var show_img = "<img src='{sugar_getimagepath file='advanced_search.gif'}' width='8' height='8' alt='Expand' border='0'>";
- var hide_img = "<img src='{sugar_getimagepath file='basic_search.gif'}' width='8' height='8' alt='Collapse' border='0'>";
-
+ {/literal}
+ var show_img = '{$SHOW_IMG}';
+ var hide_img = '{$HIDE_IMG}';
+ {literal}
var spn = document.getElementById(outer_div);
var anim_div = document.getElementById(animate_div);
_attributes.height.to = (_attributes.height.to == MAX_HEIGHT) ? MIN_HEIGHT : MAX_HEIGHT;
@@ -465,13 +467,12 @@ if(typeof PackageManager == 'undefined') {
},
toggle_div : function toggle_div(id)
{
- var show_img = "<img src='{sugar_getimagepath file='advanced_search.gif'}' width='8' height='8' alt='Show' border='0'>";
- var hide_img = "<img src='{sugar_getimagepath file='basic_search.gif'}' width='8' height='8' alt='Hide' border='0'>";
+
var dv = document.getElementById("release_table_"+id);
var spn = document.getElementById("span_toggle_package_"+id);
dv.style.display =(dv.style.display == 'none') ? 'block' : 'none';
- spn.innerHTML =(dv.style.display == 'none') ? show_img+"&nbsp;" : hide_img+"&nbsp;";
+ spn.innerHTML =(dv.style.display == 'none') ? show_img + "&nbsp;" : hide_img + "&nbsp;";
},
processLicense : function(file){
var licenseDiv = document.getElementById('licenseDiv');
@@ -903,7 +904,7 @@ PackageManagerGrid = function(){
height: "190px"
}),
{
- MSG_EMPTY: "",
+ MSG_EMPTY: "",
width : (YAHOO.util.Selector.query('table','content',true).clientWidth - 15) + "px",
height: (document.getElementById("patch_downloads").clientHeight - 25 ) + "px"
}
@@ -941,10 +942,10 @@ PackageManagerGrid = function(){
{key:'description', label: '{/literal}{$ML_FILEGRIDINSTALLED_COLUMN.Description}{literal}', sortable: true, 'minWidth' : Math.round(minWidth*1.5)}
],
new YAHOO.util.LocalDataSource(mti_installed_data, {
- responseSchema: {fields: ['name', 'file', 'unFile', 'state_file', 'type', 'version', 'date', 'uninstallable', 'description'] },
- height: "200px"}),
+ responseSchema: {fields: ['name', 'file', 'unFile', 'state_file', 'type', 'version', 'date', 'uninstallable', 'description'] },
+ height: "200px"}),
{
- MSG_EMPTY: "",
+ MSG_EMPTY: "",
width : (YAHOO.util.Selector.query('table','content',true).clientWidth - 15 ) + "px",
height: (document.getElementById("installed_grid").clientHeight - 20 ) + "px"
}
@@ -954,7 +955,7 @@ PackageManagerGrid = function(){
_fileGridInstalled.MSG_EMPTY = "empty5";
//bugfix for http://yuilibrary.com/projects/yui2/ticket/2528034
_fileGridInstalled.getColumn = YAHOO.SUGAR.SelectionGrid.prototype.getColumn;
-
+
_fileGridInstalled.on("renderEvent", function(){
if (mti_installed_data.length > 0)
setTimeout("if(_fileGridInstalled.getFirstTrEl()) _fileGridInstalled.getFirstTrEl().style.width='100%';", 1000);
@@ -1021,7 +1022,7 @@ PackageManagerGrid.prototype.renderUninstallButton = function(elCell, oRecord, c
output += '<input type=hidden name="mode"/>';
output += '</form></span>';
}
-
+
elCell.innerHTML = output;
}
@@ -1050,8 +1051,8 @@ PackageManagerGrid.prototype.renderEnableDisableButton = function(elCell, oRecor
}
PackageManagerGrid.prototype.renderDeleteButton = function(elCell, oRecord, col, file) {
-
- var upload_file = oRecord.getData().upload_file;
+
+ var upload_file = oRecord.getData().file;
var output = "<span style='text-align:center;'><input type='button' class='button' value='{/literal}{$MOD.LBL_UW_BTN_DELETE_PACKAGE}{literal}' onClick='PackageManager.remove(\""+file+"\");'></span>";
//var output = '<form action="index.php?module=Administration&view=module&action=UpgradeWizard" method="post">';
// output += '<input type=submit class=\'button\' name="run" value="{/literal}{$MOD.LBL_UW_BTN_DELETE_PACKAGE}{literal}" />';
View
22 XTemplate/xtpl.php
@@ -3,6 +3,7 @@
/*
Modification information for LGPL compliance
+Stas 2010-12-20 Added 'VERSION_MARK' to templates
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
@@ -10,7 +11,7 @@
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
-r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
+r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
@@ -98,7 +99,7 @@ class XTemplate {
/*
xtemplate class 0.2.4-3
html generation with templates - fast & easy
- copyright (c) 2000 barnabás debreceni [cranx@users.sourceforge.net]
+ copyright (c) 2000 barnabás debreceni [cranx@users.sourceforge.net]
code optimization by Ivar Smolin <okul@linux.ee> 14-march-2001
latest stable & CVS version always available @ http://sourceforge.net/projects/xtpl
@@ -183,7 +184,7 @@ function append ($varname, $name,$val="") {
}
if(is_array($this->VARS[$varname])){
$this->VARS[$varname][$name] = $val;
- }
+ }
}
/***[ parse ]***************************************************************/
@@ -193,10 +194,11 @@ function append ($varname, $name,$val="") {
function parse ($bname) {
global $sugar_version, $sugar_config;
-
+
$this->assign('SUGAR_VERSION', $GLOBALS['js_version_key']);
$this->assign('JS_CUSTOM_VERSION', $sugar_config['js_custom_version']);
-
+ $this->assign('VERSION_MARK', getVersionedPath(''));
+
if(empty($this->blocks[$bname]))
return;
@@ -267,7 +269,7 @@ function parse ($bname) {
// reset sub-blocks
if ($this->AUTORESET && (!empty($this->sub_blocks[$bname]))) {
reset($this->sub_blocks[$bname]);
- foreach ($this->sub_blocks[$bname] as $v)
+ foreach ($this->sub_blocks[$bname] as $v)
$this->reset($v);
}
}
@@ -339,14 +341,14 @@ function text($bname) {
function out ($bname) {
global $focus;
-
+
if(isset($focus)){
global $action;
-
+
if($focus && is_subclass_of($focus, 'SugarBean') && !$focus->ACLAccess($action)){
-
+
ACLController::displayNoAccess(true);
-
+
sugar_die('');
return;
}}
View
11 Zend/Http/Response/Stream.php
@@ -232,4 +232,15 @@ public function __destruct()
}
}
+ /**
+ * This is needed to prevent unserialize vulnerability
+ */
+ public function __wakeup()
+ {
+ // clean all properties
+ foreach(get_object_vars($this) as $k => $v) {
+ $this->$k = null;
+ }
+ throw new Exception("Not a serializable object");
+ }
}
View
2 Zend/Oauth/Provider.php
@@ -234,7 +234,7 @@ protected function assembleParams($method, $params = array())
if(!empty($auth) && substr($auth, 0, 6) == 'OAuth ') {
// import header data
- if (preg_match_all('/(oauth_[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $_SERVER['HTTP_AUTHORIZATION'], $matches)) {
+ if (preg_match_all('/(oauth_[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $auth, $matches)) {
foreach ($matches[1] as $num => $header) {
if($header == 'realm') {
continue;
View
1 cache/upload/index.html
@@ -1 +0,0 @@
-This directory must be writable by the webserver user.
View
20 cron.php
@@ -38,15 +38,15 @@
//change directories to where this file is located.
//this is to make sure it can find dce_config.php
chdir(realpath(dirname(__FILE__)));
-
+
require_once('include/entryPoint.php');
-//Bug 27991 . Redirect to index.php if the request is not come from CLI.
+//Bug 27991 . Redirect to index.php if the request is not come from CLI.
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) != 'cgi') {
global $sugar_config;
if(!empty($sugar_config['site_url'])){
- header("Location: ".$sugar_config['site_url'] . "/index.php");
+ header("Location: ".$sugar_config['site_url'] . "/index.php");
}else{
sugar_die("Didn't find site url in your sugarcrm config file");
}
@@ -68,7 +68,7 @@
//// PREP FOR SCHEDULER PID
$GLOBALS['log']->debug('--------------------------------------------> at cron.php <--------------------------------------------');
-$cachePath = $GLOBALS['sugar_config']['cache_dir'].'modules/Schedulers';
+$cachePath = sugar_cached('modules/Schedulers');
$pid = 'pid.php';
if(!is_dir($cachePath)) {
mkdir_recursive($cachePath);
@@ -110,5 +110,13 @@
}
$exit_on_cleanup = true;
-sugar_cleanup($exit_on_cleanup);
-?>
+sugar_cleanup(false);
+// some jobs have annoying habit of calling sugar_cleanup(), and it can be called only once
+// but job results can be written to DB after job is finished, so we have to disconnect here again
+// just in case we couldn't call cleanup
+if(class_exists('DBManagerFactory')) {
+ $db = DBManagerFactory::getInstance();
+ $db->disconnect();
+}
+
+if($exit_on_cleanup) exit;
View
2 custom/index.html
@@ -1,4 +1,4 @@
-<html>
+<html lang="en">
<body>
<p>keep me</p>
</body>
View
10 data/BeanFactory.php
@@ -38,6 +38,10 @@
require_once('data/SugarBean.php');
+/**
+ * Factory to create SugarBeans
+ * @api
+ */
class BeanFactory {
protected static $loadedBeans = array();
protected static $maxLoaded = 10;
@@ -84,7 +88,7 @@ public static function getBean($module, $id = null)
} else {
$bean = new $beanClass();
}
-
+
return $bean;
}
@@ -104,7 +108,7 @@ public static function getBeanName($module)
/**
* Returns the object name / dictionary key for a given module. This should normally
* be the same as the bean name, but may not for special case modules (ex. Case vs aCase)
- * @static
+ * @static
* @param String $module
* @return bool
*/
@@ -177,7 +181,7 @@ public static function registerBean($module, $bean, $id=false)
if(!empty($bean->id))
$id = $bean->id;
-
+
if ($id)
{
self::$loadedBeans[$module][$id] = $bean;
View
8 data/Link.php
@@ -692,7 +692,7 @@ function add($rel_keys,$additional_values=array()) {
return;
}
}
- $GLOBALS['log']->fatal("Relationship type = {$this->_relationship->relationship_type}");
+ $GLOBALS['log']->debug("Relationship type = {$this->_relationship->relationship_type}");
foreach($keys as $key) {
//fetch the related record using the key and update.
@@ -816,7 +816,7 @@ function _add_many_to_many($add_values) {
}
function _delete_row($table_name,$key) {
- $query="UPDATE $table_name SET deleted=1, date_modified='" .$GLOBALS['timedate']->nowDb()."' WHERE id='$key'";
+ $query="UPDATE $table_name SET deleted=1, date_modified='" .$GLOBALS['timedate']->nowDb()."' WHERE id='".$this->_db->quote($key)."'";
$GLOBALS['log']->debug("Relationship Delete Statement :".$query);
$result=$this->_db->query($query, true);
@@ -827,7 +827,7 @@ function _update_row(&$value_array,$table_name,$where) {
$query='UPDATE '.$table_name.' SET ';
$delimiter='';
foreach ($value_array as $key=>$value) {
- $query.=$delimiter.$key."='".$value."' ";
+ $query.=$delimiter.$key."='".$this->_db->quote($value)."' ";
$delimiter=",";
}
$query.=$where;
@@ -845,7 +845,7 @@ function _insert_row(&$value_array) {
$delimiter='';
foreach ($value_array as $key=>$value) {
$columns_list.=$delimiter.$key;
- $values_list .=$delimiter."'".$value."'";
+ $values_list .=$delimiter."'".$this->_db->quote($value)."'";
$delimiter=",";
}
$insert_string='INSERT into '.$this->_relationship->join_table.' ('.$columns_list.') VALUES ('.$values_list.')';
View
7 data/Link2.php
@@ -50,6 +50,10 @@
global $dictionary;
require_once("data/Relationships/RelationshipFactory.php");
+/**
+ * Represents a relationship from a single beans perspective.
+ * @api
+ */
class Link2 {
protected $relationship; //relationship object this link is tied to.
@@ -323,7 +327,7 @@ function getJoin($params, $return_array =false)
/**
* @param array $params optional parameters. Possible Values;
- * 'return_as_array': returns the query broken into
+ * 'return_as_array': returns the query broken into
* @return String/Array query to grab just ids for this relationship
*/
function getQuery($params = array())
@@ -636,4 +640,3 @@ public function _get_bean_position()
return $this->getSide() == REL_LHS;
}
}
-?>
View
1 data/Relationships/EmailAddressRelationship.php
@@ -40,6 +40,7 @@
/**
* Represents a many to many relationship that is table based.
+ * @api
*/
class EmailAddressRelationship extends M2MRelationship
{
View
9 data/Relationships/M2MRelationship.php
@@ -40,8 +40,9 @@
/**
* Represents a many to many relationship that is table based.
+ * @api
*/
-class M2MRelationship extends SugarRelationship
+class M2MRelationship extends SugarRelationship
{
var $type = "many-to-many";
@@ -161,7 +162,7 @@ protected function getRowToInsert($lhs, $rhs, $additionalFields = array())
"id" => create_guid(),
$this->def['join_key_lhs'] => $lhs->id,
$this->def['join_key_rhs'] => $rhs->id,
- 'date_modified' => TimeDate::getInstance()->getNow()->asDb(),
+ 'date_modified' => TimeDate::getInstance()->nowDb(),
'deleted' => 0,
);
@@ -207,6 +208,10 @@ protected function addSelfReferencing($lhs, $rhs, $additionalFields = array())
public function remove($lhs, $rhs)
{
+ if(!($lhs instanceof SugarBean) || !($rhs instanceof SugarBean)) {
+ $GLOBALS['log']->fatal("LHS and RHS must be beans");
+ return false;
+ }
$lhsLinkName = $this->lhsLink;
$rhsLinkName = $this->rhsLink;
View
9 data/Relationships/One2MBeanRelationship.php
@@ -40,6 +40,7 @@
/**
* Represents a one to many relationship that is table based.
+ * @api
*/
class One2MBeanRelationship extends One2MRelationship
{
@@ -136,7 +137,7 @@ public function remove($lhs, $rhs, $save = true)
$rhs->in_relationship_update = TRUE;
$rhs->save();
}
-
+
if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes")
{
$this->callAfterDelete($lhs, $rhs);
@@ -207,7 +208,7 @@ public function getQuery($link, $return_as_array = false)
else
{
return array(
- 'select' => "SELECT id",
+ 'select' => "SELECT {$this->def['rhs_table']}.id",
'from' => "FROM {$this->def['rhs_table']}",
'where' => $where,
);
@@ -238,7 +239,7 @@ public function getJoin($link, $params = array(), $return_array = false)
//First join the relationship table
$join .= "$join_type $targetTableWithAlias ON $startingTable.$startingKey=$targetTable.$targetKey AND $targetTable.deleted=0\n"
//Next add any role filters
- . $this->getRoleWhere(($linkIsLHS) ? $targetTable : $startingTable) . "\n";
+ . $this->getRoleWhere(($linkIsLHS) ? $targetTable : $startingTable) . "\n";
if($return_array){
return array(
@@ -267,7 +268,7 @@ public function getSubpanelQuery($link, $params = array(), $return_array = false
$query = '';
$alias = empty($params['join_table_alias']) ? "{$link->name}_rel": $params['join_table_alias'];
- $alias = $GLOBALS['db']->getHelper()->getValidDBName($alias, 'alias');
+ $alias = $GLOBALS['db']->getValidDBName($alias, false, 'alias');
//Set up any table aliases required
$targetTableWithAlias = "$targetTable $alias";
View
1 data/Relationships/One2MRelationship.php