svn: /web/php-rmtools/trunk/docroot/rm/ index.php

From: Date: Mon, 11 Jan 2010 00:29:12 +0000
Subject: svn: /web/php-rmtools/trunk/docroot/rm/ index.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-6950@lists.php.net to get a copy of this message
pajoye Mon, 11 Jan 2010 00:29:12 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=293365 Log: - clean(er) error on failure Changed paths: U web/php-rmtools/trunk/docroot/rm/index.php Modified: web/php-rmtools/trunk/docroot/rm/index.php =================================================================== --- web/php-rmtools/trunk/docroot/rm/index.php 2010-01-10 23:38:48 UTC (rev 293364) +++ web/php-rmtools/trunk/docroot/rm/index.php 2010-01-11 00:29:12 UTC (rev 293365) @@ -54,22 +54,31 @@ $revision['comment'] = filter_input(INPUT_POST, 'comment', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH); $revision['news'] = filter_input(INPUT_POST, 'news', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH); $revision['status'] = filter_input(INPUT_POST, 'status', FILTER_VALIDATE_INT, array('min_range'=>0. , 'max_range'=>2)); + try { + if (!$svn->updateRevision($revision)) { + if ($json) { + header('HTTP/1.0 500 Internal Server Error'); + } + $error = "Failed to update revision: $revision"; + $tpl = 'error.php'; + break; + } - if (!$svn->updateRevision($revision)) { if ($json) { - header('HTTP/1.0 500 Internal Server Error'); + echo json_encode($revision); + exit(); + } else { + header('Location: index.php'); + exit(); } - $error = "Failed to update revision: $revision"; - $tpl = 'error.php'; - break; + } catch (\Exception $e) { + if ($json) { + header('HTTP/1.0 500 Internal Server Error'); + exit(); + } + $error = "Failed to update revision: $revision"; + $tpl = 'error.php'; } - if ($json) { - echo json_encode($revision); - exit(); - } else { - header('Location: index.php'); - exit(); - } break; }

« previous php.webmaster (#6950) next »