@@ -44,45 +44,45 @@ |
||
44 | 44 | */ |
45 | 45 | class ConnectorFactory{ |
46 | 46 | |
47 | - static $source_map = array(); |
|
47 | + static $source_map = array(); |
|
48 | 48 | |
49 | - public static function getInstance($source_name){ |
|
50 | - if(empty(self::$source_map[$source_name])) { |
|
51 | - require_once('include/connectors/sources/SourceFactory.php'); |
|
52 | - require_once('include/connectors/component.php'); |
|
53 | - $source = SourceFactory::getSource($source_name); |
|
54 | - $component = new component(); |
|
55 | - $component->setSource($source); |
|
56 | - $component->init(); |
|
57 | - self::$source_map[$source_name] = $component; |
|
58 | - } |
|
59 | - return self::$source_map[$source_name]; |
|
60 | - } |
|
49 | + public static function getInstance($source_name){ |
|
50 | + if(empty(self::$source_map[$source_name])) { |
|
51 | + require_once('include/connectors/sources/SourceFactory.php'); |
|
52 | + require_once('include/connectors/component.php'); |
|
53 | + $source = SourceFactory::getSource($source_name); |
|
54 | + $component = new component(); |
|
55 | + $component->setSource($source); |
|
56 | + $component->init(); |
|
57 | + self::$source_map[$source_name] = $component; |
|
58 | + } |
|
59 | + return self::$source_map[$source_name]; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Split the class name by _ and go through the class name |
|
64 | - * which represents the inheritance structure to load up all required parents. |
|
65 | - * @param string $class the root class we want to load. |
|
66 | - */ |
|
67 | - public static function load($class, $type){ |
|
68 | - self::loadClass($class, $type); |
|
69 | - } |
|
62 | + /** |
|
63 | + * Split the class name by _ and go through the class name |
|
64 | + * which represents the inheritance structure to load up all required parents. |
|
65 | + * @param string $class the root class we want to load. |
|
66 | + */ |
|
67 | + public static function load($class, $type){ |
|
68 | + self::loadClass($class, $type); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * include a source class file. |
|
73 | - * @param string $class a class file to include. |
|
74 | - */ |
|
75 | - public static function loadClass($class, $type){ |
|
76 | - $dir = str_replace('_','/',$class); |
|
77 | - $parts = explode("/", $dir); |
|
78 | - $file = $parts[count($parts)-1] . '.php'; |
|
79 | - if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){ |
|
80 | - require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
81 | - } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
82 | - require_once("modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
83 | - } else if(file_exists("connectors/{$type}/{$dir}/$file")) { |
|
84 | - require_once("connectors/{$type}/{$dir}/$file"); |
|
85 | - } |
|
86 | - } |
|
71 | + /** |
|
72 | + * include a source class file. |
|
73 | + * @param string $class a class file to include. |
|
74 | + */ |
|
75 | + public static function loadClass($class, $type){ |
|
76 | + $dir = str_replace('_','/',$class); |
|
77 | + $parts = explode("/", $dir); |
|
78 | + $file = $parts[count($parts)-1] . '.php'; |
|
79 | + if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){ |
|
80 | + require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
81 | + } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) { |
|
82 | + require_once("modules/Connectors/connectors/{$type}/{$dir}/$file"); |
|
83 | + } else if(file_exists("connectors/{$type}/{$dir}/$file")) { |
|
84 | + require_once("connectors/{$type}/{$dir}/$file"); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | ?> |
89 | 89 | \ No newline at end of file |
@@ -44,43 +44,43 @@ |
||
44 | 44 | */ |
45 | 45 | class ControllerFactory |
46 | 46 | { |
47 | - /** |
|
48 | - * Obtain an instance of the correct controller. |
|
49 | - * |
|
50 | - * @return an instance of SugarController |
|
51 | - */ |
|
52 | - static function getController($module){ |
|
53 | - $class = ucfirst($module).'Controller'; |
|
54 | - $customClass = 'Custom' . $class; |
|
55 | - if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | - $customClass = 'Custom' . $class; |
|
57 | - require_once('custom/modules/'.$module.'/controller.php'); |
|
58 | - if(class_exists($customClass)){ |
|
59 | - $controller = new $customClass(); |
|
60 | - }else if(class_exists($class)){ |
|
61 | - $controller = new $class(); |
|
62 | - } |
|
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | - require_once('modules/'.$module.'/controller.php'); |
|
65 | - if(class_exists($customClass)){ |
|
66 | - $controller = new $customClass(); |
|
67 | - }else if(class_exists($class)){ |
|
68 | - $controller = new $class(); |
|
69 | - } |
|
70 | - }else{ |
|
71 | - if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
72 | - require_once('custom/include/MVC/Controller/SugarController.php'); |
|
73 | - } |
|
74 | - if(class_exists('CustomSugarController')){ |
|
75 | - $controller = new CustomSugarController(); |
|
76 | - }else{ |
|
77 | - $controller = new SugarController(); |
|
78 | - } |
|
79 | - } |
|
80 | - //setup the controller |
|
81 | - $controller->setup($module); |
|
82 | - return $controller; |
|
83 | - } |
|
47 | + /** |
|
48 | + * Obtain an instance of the correct controller. |
|
49 | + * |
|
50 | + * @return an instance of SugarController |
|
51 | + */ |
|
52 | + static function getController($module){ |
|
53 | + $class = ucfirst($module).'Controller'; |
|
54 | + $customClass = 'Custom' . $class; |
|
55 | + if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | + $customClass = 'Custom' . $class; |
|
57 | + require_once('custom/modules/'.$module.'/controller.php'); |
|
58 | + if(class_exists($customClass)){ |
|
59 | + $controller = new $customClass(); |
|
60 | + }else if(class_exists($class)){ |
|
61 | + $controller = new $class(); |
|
62 | + } |
|
63 | + }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | + require_once('modules/'.$module.'/controller.php'); |
|
65 | + if(class_exists($customClass)){ |
|
66 | + $controller = new $customClass(); |
|
67 | + }else if(class_exists($class)){ |
|
68 | + $controller = new $class(); |
|
69 | + } |
|
70 | + }else{ |
|
71 | + if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
72 | + require_once('custom/include/MVC/Controller/SugarController.php'); |
|
73 | + } |
|
74 | + if(class_exists('CustomSugarController')){ |
|
75 | + $controller = new CustomSugarController(); |
|
76 | + }else{ |
|
77 | + $controller = new SugarController(); |
|
78 | + } |
|
79 | + } |
|
80 | + //setup the controller |
|
81 | + $controller->setup($module); |
|
82 | + return $controller; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | ?> |
87 | 87 | \ No newline at end of file |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * To change the template for this generated file go to |
44 | 44 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
45 | 45 | */ |
46 | - //format '<action_name>' => '<view_name>' |
|
46 | + //format '<action_name>' => '<view_name>' |
|
47 | 47 | $action_view_map['multieditview']= 'multiedit'; |
48 | 48 | $action_view_map['detailview']= 'detail'; |
49 | 49 | $action_view_map['editview']= 'edit'; |
@@ -46,29 +46,29 @@ |
||
46 | 46 | * Contributor(s): ______________________________________.. |
47 | 47 | ********************************************************************************/ |
48 | 48 | $file_access_control_map = array( |
49 | - 'modules' => array( |
|
50 | - 'administration' => array( |
|
51 | - 'actions' => array( |
|
52 | - 'backups', |
|
53 | - 'updater', |
|
54 | - ), |
|
55 | - 'links' => array( |
|
56 | - 'update', |
|
57 | - 'backup_management', |
|
58 | - 'upgrade_wizard', |
|
59 | - 'moduleBuilder', |
|
60 | - ), |
|
61 | - ), |
|
62 | - 'upgradewizard' => array( |
|
63 | - 'actions' => array( |
|
64 | - 'index', |
|
65 | - ), |
|
66 | - ), |
|
67 | - 'modulebuilder' => array( |
|
68 | - 'actions' => array( |
|
69 | - 'index' => array('params' => array('type' => array('mb'))), |
|
70 | - ), |
|
71 | - ), |
|
72 | - ) |
|
49 | + 'modules' => array( |
|
50 | + 'administration' => array( |
|
51 | + 'actions' => array( |
|
52 | + 'backups', |
|
53 | + 'updater', |
|
54 | + ), |
|
55 | + 'links' => array( |
|
56 | + 'update', |
|
57 | + 'backup_management', |
|
58 | + 'upgrade_wizard', |
|
59 | + 'moduleBuilder', |
|
60 | + ), |
|
61 | + ), |
|
62 | + 'upgradewizard' => array( |
|
63 | + 'actions' => array( |
|
64 | + 'index', |
|
65 | + ), |
|
66 | + ), |
|
67 | + 'modulebuilder' => array( |
|
68 | + 'actions' => array( |
|
69 | + 'index' => array('params' => array('type' => array('mb'))), |
|
70 | + ), |
|
71 | + ), |
|
72 | + ) |
|
73 | 73 | ); |
74 | 74 | ?> |
75 | 75 | \ No newline at end of file |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | $yui_path = array( |
44 | 44 | "2.9.0" => "include/javascript/yui", |
45 | - "2_9_0" => "include/javascript/yui", |
|
46 | - "3.3.0" => "include/javascript/yui3", |
|
47 | - "3_3_0" => "include/javascript/yui3" |
|
45 | + "2_9_0" => "include/javascript/yui", |
|
46 | + "3.3.0" => "include/javascript/yui3", |
|
47 | + "3_3_0" => "include/javascript/yui3" |
|
48 | 48 | ); |
49 | 49 | $types = array( |
50 | 50 | "js" => "application/javascript", |
51 | - "css" => "text/css", |
|
51 | + "css" => "text/css", |
|
52 | 52 | ); |
53 | 53 | $out = ""; |
54 | 54 | |
@@ -57,36 +57,36 @@ discard block |
||
57 | 57 | |
58 | 58 | foreach ($_REQUEST as $param => $val) |
59 | 59 | { |
60 | - //No backtracking in the path |
|
61 | - if (strpos($param, "..") !== false) |
|
60 | + //No backtracking in the path |
|
61 | + if (strpos($param, "..") !== false) |
|
62 | 62 | continue; |
63 | 63 | |
64 | - $version = explode("/", $param); |
|
65 | - $version = $version[0]; |
|
64 | + $version = explode("/", $param); |
|
65 | + $version = $version[0]; |
|
66 | 66 | if (empty($yui_path[$version])) continue; |
67 | 67 | |
68 | 68 | $path = $yui_path[$version] . substr($param, strlen($version)); |
69 | 69 | |
70 | - $extension = substr($path, strrpos($path, "_") + 1); |
|
70 | + $extension = substr($path, strrpos($path, "_") + 1); |
|
71 | 71 | |
72 | - //Only allowed file extensions |
|
73 | - if (empty($types[$extension])) |
|
74 | - continue; |
|
72 | + //Only allowed file extensions |
|
73 | + if (empty($types[$extension])) |
|
74 | + continue; |
|
75 | 75 | |
76 | - if (empty($contentType)) |
|
76 | + if (empty($contentType)) |
|
77 | 77 | { |
78 | 78 | $contentType = $types[$extension]; |
79 | 79 | } |
80 | - //Put together the final filepath |
|
81 | - $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
82 | - $contents = ''; |
|
83 | - if (is_file($path)) { |
|
84 | - $out .= "/*" . $path . "*/\n"; |
|
85 | - $contents = file_get_contents($path); |
|
86 | - $out .= $contents . "\n"; |
|
87 | - } |
|
88 | - $path = empty($contents) ? $path : $contents; |
|
89 | - $allpath .= md5($path); |
|
80 | + //Put together the final filepath |
|
81 | + $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
82 | + $contents = ''; |
|
83 | + if (is_file($path)) { |
|
84 | + $out .= "/*" . $path . "*/\n"; |
|
85 | + $contents = file_get_contents($path); |
|
86 | + $out .= $contents . "\n"; |
|
87 | + } |
|
88 | + $path = empty($contents) ? $path : $contents; |
|
89 | + $allpath .= md5($path); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $etag = '"'.md5($allpath).'"'; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function setRefreshIcon() |
141 | 141 | { |
142 | - $additionalTitle = ''; |
|
142 | + $additionalTitle = ''; |
|
143 | 143 | if($this->isRefreshable) |
144 | 144 | |
145 | 145 | $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\'' |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | public function displayScript() |
166 | 166 | { |
167 | 167 | |
168 | - require_once('include/SugarCharts/SugarChartFactory.php'); |
|
169 | - $sugarChart = SugarChartFactory::getInstance(); |
|
170 | - return $sugarChart->getDashletScript($this->id); |
|
168 | + require_once('include/SugarCharts/SugarChartFactory.php'); |
|
169 | + $sugarChart = SugarChartFactory::getInstance(); |
|
170 | + return $sugarChart->getDashletScript($this->id); |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown); |
273 | 273 | |
274 | 274 | if($this->isAutoRefreshable()) { |
275 | - $this->getConfigureSmartyInstance()->assign('isRefreshable', true); |
|
276 | - $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); |
|
277 | - $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); |
|
278 | - $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh); |
|
279 | - } |
|
275 | + $this->getConfigureSmartyInstance()->assign('isRefreshable', true); |
|
276 | + $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); |
|
277 | + $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); |
|
278 | + $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh); |
|
279 | + } |
|
280 | 280 | |
281 | 281 | return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl); |
282 | 282 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $dashletOffset = 0; |
340 | 340 | $module = $_REQUEST['module']; |
341 | 341 | if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) { |
342 | - $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset']; |
|
342 | + $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset']; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 |
@@ -43,79 +43,79 @@ |
||
43 | 43 | * Created: Sep 12, 2011 |
44 | 44 | */ |
45 | 45 | class DashletRssFeedTitle { |
46 | - public $defaultEncoding = "UTF-8"; |
|
47 | - public $readBytes = 8192; |
|
48 | - public $url; |
|
49 | - public $cut = 70; |
|
50 | - public $contents = ""; |
|
51 | - public $title = ""; |
|
52 | - public $endWith = "..."; |
|
53 | - public $xmlEncoding = false; |
|
54 | - public $fileOpen = false; |
|
46 | + public $defaultEncoding = "UTF-8"; |
|
47 | + public $readBytes = 8192; |
|
48 | + public $url; |
|
49 | + public $cut = 70; |
|
50 | + public $contents = ""; |
|
51 | + public $title = ""; |
|
52 | + public $endWith = "..."; |
|
53 | + public $xmlEncoding = false; |
|
54 | + public $fileOpen = false; |
|
55 | 55 | |
56 | - public function __construct($url) { |
|
57 | - $this->url = $url; |
|
58 | - } |
|
56 | + public function __construct($url) { |
|
57 | + $this->url = $url; |
|
58 | + } |
|
59 | 59 | |
60 | - public function generateTitle() { |
|
61 | - if ($this->readFeed()) { |
|
62 | - $this->getTitle(); |
|
63 | - if (!empty($this->title)) { |
|
64 | - $this->convertEncoding(); |
|
65 | - $this->cutLength(); |
|
66 | - } |
|
67 | - } |
|
68 | - return $this->title; |
|
69 | - } |
|
60 | + public function generateTitle() { |
|
61 | + if ($this->readFeed()) { |
|
62 | + $this->getTitle(); |
|
63 | + if (!empty($this->title)) { |
|
64 | + $this->convertEncoding(); |
|
65 | + $this->cutLength(); |
|
66 | + } |
|
67 | + } |
|
68 | + return $this->title; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @todo use curl with waiting timeout instead of fopen |
|
73 | - */ |
|
74 | - public function readFeed() { |
|
75 | - if ($this->url) { |
|
71 | + /** |
|
72 | + * @todo use curl with waiting timeout instead of fopen |
|
73 | + */ |
|
74 | + public function readFeed() { |
|
75 | + if ($this->url) { |
|
76 | 76 | if (!in_array(strtolower(parse_url($this->url, PHP_URL_SCHEME)), array("http", "https"), true)) { |
77 | 77 | return false; |
78 | 78 | } |
79 | - $fileOpen = @fopen($this->url, 'r'); |
|
80 | - if ($fileOpen) { |
|
81 | - $this->fileOpen = true; |
|
82 | - $this->contents = fread($fileOpen, $this->readBytes); |
|
83 | - fclose($fileOpen); |
|
84 | - return true; |
|
85 | - } |
|
86 | - } |
|
87 | - return false; |
|
88 | - } |
|
79 | + $fileOpen = @fopen($this->url, 'r'); |
|
80 | + if ($fileOpen) { |
|
81 | + $this->fileOpen = true; |
|
82 | + $this->contents = fread($fileOpen, $this->readBytes); |
|
83 | + fclose($fileOpen); |
|
84 | + return true; |
|
85 | + } |
|
86 | + } |
|
87 | + return false; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * |
|
92 | - */ |
|
93 | - public function getTitle() { |
|
94 | - $matches = array (); |
|
95 | - preg_match("/<title>.*?<\/title>/i", $this->contents, $matches); |
|
96 | - if (isset($matches[0])) { |
|
97 | - $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]); |
|
98 | - } |
|
99 | - } |
|
90 | + /** |
|
91 | + * |
|
92 | + */ |
|
93 | + public function getTitle() { |
|
94 | + $matches = array (); |
|
95 | + preg_match("/<title>.*?<\/title>/i", $this->contents, $matches); |
|
96 | + if (isset($matches[0])) { |
|
97 | + $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]); |
|
98 | + } |
|
99 | + } |
|
100 | 100 | |
101 | - public function cutLength() { |
|
102 | - if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) { |
|
103 | - $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith; |
|
104 | - } |
|
105 | - } |
|
101 | + public function cutLength() { |
|
102 | + if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) { |
|
103 | + $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith; |
|
104 | + } |
|
105 | + } |
|
106 | 106 | |
107 | - private function _identifyXmlEncoding() { |
|
108 | - $matches = array (); |
|
109 | - preg_match('/encoding\=*\".*?\"/', $this->contents, $matches); |
|
110 | - if (isset($matches[0])) { |
|
111 | - $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"'); |
|
112 | - } |
|
113 | - } |
|
107 | + private function _identifyXmlEncoding() { |
|
108 | + $matches = array (); |
|
109 | + preg_match('/encoding\=*\".*?\"/', $this->contents, $matches); |
|
110 | + if (isset($matches[0])) { |
|
111 | + $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"'); |
|
112 | + } |
|
113 | + } |
|
114 | 114 | |
115 | - public function convertEncoding() { |
|
116 | - $this->_identifyXmlEncoding(); |
|
117 | - if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) { |
|
118 | - $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title); |
|
119 | - } |
|
120 | - } |
|
115 | + public function convertEncoding() { |
|
116 | + $this->_identifyXmlEncoding(); |
|
117 | + if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) { |
|
118 | + $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title); |
|
119 | + } |
|
120 | + } |
|
121 | 121 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | function smarty_function_sugar_number_format($params, &$smarty) { |
38 | 38 | global $locale; |
39 | 39 | |
40 | - if(!isset($params['var']) || $params['var'] === '') { |
|
40 | + if(!isset($params['var']) || $params['var'] === '') { |
|
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 |
@@ -2,6 +2,6 @@ |
||
2 | 2 | //implements Smarty 3 style {nocache}{/nocache} block to prevent caching of a section of a template. |
3 | 3 | //remove this upon upgrade to Smarty 3 |
4 | 4 | function smarty_block_nocache($param, $content, &$smarty) { |
5 | - return $content; |
|
5 | + return $content; |
|
6 | 6 | } |
7 | 7 | ?> |
8 | 8 | \ No newline at end of file |