Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Release 6.2.0

  • Loading branch information...
commit a84f4a930b0ca7e79f37cbef041669203c13829b 1 parent 0b03698
@jmertic jmertic authored
Showing with 33,183 additions and 55 deletions.
  1. +1 −1  HandleAjaxCall.php
  2. +22 −17 ModuleInstall/ModuleInstaller.php
  3. +3 −2 ModuleInstall/ModuleScanner.php
  4. +1 −1  ModuleInstall/PackageManager/ListViewPackages.php
  5. +1 −1  ModuleInstall/PackageManager/PackageController.php
  6. +16 −18 ModuleInstall/PackageManager/PackageManager.php
  7. +1 −1  ModuleInstall/PackageManager/PackageManagerComm.php
  8. +2 −4 ModuleInstall/PackageManager/PackageManagerDisplay.php
  9. +1 −1  ModuleInstall/PackageManager/PackageManagerDownloader.php
  10. +1 −1  ModuleInstall/PackageManager/metadata/listviewdefs.php
  11. +1 −1  ModuleInstall/PackageManager/tpls/ModuleLoaderListView.tpl
  12. +1 −1  ModuleInstall/PackageManager/tpls/PackageForm.tpl
  13. +1 −1  ModuleInstall/PackageManager/tpls/PackageManagerLicense.tpl
  14. +2 −2 ModuleInstall/PackageManager/tpls/PackageManagerScripts.tpl
  15. +1 −1  SugarSecurity.php
  16. +1 −1  TreeData.php
  17. +1 −1  WebToLeadCapture.php
  18. +167 −0 Zend/Crypt.php
  19. +380 −0 Zend/Crypt/DiffieHellman.php
  20. +36 −0 Zend/Crypt/DiffieHellman/Exception.php
  21. +35 −0 Zend/Crypt/Exception.php
  22. +181 −0 Zend/Crypt/Hmac.php
  23. +36 −0 Zend/Crypt/Hmac/Exception.php
  24. +102 −0 Zend/Crypt/Math.php
  25. +117 −0 Zend/Crypt/Math/BigInteger.php
  26. +203 −0 Zend/Crypt/Math/BigInteger/Bcmath.php
  27. +36 −0 Zend/Crypt/Math/BigInteger/Exception.php
  28. +196 −0 Zend/Crypt/Math/BigInteger/Gmp.php
  29. +51 −0 Zend/Crypt/Math/BigInteger/Interface.php
  30. +36 −0 Zend/Crypt/Math/Exception.php
  31. +309 −0 Zend/Crypt/Rsa.php
  32. +95 −0 Zend/Crypt/Rsa/Key.php
  33. +75 −0 Zend/Crypt/Rsa/Key/Private.php
  34. +74 −0 Zend/Crypt/Rsa/Key/Public.php
  35. +95 −0 Zend/Exception.php
  36. +241 −0 Zend/Gdata.php
  37. +1,234 −0 Zend/Gdata/App.php
  38. +41 −0 Zend/Gdata/App/AuthException.php
  39. +42 −0 Zend/Gdata/App/BadMethodCallException.php
  40. +572 −0 Zend/Gdata/App/Base.php
  41. +179 −0 Zend/Gdata/App/BaseMediaSource.php
  42. +94 −0 Zend/Gdata/App/CaptchaRequiredException.php
  43. +389 −0 Zend/Gdata/App/Entry.php
  44. +43 −0 Zend/Gdata/App/Exception.php
  45. +40 −0 Zend/Gdata/App/Extension.php
  46. +43 −0 Zend/Gdata/App/Extension/Author.php
  47. +140 −0 Zend/Gdata/App/Extension/Category.php
  48. +88 −0 Zend/Gdata/App/Extension/Content.php
  49. +43 −0 Zend/Gdata/App/Extension/Contributor.php
  50. +98 −0 Zend/Gdata/App/Extension/Control.php
  51. +50 −0 Zend/Gdata/App/Extension/Draft.php
  52. +49 −0 Zend/Gdata/App/Extension/Edited.php
  53. +58 −0 Zend/Gdata/App/Extension/Element.php
  54. +49 −0 Zend/Gdata/App/Extension/Email.php
  55. +115 −0 Zend/Gdata/App/Extension/Generator.php
  56. +49 −0 Zend/Gdata/App/Extension/Icon.php
  57. +49 −0 Zend/Gdata/App/Extension/Id.php
  58. +219 −0 Zend/Gdata/App/Extension/Link.php
  59. +49 −0 Zend/Gdata/App/Extension/Logo.php
  60. +48 −0 Zend/Gdata/App/Extension/Name.php
  61. +163 −0 Zend/Gdata/App/Extension/Person.php
  62. +49 −0 Zend/Gdata/App/Extension/Published.php
  63. +49 −0 Zend/Gdata/App/Extension/Rights.php
  64. +46 −0 Zend/Gdata/App/Extension/Source.php
  65. +43 −0 Zend/Gdata/App/Extension/Subtitle.php
  66. +43 −0 Zend/Gdata/App/Extension/Summary.php
  67. +90 −0 Zend/Gdata/App/Extension/Text.php
  68. +43 −0 Zend/Gdata/App/Extension/Title.php
  69. +49 −0 Zend/Gdata/App/Extension/Updated.php
  70. +49 −0 Zend/Gdata/App/Extension/Uri.php
  71. +352 −0 Zend/Gdata/App/Feed.php
  72. +681 −0 Zend/Gdata/App/FeedEntryParent.php
  73. +267 −0 Zend/Gdata/App/FeedSourceParent.php
  74. +121 −0 Zend/Gdata/App/HttpException.php
  75. +43 −0 Zend/Gdata/App/IOException.php
  76. +42 −0 Zend/Gdata/App/InvalidArgumentException.php
  77. +119 −0 Zend/Gdata/App/LoggingHttpClientAdapterSocket.php
  78. +119 −0 Zend/Gdata/App/MediaEntry.php
  79. +146 −0 Zend/Gdata/App/MediaFileSource.php
  80. +73 −0 Zend/Gdata/App/MediaSource.php
  81. +112 −0 Zend/Gdata/App/Util.php
  82. +42 −0 Zend/Gdata/App/VersionException.php
  83. +246 −0 Zend/Gdata/AuthSub.php
  84. +204 −0 Zend/Gdata/Books.php
  85. +56 −0 Zend/Gdata/Books/CollectionEntry.php
  86. +62 −0 Zend/Gdata/Books/CollectionFeed.php
  87. +63 −0 Zend/Gdata/Books/Extension/AnnotationLink.php
  88. +59 −0 Zend/Gdata/Books/Extension/BooksCategory.php
  89. +61 −0 Zend/Gdata/Books/Extension/BooksLink.php
  90. +122 −0 Zend/Gdata/Books/Extension/Embeddability.php
  91. +59 −0 Zend/Gdata/Books/Extension/InfoLink.php
  92. +60 −0 Zend/Gdata/Books/Extension/PreviewLink.php
  93. +152 −0 Zend/Gdata/Books/Extension/Review.php
  94. +60 −0 Zend/Gdata/Books/Extension/ThumbnailLink.php
  95. +123 −0 Zend/Gdata/Books/Extension/Viewability.php
  96. +687 −0 Zend/Gdata/Books/VolumeEntry.php
  97. +62 −0 Zend/Gdata/Books/VolumeFeed.php
  98. +112 −0 Zend/Gdata/Books/VolumeQuery.php
  99. +169 −0 Zend/Gdata/Calendar.php
  100. +164 −0 Zend/Gdata/Calendar/EventEntry.php
  101. +106 −0 Zend/Gdata/Calendar/EventFeed.php
  102. +491 −0 Zend/Gdata/Calendar/EventQuery.php
  103. +125 −0 Zend/Gdata/Calendar/Extension/AccessLevel.php
  104. +125 −0 Zend/Gdata/Calendar/Extension/Color.php
  105. +134 −0 Zend/Gdata/Calendar/Extension/Hidden.php
  106. +125 −0 Zend/Gdata/Calendar/Extension/Link.php
  107. +132 −0 Zend/Gdata/Calendar/Extension/QuickAdd.php
  108. +133 −0 Zend/Gdata/Calendar/Extension/Selected.php
  109. +132 −0 Zend/Gdata/Calendar/Extension/SendEventNotifications.php
  110. +124 −0 Zend/Gdata/Calendar/Extension/Timezone.php
  111. +177 −0 Zend/Gdata/Calendar/Extension/WebContent.php
  112. +246 −0 Zend/Gdata/Calendar/ListEntry.php
  113. +106 −0 Zend/Gdata/Calendar/ListFeed.php
  114. +182 −0 Zend/Gdata/ClientLogin.php
  115. +319 −0 Zend/Gdata/Docs.php
  116. +54 −0 Zend/Gdata/Docs/DocumentListEntry.php
  117. +68 −0 Zend/Gdata/Docs/DocumentListFeed.php
  118. +228 −0 Zend/Gdata/Docs/Query.php
  119. +65 −0 Zend/Gdata/DublinCore.php
  120. +58 −0 Zend/Gdata/DublinCore/Extension/Creator.php
  121. +60 −0 Zend/Gdata/DublinCore/Extension/Date.php
  122. +58 −0 Zend/Gdata/DublinCore/Extension/Description.php
  123. +58 −0 Zend/Gdata/DublinCore/Extension/Format.php
  124. +58 −0 Zend/Gdata/DublinCore/Extension/Identifier.php
  125. +58 −0 Zend/Gdata/DublinCore/Extension/Language.php
  126. +58 −0 Zend/Gdata/DublinCore/Extension/Publisher.php
  127. +58 −0 Zend/Gdata/DublinCore/Extension/Rights.php
  128. +58 −0 Zend/Gdata/DublinCore/Extension/Subject.php
  129. +58 −0 Zend/Gdata/DublinCore/Extension/Title.php
  130. +132 −0 Zend/Gdata/Entry.php
  131. +65 −0 Zend/Gdata/Exif.php
  132. +145 −0 Zend/Gdata/Exif/Entry.php
  133. +61 −0 Zend/Gdata/Exif/Extension/Distance.php
  134. +61 −0 Zend/Gdata/Exif/Extension/Exposure.php
  135. +61 −0 Zend/Gdata/Exif/Extension/FStop.php
  136. +61 −0 Zend/Gdata/Exif/Extension/Flash.php
  137. +61 −0 Zend/Gdata/Exif/Extension/FocalLength.php
  138. +61 −0 Zend/Gdata/Exif/Extension/ImageUniqueId.php
  139. +61 −0 Zend/Gdata/Exif/Extension/Iso.php
  140. +61 −0 Zend/Gdata/Exif/Extension/Make.php
  141. +61 −0 Zend/Gdata/Exif/Extension/Model.php
  142. +549 −0 Zend/Gdata/Exif/Extension/Tags.php
  143. +61 −0 Zend/Gdata/Exif/Extension/Time.php
  144. +70 −0 Zend/Gdata/Exif/Feed.php
  145. +58 −0 Zend/Gdata/Extension.php
  146. +123 −0 Zend/Gdata/Extension/AttendeeStatus.php
  147. +123 −0 Zend/Gdata/Extension/AttendeeType.php
  148. +117 −0 Zend/Gdata/Extension/Comments.php
  149. +167 −0 Zend/Gdata/Extension/EntryLink.php
  150. +101 −0 Zend/Gdata/Extension/EventStatus.php
  151. +106 −0 Zend/Gdata/Extension/ExtendedProperty.php
  152. +175 −0 Zend/Gdata/Extension/FeedLink.php
  153. +50 −0 Zend/Gdata/Extension/OpenSearchItemsPerPage.php
  154. +50 −0 Zend/Gdata/Extension/OpenSearchStartIndex.php
  155. +50 −0 Zend/Gdata/Extension/OpenSearchTotalResults.php
  156. +142 −0 Zend/Gdata/Extension/OriginalEvent.php
  157. +240 −0 Zend/Gdata/Extension/Rating.php
  158. +49 −0 Zend/Gdata/Extension/Recurrence.php
  159. +215 −0 Zend/Gdata/Extension/RecurrenceException.php
  160. +171 −0 Zend/Gdata/Extension/Reminder.php
  161. +123 −0 Zend/Gdata/Extension/Transparency.php
  162. +123 −0 Zend/Gdata/Extension/Visibility.php
  163. +169 −0 Zend/Gdata/Extension/When.php
  164. +171 −0 Zend/Gdata/Extension/Where.php
  165. +299 −0 Zend/Gdata/Extension/Who.php
  166. +251 −0 Zend/Gdata/Feed.php
  167. +1,683 −0 Zend/Gdata/Gapps.php
  168. +214 −0 Zend/Gdata/Gapps/EmailListEntry.php
  169. +53 −0 Zend/Gdata/Gapps/EmailListFeed.php
  170. +187 −0 Zend/Gdata/Gapps/EmailListQuery.php
  171. +146 −0 Zend/Gdata/Gapps/EmailListRecipientEntry.php
  172. +53 −0 Zend/Gdata/Gapps/EmailListRecipientFeed.php
  173. +153 −0 Zend/Gdata/Gapps/EmailListRecipientQuery.php
  174. +233 −0 Zend/Gdata/Gapps/Error.php
  175. +144 −0 Zend/Gdata/Gapps/Extension/EmailList.php
  176. +485 −0 Zend/Gdata/Gapps/Extension/Login.php
  177. +181 −0 Zend/Gdata/Gapps/Extension/Name.php
  178. +142 −0 Zend/Gdata/Gapps/Extension/Nickname.php
  179. +180 −0 Zend/Gdata/Gapps/Extension/Property.php
  180. +142 −0 Zend/Gdata/Gapps/Extension/Quota.php
  181. +158 −0 Zend/Gdata/Gapps/GroupEntry.php
  182. +53 −0 Zend/Gdata/Gapps/GroupFeed.php
  183. +226 −0 Zend/Gdata/Gapps/GroupQuery.php
  184. +159 −0 Zend/Gdata/Gapps/MemberEntry.php
  185. +53 −0 Zend/Gdata/Gapps/MemberFeed.php
  186. +194 −0 Zend/Gdata/Gapps/MemberQuery.php
  187. +189 −0 Zend/Gdata/Gapps/NicknameEntry.php
  188. +53 −0 Zend/Gdata/Gapps/NicknameFeed.php
  189. +186 −0 Zend/Gdata/Gapps/NicknameQuery.php
  190. +158 −0 Zend/Gdata/Gapps/OwnerEntry.php
  191. +53 −0 Zend/Gdata/Gapps/OwnerFeed.php
  192. +147 −0 Zend/Gdata/Gapps/OwnerQuery.php
  193. +123 −0 Zend/Gdata/Gapps/Query.php
  194. +208 −0 Zend/Gdata/Gapps/ServiceException.php
  195. +295 −0 Zend/Gdata/Gapps/UserEntry.php
  196. +53 −0 Zend/Gdata/Gapps/UserFeed.php
  197. +147 −0 Zend/Gdata/Gapps/UserQuery.php
  198. +209 −0 Zend/Gdata/Gbase.php
  199. +151 −0 Zend/Gdata/Gbase/Entry.php
  200. +115 −0 Zend/Gdata/Gbase/Extension/BaseAttribute.php
  201. +60 −0 Zend/Gdata/Gbase/Feed.php
  202. +161 −0 Zend/Gdata/Gbase/ItemEntry.php
  203. +48 −0 Zend/Gdata/Gbase/ItemFeed.php
  204. +101 −0 Zend/Gdata/Gbase/ItemQuery.php
  205. +268 −0 Zend/Gdata/Gbase/Query.php
  206. +48 −0 Zend/Gdata/Gbase/SnippetEntry.php
  207. +48 −0 Zend/Gdata/Gbase/SnippetFeed.php
  208. +74 −0 Zend/Gdata/Gbase/SnippetQuery.php
  209. +70 −0 Zend/Gdata/Geo.php
  210. +97 −0 Zend/Gdata/Geo/Entry.php
  211. +135 −0 Zend/Gdata/Geo/Extension/GeoRssWhere.php
  212. +136 −0 Zend/Gdata/Geo/Extension/GmlPoint.php
  213. +61 −0 Zend/Gdata/Geo/Extension/GmlPos.php
  214. +64 −0 Zend/Gdata/Geo/Feed.php
  215. +274 −0 Zend/Gdata/Health.php
  216. +124 −0 Zend/Gdata/Health/Extension/Ccr.php
  217. +135 −0 Zend/Gdata/Health/ProfileEntry.php
  218. +67 −0 Zend/Gdata/Health/ProfileFeed.php
  219. +100 −0 Zend/Gdata/Health/ProfileListEntry.php
  220. +53 −0 Zend/Gdata/Health/ProfileListFeed.php
  221. +285 −0 Zend/Gdata/Health/Query.php
  222. +127 −0 Zend/Gdata/HttpAdapterStreamingProxy.php
  223. +111 −0 Zend/Gdata/HttpAdapterStreamingSocket.php
  224. +352 −0 Zend/Gdata/HttpClient.php
  225. +428 −0 Zend/Gdata/Kind/EventEntry.php
  226. +65 −0 Zend/Gdata/Media.php
  227. +134 −0 Zend/Gdata/Media/Entry.php
  228. +148 −0 Zend/Gdata/Media/Extension/MediaCategory.php
  229. +522 −0 Zend/Gdata/Media/Extension/MediaContent.php
  230. +116 −0 Zend/Gdata/Media/Extension/MediaCopyright.php
  231. +149 −0 Zend/Gdata/Media/Extension/MediaCredit.php
  232. +116 −0 Zend/Gdata/Media/Extension/MediaDescription.php
  233. +566 −0 Zend/Gdata/Media/Extension/MediaGroup.php
  234. +115 −0 Zend/Gdata/Media/Extension/MediaHash.php
  235. +52 −0 Zend/Gdata/Media/Extension/MediaKeywords.php
  236. +178 −0 Zend/Gdata/Media/Extension/MediaPlayer.php
  237. +118 −0 Zend/Gdata/Media/Extension/MediaRating.php
  238. +149 −0 Zend/Gdata/Media/Extension/MediaRestriction.php
  239. +211 −0 Zend/Gdata/Media/Extension/MediaText.php
  240. +210 −0 Zend/Gdata/Media/Extension/MediaThumbnail.php
  241. +118 −0 Zend/Gdata/Media/Extension/MediaTitle.php
