diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-06-06 13:57:13 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-06-06 13:57:13 +0200 |
| commit | db968c8d0eb4665b322429aec0573cb2f33a5881 (patch) | |
| tree | 8c3885d9ca8c2b075eaf983b5f41758827334c28 /src/phorkie/Repository/Post.php | |
| parent | 2e5ea3ac15673e04416e789d7eabff8b11c70c50 (diff) | |
| download | phorkie-db968c8d0eb4665b322429aec0573cb2f33a5881.tar.gz phorkie-db968c8d0eb4665b322429aec0573cb2f33a5881.zip | |
fix bug #10: error when nothing submitted
Diffstat (limited to 'src/phorkie/Repository/Post.php')
| -rw-r--r-- | src/phorkie/Repository/Post.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index d104a8c..fe2372f 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -20,6 +20,9 @@ class Repository_Post if (!isset($postData['files'])) { return false; } + if (!$this->hasContent($postData)) { + return false; + } if (!$this->repo) { $this->repo = $this->createRepo(); @@ -137,6 +140,19 @@ class Repository_Post return true; } + protected function hasContent($postData) + { + foreach ($postData['files'] as $num => $arFile) { + if ($_FILES['files']['error'][$num]['upload'] == 0) { + return true; + } + if ($arFile['content'] != '') { + return true; + } + } + return false; + } + public function createRepo() { $rs = new Repositories(); |
