PHP Files translated to english

This commit is contained in:
2016-11-29 15:24:22 +01:00
parent 9ff00b0f60
commit 244883d942
15 changed files with 1621 additions and 1228 deletions

View File

@@ -1,7 +1,7 @@
<?php
/**
* download.php, zarafa contact to vcf im/exporter
* download.php, Kopano Webapp contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas
@@ -25,7 +25,6 @@ class DownloadHandler
{
/**
* Download the given vcf file.
* @return bool
*/
public static function doDownload()
{

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?php
/**
* plugin.contactimporter.php, zarafa contact to vcf im/exporter
* plugin.contactimporter.php, Kopano Webapp contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas
@@ -30,63 +30,63 @@ require_once __DIR__ . "/download.php";
*/
class Plugincontactimporter extends Plugin
{
/**
* Constructor
*/
function __construct() {}
/**
* Constructor
*/
function __construct()
{
}
/**
* Function initializes the Plugin and registers all hooks
*
* @return void
*/
function init()
{
$this->registerHook('server.core.settings.init.before');
$this->registerHook('server.index.load.custom');
}
/**
* Function initializes the Plugin and registers all hooks
*
* @return void
*/
function init()
{
$this->registerHook('server.core.settings.init.before');
$this->registerHook('server.index.load.custom');
}
/**
* Function is executed when a hook is triggered by the PluginManager
*
* @param string $eventID the id of the triggered hook
* @param mixed $data object(s) related to the hook
* @return void
*/
function execute($eventID, &$data)
{
switch ($eventID) {
case 'server.core.settings.init.before' :
$this->injectPluginSettings($data);
break;
case 'server.index.load.custom':
if ($data['name'] == 'download_vcf') {
DownloadHandler::doDownload();
}
break;
}
}
/**
* Function is executed when a hook is triggered by the PluginManager
*
* @param string $eventID the id of the triggered hook
* @param mixed $data object(s) related to the hook
* @return void
*/
function execute($eventID, &$data)
{
switch ($eventID) {
case 'server.core.settings.init.before' :
$this->injectPluginSettings($data);
break;
case 'server.index.load.custom':
if ($data['name'] == 'download_vcf') {
DownloadHandler::doDownload();
}
break;
}
}
/**
* Called when the core Settings class is initialized and ready to accept sysadmin default
* settings.
* @param Array $data Reference to the data of the triggered hook
*/
function injectPluginSettings(&$data)
{
$data['settingsObj']->addSysAdminDefaults(Array(
'zarafa' => Array(
'v1' => Array(
'plugins' => Array(
'contactimporter' => Array(
'enable' => PLUGIN_CONTACTIMPORTER_USER_DEFAULT_ENABLE,
'default_addressbook' => PLUGIN_CONTACTIMPORTER_DEFAULT
)
)
)
)
));
}
}
?>
/**
* Called when the core Settings class is initialized and ready to accept sysadmin default
* settings.
* @param [] $data Reference to the data of the triggered hook
*/
function injectPluginSettings(&$data)
{
$data['settingsObj']->addSysAdminDefaults(Array(
'zarafa' => Array(
'v1' => Array(
'plugins' => Array(
'contactimporter' => Array(
'enable' => PLUGIN_CONTACTIMPORTER_USER_DEFAULT_ENABLE,
'default_addressbook' => PLUGIN_CONTACTIMPORTER_DEFAULT
)
)
)
)
));
}
}

View File

@@ -1,6 +1,6 @@
<?php
/**
* upload.php, zarafa contact to vcf im/exporter
* upload.php, Kopano Webapp contact to vcf im/exporter
*
* Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas
@@ -32,7 +32,7 @@ ini_set('display_errors', '0');
*/
function respondJSON($arr)
{
echo json_encode($arr);
echo json_encode($arr);
}
/**
@@ -42,33 +42,33 @@ function respondJSON($arr)
*/
function randomstring($length = 6)
{
// $chars - all allowed charakters
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
// $chars - all allowed charakters
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
srand((double)microtime() * 1000000);
$i = 0;
$pass = "";
while ($i < $length) {
$num = rand() % strlen($chars);
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
srand((double)microtime() * 1000000);
$i = 0;
$pass = "";
while ($i < $length) {
$num = rand() % strlen($chars);
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$destpath = PLUGIN_CONTACTIMPORTER_TMP_UPLOAD;
$destpath .= $_FILES['vcfdata']['name'] . randomstring();
if (is_readable($_FILES['vcfdata']['tmp_name'])) {
$result = move_uploaded_file($_FILES['vcfdata']['tmp_name'], $destpath);
$result = move_uploaded_file($_FILES['vcfdata']['tmp_name'], $destpath);
if ($result) {
respondJSON(array('success' => true, 'vcf_file' => $destpath));
} else {
respondJSON(array('success' => false, 'error' => "File could not be moved to TMP path! Check plugin config and folder permissions!"));
}
if ($result) {
respondJSON(array('success' => true, 'vcf_file' => $destpath));
} else {
respondJSON(array('success' => false, 'error' => dgettext("plugin_contactimporter", "File could not be moved to TMP path! Check plugin config and folder permissions!")));
}
} else {
respondJSON(array('success' => false, 'error' => "File could not be read by server, upload error!"));
respondJSON(array('success' => false, 'error' => dgettext("plugin_contactimporter", "File could not be read by server, upload error!")));
}
?>