Sorry, we could not display the entire diff because too many files (4,177) changed.
View
2  HandleAjaxCall.php
@@ -1,7 +1,7 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
39 ModuleInstall/ModuleInstaller.php
@@ -1,7 +1,7 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
@@ -224,10 +224,13 @@ function install($base_dir, $is_upgrade = false, $previous_version = ''){
$rac = new RepairAndClear();
$rac->repairAndClearAll($selectedActions, $installed_modules,true, false);
$this->rebuild_relationships();
- $this->log('<br><b>' . translate('LBL_MI_COMPLETE') . '</b>');
-
UpdateSystemTabs('Add',$tab_modules);
-
+
+ //clear the unified_search_module.php file
+ require_once('modules/Home/UnifiedSearchAdvanced.php');
+ UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile();
+
+ $this->log('<br><b>' . translate('LBL_MI_COMPLETE') . '</b>');
}else{
die("No \$installdefs Defined In $this->base_dir/manifest.php");
}
@@ -337,7 +340,9 @@ function uninstall_new_files($cp, $backup_path){
//if it's not a sugar file then we remove it otherwise we can't restor it
if(!$this->ms->sugarFileExists($to)){
$GLOBALS['log']->debug('ModuleInstaller[uninstall_new_file] deleting file ' . $to);
- unlink($to);
+ if(file_exists($to)) {
+ unlink($to);
+ }
}else{
$GLOBALS['log']->fatal('ModuleInstaller[uninstall_new_file] Could not remove file ' . $to . ' as no backup file was found to restore to');
}
@@ -1261,6 +1266,10 @@ function uninstall($base_dir){
UpdateSystemTabs('Restore',$installed_modules);
+ //clear the unified_search_module.php file
+ require_once('modules/Home/UnifiedSearchAdvanced.php');
+ UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile();
+
$this->log('<br><b>' . translate('LBL_MI_COMPLETE') . '</b>');
if(!$this->silent){
update_progress_bar('install', $total_steps, $total_steps);
@@ -1289,6 +1298,7 @@ function rebuild_vardefs(){
$this->merge_files('Ext/Vardefs/', 'vardefs.ext.php');
sugar_cache_reset();
}
+
function rebuild_layoutdefs(){
$this->log(translate('LBL_MI_REBUILDING') . " Layoutdefs...");
$this->merge_files('Ext/Layoutdefs/', 'layoutdefs.ext.php');
@@ -1302,12 +1312,12 @@ function rebuild_menus(){
function rebuild_dashletcontainers(){
$this->log(translate('LBL_MI_REBUILDING') . " DC Actions...");
- $this->merge_files('Ext/DashletContainer/Containers', 'dcactions.ext.php');
+ $this->merge_files('Ext/DashletContainer/Containers/', 'dcactions.ext.php');
}
function rebuild_modules(){
$this->log(translate('LBL_MI_REBUILDING') . " Modules...");
- $this->merge_files('Ext/Include', 'modules.ext.php', '', true);
+ $this->merge_files('Ext/Include/', 'modules.ext.php', '', true);
}
function rebuild_administration(){
@@ -1400,18 +1410,14 @@ function merge_files($path, $name, $filter = '', $application = false){
if (substr($entry, 0, 9) == '_override') {
$override[] = $entry;
} else {
- $fp = sugar_fopen($module_install . '/' . $entry, 'r');
- $file = fread($fp , filesize($module_install . '/' . $entry));
+ $file = file_get_contents($module_install . '/' . $entry);
$GLOBALS['log']->debug(get_class($this)."->merge_files(): found {$module_install}{$entry}") ;
- fclose($fp);
$extension .= "\n". str_replace(array('<?php', '?>', '<?PHP', '<?'), array('','', '' ,'') , $file);
}
}
}
foreach ($override as $entry) {
- $fp = sugar_fopen($module_install . '/' . $entry, 'r');
- $file = fread($fp , filesize($module_install . '/' . $entry));
- fclose($fp);
+ $file = file_get_contents($module_install . '/' . $entry);
$extension .= "\n". str_replace(array('<?php', '?>', '<?PHP', '<?'), array('','', '' ,'') , $file);
}
}
@@ -1446,9 +1452,7 @@ function merge_files($path, $name, $filter = '', $application = false){
if((empty($filter) || substr_count($entry, $filter) > 0) && is_file($module_install.'/'.$entry)
&& $entry != '.' && $entry != '..' && strtolower(substr($entry, -4)) == ".php")
{
- $fp = sugar_fopen($module_install . '/' . $entry, 'r');
- $file = fread($fp , filesize($module_install . '/' . $entry));
- fclose($fp);
+ $file = file_get_contents($module_install . '/' . $entry);
$extension .= "\n". str_replace(array('<?php', '?>', '<?PHP', '<?'), array('','', '' ,'') , $file);
}
}
@@ -1624,6 +1628,7 @@ private function dir_get_files($path, $base_path){
private function dir_file_count($path){
//if its a file then it has at least 1 file in the directory
if(is_file($path)) return 1;
+ if(!is_dir($path)) return 0;
$d = dir($path);
$count = 0;
while ($e = $d->read()){
@@ -1992,7 +1997,7 @@ function disable_relationships($action = 'disable'){
$path ='custom/Extension/' . $relationship['module']. '/Ext/Layoutdefs';
}
}
-
+
if(!empty($relationship['module_layoutdefs']) && file_exists($path . '/'. $this->id_name . '.php')){
mkdir_recursive($path . '/'.DISABLED_PATH, true);
rename( $path . '/'. $this->id_name . '.php', $path . '/'.DISABLED_PATH.'/'. $this->id_name . '.php');
View
5 ModuleInstall/ModuleScanner.php
@@ -1,7 +1,7 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
@@ -281,7 +281,8 @@ public function scanFile($file){
*/
public function sugarFileExists($path){
static $md5 = array();
- if(empty($md5)){
+ if(empty($md5) && file_exists('files.md5'))
+ {
include('files.md5');
$md5 = $md5_string;
}
View
2  ModuleInstall/PackageManager/ListViewPackages.php
@@ -1,6 +1,6 @@
<?php
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
2  ModuleInstall/PackageManager/PackageController.php
@@ -1,6 +1,6 @@
<?php
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
34 ModuleInstall/PackageManager/PackageManager.php
@@ -1,6 +1,6 @@
<?php
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
@@ -233,7 +233,7 @@ function authenticate($username, $password, $systemname='', $terms_checked = tru
}
function setCredentials($username, $password, $systemname){
-
+
$admin = new Administration();
$admin->retrieveSettings();
$admin->saveSetting(CREDENTIAL_CATEGORY, CREDENTIAL_USERNAME, $username);
@@ -244,7 +244,7 @@ function setCredentials($username, $password, $systemname){
}
function getCredentials(){
-
+
$admin = new Administration();
$admin->retrieveSettings(CREDENTIAL_CATEGORY, true);
$credentials = array();
@@ -619,7 +619,7 @@ function getUITextForType( $type ){
}
function getImageForType( $type ){
-
+
$icon = "";
switch( $type ){
case "full":
@@ -664,7 +664,7 @@ function getPackagesInStaging($view = 'module'){
$alreadyProcessed["$val"] = true;
}
}
-
+
$upgrades_available = 0;
$packages = array();
$mod_strings = return_module_language($current_language, "Administration");
@@ -703,7 +703,7 @@ function getPackagesInStaging($view = 'module'){
//check dependencies first
if(!empty($dependencies)){
-
+
$uh = new UpgradeHistory();
$not_found = $uh->checkDependencies($dependencies);
if(!empty($not_found) && count($not_found) > 0){
@@ -736,7 +736,7 @@ function getPackagesInStaging($view = 'module'){
$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);
@@ -751,9 +751,7 @@ function getLicenseFromFile($file){
$base_tmp_upgrade_dir = "$base_upgrade_dir/temp";
$license_file = $this->extractFile($file, 'LICENSE.txt', $base_tmp_upgrade_dir);
if(is_file($license_file)){
- $fh = sugar_fopen($license_file, 'r');
- $contents = fread($fh, filesize($license_file));
- fclose($fh);
+ $contents = file_get_contents($license_file);
return $contents;
}else{
return null;
@@ -856,15 +854,15 @@ function getinstalledPackages($types = array('module', 'langpack')){
} else {
$file_uninstall = fileToHash( $file_uninstall );
}
-
+
$packages[] = array(
- 'name' => $name,
- 'version' => $version,
- 'type' => $type,
- 'published_date' => $date_entered,
- 'description' => $description,
- 'uninstallable' =>$uninstallable,
- 'file_install' => $file_uninstall ,
+ 'name' => $name,
+ 'version' => $version,
+ 'type' => $type,
+ 'published_date' => $date_entered,
+ 'description' => $description,
+ 'uninstallable' =>$uninstallable,
+ 'file_install' => $file_uninstall ,
'file' => fileToHash($filename),
'enabled' => $enabled_string
);
View
2  ModuleInstall/PackageManager/PackageManagerComm.php
@@ -1,6 +1,6 @@
<?php
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
6 ModuleInstall/PackageManager/PackageManagerDisplay.php
@@ -1,6 +1,6 @@
<?php
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
@@ -324,9 +324,7 @@ function buildTreeView($div_id, $isAlive = true){
function getLicenseDisplay($license_file, $form_action, $next_step, $zipFile, $type, $manifest, $modify_field){
global $current_language;
$mod_strings = return_module_language($current_language, "Administration");
- $fh = sugar_fopen($license_file, 'r');
- $contents = fread($fh, filesize($license_file));
- fclose($fh);
+ $contents = sugar_file_get_contents($license_file);
$div_id = urlencode($zipFile);
$display = "<form name='delete{$zipFile}' action='{$form_action}' method='POST'>";
$display .= "<input type='hidden' name='current_step' value='{$next_step}'>";
View
2  ModuleInstall/PackageManager/PackageManagerDownloader.php
@@ -1,6 +1,6 @@
<?php
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
2  ModuleInstall/PackageManager/metadata/listviewdefs.php
@@ -1,6 +1,6 @@
<?php
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
2  ModuleInstall/PackageManager/tpls/ModuleLoaderListView.tpl
@@ -1,6 +1,6 @@
{*
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
2  ModuleInstall/PackageManager/tpls/PackageForm.tpl
@@ -1,6 +1,6 @@
{*
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
2  ModuleInstall/PackageManager/tpls/PackageManagerLicense.tpl
@@ -1,6 +1,6 @@
{*
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
4 ModuleInstall/PackageManager/tpls/PackageManagerScripts.tpl
@@ -1,6 +1,6 @@
{*
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
@@ -35,8 +35,8 @@
********************************************************************************/
*}
+<script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
{literal}
-<script type="text/javascript" src="include/javascript/sugar_grp_yui_widgets.js"></script>
<script>
/*
* a reference to an instance of PackageManagerGrid
View
2  SugarSecurity.php
@@ -1,6 +1,6 @@
<?PHP
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
2  TreeData.php
@@ -1,7 +1,7 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
2  WebToLeadCapture.php
@@ -1,7 +1,7 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
- * SugarCRM is a customer relationship management program developed by
+ * SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
View
167 Zend/Crypt.php
@@ -0,0 +1,167 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt
+{
+
+ const TYPE_OPENSSL = 'openssl';
+ const TYPE_HASH = 'hash';
+ const TYPE_MHASH = 'mhash';
+
+ protected static $_type = null;
+
+ /**
+ * @var array
+ */
+ protected static $_supportedAlgosOpenssl = array(
+ 'md2',
+ 'md4',
+ 'mdc2',
+ 'rmd160',
+ 'sha',
+ 'sha1',
+ 'sha224',
+ 'sha256',
+ 'sha384',
+ 'sha512'
+ );
+
+ /**
+ * @var array
+ */
+ protected static $_supportedAlgosMhash = array(
+ 'adler32',
+ 'crc32',
+ 'crc32b',
+ 'gost',
+ 'haval128',
+ 'haval160',
+ 'haval192',
+ 'haval256',
+ 'md4',
+ 'md5',
+ 'ripemd160',
+ 'sha1',
+ 'sha256',
+ 'tiger',
+ 'tiger128',
+ 'tiger160'
+ );
+
+ /**
+ * @param string $algorithm
+ * @param string $data
+ * @param bool $binaryOutput
+ * @return unknown
+ */
+ public static function hash($algorithm, $data, $binaryOutput = false)
+ {
+ $algorithm = strtolower($algorithm);
+ if (function_exists($algorithm)) {
+ return $algorithm($data, $binaryOutput);
+ }
+ self::_detectHashSupport($algorithm);
+ $supportedMethod = '_digest' . ucfirst(self::$_type);
+ $result = self::$supportedMethod($algorithm, $data, $binaryOutput);
+ }
+
+ /**
+ * @param string $algorithm
+ * @throws Zend_Crypt_Exception
+ */
+ protected static function _detectHashSupport($algorithm)
+ {
+ if (function_exists('hash')) {
+ self::$_type = self::TYPE_HASH;
+ if (in_array($algorithm, hash_algos())) {
+ return;
+ }
+ }
+ if (function_exists('mhash')) {
+ self::$_type = self::TYPE_MHASH;
+ if (in_array($algorithm, self::$_supportedAlgosMhash)) {
+ return;
+ }
+ }
+ if (function_exists('openssl_digest')) {
+ if ($algorithm == 'ripemd160') {
+ $algorithm = 'rmd160';
+ }
+ self::$_type = self::TYPE_OPENSSL;
+ if (in_array($algorithm, self::$_supportedAlgosOpenssl)) {
+ return;
+ }
+ }
+ /**
+ * @see Zend_Crypt_Exception
+ */
+ require_once 'Zend/Crypt/Exception.php';
+ throw new Zend_Crypt_Exception('\'' . $algorithm . '\' is not supported by any available extension or native function');
+ }
+
+ /**
+ * @param string $algorithm
+ * @param string $data
+ * @param bool $binaryOutput
+ * @return string
+ */
+ protected static function _digestHash($algorithm, $data, $binaryOutput)
+ {
+ return hash($algorithm, $data, $binaryOutput);
+ }
+
+ /**
+ * @param string $algorithm
+ * @param string $data
+ * @param bool $binaryOutput
+ * @return string
+ */
+ protected static function _digestMhash($algorithm, $data, $binaryOutput)
+ {
+ $constant = constant('MHASH_' . strtoupper($algorithm));
+ $binary = mhash($constant, $data);
+ if ($binaryOutput) {
+ return $binary;
+ }
+ return bin2hex($binary);
+ }
+
+ /**
+ * @param string $algorithm
+ * @param string $data
+ * @param bool $binaryOutput
+ * @return string
+ */
+ protected static function _digestOpenssl($algorithm, $data, $binaryOutput)
+ {
+ if ($algorithm == 'ripemd160') {
+ $algorithm = 'rmd160';
+ }
+ return openssl_digest($data, $algorithm, $binaryOutput);
+ }
+
+}
View
380 Zend/Crypt/DiffieHellman.php
@@ -0,0 +1,380 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @subpackage DiffieHellman
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * PHP implementation of the Diffie-Hellman public key encryption algorithm.
+ * Allows two unassociated parties to establish a joint shared secret key
+ * to be used in encrypting subsequent communications.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt_DiffieHellman
+{
+
+ /**
+ * Static flag to select whether to use PHP5.3's openssl extension
+ * if available.
+ *
+ * @var boolean
+ */
+ public static $useOpenssl = true;
+
+ /**
+ * Default large prime number; required by the algorithm.
+ *
+ * @var string
+ */
+ private $_prime = null;
+
+ /**
+ * The default generator number. This number must be greater than 0 but
+ * less than the prime number set.
+ *
+ * @var string
+ */
+ private $_generator = null;
+
+ /**
+ * A private number set by the local user. It's optional and will
+ * be generated if not set.
+ *
+ * @var string
+ */
+ private $_privateKey = null;
+
+ /**
+ * BigInteger support object courtesy of Zend_Crypt_Math
+ *
+ * @var Zend_Crypt_Math_BigInteger
+ */
+ private $_math = null;
+
+ /**
+ * The public key generated by this instance after calling generateKeys().
+ *
+ * @var string
+ */
+ private $_publicKey = null;
+
+ /**
+ * The shared secret key resulting from a completed Diffie Hellman
+ * exchange
+ *
+ * @var string
+ */
+ private $_secretKey = null;
+
+ /**
+ * Constants
+ */
+ const BINARY = 'binary';
+ const NUMBER = 'number';
+ const BTWOC = 'btwoc';
+
+ /**
+ * Constructor; if set construct the object using the parameter array to
+ * set values for Prime, Generator and Private.
+ * If a Private Key is not set, one will be generated at random.
+ *
+ * @param string $prime
+ * @param string $generator
+ * @param string $privateKey
+ * @param string $privateKeyType
+ * @return void
+ */
+ public function __construct($prime, $generator, $privateKey = null, $privateKeyType = self::NUMBER)
+ {
+ $this->setPrime($prime);
+ $this->setGenerator($generator);
+ if ($privateKey !== null) {
+ $this->setPrivateKey($privateKey, $privateKeyType);
+ }
+ $this->setBigIntegerMath();
+ }
+
+ /**
+ * Generate own public key. If a private number has not already been
+ * set, one will be generated at this stage.
+ *
+ * @return Zend_Crypt_DiffieHellman
+ */
+ public function generateKeys()
+ {
+ if (function_exists('openssl_dh_compute_key') && self::$useOpenssl !== false) {
+ $details = array();
+ $details['p'] = $this->getPrime();
+ $details['g'] = $this->getGenerator();
+ if ($this->hasPrivateKey()) {
+ $details['priv_key'] = $this->getPrivateKey();
+ }
+ $opensslKeyResource = openssl_pkey_new( array('dh' => $details) );
+ $data = openssl_pkey_get_details($opensslKeyResource);
+ $this->setPrivateKey($data['dh']['priv_key'], self::BINARY);
+ $this->setPublicKey($data['dh']['pub_key'], self::BINARY);
+ } else {
+ // Private key is lazy generated in the absence of PHP 5.3's ext/openssl
+ $publicKey = $this->_math->powmod($this->getGenerator(), $this->getPrivateKey(), $this->getPrime());
+ $this->setPublicKey($publicKey);
+ }
+ return $this;
+ }
+
+ /**
+ * Setter for the value of the public number
+ *
+ * @param string $number
+ * @param string $type
+ * @return Zend_Crypt_DiffieHellman
+ */
+ public function setPublicKey($number, $type = self::NUMBER)
+ {
+ if ($type == self::BINARY) {
+ $number = $this->_math->fromBinary($number);
+ }
+ if (!preg_match("/^\d+$/", $number)) {
+ require_once('Zend/Crypt/DiffieHellman/Exception.php');
+ throw new Zend_Crypt_DiffieHellman_Exception('invalid parameter; not a positive natural number');
+ }
+ $this->_publicKey = (string) $number;
+ return $this;
+ }
+
+ /**
+ * Returns own public key for communication to the second party to this
+ * transaction.
+ *
+ * @param string $type
+ * @return string
+ */
+ public function getPublicKey($type = self::NUMBER)
+ {
+ if ($this->_publicKey === null) {
+ require_once 'Zend/Crypt/DiffieHellman/Exception.php';
+ throw new Zend_Crypt_DiffieHellman_Exception('A public key has not yet been generated using a prior call to generateKeys()');
+ }
+ if ($type == self::BINARY) {
+ return $this->_math->toBinary($this->_publicKey);
+ } elseif ($type == self::BTWOC) {
+ return $this->_math->btwoc($this->_math->toBinary($this->_publicKey));
+ }
+ return $this->_publicKey;
+ }
+
+ /**
+ * Compute the shared secret key based on the public key received from the
+ * the second party to this transaction. This should agree to the secret
+ * key the second party computes on our own public key.
+ * Once in agreement, the key is known to only to both parties.
+ * By default, the function expects the public key to be in binary form
+ * which is the typical format when being transmitted.
+ *
+ * If you need the binary form of the shared secret key, call
+ * getSharedSecretKey() with the optional parameter for Binary output.
+ *
+ * @param string $publicKey
+ * @param string $type
+ * @return mixed
+ */
+ public function computeSecretKey($publicKey, $type = self::NUMBER, $output = self::NUMBER)
+ {
+ if ($type == self::BINARY) {
+ $publicKey = $this->_math->fromBinary($publicKey);
+ }
+ if (!preg_match("/^\d+$/", $publicKey)) {
+ require_once('Zend/Crypt/DiffieHellman/Exception.php');
+ throw new Zend_Crypt_DiffieHellman_Exception('invalid parameter; not a positive natural number');
+ }
+ if (function_exists('openssl_dh_compute_key') && self::$useOpenssl !== false) {
+ $this->_secretKey = openssl_dh_compute_key($publicKey, $this->getPublicKey());
+ } else {
+ $this->_secretKey = $this->_math->powmod($publicKey, $this->getPrivateKey(), $this->getPrime());
+ }
+ return $this->getSharedSecretKey($output);
+ }
+
+ /**
+ * Return the computed shared secret key from the DiffieHellman transaction
+ *
+ * @param string $type
+ * @return string
+ */
+ public function getSharedSecretKey($type = self::NUMBER)
+ {
+ if (!isset($this->_secretKey)) {
+ require_once('Zend/Crypt/DiffieHellman/Exception.php');
+ throw new Zend_Crypt_DiffieHellman_Exception('A secret key has not yet been computed; call computeSecretKey()');
+ }
+ if ($type == self::BINARY) {
+ return $this->_math->toBinary($this->_secretKey);
+ } elseif ($type == self::BTWOC) {
+ return $this->_math->btwoc($this->_math->toBinary($this->_secretKey));
+ }
+ return $this->_secretKey;
+ }
+
+ /**
+ * Setter for the value of the prime number
+ *
+ * @param string $number
+ * @return Zend_Crypt_DiffieHellman
+ */
+ public function setPrime($number)
+ {
+ if (!preg_match("/^\d+$/", $number) || $number < 11) {
+ require_once('Zend/Crypt/DiffieHellman/Exception.php');
+ throw new Zend_Crypt_DiffieHellman_Exception('invalid parameter; not a positive natural number or too small: should be a large natural number prime');
+ }
+ $this->_prime = (string) $number;
+ return $this;
+ }
+
+ /**
+ * Getter for the value of the prime number
+ *
+ * @return string
+ */
+ public function getPrime()
+ {
+ if (!isset($this->_prime)) {
+ require_once('Zend/Crypt/DiffieHellman/Exception.php');
+ throw new Zend_Crypt_DiffieHellman_Exception('No prime number has been set');
+ }
+ return $this->_prime;
+ }
+
+
+ /**
+ * Setter for the value of the generator number
+ *
+ * @param string $number
+ * @return Zend_Crypt_DiffieHellman
+ */
+ public function setGenerator($number)
+ {
+ if (!preg_match("/^\d+$/", $number) || $number < 2) {
+ require_once('Zend/Crypt/DiffieHellman/Exception.php');
+ throw new Zend_Crypt_DiffieHellman_Exception('invalid parameter; not a positive natural number greater than 1');
+ }
+ $this->_generator = (string) $number;
+ return $this;
+ }
+
+ /**
+ * Getter for the value of the generator number
+ *
+ * @return string
+ */
+ public function getGenerator()
+ {
+ if (!isset($this->_generator)) {
+ require_once('Zend/Crypt/DiffieHellman/Exception.php');
+ throw new Zend_Crypt_DiffieHellman_Exception('No generator number has been set');
+ }
+ return $this->_generator;
+ }
+
+ /**
+ * Setter for the value of the private number
+ *
+ * @param string $number
+ * @param string $type
+ * @return Zend_Crypt_DiffieHellman
+ */
+ public function setPrivateKey($number, $type = self::NUMBER)
+ {
+ if ($type == self::BINARY) {
+ $number = $this->_math->fromBinary($number);
+ }
+ if (!preg_match("/^\d+$/", $number)) {
+ require_once('Zend/Crypt/DiffieHellman/Exception.php');
+ throw new Zend_Crypt_DiffieHellman_Exception('invalid parameter; not a positive natural number');
+ }
+ $this->_privateKey = (string) $number;
+ return $this;
+ }
+
+ /**
+ * Getter for the value of the private number
+ *
+ * @param string $type
+ * @return string
+ */
+ public function getPrivateKey($type = self::NUMBER)
+ {
+ if (!$this->hasPrivateKey()) {
+ $this->setPrivateKey($this->_generatePrivateKey(), self::BINARY);
+ }
+ if ($type == self::BINARY) {
+ return $this->_math->toBinary($this->_privateKey);
+ } elseif ($type == self::BTWOC) {
+ return $this->_math->btwoc($this->_math->toBinary($this->_privateKey));
+ }
+ return $this->_privateKey;
+ }
+
+ /**
+ * Check whether a private key currently exists.
+ *
+ * @return boolean
+ */
+ public function hasPrivateKey()
+ {
+ return isset($this->_privateKey);
+ }
+
+ /**
+ * Setter to pass an extension parameter which is used to create
+ * a specific BigInteger instance for a specific extension type.
+ * Allows manual setting of the class in case of an extension
+ * problem or bug.
+ *
+ * @param string $extension
+ * @return void
+ */
+ public function setBigIntegerMath($extension = null)
+ {
+ /**
+ * @see Zend_Crypt_Math
+ */
+ require_once 'Zend/Crypt/Math.php';
+ $this->_math = new Zend_Crypt_Math($extension);
+ }
+
+ /**
+ * In the event a private number/key has not been set by the user,
+ * or generated by ext/openssl, a best attempt will be made to
+ * generate a random key. Having a random number generator installed
+ * on linux/bsd is highly recommended! The alternative is not recommended
+ * for production unless without any other option.
+ *
+ * @return string
+ */
+ protected function _generatePrivateKey()
+ {
+ $rand = $this->_math->rand($this->getGenerator(), $this->getPrime());
+ return $rand;
+ }
+
+}
View
36 Zend/Crypt/DiffieHellman/Exception.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @subpackage DiffieHellman
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * @see Zend_Crypt_Exception
+ */
+require_once 'Zend/Crypt/Exception.php';
+
+/**
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt_DiffieHellman_Exception extends Zend_Crypt_Exception
+{
+}
View
35 Zend/Crypt/Exception.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * @see Zend_Exception
+ */
+require_once 'Zend/Exception.php';
+
+/**
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt_Exception extends Zend_Exception
+{
+}
View
181 Zend/Crypt/Hmac.php
@@ -0,0 +1,181 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @subpackage Hmac
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * @see Zend_Crypt
+ */
+require_once 'Zend/Crypt.php';
+
+/**
+ * PHP implementation of the RFC 2104 Hash based Message Authentication Code
+ * algorithm.
+ *
+ * @todo Patch for refactoring failed tests (key block sizes >80 using internal algo)
+ * @todo Check if mhash() is a required alternative (will be PECL-only soon)
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt_Hmac extends Zend_Crypt
+{
+
+ /**
+ * The key to use for the hash
+ *
+ * @var string
+ */
+ protected static $_key = null;
+
+ /**
+ * pack() format to be used for current hashing method
+ *
+ * @var string
+ */
+ protected static $_packFormat = null;
+
+ /**
+ * Hashing algorithm; can be the md5/sha1 functions or any algorithm name
+ * listed in the output of PHP 5.1.2+ hash_algos().
+ *
+ * @var string
+ */
+ protected static $_hashAlgorithm = 'md5';
+
+ /**
+ * List of algorithms supported my mhash()
+ *
+ * @var array
+ */
+ protected static $_supportedMhashAlgorithms = array('adler32',' crc32', 'crc32b', 'gost',
+ 'haval128', 'haval160', 'haval192', 'haval256', 'md4', 'md5', 'ripemd160',
+ 'sha1', 'sha256', 'tiger', 'tiger128', 'tiger160');
+
+ /**
+ * Constants representing the output mode of the hash algorithm
+ */
+ const STRING = 'string';
+ const BINARY = 'binary';
+
+ /**
+ * Performs a HMAC computation given relevant details such as Key, Hashing
+ * algorithm, the data to compute MAC of, and an output format of String,
+ * Binary notation or BTWOC.
+ *
+ * @param string $key
+ * @param string $hash
+ * @param string $data
+ * @param string $output
+ * @param boolean $internal
+ * @return string
+ */
+ public static function compute($key, $hash, $data, $output = self::STRING)
+ {
+ // set the key
+ if (!isset($key) || empty($key)) {
+ require_once 'Zend/Crypt/Hmac/Exception.php';
+ throw new Zend_Crypt_Hmac_Exception('provided key is null or empty');
+ }
+ self::$_key = $key;
+
+ // set the hash
+ self::_setHashAlgorithm($hash);
+
+ // perform hashing and return
+ return self::_hash($data, $output);
+ }
+
+ /**
+ * Setter for the hash method.
+ *
+ * @param string $hash
+ * @return Zend_Crypt_Hmac
+ */
+ protected static function _setHashAlgorithm($hash)
+ {
+ if (!isset($hash) || empty($hash)) {
+ require_once 'Zend/Crypt/Hmac/Exception.php';
+ throw new Zend_Crypt_Hmac_Exception('provided hash string is null or empty');
+ }
+
+ $hash = strtolower($hash);
+ $hashSupported = false;
+
+ if (function_exists('hash_algos') && in_array($hash, hash_algos())) {
+ $hashSupported = true;
+ }
+
+ if ($hashSupported === false && function_exists('mhash') && in_array($hash, self::$_supportedAlgosMhash)) {
+ $hashSupported = true;
+ }
+
+ if ($hashSupported === false) {
+ require_once 'Zend/Crypt/Hmac/Exception.php';
+ throw new Zend_Crypt_Hmac_Exception('hash algorithm provided is not supported on this PHP installation; please enable the hash or mhash extensions');
+ }
+ self::$_hashAlgorithm = $hash;
+ }
+
+ /**
+ * Perform HMAC and return the keyed data
+ *
+ * @param string $data
+ * @param string $output
+ * @param bool $internal Option to not use hash() functions for testing
+ * @return string
+ */
+ protected static function _hash($data, $output = self::STRING, $internal = false)
+ {
+ if (function_exists('hash_hmac')) {
+ if ($output == self::BINARY) {
+ return hash_hmac(self::$_hashAlgorithm, $data, self::$_key, 1);
+ }
+ return hash_hmac(self::$_hashAlgorithm, $data, self::$_key);
+ }
+
+ if (function_exists('mhash')) {
+ if ($output == self::BINARY) {
+ return mhash(self::_getMhashDefinition(self::$_hashAlgorithm), $data, self::$_key);
+ }
+ $bin = mhash(self::_getMhashDefinition(self::$_hashAlgorithm), $data, self::$_key);
+ return bin2hex($bin);
+ }
+ }
+
+ /**
+ * Since MHASH accepts an integer constant representing the hash algorithm
+ * we need to make a small detour to get the correct integer matching our
+ * algorithm's name.
+ *
+ * @param string $hashAlgorithm
+ * @return integer
+ */
+ protected static function _getMhashDefinition($hashAlgorithm)
+ {
+ for ($i = 0; $i <= mhash_count(); $i++)
+ {
+ $types[mhash_get_hash_name($i)] = $i;
+ }
+ return $types[strtoupper($hashAlgorithm)];
+ }
+
+}
View
36 Zend/Crypt/Hmac/Exception.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @subpackage Hmac
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * @see Zend_Crypt_Exception
+ */
+require_once 'Zend/Crypt/Exception.php';
+
+/**
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt_Hmac_Exception extends Zend_Crypt_Exception
+{
+}
View
102 Zend/Crypt/Math.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @subpackage Math
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * @see Zend_Crypt_Math_BigInteger
+ */
+require_once 'Zend/Crypt/Math/BigInteger.php';
+
+/**
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger
+{
+
+ /**
+ * Generate a pseudorandom number within the given range.
+ * Will attempt to read from a systems RNG if it exists or else utilises
+ * a simple random character to maximum length process. Simplicity
+ * is a factor better left for development...
+ *
+ * @param string|int $minimum
+ * @param string|int $maximum
+ * @return string
+ */
+ public function rand($minimum, $maximum)
+ {
+ if (file_exists('/dev/urandom')) {
+ $frandom = fopen('/dev/urandom', 'r');
+ if ($frandom !== false) {
+ return fread($frandom, strlen($maximum) - 1);
+ }
+ }
+ if (strlen($maximum) < 4) {
+ return mt_rand($minimum, $maximum - 1);
+ }
+ $rand = '';
+ $i2 = strlen($maximum) - 1;
+ for ($i = 1;$i < $i2;$i++) {
+ $rand .= mt_rand(0,9);
+ }
+ $rand .= mt_rand(0,9);
+ return $rand;
+ }
+
+ /**
+ * Get the big endian two's complement of a given big integer in
+ * binary notation
+ *
+ * @param string $long
+ * @return string
+ */
+ public function btwoc($long) {
+ if (ord($long[0]) > 127) {
+ return "\x00" . $long;
+ }
+ return $long;
+ }
+
+ /**
+ * Translate a binary form into a big integer string
+ *
+ * @param string $binary
+ * @return string
+ */
+ public function fromBinary($binary) {
+ return $this->_math->binaryToInteger($binary);
+ }
+
+ /**
+ * Translate a big integer string into a binary form
+ *
+ * @param string $integer
+ * @return string
+ */
+ public function toBinary($integer)
+ {
+ return $this->_math->integerToBinary($integer);
+ }
+
+}
View
117 Zend/Crypt/Math/BigInteger.php
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @subpackage Math
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * Support for arbitrary precision mathematics in PHP.
+ *
+ * Zend_Crypt_Math_BigInteger is a wrapper across three PHP extensions: bcmath, gmp
+ * and big_int. Since each offer similar functionality, but availability of
+ * each differs across installations of PHP, this wrapper attempts to select
+ * the fastest option available and encapsulate a subset of its functionality
+ * which all extensions share in common.
+ *
+ * This class requires one of the three extensions to be available. BCMATH
+ * while the slowest, is available by default under Windows, and under Unix
+ * if PHP is compiled with the flag "--enable-bcmath". GMP requires the gmp
+ * library from http://www.swox.com/gmp/ and PHP compiled with the "--with-gmp"
+ * flag. BIG_INT support is available from a big_int PHP library available from
+ * only from PECL (a Windows port is not available).
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt_Math_BigInteger
+{
+
+ /**
+ * Holds an instance of one of the three arbitrary precision wrappers.
+ *
+ * @var Zend_Crypt_Math_BigInteger_Interface
+ */
+ protected $_math = null;
+
+ /**
+ * Constructor; a Factory which detects a suitable PHP extension for
+ * arbitrary precision math and instantiates the suitable wrapper
+ * object.
+ *
+ * @param string $extension
+ * @throws Zend_Crypt_Math_BigInteger_Exception
+ */
+ public function __construct($extension = null)
+ {
+ if ($extension !== null && !in_array($extension, array('bcmath', 'gmp', 'bigint'))) {
+ require_once('Zend/Crypt/Math/BigInteger/Exception.php');
+ throw new Zend_Crypt_Math_BigInteger_Exception('Invalid extension type; please use one of bcmath, gmp or bigint');
+ }
+ $this->_loadAdapter($extension);
+ }
+
+ /**
+ * Redirect all public method calls to the wrapped extension object.
+ *
+ * @param string $methodName
+ * @param array $args
+ * @throws Zend_Crypt_Math_BigInteger_Exception
+ */
+ public function __call($methodName, $args)
+ {
+ if(!method_exists($this->_math, $methodName)) {
+ require_once 'Zend/Crypt/Math/BigInteger/Exception.php';
+ throw new Zend_Crypt_Math_BigInteger_Exception('invalid method call: ' . get_class($this->_math) . '::' . $methodName . '() does not exist');
+ }
+ return call_user_func_array(array($this->_math, $methodName), $args);
+ }
+
+ /**
+ * @param string $extension
+ * @throws Zend_Crypt_Math_BigInteger_Exception
+ */
+ protected function _loadAdapter($extension = null)
+ {
+ if ($extension === null) {
+ if (extension_loaded('gmp')) {
+ $extension = 'gmp';
+ //} elseif (extension_loaded('big_int')) {
+ // $extension = 'big_int';
+ } else {
+ $extension = 'bcmath';
+ }
+ }
+ if($extension == 'gmp' && extension_loaded('gmp')) {
+ require_once 'Zend/Crypt/Math/BigInteger/Gmp.php';
+ $this->_math = new Zend_Crypt_Math_BigInteger_Gmp();
+ //} elseif($extension == 'bigint' && extension_loaded('big_int')) {
+ // require_once 'Zend/Crypt_Math/BigInteger/Bigint.php';
+ // $this->_math = new Zend_Crypt_Math_BigInteger_Bigint();
+ } elseif ($extension == 'bcmath') {
+ require_once 'Zend/Crypt/Math/BigInteger/Bcmath.php';
+ $this->_math = new Zend_Crypt_Math_BigInteger_Bcmath();
+ } else {
+ require_once 'Zend/Crypt/Math/BigInteger/Exception.php';
+ throw new Zend_Crypt_Math_BigInteger_Exception($extension . ' big integer precision math support not detected');
+ }
+ }
+
+}
View
203 Zend/Crypt/Math/BigInteger/Bcmath.php
@@ -0,0 +1,203 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @subpackage Math
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+
+ */
+
+/**
+ * @see Zend_Crypt_Math_BigInteger_Interface
+ */
+require_once 'Zend/Crypt/Math/BigInteger/Interface.php';
+
+/**
+ * Support for arbitrary precision mathematics in PHP.
+ *
+ * Zend_Crypt_Math_BigInteger_Bcmath is a wrapper across the PHP BCMath
+ * extension.
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_Interface
+{
+
+ /**
+ * Initialise a big integer into an extension specific type. This is not
+ * applicable to BCMath.
+ * @param string $operand
+ * @param int $base
+ * @return string
+ */
+ public function init($operand, $base = 10)
+ {
+ return $operand;
+ }
+
+ /**
+ * Adds two arbitrary precision numbers
+ *
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return string
+ */
+ public function add($left_operand, $right_operand)
+ {
+ return bcadd($left_operand, $right_operand);
+ }
+
+ /**
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return string
+ */
+ public function subtract($left_operand, $right_operand)
+ {
+ return bcsub($left_operand, $right_operand);
+ }
+
+ /**
+ * Compare two big integers and returns result as an integer where 0 means
+ * both are identical, 1 that left_operand is larger, or -1 that
+ * right_operand is larger.
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return int
+ */
+ public function compare($left_operand, $right_operand)
+ {
+ return bccomp($left_operand, $right_operand);
+ }
+
+ /**
+ * Divide two big integers and return result or NULL if the denominator
+ * is zero.
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return string|null
+ */
+ public function divide($left_operand, $right_operand)
+ {
+ return bcdiv($left_operand, $right_operand);
+ }
+
+ /**
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return string
+ */
+ public function modulus($left_operand, $modulus)
+ {
+ return bcmod($left_operand, $modulus);
+ }
+
+ /**
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return string
+ */
+ public function multiply($left_operand, $right_operand)
+ {
+ return bcmul($left_operand, $right_operand);
+ }
+
+ /**
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return string
+ */
+ public function pow($left_operand, $right_operand)
+ {
+ return bcpow($left_operand, $right_operand);
+ }
+
+ /**
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return string
+ */
+ public function powmod($left_operand, $right_operand, $modulus)
+ {
+ return bcpowmod($left_operand, $right_operand, $modulus);
+ }
+
+ /**
+ * @param string $left_operand
+ * @param string $right_operand
+ * @return string
+ */
+ public function sqrt($operand)
+ {
+ return bcsqrt($operand);
+ }
+
+
+ public function binaryToInteger($operand)
+ {
+ $result = '0';
+ while (strlen($operand)) {
+ $ord = ord(substr($operand, 0, 1));
+ $result = bcadd(bcmul($result, 256), $ord);
+ $operand = substr($operand, 1);
+ }
+ return $result;
+ }
+
+
+ public function integerToBinary($operand)
+ {
+ $cmp = bccomp($operand, 0);
+ $return = '';
+ if ($cmp == 0) {
+ return "\0";
+ }
+ while (bccomp($operand, 0) > 0) {
+ $return = chr(bcmod($operand, 256)) . $return;
+ $operand = bcdiv($operand, 256);
+ }
+ if (ord($return[0]) > 127) {
+ $return = "\0" . $return;
+ }
+ return $return;
+ }
+
+ /**public function integerToBinary($operand)
+ {
+ $return = '';
+ while(bccomp($operand, '0')) {
+ $return .= chr(bcmod($operand, '256'));
+ $operand = bcdiv($operand, '256');
+ }
+ return $return;
+ }**/ // Prior version for referenced offset
+
+
+ public function hexToDecimal($operand)
+ {
+ $return = '0';
+ while(strlen($hex)) {
+ $hex = hexdec(substr($operand, 0, 4));
+ $dec = bcadd(bcmul($return, 65536), $hex);
+ $operand = substr($operand, 4);
+ }
+ return $return;
+ }
+
+}
View
36 Zend/Crypt/Math/BigInteger/Exception.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *