diff options
author | Christian Helbling | 2015-11-16 15:20:03 +0100 |
---|---|---|
committer | Christian Helbling | 2015-11-16 15:20:03 +0100 |
commit | 2587921cdf5f9139c6f2483dddb12df27740fef5 (patch) | |
tree | b67941b93eda2490800efafd1f5410bdd754bf16 /it.class | |
parent | babb09e211e93c6236bc19e60a4f649e573a6f4e (diff) | |
parent | 3b4aeabd9186666e025d3233f06f7458356bfc37 (diff) | |
download | itools-2587921cdf5f9139c6f2483dddb12df27740fef5.tar.gz itools-2587921cdf5f9139c6f2483dddb12df27740fef5.tar.bz2 itools-2587921cdf5f9139c6f2483dddb12df27740fef5.zip |
Merge branch 'master' into cs/php7
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -144,7 +144,7 @@ static function error($p = array()) 'to' => $gods ? $gods : (get_current_user() ? get_current_user() : $_SERVER['SERVER_ADMIN']), 'graceperiod' => 60, 'timewindow' => 25*3600, - 'backtraceskip' => 0, + 'backtraceskip' => 1, 'blockmail' => 3600, 'omitdebuginfo' => false, 'failcount' => 2, @@ -169,7 +169,7 @@ static function error($p = array()) if ($toscreen && !it::is_live()) $GLOBALS['debug_noredir'] = 1; - if (!$toscreen) # this error can only be sent by mail: find out if we want to suppress it + if (error_reporting() && !$toscreen) # not called with @ and this error can only be sent by mail: find out if we want to suppress it { if (!$p['id']) $sendmail = true; @@ -204,6 +204,7 @@ static function error($p = array()) { $trace = it_debug::backtrace(array('skiplevels' => $p['backtraceskip'], 'skipfiles' => $p['skipfiles'])); # moved in here for performance in mass error case + $p['body'] = is_string($p['body']) || !$p['body'] ? $p['body'] : var_export($p['body'], true); if (strlen($p['body']) > 500000) { file_put_contents($datafn = "/tmp/alertdata/error-" . substr(md5($p['body']), 0, 2), $p['body']); @@ -651,6 +652,7 @@ static function cdist(/* $file1, ... */) * @param $p['types'] Comma separated list of accepted input types, default "bmp,eps,gif,jp2,jpg,png,svg,tif" * @param $p['quality'] JPEG quality (0-100), default is 75 * @param $p['keepalpha'] Don't add option --flatten to preserve alpha channel + * @param $p['pngcrush'] Use pngcrush for sm * @param $p['-opts'] Custom command line options to ImageMagick convert * @return Success of convert as true/false */ @@ -692,6 +694,9 @@ static function imageconvert($p) if (in_array($type, explode(',', $p['types']))) # Valid type? $cmdoutput = it::exec('( ' . $ultratimeout . 'gm convert 2>&1 {-opts} {in} {type}:{out} || echo "SHELL ERROR $?" ) | grep -v " iCCP: "', $p); + if ($p['pngcrush'] && $p['type'] == "png") + it::exec('pngcrush.sh 2>/dev/null {out} {out}.tmp && mv {out}.tmp {out} || rm {out}.tmp', $p); + return $cmdoutput === ""; } @@ -1025,5 +1030,12 @@ static function json_decode($json) return ($data = json_decode($json)) === null && $json != 'null' ? it::error(array('title' => "invalid json", 'body' => $json)) : $data; } +static function sort($array, $mode = "") +{ + $func = it::replace(array('n' => ""), count_chars($mode, 3)) . "sort"; # count_chars sorts flags + $func($array, it::match('n', $mode) ? SORT_NUMERIC : 0); + + return $array; +} + } -?> |