Merge branch 'master' of github.com:EGroupware/egroupware

This commit is contained in:
nathangray 2017-06-07 13:26:36 -06:00
commit 4f59bc2ccf
12 changed files with 81 additions and 17 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/php -qC
#!/usr/bin/env php
<?php
/**
* Admin - Command line interface

View File

@ -127,7 +127,7 @@ class admin_customfields
{
// determine appname
$this->appname = $this->appname ? $this->appname : ($_GET['appname'] ? $_GET['appname'] : ($content['appname'] ? $content['appname'] : false));
if(!$this->appname) die(lang('Error! No appname found'));
if(!$this->appname || !Api\Link::get_registry($this->appname, 'title')) die(lang('Error! No appname found'));
$this->use_private = !isset($_GET['use_private']) || (boolean)$_GET['use_private'] || $content['use_private'];

View File

@ -48,6 +48,11 @@ var et2_customfields_list = (function(){ "use strict"; return et2_valueWidget.ex
'private': {
ignore: true,
type: 'boolean'
},
'sub_app': {
'name': 'sub app name',
'type': "string",
'description': "Name of sub application"
}
},

View File

@ -126,6 +126,7 @@ class Customfields extends Transformer
if(!$app)
{
$app =& $this->setElementAttribute(self::GLOBAL_VALS, 'app', $GLOBALS['egw_info']['flags']['currentapp']);
if ($this->attrs['sub-app']) $app .= '-'.$this->attrs['sub-app'];
$customfields =& $this->setElementAttribute(self::GLOBAL_VALS, 'customfields', Api\Storage\Customfields::get($app));
}
@ -283,7 +284,7 @@ class Customfields extends Transformer
$widget->id = self::$prefix.$fname;
$widget->attrs['type'] = $type;
$widget->set_attrs($xml);
// some type-specific (default) attributes
switch($type)
{
@ -402,7 +403,7 @@ class Customfields extends Transformer
// Arrays are not valid, but leave filemanager alone, we'll catch it
// when saving. This allows files for new entries.
if (is_array($valid) && $field_settings['type'] !== 'filemanager') $valid = implode(',', $valid);
// NULL is valid for most fields, but not custom fields due to backend handling
// See so_sql_cf->save()
if (is_null($valid)) $valid = false;

View File

@ -6997,6 +6997,54 @@ class Mail
fclose($message);
}
/**
* Check and fix headers of raw message for headers with line width
* more than 998 chars per line, as none folding long headers might
* break the mail content. RFC 2822 (2.2.3 Long Header fields)
* https://www.ietf.org/rfc/rfc2822.txt
*
* @param string|resource $message
* @return string
*/
static private function _checkAndfixLongHeaderFields($message)
{
$eol = Horde_Mime_Part::RFC_EOL.Horde_Mime_Part::RFC_EOL;
$needsFix = false;
if (is_resource($message))
{
fseek($message, 0, SEEK_SET);
$m = '';
while (!feof($message)) {
$m .= fread($message, 8192);
}
$message = $m;
}
if (is_string($message))
{
$start = substr($message,0, strpos($message, $eol));
$body = substr($message, strlen($start));
$hlength = strpos($start, $eol) ? strpos($start, $eol) : strlen($start);
$headers = Horde_Mime_Headers::parseHeaders(substr($start, 0,$hlength));
foreach($headers->toArray() as $header => $value)
{
$needsReplacement = false;
foreach((array)$value as &$val)
{
if (strlen($val) > 998)
{
$needsReplacement = $needsFix = true;
}
}
if ($needsReplacement) {
$headers->removeHeader($header);
$headers->addHeader($header, $value);
}
}
}
return $needsFix ? ($headers->toString(array('canonical'=>true)).$body) : $message;
}
/**
* Parses a message/rfc mail from file to the mailobject
*
@ -7009,6 +7057,9 @@ class Mail
{
if (is_string($message) || is_resource($message))
{
// Check and fix long header fields
$message = self::_checkAndfixLongHeaderFields($message);
$structure = Horde_Mime_Part::parseMessage($message);
//error_log(__METHOD__.__LINE__.'#'.$structure->getPrimaryType().'#');
if ($force8bitOnPrimaryPart&&$structure->getPrimaryType()=='text')

View File

@ -1,4 +1,4 @@
#!/usr/bin/env php -qC
#!/usr/bin/env php
<?php
/**
* EGroupware - check namespace usage in converted code

View File

@ -1,4 +1,4 @@
#!/usr/bin/env php -qC
#!/usr/bin/env php
<?php
/**
* EGroupware - check namespace usage in converted code

View File

@ -1,4 +1,4 @@
#!/usr/bin/env php -dapc.enable_cli=1
#!/usr/bin/env php
<?php
/**
* EGroupware Test Runner
@ -12,6 +12,8 @@ if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-pag
die('<h1>test-cli.php must NOT be called as web-page --> exiting !!!</h1>');
}
ini_set('apc.enable_cli', true);
require_once dirname(__DIR__).'/api/src/loader/common.php';
$_SERVER['argv'][] = '--verbose';

View File

@ -1,4 +1,4 @@
#!/usr/bin/env php -qC
#!/usr/bin/env php
<?php
/**
* EGroupware Filemanager - Command line interface
@ -94,6 +94,11 @@ while(!is_null($option = array_shift($args)))
{
if ($option == '-' || $option[0] != '-') // no option --> argument
{
// remove quotes from arguments
if (in_array($option[0], array('"', "'")) && $option[0] == substr($option, -1))
{
$option = substr($option, 1, -1);
}
$argv[] = $option;
continue;
}
@ -297,8 +302,8 @@ switch($cmd)
{
$url = array_shift($argv);
load_wrapper($url);
echo "$cmd $url (long=".(int)$long.", numeric=".(int)$numeric.", recursive=".(int)$recursive.")\n";
if (strpos($url, '://')) load_wrapper($url);
echo "$cmd $url (long=".(int)$long.", numeric=".(int)$numeric.", recursive=".(int)$recursive.") ".implode(' ', $argv)."\n";
switch($cmd)
{
@ -341,8 +346,8 @@ switch($cmd)
{
$mode = $url; // first param is mode
$url = array_shift($argv);
load_wrapper($url); // not loaded because mode was in url
}
if (Vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url); // cant use stat or Vfs::mode2int otherwise!
if (strpos($mode,'+') !== false || strpos($mode,'-') !== false)
{
@ -367,7 +372,7 @@ switch($cmd)
{
$owner = $url; // first param is owner/group
$url = array_shift($argv);
if (Vfs::parse_url($url,PHP_URL_SCHEME)) load_wrapper($url); // we need the header loaded
load_wrapper($url); // not loaded because owner/group was in url
if ($owner == 'root')
{
$owner = 0;
@ -559,7 +564,7 @@ function load_egw($user,$passwd,$domain='default')
}
$cmd = $GLOBALS['cmd'];
if (!in_array($cmd,array('ls','find','mount','umount','eacl')) && $GLOBALS['egw_info']['server']['files_dir'] && !is_writable($GLOBALS['egw_info']['server']['files_dir']))
if (!in_array($cmd,array('ls','find','mount','umount','eacl','touch','chmod','chown','chgrp')) && $GLOBALS['egw_info']['server']['files_dir'] && !is_writable($GLOBALS['egw_info']['server']['files_dir']))
{
echo "\nError: eGroupWare's files directory {$GLOBALS['egw_info']['server']['files_dir']} is NOT writable by the user running ".basename(__FILE__)."!\n".
"--> Please run it as the same user the webserver uses or root, otherwise the $cmd command will fail!\n\n";

View File

@ -921,7 +921,7 @@ class mail_ui
), 'move');
break;
case 'ham':
if ($ham)
if (isset($this->mail_bo->icServer->acc_folder_ham) && !isset($this->mail_bo->icServer->acc_spam_api))
{
$this->ajax_copyMessages($ham, array(
'all' => false,

View File

@ -5498,7 +5498,7 @@ app.classes.mail = AppJS.extend(
}
var data = egw.dataGetUIDdata(id);
var fromaddress = data.data.fromaddress.match(/<([^\'\" <>]+)>$/);
var email = fromaddress[1]?fromaddress[1]:fromaddress;
var email = (fromaddress && fromaddress[1])?fromaddress[1]:data.data.fromaddress;
var domain = '@'+email.split('@')[1];
this.egw.json('mail.mail_ui.ajax_spamAction', [
_action.id,
@ -5516,7 +5516,7 @@ app.classes.mail = AppJS.extend(
var id = _sender[0].id;
var data = egw.dataGetUIDdata(id);
var fromaddress = data.data.fromaddress.match(/<([^\'\" <>]+)>$/);
var email = fromaddress[1]?fromaddress[1]:fromaddress;
var email = (fromaddress && fromaddress[1]) ?fromaddress[1]:data.data.fromaddress;
var domain = email.split('@')[1];
switch (_action.id)
{

View File

@ -1,4 +1,4 @@
#!/usr/bin/env php -qC
#!/usr/bin/env php
<?php
/**
* Setup - Command line interface