示例#1
0
 public function entryPostEdit($context)
 {
     $section = $context['section'];
     $errors = Administration::instance()->Page->_errors;
     $isReturn = isset($_POST['fields']['save-and-return-h']) && strlen($_POST['fields']['save-and-return-h']) > 1;
     $isNew = isset($_POST['fields']['save-and-new-h']) && strlen($_POST['fields']['save-and-new-h']) > 1;
     // if save returned no errors and return or new button was hit
     if (($isReturn || $isNew) && count($errors) < 1) {
         try {
             redirect(vsprintf($this->getPath($isNew), array(SYMPHONY_URL, $section->get('handle'))));
         } catch (Exception $e) {
             Symphony::initialiseLog();
             Symphony::Logs()->pushExceptionToLog($e, true, true, false);
         }
     }
 }
function __errorHandler($errno = null, $errstr, $errfile = null, $errline = null, $errcontext = null)
{
    global $param;
    if (error_reporting() != 0 && in_array($errno, array(E_WARNING, E_USER_WARNING, E_ERROR, E_USER_ERROR))) {
        Symphony::initialiseLog();
        Symphony::Log()->pushToLog("{$errno} - " . strip_tags(is_object($errstr) ? $errstr->generate() : $errstr) . ($errfile ? " in file {$errfile}" : '') . ($errline ? " on line {$errline}" : ''), $errno, true);
        Symphony::Log()->pushToLog(sprintf('Image class param dump - mode: %d, width: %d, height: %d, position: %d, background: %d, file: %s, external: %d, raw input: %s', $param->mode, $param->width, $param->height, $param->position, $param->background, $param->file, (bool) $param->external, $_GET['param']), E_NOTICE, true);
    }
}
示例#3
0
// Calculate the correct dimensions. If necessary, avoid upscaling the image.
$src_w = $image->Meta()->width;
$src_h = $image->Meta()->height;
if ($settings['image']['disable_upscaling'] == 'yes') {
    $dst_w = min($param->width, $src_w);
    $dst_h = min($param->height, $src_h);
} else {
    $dst_w = $param->width;
    $dst_h = $param->height;
}
// Make sure we have a valid size
if ($dst_w == 0 && $dst_h == 0) {
    // Return 400
    Page::renderStatusCode(Page::HTTP_STATUS_BAD_REQUEST);
    // Init log
    Symphony::initialiseLog();
    // Get referrer
    $httpRef = General::sanitize($_SERVER["HTTP_REFERER"]);
    if (!$httpRef) {
        $httpRef = 'unknown referrer';
    }
    // push to log
    Symphony::Log()->pushToLog(sprintf('Invalid size (0 x 0) requested from "%s"', $httpRef), E_WARNING, true);
    // output and exit
    echo 'Both width and height can not be 0';
    exit;
}
// Apply the filter to the Image class (`$image`)
switch ($param->mode) {
    case MODE_RESIZE:
        $image->applyFilter('resize', array($dst_w, $dst_h));