added dynamic email helper fields to the global settings of all components that use the email helper class

This commit is contained in:
2016-12-22 23:32:13 +02:00
parent 0cd5660141
commit 829384a56b
382 changed files with 1919 additions and 1347 deletions

View File

@@ -96,6 +96,11 @@ class Dropbox
* the error messages
*/
public $error_summary = array();
/**
* force the update to reset
**/
public $forceReset = false;
/**
* Constructor
@@ -116,6 +121,7 @@ class Dropbox
* =============
* $details
* =============
* sourceID
* dropboxOption
* dropboxTarget
* addTypes
@@ -217,16 +223,20 @@ class Dropbox
protected function makeGetCall()
{
$query = json_encode($this->query);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n".
"Authorization: Bearer ".$this->oauthToken,
'method' => "POST",
'content' => $query
),
);
'method' => "POST"
),
);
if ($this->checkArray($this->query))
{
$this->query = json_encode($this->query);
}
$options['http']['content'] = $this->query;
$context = stream_context_create($options);
$response = file_get_contents($this->url.$this->domainpath[$this->type], false, $context);
@@ -246,8 +256,6 @@ class Dropbox
protected function makeCurlCall()
{
$query = json_encode($this->query);
$headers = array('Authorization: Bearer '. $this->oauthToken,
'Content-Type: application/json'
);
@@ -255,7 +263,12 @@ class Dropbox
$ch = curl_init($this->url.$this->domainpath[$this->type]);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
// check if query is set
if ($this->checkArray($this->query))
{
$this->query = json_encode($this->query);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->query);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_VERBOSE, 1); // debug
@@ -278,6 +291,7 @@ class Dropbox
if (isset($data->error_summary))
{
$this->error_summary[] = $data->error_summary;
$this->forceReset = true;
return false;
}
@@ -330,6 +344,7 @@ class Dropbox
$this->error_summary[] = $this->type.'_error';
break;
}
$this->forceReset = true;
return false;
}
@@ -338,13 +353,14 @@ class Dropbox
// we need to store the url to DB
if (isset($this->mediaData[$path]))
{
$localListing = array();
$localListing['id'] = 0;
$localListing['name'] = $this->mediaData[$path]['name'];
$localListing['size'] = $this->mediaData[$path]['size'];
$localListing['key'] = $path;
$localListing['url'] = $url;
$localListing['build'] = $this->build;
$localListing = array();
$localListing['id'] = 0;
$localListing['name'] = $this->mediaData[$path]['name'];
$localListing['size'] = $this->mediaData[$path]['size'];
$localListing['key'] = $path;
$localListing['url'] = $url;
$localListing['build'] = $this->build;
$localListing['external_source'] = (int) $this->sourceID;
// free some memory
unset($this->mediaData[$path]);
// check if item already set

View File

@@ -69,11 +69,6 @@ class Dropboxupdater
protected $updateInfo;
protected $infoFilePath;
/**
* get the localkey
**/
protected $localkey = false;
/**
* Main dropbox class
**/
@@ -302,6 +297,8 @@ class Dropboxupdater
{
// reset config
$this->detailsConfig = array();
// the source ID
$this->detailsConfig['sourceID'] = $this->data->id;
// get the legal files set
$this->detailsConfig['addTypes'] = $this->data->filetypes;
// set other config settings
@@ -348,7 +345,7 @@ class Dropboxupdater
protected function setUpdateInfoData()
{
// set the info file name
$fileName = md5($this->fileKey.'info'.$this->localkey);
$fileName = md5($this->fileKey.'info');
// set file path
$this->infoFilePath = JPATH_COMPONENT_SITE.'/helpers/'.$fileName.'.json';
@@ -402,7 +399,7 @@ class Dropboxupdater
protected function doUpdate()
{
// we need more then the normal time to run this script 5 minutes at least.
ini_set('max_execution_time', 500);
ini_set('max_execution_time', $this->app_params->get('max_execution_time', 500));
// get data of all the shared links of all target items
if (!$this->dropbox->getFiles($this->data->oauthtoken, $this->data->permissiontype, $this->detailsConfig))
{
@@ -412,23 +409,23 @@ class Dropboxupdater
// if this is a manual update, then revoke the token
if ($this->forceUpdate)
{
$this->dropbox->revokeToken($this->data->oauthtoken);
$this->dropbox->revokeToken();
}
return true;
}
protected function resetUpdate()
public function resetUpdate()
{
if ($this->okay)
if ($this->okay || (isset($this->dropbox->forceReset) && $this->dropbox->forceReset))
{
// make sure the update reset
$this->updateInfo->nextupdate = $this->next;
$this->updateInfo->updateactive = false;
$this->updateInfo->updatenow = false;
return $this->saveUpdateInfo();
// store final update
$this->saveUpdateInfo();
}
return false;
return $this->okay;
}
protected function saveJson($data,$filename)