Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2017-11-07 21:51:20 +0300
committerdartcafe <github@dartcafe.de>2017-11-07 21:51:20 +0300
commita9bdf7d2fcebb5f818620d24bb1ac30ba036f97f (patch)
tree8b1b83a418e12bd90b2f5dda7e1b7d6ef278f10c /lib
parentdea743b43bfb44ae0ac3df184b627f3195a24b79 (diff)
parentb272a7f778a9b340870dc20f97ff21bffcb39ad5 (diff)
Revert "Merge branch 'develop' into votepage-design"
This reverts commit dea743b43bfb44ae0ac3df184b627f3195a24b79, reversing changes made to 3d5cdbee1f3de0b8e114c7eab199de229569822a.
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/PageController.php12
-rw-r--r--lib/Db/Comment.php12
-rw-r--r--lib/Db/Date.php12
-rw-r--r--lib/Db/Event.php32
-rw-r--r--lib/Db/EventMapper.php2
-rw-r--r--lib/Db/Model.php39
-rw-r--r--lib/Db/Notification.php8
-rw-r--r--lib/Db/NotificationMapper.php4
-rw-r--r--lib/Db/Participation.php16
-rw-r--r--lib/Db/ParticipationText.php12
-rw-r--r--lib/Db/Text.php8
11 files changed, 61 insertions, 96 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 232d60dc..96cb62bf 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -218,11 +218,7 @@ class PageController extends Controller {
* @return TemplateResponse
*/
public function gotoPoll($hash) {
- try {
- $poll = $this->eventMapper->findByHash($hash);
- } catch(DoesNotExistException $e) {
- return new TemplateResponse('polls', 'no.acc.tmpl', []);
- }
+ $poll = $this->eventMapper->findByHash($hash);
if ($poll->getType() == '0') {
$dates = $this->dateMapper->findByPoll($poll->getId());
$votes = $this->participationMapper->findByPoll($poll->getId());
@@ -439,12 +435,10 @@ class PageController extends Controller {
$event->setDescription(htmlspecialchars($pollDesc));
$event->setOwner($userId);
$event->setCreated(date('Y-m-d H:i:s'));
- $event->setHash(\OC::$server->getSecureRandom()->generate(
- 16,
+ $event->setHash(\OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(16,
ISecureRandom::CHAR_DIGITS .
ISecureRandom::CHAR_LOWER .
- ISecureRandom::CHAR_UPPER
- ));
+ ISecureRandom::CHAR_UPPER));
$event->setIsAnonymous($isAnonymous ? 1 : 0);
$event->setFullAnonymous($isAnonymous && $hideNames ? 1 : 0);
diff --git a/lib/Db/Comment.php b/lib/Db/Comment.php
index bbfb5403..28b5ae35 100644
--- a/lib/Db/Comment.php
+++ b/lib/Db/Comment.php
@@ -23,6 +23,8 @@
namespace OCA\Polls\Db;
+use OCP\AppFramework\Db\Entity;
+
/**
* @method string getUserId()
* @method void setUserId(string $value)
@@ -33,9 +35,9 @@ namespace OCA\Polls\Db;
* @method integer getPollId()
* @method void setPollId(integer $value)
*/
-class Comment extends Model {
- protected $userId;
- protected $dt;
- protected $comment;
- protected $pollId;
+class Comment extends Entity {
+ public $userId;
+ public $dt;
+ public $comment;
+ public $pollId;
}
diff --git a/lib/Db/Date.php b/lib/Db/Date.php
index 5363ec6a..d34a9a41 100644
--- a/lib/Db/Date.php
+++ b/lib/Db/Date.php
@@ -23,13 +23,15 @@
namespace OCA\Polls\Db;
+use OCP\AppFramework\Db\Entity;
+
/**
- * @method string getDt()
- * @method void setDt(string $value)
+ * @method timestamp getDt()
+ * @method void setDt(timestamp $value)
* @method integer getPollId()
* @method void setPollId(integer $value)
*/
-class Date extends Model {
- protected $dt;
- protected $pollId;
+class Date extends Entity {
+ public $dt;
+ public $pollId;
}
diff --git a/lib/Db/Event.php b/lib/Db/Event.php
index f422f0b6..df4c1ca8 100644
--- a/lib/Db/Event.php
+++ b/lib/Db/Event.php
@@ -23,6 +23,8 @@
namespace OCA\Polls\Db;
+use OCP\AppFramework\Db\Entity;
+
/**
* @method integer getType()
* @method void setType(integer $value)
@@ -32,12 +34,12 @@ namespace OCA\Polls\Db;
* @method void setDescription(string $value)
* @method string getOwner()
* @method void setOwner(string $value)
- * @method string getCreated()
- * @method void setCreated(string $value)
+ * @method timestamp getCreated()
+ * @method void setCreated(timestamp $value)
* @method string getAccess()
* @method void setAccess(string $value)
- * @method string getExpire()
- * @method void setExpire(string $value)
+ * @method timestamp getExpire()
+ * @method void setExpire(timestamp $value)
* @method string getHash()
* @method void setHash(string $value)
* @method integer getIsAnonymous()
@@ -45,15 +47,15 @@ namespace OCA\Polls\Db;
* @method integer getFullAnonymous()
* @method void setFullAnonymous(integer $value)
*/
-class Event extends Model {
- protected $type;
- protected $title;
- protected $description;
- protected $owner;
- protected $created;
- protected $access;
- protected $expire;
- protected $hash;
- protected $isAnonymous;
- protected $fullAnonymous;
+class Event extends Entity {
+ public $type;
+ public $title;
+ public $description;
+ public $owner;
+ public $created;
+ public $access;
+ public $expire;
+ public $hash;
+ public $isAnonymous;
+ public $fullAnonymous;
}
diff --git a/lib/Db/EventMapper.php b/lib/Db/EventMapper.php
index dabb28ac..44ed6a84 100644
--- a/lib/Db/EventMapper.php
+++ b/lib/Db/EventMapper.php
@@ -51,8 +51,6 @@ class EventMapper extends Mapper {
* @param $hash
* @param int $limit
* @param int $offset
- * @throws \OCP\AppFramework\Db\DoesNotExistException if not found
- * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
* @return Event
*/
public function findByHash($hash, $limit = null, $offset = null) {
diff --git a/lib/Db/Model.php b/lib/Db/Model.php
deleted file mode 100644
index 087f4842..00000000
--- a/lib/Db/Model.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
- *
- * @author Kai Schröer <git@schroeer.co>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCA\Polls\Db;
-
-use OCP\AppFramework\Db\Entity;
-
-abstract class Model extends Entity {
- /**
- * FactoryMuffin checks for the existence of setters with method_exists($obj, $attr) but that returns false.
- * By overwriting the __set() magic method we can trigger the changed flag on $obj->attr assignment.
- *
- * @param $name
- * @param $value
- */
- public function __set($name, $value) {
- $this->setter($name, [$value]);
- }
-}
diff --git a/lib/Db/Notification.php b/lib/Db/Notification.php
index 53d717dc..eb5c2180 100644
--- a/lib/Db/Notification.php
+++ b/lib/Db/Notification.php
@@ -23,13 +23,15 @@
namespace OCA\Polls\Db;
+use OCP\AppFramework\Db\Entity;
+
/**
* @method string getUserId()
* @method void setUserId(string $value)
* @method string getPollId()
* @method void setPollId(string $value)
*/
-class Notification extends Model {
- protected $userId;
- protected $pollId;
+class Notification extends Entity {
+ public $userId;
+ public $pollId;
}
diff --git a/lib/Db/NotificationMapper.php b/lib/Db/NotificationMapper.php
index 38b73b74..c5ee3b38 100644
--- a/lib/Db/NotificationMapper.php
+++ b/lib/Db/NotificationMapper.php
@@ -80,9 +80,7 @@ class NotificationMapper extends Mapper {
/**
* @param string $pollId
* @param string $userId
- * @throws \OCP\AppFramework\Db\DoesNotExistException if not found
- * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
- * @return Notification
+ * @return Notification if not found
*/
public function findByUserAndPoll($pollId, $userId) {
$sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?';
diff --git a/lib/Db/Participation.php b/lib/Db/Participation.php
index 317561dc..a8494c86 100644
--- a/lib/Db/Participation.php
+++ b/lib/Db/Participation.php
@@ -23,9 +23,11 @@
namespace OCA\Polls\Db;
+use OCP\AppFramework\Db\Entity;
+
/**
- * @method string getDt()
- * @method void setDt(string $value)
+ * @method timestamp getDt()
+ * @method void setDt(timestamp $value)
* @method string getUserId()
* @method void setUserId(string $value)
* @method integer getPollId()
@@ -33,9 +35,9 @@ namespace OCA\Polls\Db;
* @method integer getType()
* @method void setType(integer $value)
*/
-class Participation extends Model {
- protected $dt;
- protected $userId;
- protected $pollId;
- protected $type;
+class Participation extends Entity {
+ public $dt;
+ public $userId;
+ public $pollId;
+ public $type;
}
diff --git a/lib/Db/ParticipationText.php b/lib/Db/ParticipationText.php
index 064c50d3..6fd05cca 100644
--- a/lib/Db/ParticipationText.php
+++ b/lib/Db/ParticipationText.php
@@ -23,6 +23,8 @@
namespace OCA\Polls\Db;
+use OCP\AppFramework\Db\Entity;
+
/**
* @method text getText()
* @method void setText(text $value)
@@ -33,9 +35,9 @@ namespace OCA\Polls\Db;
* @method integer getType()
* @method void setType(integer $value)
*/
-class ParticipationText extends Model {
- protected $text;
- protected $userId;
- protected $pollId;
- protected $type;
+class ParticipationText extends Entity {
+ public $text;
+ public $userId;
+ public $pollId;
+ public $type;
}
diff --git a/lib/Db/Text.php b/lib/Db/Text.php
index c888dbdc..792e4caf 100644
--- a/lib/Db/Text.php
+++ b/lib/Db/Text.php
@@ -23,13 +23,15 @@
namespace OCA\Polls\Db;
+use OCP\AppFramework\Db\Entity;
+
/**
* @method string getText()
* @method void setText(string $value)
* @method integer getPollId()
* @method void setPollId(integer $value)
*/
-class Text extends Model {
- protected $text;
- protected $pollId;
+class Text extends Entity {
+ public $text;
+ public $pollId;
}