mirror of
https://github.com/salesagility/SuiteCRM.git
synced 2025-03-15 05:44:49 +00:00
Merge branch 'hotfix' into develop
# Conflicts: # modules/Users/UserViewHelper.php
This commit is contained in:
commit
d08f74643d
3922 changed files with 234195 additions and 226316 deletions
.travis.ymlHandleAjaxCall.php
ModuleInstall
ModuleInstaller.phpModuleScanner.php
README.mdRoboFile.phpSugarSecurity.phpTreeData.phpPackageManager
ListViewPackages.phpPackageController.phpPackageManager.phpPackageManagerComm.phpPackageManagerDisplay.phpPackageManagerDownloader.php
extensions.phpmetadata
Zend
Exception.phpGdata.php
Gdata
App.php
App
Base.phpBaseMediaSource.phpCaptchaRequiredException.phpEntry.php
AuthSub.phpBooks.phpExtension
Author.phpCategory.phpContent.phpContributor.phpControl.phpDraft.phpEdited.phpElement.phpEmail.phpGenerator.phpIcon.phpId.phpLink.phpLogo.phpName.phpPerson.phpPublished.phpRights.phpSource.phpSubtitle.phpSummary.phpText.phpTitle.phpUpdated.phpUri.php
Feed.phpFeedEntryParent.phpFeedSourceParent.phpHttpException.phpLoggingHttpClientAdapterSocket.phpMediaEntry.phpMediaFileSource.phpUtil.phpBooks
CollectionEntry.phpCollectionFeed.php
Calendar.phpExtension
AnnotationLink.phpBooksCategory.phpBooksLink.phpEmbeddability.phpInfoLink.phpPreviewLink.phpReview.phpThumbnailLink.phpViewability.php
VolumeEntry.phpVolumeFeed.phpVolumeQuery.phpCalendar
EventEntry.phpEventFeed.phpEventQuery.php
ClientLogin.phpContacts.phpExtension
AccessLevel.phpColor.phpHidden.phpLink.phpQuickAdd.phpSelected.phpSendEventNotifications.phpTimezone.phpWebContent.php
ListEntry.phpListFeed.phpContacts
Docs.phpDocs
13
.travis.yml
13
.travis.yml
|
@ -11,7 +11,7 @@ matrix:
|
|||
jobs:
|
||||
include:
|
||||
- stage: codecoverage
|
||||
if: type IN (pull_request) OR branch in (master, develop)
|
||||
if: type IN (pull_request) OR branch in (master, develop, hotfix)
|
||||
php: 7.0
|
||||
script: ./vendor/bin/codecept run install --env travis-ci-hub -f -vvv -d; ./vendor/bin/robo -vvv code:coverage; cat codeception.yml; bash <(curl -s https://codecov.io/bash) -f tests/_output/coverage.xml
|
||||
sudo: required
|
||||
|
@ -66,19 +66,16 @@ script:
|
|||
- ./vendor/bin/codecept run install --env travis-ci-hub -f -vvv -d
|
||||
- ./build/push_output.sh
|
||||
|
||||
# Run the unit tests
|
||||
- ./vendor/bin/codecept run unit --steps
|
||||
# set the log level to error
|
||||
- echo "\$sugar_config['logger']['level']='error';" >> config_override.php
|
||||
# Install OAuth2 demo data
|
||||
- mysql -u root -D automated_tests -v -e "source tests/_data/api_data.sql"
|
||||
# Install demo user data
|
||||
- mysql -u root -D automated_tests -v -e "source tests/_data/demo_users.sql"
|
||||
# set the log level to error
|
||||
- echo "\$sugar_config['logger']['level']='error';" >> config_override.php
|
||||
# Run the unit tests
|
||||
# Run API functional tests
|
||||
- ./vendor/bin/codecept run api --steps
|
||||
# RUN Basic Acceptance test
|
||||
- sudo chmod -R 777 .
|
||||
- ./vendor/bin/codecept run acceptance --env travis-ci-hub -f -vvv -d;
|
||||
- ./vendor/bin/codecept run -f unit --steps -v && ./vendor/bin/codecept run api --steps -f -v && sudo chmod -R 777 . && ./vendor/bin/codecept run acceptance --env travis-ci-hub -f -v;
|
||||
|
||||
after_script:
|
||||
- ./build/push_output.sh
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
if (!defined('sugarEntry') || !sugarEntry) {
|
||||
die('Not A Valid Entry Point');
|
||||
}
|
||||
/*********************************************************************************
|
||||
* SugarCRM Community Edition is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
|
||||
|
@ -43,16 +45,15 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
|||
*/
|
||||
require_once('include/entryPoint.php');
|
||||
require_once('ModuleInstall/PackageManager/PackageController.php');
|
||||
if(!is_admin($GLOBALS['current_user'])){
|
||||
sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
|
||||
}
|
||||
if (!is_admin($GLOBALS['current_user'])) {
|
||||
sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
|
||||
}
|
||||
$requestedMethod = $_REQUEST['method'];
|
||||
$pmc = new PackageController();
|
||||
|
||||
if(method_exists($pmc, $requestedMethod)) {
|
||||
echo $pmc->$requestedMethod();
|
||||
}
|
||||
else {
|
||||
if (method_exists($pmc, $requestedMethod)) {
|
||||
echo $pmc->$requestedMethod();
|
||||
} else {
|
||||
echo 'no method';
|
||||
}
|
||||
// sugar_cleanup();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
if (!defined('sugarEntry') || !sugarEntry) {
|
||||
die('Not A Valid Entry Point');
|
||||
}
|
||||
/*********************************************************************************
|
||||
* SugarCRM Community Edition is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
|
||||
|
@ -13,24 +15,24 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
|||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
|
||||
|
@ -38,40 +40,41 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
|||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
********************************************************************************/
|
||||
|
||||
class ModuleScanner{
|
||||
private $manifestMap = array(
|
||||
'pre_execute'=>'pre_execute',
|
||||
'install_mkdirs'=>'mkdir',
|
||||
'install_copy'=>'copy',
|
||||
'install_images'=>'image_dir',
|
||||
'install_menus'=>'menu',
|
||||
'install_userpage'=>'user_page',
|
||||
'install_dashlets'=>'dashlets',
|
||||
'install_administration'=>'administration',
|
||||
'install_connectors'=>'connectors',
|
||||
'install_vardefs'=>'vardefs',
|
||||
'install_layoutdefs'=>'layoutdefs',
|
||||
'install_layoutfields'=>'layoutfields',
|
||||
'install_relationships'=>'relationships',
|
||||
'install_languages'=>'language',
|
||||
class ModuleScanner
|
||||
{
|
||||
private $manifestMap = array(
|
||||
'pre_execute'=>'pre_execute',
|
||||
'install_mkdirs'=>'mkdir',
|
||||
'install_copy'=>'copy',
|
||||
'install_images'=>'image_dir',
|
||||
'install_menus'=>'menu',
|
||||
'install_userpage'=>'user_page',
|
||||
'install_dashlets'=>'dashlets',
|
||||
'install_administration'=>'administration',
|
||||
'install_connectors'=>'connectors',
|
||||
'install_vardefs'=>'vardefs',
|
||||
'install_layoutdefs'=>'layoutdefs',
|
||||
'install_layoutfields'=>'layoutfields',
|
||||
'install_relationships'=>'relationships',
|
||||
'install_languages'=>'language',
|
||||
'install_logichooks'=>'logic_hooks',
|
||||
'post_execute'=>'post_execute',
|
||||
'post_execute'=>'post_execute',
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* config settings
|
||||
* @var array
|
||||
*/
|
||||
private $config = array();
|
||||
private $config_hash;
|
||||
/**
|
||||
* config settings
|
||||
* @var array
|
||||
*/
|
||||
private $config = array();
|
||||
private $config_hash;
|
||||
|
||||
private $blackListExempt = array();
|
||||
private $classBlackListExempt = array();
|
||||
private $blackListExempt = array();
|
||||
private $classBlackListExempt = array();
|
||||
|
||||
// Bug 56717 - adding hbs extension to the whitelist - rgonzalez
|
||||
private $validExt = array('png', 'gif', 'jpg', 'css', 'js', 'php', 'txt', 'html', 'htm', 'tpl', 'pdf', 'md5', 'xml', 'hbs');
|
||||
private $classBlackList = array(
|
||||
private $validExt = array('png', 'gif', 'jpg', 'css', 'js', 'php', 'txt', 'html', 'htm', 'tpl', 'pdf', 'md5', 'xml', 'hbs');
|
||||
private $classBlackList = array(
|
||||
// Class names specified here must be in lowercase as the implementation
|
||||
// of the tokenizer converts all tokens to lowercase.
|
||||
'reflection',
|
||||
|
@ -87,13 +90,13 @@ class ModuleScanner{
|
|||
'reflector',
|
||||
'reflectionexception',
|
||||
'lua',
|
||||
'ziparchive',
|
||||
'splfileinfo',
|
||||
'splfileobject',
|
||||
'pclzip',
|
||||
'ziparchive',
|
||||
'splfileinfo',
|
||||
'splfileobject',
|
||||
'pclzip',
|
||||
|
||||
);
|
||||
private $blackList = array(
|
||||
private $blackList = array(
|
||||
'popen',
|
||||
'proc_open',
|
||||
'escapeshellarg',
|
||||
|
@ -101,12 +104,12 @@ class ModuleScanner{
|
|||
'proc_close',
|
||||
'proc_get_status',
|
||||
'proc_nice',
|
||||
'passthru',
|
||||
'passthru',
|
||||
'clearstatcache',
|
||||
'disk_free_space',
|
||||
'disk_total_space',
|
||||
'diskfreespace',
|
||||
'dir',
|
||||
'dir',
|
||||
'fclose',
|
||||
'feof',
|
||||
'fflush',
|
||||
|
@ -136,7 +139,7 @@ class ModuleScanner{
|
|||
'is_link',
|
||||
'is_readable',
|
||||
'is_uploaded_file',
|
||||
'opendir',
|
||||
'opendir',
|
||||
'parse_ini_string',
|
||||
'pathinfo',
|
||||
'pclose',
|
||||
|
@ -146,75 +149,75 @@ class ModuleScanner{
|
|||
'realpath_cache_size',
|
||||
'realpath',
|
||||
'rewind',
|
||||
'readdir',
|
||||
'readdir',
|
||||
'set_file_buffer',
|
||||
'tmpfile',
|
||||
'umask',
|
||||
'ini_set',
|
||||
'set_time_limit',
|
||||
'eval',
|
||||
'exec',
|
||||
'system',
|
||||
'shell_exec',
|
||||
'passthru',
|
||||
'chgrp',
|
||||
'chmod',
|
||||
'chwown',
|
||||
'file_put_contents',
|
||||
'file',
|
||||
'fileatime',
|
||||
'filectime',
|
||||
'filegroup',
|
||||
'fileinode',
|
||||
'filemtime',
|
||||
'fileowner',
|
||||
'fileperms',
|
||||
'fopen',
|
||||
'is_executable',
|
||||
'is_writable',
|
||||
'is_writeable',
|
||||
'lchgrp',
|
||||
'lchown',
|
||||
'linkinfo',
|
||||
'lstat',
|
||||
'mkdir',
|
||||
'eval',
|
||||
'exec',
|
||||
'system',
|
||||
'shell_exec',
|
||||
'passthru',
|
||||
'chgrp',
|
||||
'chmod',
|
||||
'chwown',
|
||||
'file_put_contents',
|
||||
'file',
|
||||
'fileatime',
|
||||
'filectime',
|
||||
'filegroup',
|
||||
'fileinode',
|
||||
'filemtime',
|
||||
'fileowner',
|
||||
'fileperms',
|
||||
'fopen',
|
||||
'is_executable',
|
||||
'is_writable',
|
||||
'is_writeable',
|
||||
'lchgrp',
|
||||
'lchown',
|
||||
'linkinfo',
|
||||
'lstat',
|
||||
'mkdir',
|
||||
'mkdir_recursive',
|
||||
'parse_ini_file',
|
||||
'rmdir',
|
||||
'parse_ini_file',
|
||||
'rmdir',
|
||||
'rmdir_recursive',
|
||||
'stat',
|
||||
'tempnam',
|
||||
'touch',
|
||||
'unlink',
|
||||
'getimagesize',
|
||||
'call_user_func',
|
||||
'call_user_func_array',
|
||||
'create_function',
|
||||
'stat',
|
||||
'tempnam',
|
||||
'touch',
|
||||
'unlink',
|
||||
'getimagesize',
|
||||
'call_user_func',
|
||||
'call_user_func_array',
|
||||
'create_function',
|
||||
|
||||
|
||||
//mutliple files per function call
|
||||
'copy',
|
||||
//mutliple files per function call
|
||||
'copy',
|
||||
'copy_recursive',
|
||||
'link',
|
||||
'rename',
|
||||
'symlink',
|
||||
'move_uploaded_file',
|
||||
'chdir',
|
||||
'chroot',
|
||||
'create_cache_directory',
|
||||
'mk_temp_dir',
|
||||
'write_array_to_file',
|
||||
'write_encoded_file',
|
||||
'create_custom_directory',
|
||||
'sugar_rename',
|
||||
'sugar_chown',
|
||||
'sugar_fopen',
|
||||
'sugar_mkdir',
|
||||
'sugar_file_put_contents',
|
||||
'sugar_file_put_contents_atomic',
|
||||
'sugar_chgrp',
|
||||
'sugar_chmod',
|
||||
'sugar_touch',
|
||||
'link',
|
||||
'rename',
|
||||
'symlink',
|
||||
'move_uploaded_file',
|
||||
'chdir',
|
||||
'chroot',
|
||||
'create_cache_directory',
|
||||
'mk_temp_dir',
|
||||
'write_array_to_file',
|
||||
'write_encoded_file',
|
||||
'create_custom_directory',
|
||||
'sugar_rename',
|
||||
'sugar_chown',
|
||||
'sugar_fopen',
|
||||
'sugar_mkdir',
|
||||
'sugar_file_put_contents',
|
||||
'sugar_file_put_contents_atomic',
|
||||
'sugar_chgrp',
|
||||
'sugar_chmod',
|
||||
'sugar_touch',
|
||||
|
||||
// Functions that have callbacks can circumvent our security measures.
|
||||
// List retrieved through PHP's XML documentation, and running the
|
||||
|
@ -396,28 +399,26 @@ class ModuleScanner{
|
|||
'xml_set_processing_instruction_handler',
|
||||
'xml_set_start_namespace_decl_handler',
|
||||
'xml_set_unparsed_entity_decl_handler',
|
||||
'simplexml_load_file',
|
||||
'simplexml_load_string',
|
||||
'simplexml_load_file',
|
||||
'simplexml_load_string',
|
||||
|
||||
// unzip
|
||||
'unzip',
|
||||
'unzip_file',
|
||||
// unzip
|
||||
'unzip',
|
||||
'unzip_file',
|
||||
);
|
||||
private $methodsBlackList = array('setlevel', 'put' => array('sugarautoloader'), 'unlink' => array('sugarautoloader'));
|
||||
|
||||
public function printToWiki(){
|
||||
echo "'''Default Extensions'''<br>";
|
||||
foreach($this->validExt as $b){
|
||||
echo '#' . $b . '<br>';
|
||||
|
||||
}
|
||||
echo "'''Default Black Listed Functions'''<br>";
|
||||
foreach($this->blackList as $b){
|
||||
echo '#' . $b . '<br>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public function printToWiki()
|
||||
{
|
||||
echo "'''Default Extensions'''<br>";
|
||||
foreach ($this->validExt as $b) {
|
||||
echo '#' . $b . '<br>';
|
||||
}
|
||||
echo "'''Default Black Listed Functions'''<br>";
|
||||
foreach ($this->blackList as $b) {
|
||||
echo '#' . $b . '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -441,7 +442,6 @@ class ModuleScanner{
|
|||
}
|
||||
|
||||
foreach ($params as $param => $constName) {
|
||||
|
||||
if (!$disableConfigOverride && isset($this->config[$param]) && is_array($this->config[$param])) {
|
||||
$this->{$param} = array_merge($this->{$param}, $this->config[$param]);
|
||||
}
|
||||
|
@ -454,201 +454,224 @@ class ModuleScanner{
|
|||
$this->{$param} = array_merge($this->{$param}, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private $issues = array();
|
||||
private $pathToModule = '';
|
||||
private $issues = array();
|
||||
private $pathToModule = '';
|
||||
|
||||
/**
|
||||
*returns a list of issues
|
||||
*/
|
||||
public function getIssues(){
|
||||
return $this->issues;
|
||||
}
|
||||
/**
|
||||
*returns a list of issues
|
||||
*/
|
||||
public function getIssues()
|
||||
{
|
||||
return $this->issues;
|
||||
}
|
||||
|
||||
/**
|
||||
*returns true or false if any issues were found
|
||||
*/
|
||||
public function hasIssues(){
|
||||
return !empty($this->issues);
|
||||
}
|
||||
/**
|
||||
*returns true or false if any issues were found
|
||||
*/
|
||||
public function hasIssues()
|
||||
{
|
||||
return !empty($this->issues);
|
||||
}
|
||||
|
||||
/**
|
||||
*Ensures that a file has a valid extension
|
||||
*/
|
||||
public function isValidExtension($file)
|
||||
{
|
||||
$file = strtolower($file);
|
||||
$pi = pathinfo($file);
|
||||
/**
|
||||
*Ensures that a file has a valid extension
|
||||
*/
|
||||
public function isValidExtension($file)
|
||||
{
|
||||
$file = strtolower($file);
|
||||
$pi = pathinfo($file);
|
||||
|
||||
//make sure they don't override the files.md5
|
||||
if(empty($pi['extension']) || $pi['basename'] == 'files.md5') {
|
||||
return false;
|
||||
}
|
||||
return in_array($pi['extension'], $this->validExt);
|
||||
//make sure they don't override the files.md5
|
||||
if (empty($pi['extension']) || $pi['basename'] == 'files.md5') {
|
||||
return false;
|
||||
}
|
||||
return in_array($pi['extension'], $this->validExt);
|
||||
}
|
||||
|
||||
}
|
||||
public function isConfigFile($file)
|
||||
{
|
||||
$real = realpath($file);
|
||||
if ($real == realpath("config.php")) {
|
||||
return true;
|
||||
}
|
||||
if (file_exists("config_override.php") && $real == realpath("config_override.php")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isConfigFile($file)
|
||||
{
|
||||
$real = realpath($file);
|
||||
if($real == realpath("config.php")) {
|
||||
return true;
|
||||
}
|
||||
if(file_exists("config_override.php") && $real == realpath("config_override.php")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
*Scans a directory and calls on scan file for each file
|
||||
**/
|
||||
public function scanDir($path)
|
||||
{
|
||||
static $startPath = '';
|
||||
if (empty($startPath)) {
|
||||
$startPath = $path;
|
||||
}
|
||||
if (!is_dir($path)) {
|
||||
return false;
|
||||
}
|
||||
$d = dir($path);
|
||||
while ($e = $d->read()) {
|
||||
$next = $path . '/' . $e;
|
||||
if (is_dir($next)) {
|
||||
if (substr($e, 0, 1) == '.') {
|
||||
continue;
|
||||
}
|
||||
$this->scanDir($next);
|
||||
} else {
|
||||
$issues = $this->scanFile($next);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*Scans a directory and calls on scan file for each file
|
||||
**/
|
||||
public function scanDir($path){
|
||||
static $startPath = '';
|
||||
if(empty($startPath))$startPath = $path;
|
||||
if(!is_dir($path))return false;
|
||||
$d = dir($path);
|
||||
while($e = $d->read()){
|
||||
$next = $path . '/' . $e;
|
||||
if(is_dir($next)){
|
||||
if(substr($e, 0, 1) == '.')continue;
|
||||
$this->scanDir($next);
|
||||
}else{
|
||||
$issues = $this->scanFile($next);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the file contents looks like PHP
|
||||
* @param string $contents File contents
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPHPFile($contents)
|
||||
{
|
||||
if(stripos($contents, '<?php') !== false) return true;
|
||||
for($tag=0;($tag = stripos($contents, '<?', $tag)) !== false;$tag++) {
|
||||
if(strncasecmp(substr($contents, $tag, 13), '<?xml version', 13) == 0) {
|
||||
/**
|
||||
* Check if the file contents looks like PHP
|
||||
* @param string $contents File contents
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPHPFile($contents)
|
||||
{
|
||||
if (stripos($contents, '<?php') !== false) {
|
||||
return true;
|
||||
}
|
||||
for ($tag=0;($tag = stripos($contents, '<?', $tag)) !== false;$tag++) {
|
||||
if (strncasecmp(substr($contents, $tag, 13), '<?xml version', 13) == 0) {
|
||||
// <?xml version is OK, skip it
|
||||
$tag++;
|
||||
continue;
|
||||
}
|
||||
// found <?, it's PHP
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a file it will open it's contents and check if it is a PHP file (not safe to just rely on extensions) if it finds <?php tags it will use the tokenizer to scan the file
|
||||
* $var() and ` are always prevented then whatever is in the blacklist.
|
||||
* It will also ensure that all files are of valid extension types
|
||||
*
|
||||
*/
|
||||
public function scanFile($file){
|
||||
$issues = array();
|
||||
if(!$this->isValidExtension($file)){
|
||||
$issues[] = translate('ML_INVALID_EXT');
|
||||
$this->issues['file'][$file] = $issues;
|
||||
return $issues;
|
||||
}
|
||||
if($this->isConfigFile($file)){
|
||||
$issues[] = translate('ML_OVERRIDE_CORE_FILES');
|
||||
$this->issues['file'][$file] = $issues;
|
||||
return $issues;
|
||||
}
|
||||
$contents = file_get_contents($file);
|
||||
if(!$this->isPHPFile($contents)) return $issues;
|
||||
$tokens = @token_get_all($contents);
|
||||
$checkFunction = false;
|
||||
$possibleIssue = '';
|
||||
$lastToken = false;
|
||||
foreach($tokens as $index=>$token){
|
||||
if(is_string($token[0])){
|
||||
switch($token[0]){
|
||||
case '`':
|
||||
$issues['backtick'] = translate('ML_INVALID_FUNCTION') . " '`'";
|
||||
case '(':
|
||||
if($checkFunction)$issues[] = $possibleIssue;
|
||||
break;
|
||||
}
|
||||
$checkFunction = false;
|
||||
$possibleIssue = '';
|
||||
}else{
|
||||
$token['_msi'] = token_name($token[0]);
|
||||
switch($token[0]){
|
||||
case T_WHITESPACE: continue;
|
||||
case T_EVAL:
|
||||
if(in_array('eval', $this->blackList) && !in_array('eval', $this->blackListExempt))
|
||||
$issues[]= translate('ML_INVALID_FUNCTION') . ' eval()';
|
||||
break;
|
||||
case T_STRING:
|
||||
$token[1] = strtolower($token[1]);
|
||||
if($lastToken !== false && $lastToken[0] == T_NEW) {
|
||||
if(!in_array($token[1], $this->classBlackList))break;
|
||||
if(in_array($token[1], $this->classBlackListExempt))break;
|
||||
/**
|
||||
* Given a file it will open it's contents and check if it is a PHP file (not safe to just rely on extensions) if it finds <?php tags it will use the tokenizer to scan the file
|
||||
* $var() and ` are always prevented then whatever is in the blacklist.
|
||||
* It will also ensure that all files are of valid extension types
|
||||
*
|
||||
*/
|
||||
public function scanFile($file)
|
||||
{
|
||||
$issues = array();
|
||||
if (!$this->isValidExtension($file)) {
|
||||
$issues[] = translate('ML_INVALID_EXT');
|
||||
$this->issues['file'][$file] = $issues;
|
||||
return $issues;
|
||||
}
|
||||
if ($this->isConfigFile($file)) {
|
||||
$issues[] = translate('ML_OVERRIDE_CORE_FILES');
|
||||
$this->issues['file'][$file] = $issues;
|
||||
return $issues;
|
||||
}
|
||||
$contents = file_get_contents($file);
|
||||
if (!$this->isPHPFile($contents)) {
|
||||
return $issues;
|
||||
}
|
||||
$tokens = @token_get_all($contents);
|
||||
$checkFunction = false;
|
||||
$possibleIssue = '';
|
||||
$lastToken = false;
|
||||
foreach ($tokens as $index=>$token) {
|
||||
if (is_string($token[0])) {
|
||||
switch ($token[0]) {
|
||||
case '`':
|
||||
$issues['backtick'] = translate('ML_INVALID_FUNCTION') . " '`'";
|
||||
// no break
|
||||
case '(':
|
||||
if ($checkFunction) {
|
||||
$issues[] = $possibleIssue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
$checkFunction = false;
|
||||
$possibleIssue = '';
|
||||
} else {
|
||||
$token['_msi'] = token_name($token[0]);
|
||||
switch ($token[0]) {
|
||||
case T_WHITESPACE: continue;
|
||||
case T_EVAL:
|
||||
if (in_array('eval', $this->blackList) && !in_array('eval', $this->blackListExempt)) {
|
||||
$issues[]= translate('ML_INVALID_FUNCTION') . ' eval()';
|
||||
}
|
||||
break;
|
||||
case T_STRING:
|
||||
$token[1] = strtolower($token[1]);
|
||||
if ($lastToken !== false && $lastToken[0] == T_NEW) {
|
||||
if (!in_array($token[1], $this->classBlackList)) {
|
||||
break;
|
||||
}
|
||||
if (in_array($token[1], $this->classBlackListExempt)) {
|
||||
break;
|
||||
}
|
||||
} elseif ($token[0] == T_DOUBLE_COLON) {
|
||||
if(!in_array($lastToken[1], $this->classBlackList))break;
|
||||
if(in_array($lastToken[1], $this->classBlackListExempt))break;
|
||||
if (!in_array($lastToken[1], $this->classBlackList)) {
|
||||
break;
|
||||
}
|
||||
if (in_array($lastToken[1], $this->classBlackListExempt)) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//if nothing else fit, lets check the last token to see if this is a possible method call
|
||||
if ($lastToken !== false &&
|
||||
($lastToken[0] == T_OBJECT_OPERATOR || $lastToken[0] == T_DOUBLE_COLON))
|
||||
{
|
||||
($lastToken[0] == T_OBJECT_OPERATOR || $lastToken[0] == T_DOUBLE_COLON)) {
|
||||
// check static blacklist for methods
|
||||
if(!empty($this->methodsBlackList[$token[1]])) {
|
||||
if($this->methodsBlackList[$token[1]] == '*') {
|
||||
if (!empty($this->methodsBlackList[$token[1]])) {
|
||||
if ($this->methodsBlackList[$token[1]] == '*') {
|
||||
$issues[]= translate('ML_INVALID_METHOD') . ' ' .$token[1]. '()';
|
||||
break;
|
||||
} else {
|
||||
if($lastToken[0] == T_DOUBLE_COLON && $index > 2 && $tokens[$index-2][0] == T_STRING) {
|
||||
$classname = strtolower($tokens[$index-2][1]);
|
||||
if(in_array($classname, $this->methodsBlackList[$token[1]])) {
|
||||
$issues[]= translate('ML_INVALID_METHOD') . ' ' .$classname . '::' . $token[1]. '()';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($lastToken[0] == T_DOUBLE_COLON && $index > 2 && $tokens[$index-2][0] == T_STRING) {
|
||||
$classname = strtolower($tokens[$index-2][1]);
|
||||
if (in_array($classname, $this->methodsBlackList[$token[1]])) {
|
||||
$issues[]= translate('ML_INVALID_METHOD') . ' ' .$classname . '::' . $token[1]. '()';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//this is a method call, check the black list
|
||||
if(in_array($token[1], $this->methodsBlackList)){
|
||||
if (in_array($token[1], $this->methodsBlackList)) {
|
||||
$issues[]= translate('ML_INVALID_METHOD') . ' ' .$token[1]. '()';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(!in_array($token[1], $this->blackList))break;
|
||||
if(in_array($token[1], $this->blackListExempt))break;
|
||||
|
||||
if (!in_array($token[1], $this->blackList)) {
|
||||
break;
|
||||
}
|
||||
if (in_array($token[1], $this->blackListExempt)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case T_VARIABLE:
|
||||
$checkFunction = true;
|
||||
$possibleIssue = translate('ML_INVALID_FUNCTION') . ' ' . $token[1] . '()';
|
||||
break;
|
||||
// no break
|
||||
case T_VARIABLE:
|
||||
$checkFunction = true;
|
||||
$possibleIssue = translate('ML_INVALID_FUNCTION') . ' ' . $token[1] . '()';
|
||||
break;
|
||||
|
||||
default:
|
||||
$checkFunction = false;
|
||||
$possibleIssue = '';
|
||||
default:
|
||||
$checkFunction = false;
|
||||
$possibleIssue = '';
|
||||
|
||||
}
|
||||
if ($token[0] != T_WHITESPACE)
|
||||
{
|
||||
$lastToken = $token;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($token[0] != T_WHITESPACE) {
|
||||
$lastToken = $token;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($issues)) {
|
||||
$this->issues['file'][$file] = $issues;
|
||||
}
|
||||
|
||||
}
|
||||
if(!empty($issues)){
|
||||
$this->issues['file'][$file] = $issues;
|
||||
}
|
||||
|
||||
return $issues;
|
||||
}
|
||||
return $issues;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks files.md5 file to see if the file is from sugar
|
||||
|
@ -661,7 +684,7 @@ class ModuleScanner{
|
|||
{
|
||||
static $md5 = array();
|
||||
if (empty($md5) && file_exists('files.md5')) {
|
||||
include ('files.md5');
|
||||
include('files.md5');
|
||||
$md5 = isset($md5_string) ? $md5_string : null;
|
||||
}
|
||||
if ($path[0] != '.' || $path[1] != '/') {
|
||||
|
@ -704,37 +727,37 @@ class ModuleScanner{
|
|||
return join("/", $res);
|
||||
}
|
||||
|
||||
/**
|
||||
*This function will scan the Manifest for disabled actions specified in $GLOBALS['sugar_config']['moduleInstaller']['disableActions']
|
||||
*if $GLOBALS['sugar_config']['moduleInstaller']['disableRestrictedCopy'] is set to false or not set it will call on scanCopy to ensure that it is not overriding files
|
||||
*/
|
||||
/**
|
||||
*This function will scan the Manifest for disabled actions specified in $GLOBALS['sugar_config']['moduleInstaller']['disableActions']
|
||||
*if $GLOBALS['sugar_config']['moduleInstaller']['disableRestrictedCopy'] is set to false or not set it will call on scanCopy to ensure that it is not overriding files
|
||||
*/
|
||||
public function scanManifest($manifestPath)
|
||||
{
|
||||
$issues = array();
|
||||
if(!file_exists($manifestPath)){
|
||||
$this->issues['manifest'][$manifestPath] = translate('ML_NO_MANIFEST');
|
||||
return $issues;
|
||||
}
|
||||
$fileIssues = $this->scanFile($manifestPath);
|
||||
//if the manifest contains malicious code do not open it
|
||||
if(!empty($fileIssues)){
|
||||
return $fileIssues;
|
||||
}
|
||||
$this->lockConfig();
|
||||
list($manifest, $installdefs) = MSLoadManifest($manifestPath);
|
||||
$fileIssues = $this->checkConfig($manifestPath);
|
||||
if(!empty($fileIssues)){
|
||||
return $fileIssues;
|
||||
}
|
||||
$issues = array();
|
||||
if (!file_exists($manifestPath)) {
|
||||
$this->issues['manifest'][$manifestPath] = translate('ML_NO_MANIFEST');
|
||||
return $issues;
|
||||
}
|
||||
$fileIssues = $this->scanFile($manifestPath);
|
||||
//if the manifest contains malicious code do not open it
|
||||
if (!empty($fileIssues)) {
|
||||
return $fileIssues;
|
||||
}
|
||||
$this->lockConfig();
|
||||
list($manifest, $installdefs) = MSLoadManifest($manifestPath);
|
||||
$fileIssues = $this->checkConfig($manifestPath);
|
||||
if (!empty($fileIssues)) {
|
||||
return $fileIssues;
|
||||
}
|
||||
|
||||
//scan for disabled actions
|
||||
if(isset($this->config['disableActions'])){
|
||||
foreach($this->config['disableActions'] as $action){
|
||||
if(isset($installdefs[$this->manifestMap[$action]])){
|
||||
$issues[] = translate('ML_INVALID_ACTION_IN_MANIFEST') . $this->manifestMap[$action];
|
||||
}
|
||||
}
|
||||
}
|
||||
//scan for disabled actions
|
||||
if (isset($this->config['disableActions'])) {
|
||||
foreach ($this->config['disableActions'] as $action) {
|
||||
if (isset($installdefs[$this->manifestMap[$action]])) {
|
||||
$issues[] = translate('ML_INVALID_ACTION_IN_MANIFEST') . $this->manifestMap[$action];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now lets scan for files that will override our files
|
||||
if (empty($this->config['disableRestrictedCopy']) && isset($installdefs['copy'])) {
|
||||
|
@ -759,7 +782,7 @@ class ModuleScanner{
|
|||
if (!empty($issues)) {
|
||||
$this->issues['manifest'][$manifestPath] = $issues;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes in where the file will is specified to be copied from and to
|
||||
|
@ -793,80 +816,78 @@ class ModuleScanner{
|
|||
if (is_file($to) && $this->sugarFileExists($to)) {
|
||||
$this->issues['copy'][$from] = translate('ML_OVERRIDE_CORE_FILES') . '(' . $to . ')';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*Main external function that takes in a path to a package and then scans
|
||||
*that package's manifest for disabled actions and then it scans the PHP files
|
||||
*for restricted function calls
|
||||
*
|
||||
*/
|
||||
public function scanPackage($path){
|
||||
$this->pathToModule = $path;
|
||||
$this->scanManifest($path . '/manifest.php');
|
||||
if(empty($this->config['disableFileScan'])){
|
||||
$this->scanDir($path);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*Main external function that takes in a path to a package and then scans
|
||||
*that package's manifest for disabled actions and then it scans the PHP files
|
||||
*for restricted function calls
|
||||
*
|
||||
*/
|
||||
public function scanPackage($path)
|
||||
{
|
||||
$this->pathToModule = $path;
|
||||
$this->scanManifest($path . '/manifest.php');
|
||||
if (empty($this->config['disableFileScan'])) {
|
||||
$this->scanDir($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*This function will take all issues of the current instance and print them to the screen
|
||||
**/
|
||||
public function displayIssues($package='Package'){
|
||||
echo '<h2>'.str_replace('{PACKAGE}' , $package ,translate('ML_PACKAGE_SCANNING')). '</h2><BR><h2 class="error">' . translate('ML_INSTALLATION_FAILED') . '</h2><br><p>' .str_replace('{PACKAGE}' , $package ,translate('ML_PACKAGE_NOT_CONFIRM')). '</p><ul><li>'. translate('ML_OBTAIN_NEW_PACKAGE') . '<li>' . translate('ML_RELAX_LOCAL').
|
||||
/**
|
||||
*This function will take all issues of the current instance and print them to the screen
|
||||
**/
|
||||
public function displayIssues($package='Package')
|
||||
{
|
||||
echo '<h2>'.str_replace('{PACKAGE}', $package, translate('ML_PACKAGE_SCANNING')). '</h2><BR><h2 class="error">' . translate('ML_INSTALLATION_FAILED') . '</h2><br><p>' .str_replace('{PACKAGE}', $package, translate('ML_PACKAGE_NOT_CONFIRM')). '</p><ul><li>'. translate('ML_OBTAIN_NEW_PACKAGE') . '<li>' . translate('ML_RELAX_LOCAL').
|
||||
'</ul></p><br>' . translate('ML_SUGAR_LOADING_POLICY') . ' <a href=" http://kb.sugarcrm.com/custom/module-loader-restrictions-for-sugar-open-cloud/">' . translate('ML_SUGAR_KB') . '</a>.'.
|
||||
'<br>' . translate('ML_AVAIL_RESTRICTION'). ' <a href=" http://developers.sugarcrm.com/wordpress/2009/08/14/module-loader-restrictions/">' . translate('ML_SUGAR_DZ') . '</a>.<br><br>';
|
||||
|
||||
|
||||
foreach($this->issues as $type=>$issues){
|
||||
echo '<div class="error"><h2>'. ucfirst($type) .' ' . translate('ML_ISSUES') . '</h2> </div>';
|
||||
echo '<div id="details' . $type . '" >';
|
||||
foreach($issues as $file=>$issue){
|
||||
$file = str_replace($this->pathToModule . '/', '', $file);
|
||||
echo '<div style="position:relative;left:10px"><b>' . $file . '</b></div><div style="position:relative;left:20px">';
|
||||
if(is_array($issue)){
|
||||
foreach($issue as $i){
|
||||
echo "$i<br>";
|
||||
}
|
||||
}else{
|
||||
echo "$issue<br>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
echo '</div>';
|
||||
foreach ($this->issues as $type=>$issues) {
|
||||
echo '<div class="error"><h2>'. ucfirst($type) .' ' . translate('ML_ISSUES') . '</h2> </div>';
|
||||
echo '<div id="details' . $type . '" >';
|
||||
foreach ($issues as $file=>$issue) {
|
||||
$file = str_replace($this->pathToModule . '/', '', $file);
|
||||
echo '<div style="position:relative;left:10px"><b>' . $file . '</b></div><div style="position:relative;left:20px">';
|
||||
if (is_array($issue)) {
|
||||
foreach ($issue as $i) {
|
||||
echo "$i<br>";
|
||||
}
|
||||
} else {
|
||||
echo "$issue<br>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo "<br><input class='button' onclick='document.location.href=\"index.php?module=Administration&action=UpgradeWizard&view=module\"' type='button' value=\"" . translate('LBL_UW_BTN_BACK_TO_MOD_LOADER') . "\" />";
|
||||
}
|
||||
|
||||
}
|
||||
echo "<br><input class='button' onclick='document.location.href=\"index.php?module=Administration&action=UpgradeWizard&view=module\"' type='button' value=\"" . translate('LBL_UW_BTN_BACK_TO_MOD_LOADER') . "\" />";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock config settings
|
||||
*/
|
||||
public function lockConfig()
|
||||
{
|
||||
if(empty($this->config_hash)) {
|
||||
$this->config_hash = md5(serialize($GLOBALS['sugar_config']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if config was modified. Return
|
||||
* @param string $file
|
||||
* @return array Errors if something wrong, false if no problems
|
||||
*/
|
||||
public function checkConfig($file)
|
||||
{
|
||||
$config_hash_after = md5(serialize($GLOBALS['sugar_config']));
|
||||
if($config_hash_after != $this->config_hash) {
|
||||
$this->issues['file'][$file] = array(translate('ML_CONFIG_OVERRIDE'));
|
||||
return $this->issues;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Lock config settings
|
||||
*/
|
||||
public function lockConfig()
|
||||
{
|
||||
if (empty($this->config_hash)) {
|
||||
$this->config_hash = md5(serialize($GLOBALS['sugar_config']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if config was modified. Return
|
||||
* @param string $file
|
||||
* @return array Errors if something wrong, false if no problems
|
||||
*/
|
||||
public function checkConfig($file)
|
||||
{
|
||||
$config_hash_after = md5(serialize($GLOBALS['sugar_config']));
|
||||
if ($config_hash_after != $this->config_hash) {
|
||||
$this->issues['file'][$file] = array(translate('ML_CONFIG_OVERRIDE'));
|
||||
return $this->issues;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -877,6 +898,6 @@ class ModuleScanner{
|
|||
*/
|
||||
function MSLoadManifest($manifest_file)
|
||||
{
|
||||
include( $manifest_file );
|
||||
return array($manifest, $installdefs);
|
||||
include($manifest_file);
|
||||
return array($manifest, $installdefs);
|
||||
}
|
||||
|
|
|
@ -39,24 +39,26 @@
|
|||
|
||||
require_once('include/ListView/ListViewSmarty.php');
|
||||
|
||||
class ListViewPackages extends ListViewSmarty{
|
||||
var $secondaryDisplayColumns;
|
||||
class ListViewPackages extends ListViewSmarty
|
||||
{
|
||||
public $secondaryDisplayColumns;
|
||||
/**
|
||||
* Constructor Call ListViewSmarty
|
||||
*/
|
||||
function __construct(){
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
|
||||
*/
|
||||
function ListViewPackages(){
|
||||
public function ListViewPackages()
|
||||
{
|
||||
$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
|
||||
if(isset($GLOBALS['log'])) {
|
||||
if (isset($GLOBALS['log'])) {
|
||||
$GLOBALS['log']->deprecated($deprecatedMessage);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
trigger_error($deprecatedMessage, E_USER_DEPRECATED);
|
||||
}
|
||||
self::__construct();
|
||||
|
@ -69,7 +71,8 @@ class ListViewPackages extends ListViewSmarty{
|
|||
* @param data the data to display on the page
|
||||
* @param file the template file to parse
|
||||
*/
|
||||
function setup($data, $file, $where, $params = Array(), $offset = 0, $limit = -1, $filter_fields = Array(), $id_field = 'id', $id=NULL) {
|
||||
public function setup($data, $file, $where, $params = array(), $offset = 0, $limit = -1, $filter_fields = array(), $id_field = 'id', $id=null)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->tpl = $file;
|
||||
}
|
||||
|
@ -77,7 +80,8 @@ class ListViewPackages extends ListViewSmarty{
|
|||
/**
|
||||
* Override the display method
|
||||
*/
|
||||
function display($end = true){
|
||||
public function display($end = true)
|
||||
{
|
||||
global $odd_bg, $even_bg, $app_strings;
|
||||
$this->ss->assign('rowColor', array('oddListRow', 'evenListRow'));
|
||||
$this->ss->assign('bgColor', array($odd_bg, $even_bg));
|
||||
|
|
|
@ -39,352 +39,372 @@
|
|||
|
||||
require_once('ModuleInstall/PackageManager/PackageManagerDisplay.php');
|
||||
require_once('ModuleInstall/PackageManager/PackageManager.php');
|
||||
class PackageController{
|
||||
var $_pm;
|
||||
class PackageController
|
||||
{
|
||||
public $_pm;
|
||||
|
||||
/**
|
||||
* Constructor: this class is called from the the ajax call and handles invoking the correct
|
||||
* functionality on the server.
|
||||
*/
|
||||
function __construct(){
|
||||
$this->_pm = new PackageManager();
|
||||
}
|
||||
/**
|
||||
* Constructor: this class is called from the the ajax call and handles invoking the correct
|
||||
* functionality on the server.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_pm = new PackageManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
|
||||
/**
|
||||
* @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
|
||||
*/
|
||||
public function PackageController()
|
||||
{
|
||||
$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
|
||||
if (isset($GLOBALS['log'])) {
|
||||
$GLOBALS['log']->deprecated($deprecatedMessage);
|
||||
} else {
|
||||
trigger_error($deprecatedMessage, E_USER_DEPRECATED);
|
||||
}
|
||||
self::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function performBasicSearch()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$search_term = '';
|
||||
$node_id = '';
|
||||
if (isset($_REQUEST['search_term'])) {
|
||||
$search_term = nl2br($_REQUEST['search_term']);
|
||||
}
|
||||
if (isset($_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
|
||||
* the category
|
||||
*/
|
||||
public function getPackages()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$category_id = '';
|
||||
|
||||
if (isset($_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
|
||||
*/
|
||||
public function getReleases()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$category_id = '';
|
||||
$package_id = '';
|
||||
$types = '';
|
||||
if (isset($_REQUEST['category_id'])) {
|
||||
$category_id = nl2br($_REQUEST['category_id']);
|
||||
}
|
||||
if (isset($_REQUEST['package_id'])) {
|
||||
$package_id = nl2br($_REQUEST['package_id']);
|
||||
}
|
||||
if (isset($_REQUEST['types'])) {
|
||||
$types = nl2br($_REQUEST['types']);
|
||||
}
|
||||
$types = explode(',', $types);
|
||||
|
||||
$filter = array();
|
||||
$count = count($types);
|
||||
$index = 1;
|
||||
$type_str = '';
|
||||
foreach ($types as $type) {
|
||||
$type_str .= "'".$type."'";
|
||||
if ($index < $count) {
|
||||
$type_str .= ",";
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
|
||||
$filter = array('type' => $type_str);
|
||||
$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']);
|
||||
$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
|
||||
*/
|
||||
public 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
|
||||
* @return bool true is successful in downloading, false otherwise
|
||||
*/
|
||||
public function download()
|
||||
{
|
||||
global $sugar_config;
|
||||
$json = getJSONobj();
|
||||
$package_id = '';
|
||||
$category_id = '';
|
||||
$release_id = '';
|
||||
if (isset($_REQUEST['package_id'])) {
|
||||
$package_id = nl2br($_REQUEST['package_id']);
|
||||
}
|
||||
if (isset($_REQUEST['category_id'])) {
|
||||
$category_id = nl2br($_REQUEST['category_id']);
|
||||
}
|
||||
if (isset($_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);
|
||||
$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';
|
||||
}
|
||||
echo 'result = ' . $json->encode(array('success' => $success));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of categories that are subcategories to the selected category
|
||||
*
|
||||
* @param id - the id of the parent_category, -1 if this is the root
|
||||
* @return array - a list of categories/nodes which are underneath this node
|
||||
*/
|
||||
function PackageController(){
|
||||
$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
|
||||
if(isset($GLOBALS['log'])) {
|
||||
$GLOBALS['log']->deprecated($deprecatedMessage);
|
||||
}
|
||||
else {
|
||||
trigger_error($deprecatedMessage, E_USER_DEPRECATED);
|
||||
}
|
||||
self::__construct();
|
||||
}
|
||||
public function getCategories()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$node_id = '';
|
||||
if (isset($_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));
|
||||
}
|
||||
|
||||
public function getNodes()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$category_id = '';
|
||||
if (isset($_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));
|
||||
}
|
||||
|
||||
function performBasicSearch(){
|
||||
$json = getJSONobj();
|
||||
$search_term = '';
|
||||
$node_id = '';
|
||||
if(isset($_REQUEST['search_term'])) {
|
||||
$search_term = nl2br($_REQUEST['search_term']);
|
||||
}
|
||||
if(isset($_REQUEST['node_id'])) {
|
||||
$node_id = nl2br($_REQUEST['node_id']);
|
||||
}
|
||||
$xml = PackageManager::getPackages($node_id);
|
||||
echo 'result = ' . $json->encode(array('packages' => $xml));
|
||||
}
|
||||
/**
|
||||
* Check the SugarDepot for updates for the given type as passed in via POST
|
||||
* @param type the type to check for
|
||||
* @return array return an array of releases for each given installed object if an update is found
|
||||
*/
|
||||
public function checkForUpdates()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$type = '';
|
||||
if (isset($_REQUEST['type'])) {
|
||||
$type = nl2br($_REQUEST['type']);
|
||||
}
|
||||
$pm = new PackageManager();
|
||||
$updates = $pm->checkForUpdates();
|
||||
$nodes = array();
|
||||
$release_map = array();
|
||||
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']);
|
||||
$release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']);
|
||||
}
|
||||
}
|
||||
//patches
|
||||
$filter = array(array('name' => 'type', 'value' => "'patch'"));
|
||||
$releases = $pm->getReleases('', '', $filter);
|
||||
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']);
|
||||
$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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* the category
|
||||
*/
|
||||
function getPackages(){
|
||||
$json = getJSONobj();
|
||||
$category_id = '';
|
||||
public 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)));
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['category_id'])) {
|
||||
$category_id = nl2br($_REQUEST['category_id']);
|
||||
}
|
||||
$xml = PackageManager::getPackages($category_id);
|
||||
echo 'result = ' . $json->encode(array('package_output' => $xml));
|
||||
}
|
||||
/**
|
||||
* build the list of modules that are currently in the staging area waiting to be installed
|
||||
*/
|
||||
public function getPackagesInStaging()
|
||||
{
|
||||
$packages = $this->_pm->getPackagesInStaging('module');
|
||||
$json = getJSONobj();
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
function getReleases(){
|
||||
$json = getJSONobj();
|
||||
$category_id = '';
|
||||
$package_id = '';
|
||||
$types = '';
|
||||
if(isset($_REQUEST['category_id'])) {
|
||||
$category_id = nl2br($_REQUEST['category_id']);
|
||||
}
|
||||
if(isset($_REQUEST['package_id'])) {
|
||||
$package_id = nl2br($_REQUEST['package_id']);
|
||||
}
|
||||
if(isset($_REQUEST['types'])) {
|
||||
$types = nl2br($_REQUEST['types']);
|
||||
}
|
||||
$types = explode(',', $types);
|
||||
echo 'result = ' . $json->encode(array('packages' => $packages));
|
||||
}
|
||||
|
||||
$filter = array();
|
||||
$count = count($types);
|
||||
$index = 1;
|
||||
$type_str = '';
|
||||
foreach($types as $type){
|
||||
$type_str .= "'".$type."'";
|
||||
if($index < $count)
|
||||
$type_str .= ",";
|
||||
$index++;
|
||||
}
|
||||
/**
|
||||
* build the list of modules that are currently in the staging area waiting to be installed
|
||||
*/
|
||||
public function performInstall()
|
||||
{
|
||||
$file = '';
|
||||
if (isset($_REQUEST['file'])) {
|
||||
$file = hashToFile($_REQUEST['file']);
|
||||
}
|
||||
if (!empty($file)) {
|
||||
$this->_pm->performInstall($file);
|
||||
}
|
||||
$json = getJSONobj();
|
||||
|
||||
$filter = array('type' => $type_str);
|
||||
$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']);
|
||||
$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));
|
||||
}
|
||||
echo 'result = ' . $json->encode(array('result' => 'success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a promotion from the depot
|
||||
*/
|
||||
function getPromotion(){
|
||||
$json = getJSONobj();
|
||||
public function authenticate()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$username = '';
|
||||
$password = '';
|
||||
$servername = '';
|
||||
$terms_checked = '';
|
||||
if (isset($_REQUEST['username'])) {
|
||||
$username = nl2br($_REQUEST['username']);
|
||||
}
|
||||
if (isset($_REQUEST['password'])) {
|
||||
$password = nl2br($_REQUEST['password']);
|
||||
}
|
||||
if (isset($_REQUEST['servername'])) {
|
||||
$servername = $_REQUEST['servername'];
|
||||
}
|
||||
if (isset($_REQUEST['terms_checked'])) {
|
||||
$terms_checked = $_REQUEST['terms_checked'];
|
||||
if ($terms_checked == 'on') {
|
||||
$terms_checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
$header = PackageManager::getPromotion();
|
||||
if (!empty($username) && !empty($password)) {
|
||||
$password = md5($password);
|
||||
$result = PackageManager::authenticate($username, $password, $servername, $terms_checked);
|
||||
if (!is_array($result) && $result == true) {
|
||||
$status = 'success';
|
||||
} else {
|
||||
$status = $result['faultstring'];
|
||||
}
|
||||
} else {
|
||||
$status = 'failed';
|
||||
}
|
||||
|
||||
echo 'result = ' . $json->encode(array('promotion' => $header));
|
||||
}
|
||||
echo 'result = ' . $json->encode(array('status' => $status));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return bool true is successful in downloading, false otherwise
|
||||
*/
|
||||
function download(){
|
||||
global $sugar_config;
|
||||
$json = getJSONobj();
|
||||
$package_id = '';
|
||||
$category_id = '';
|
||||
$release_id = '';
|
||||
if(isset($_REQUEST['package_id'])) {
|
||||
$package_id = nl2br($_REQUEST['package_id']);
|
||||
}
|
||||
if(isset($_REQUEST['category_id'])) {
|
||||
$category_id = nl2br($_REQUEST['category_id']);
|
||||
}
|
||||
if(isset($_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);
|
||||
$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';
|
||||
}
|
||||
echo 'result = ' . $json->encode(array('success' => $success));
|
||||
}
|
||||
public function getDocumentation()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$package_id = '';
|
||||
$release_id = '';
|
||||
|
||||
/**
|
||||
* Retrieve a list of categories that are subcategories to the selected category
|
||||
*
|
||||
* @param id - the id of the parent_category, -1 if this is the root
|
||||
* @return array - a list of categories/nodes which are underneath this node
|
||||
*/
|
||||
function getCategories(){
|
||||
$json = getJSONobj();
|
||||
$node_id = '';
|
||||
if(isset($_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));
|
||||
}
|
||||
if (isset($_REQUEST['package_id'])) {
|
||||
$package_id = nl2br($_REQUEST['package_id']);
|
||||
}
|
||||
if (isset($_REQUEST['release_id'])) {
|
||||
$release_id = nl2br($_REQUEST['release_id']);
|
||||
}
|
||||
|
||||
function getNodes(){
|
||||
$json = getJSONobj();
|
||||
$category_id = '';
|
||||
if(isset($_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));
|
||||
}
|
||||
$documents = PackageManager::getDocumentation($package_id, $release_id);
|
||||
$GLOBALS['log']->debug("DOCUMENTS: ".var_export($documents, true));
|
||||
echo 'result = ' . $json->encode(array('documents' => $documents));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the SugarDepot for updates for the given type as passed in via POST
|
||||
* @param type the type to check for
|
||||
* @return array return an array of releases for each given installed object if an update is found
|
||||
*/
|
||||
function checkForUpdates(){
|
||||
$json = getJSONobj();
|
||||
$type = '';
|
||||
if(isset($_REQUEST['type'])) {
|
||||
$type = nl2br($_REQUEST['type']);
|
||||
}
|
||||
$pm = new PackageManager();
|
||||
$updates = $pm->checkForUpdates();
|
||||
$nodes = array();
|
||||
$release_map = array();
|
||||
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']);
|
||||
$release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']);
|
||||
}
|
||||
}
|
||||
//patches
|
||||
$filter = array(array('name' => 'type', 'value' => "'patch'"));
|
||||
$releases = $pm->getReleases('', '', $filter);
|
||||
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']);
|
||||
$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));
|
||||
}
|
||||
public function downloadedDocumentation()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$document_id = '';
|
||||
|
||||
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)));
|
||||
}
|
||||
if (isset($_REQUEST['document_id'])) {
|
||||
$document_id = nl2br($_REQUEST['document_id']);
|
||||
}
|
||||
$GLOBALS['log']->debug("Downloading Document: ".$document_id);
|
||||
PackageManagerComm::downloadedDocumentation($document_id);
|
||||
echo 'result = ' . $json->encode(array('result' => 'true'));
|
||||
}
|
||||
|
||||
/**
|
||||
* build the list of modules that are currently in the staging area waiting to be installed
|
||||
*/
|
||||
function getPackagesInStaging(){
|
||||
$packages = $this->_pm->getPackagesInStaging('module');
|
||||
$json = getJSONobj();
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
echo 'result = ' . $json->encode(array('packages' => $packages));
|
||||
}
|
||||
public function remove()
|
||||
{
|
||||
$json = getJSONobj();
|
||||
$file = '';
|
||||
|
||||
/**
|
||||
* 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)){
|
||||
$this->_pm->performInstall($file);
|
||||
}
|
||||
$json = getJSONobj();
|
||||
|
||||
echo 'result = ' . $json->encode(array('result' => 'success'));
|
||||
}
|
||||
|
||||
function authenticate(){
|
||||
$json = getJSONobj();
|
||||
$username = '';
|
||||
$password = '';
|
||||
$servername = '';
|
||||
$terms_checked = '';
|
||||
if(isset($_REQUEST['username'])) {
|
||||
$username = nl2br($_REQUEST['username']);
|
||||
}
|
||||
if(isset($_REQUEST['password'])) {
|
||||
$password = nl2br($_REQUEST['password']);
|
||||
}
|
||||
if(isset($_REQUEST['servername'])) {
|
||||
$servername = $_REQUEST['servername'];
|
||||
}
|
||||
if(isset($_REQUEST['terms_checked'])) {
|
||||
$terms_checked = $_REQUEST['terms_checked'];
|
||||
if($terms_checked == 'on')
|
||||
$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';
|
||||
else
|
||||
$status = $result['faultstring'];
|
||||
}else{
|
||||
$status = 'failed';
|
||||
}
|
||||
|
||||
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']);
|
||||
}
|
||||
if(isset($_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']);
|
||||
}
|
||||
$GLOBALS['log']->debug("Downloading Document: ".$document_id);
|
||||
PackageManagerComm::downloadedDocumentation($document_id);
|
||||
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']));
|
||||
}
|
||||
$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'));
|
||||
}
|
||||
if (isset($_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'));
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -43,108 +43,119 @@ require_once('ModuleInstall/PackageManager/PackageManagerDownloader.php');
|
|||
define("HTTPS_URL", "https://depot.sugarcrm.com/depot/SugarDepotSoap.php");
|
||||
define("ACTIVE_STATUS", "ACTIVE");
|
||||
|
||||
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'])){
|
||||
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
|
||||
*/
|
||||
public 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'])){
|
||||
if ($login && empty($_SESSION['SugarDepotSessionID'])) {
|
||||
PackageManagerComm::login();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for errors in the response or error_str
|
||||
*/
|
||||
function errorCheck(){
|
||||
if(!empty($GLOBALS['SugarDepot']->error_str)){
|
||||
$GLOBALS['log']->fatal($GLOBALS['SugarDepot']->error_str);
|
||||
$GLOBALS['log']->fatal($GLOBALS['SugarDepot']->response);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check for errors in the response or error_str
|
||||
*/
|
||||
public function errorCheck()
|
||||
{
|
||||
if (!empty($GLOBALS['SugarDepot']->error_str)) {
|
||||
$GLOBALS['log']->fatal($GLOBALS['SugarDepot']->error_str);
|
||||
$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
|
||||
*/
|
||||
function setCredentials($username, $password, $download_key){
|
||||
/**
|
||||
* Set the credentials for use during login
|
||||
*
|
||||
* @param username Mambo username
|
||||
* @param password Mambo password
|
||||
* @param download_key User's download key
|
||||
*/
|
||||
public function setCredentials($username, $password, $download_key)
|
||||
{
|
||||
$_SESSION['SugarDepotUsername'] = $username;
|
||||
$_SESSION['SugarDepotPassword'] = $password;
|
||||
$_SESSION['SugarDepotDownloadKey'] = $download_key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the session so we can reauthenticate.
|
||||
*/
|
||||
function clearSession(){
|
||||
$_SESSION['SugarDepotSessionID'] = null;
|
||||
unset($_SESSION['SugarDepotSessionID']);
|
||||
}
|
||||
/////////////////////////////////////////////////////////
|
||||
////////// BEGIN: Base Functions for Communicating with the depot
|
||||
/**
|
||||
* Login to the depot
|
||||
*
|
||||
* @return true if successful, false otherwise
|
||||
*/
|
||||
function login($terms_checked = true){
|
||||
if(empty($_SESSION['SugarDepotSessionID'])){
|
||||
global $license;
|
||||
$GLOBALS['log']->debug("Begin SugarDepot Login");
|
||||
PackageManagerComm::initialize(false);
|
||||
require('sugar_version.php');
|
||||
require('config.php');
|
||||
$credentials = PackageManager::getCredentials();
|
||||
if(empty($license))loadLicense();
|
||||
$info = sugarEncode('2813', serialize(getSystemInfo(true)));
|
||||
$pm = new PackageManager();
|
||||
$installed = $pm->buildInstalledReleases();
|
||||
$installed = base64_encode(serialize($installed));
|
||||
$params = array('installed_modules' => $installed, 'terms_checked' => $terms_checked, 'system_name' => $credentials['system_name']);
|
||||
$terms_version = (!empty($_SESSION['SugarDepot_TermsVersion']) ? $_SESSION['SugarDepot_TermsVersion'] : '');
|
||||
if(!empty($terms_version))
|
||||
$params['terms_version'] = $terms_version;
|
||||
/**
|
||||
* Clears out the session so we can reauthenticate.
|
||||
*/
|
||||
public function clearSession()
|
||||
{
|
||||
$_SESSION['SugarDepotSessionID'] = null;
|
||||
unset($_SESSION['SugarDepotSessionID']);
|
||||
}
|
||||
/////////////////////////////////////////////////////////
|
||||
////////// BEGIN: Base Functions for Communicating with the depot
|
||||
/**
|
||||
* Login to the depot
|
||||
*
|
||||
* @return true if successful, false otherwise
|
||||
*/
|
||||
public function login($terms_checked = true)
|
||||
{
|
||||
if (empty($_SESSION['SugarDepotSessionID'])) {
|
||||
global $license;
|
||||
$GLOBALS['log']->debug("Begin SugarDepot Login");
|
||||
PackageManagerComm::initialize(false);
|
||||
require('sugar_version.php');
|
||||
require('config.php');
|
||||
$credentials = PackageManager::getCredentials();
|
||||
if (empty($license)) {
|
||||
loadLicense();
|
||||
}
|
||||
$info = sugarEncode('2813', serialize(getSystemInfo(true)));
|
||||
$pm = new PackageManager();
|
||||
$installed = $pm->buildInstalledReleases();
|
||||
$installed = base64_encode(serialize($installed));
|
||||
$params = array('installed_modules' => $installed, 'terms_checked' => $terms_checked, 'system_name' => $credentials['system_name']);
|
||||
$terms_version = (!empty($_SESSION['SugarDepot_TermsVersion']) ? $_SESSION['SugarDepot_TermsVersion'] : '');
|
||||
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));
|
||||
PackageManagerComm::errorCheck();
|
||||
if(!is_array($result))
|
||||
$_SESSION['SugarDepotSessionID'] = $result;
|
||||
$GLOBALS['log']->debug("End SugarDepot Login");
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
return $_SESSION['SugarDepotSessionID'];
|
||||
}
|
||||
$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;
|
||||
}
|
||||
$GLOBALS['log']->debug("End SugarDepot Login");
|
||||
return $result;
|
||||
}
|
||||
return $_SESSION['SugarDepotSessionID'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout from the depot
|
||||
*/
|
||||
function logout(){
|
||||
/**
|
||||
* Logout from the depot
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
PackageManagerComm::initialize();
|
||||
$result = $GLOBALS['SugarDepot']->call('depotLogout', array('session_id' => $_SESSION['SugarDepotSessionID']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all promotions from the depot
|
||||
*/
|
||||
function getPromotion(){
|
||||
/**
|
||||
* Get all promotions from the depot
|
||||
*/
|
||||
public function getPromotion()
|
||||
{
|
||||
PackageManagerComm::initialize();
|
||||
//check for fault first and then return
|
||||
$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
|
||||
|
@ -155,10 +166,11 @@ class PackageManagerComm{
|
|||
* @return categories_and_packages
|
||||
* @see categories_and_packages
|
||||
*/
|
||||
function getCategoryPackages($category_id, $filter = array()){
|
||||
public function getCategoryPackages($category_id, $filter = array())
|
||||
{
|
||||
PackageManagerComm::initialize();
|
||||
//check for fault
|
||||
return $GLOBALS['SugarDepot']->call('depotGetCategoriesPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter));
|
||||
return $GLOBALS['SugarDepot']->call('depotGetCategoriesPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,7 +181,8 @@ class PackageManagerComm{
|
|||
* @return categories_and_packages
|
||||
* @see categories_and_packages
|
||||
*/
|
||||
function getCategories($category_id, $filter = array()){
|
||||
public function getCategories($category_id, $filter = array())
|
||||
{
|
||||
PackageManagerComm::initialize();
|
||||
//check for fault
|
||||
return $GLOBALS['SugarDepot']->call('depotGetCategories', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter));
|
||||
|
@ -183,10 +196,11 @@ class PackageManagerComm{
|
|||
* @return packages
|
||||
* @see packages
|
||||
*/
|
||||
function getPackages($category_id, $filter = array()){
|
||||
public 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 $GLOBALS['SugarDepot']->call('depotGetPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,10 +211,11 @@ class PackageManagerComm{
|
|||
* @return packages
|
||||
* @see packages
|
||||
*/
|
||||
function getReleases($category_id, $package_id, $filter = array()){
|
||||
public 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));
|
||||
//check for fault
|
||||
return $GLOBALS['SugarDepot']->call('depotGetReleases', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'filter' => $filter));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,10 +227,11 @@ class PackageManagerComm{
|
|||
* @return download
|
||||
* @see download
|
||||
*/
|
||||
function download($category_id, $package_id, $release_id){
|
||||
public 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));
|
||||
//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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,10 +242,11 @@ class PackageManagerComm{
|
|||
* @param release_id the release we want to download
|
||||
* @return the filename to download
|
||||
*/
|
||||
function addDownload($category_id, $package_id, $release_id){
|
||||
public 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'));
|
||||
//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'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,11 +255,12 @@ class PackageManagerComm{
|
|||
* @param filename the file to download
|
||||
* @return path to downloaded file
|
||||
*/
|
||||
static public function performDownload($filename){
|
||||
public static 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);
|
||||
//check for fault
|
||||
$GLOBALS['log']->debug("Performing download from depot: Session ID: ".$_SESSION['SugarDepotSessionID']." Filename: ".$filename);
|
||||
return PackageManagerDownloader::download($_SESSION['SugarDepotSessionID'], $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,15 +271,17 @@ class PackageManagerComm{
|
|||
*
|
||||
* @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));
|
||||
public 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));
|
||||
}
|
||||
|
||||
function getTermsAndConditions(){
|
||||
PackageManagerComm::initialize(false);
|
||||
return $GLOBALS['SugarDepot']->call('depotTermsAndConditions',array());
|
||||
public function getTermsAndConditions()
|
||||
{
|
||||
PackageManagerComm::initialize(false);
|
||||
return $GLOBALS['SugarDepot']->call('depotTermsAndConditions', array());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -269,42 +289,44 @@ class PackageManagerComm{
|
|||
*
|
||||
* @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));
|
||||
public 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
function checkForUpdates($objects_to_check){
|
||||
PackageManagerComm::initialize();
|
||||
//check for fault
|
||||
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
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @return true if we can communicate with the server and false otherwise
|
||||
* @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
|
||||
*/
|
||||
public function checkForUpdates($objects_to_check)
|
||||
{
|
||||
PackageManagerComm::initialize();
|
||||
//check for fault
|
||||
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(){
|
||||
public function isAlive()
|
||||
{
|
||||
PackageManagerComm::initialize(false);
|
||||
|
||||
$status = $GLOBALS['SugarDepot']->call('sugarPing', array());
|
||||
if(empty($status) || $GLOBALS['SugarDepot']->getError() || $status != ACTIVE_STATUS){
|
||||
if (empty($status) || $GLOBALS['SugarDepot']->getError() || $status != ACTIVE_STATUS) {
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
////////// END: Base Functions for Communicating with the depot
|
||||
return true;
|
||||
}
|
||||
////////// END: Base Functions for Communicating with the depot
|
||||
////////////////////////////////////////////////////////
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ require_once('include/ytree/Tree.php');
|
|||
require_once('include/ytree/Node.php');
|
||||
require_once('ModuleInstall/PackageManager/ListViewPackages.php');
|
||||
|
||||
class PackageManagerDisplay{
|
||||
class PackageManagerDisplay
|
||||
{
|
||||
|
||||
/**
|
||||
* A Static method to Build the display for the package manager
|
||||
|
@ -56,8 +57,9 @@ class PackageManagerDisplay{
|
|||
* @param String active_form - the form to display first
|
||||
* @return String - a string of html which will be used to display the forms
|
||||
*/
|
||||
static function buildPackageDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1', $install = false){
|
||||
global $current_language;
|
||||
public static function buildPackageDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1', $install = false)
|
||||
{
|
||||
global $current_language;
|
||||
|
||||
$mod_strings = return_module_language($current_language, "Administration");
|
||||
global $app_strings;
|
||||
|
@ -75,67 +77,65 @@ class PackageManagerDisplay{
|
|||
$show_login = $result['show_login'];
|
||||
$mi_errors = ModuleInstaller::getErrors();
|
||||
$error_html = "";
|
||||
if(!empty($mi_errors)){
|
||||
$error_html = "<tr><td><span>";
|
||||
foreach($mi_errors as $error){
|
||||
$error_html .= "<font color='red'>".$error."</font><br>";
|
||||
}
|
||||
$error_html .= "</span></td></tr>";
|
||||
}
|
||||
if (!empty($mi_errors)) {
|
||||
$error_html = "<tr><td><span>";
|
||||
foreach ($mi_errors as $error) {
|
||||
$error_html .= "<font color='red'>".$error."</font><br>";
|
||||
}
|
||||
$error_html .= "</span></td></tr>";
|
||||
}
|
||||
|
||||
$form2 = "<table class='tabForm' width='100%' cellpadding='0' cellspacing='0' width='100%' border='0'>";
|
||||
$form2 .= $error_html;
|
||||
if(!$isAlive)
|
||||
$form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>";
|
||||
if (!$isAlive) {
|
||||
$form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>";
|
||||
}
|
||||
$form2 .= "</table>";
|
||||
|
||||
$tree = null;
|
||||
//if($isAlive){
|
||||
$tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive);
|
||||
$tree->tree_style= 'include/ytree/TreeView/css/check/tree.css';
|
||||
$ss->assign('TREEHEADER',$tree->generate_header());
|
||||
$tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive);
|
||||
$tree->tree_style= 'include/ytree/TreeView/css/check/tree.css';
|
||||
$ss->assign('TREEHEADER', $tree->generate_header());
|
||||
//}
|
||||
//$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings);
|
||||
$form2 .= "<table class='tabForm' cellpadding='0' cellspacing='0' width='100%' border='0'>";
|
||||
$form2 .= "<tr><td></td><td align='left'>";
|
||||
if($isAlive){
|
||||
$form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>";
|
||||
}else{
|
||||
if ($isAlive) {
|
||||
$form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>";
|
||||
} 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'",null,null,'.gif',"Loading")."</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){
|
||||
if ($isAlive) {
|
||||
$form2 .= "<span><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'> Collapse</span></a></span>";
|
||||
}else{
|
||||
} else {
|
||||
$form2 .= "<span><a class=\"listViewTdToolsS1\" id='href_animate' onClick=\"PackageManager.toggleDiv('span_animate_server_div', 'catview');\"><span id='span_animate_server_div' style='display:none;'><img src='".SugarThemeRegistry::current()->getImageURL('basic_search.gif')."' width='8' height='8' border='0'> Collapse</span></a></span>";
|
||||
}
|
||||
$form2 .= "</td></tr></table>";
|
||||
$form2 = ''; //Commenting out the form as part of sugar depot hiding.
|
||||
$form2 = ''; //Commenting out the form as part of sugar depot hiding.
|
||||
$ss->assign('installation', ($install ? 'true' : 'false'));
|
||||
|
||||
|
||||
$mod_strings = return_module_language($current_language, "Administration");
|
||||
$mod_strings = return_module_language($current_language, "Administration");
|
||||
|
||||
$ss->assign('MOD', $mod_strings);
|
||||
$ss->assign('module_load', 'true');
|
||||
if (UploadStream::getSuhosinStatus() == false)
|
||||
{
|
||||
$ss->assign('module_load', 'true');
|
||||
if (UploadStream::getSuhosinStatus() == false) {
|
||||
$ss->assign('ERR_SUHOSIN', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$ss->assign('scripts', PackageManagerDisplay::getDisplayScript($install));
|
||||
}
|
||||
$show_login = false; //hiding install from sugar
|
||||
$ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
|
||||
$ss->assign('FORM_2_PLACE_HOLDER', $form2);
|
||||
$ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
|
||||
$ss->assign('FORM_2_PLACE_HOLDER', $form2);
|
||||
$ss->assign('MOD', $mod_strings);
|
||||
$descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
|
||||
$ss->assign('INSTALLED_PACKAGES_HOLDER', PackageManagerDisplay::buildInstalledGrid($mod_strings, $types));
|
||||
|
||||
$str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl');
|
||||
return $str;
|
||||
$str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl');
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,8 +148,9 @@ class PackageManagerDisplay{
|
|||
* @param String active_form - the form to display first
|
||||
* @return String - a string of html which will be used to display the forms
|
||||
*/
|
||||
function buildPatchDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1'){
|
||||
global $current_language;
|
||||
public function buildPatchDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1')
|
||||
{
|
||||
global $current_language;
|
||||
$mod_strings = return_module_language($current_language, "Administration");
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('FORM_1_PLACE_HOLDER', $form1);
|
||||
|
@ -164,47 +165,50 @@ class PackageManagerDisplay{
|
|||
$show_login = $result['show_login'];
|
||||
$display = 'none';
|
||||
//if($isAlive){
|
||||
$display = 'block';
|
||||
$display = 'block';
|
||||
//}
|
||||
$form2 = "<table class='tabForm' width='100%' cellpadding='0' cellspacing='0' width='100%' border='0'>";
|
||||
if(!$isAlive)
|
||||
$form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>";
|
||||
if (!$isAlive) {
|
||||
$form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>";
|
||||
}
|
||||
$form2 .= "</table>";
|
||||
$form2 .= "<table width='100%'><tr><td align='left'>";
|
||||
if($show_login){
|
||||
$form2 .= "<input type='button' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>";
|
||||
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'",null,null,'.gif',"Loading")."</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."'>";
|
||||
$form2 .= " <div id='patch_downloads' class='ygrid-mso' style='height:205px; display: ".$display.";'></div>";
|
||||
$form2 .= "</div>";
|
||||
if(!$show_login)
|
||||
$loginViewStyle = 'none';
|
||||
//$form2 .= "<div id='loginView' style='display:".$loginViewStyle."'>";
|
||||
//$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings, $isAlive);
|
||||
//$form2 .= "</div>";
|
||||
$selectViewStyle = ($isAlive ? 'block' : 'none');
|
||||
$form2 .= "<div id='selectView' style='display:".$selectViewStyle."'>";
|
||||
$form2 .= " <div id='patch_downloads' class='ygrid-mso' style='height:205px; display: ".$display.";'></div>";
|
||||
$form2 .= "</div>";
|
||||
if (!$show_login) {
|
||||
$loginViewStyle = 'none';
|
||||
}
|
||||
//$form2 .= "<div id='loginView' style='display:".$loginViewStyle."'>";
|
||||
//$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings, $isAlive);
|
||||
//$form2 .= "</div>";
|
||||
|
||||
$form2 .= "</td></tr></table>";
|
||||
$form2 = '';
|
||||
$packages = array();
|
||||
$releases = array();
|
||||
if($isAlive){
|
||||
$filter = array();
|
||||
$count = count($types);
|
||||
$index = 1;
|
||||
$type_str = '"';
|
||||
foreach($types as $type){
|
||||
$type_str .= "'".$type."'";
|
||||
if($index < $count)
|
||||
$type_str .= ",";
|
||||
$index++;
|
||||
}
|
||||
$type_str .= '"';
|
||||
$filter = array('type' => $type_str);
|
||||
$filter = PackageManager::toNameValueList($filter);
|
||||
if ($isAlive) {
|
||||
$filter = array();
|
||||
$count = count($types);
|
||||
$index = 1;
|
||||
$type_str = '"';
|
||||
foreach ($types as $type) {
|
||||
$type_str .= "'".$type."'";
|
||||
if ($index < $count) {
|
||||
$type_str .= ",";
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$type_str .= '"';
|
||||
$filter = array('type' => $type_str);
|
||||
$filter = PackageManager::toNameValueList($filter);
|
||||
$pm = new PackageManager();
|
||||
/*if(in_array('patch', $types)){
|
||||
$releases = $pm->getReleases('3', '3', $filter);
|
||||
|
@ -212,49 +216,51 @@ class PackageManagerDisplay{
|
|||
$releases = $pm->getReleases('', '', $filter);
|
||||
}*/
|
||||
}
|
||||
if($form_action == 'install.php' && (empty($releases) || count($releases['packages']) == 0)){
|
||||
//return false;
|
||||
if ($form_action == 'install.php' && (empty($releases) || count($releases['packages']) == 0)) {
|
||||
//return false;
|
||||
}
|
||||
$tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive);
|
||||
$tree->tree_style= 'include/ytree/TreeView/css/check/tree.css';
|
||||
$ss->assign('TREEHEADER',$tree->generate_header());
|
||||
$ss->assign('module_load', 'false');
|
||||
$ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
|
||||
$ss->assign('TREEHEADER', $tree->generate_header());
|
||||
$ss->assign('module_load', 'false');
|
||||
$ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
|
||||
$ss->assign('FORM_2_PLACE_HOLDER', $form2);
|
||||
$ss->assign('scripts', PackageManagerDisplay::getDisplayScript(false, 'patch', $releases, $types, $isAlive));
|
||||
$str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl');
|
||||
return $str;
|
||||
}
|
||||
|
||||
static function buildInstalledGrid($mod_strings, $types = array('modules')){
|
||||
$descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
|
||||
$output = '<table width="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td align="left">'.$descItemsInstalled.'</td>';
|
||||
$output .= '</td></tr></table>';
|
||||
$output .= "<table width='100%'><tr><td ><div id='installed_grid' class='ygrid-mso' style='height:205px;'></div></td></tr></table>";
|
||||
return $output;
|
||||
public static function buildInstalledGrid($mod_strings, $types = array('modules'))
|
||||
{
|
||||
$descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
|
||||
$output = '<table width="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td align="left">'.$descItemsInstalled.'</td>';
|
||||
$output .= '</td></tr></table>';
|
||||
$output .= "<table width='100%'><tr><td ><div id='installed_grid' class='ygrid-mso' style='height:205px;'></div></td></tr></table>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
function buildLoginPanel($mod_strings, $display_cancel){
|
||||
public function buildLoginPanel($mod_strings, $display_cancel)
|
||||
{
|
||||
$credentials = PackageManager::getCredentials();
|
||||
$output = "<div id='login_panel'><div class='hd'><b>".$mod_strings['HDR_LOGIN_PANEL']."</b></div>";
|
||||
$output = "<div id='login_panel'><div class='hd'><b>".$mod_strings['HDR_LOGIN_PANEL']."</b></div>";
|
||||
$output .= "<div class='bd'><form><table><tr><td>".$mod_strings['LBL_USERNAME']."</td><td><input type='text' name='login_panel_username' id='login_panel_username' value='".$credentials['username']."'></td><td><a target='blank'>".$mod_strings['LNK_NEW_ACCOUNT']."</a></td>";
|
||||
|
||||
$output .= "</tr><tr><td>".$mod_strings['LBL_PASSWORD']."</td><td><input type='password' name='login_panel_password' id='login_panel_password'></td><td></td>";
|
||||
|
||||
$terms = PackageManager::getTermsAndConditions();
|
||||
$output .= "</tr><tr><td colspan='6' valign='top'><b>".$mod_strings['LBL_TERMS_AND_CONDITIONS']."</b><br><textarea readonly cols=80 rows=8>" . $terms['terms'] . '</textarea></td>';
|
||||
$_SESSION['SugarDepot_TermsVersion'] = (!empty($terms['version']) ? $terms['version'] : '');
|
||||
$terms = PackageManager::getTermsAndConditions();
|
||||
$output .= "</tr><tr><td colspan='6' valign='top'><b>".$mod_strings['LBL_TERMS_AND_CONDITIONS']."</b><br><textarea readonly cols=80 rows=8>" . $terms['terms'] . '</textarea></td>';
|
||||
$_SESSION['SugarDepot_TermsVersion'] = (!empty($terms['version']) ? $terms['version'] : '');
|
||||
|
||||
$output .= "</td></tr><tr><td colspan='6'><input class='checkbox' type='checkbox' name='cb_terms' id='cb_terms' onclick='if(this.checked){this.form.panel_login_button.disabled=false;}else{this.form.panel_login_button.disabled=true;}'>".$mod_strings['LBL_ACCEPT_TERMS']."</td></tr><tr>";
|
||||
$output .= "</td></tr><tr><td colspan='6'><input class='checkbox' type='checkbox' name='cb_terms' id='cb_terms' onclick='if(this.checked){this.form.panel_login_button.disabled=false;}else{this.form.panel_login_button.disabled=true;}'>".$mod_strings['LBL_ACCEPT_TERMS']."</td></tr><tr>";
|
||||
$output .= "<td align='left'>";
|
||||
$output .= "<input type='button' id='panel_login_button' name='panel_login_button' value='Login' class='button' onClick='PackageManager.authenticate(this.form.login_panel_username.value, this.form.login_panel_password.value, \"\",\"" . $terms['version'] . "\");' disabled>";
|
||||
|
||||
if($display_cancel){
|
||||
$output .= " <input type='button' id='panel_cancel_button' value='Cancel' class='button' onClick='PackageManager.showLoginDialog(false);'>";
|
||||
if ($display_cancel) {
|
||||
$output .= " <input type='button' id='panel_cancel_button' value='Cancel' class='button' onClick='PackageManager.showLoginDialog(false);'>";
|
||||
}
|
||||
$output .= "</td><td></td></tr>";
|
||||
$output .= "<tr></td><td></td></tr>";
|
||||
$output .= "</table></div>";
|
||||
$output .= "<tr></td><td></td></tr>";
|
||||
$output .= "</table></div>";
|
||||
$output .= "<div class='ft'></div></form></div>";
|
||||
return $output;
|
||||
}
|
||||
|
@ -266,55 +272,59 @@ class PackageManagerDisplay{
|
|||
* @param Array mod_strings - the local mod strings to display
|
||||
* @return String - a string of html
|
||||
*/
|
||||
static function buildGridOutput($tree, $mod_strings, $display = true, $show_login = true){
|
||||
$output = "<div id='catview'>";
|
||||
$loginViewStyle = ($display ? 'none' : 'block');
|
||||
$selectViewStyle = ($display ? 'block' : 'none');
|
||||
$output .= "<div id='selectView' style='display:".$selectViewStyle."'>";
|
||||
//if($display){
|
||||
$output .= "<table border=0 width='100%' class='moduleTitle'><tr><td width='100%' valign='top'>";
|
||||
$output .= "<div id='treeview'>";
|
||||
$output .= $tree->generate_nodes_array();
|
||||
$output .= "</div>";
|
||||
$output .= "</td></tr>";
|
||||
$output .= "<tr><td width='100%'>";
|
||||
$output .= "<div id='tabs1'></div>";
|
||||
$output .= "</td></tr>";
|
||||
$output .= "<tr><td width='100%' align='left'>";
|
||||
$output .= "<input type='button' class='button' value='Download Selected' onClick='PackageManager.download();'>";
|
||||
$output .= "</td></tr></table>";
|
||||
public static function buildGridOutput($tree, $mod_strings, $display = true, $show_login = true)
|
||||
{
|
||||
$output = "<div id='catview'>";
|
||||
$loginViewStyle = ($display ? 'none' : 'block');
|
||||
$selectViewStyle = ($display ? 'block' : 'none');
|
||||
$output .= "<div id='selectView' style='display:".$selectViewStyle."'>";
|
||||
//if($display){
|
||||
$output .= "<table border=0 width='100%' class='moduleTitle'><tr><td width='100%' valign='top'>";
|
||||
$output .= "<div id='treeview'>";
|
||||
$output .= $tree->generate_nodes_array();
|
||||
$output .= "</div>";
|
||||
$output .= "</td></tr>";
|
||||
$output .= "<tr><td width='100%'>";
|
||||
$output .= "<div id='tabs1'></div>";
|
||||
$output .= "</td></tr>";
|
||||
$output .= "<tr><td width='100%' align='left'>";
|
||||
$output .= "<input type='button' class='button' value='Download Selected' onClick='PackageManager.download();'>";
|
||||
$output .= "</td></tr></table>";
|
||||
// }
|
||||
$output .= "</div>";
|
||||
if(!$show_login)
|
||||
$loginViewStyle = 'none';
|
||||
$output .= "</div>";
|
||||
if (!$show_login) {
|
||||
$loginViewStyle = 'none';
|
||||
}
|
||||
// $output .= "<div id='loginView' style='display:".$loginViewStyle."'>";
|
||||
// jchi ,#24296 :commented code because we are currently not using depot, in the future this may change so you can put this code back in.
|
||||
//$output .= PackageManagerDisplay::buildLoginPanel($mod_strings, $display);
|
||||
//$output .= "</div>";
|
||||
//$output .= "<table width='100%' class='moduleTitle' border=1><tr><td><div id='patch_downloads' class='ygrid-mso' style='height:205px;'></div></td></tr></table>";
|
||||
$output .= "</div>";
|
||||
// jchi ,#24296 :commented code because we are currently not using depot, in the future this may change so you can put this code back in.
|
||||
//$output .= PackageManagerDisplay::buildLoginPanel($mod_strings, $display);
|
||||
//$output .= "</div>";
|
||||
//$output .= "<table width='100%' class='moduleTitle' border=1><tr><td><div id='patch_downloads' class='ygrid-mso' style='height:205px;'></div></td></tr></table>";
|
||||
$output .= "</div>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Static method used to build the initial treeview when the page is first displayed
|
||||
*
|
||||
* @param String div_id - this div in which to display the tree
|
||||
* @return Tree - the tree that is built
|
||||
*/
|
||||
static function buildTreeView($div_id, $isAlive = true){
|
||||
/**
|
||||
* A Static method used to build the initial treeview when the page is first displayed
|
||||
*
|
||||
* @param String div_id - this div in which to display the tree
|
||||
* @return Tree - the tree that is built
|
||||
*/
|
||||
public static function buildTreeView($div_id, $isAlive = true)
|
||||
{
|
||||
$tree = new Tree($div_id);
|
||||
$nodes = array();
|
||||
if($isAlive)
|
||||
$nodes = PackageManager::getCategories('');
|
||||
if ($isAlive) {
|
||||
$nodes = PackageManager::getCategories('');
|
||||
}
|
||||
|
||||
foreach($nodes as $arr_node){
|
||||
foreach ($nodes as $arr_node) {
|
||||
$node = new Node($arr_node['id'], $arr_node['label']);
|
||||
$node->dynamicloadfunction = 'PackageManager.loadDataForNodeForPackage';
|
||||
$node->expanded = false;
|
||||
$node->dynamic_load = true;
|
||||
$node->set_property('href',"javascript:PackageManager.catClick('treeview');");
|
||||
$node->set_property('href', "javascript:PackageManager.catClick('treeview');");
|
||||
$tree->add_node($node);
|
||||
$node->set_property('description', $arr_node['description']);
|
||||
}
|
||||
|
@ -333,8 +343,9 @@ class PackageManagerDisplay{
|
|||
* @param String modify_field - the field to update when the radio button is changed
|
||||
* @return String - a form used to display the license
|
||||
*/
|
||||
function getLicenseDisplay($license_file, $form_action, $next_step, $zipFile, $type, $manifest, $modify_field){
|
||||
global $current_language;
|
||||
public function getLicenseDisplay($license_file, $form_action, $next_step, $zipFile, $type, $manifest, $modify_field)
|
||||
{
|
||||
global $current_language;
|
||||
$mod_strings = return_module_language($current_language, "Administration");
|
||||
$contents = sugar_file_get_contents($license_file);
|
||||
$div_id = urlencode($zipFile);
|
||||
|
@ -371,139 +382,146 @@ class PackageManagerDisplay{
|
|||
return $display;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Static method used to generate the javascript for the page
|
||||
*
|
||||
* @return String - the javascript required for the page
|
||||
*/
|
||||
static function getDisplayScript($install = false, $type = 'module', $releases = null, $types = array(), $isAlive = true){
|
||||
/**
|
||||
* A Static method used to generate the javascript for the page
|
||||
*
|
||||
* @return String - the javascript required for the page
|
||||
*/
|
||||
public static function getDisplayScript($install = false, $type = 'module', $releases = null, $types = array(), $isAlive = true)
|
||||
{
|
||||
global $sugar_version, $sugar_config;
|
||||
global $current_language;
|
||||
|
||||
$mod_strings = return_module_language($current_language, "Administration");
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('MOD', $mod_strings);
|
||||
if(!$install){
|
||||
if (!$install) {
|
||||
$install = 0;
|
||||
}
|
||||
$ss->assign('INSTALLATION', $install);
|
||||
$ss->assign('WAIT_IMAGE', SugarThemeRegistry::current()->getImage("loading","border='0' align='bottom'",null,null,'.gif',"Loading"));
|
||||
$ss->assign('INSTALLATION', $install);
|
||||
$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);
|
||||
$ss->assign('IS_ALIVE', $isAlive);
|
||||
//if($type == 'patch' && $releases != null){
|
||||
if($type == 'patch'){
|
||||
if ($type == 'patch') {
|
||||
$ss->assign('module_load', 'false');
|
||||
$patches = PackageManagerDisplay::createJavascriptPackageArray($releases);
|
||||
$ss->assign('PATCHES', $patches);
|
||||
$ss->assign('GRID_TYPE', implode(',', $types));
|
||||
}else{
|
||||
$pm = new PackageManager();
|
||||
$releases = $pm->getPackagesInStaging();
|
||||
$patches = PackageManagerDisplay::createJavascriptModuleArray($releases);
|
||||
$ss->assign('GRID_TYPE', implode(',', $types));
|
||||
} else {
|
||||
$pm = new PackageManager();
|
||||
$releases = $pm->getPackagesInStaging();
|
||||
$patches = PackageManagerDisplay::createJavascriptModuleArray($releases);
|
||||
$ss->assign('PATCHES', $patches);
|
||||
$installeds = $pm->getinstalledPackages();
|
||||
$patches = PackageManagerDisplay::createJavascriptModuleArray($installeds, 'mti_installed_data');
|
||||
$patches = PackageManagerDisplay::createJavascriptModuleArray($installeds, 'mti_installed_data');
|
||||
$ss->assign('INSTALLED_MODULES', $patches);
|
||||
$ss->assign('UPGARDE_WIZARD_URL', 'index.php?module=UpgradeWizard&action=index');
|
||||
$ss->assign('UPGARDE_WIZARD_URL', 'index.php?module=UpgradeWizard&action=index');
|
||||
$ss->assign('module_load', 'true');
|
||||
}
|
||||
if(!empty($GLOBALS['ML_STATUS_MESSAGE']))
|
||||
$ss->assign('ML_STATUS_MESSAGE',$GLOBALS['ML_STATUS_MESSAGE']);
|
||||
if (!empty($GLOBALS['ML_STATUS_MESSAGE'])) {
|
||||
$ss->assign('ML_STATUS_MESSAGE', $GLOBALS['ML_STATUS_MESSAGE']);
|
||||
}
|
||||
|
||||
//Bug 24064. Checking and Defining labels since these might not be cached during Upgrade
|
||||
if(!isset($mod_strings['LBL_ML_INSTALL']) || empty($mod_strings['LBL_ML_INSTALL'])){
|
||||
$mod_strings['LBL_ML_INSTALL'] = 'Install';
|
||||
}
|
||||
if(!isset($mod_strings['LBL_ML_ENABLE_OR_DISABLE']) || empty($mod_strings['LBL_ML_ENABLE_OR_DISABLE'])) {
|
||||
$mod_strings['LBL_ML_ENABLE_OR_DISABLE'] = 'Enable/Disable';
|
||||
}
|
||||
if(!isset($mod_strings['LBL_ML_DELETE'])|| empty($mod_strings['LBL_ML_DELETE'])){
|
||||
$mod_strings['LBL_ML_DELETE'] = 'Delete';
|
||||
}
|
||||
if (!isset($mod_strings['LBL_ML_INSTALL']) || empty($mod_strings['LBL_ML_INSTALL'])) {
|
||||
$mod_strings['LBL_ML_INSTALL'] = 'Install';
|
||||
}
|
||||
if (!isset($mod_strings['LBL_ML_ENABLE_OR_DISABLE']) || empty($mod_strings['LBL_ML_ENABLE_OR_DISABLE'])) {
|
||||
$mod_strings['LBL_ML_ENABLE_OR_DISABLE'] = 'Enable/Disable';
|
||||
}
|
||||
if (!isset($mod_strings['LBL_ML_DELETE'])|| empty($mod_strings['LBL_ML_DELETE'])) {
|
||||
$mod_strings['LBL_ML_DELETE'] = 'Delete';
|
||||
}
|
||||
//Add by jchi 6/23/2008 to fix the bug 21667
|
||||
$filegrid_column_ary = array(
|
||||
'Name' => $mod_strings['LBL_ML_NAME'],
|
||||
'Install' => $mod_strings['LBL_ML_INSTALL'],
|
||||
'Delete' => $mod_strings['LBL_ML_DELETE'],
|
||||
'Type' => $mod_strings['LBL_ML_TYPE'],
|
||||
'Version' => $mod_strings['LBL_ML_VERSION'],
|
||||
'Published' => $mod_strings['LBL_ML_PUBLISHED'],
|
||||
'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'],
|
||||
'Description' => $mod_strings['LBL_ML_DESCRIPTION']
|
||||
);
|
||||
$filegrid_column_ary = array(
|
||||
'Name' => $mod_strings['LBL_ML_NAME'],
|
||||
'Install' => $mod_strings['LBL_ML_INSTALL'],
|
||||
'Delete' => $mod_strings['LBL_ML_DELETE'],
|
||||
'Type' => $mod_strings['LBL_ML_TYPE'],
|
||||
'Version' => $mod_strings['LBL_ML_VERSION'],
|
||||
'Published' => $mod_strings['LBL_ML_PUBLISHED'],
|
||||
'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'],
|
||||
'Description' => $mod_strings['LBL_ML_DESCRIPTION']
|
||||
);
|
||||
|
||||
$filegridinstalled_column_ary = array(
|
||||
'Name' => $mod_strings['LBL_ML_NAME'],
|
||||
'Install' => $mod_strings['LBL_ML_INSTALL'],
|
||||
'Action' => $mod_strings['LBL_ML_ACTION'],
|
||||
'Enable_Or_Disable' => $mod_strings['LBL_ML_ENABLE_OR_DISABLE'],
|
||||
'Type' => $mod_strings['LBL_ML_TYPE'],
|
||||
'Version' => $mod_strings['LBL_ML_VERSION'],
|
||||
'Date_Installed' => $mod_strings['LBL_ML_INSTALLED'],
|
||||
'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'],
|
||||
'Description' => $mod_strings['LBL_ML_DESCRIPTION']
|
||||
);
|
||||
$filegridinstalled_column_ary = array(
|
||||
'Name' => $mod_strings['LBL_ML_NAME'],
|
||||
'Install' => $mod_strings['LBL_ML_INSTALL'],
|
||||
'Action' => $mod_strings['LBL_ML_ACTION'],
|
||||
'Enable_Or_Disable' => $mod_strings['LBL_ML_ENABLE_OR_DISABLE'],
|
||||
'Type' => $mod_strings['LBL_ML_TYPE'],
|
||||
'Version' => $mod_strings['LBL_ML_VERSION'],
|
||||
'Date_Installed' => $mod_strings['LBL_ML_INSTALLED'],
|
||||
'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'],
|
||||
'Description' => $mod_strings['LBL_ML_DESCRIPTION']
|
||||
);
|
||||
|
||||
$ss->assign('ML_FILEGRID_COLUMN',$filegrid_column_ary);
|
||||
$ss->assign('ML_FILEGRIDINSTALLED_COLUMN',$filegridinstalled_column_ary);
|
||||
//end
|
||||
$ss->assign('ML_FILEGRID_COLUMN', $filegrid_column_ary);
|
||||
$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'));
|
||||
$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;
|
||||
}
|
||||
|
||||
function createJavascriptPackageArray($releases){
|
||||
public function createJavascriptPackageArray($releases)
|
||||
{
|
||||
$output = "var mti_data = [";
|
||||
$count = count($releases);
|
||||
$index = 1;
|
||||
if(!empty($releases['packages'])){
|
||||
foreach($releases['packages'] as $release){
|
||||
$release = PackageManager::fromNameValueList($release);
|
||||
$output .= "[";
|
||||
$output .= "'".$release['description']."', '".$release['version']."', '".$release['build_number']."', '".$release['id']."'";
|
||||
$output .= "]";
|
||||
if($index < $count)
|
||||
$output .= ",";
|
||||
$index++;
|
||||
}
|
||||
if (!empty($releases['packages'])) {
|
||||
foreach ($releases['packages'] as $release) {
|
||||
$release = PackageManager::fromNameValueList($release);
|
||||
$output .= "[";
|
||||
$output .= "'".$release['description']."', '".$release['version']."', '".$release['build_number']."', '".$release['id']."'";
|
||||
$output .= "]";
|
||||
if ($index < $count) {
|
||||
$output .= ",";
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
$output .= "]\n;";
|
||||
return $output;
|
||||
}
|
||||
|
||||
static function createJavascriptModuleArray($modules, $variable_name = 'mti_data'){
|
||||
public static function createJavascriptModuleArray($modules, $variable_name = 'mti_data')
|
||||
{
|
||||
$output = "var ".$variable_name." = [";
|
||||
$count = count($modules);
|
||||
$index = 1;
|
||||
if(!empty($modules)){
|
||||
foreach($modules as $module){
|
||||
$output .= "[";
|
||||
$output .= "'".$module['name']."', '".$module['file_install']."', '".$module['file']."', '";
|
||||
if(!empty($module['enabled']))
|
||||
$output .= $module['enabled'].'_'.$module['file']."', '";
|
||||
|
||||
$description = js_escape($module['description']);
|
||||
$output .= $module['type']."', '".$module['version']."', '".$module['published_date']."', '".$module['uninstallable']."', '".$description."'".(isset($module['upload_file'])?" , '".$module['upload_file']."']":"]");
|
||||
if($index < $count)
|
||||
$output .= ",";
|
||||
$index++;
|
||||
}
|
||||
if (!empty($modules)) {
|
||||
foreach ($modules as $module) {
|
||||
$output .= "[";
|
||||
$output .= "'".$module['name']."', '".$module['file_install']."', '".$module['file']."', '";
|
||||
if (!empty($module['enabled'])) {
|
||||
$output .= $module['enabled'].'_'.$module['file']."', '";
|
||||
}
|
||||
|
||||
$description = js_escape($module['description']);
|
||||
$output .= $module['type']."', '".$module['version']."', '".$module['published_date']."', '".$module['uninstallable']."', '".$description."'".(isset($module['upload_file'])?" , '".$module['upload_file']."']":"]");
|
||||
if ($index < $count) {
|
||||
$output .= ",";
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
$output .= "]\n;";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is meant to be used to display the license agreement inline on the page
|
||||
* if the system would like to perform the installation on the same page via an Ajax call
|
||||
*/
|
||||
function buildLicenseOutput($file){
|
||||
global $current_language;
|
||||
/**
|
||||
* This method is meant to be used to display the license agreement inline on the page
|
||||
* if the system would like to perform the installation on the same page via an Ajax call
|
||||
*/
|
||||
public function buildLicenseOutput($file)
|
||||
{
|
||||
global $current_language;
|
||||
|
||||
$mod_strings = return_module_language($current_language, "Administration");
|
||||
$contents = '';
|
||||
|
@ -518,103 +536,94 @@ class PackageManagerDisplay{
|
|||
return $str;
|
||||
}
|
||||
|
||||
static function getHeader(){
|
||||
global $current_language;
|
||||
public static function getHeader()
|
||||
{
|
||||
global $current_language;
|
||||
|
||||
$mod_strings = return_module_language($current_language, "Administration");
|
||||
$header_text = '';
|
||||
$isAlive = false;
|
||||
$show_login = false;
|
||||
if(!function_exists('curl_init') && $show_login){
|
||||
$header_text = "<font color='red'><b>".$mod_strings['ERR_ENABLE_CURL']."</b></font>";
|
||||
$show_login = false;
|
||||
}else{
|
||||
if (!function_exists('curl_init') && $show_login) {
|
||||
$header_text = "<font color='red'><b>".$mod_strings['ERR_ENABLE_CURL']."</b></font>";
|
||||
$show_login = false;
|
||||
} else {
|
||||
$credentials = PackageManager::getCredentials();
|
||||
if(empty($credentials['username']) || empty($credentials['password'])){
|
||||
//$header_text = "<font color='red'><b>".$mod_strings['ERR_CREDENTIALS_MISSING']."</b></font>";
|
||||
}
|
||||
else{
|
||||
$result = PackageManagerComm::login();
|
||||
if((is_array($result) && !empty($result['faultcode'])) || $result == false){
|
||||
$header_text = "<font color='red'><b>".$result['faultstring']."</b></font>";
|
||||
}else{
|
||||
$header_text = PackageManager::getPromotion();
|
||||
$isAlive = true;
|
||||
}
|
||||
if (empty($credentials['username']) || empty($credentials['password'])) {
|
||||
//$header_text = "<font color='red'><b>".$mod_strings['ERR_CREDENTIALS_MISSING']."</b></font>";
|
||||
} else {
|
||||
$result = PackageManagerComm::login();
|
||||
if ((is_array($result) && !empty($result['faultcode'])) || $result == false) {
|
||||
$header_text = "<font color='red'><b>".$result['faultstring']."</b></font>";
|
||||
} else {
|
||||
$header_text = PackageManager::getPromotion();
|
||||
$isAlive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return array('text' => $header_text, 'isAlive' => $isAlive, 'show_login' => $show_login);
|
||||
}
|
||||
|
||||
function buildInstallGrid($view){
|
||||
$uh = new UpgradeHistory();
|
||||
$installeds = $uh->getAll();
|
||||
$upgrades_installed = 0;
|
||||
$installed_objects = array();
|
||||
foreach($installeds as $installed)
|
||||
{
|
||||
$filename = from_html($installed->filename);
|
||||
$date_entered = $installed->date_entered;
|
||||
$type = $installed->type;
|
||||
$version = $installed->version;
|
||||
$upgrades_installed++;
|
||||
$link = "";
|
||||
public function buildInstallGrid($view)
|
||||
{
|
||||
$uh = new UpgradeHistory();
|
||||
$installeds = $uh->getAll();
|
||||
$upgrades_installed = 0;
|
||||
$installed_objects = array();
|
||||
foreach ($installeds as $installed) {
|
||||
$filename = from_html($installed->filename);
|
||||
$date_entered = $installed->date_entered;
|
||||
$type = $installed->type;
|
||||
$version = $installed->version;
|
||||
$upgrades_installed++;
|
||||
$link = "";
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case "theme":
|
||||
case "langpack":
|
||||
case "module":
|
||||
case "patch":
|
||||
$manifest_file = extractManifest($filename);
|
||||
require_once($manifest_file);
|
||||
switch ($type) {
|
||||
case "theme":
|
||||
case "langpack":
|
||||
case "module":
|
||||
case "patch":
|
||||
$manifest_file = extractManifest($filename);
|
||||
require_once($manifest_file);
|
||||
|
||||
$name = empty($manifest['name']) ? $filename : $manifest['name'];
|
||||
$description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
|
||||
if(($upgrades_installed==0 || $uh->UninstallAvailable($installeds, $installed))
|
||||
&& is_file($filename) && !empty($manifest['is_uninstallable']))
|
||||
{
|
||||
$link = urlencode( $filename );
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = 'false';
|
||||
}
|
||||
$name = empty($manifest['name']) ? $filename : $manifest['name'];
|
||||
$description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
|
||||
if (($upgrades_installed==0 || $uh->UninstallAvailable($installeds, $installed))
|
||||
&& is_file($filename) && !empty($manifest['is_uninstallable'])) {
|
||||
$link = urlencode($filename);
|
||||
} else {
|
||||
$link = 'false';
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if($view == 'default' && $type != 'patch')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ($view == 'default' && $type != 'patch') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($view == 'module'
|
||||
&& $type != 'module' && $type != 'theme' && $type != 'langpack')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ($view == 'module'
|
||||
&& $type != 'module' && $type != 'theme' && $type != 'langpack') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$target_manifest = remove_file_extension( $filename ) . "-manifest.php";
|
||||
require_once( "$target_manifest" );
|
||||
$target_manifest = remove_file_extension($filename) . "-manifest.php";
|
||||
require_once("$target_manifest");
|
||||
|
||||
if(isset($manifest['icon']) && $manifest['icon'] != "")
|
||||
{
|
||||
$manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
|
||||
$manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
|
||||
$manifest_icon = clean_path($manifest['icon']);
|
||||
$icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir)+1) : $manifest_icon ) . "\">";
|
||||
}
|
||||
else
|
||||
{
|
||||
$icon = getImageForType( $manifest['type'] );
|
||||
}
|
||||
$installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link);
|
||||
//print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" );
|
||||
//print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" );
|
||||
//print( "</form>\n" );
|
||||
}
|
||||
if (isset($manifest['icon']) && $manifest['icon'] != "") {
|
||||
$manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
|
||||
$manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
|
||||
$manifest_icon = clean_path($manifest['icon']);
|
||||
$icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir)+1) : $manifest_icon) . "\">";
|
||||
} else {
|
||||
$icon = getImageForType($manifest['type']);
|
||||
}
|
||||
$installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link);
|
||||
//print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" );
|
||||
//print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" );
|
||||
//print( "</form>\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,35 +39,37 @@
|
|||
|
||||
define('PACKAGE_MANAGER_DOWNLOAD_SERVER', 'https://depot.sugarcrm.com/depot/');
|
||||
define('PACKAGE_MANAGER_DOWNLOAD_PAGE', 'download.php');
|
||||
class PackageManagerDownloader{
|
||||
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 = "upload://";
|
||||
}
|
||||
if(empty($download_server)){
|
||||
$download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER;
|
||||
}
|
||||
$download_server .= PACKAGE_MANAGER_DOWNLOAD_PAGE;
|
||||
$ch = curl_init($download_server . '?filename='. $file_name);
|
||||
$fp = sugar_fopen($save_dir . $file_name, 'w');
|
||||
curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$session_id. ';');
|
||||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
fclose($fp);
|
||||
return $save_dir . $file_name;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public function download($session_id, $file_name, $save_dir = '', $download_server = '')
|
||||
{
|
||||
if (empty($save_dir)) {
|
||||
$save_dir = "upload://";
|
||||
}
|
||||
if (empty($download_server)) {
|
||||
$download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER;
|
||||
}
|
||||
$download_server .= PACKAGE_MANAGER_DOWNLOAD_PAGE;
|
||||
$ch = curl_init($download_server . '?filename='. $file_name);
|
||||
$fp = sugar_fopen($save_dir . $file_name, 'w');
|
||||
curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$session_id. ';');
|
||||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
fclose($fp);
|
||||
return $save_dir . $file_name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,14 +39,14 @@
|
|||
|
||||
$listViewDefs['module_loader']['packages'] = array(
|
||||
'name' => array(
|
||||
'width' => '5',
|
||||
'label' => 'LBL_LIST_NAME',
|
||||
'width' => '5',
|
||||
'label' => 'LBL_LIST_NAME',
|
||||
'link' => false,
|
||||
'default' => true,
|
||||
'show' => true),
|
||||
'show' => true),
|
||||
'description' => array(
|
||||
'width' => '32',
|
||||
'label' => 'LBL_ML_DESCRIPTION',
|
||||
'width' => '32',
|
||||
'label' => 'LBL_ML_DESCRIPTION',
|
||||
'default' => true,
|
||||
'link' => false,
|
||||
'show' => true),
|
||||
|
@ -54,13 +54,13 @@
|
|||
|
||||
$listViewDefs['module_loader']['releases'] = array(
|
||||
'description' => array(
|
||||
'width' => '32',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'width' => '32',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'default' => true,
|
||||
'link' => false),
|
||||
'version' => array(
|
||||
'width' => '32',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'width' => '32',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'default' => true,
|
||||
'link' => false),
|
||||
);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
if (!defined('sugarEntry') || !sugarEntry) {
|
||||
die('Not A Valid Entry Point');
|
||||
}
|
||||
/*********************************************************************************
|
||||
* SugarCRM Community Edition is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
|
||||
|
@ -44,25 +46,23 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
|||
"actionviewmap" => array("section" => "action_view_map","extdir" => "ActionViewMap", "file" => 'action_view_map.ext.php'),
|
||||
"actionfilemap" => array("section" => "action_file_map","extdir" => "ActionFileMap", "file" => 'action_file_map.ext.php'),
|
||||
"actionremap" => array("section" => "action_remap", "extdir" => "ActionReMap", "file" => 'action_remap.ext.php'),
|
||||
"administration" => array("section" => "administration", "extdir" => "Administration", "file" => 'administration.ext.php', "module" => "Administration"),
|
||||
"entrypoints" => array("section" => "entrypoints", "extdir" => "EntryPointRegistry", "file" => 'entry_point_registry.ext.php', "module" => "application"),
|
||||
"exts" => array("section" => "extensions", "extdir" => "Extensions", "file" => 'extensions.ext.php', "module" => "application"),
|
||||
"file_access" => array("section" => "file_access", "extdir" => "FileAccessControlMap", "file" => 'file_access_control_map.ext.php'),
|
||||
"languages" => array("section" => "language", "extdir" => "Language", "file" => '' /* custom rebuild */),
|
||||
"layoutdefs" => array("section" => "layoutdefs", "extdir" => "Layoutdefs", "file" => 'layoutdefs.ext.php'),
|
||||
"administration" => array("section" => "administration", "extdir" => "Administration", "file" => 'administration.ext.php', "module" => "Administration"),
|
||||
"entrypoints" => array("section" => "entrypoints", "extdir" => "EntryPointRegistry", "file" => 'entry_point_registry.ext.php', "module" => "application"),
|
||||
"exts" => array("section" => "extensions", "extdir" => "Extensions", "file" => 'extensions.ext.php', "module" => "application"),
|
||||
"file_access" => array("section" => "file_access", "extdir" => "FileAccessControlMap", "file" => 'file_access_control_map.ext.php'),
|
||||
"languages" => array("section" => "language", "extdir" => "Language", "file" => '' /* custom rebuild */),
|
||||
"layoutdefs" => array("section" => "layoutdefs", "extdir" => "Layoutdefs", "file" => 'layoutdefs.ext.php'),
|
||||
"links" => array("section" => "linkdefs", "extdir" => "GlobalLinks", "file" => 'links.ext.php', "module" => "application"),
|
||||
"logichooks" => array("section" => "hookdefs", "extdir" => "LogicHooks", "file" => 'logichooks.ext.php'),
|
||||
"logichooks" => array("section" => "hookdefs", "extdir" => "LogicHooks", "file" => 'logichooks.ext.php'),
|
||||
"menus" => array("section" => "menu", "extdir" => "Menus", "file" => "menu.ext.php"),
|
||||
"modules" => array("section" => "beans", "extdir" => "Include", "file" => 'modules.ext.php', "module" => "application"),
|
||||
"schedulers" => array("section" => "scheduledefs", "extdir" => "ScheduledTasks", "file" => 'scheduledtasks.ext.php', "module" => "Schedulers"),
|
||||
"userpage" => array("section" => "user_page", "extdir" => "UserPage", "file" => 'userpage.ext.php', "module" => "Users"),
|
||||
"utils" => array("section" => "utils", "extdir" => "Utils", "file" => 'custom_utils.ext.php', "module" => "application"),
|
||||
"vardefs" => array("section" => "vardefs", "extdir" => "Vardefs", "file" => 'vardefs.ext.php'),
|
||||
"jsgroupings" => array("section" => "jsgroups", "extdir" => "JSGroupings", "file" => 'jsgroups.ext.php'),
|
||||
"aow" => array("section" => "aow_actions", "extdir" => "Actions", "file" => 'actions.ext.php', "module" => "AOW_Actions"),
|
||||
"vardefs" => array("section" => "vardefs", "extdir" => "Vardefs", "file" => 'vardefs.ext.php'),
|
||||
"jsgroupings" => array("section" => "jsgroups", "extdir" => "JSGroupings", "file" => 'jsgroups.ext.php'),
|
||||
"aow" => array("section" => "aow_actions", "extdir" => "Actions", "file" => 'actions.ext.php', "module" => "AOW_Actions"),
|
||||
);
|
||||
if(file_exists("custom/application/Ext/Extensions/extensions.ext.php")) {
|
||||
if (file_exists("custom/application/Ext/Extensions/extensions.ext.php")) {
|
||||
include("custom/application/Ext/Extensions/extensions.ext.php");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
## SuiteCRM 7.10.7
|
||||
|
||||
[](https://travis-ci.org/salesagility/SuiteCRM)
|
||||
[](https://travis-ci.org/salesagility/SuiteCRM)
|
||||
[](https://codecov.io/gh/salesagility/SuiteCRM/branch/hotfix)
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ The following links offer various ways to view, contribute and collaborate to th
|
|||
|
||||
[ View the Community Roadmap here and get involved][suitecrm_roadmap]
|
||||
|
||||
[suitecrm_roadmap]: https://suitecrm.com/community/roadmap
|
||||
[suitecrm_roadmap]: https://suitecrm.com/roadmap
|
||||
|
||||
[More detailed SuiteCRM Community LTS Roadmap][suitecrm_detailed_roadmap]
|
||||
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
class RoboFile extends \Robo\Tasks
|
||||
{
|
||||
// define public methods as commands
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?PHP
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM Community Edition is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
|
||||
|
@ -41,130 +41,134 @@
|
|||
|
||||
|
||||
|
||||
class SugarSecure{
|
||||
var $results = array();
|
||||
function display(){
|
||||
echo '<table>';
|
||||
foreach($this->results as $result){
|
||||
echo '<tr><td>' . nl2br($result) . '</td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
function save($file=''){
|
||||
$fp = fopen($file, 'a');
|
||||
foreach($this->results as $result){
|
||||
fwrite($fp , $result);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
function scan($path= '.', $ext = '.php'){
|
||||
$dir = dir($path);
|
||||
while($entry = $dir->read()){
|
||||
if(is_dir($path . '/' . $entry) && $entry != '.' && $entry != '..'){
|
||||
$this->scan($path .'/' . $entry);
|
||||
}
|
||||
if(is_file($path . '/'. $entry) && substr($entry, strlen($entry) - strlen($ext), strlen($ext)) == $ext){
|
||||
$contents = file_get_contents($path .'/'. $entry);
|
||||
$this->scanContents($contents, $path .'/'. $entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function scanContents($contents){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
class SugarSecure
|
||||
{
|
||||
public $results = array();
|
||||
public function display()
|
||||
{
|
||||
echo '<table>';
|
||||
foreach ($this->results as $result) {
|
||||
echo '<tr><td>' . nl2br($result) . '</td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
public function save($file='')
|
||||
{
|
||||
$fp = fopen($file, 'a');
|
||||
foreach ($this->results as $result) {
|
||||
fwrite($fp, $result);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
public function scan($path= '.', $ext = '.php')
|
||||
{
|
||||
$dir = dir($path);
|
||||
while ($entry = $dir->read()) {
|
||||
if (is_dir($path . '/' . $entry) && $entry != '.' && $entry != '..') {
|
||||
$this->scan($path .'/' . $entry);
|
||||
}
|
||||
if (is_file($path . '/'. $entry) && substr($entry, strlen($entry) - strlen($ext), strlen($ext)) == $ext) {
|
||||
$contents = file_get_contents($path .'/'. $entry);
|
||||
$this->scanContents($contents, $path .'/'. $entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function scanContents($contents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
class ScanFileIncludes extends SugarSecure{
|
||||
function scanContents($contents, $file){
|
||||
$results = array();
|
||||
$found = '';
|
||||
/*preg_match_all("'(require_once\([^\)]*\\$[^\)]*\))'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'include_once\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
*/
|
||||
$results = array();
|
||||
preg_match_all("'require\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'include\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'require_once\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'fopen\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'file_get_contents\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
if(!empty($found)){
|
||||
$this->results[] = $file . $found."\n\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ScanFileIncludes extends SugarSecure
|
||||
{
|
||||
public function scanContents($contents, $file)
|
||||
{
|
||||
$results = array();
|
||||
$found = '';
|
||||
/*preg_match_all("'(require_once\([^\)]*\\$[^\)]*\))'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'include_once\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach($results as $result){
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
*/
|
||||
$results = array();
|
||||
preg_match_all("'require\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach ($results as $result) {
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'include\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach ($results as $result) {
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'require_once\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach ($results as $result) {
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'fopen\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach ($results as $result) {
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
$results = array();
|
||||
preg_match_all("'file_get_contents\([^\)]*\\$[^\)]*\)'si", $contents, $results, PREG_SET_ORDER);
|
||||
foreach ($results as $result) {
|
||||
$found .= "\n" . $result[0];
|
||||
}
|
||||
if (!empty($found)) {
|
||||
$this->results[] = $file . $found."\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class SugarSecureManager{
|
||||
var $scanners = array();
|
||||
function registerScan($class){
|
||||
$this->scanners[] = new $class();
|
||||
}
|
||||
|
||||
function scan(){
|
||||
|
||||
while($scanner = current($this->scanners)){
|
||||
$scanner->scan();
|
||||
$scanner = next($this->scanners);
|
||||
}
|
||||
reset($this->scanners);
|
||||
}
|
||||
|
||||
function display(){
|
||||
|
||||
while($scanner = current($this->scanners)){
|
||||
echo 'Scan Results: ';
|
||||
$scanner->display();
|
||||
$scanner = next($this->scanners);
|
||||
}
|
||||
reset($this->scanners);
|
||||
}
|
||||
|
||||
function save(){
|
||||
//reset($this->scanners);
|
||||
$name = 'SugarSecure'. time() . '.txt';
|
||||
while($this->scanners = next($this->scanners)){
|
||||
$scanner->save($name);
|
||||
}
|
||||
}
|
||||
|
||||
class SugarSecureManager
|
||||
{
|
||||
public $scanners = array();
|
||||
public function registerScan($class)
|
||||
{
|
||||
$this->scanners[] = new $class();
|
||||
}
|
||||
|
||||
public function scan()
|
||||
{
|
||||
while ($scanner = current($this->scanners)) {
|
||||
$scanner->scan();
|
||||
$scanner = next($this->scanners);
|
||||
}
|
||||
reset($this->scanners);
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
while ($scanner = current($this->scanners)) {
|
||||
echo 'Scan Results: ';
|
||||
$scanner->display();
|
||||
$scanner = next($this->scanners);
|
||||
}
|
||||
reset($this->scanners);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
//reset($this->scanners);
|
||||
$name = 'SugarSecure'. time() . '.txt';
|
||||
while ($this->scanners = next($this->scanners)) {
|
||||
$scanner->save($name);
|
||||
}
|
||||
}
|
||||
}
|
||||
$secure = new SugarSecureManager();
|
||||
$secure->registerScan('ScanFileIncludes');
|
||||
$secure->scan();
|
||||
$secure->display();
|
||||
$secure->display();
|
||||
|
|
76
TreeData.php
76
TreeData.php
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
if (!defined('sugarEntry') || !sugarEntry) {
|
||||
die('Not A Valid Entry Point');
|
||||
}
|
||||
/*********************************************************************************
|
||||
* SugarCRM Community Edition is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
|
||||
|
@ -57,41 +59,41 @@ $current_language = $GLOBALS['current_language'];
|
|||
//module name and function name parameters are the only ones consumed
|
||||
//by this file..
|
||||
foreach ($_REQUEST as $key=>$value) {
|
||||
|
||||
switch ($key) {
|
||||
|
||||
case "function":
|
||||
case "call_back_function":
|
||||
$func_name=$value;
|
||||
$params1['TREE']['function']=$value;
|
||||
break;
|
||||
|
||||
default:
|
||||
$pssplit=explode('_',$key);
|
||||
if ($pssplit[0] =='PARAMT') {
|
||||
unset($pssplit[0]);
|
||||
$params1['TREE'][implode('_',$pssplit)]=$value;
|
||||
} else {
|
||||
if ($pssplit[0] =='PARAMN') {
|
||||
$depth=$pssplit[count($pssplit)-1];
|
||||
//parmeter is surrounded by PARAMN_ and depth info.
|
||||
unset($pssplit[count($pssplit)-1]);unset($pssplit[0]);
|
||||
$params1['NODES'][$depth][implode('_',$pssplit)]=$value;
|
||||
} else {
|
||||
if ($key=='module') {
|
||||
if (!isset($params1['TREE']['module'])) {
|
||||
$params1['TREE'][$key]=$value;
|
||||
}
|
||||
} else {
|
||||
$params1['REQUEST'][$key]=$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
switch ($key) {
|
||||
|
||||
case "function":
|
||||
case "call_back_function":
|
||||
$func_name=$value;
|
||||
$params1['TREE']['function']=$value;
|
||||
break;
|
||||
|
||||
default:
|
||||
$pssplit=explode('_', $key);
|
||||
if ($pssplit[0] =='PARAMT') {
|
||||
unset($pssplit[0]);
|
||||
$params1['TREE'][implode('_', $pssplit)]=$value;
|
||||
} else {
|
||||
if ($pssplit[0] =='PARAMN') {
|
||||
$depth=$pssplit[count($pssplit)-1];
|
||||
//parmeter is surrounded by PARAMN_ and depth info.
|
||||
unset($pssplit[count($pssplit)-1]);
|
||||
unset($pssplit[0]);
|
||||
$params1['NODES'][$depth][implode('_', $pssplit)]=$value;
|
||||
} else {
|
||||
if ($key=='module') {
|
||||
if (!isset($params1['TREE']['module'])) {
|
||||
$params1['TREE'][$key]=$value;
|
||||
}
|
||||
} else {
|
||||
$params1['REQUEST'][$key]=$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$modulename=$params1['TREE']['module']; ///module is a required parameter for the tree.
|
||||
require('include/modules.php');
|
||||
if (!empty($modulename) && !empty($func_name) && isset($beanList[$modulename]) ) {
|
||||
if (!empty($modulename) && !empty($func_name) && isset($beanList[$modulename])) {
|
||||
require_once('modules/'.$modulename.'/TreeData.php');
|
||||
$TreeDataFunctions = array(
|
||||
'ProductTemplates' => array('get_node_data'=>'','get_categories_and_products'=>''),
|
||||
|
@ -137,11 +139,11 @@ if (!empty($modulename) && !empty($func_name) && isset($beanList[$modulename]) )
|
|||
),
|
||||
);
|
||||
|
||||
if (isset($TreeDataFunctions[$modulename][$func_name])) {
|
||||
$ret=call_user_func($func_name,$params1);
|
||||
if (isset($TreeDataFunctions[$modulename][$func_name])) {
|
||||
$ret=call_user_func($func_name, $params1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($ret)) {
|
||||
echo $ret;
|
||||
echo $ret;
|
||||
}
|
||||
|
|
|
@ -53,9 +53,9 @@ class Zend_Exception extends Exception
|
|||
* Overloading
|
||||
*
|
||||
* For PHP < 5.3.0, provides access to the getPrevious() method.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, array $args)
|
||||
|
@ -75,8 +75,8 @@ class Zend_Exception extends Exception
|
|||
{
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||
if (null !== ($e = $this->getPrevious())) {
|
||||
return $e->__toString()
|
||||
. "\n\nNext "
|
||||
return $e->__toString()
|
||||
. "\n\nNext "
|
||||
. parent::__toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,9 +120,11 @@ class Zend_Gdata extends Zend_Gdata_App
|
|||
* by passing false to the
|
||||
* useObjectMapping() function.
|
||||
*/
|
||||
public static function import($uri, $client = null,
|
||||
$className='Zend_Gdata_Feed')
|
||||
{
|
||||
public static function import(
|
||||
$uri,
|
||||
$client = null,
|
||||
$className='Zend_Gdata_Feed'
|
||||
) {
|
||||
$app = new Zend_Gdata($client);
|
||||
$requestData = $app->decodeRequest('GET', $uri);
|
||||
$response = $app->performHttpRequest($requestData['method'], $requestData['url']);
|
||||
|
@ -157,7 +159,8 @@ class Zend_Gdata extends Zend_Gdata_App
|
|||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the location as either a string URI ' .
|
||||
'or a child of Zend_Gdata_Query');
|
||||
'or a child of Zend_Gdata_Query'
|
||||
);
|
||||
}
|
||||
return parent::getFeed($uri, $className);
|
||||
}
|
||||
|
@ -182,7 +185,8 @@ class Zend_Gdata extends Zend_Gdata_App
|
|||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the location as either a string URI ' .
|
||||
'or a child of Zend_Gdata_Query');
|
||||
'or a child of Zend_Gdata_Query'
|
||||
);
|
||||
}
|
||||
return parent::getEntry($uri, $className);
|
||||
}
|
||||
|
@ -232,10 +236,9 @@ class Zend_Gdata extends Zend_Gdata_App
|
|||
$client = parent::getHttpClient();
|
||||
if ($client->getClientLoginToken() ||
|
||||
$client->getAuthSubToken()) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -237,21 +237,24 @@ class Zend_Gdata_App
|
|||
* @throws Zend_Gdata_App_HttpException
|
||||
* @return Zend_Gdata_App Provides a fluent interface
|
||||
*/
|
||||
public function setHttpClient($client,
|
||||
$applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
public function setHttpClient(
|
||||
$client,
|
||||
$applicationId = 'MyCompany-MyApp-1.0'
|
||||
) {
|
||||
if ($client === null) {
|
||||
$client = new Zend_Http_Client();
|
||||
}
|
||||
if (!$client instanceof Zend_Http_Client) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException(
|
||||
'Argument is not an instance of Zend_Http_Client.');
|
||||
'Argument is not an instance of Zend_Http_Client.'
|
||||
);
|
||||
}
|
||||
$userAgent = $applicationId . ' Zend_Framework_Gdata/' .
|
||||
Zend_Version::VERSION;
|
||||
$client->setHeaders('User-Agent', $userAgent);
|
||||
$client->setConfig(array(
|
||||
$client->setConfig(
|
||||
array(
|
||||
'strictredirects' => true
|
||||
)
|
||||
);
|
||||
|
@ -285,7 +288,8 @@ class Zend_Gdata_App
|
|||
$client = new Zend_Http_Client();
|
||||
$userAgent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setHeaders('User-Agent', $userAgent);
|
||||
$client->setConfig(array(
|
||||
$client->setConfig(
|
||||
array(
|
||||
'strictredirects' => true
|
||||
)
|
||||
);
|
||||
|
@ -334,8 +338,8 @@ class Zend_Gdata_App
|
|||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You cannot enable gzipped responses if the zlib module ' .
|
||||
'is not enabled in your PHP installation.');
|
||||
|
||||
'is not enabled in your PHP installation.'
|
||||
);
|
||||
}
|
||||
self::$_gzipEnabled = $enabled;
|
||||
}
|
||||
|
@ -410,7 +414,8 @@ class Zend_Gdata_App
|
|||
if (!($value >= 1)) {
|
||||
require_once('Zend/Gdata/App/InvalidArgumentException.php');
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Major protocol version must be >= 1');
|
||||
'Major protocol version must be >= 1'
|
||||
);
|
||||
}
|
||||
$this->_majorProtocolVersion = $value;
|
||||
}
|
||||
|
@ -440,7 +445,8 @@ class Zend_Gdata_App
|
|||
if (!($value >= 0)) {
|
||||
require_once('Zend/Gdata/App/InvalidArgumentException.php');
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Minor protocol version must be >= 0');
|
||||
'Minor protocol version must be >= 0'
|
||||
);
|
||||
}
|
||||
$this->_minorProtocolVersion = $value;
|
||||
}
|
||||
|
@ -480,12 +486,13 @@ class Zend_Gdata_App
|
|||
* @return array An associative array containing the determined
|
||||
* 'method', 'url', 'data', 'headers', 'contentType'
|
||||
*/
|
||||
public function prepareRequest($method,
|
||||
public function prepareRequest(
|
||||
$method,
|
||||
$url = null,
|
||||
$headers = array(),
|
||||
$data = null,
|
||||
$contentTypeOverride = null)
|
||||
{
|
||||
$contentTypeOverride = null
|
||||
) {
|
||||
// As a convenience, if $headers is null, we'll convert it back to
|
||||
// an empty array.
|
||||
if ($headers === null) {
|
||||
|
@ -547,10 +554,12 @@ class Zend_Gdata_App
|
|||
if ($method != 'DELETE' && (
|
||||
!array_key_exists('If-Match', $headers) &&
|
||||
!array_key_exists('If-None-Match', $headers)
|
||||
) ) {
|
||||
)) {
|
||||
$allowWeak = $method == 'GET';
|
||||
if ($ifMatchHeader = $this->generateIfMatchHeaderData(
|
||||
$data, $allowWeak)) {
|
||||
$data,
|
||||
$allowWeak
|
||||
)) {
|
||||
$headers['If-Match'] = $ifMatchHeader;
|
||||
}
|
||||
}
|
||||
|
@ -586,9 +595,14 @@ class Zend_Gdata_App
|
|||
* s results in one
|
||||
* @return Zend_Http_Response The response object
|
||||
*/
|
||||
public function performHttpRequest($method, $url, $headers = null,
|
||||
$body = null, $contentType = null, $remainingRedirects = null)
|
||||
{
|
||||
public function performHttpRequest(
|
||||
$method,
|
||||
$url,
|
||||
$headers = null,
|
||||
$body = null,
|
||||
$contentType = null,
|
||||
$remainingRedirects = null
|
||||
) {
|
||||
require_once 'Zend/Http/Client/Exception.php';
|
||||
if ($remainingRedirects === null) {
|
||||
$remainingRedirects = self::getMaxRedirects();
|
||||
|
@ -608,22 +622,26 @@ class Zend_Gdata_App
|
|||
// check the overridden method
|
||||
if (($method == 'POST' || $method == 'PUT') && $body === null &&
|
||||
$headers['x-http-method-override'] != 'DELETE') {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the data to post as either a ' .
|
||||
'string or a child of Zend_Gdata_App_Entry');
|
||||
'string or a child of Zend_Gdata_App_Entry'
|
||||
);
|
||||
}
|
||||
if ($url === null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify an URI to which to post.');
|
||||
'You must specify an URI to which to post.'
|
||||
);
|
||||
}
|
||||
$headers['Content-Type'] = $contentType;
|
||||
if (Zend_Gdata_App::getGzipEnabled()) {
|
||||
// some services require the word 'gzip' to be in the user-agent
|
||||
// header in addition to the accept-encoding header
|
||||
if (strpos($this->_httpClient->getHeader('User-Agent'),
|
||||
'gzip') === false) {
|
||||
if (strpos(
|
||||
$this->_httpClient->getHeader('User-Agent'),
|
||||
'gzip'
|
||||
) === false) {
|
||||
$headers['User-Agent'] =
|
||||
$this->_httpClient->getHeader('User-Agent') . ' (gzip)';
|
||||
}
|
||||
|
@ -644,8 +662,8 @@ class Zend_Gdata_App
|
|||
preg_match("/^(.*?)(\?.*)?$/", $url, $matches);
|
||||
$this->_httpClient->setUri($matches[1]);
|
||||
$queryArray = $uri->getQueryAsArray();
|
||||
foreach ($queryArray as $name => $value) {
|
||||
$this->_httpClient->setParameterGet($name, $value);
|
||||
foreach ($queryArray as $name => $value) {
|
||||
$this->_httpClient->setParameterGet($name, $value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -690,12 +708,20 @@ class Zend_Gdata_App
|
|||
if ($remainingRedirects > 0) {
|
||||
$newUrl = $response->getHeader('Location');
|
||||
$response = $this->performHttpRequest(
|
||||
$method, $newUrl, $headers, $body,
|
||||
$contentType, $remainingRedirects);
|
||||
$method,
|
||||
$newUrl,
|
||||
$headers,
|
||||
$body,
|
||||
$contentType,
|
||||
$remainingRedirects
|
||||
);
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException(
|
||||
'Number of redirects exceeds maximum', null, $response);
|
||||
'Number of redirects exceeds maximum',
|
||||
null,
|
||||
$response
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!$response->isSuccessful()) {
|
||||
|
@ -724,13 +750,17 @@ class Zend_Gdata_App
|
|||
* by passing false to the
|
||||
* useObjectMapping() function.
|
||||
*/
|
||||
public static function import($uri, $client = null,
|
||||
$className='Zend_Gdata_App_Feed')
|
||||
{
|
||||
public static function import(
|
||||
$uri,
|
||||
$client = null,
|
||||
$className='Zend_Gdata_App_Feed'
|
||||
) {
|
||||
$app = new Zend_Gdata_App($client);
|
||||
$requestData = $app->prepareRequest('GET', $uri);
|
||||
$response = $app->performHttpRequest(
|
||||
$requestData['method'], $requestData['url']);
|
||||
$requestData['method'],
|
||||
$requestData['url']
|
||||
);
|
||||
|
||||
$feedContent = $response->getBody();
|
||||
if (!$this->_useObjectMapping) {
|
||||
|
@ -756,9 +786,11 @@ class Zend_Gdata_App
|
|||
* by passing false to the
|
||||
* useObjectMapping() function.
|
||||
*/
|
||||
public function importUrl($url, $className='Zend_Gdata_App_Feed',
|
||||
$extraHeaders = array())
|
||||
{
|
||||
public function importUrl(
|
||||
$url,
|
||||
$className='Zend_Gdata_App_Feed',
|
||||
$extraHeaders = array()
|
||||
) {
|
||||
$response = $this->get($url, $extraHeaders);
|
||||
|
||||
$feedContent = $response->getBody();
|
||||
|
@ -779,8 +811,12 @@ class Zend_Gdata_App
|
|||
$minorProtocolVersion = $minor;
|
||||
}
|
||||
|
||||
$feed = self::importString($feedContent, $className,
|
||||
$majorProtocolVersion, $minorProtocolVersion);
|
||||
$feed = self::importString(
|
||||
$feedContent,
|
||||
$className,
|
||||
$majorProtocolVersion,
|
||||
$minorProtocolVersion
|
||||
);
|
||||
if ($this->getHttpClient() != null) {
|
||||
$feed->setHttpClient($this->getHttpClient());
|
||||
}
|
||||
|
@ -804,13 +840,15 @@ class Zend_Gdata_App
|
|||
* @throws Zend_Gdata_App_Exception
|
||||
* @return Zend_Gdata_App_Feed
|
||||
*/
|
||||
public static function importString($string,
|
||||
$className='Zend_Gdata_App_Feed', $majorProtocolVersion = null,
|
||||
$minorProtocolVersion = null)
|
||||
{
|
||||
public static function importString(
|
||||
$string,
|
||||
$className='Zend_Gdata_App_Feed',
|
||||
$majorProtocolVersion = null,
|
||||
$minorProtocolVersion = null
|
||||
) {
|
||||
if (!class_exists($className, false)) {
|
||||
require_once 'Zend/Loader.php';
|
||||
@Zend_Loader::loadClass($className);
|
||||
require_once 'Zend/Loader.php';
|
||||
@Zend_Loader::loadClass($className);
|
||||
}
|
||||
|
||||
// Load the feed as an XML DOMDocument object
|
||||
|
@ -822,7 +860,8 @@ class Zend_Gdata_App
|
|||
if (!$success) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
"DOMDocument cannot parse XML: $php_errormsg");
|
||||
"DOMDocument cannot parse XML: $php_errormsg"
|
||||
);
|
||||
}
|
||||
|
||||
$feed = new $className();
|
||||
|
@ -843,16 +882,19 @@ class Zend_Gdata_App
|
|||
* @throws Zend_Gdata_App_Exception
|
||||
* @return Zend_Gdata_App_Feed
|
||||
*/
|
||||
public static function importFile($filename,
|
||||
$className='Zend_Gdata_App_Feed', $useIncludePath = false)
|
||||
{
|
||||
public static function importFile(
|
||||
$filename,
|
||||
$className='Zend_Gdata_App_Feed',
|
||||
$useIncludePath = false
|
||||
) {
|
||||
@ini_set('track_errors', 1);
|
||||
$feed = @file_get_contents($filename, $useIncludePath);
|
||||
@ini_restore('track_errors');
|
||||
if ($feed === false) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
"File could not be loaded: $php_errormsg");
|
||||
"File could not be loaded: $php_errormsg"
|
||||
);
|
||||
}
|
||||
return self::importString($feed, $className);
|
||||
}
|
||||
|
@ -870,8 +912,10 @@ class Zend_Gdata_App
|
|||
{
|
||||
$requestData = $this->prepareRequest('GET', $uri, $extraHeaders);
|
||||
return $this->performHttpRequest(
|
||||
$requestData['method'], $requestData['url'],
|
||||
$requestData['headers']);
|
||||
$requestData['method'],
|
||||
$requestData['url'],
|
||||
$requestData['headers']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -888,15 +932,27 @@ class Zend_Gdata_App
|
|||
* @throws Zend_Gdata_App_HttpException
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function post($data, $uri = null, $remainingRedirects = null,
|
||||
$contentType = null, $extraHeaders = null)
|
||||
{
|
||||
public function post(
|
||||
$data,
|
||||
$uri = null,
|
||||
$remainingRedirects = null,
|
||||
$contentType = null,
|
||||
$extraHeaders = null
|
||||
) {
|
||||
$requestData = $this->prepareRequest(
|
||||
'POST', $uri, $extraHeaders, $data, $contentType);
|
||||
'POST',
|
||||
$uri,
|
||||
$extraHeaders,
|
||||
$data,
|
||||
$contentType
|
||||
);
|
||||
return $this->performHttpRequest(
|
||||
$requestData['method'], $requestData['url'],
|
||||
$requestData['headers'], $requestData['data'],
|
||||
$requestData['contentType']);
|
||||
$requestData['method'],
|
||||
$requestData['url'],
|
||||
$requestData['headers'],
|
||||
$requestData['data'],
|
||||
$requestData['contentType']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -913,15 +969,27 @@ class Zend_Gdata_App
|
|||
* @throws Zend_Gdata_App_HttpException
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function put($data, $uri = null, $remainingRedirects = null,
|
||||
$contentType = null, $extraHeaders = null)
|
||||
{
|
||||
public function put(
|
||||
$data,
|
||||
$uri = null,
|
||||
$remainingRedirects = null,
|
||||
$contentType = null,
|
||||
$extraHeaders = null
|
||||
) {
|
||||
$requestData = $this->prepareRequest(
|
||||
'PUT', $uri, $extraHeaders, $data, $contentType);
|
||||
'PUT',
|
||||
$uri,
|
||||
$extraHeaders,
|
||||
$data,
|
||||
$contentType
|
||||
);
|
||||
return $this->performHttpRequest(
|
||||
$requestData['method'], $requestData['url'],
|
||||
$requestData['headers'], $requestData['data'],
|
||||
$requestData['contentType']);
|
||||
$requestData['method'],
|
||||
$requestData['url'],
|
||||
$requestData['headers'],
|
||||
$requestData['data'],
|
||||
$requestData['contentType']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -941,14 +1009,20 @@ class Zend_Gdata_App
|
|||
$headers = array();
|
||||
|
||||
$requestData = $this->prepareRequest(
|
||||
'DELETE', null, $headers, $data);
|
||||
'DELETE',
|
||||
null,
|
||||
$headers,
|
||||
$data
|
||||
);
|
||||
}
|
||||
return $this->performHttpRequest($requestData['method'],
|
||||
return $this->performHttpRequest(
|
||||
$requestData['method'],
|
||||
$requestData['url'],
|
||||
$requestData['headers'],
|
||||
'',
|
||||
$requestData['contentType'],
|
||||
$remainingRedirects);
|
||||
$remainingRedirects
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -963,12 +1037,15 @@ class Zend_Gdata_App
|
|||
* @return Zend_Gdata_App_Entry The entry returned by the service after
|
||||
* insertion.
|
||||
*/
|
||||
public function insertEntry($data, $uri, $className='Zend_Gdata_App_Entry',
|
||||
$extraHeaders = array())
|
||||
{
|
||||
public function insertEntry(
|
||||
$data,
|
||||
$uri,
|
||||
$className='Zend_Gdata_App_Entry',
|
||||
$extraHeaders = array()
|
||||
) {
|
||||
if (!class_exists($className, false)) {
|
||||
require_once 'Zend/Loader.php';
|
||||
@Zend_Loader::loadClass($className);
|
||||
require_once 'Zend/Loader.php';
|
||||
@Zend_Loader::loadClass($className);
|
||||
}
|
||||
|
||||
$response = $this->post($data, $uri, null, null, $extraHeaders);
|
||||
|
@ -998,9 +1075,12 @@ class Zend_Gdata_App
|
|||
* @return Zend_Gdata_App_Entry The entry returned from the server
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function updateEntry($data, $uri = null, $className = null,
|
||||
$extraHeaders = array())
|
||||
{
|
||||
public function updateEntry(
|
||||
$data,
|
||||
$uri = null,
|
||||
$className = null,
|
||||
$extraHeaders = array()
|
||||
) {
|
||||
if ($className === null && $data instanceof Zend_Gdata_App_Entry) {
|
||||
$className = get_class($data);
|
||||
} elseif ($className === null) {
|
||||
|
@ -1008,8 +1088,8 @@ class Zend_Gdata_App
|
|||
}
|
||||
|
||||
if (!class_exists($className, false)) {
|
||||
require_once 'Zend/Loader.php';
|
||||
@Zend_Loader::loadClass($className);
|
||||
require_once 'Zend/Loader.php';
|
||||
@Zend_Loader::loadClass($className);
|
||||
}
|
||||
|
||||
$response = $this->put($data, $uri, null, null, $extraHeaders);
|
||||
|
@ -1043,18 +1123,18 @@ class Zend_Gdata_App
|
|||
$class = $matches[1];
|
||||
$foundClassName = null;
|
||||
foreach ($this->_registeredPackages as $name) {
|
||||
try {
|
||||
// Autoloading disabled on next line for compatibility
|
||||
// with magic factories. See ZF-6660.
|
||||
if (!class_exists($name . '_' . $class, false)) {
|
||||
try {
|
||||
// Autoloading disabled on next line for compatibility
|
||||
// with magic factories. See ZF-6660.
|
||||
if (!class_exists($name . '_' . $class, false)) {
|
||||
require_once 'Zend/Loader.php';
|
||||
@Zend_Loader::loadClass($name . '_' . $class);
|
||||
}
|
||||
$foundClassName = $name . '_' . $class;
|
||||
break;
|
||||
} catch (Zend_Exception $e) {
|
||||
// package wasn't here- continue searching
|
||||
}
|
||||
}
|
||||
$foundClassName = $name . '_' . $class;
|
||||
break;
|
||||
} catch (Zend_Exception $e) {
|
||||
// package wasn't here- continue searching
|
||||
}
|
||||
}
|
||||
if ($foundClassName != null) {
|
||||
$reflectionObj = new ReflectionClass($foundClassName);
|
||||
|
@ -1064,15 +1144,18 @@ class Zend_Gdata_App
|
|||
|
||||
// Propogate version data
|
||||
$instance->setMajorProtocolVersion(
|
||||
$this->_majorProtocolVersion);
|
||||
$this->_majorProtocolVersion
|
||||
);
|
||||
$instance->setMinorProtocolVersion(
|
||||
$this->_minorProtocolVersion);
|
||||
$this->_minorProtocolVersion
|
||||
);
|
||||
}
|
||||
return $instance;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
"Unable to find '${class}' in registered packages");
|
||||
"Unable to find '${class}' in registered packages"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
|
@ -1090,7 +1173,8 @@ class Zend_Gdata_App
|
|||
* @return mixed A new feed of the same type as the one originally
|
||||
* passed in, containing all relevent entries.
|
||||
*/
|
||||
public function retrieveAllEntriesForFeed($feed) {
|
||||
public function retrieveAllEntriesForFeed($feed)
|
||||
{
|
||||
$feedClass = get_class($feed);
|
||||
$reflectionObj = new ReflectionClass($feedClass);
|
||||
$result = $reflectionObj->newInstance();
|
||||
|
@ -1105,8 +1189,7 @@ class Zend_Gdata_App
|
|||
} else {
|
||||
$feed = null;
|
||||
}
|
||||
}
|
||||
while ($feed != null);
|
||||
} while ($feed != null);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -1224,11 +1307,10 @@ class Zend_Gdata_App
|
|||
*/
|
||||
public function useObjectMapping($value)
|
||||
{
|
||||
if ($value === True) {
|
||||
if ($value === true) {
|
||||
$this->_useObjectMapping = true;
|
||||
} else {
|
||||
$this->_useObjectMapping = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ abstract class Zend_Gdata_App_Base
|
|||
* @see registerAllNamespaces()
|
||||
* @var array
|
||||
*/
|
||||
protected $_namespaces = array(
|
||||
protected $_namespaces = array(
|
||||
'atom' => array(
|
||||
1 => array(
|
||||
0 => 'http://www.w3.org/2005/Atom'
|
||||
|
@ -261,7 +261,8 @@ abstract class Zend_Gdata_App_Base
|
|||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
$arrayIndex = ($attribute->namespaceURI != '')?(
|
||||
$attribute->namespaceURI . ':' . $attribute->name):
|
||||
$attribute->namespaceURI . ':' . $attribute->name
|
||||
):
|
||||
$attribute->name;
|
||||
$this->_extensionAttributes[$arrayIndex] =
|
||||
array('namespaceUri' => $attribute->namespaceURI,
|
||||
|
@ -369,16 +370,18 @@ abstract class Zend_Gdata_App_Base
|
|||
* Defaults to null (use latest).
|
||||
* @return string
|
||||
*/
|
||||
public function lookupNamespace($prefix,
|
||||
public function lookupNamespace(
|
||||
$prefix,
|
||||
$majorVersion = 1,
|
||||
$minorVersion = null)
|
||||
{
|
||||
$minorVersion = null
|
||||
) {
|
||||
// Check for a memoized result
|
||||
$key = $prefix . ' ' .
|
||||
(is_null($majorVersion) ? 'NULL' : $majorVersion) .
|
||||
' '. (is_null($minorVersion) ? 'NULL' : $minorVersion);
|
||||
if (array_key_exists($key, self::$_namespaceLookupCache))
|
||||
return self::$_namespaceLookupCache[$key];
|
||||
if (array_key_exists($key, self::$_namespaceLookupCache)) {
|
||||
return self::$_namespaceLookupCache[$key];
|
||||
}
|
||||
// If no match, return the prefix by default
|
||||
$result = $prefix;
|
||||
|
||||
|
@ -387,11 +390,15 @@ abstract class Zend_Gdata_App_Base
|
|||
// Major version search
|
||||
$nsData = $this->_namespaces[$prefix];
|
||||
$foundMajorV = Zend_Gdata_App_Util::findGreatestBoundedValue(
|
||||
$majorVersion, $nsData);
|
||||
$majorVersion,
|
||||
$nsData
|
||||
);
|
||||
// Minor version search
|
||||
$nsData = $nsData[$foundMajorV];
|
||||
$foundMinorV = Zend_Gdata_App_Util::findGreatestBoundedValue(
|
||||
$minorVersion, $nsData);
|
||||
$minorVersion,
|
||||
$nsData
|
||||
);
|
||||
// Extract NS
|
||||
$result = $nsData[$foundMinorV];
|
||||
}
|
||||
|
@ -423,11 +430,12 @@ abstract class Zend_Gdata_App_Base
|
|||
* Defaults to null (use latest).
|
||||
* @return void
|
||||
*/
|
||||
public function registerNamespace($prefix,
|
||||
public function registerNamespace(
|
||||
$prefix,
|
||||
$namespaceUri,
|
||||
$majorVersion = 1,
|
||||
$minorVersion = 0)
|
||||
{
|
||||
$minorVersion = 0
|
||||
) {
|
||||
$this->_namespaces[$prefix][$majorVersion][$minorVersion] =
|
||||
$namespaceUri;
|
||||
}
|
||||
|
@ -456,9 +464,13 @@ abstract class Zend_Gdata_App_Base
|
|||
*/
|
||||
public function registerAllNamespaces($namespaceArray)
|
||||
{
|
||||
foreach($namespaceArray as $namespace) {
|
||||
$this->registerNamespace(
|
||||
$namespace[0], $namespace[1], $namespace[2], $namespace[3]);
|
||||
foreach ($namespaceArray as $namespace) {
|
||||
$this->registerNamespace(
|
||||
$namespace[0],
|
||||
$namespace[1],
|
||||
$namespace[2],
|
||||
$namespace[3]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,12 +489,13 @@ abstract class Zend_Gdata_App_Base
|
|||
$method = 'get'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method));
|
||||
} else if (property_exists($this, "_${name}")) {
|
||||
} elseif (property_exists($this, "_${name}")) {
|
||||
return $this->{'_' . $name};
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
'Property ' . $name . ' does not exist'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,12 +516,13 @@ abstract class Zend_Gdata_App_Base
|
|||
$method = 'set'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method), $val);
|
||||
} else if (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) {
|
||||
} elseif (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) {
|
||||
$this->{'_' . $name} = $val;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
'Property ' . $name . ' does not exist'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -524,7 +538,8 @@ abstract class Zend_Gdata_App_Base
|
|||
if (!($rc->hasProperty($privName))) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
'Property ' . $name . ' does not exist'
|
||||
);
|
||||
} else {
|
||||
if (isset($this->{$privName})) {
|
||||
if (is_array($this->{$privName})) {
|
||||
|
@ -568,5 +583,4 @@ abstract class Zend_Gdata_App_Base
|
|||
{
|
||||
return $this->getText();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,7 +82,8 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug(){
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->_slug;
|
||||
}
|
||||
|
||||
|
@ -93,7 +94,8 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
|||
* @var string The slug value
|
||||
* @return Zend_Gdata_App_MediaSource Provides a fluent interface
|
||||
*/
|
||||
public function setSlug($value){
|
||||
public function setSlug($value)
|
||||
{
|
||||
$this->_slug = $value;
|
||||
return $this;
|
||||
}
|
||||
|
@ -113,12 +115,13 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
|||
$method = 'get'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method));
|
||||
} else if (property_exists($this, "_${name}")) {
|
||||
} elseif (property_exists($this, "_${name}")) {
|
||||
return $this->{'_' . $name};
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
'Property ' . $name . ' does not exist'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,12 +140,13 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
|||
$method = 'set'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method), $val);
|
||||
} else if (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) {
|
||||
} elseif (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) {
|
||||
$this->{'_' . $name} = $val;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
'Property ' . $name . ' does not exist'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +162,8 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
|||
if (!($rc->hasProperty($privName))) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
'Property ' . $name . ' does not exist'
|
||||
);
|
||||
} else {
|
||||
if (isset($this->{$privName})) {
|
||||
if (is_array($this->{$privName})) {
|
||||
|
@ -175,5 +180,4 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -67,7 +67,8 @@ class Zend_Gdata_App_CaptchaRequiredException extends Zend_Gdata_App_AuthExcepti
|
|||
* @param string $captchaToken The CAPTCHA token ID provided by the server.
|
||||
* @param string $captchaUrl The URL to the CAPTCHA challenge image.
|
||||
*/
|
||||
public function __construct($captchaToken, $captchaUrl) {
|
||||
public function __construct($captchaToken, $captchaUrl)
|
||||
{
|
||||
$this->captchaToken = $captchaToken;
|
||||
$this->captchaUrl = Zend_Gdata_App_CaptchaRequiredException::ACCOUNTS_URL . $captchaUrl;
|
||||
parent::__construct('CAPTCHA challenge issued by server');
|
||||
|
@ -78,7 +79,8 @@ class Zend_Gdata_App_CaptchaRequiredException extends Zend_Gdata_App_AuthExcepti
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCaptchaToken() {
|
||||
public function getCaptchaToken()
|
||||
{
|
||||
return $this->captchaToken;
|
||||
}
|
||||
|
||||
|
@ -87,8 +89,8 @@ class Zend_Gdata_App_CaptchaRequiredException extends Zend_Gdata_App_AuthExcepti
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCaptchaUrl() {
|
||||
public function getCaptchaUrl()
|
||||
{
|
||||
return $this->captchaUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -203,10 +203,12 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
|||
*/
|
||||
public function save($uri = null, $className = null, $extraHeaders = array())
|
||||
{
|
||||
return $this->getService()->updateEntry($this,
|
||||
return $this->getService()->updateEntry(
|
||||
$this,
|
||||
$uri,
|
||||
$className,
|
||||
$extraHeaders);
|
||||
$extraHeaders
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -265,8 +267,9 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
|||
try {
|
||||
$result = $this->service->importUrl($uri, $className, $extraHeaders);
|
||||
} catch (Zend_Gdata_App_HttpException $e) {
|
||||
if ($e->getResponse()->getStatus() != '304')
|
||||
if ($e->getResponse()->getStatus() != '304') {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@ -385,5 +388,4 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
|||
$this->_control = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,5 @@ require_once 'Zend/Gdata/App/Extension/Person.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Author extends Zend_Gdata_App_Extension_Person
|
||||
{
|
||||
|
||||
protected $_rootElement = 'author';
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Category extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'category';
|
||||
protected $_term = null;
|
||||
protected $_scheme = null;
|
||||
|
@ -136,5 +135,4 @@ class Zend_Gdata_App_Extension_Category extends Zend_Gdata_App_Extension
|
|||
$this->_label = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Content extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'content';
|
||||
protected $_src = null;
|
||||
|
||||
|
@ -84,5 +83,4 @@ class Zend_Gdata_App_Extension_Content extends Zend_Gdata_App_Extension_Text
|
|||
$this->_src = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,5 @@ require_once 'Zend/Gdata/App/Extension/Person.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Contributor extends Zend_Gdata_App_Extension_Person
|
||||
{
|
||||
|
||||
protected $_rootElement = 'contributor';
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ require_once 'Zend/Gdata/App/Extension/Draft.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Control extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'app';
|
||||
protected $_rootElement = 'control';
|
||||
protected $_draft = null;
|
||||
|
@ -94,5 +93,4 @@ class Zend_Gdata_App_Extension_Control extends Zend_Gdata_App_Extension
|
|||
$this->_draft = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Draft extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'app';
|
||||
protected $_rootElement = 'draft';
|
||||
|
||||
|
@ -46,5 +45,4 @@ class Zend_Gdata_App_Extension_Draft extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Edited extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'edited';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Edited extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Element extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
public function __construct($rootElement=null, $rootNamespace=null, $rootNamespaceURI=null, $text=null){
|
||||
public function __construct($rootElement=null, $rootNamespace=null, $rootNamespaceURI=null, $text=null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_rootElement = $rootElement;
|
||||
$this->_rootNamespace = $rootNamespace;
|
||||
|
@ -54,5 +54,4 @@ class Zend_Gdata_App_Extension_Element extends Zend_Gdata_App_Extension
|
|||
$this->_rootNamespaceURI = $node->namespaceURI;
|
||||
$this->_rootElement = $node->localName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Email extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'email';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Email extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Generator extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'generator';
|
||||
protected $_uri = null;
|
||||
protected $_version = null;
|
||||
|
@ -111,5 +110,4 @@ class Zend_Gdata_App_Extension_Generator extends Zend_Gdata_App_Extension
|
|||
$this->_version = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Icon extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'icon';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Icon extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Id extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'id';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Id extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Link extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'link';
|
||||
protected $_href = null;
|
||||
protected $_rel = null;
|
||||
|
@ -46,9 +45,14 @@ class Zend_Gdata_App_Extension_Link extends Zend_Gdata_App_Extension
|
|||
protected $_title = null;
|
||||
protected $_length = null;
|
||||
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
public function __construct(
|
||||
$href = null,
|
||||
$rel = null,
|
||||
$type = null,
|
||||
$hrefLang = null,
|
||||
$title = null,
|
||||
$length = null
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->_href = $href;
|
||||
$this->_rel = $rel;
|
||||
|
@ -215,5 +219,4 @@ class Zend_Gdata_App_Extension_Link extends Zend_Gdata_App_Extension
|
|||
$this->_length = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Logo extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'logo';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Logo extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Name extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'name';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
|
|
@ -52,7 +52,6 @@ require_once 'Zend/Gdata/App/Extension/Uri.php';
|
|||
*/
|
||||
abstract class Zend_Gdata_App_Extension_Person extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = null;
|
||||
protected $_name = null;
|
||||
protected $_email = null;
|
||||
|
@ -159,5 +158,4 @@ abstract class Zend_Gdata_App_Extension_Person extends Zend_Gdata_App_Extension
|
|||
$this->_uri = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Published extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'published';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Published extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Rights extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'rights';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Rights extends Zend_Gdata_App_Extension_Text
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,5 @@ require_once 'Zend/Gdata/App/FeedSourceParent.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Source extends Zend_Gdata_App_FeedSourceParent
|
||||
{
|
||||
|
||||
protected $_rootElement = 'source';
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,5 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Subtitle extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'subtitle';
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,5 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Summary extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'summary';
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
abstract class Zend_Gdata_App_Extension_Text extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = null;
|
||||
protected $_type = 'text';
|
||||
|
||||
|
@ -86,5 +85,4 @@ abstract class Zend_Gdata_App_Extension_Text extends Zend_Gdata_App_Extension
|
|||
$this->_type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,5 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Title extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'title';
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Updated extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'updated';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Updated extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/App/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_App_Extension_Uri extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'uri';
|
||||
|
||||
public function __construct($text = null)
|
||||
|
@ -45,5 +44,4 @@ class Zend_Gdata_App_Extension_Uri extends Zend_Gdata_App_Extension
|
|||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ require_once 'Zend/Gdata/App/FeedSourceParent.php';
|
|||
* @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_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent
|
||||
implements Iterator, ArrayAccess
|
||||
class Zend_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent implements Iterator, ArrayAccess
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -270,13 +269,13 @@ class Zend_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent
|
|||
return (array_key_exists($key, $this->_entry));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the next set of results from this feed.
|
||||
*
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return mixed|null Returns the next set of results as a feed of the same
|
||||
* class as this feed, or null if no results exist.
|
||||
*/
|
||||
/**
|
||||
* Retrieve the next set of results from this feed.
|
||||
*
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return mixed|null Returns the next set of results as a feed of the same
|
||||
* class as this feed, or null if no results exist.
|
||||
*/
|
||||
public function getNextFeed()
|
||||
{
|
||||
$nextLink = $this->getNextLink();
|
||||
|
@ -291,13 +290,13 @@ class Zend_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent
|
|||
return $service->getFeed($nextLinkHref, get_class($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the previous set of results from this feed.
|
||||
*
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return mixed|null Returns the previous set of results as a feed of
|
||||
* the same class as this feed, or null if no results exist.
|
||||
*/
|
||||
/**
|
||||
* Retrieve the previous set of results from this feed.
|
||||
*
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return mixed|null Returns the previous set of results as a feed of
|
||||
* the same class as this feed, or null if no results exist.
|
||||
*/
|
||||
public function getPreviousFeed()
|
||||
{
|
||||
$previousLink = $this->getPreviousLink();
|
||||
|
@ -348,5 +347,4 @@ class Zend_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent
|
|||
$entry->setMinorProtocolVersion($value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
|||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $_etag = NULL;
|
||||
protected $_etag = null;
|
||||
|
||||
protected $_author = array();
|
||||
protected $_category = array();
|
||||
|
@ -567,7 +567,8 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
|||
* @param string|null $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setEtag($value) {
|
||||
public function setEtag($value)
|
||||
{
|
||||
$this->_etag = $value;
|
||||
return $this;
|
||||
}
|
||||
|
@ -577,7 +578,8 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
|||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getEtag() {
|
||||
public function getEtag()
|
||||
{
|
||||
return $this->_etag;
|
||||
}
|
||||
|
||||
|
@ -595,7 +597,8 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
|||
if (!($value >= 1) && ($value !== null)) {
|
||||
require_once('Zend/Gdata/App/InvalidArgumentException.php');
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Major protocol version must be >= 1');
|
||||
'Major protocol version must be >= 1'
|
||||
);
|
||||
}
|
||||
$this->_majorProtocolVersion = $value;
|
||||
}
|
||||
|
@ -625,7 +628,8 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
|||
if (!($value >= 0)) {
|
||||
require_once('Zend/Gdata/App/InvalidArgumentException.php');
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Minor protocol version must be >= 0 or null');
|
||||
'Minor protocol version must be >= 0 or null'
|
||||
);
|
||||
}
|
||||
$this->_minorProtocolVersion = $value;
|
||||
}
|
||||
|
@ -662,10 +666,11 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
|||
* Defaults to null (auto-select).
|
||||
* @return string
|
||||
*/
|
||||
public function lookupNamespace($prefix,
|
||||
public function lookupNamespace(
|
||||
$prefix,
|
||||
$majorVersion = null,
|
||||
$minorVersion = null)
|
||||
{
|
||||
$minorVersion = null
|
||||
) {
|
||||
// Auto-select current version
|
||||
if ($majorVersion === null) {
|
||||
$majorVersion = $this->getMajorProtocolVersion();
|
||||
|
@ -677,5 +682,4 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
|||
// Perform lookup
|
||||
return parent::lookupNamespace($prefix, $majorVersion, $minorVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -263,5 +263,4 @@ abstract class Zend_Gdata_App_FeedSourceParent extends Zend_Gdata_App_FeedEntryP
|
|||
$this->_subtitle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ require_once 'Zend/Http/Client/Exception.php';
|
|||
*/
|
||||
class Zend_Gdata_App_HttpException extends Zend_Gdata_App_Exception
|
||||
{
|
||||
|
||||
protected $_httpClientException = null;
|
||||
protected $_response = null;
|
||||
|
||||
|
@ -117,5 +116,4 @@ class Zend_Gdata_App_HttpException extends Zend_Gdata_App_Exception
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -115,5 +115,4 @@ class Zend_Gdata_App_LoggingHttpClientAdapterSocket extends Zend_Http_Client_Ada
|
|||
$this->log("Closing socket\n\n");
|
||||
parent::close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,8 +82,11 @@ class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry
|
|||
// No attachment, just send XML for entry
|
||||
return $xmlData;
|
||||
} else {
|
||||
return new Zend_Gdata_MediaMimeStream($xmlData,
|
||||
$mediaSource->getFilename(), $mediaSource->getContentType());
|
||||
return new Zend_Gdata_MediaMimeStream(
|
||||
$xmlData,
|
||||
$mediaSource->getFilename(),
|
||||
$mediaSource->getContentType()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,9 +114,9 @@ class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry
|
|||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the media data as a class that conforms to Zend_Gdata_App_MediaSource.');
|
||||
'You must specify the media data as a class that conforms to Zend_Gdata_App_MediaSource.'
|
||||
);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -142,5 +142,4 @@ class Zend_Gdata_App_MediaFileSource extends Zend_Gdata_App_BaseMediaSource
|
|||
{
|
||||
return $this->getFilename();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,10 +92,11 @@ class Zend_Gdata_App_Util
|
|||
// will have a matching namespce. If that fails, we decrement the
|
||||
// version until we find a match.
|
||||
while (!$found && $foundKey >= 0) {
|
||||
if (array_key_exists($foundKey, $collection))
|
||||
if (array_key_exists($foundKey, $collection)) {
|
||||
$found = true;
|
||||
else
|
||||
} else {
|
||||
$foundKey--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,5 +109,4 @@ class Zend_Gdata_App_Util
|
|||
|
||||
return $foundKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ require_once 'Zend/Version.php';
|
|||
*/
|
||||
class Zend_Gdata_AuthSub
|
||||
{
|
||||
|
||||
const AUTHSUB_REQUEST_URI = 'https://www.google.com/accounts/AuthSubRequest';
|
||||
|
||||
const AUTHSUB_SESSION_TOKEN_URI = 'https://www.google.com/accounts/AuthSubSessionToken';
|
||||
|
@ -54,37 +53,41 @@ class Zend_Gdata_AuthSub
|
|||
|
||||
const AUTHSUB_TOKEN_INFO_URI = 'https://www.google.com/accounts/AuthSubTokenInfo';
|
||||
|
||||
/**
|
||||
* Creates a URI to request a single-use AuthSub token.
|
||||
*
|
||||
* @param string $next (required) URL identifying the service to be
|
||||
* accessed.
|
||||
* The resulting token will enable access to the specified service only.
|
||||
* Some services may limit scope further, such as read-only access.
|
||||
* @param string $scope (required) URL identifying the service to be
|
||||
* accessed. The resulting token will enable
|
||||
* access to the specified service only.
|
||||
* Some services may limit scope further, such
|
||||
* as read-only access.
|
||||
* @param int $secure (optional) Boolean flag indicating whether the
|
||||
* authentication transaction should issue a secure
|
||||
* token (1) or a non-secure token (0). Secure tokens
|
||||
* are available to registered applications only.
|
||||
* @param int $session (optional) Boolean flag indicating whether
|
||||
* the one-time-use token may be exchanged for
|
||||
* a session token (1) or not (0).
|
||||
* @param string $request_uri (optional) URI to which to direct the
|
||||
* authentication request.
|
||||
*/
|
||||
public static function getAuthSubTokenUri($next, $scope, $secure=0, $session=0,
|
||||
$request_uri = self::AUTHSUB_REQUEST_URI)
|
||||
{
|
||||
$querystring = '?next=' . urlencode($next)
|
||||
/**
|
||||
* Creates a URI to request a single-use AuthSub token.
|
||||
*
|
||||
* @param string $next (required) URL identifying the service to be
|
||||
* accessed.
|
||||
* The resulting token will enable access to the specified service only.
|
||||
* Some services may limit scope further, such as read-only access.
|
||||
* @param string $scope (required) URL identifying the service to be
|
||||
* accessed. The resulting token will enable
|
||||
* access to the specified service only.
|
||||
* Some services may limit scope further, such
|
||||
* as read-only access.
|
||||
* @param int $secure (optional) Boolean flag indicating whether the
|
||||
* authentication transaction should issue a secure
|
||||
* token (1) or a non-secure token (0). Secure tokens
|
||||
* are available to registered applications only.
|
||||
* @param int $session (optional) Boolean flag indicating whether
|
||||
* the one-time-use token may be exchanged for
|
||||
* a session token (1) or not (0).
|
||||
* @param string $request_uri (optional) URI to which to direct the
|
||||
* authentication request.
|
||||
*/
|
||||
public static function getAuthSubTokenUri(
|
||||
$next,
|
||||
$scope,
|
||||
$secure=0,
|
||||
$session=0,
|
||||
$request_uri = self::AUTHSUB_REQUEST_URI
|
||||
) {
|
||||
$querystring = '?next=' . urlencode($next)
|
||||
. '&scope=' . urldecode($scope)
|
||||
. '&secure=' . urlencode($secure)
|
||||
. '&session=' . urlencode($session);
|
||||
return $request_uri . $querystring;
|
||||
}
|
||||
return $request_uri . $querystring;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -100,9 +103,10 @@ class Zend_Gdata_AuthSub
|
|||
* @throws Zend_Gdata_App_HttpException
|
||||
*/
|
||||
public static function getAuthSubSessionToken(
|
||||
$token, $client = null,
|
||||
$request_uri = self::AUTHSUB_SESSION_TOKEN_URI)
|
||||
{
|
||||
$token,
|
||||
$client = null,
|
||||
$request_uri = self::AUTHSUB_SESSION_TOKEN_URI
|
||||
) {
|
||||
$client = self::getHttpClient($token, $client);
|
||||
|
||||
if ($client instanceof Zend_Gdata_HttpClient) {
|
||||
|
@ -136,7 +140,8 @@ class Zend_Gdata_AuthSub
|
|||
} else {
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Token upgrade failed. Reason: ' . $response->getBody());
|
||||
'Token upgrade failed. Reason: ' . $response->getBody()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,9 +154,11 @@ class Zend_Gdata_AuthSub
|
|||
* @return boolean Whether the revokation was successful
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
*/
|
||||
public static function AuthSubRevokeToken($token, $client = null,
|
||||
$request_uri = self::AUTHSUB_REVOKE_TOKEN_URI)
|
||||
{
|
||||
public static function AuthSubRevokeToken(
|
||||
$token,
|
||||
$client = null,
|
||||
$request_uri = self::AUTHSUB_REVOKE_TOKEN_URI
|
||||
) {
|
||||
$client = self::getHttpClient($token, $client);
|
||||
|
||||
if ($client instanceof Zend_Gdata_HttpClient) {
|
||||
|
@ -192,8 +199,10 @@ class Zend_Gdata_AuthSub
|
|||
* the information request
|
||||
*/
|
||||
public static function getAuthSubTokenInfo(
|
||||
$token, $client = null, $request_uri = self::AUTHSUB_TOKEN_INFO_URI)
|
||||
{
|
||||
$token,
|
||||
$client = null,
|
||||
$request_uri = self::AUTHSUB_TOKEN_INFO_URI
|
||||
) {
|
||||
$client = self::getHttpClient($token, $client);
|
||||
|
||||
if ($client instanceof Zend_Gdata_HttpClient) {
|
||||
|
@ -234,7 +243,8 @@ class Zend_Gdata_AuthSub
|
|||
throw new Zend_Gdata_App_HttpException('Client is not an instance of Zend_Http_Client.');
|
||||
}
|
||||
$useragent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
$client->setConfig(
|
||||
array(
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
|
@ -242,5 +252,4 @@ class Zend_Gdata_AuthSub
|
|||
$client->setAuthSubToken($token);
|
||||
return $client;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class Zend_Gdata_Books extends Zend_Gdata
|
|||
$this->registerPackage('Zend_Gdata_Books_Extension');
|
||||
parent::__construct($client, $applicationId);
|
||||
$this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a feed of volumes.
|
||||
|
@ -105,7 +105,7 @@ class Zend_Gdata_Books extends Zend_Gdata
|
|||
{
|
||||
if ($location == null) {
|
||||
$uri = self::VOLUME_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
|
@ -127,7 +127,7 @@ class Zend_Gdata_Books extends Zend_Gdata
|
|||
{
|
||||
if ($volumeId !== null) {
|
||||
$uri = self::VOLUME_FEED_URI . "/" . $volumeId;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
|
@ -187,7 +187,10 @@ class Zend_Gdata_Books extends Zend_Gdata
|
|||
$uri = $location;
|
||||
}
|
||||
return parent::insertEntry(
|
||||
$entry, $uri, 'Zend_Gdata_Books_VolumeEntry');
|
||||
$entry,
|
||||
$uri,
|
||||
'Zend_Gdata_Books_VolumeEntry'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,5 +203,4 @@ class Zend_Gdata_Books extends Zend_Gdata
|
|||
{
|
||||
$entry->delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,4 @@ class Zend_Gdata_Books_CollectionEntry extends Zend_Gdata_Entry
|
|||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,4 @@ class Zend_Gdata_Books_CollectionFeed extends Zend_Gdata_Feed
|
|||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Books_CollectionEntry';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -52,12 +52,15 @@ class Zend_Gdata_Books_Extension_AnnotationLink extends
|
|||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
public function __construct(
|
||||
$href = null,
|
||||
$rel = null,
|
||||
$type = null,
|
||||
$hrefLang = null,
|
||||
$title = null,
|
||||
$length = null
|
||||
) {
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -55,5 +55,4 @@ class Zend_Gdata_Books_Extension_BooksCategory extends
|
|||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($term, $scheme, $label);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,13 +49,15 @@ class Zend_Gdata_Books_Extension_BooksLink extends Zend_Gdata_App_Extension_Link
|
|||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
public function __construct(
|
||||
$href = null,
|
||||
$rel = null,
|
||||
$type = null,
|
||||
$hrefLang = null,
|
||||
$title = null,
|
||||
$length = null
|
||||
) {
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Books_Extension_Embeddability extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gbs';
|
||||
protected $_rootElement = 'embeddability';
|
||||
protected $_value = null;
|
||||
|
@ -117,6 +116,4 @@ class Zend_Gdata_Books_Extension_Embeddability extends Zend_Gdata_Extension
|
|||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -49,11 +49,15 @@ class Zend_Gdata_Books_Extension_InfoLink extends
|
|||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
public function __construct(
|
||||
$href = null,
|
||||
$rel = null,
|
||||
$type = null,
|
||||
$hrefLang = null,
|
||||
$title = null,
|
||||
$length = null
|
||||
) {
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,11 +50,15 @@ class Zend_Gdata_Books_Extension_PreviewLink extends
|
|||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
public function __construct(
|
||||
$href = null,
|
||||
$rel = null,
|
||||
$type = null,
|
||||
$hrefLang = null,
|
||||
$title = null,
|
||||
$length = null
|
||||
) {
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Books_Extension_Review extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gbs';
|
||||
protected $_rootElement = 'review';
|
||||
protected $_lang = null;
|
||||
|
@ -146,7 +145,4 @@ class Zend_Gdata_Books_Extension_Review extends Zend_Gdata_Extension
|
|||
$this->_type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -50,11 +50,15 @@ class Zend_Gdata_Books_Extension_ThumbnailLink extends
|
|||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
public function __construct(
|
||||
$href = null,
|
||||
$rel = null,
|
||||
$type = null,
|
||||
$hrefLang = null,
|
||||
$title = null,
|
||||
$length = null
|
||||
) {
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Books_Extension_Viewability extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gbs';
|
||||
protected $_rootElement = 'viewability';
|
||||
protected $_value = null;
|
||||
|
@ -117,7 +116,4 @@ class Zend_Gdata_Books_Extension_Viewability extends Zend_Gdata_Extension
|
|||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ require_once 'Zend/Gdata/Books/Extension/Viewability.php';
|
|||
*/
|
||||
class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
const THUMBNAIL_LINK_REL = 'http://schemas.google.com/books/2008/thumbnail';
|
||||
const PREVIEW_LINK_REL = 'http://schemas.google.com/books/2008/preview';
|
||||
const INFO_LINK_REL = 'http://schemas.google.com/books/2008/info';
|
||||
|
@ -157,7 +156,8 @@ class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry
|
|||
if ($this->_creators !== null) {
|
||||
foreach ($this->_creators as $creators) {
|
||||
$element->appendChild($creators->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($this->_dates !== null) {
|
||||
|
@ -168,37 +168,43 @@ class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry
|
|||
if ($this->_descriptions !== null) {
|
||||
foreach ($this->_descriptions as $descriptions) {
|
||||
$element->appendChild($descriptions->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($this->_formats !== null) {
|
||||
foreach ($this->_formats as $formats) {
|
||||
$element->appendChild($formats->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($this->_identifiers !== null) {
|
||||
foreach ($this->_identifiers as $identifiers) {
|
||||
$element->appendChild($identifiers->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($this->_languages !== null) {
|
||||
foreach ($this->_languages as $languages) {
|
||||
$element->appendChild($languages->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($this->_publishers !== null) {
|
||||
foreach ($this->_publishers as $publishers) {
|
||||
$element->appendChild($publishers->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($this->_subjects !== null) {
|
||||
foreach ($this->_subjects as $subjects) {
|
||||
$element->appendChild($subjects->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($this->_titles !== null) {
|
||||
|
@ -208,23 +214,28 @@ class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry
|
|||
}
|
||||
if ($this->_comments !== null) {
|
||||
$element->appendChild($this->_comments->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
if ($this->_embeddability !== null) {
|
||||
$element->appendChild($this->_embeddability->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
if ($this->_rating !== null) {
|
||||
$element->appendChild($this->_rating->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
if ($this->_review !== null) {
|
||||
$element->appendChild($this->_review->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
if ($this->_viewability !== null) {
|
||||
$element->appendChild($this->_viewability->getDOM(
|
||||
$element->ownerDocument));
|
||||
$element->ownerDocument
|
||||
));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
@ -640,7 +651,7 @@ class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry
|
|||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception('Slash not found in atom:id');
|
||||
} else {
|
||||
return substr($fullId, strrpos($fullId,'/') + 1);
|
||||
return substr($fullId, strrpos($fullId, '/') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -683,5 +694,4 @@ class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry
|
|||
{
|
||||
return $this->getLink(self::ANNOTATION_LINK_REL);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,12 +51,10 @@ class Zend_Gdata_Books_VolumeFeed extends Zend_Gdata_Feed
|
|||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Books_VolumeEntry';
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Books_VolumeEntry';
|
||||
}
|
||||
|
||||
|
|
|
@ -108,5 +108,4 @@ class Zend_Gdata_Books_VolumeQuery extends Zend_Gdata_Query
|
|||
$url = $url . $this->getQueryString();
|
||||
return $url;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ require_once 'Zend/Gdata/Calendar/ListEntry.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar extends Zend_Gdata
|
||||
{
|
||||
|
||||
const CALENDAR_FEED_URI = 'http://www.google.com/calendar/feeds';
|
||||
const CALENDAR_EVENT_FEED_URI = 'http://www.google.com/calendar/feeds/default/private/full';
|
||||
const AUTH_SERVICE_NAME = 'cl';
|
||||
|
@ -99,7 +98,7 @@ class Zend_Gdata_Calendar extends Zend_Gdata
|
|||
{
|
||||
if ($location == null) {
|
||||
$uri = self::CALENDAR_EVENT_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
|
@ -117,8 +116,9 @@ class Zend_Gdata_Calendar extends Zend_Gdata
|
|||
if ($location == null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Location must not be null');
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
'Location must not be null'
|
||||
);
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
|
@ -135,7 +135,7 @@ class Zend_Gdata_Calendar extends Zend_Gdata
|
|||
public function getCalendarListFeed()
|
||||
{
|
||||
$uri = self::CALENDAR_FEED_URI . '/default';
|
||||
return parent::getFeed($uri,'Zend_Gdata_Calendar_ListFeed');
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Calendar_ListFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,13 +148,14 @@ class Zend_Gdata_Calendar extends Zend_Gdata
|
|||
if ($location == null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Location must not be null');
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
'Location must not be null'
|
||||
);
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getEntry($uri,'Zend_Gdata_Calendar_ListEntry');
|
||||
return parent::getEntry($uri, 'Zend_Gdata_Calendar_ListEntry');
|
||||
}
|
||||
|
||||
public function insertEvent($event, $uri=null)
|
||||
|
@ -165,5 +166,4 @@ class Zend_Gdata_Calendar extends Zend_Gdata
|
|||
$newEvent = $this->insertEntry($event, $uri, 'Zend_Gdata_Calendar_EventEntry');
|
||||
return $newEvent;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@ require_once 'Zend/Gdata/Calendar/Extension/QuickAdd.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_EventEntry extends Zend_Gdata_Kind_EventEntry
|
||||
{
|
||||
|
||||
protected $_entryClassName = 'Zend_Gdata_Calendar_EventEntry';
|
||||
protected $_sendEventNotifications = null;
|
||||
protected $_timezone = null;
|
||||
|
@ -94,22 +93,22 @@ class Zend_Gdata_Calendar_EventEntry extends Zend_Gdata_Kind_EventEntry
|
|||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'sendEventNotifications';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'sendEventNotifications':
|
||||
$sendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications();
|
||||
$sendEventNotifications->transferFromDOM($child);
|
||||
$this->_sendEventNotifications = $sendEventNotifications;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone':
|
||||
$timezone = new Zend_Gdata_Calendar_Extension_Timezone();
|
||||
$timezone->transferFromDOM($child);
|
||||
$this->_timezone = $timezone;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'link';
|
||||
case $this->lookupNamespace('atom') . ':' . 'link':
|
||||
$link = new Zend_Gdata_Calendar_Extension_Link();
|
||||
$link->transferFromDOM($child);
|
||||
$this->_link[] = $link;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'quickadd';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'quickadd':
|
||||
$quickadd = new Zend_Gdata_Calendar_Extension_QuickAdd();
|
||||
$quickadd->transferFromDOM($child);
|
||||
$this->_quickadd = $quickadd;
|
||||
|
@ -160,5 +159,4 @@ class Zend_Gdata_Calendar_EventEntry extends Zend_Gdata_Kind_EventEntry
|
|||
$this->_quickadd = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ require_once 'Zend/Gdata/Calendar/Extension/Timezone.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_EventFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
|
||||
protected $_timezone = null;
|
||||
|
||||
/**
|
||||
|
@ -80,7 +79,7 @@ class Zend_Gdata_Calendar_EventFeed extends Zend_Gdata_Feed
|
|||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone':
|
||||
$timezone = new Zend_Gdata_Calendar_Extension_Timezone();
|
||||
$timezone->transferFromDOM($child);
|
||||
$this->_timezone = $timezone;
|
||||
|
@ -102,5 +101,4 @@ class Zend_Gdata_Calendar_EventFeed extends Zend_Gdata_Feed
|
|||
$this->_timezone = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ require_once('Zend/Gdata/Query.php');
|
|||
*/
|
||||
class Zend_Gdata_Calendar_EventQuery extends Zend_Gdata_Query
|
||||
{
|
||||
|
||||
const CALENDAR_FEED_URI = 'http://www.google.com/calendar/feeds';
|
||||
|
||||
/**
|
||||
|
@ -380,7 +379,8 @@ class Zend_Gdata_Calendar_EventQuery extends Zend_Gdata_Query
|
|||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'Invalid query param value for futureevents: ' .
|
||||
$value . ' It must be a boolean.');
|
||||
$value . ' It must be a boolean.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
|
@ -402,7 +402,8 @@ class Zend_Gdata_Calendar_EventQuery extends Zend_Gdata_Query
|
|||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'Invalid query param value for futureevents: ' .
|
||||
$value . ' It must be a boolean.');
|
||||
$value . ' It must be a boolean.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
unset($this->_params['singleevents']);
|
||||
|
@ -428,7 +429,8 @@ class Zend_Gdata_Calendar_EventQuery extends Zend_Gdata_Query
|
|||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'Invalid query param value for futureevents: ' .
|
||||
$value . ' It must be a boolean.');
|
||||
$value . ' It must be a boolean.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
|
@ -451,7 +453,8 @@ class Zend_Gdata_Calendar_EventQuery extends Zend_Gdata_Query
|
|||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'Invalid query param value for futureevents: ' .
|
||||
$value . ' It must be a boolean.');
|
||||
$value . ' It must be a boolean.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
unset($this->_params['futureevents']);
|
||||
|
@ -487,5 +490,4 @@ class Zend_Gdata_Calendar_EventQuery extends Zend_Gdata_Query
|
|||
$uri .= $this->getQueryString();
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_Extension_AccessLevel extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'accesslevel';
|
||||
protected $_value = null;
|
||||
|
@ -121,5 +120,4 @@ class Zend_Gdata_Calendar_Extension_AccessLevel extends Zend_Gdata_Extension
|
|||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Color extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'color';
|
||||
protected $_value = null;
|
||||
|
@ -121,5 +120,4 @@ class Zend_Gdata_Calendar_Extension_Color extends Zend_Gdata_Extension
|
|||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Hidden extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'hidden';
|
||||
protected $_value = null;
|
||||
|
@ -85,11 +84,9 @@ class Zend_Gdata_Calendar_Extension_Hidden extends Zend_Gdata_Extension
|
|||
case 'value':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_value = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
} elseif ($attribute->nodeValue == "false") {
|
||||
$this->_value = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
|
@ -129,6 +126,4 @@ class Zend_Gdata_Calendar_Extension_Hidden extends Zend_Gdata_Extension
|
|||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ require_once 'Zend/Gdata/Calendar/Extension/WebContent.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link
|
||||
{
|
||||
|
||||
protected $_webContent = null;
|
||||
|
||||
/**
|
||||
|
@ -50,9 +49,15 @@ class Zend_Gdata_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link
|
|||
* @see Zend_Gdata_App_Extension_Link#__construct
|
||||
* @param Zend_Gdata_Calendar_Extension_Webcontent $webContent
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null, $webContent = null)
|
||||
{
|
||||
public function __construct(
|
||||
$href = null,
|
||||
$rel = null,
|
||||
$type = null,
|
||||
$hrefLang = null,
|
||||
$title = null,
|
||||
$length = null,
|
||||
$webContent = null
|
||||
) {
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
$this->_webContent = $webContent;
|
||||
|
@ -119,7 +124,4 @@ class Zend_Gdata_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link
|
|||
$this->_webContent = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_Extension_QuickAdd extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'quickadd';
|
||||
protected $_value = null;
|
||||
|
@ -85,11 +84,9 @@ class Zend_Gdata_Calendar_Extension_QuickAdd extends Zend_Gdata_Extension
|
|||
case 'value':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_value = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
} elseif ($attribute->nodeValue == "false") {
|
||||
$this->_value = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
|
@ -128,5 +125,4 @@ class Zend_Gdata_Calendar_Extension_QuickAdd extends Zend_Gdata_Extension
|
|||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Selected extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'selected';
|
||||
protected $_value = null;
|
||||
|
@ -85,11 +84,9 @@ class Zend_Gdata_Calendar_Extension_Selected extends Zend_Gdata_Extension
|
|||
case 'value':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_value = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
} elseif ($attribute->nodeValue == "false") {
|
||||
$this->_value = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
|
@ -129,5 +126,4 @@ class Zend_Gdata_Calendar_Extension_Selected extends Zend_Gdata_Extension
|
|||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,11 +84,9 @@ class Zend_Gdata_Calendar_Extension_SendEventNotifications extends Zend_Gdata_Ex
|
|||
case 'value':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_value = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
} elseif ($attribute->nodeValue == "false") {
|
||||
$this->_value = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
|
@ -127,6 +125,4 @@ class Zend_Gdata_Calendar_Extension_SendEventNotifications extends Zend_Gdata_Ex
|
|||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Timezone extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'timezone';
|
||||
protected $_value = null;
|
||||
|
@ -120,5 +119,4 @@ class Zend_Gdata_Calendar_Extension_Timezone extends Zend_Gdata_Extension
|
|||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_Extension_WebContent extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'webContent';
|
||||
protected $_url = null;
|
||||
|
@ -173,5 +172,4 @@ class Zend_Gdata_Calendar_Extension_WebContent extends Zend_Gdata_App_Extension
|
|||
$this->_width = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ require_once 'Zend/Gdata/Extension/Where.php';
|
|||
*/
|
||||
class Zend_Gdata_Calendar_ListEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
protected $_color = null;
|
||||
protected $_accessLevel = null;
|
||||
protected $_hidden = null;
|
||||
|
@ -118,32 +117,32 @@ class Zend_Gdata_Calendar_ListEntry extends Zend_Gdata_Entry
|
|||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'accesslevel';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'accesslevel':
|
||||
$accessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel();
|
||||
$accessLevel->transferFromDOM($child);
|
||||
$this->_accessLevel = $accessLevel;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'color';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'color':
|
||||
$color = new Zend_Gdata_Calendar_Extension_Color();
|
||||
$color->transferFromDOM($child);
|
||||
$this->_color = $color;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'hidden';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'hidden':
|
||||
$hidden = new Zend_Gdata_Calendar_Extension_Hidden();
|
||||
$hidden->transferFromDOM($child);
|
||||
$this->_hidden = $hidden;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'selected';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'selected':
|
||||
$selected = new Zend_Gdata_Calendar_Extension_Selected();
|
||||
$selected->transferFromDOM($child);
|
||||
$this->_selected = $selected;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone':
|
||||
$timezone = new Zend_Gdata_Calendar_Extension_Timezone();
|
||||
$timezone->transferFromDOM($child);
|
||||
$this->_timezone = $timezone;
|
||||
break;
|
||||
case $this->lookupNamespace('gd') . ':' . 'where';
|
||||
case $this->lookupNamespace('gd') . ':' . 'where':
|
||||
$where = new Zend_Gdata_Extension_Where();
|
||||
$where->transferFromDOM($child);
|
||||
$this->_where[] = $where;
|
||||
|
@ -242,5 +241,4 @@ class Zend_Gdata_Calendar_ListEntry extends Zend_Gdata_Entry
|
|||
$this->_where = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class Zend_Gdata_Calendar_ListFeed extends Zend_Gdata_Feed
|
|||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone';
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone':
|
||||
$timezone = new Zend_Gdata_Calendar_Extension_Timezone();
|
||||
$timezone->transferFromDOM($child);
|
||||
$this->_timezone = $timezone;
|
||||
|
@ -102,5 +102,4 @@ class Zend_Gdata_Calendar_ListFeed extends Zend_Gdata_Feed
|
|||
$this->_timezone = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,19 +78,23 @@ class Zend_Gdata_ClientLogin
|
|||
* @throws Zend_Gdata_App_CaptchaRequiredException
|
||||
* @return Zend_Gdata_HttpClient
|
||||
*/
|
||||
public static function getHttpClient($email, $password, $service = 'xapi',
|
||||
public static function getHttpClient(
|
||||
$email,
|
||||
$password,
|
||||
$service = 'xapi',
|
||||
$client = null,
|
||||
$source = self::DEFAULT_SOURCE,
|
||||
$loginToken = null,
|
||||
$loginCaptcha = null,
|
||||
$loginUri = self::CLIENTLOGIN_URI,
|
||||
$accountType = 'HOSTED_OR_GOOGLE')
|
||||
{
|
||||
$accountType = 'HOSTED_OR_GOOGLE'
|
||||
) {
|
||||
if (! ($email && $password)) {
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Please set your Google credentials before trying to ' .
|
||||
'authenticate');
|
||||
'authenticate'
|
||||
);
|
||||
}
|
||||
|
||||
if ($client == null) {
|
||||
|
@ -99,13 +103,15 @@ class Zend_Gdata_ClientLogin
|
|||
if (!$client instanceof Zend_Http_Client) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException(
|
||||
'Client is not an instance of Zend_Http_Client.');
|
||||
'Client is not an instance of Zend_Http_Client.'
|
||||
);
|
||||
}
|
||||
|
||||
// Build the HTTP client for authentication
|
||||
$client->setUri($loginUri);
|
||||
$useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
$client->setConfig(
|
||||
array(
|
||||
'maxredirects' => 0,
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
|
@ -117,16 +123,18 @@ class Zend_Gdata_ClientLogin
|
|||
$client->setParameterPost('service', (string) $service);
|
||||
$client->setParameterPost('source', (string) $source);
|
||||
if ($loginToken || $loginCaptcha) {
|
||||
if($loginToken && $loginCaptcha) {
|
||||
if ($loginToken && $loginCaptcha) {
|
||||
$client->setParameterPost('logintoken', (string) $loginToken);
|
||||
$client->setParameterPost('logincaptcha',
|
||||
(string) $loginCaptcha);
|
||||
}
|
||||
else {
|
||||
$client->setParameterPost(
|
||||
'logincaptcha',
|
||||
(string) $loginCaptcha
|
||||
);
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Please provide both a token ID and a user\'s response ' .
|
||||
'to the CAPTCHA challenge.');
|
||||
'to the CAPTCHA challenge.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,28 +163,27 @@ class Zend_Gdata_ClientLogin
|
|||
if ($response->getStatus() == 200) {
|
||||
$client->setClientLoginToken($goog_resp['Auth']);
|
||||
$useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
$client->setConfig(
|
||||
array(
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
);
|
||||
return $client;
|
||||
|
||||
} elseif ($response->getStatus() == 403) {
|
||||
// Check if the server asked for a CAPTCHA
|
||||
if (array_key_exists('Error', $goog_resp) &&
|
||||
$goog_resp['Error'] == 'CaptchaRequired') {
|
||||
require_once 'Zend/Gdata/App/CaptchaRequiredException.php';
|
||||
throw new Zend_Gdata_App_CaptchaRequiredException(
|
||||
$goog_resp['CaptchaToken'], $goog_resp['CaptchaUrl']);
|
||||
}
|
||||
else {
|
||||
$goog_resp['CaptchaToken'],
|
||||
$goog_resp['CaptchaUrl']
|
||||
);
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
throw new Zend_Gdata_App_AuthException('Authentication with Google failed. Reason: ' .
|
||||
(isset($goog_resp['Error']) ? $goog_resp['Error'] : 'Unspecified.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ require_once 'Zend/Gdata/Contacts/ListEntry.php';
|
|||
*/
|
||||
class Zend_Gdata_Contacts extends Zend_Gdata
|
||||
{
|
||||
|
||||
const CONTACT_FEED_URI = 'https://www.google.com/m8/feeds/contacts/default/full';
|
||||
const AUTH_SERVICE_NAME = 'cp';
|
||||
const DEFAULT_MAJOR_PROTOCOL_VERSION = 3;
|
||||
|
@ -102,7 +101,7 @@ class Zend_Gdata_Contacts extends Zend_Gdata
|
|||
$query = new Zend_Gdata_Query(self::CONTACT_FEED_URI);
|
||||
$query->maxResults = $this->maxResults;
|
||||
$query->startIndex = $this->startIndex;
|
||||
return parent::getFeed($query,'Zend_Gdata_Contacts_ListFeed');
|
||||
return parent::getFeed($query, 'Zend_Gdata_Contacts_ListFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,12 +112,12 @@ class Zend_Gdata_Contacts extends Zend_Gdata
|
|||
*/
|
||||
public function getContactEntry($entryID)
|
||||
{
|
||||
return parent::getEntry($entryID,'Zend_Gdata_Contacts_ListEntry');
|
||||
return parent::getEntry($entryID, 'Zend_Gdata_Contacts_ListEntry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the max results that the feed should return.
|
||||
*
|
||||
*
|
||||
* @param $maxResults
|
||||
* @return void
|
||||
*/
|
||||
|
@ -137,6 +136,4 @@ class Zend_Gdata_Contacts extends Zend_Gdata
|
|||
{
|
||||
$this->startIndex = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,9 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
|
||||
class Zend_Gdata_Contacts_Extension_Address extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gd';
|
||||
protected $_rootElement = 'structuredPostalAddress';
|
||||
protected $_isPrimary = FALSE;
|
||||
protected $_isPrimary = false;
|
||||
protected $_addressType = null;
|
||||
protected $_transformMapping = array('work' => 'primary', 'home' => 'alt', '' => 'primary');
|
||||
/**
|
||||
|
@ -64,8 +63,7 @@ class Zend_Gdata_Contacts_Extension_Address extends Zend_Gdata_Extension
|
|||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
|
||||
switch ($absoluteNodeName)
|
||||
{
|
||||
switch ($absoluteNodeName) {
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
|
@ -82,10 +80,11 @@ class Zend_Gdata_Contacts_Extension_Address extends Zend_Gdata_Extension
|
|||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'primary':
|
||||
if(strtolower($attribute->nodeValue) == 'true')
|
||||
$this->_isPrimary = true;
|
||||
else
|
||||
$this->_isPrimary = false;
|
||||
if (strtolower($attribute->nodeValue) == 'true') {
|
||||
$this->_isPrimary = true;
|
||||
} else {
|
||||
$this->_isPrimary = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'rel':
|
||||
|
@ -99,10 +98,11 @@ class Zend_Gdata_Contacts_Extension_Address extends Zend_Gdata_Extension
|
|||
|
||||
protected function getAddressType()
|
||||
{
|
||||
if($this->_addressType == null)
|
||||
if ($this->_addressType == null) {
|
||||
return '';
|
||||
else
|
||||
} else {
|
||||
return str_replace($this->lookupNamespace('gd') . '#', '', $this->_addressType);
|
||||
}
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
|
@ -111,10 +111,10 @@ class Zend_Gdata_Contacts_Extension_Address extends Zend_Gdata_Extension
|
|||
|
||||
$keyPrefix= $this->_transformMapping[strtolower($this->getAddressType())];
|
||||
|
||||
foreach($this->_extensionElements as $elem)
|
||||
{
|
||||
if( $elem->_rootElement == 'formattedAddress')
|
||||
foreach ($this->_extensionElements as $elem) {
|
||||
if ($elem->_rootElement == 'formattedAddress') {
|
||||
continue;
|
||||
}
|
||||
$elemKey = $elem->_rootElement == 'region' ? 'state' : $elem->_rootElement;
|
||||
$elemKey = "$keyPrefix" . "_address_" . "$elemKey";
|
||||
$results[$elemKey] = $elem->getText();
|
||||
|
@ -122,7 +122,4 @@ class Zend_Gdata_Contacts_Extension_Address extends Zend_Gdata_Extension
|
|||
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
|
||||
class Zend_Gdata_Contacts_Extension_Birthday extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gd';
|
||||
protected $_rootElement = 'birthday';
|
||||
protected $_value = null;
|
||||
|
@ -61,8 +60,7 @@ class Zend_Gdata_Contacts_Extension_Birthday extends Zend_Gdata_Extension
|
|||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName)
|
||||
{
|
||||
switch ($absoluteNodeName) {
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
|
@ -91,4 +89,3 @@ class Zend_Gdata_Contacts_Extension_Birthday extends Zend_Gdata_Extension
|
|||
return $this->_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,9 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
|
||||
class Zend_Gdata_Contacts_Extension_Email extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gd';
|
||||
protected $_rootElement = 'email';
|
||||
protected $_isPrimary = FALSE;
|
||||
protected $_isPrimary = false;
|
||||
protected $_emailType = null;
|
||||
protected $_email = null;
|
||||
/**
|
||||
|
@ -62,8 +61,7 @@ class Zend_Gdata_Contacts_Extension_Email extends Zend_Gdata_Extension
|
|||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName)
|
||||
{
|
||||
switch ($absoluteNodeName) {
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
|
@ -78,13 +76,13 @@ class Zend_Gdata_Contacts_Extension_Email extends Zend_Gdata_Extension
|
|||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'primary':
|
||||
if(strtolower($attribute->nodeValue) == 'true')
|
||||
if (strtolower($attribute->nodeValue) == 'true') {
|
||||
$this->_isPrimary = true;
|
||||
else
|
||||
} else {
|
||||
$this->_isPrimary = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'rel':
|
||||
|
@ -103,10 +101,11 @@ class Zend_Gdata_Contacts_Extension_Email extends Zend_Gdata_Extension
|
|||
|
||||
public function getEmailType()
|
||||
{
|
||||
if($this->_emailType == null)
|
||||
if ($this->_emailType == null) {
|
||||
return '';
|
||||
else
|
||||
} else {
|
||||
return str_replace($this->lookupNamespace('gd') . '#', '', $this->_emailType);
|
||||
}
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
|
@ -119,4 +118,3 @@ class Zend_Gdata_Contacts_Extension_Email extends Zend_Gdata_Extension
|
|||
return $this->_isPrimary;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
|
||||
class Zend_Gdata_Contacts_Extension_Name extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gd';
|
||||
protected $_rootElement = 'name';
|
||||
protected $_names = array('first_name' => '', 'last_name' => '', 'full_name' => '');
|
||||
|
@ -61,21 +60,20 @@ class Zend_Gdata_Contacts_Extension_Name extends Zend_Gdata_Extension
|
|||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName)
|
||||
{
|
||||
case $this->lookupNamespace('gd') . ':' . 'fullName';
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gd') . ':' . 'fullName':
|
||||
$entry = new Zend_Gdata_Entry();
|
||||
$entry->transferFromDOM($child);
|
||||
$this->_names['full_name'] = $entry->getText();
|
||||
break;
|
||||
|
||||
case $this->lookupNamespace('gd') . ':' . 'givenName';
|
||||
case $this->lookupNamespace('gd') . ':' . 'givenName':
|
||||
$entry = new Zend_Gdata_Entry();
|
||||
$entry->transferFromDOM($child);
|
||||
$this->_names['first_name'] = $entry->getText();
|
||||
break;
|
||||
|
||||
case $this->lookupNamespace('gd') . ':' . 'familyName';
|
||||
case $this->lookupNamespace('gd') . ':' . 'familyName':
|
||||
$entry = new Zend_Gdata_Entry();
|
||||
$entry->transferFromDOM($child);
|
||||
$this->_names['last_name'] = $entry->getText();
|
||||
|
@ -91,4 +89,3 @@ class Zend_Gdata_Contacts_Extension_Name extends Zend_Gdata_Extension
|
|||
return $this->_names;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
|
||||
class Zend_Gdata_Contacts_Extension_Organization extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gd';
|
||||
protected $_rootElement = 'organization';
|
||||
protected $_orgName = null;
|
||||
|
@ -64,15 +63,14 @@ class Zend_Gdata_Contacts_Extension_Organization extends Zend_Gdata_Extension
|
|||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
|
||||
switch ($absoluteNodeName)
|
||||
{
|
||||
case $this->lookupNamespace('gd') . ':' . 'orgName';
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gd') . ':' . 'orgName':
|
||||
$entry = new Zend_Gdata_Entry();
|
||||
$entry->transferFromDOM($child);
|
||||
$this->_orgName = $entry;
|
||||
break;
|
||||
|
||||
case $this->lookupNamespace('gd') . ':' . 'orgTitle';
|
||||
case $this->lookupNamespace('gd') . ':' . 'orgTitle':
|
||||
$entry = new Zend_Gdata_Entry();
|
||||
$entry->transferFromDOM($child);
|
||||
$this->_orgTitle = $entry;
|
||||
|
@ -87,21 +85,18 @@ class Zend_Gdata_Contacts_Extension_Organization extends Zend_Gdata_Extension
|
|||
|
||||
public function getOrganizationName()
|
||||
{
|
||||
if($this->_orgName != null)
|
||||
if ($this->_orgName != null) {
|
||||
return $this->_orgName->getText();
|
||||
else
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public function getOrganizationTitle()
|
||||
{
|
||||
if($this->_orgTitle != null)
|
||||
if ($this->_orgTitle != null) {
|
||||
return $this->_orgTitle->getText();
|
||||
else
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,10 +43,9 @@ require_once 'Zend/Gdata/Extension.php';
|
|||
|
||||
class Zend_Gdata_Contacts_Extension_PhoneNumber extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gd';
|
||||
protected $_rootElement = 'phoneNumber';
|
||||
protected $_isPrimaryNumber = FALSE;
|
||||
protected $_isPrimaryNumber = false;
|
||||
protected $_phoneType = 'main';
|
||||
|
||||
/**
|
||||
|
@ -62,8 +61,7 @@ class Zend_Gdata_Contacts_Extension_PhoneNumber extends Zend_Gdata_Extension
|
|||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName)
|
||||
{
|
||||
switch ($absoluteNodeName) {
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
|
@ -78,13 +76,13 @@ class Zend_Gdata_Contacts_Extension_PhoneNumber extends Zend_Gdata_Extension
|
|||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'primary':
|
||||
if(strtolower($attribute->nodeValue) == 'true')
|
||||
if (strtolower($attribute->nodeValue) == 'true') {
|
||||
$this->_isPrimaryNumber = true;
|
||||
else
|
||||
} else {
|
||||
$this->_isPrimaryNumber = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'rel':
|
||||
|
@ -112,4 +110,3 @@ class Zend_Gdata_Contacts_Extension_PhoneNumber extends Zend_Gdata_Extension
|
|||
return $this->_isPrimaryNumber;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,6 @@ require_once 'Zend/Gdata/Extension/Where.php';
|
|||
*/
|
||||
class Zend_Gdata_Contacts_ListEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
protected $_names = null;
|
||||
protected $_birthday = null;
|
||||
protected $_phones = array();
|
||||
|
@ -111,37 +110,37 @@ class Zend_Gdata_Contacts_ListEntry extends Zend_Gdata_Entry
|
|||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
|
||||
case $this->lookupNamespace('gd') . ':' . 'name';
|
||||
case $this->lookupNamespace('gd') . ':' . 'name':
|
||||
$item = new Zend_Gdata_Contacts_Extension_Name();
|
||||
$item->transferFromDOM($child);
|
||||
$this->_names = $item;
|
||||
break;
|
||||
|
||||
case $this->lookupNamespace('gContact') . ':' . 'birthday';
|
||||
case $this->lookupNamespace('gContact') . ':' . 'birthday':
|
||||
$item = new Zend_Gdata_Contacts_Extension_Birthday();
|
||||
$item->transferFromDOM($child);
|
||||
$this->_birthday = $item;
|
||||
break;
|
||||
|
||||
case $this->lookupNamespace('gd') . ':' . 'phoneNumber';
|
||||
case $this->lookupNamespace('gd') . ':' . 'phoneNumber':
|
||||
$item = new Zend_Gdata_Contacts_Extension_PhoneNumber();
|
||||
$item->transferFromDOM($child);
|
||||
$this->_phones[] = $item;
|
||||
break;
|
||||
|
||||
case $this->lookupNamespace('gd') . ':' . 'email';
|
||||
case $this->lookupNamespace('gd') . ':' . 'email':
|
||||
$item = new Zend_Gdata_Contacts_Extension_Email();
|
||||
$item->transferFromDOM($child);
|
||||
$this->_emails[] = $item;
|
||||
break;
|
||||
|
||||
case $this->lookupNamespace('gd') . ':' . 'structuredPostalAddress';
|
||||
case $this->lookupNamespace('gd') . ':' . 'structuredPostalAddress':
|
||||
$item = new Zend_Gdata_Contacts_Extension_Address();
|
||||
$item->transferFromDOM($child);
|
||||
$this->_addresses[] = $item;
|
||||
break;
|
||||
|
||||
case $this->lookupNamespace('gd') . ':' . 'organization';
|
||||
case $this->lookupNamespace('gd') . ':' . 'organization':
|
||||
$item = new Zend_Gdata_Contacts_Extension_Organization();
|
||||
$item->transferFromDOM($child);
|
||||
$this->_organization = $item;
|
||||
|
@ -162,48 +161,46 @@ class Zend_Gdata_Contacts_ListEntry extends Zend_Gdata_Entry
|
|||
'team_name' => '', 'assigned_user_name' => ''
|
||||
);
|
||||
|
||||
if($this->_names != null)
|
||||
$entry = array_merge($entry, $this->_names->toArray() );
|
||||
if ($this->_names != null) {
|
||||
$entry = array_merge($entry, $this->_names->toArray());
|
||||
}
|
||||
|
||||
//Get the self link so we can query for the contact details at a later date
|
||||
foreach($this->_link as $linkEntry)
|
||||
{
|
||||
foreach ($this->_link as $linkEntry) {
|
||||
$linkRel = $linkEntry->getRel();
|
||||
if( $linkRel != null && $linkRel == "self" )
|
||||
{
|
||||
if ($linkRel != null && $linkRel == "self") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//Get addresses
|
||||
foreach($this->_addresses as $address)
|
||||
{
|
||||
$entry = array_merge($entry, $address->toArray() );
|
||||
foreach ($this->_addresses as $address) {
|
||||
$entry = array_merge($entry, $address->toArray());
|
||||
}
|
||||
//Process phones
|
||||
foreach($this->_phones as $phoneEntry)
|
||||
{
|
||||
foreach ($this->_phones as $phoneEntry) {
|
||||
$key = "phone_" . $phoneEntry->getPhoneType();
|
||||
$entry[$key] = $phoneEntry->getNumber();
|
||||
}
|
||||
|
||||
//Process emails
|
||||
$entry = array_merge($entry, $this->getEmailAddresses() );
|
||||
$entry = array_merge($entry, $this->getEmailAddresses());
|
||||
|
||||
//Get Notes
|
||||
if($this->_content != null)
|
||||
if ($this->_content != null) {
|
||||
$entry['notes'] = $this->getContent()->getText();
|
||||
}
|
||||
|
||||
//ID
|
||||
$entry['id'] = $this->getId()->getText();
|
||||
|
||||
//Birthday
|
||||
if($this->_birthday != null)
|
||||
if ($this->_birthday != null) {
|
||||
$entry['birthday'] = $this->_birthday->getBirthday();
|
||||
}
|
||||
|
||||
//Organization name and title
|
||||
if($this->_organization != null)
|
||||
{
|
||||
if ($this->_organization != null) {
|
||||
$entry['account_name'] = $this->_organization->getOrganizationName();
|
||||
$entry['title'] = $this->_organization->getOrganizationTitle();
|
||||
}
|
||||
|
@ -215,42 +212,40 @@ class Zend_Gdata_Contacts_ListEntry extends Zend_Gdata_Entry
|
|||
{
|
||||
$results = array();
|
||||
$primaryEmail = $this->getPrimaryEmail();
|
||||
if($primaryEmail !== FALSE)
|
||||
if ($primaryEmail !== false) {
|
||||
$results['email1'] = $primaryEmail;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$nonPrimaryEmail = $this->getNextNonPrimaryEmail();
|
||||
if($nonPrimaryEmail !== FALSE)
|
||||
if ($nonPrimaryEmail !== false) {
|
||||
$results['email1'] = $nonPrimaryEmail;
|
||||
else
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
$secondaryEmail = $this->getNextNonPrimaryEmail();
|
||||
if($secondaryEmail !== FALSE)
|
||||
if ($secondaryEmail !== false) {
|
||||
$results['email2'] = $secondaryEmail;
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
||||
}
|
||||
protected function getPrimaryEmail()
|
||||
{
|
||||
$results = FALSE;
|
||||
foreach($this->_emails as $emailEntry)
|
||||
{
|
||||
if( $emailEntry->isPrimary() )
|
||||
$results = false;
|
||||
foreach ($this->_emails as $emailEntry) {
|
||||
if ($emailEntry->isPrimary()) {
|
||||
return $emailEntry->getEmail();
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
protected function getNextNonPrimaryEmail()
|
||||
{
|
||||
$results = FALSE;
|
||||
foreach($this->_emails as $k => $emailEntry)
|
||||
{
|
||||
if( !$emailEntry->isPrimary() )
|
||||
{
|
||||
$results = false;
|
||||
foreach ($this->_emails as $k => $emailEntry) {
|
||||
if (!$emailEntry->isPrimary()) {
|
||||
$results = $emailEntry->getEmail();
|
||||
unset($this->_emails[$k]);
|
||||
return $results;
|
||||
|
@ -258,5 +253,4 @@ class Zend_Gdata_Contacts_ListEntry extends Zend_Gdata_Entry
|
|||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
/**
|
||||
* Modifications by SugarCRM
|
||||
*
|
||||
*
|
||||
* April 12, 2011 - asandberg: Changed mime-type for jpg files to image/jpeg
|
||||
* March 14, 2011 - asandberg: Added support for Google API v3: http://code.google.com/p/gdata-samples/source/browse/trunk/doclist/OCRDemo/DocsBeta.php
|
||||
* March 10, 2011 - asandberg: Added getSupportedMimeTypes function
|
||||
|
@ -56,7 +56,6 @@ require_once 'Zend/Gdata/Docs/DocumentListEntry.php';
|
|||
*/
|
||||
class Zend_Gdata_Docs extends Zend_Gdata
|
||||
{
|
||||
|
||||
const DOCUMENTS_LIST_FEED_URI = 'https://docs.google.com/feeds/default/private/full';
|
||||
const AUTH_SERVICE_NAME = 'writely';
|
||||
const DEFAULT_MAJOR_PROTOCOL_VERSION = 3;
|
||||
|
@ -123,8 +122,9 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* @return string The mime type to be sent to the server to tell it how the
|
||||
* multipart mime data should be interpreted.
|
||||
*/
|
||||
public static function lookupMimeType($fileExtension) {
|
||||
return self::$SUPPORTED_FILETYPES[strtoupper($fileExtension)];
|
||||
public static function lookupMimeType($fileExtension)
|
||||
{
|
||||
return self::$SUPPORTED_FILETYPES[strtoupper($fileExtension)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,7 +137,7 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
{
|
||||
if ($location === null) {
|
||||
$uri = self::DOCUMENTS_LIST_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
|
@ -156,8 +156,9 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
if ($location === null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Location must not be null');
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
'Location must not be null'
|
||||
);
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
|
@ -173,9 +174,10 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* pdf:asdf89hfjjddfg
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
public function getResource($resourceId) {
|
||||
$uri = 'https://docs.google.com/feeds/documents/private/full/' . $resourceId;
|
||||
return $this->getDocumentListEntry($uri);
|
||||
public function getResource($resourceId)
|
||||
{
|
||||
$uri = 'https://docs.google.com/feeds/documents/private/full/' . $resourceId;
|
||||
return $this->getDocumentListEntry($uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,7 +192,8 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
* @deprecated Use getResource($resourceId) instead.
|
||||
*/
|
||||
public function getDoc($docId, $docType) {
|
||||
public function getDoc($docId, $docType)
|
||||
{
|
||||
$location = 'https://docs.google.com/feeds/documents/private/full/' .
|
||||
$docType . '%3A' . $docId;
|
||||
return $this->getDocumentListEntry($location);
|
||||
|
@ -203,7 +206,8 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* dcmg89gw_62hfjj8m
|
||||
* @deprecated Use getResource($resourceId) instead.
|
||||
*/
|
||||
public function getDocument($id) {
|
||||
public function getDocument($id)
|
||||
{
|
||||
return $this->getDoc('document%3A' . $id);
|
||||
}
|
||||
|
||||
|
@ -214,7 +218,8 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* pKq0CzjiF3YmGd0AIlHKqeg
|
||||
* @deprecated Use getResource($resourceId) instead.
|
||||
*/
|
||||
public function getSpreadsheet($id) {
|
||||
public function getSpreadsheet($id)
|
||||
{
|
||||
return $this->getDoc('spreadsheet%3A' . $id);
|
||||
}
|
||||
|
||||
|
@ -225,7 +230,8 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* dcmg89gw_21gtrjcn
|
||||
* @deprecated Use getResource($resourceId) instead.
|
||||
*/
|
||||
public function getPresentation($id) {
|
||||
public function getPresentation($id)
|
||||
{
|
||||
return $this->getDoc('presentation%3A' . $id);
|
||||
}
|
||||
|
||||
|
@ -251,9 +257,12 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* @return Zend_Gdata_Docs_DocumentListEntry The entry for the newly
|
||||
* created Google Document.
|
||||
*/
|
||||
public function uploadFile($fileLocation, $title=null, $mimeType=null,
|
||||
$uri=null)
|
||||
{
|
||||
public function uploadFile(
|
||||
$fileLocation,
|
||||
$title=null,
|
||||
$mimeType=null,
|
||||
$uri=null
|
||||
) {
|
||||
// Set the URI to which the file will be uploaded.
|
||||
if ($uri === null) {
|
||||
$uri = $this->_defaultPostUri;
|
||||
|
@ -274,10 +283,10 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
|
||||
// Set the mime type of the data.
|
||||
if ($mimeType === null) {
|
||||
$slugHeader = $fs->getSlug();
|
||||
$filenameParts = explode('.', $slugHeader);
|
||||
$fileExtension = end($filenameParts);
|
||||
$mimeType = self::lookupMimeType($fileExtension);
|
||||
$slugHeader = $fs->getSlug();
|
||||
$filenameParts = explode('.', $slugHeader);
|
||||
$fileExtension = end($filenameParts);
|
||||
$mimeType = self::lookupMimeType($fileExtension);
|
||||
}
|
||||
|
||||
// Set the mime type for the upload request.
|
||||
|
@ -300,9 +309,11 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* @return Zend_Gdata_Docs_DocumentListEntry The entry returned by the
|
||||
* service after insertion.
|
||||
*/
|
||||
public function insertDocument($data, $uri,
|
||||
$className='Zend_Gdata_Docs_DocumentListEntry')
|
||||
{
|
||||
public function insertDocument(
|
||||
$data,
|
||||
$uri,
|
||||
$className='Zend_Gdata_Docs_DocumentListEntry'
|
||||
) {
|
||||
return $this->insertEntry($data, $uri, $className);
|
||||
}
|
||||
|
||||
|
@ -312,8 +323,8 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
|||
* @return array
|
||||
* @author Andreas Sandberg
|
||||
*/
|
||||
public static function getSupportedMimeTypes() {
|
||||
return self::$SUPPORTED_FILETYPES;
|
||||
public static function getSupportedMimeTypes()
|
||||
{
|
||||
return self::$SUPPORTED_FILETYPES;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,5 +50,4 @@ class Zend_Gdata_Docs_DocumentListEntry extends Zend_Gdata_Entry
|
|||
$this->registerAllNamespaces(Zend_Gdata_Docs::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,5 +64,4 @@ class Zend_Gdata_Docs_DocumentListFeed extends Zend_Gdata_Feed
|
|||
$this->registerAllNamespaces(Zend_Gdata_Docs::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
/**
|
||||
* Modifications by SugarCRM
|
||||
*
|
||||
*
|
||||
* March 14, 2011 - asandberg: Changed DOCUMENTS_LIST_FEED_URI to work with v3 of Docs API.
|
||||
*/
|
||||
|
||||
|
@ -210,7 +210,8 @@ class Zend_Gdata_Docs_Query extends Zend_Gdata_Query
|
|||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'A visibility must be provided for cell queries.');
|
||||
'A visibility must be provided for cell queries.'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->_projection !== null) {
|
||||
|
@ -218,11 +219,11 @@ class Zend_Gdata_Docs_Query extends Zend_Gdata_Query
|
|||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'A projection must be provided for cell queries.');
|
||||
'A projection must be provided for cell queries.'
|
||||
);
|
||||
}
|
||||
|
||||
$uri .= $this->getQueryString();
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue