mambax7 /
tdmcreate-1.91
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php namespace XoopsModules\Tdmcreate; |
||
| 2 | |||
| 3 | use XoopsModules\Tdmcreate; |
||
| 4 | |||
| 5 | /* |
||
| 6 | You may not change or alter any portion of this comment or credits |
||
| 7 | of supporting developers from this source code or any supporting source code |
||
| 8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, |
||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | /** |
||
| 16 | * morefiles class. |
||
| 17 | * |
||
| 18 | * @copyright The XOOPS Project http:sourceforge.net/projects/xoops/ |
||
| 19 | * @license GNU GPL 2 (http:www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
| 20 | * |
||
| 21 | * @since 2.5.7 |
||
| 22 | * |
||
| 23 | * @author Txmod Xoops <[email protected]> - <http:www.txmodxoops.org/> |
||
| 24 | * |
||
| 25 | * @version $Id: morefiles.php 13080 2015-06-12 10:12:32Z timgno $ |
||
| 26 | */ |
||
| 27 | //include __DIR__.'/autoload.php'; |
||
| 28 | |||
| 29 | |||
| 30 | /** |
||
| 31 | * Class MoreFilesHandler. |
||
| 32 | */ |
||
| 33 | class AddFilesHandler extends \XoopsPersistableObjectHandler |
||
| 34 | { |
||
| 35 | /** |
||
| 36 | * @public function constructor class |
||
| 37 | * @param null|\XoopsDatabase|\XoopsMySQLDatabase $db |
||
| 38 | */ |
||
| 39 | public function __construct(\XoopsDatabase $db) |
||
| 40 | { |
||
| 41 | parent::__construct($db, 'tdmcreate_addfiles', AddFiles::class, 'file_id', 'file_name'); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param bool $isNew |
||
| 46 | * |
||
| 47 | * @return \XoopsObject |
||
| 48 | */ |
||
| 49 | public function create($isNew = true) |
||
| 50 | { |
||
| 51 | return parent::create($isNew); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * retrieve a field. |
||
| 56 | * |
||
| 57 | * @param int $i field id |
||
| 58 | * @param null $fields |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 59 | * |
||
| 60 | * @return mixed reference to the <a href='psi_element:Fields'>Fields</a> object |
||
| 61 | * object |
||
| 62 | */ |
||
| 63 | public function &get($i = null, $fields = null) |
||
| 64 | { |
||
| 65 | return parent::get($i, $fields); |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * get inserted id. |
||
| 70 | * |
||
| 71 | * @param null |
||
| 72 | * |
||
| 73 | * @return int reference to the {@link Tables} object |
||
| 74 | */ |
||
| 75 | public function &getInsertId() |
||
| 76 | { |
||
| 77 | return $this->db->getInsertId(); |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * insert a new field in the database. |
||
| 82 | * |
||
| 83 | * @param \XoopsObject $field reference to the {@link Fields} object |
||
| 84 | * @param bool $force |
||
| 85 | * |
||
| 86 | * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
||
| 87 | */ |
||
| 88 | public function insert(\XoopsObject $field, $force = false) |
||
| 89 | { |
||
| 90 | if (!parent::insert($field, $force)) { |
||
| 91 | return false; |
||
| 92 | } |
||
| 93 | |||
| 94 | return true; |
||
| 95 | } |
||
| 96 | |||
| 97 | /** |
||
| 98 | * Get Count AddFiles. |
||
| 99 | * @param int $start |
||
| 100 | * @param int $limit |
||
| 101 | * @param string $sort |
||
| 102 | * @param string $order |
||
| 103 | * @return int |
||
| 104 | */ |
||
| 105 | public function getCountAddFiles($start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') |
||
| 106 | { |
||
| 107 | $criteriaAddFilesCount = new \CriteriaCompo(); |
||
| 108 | $criteriaAddFilesCount = $this->getAddFilesCriteria($criteriaAddFilesCount, $start, $limit, $sort, $order); |
||
| 109 | |||
| 110 | return $this->getCount($criteriaAddFilesCount); |
||
| 111 | } |
||
| 112 | |||
| 113 | /** |
||
| 114 | * Get All AddFiles. |
||
| 115 | * @param int $start |
||
| 116 | * @param int $limit |
||
| 117 | * @param string $sort |
||
| 118 | * @param string $order |
||
| 119 | * @return array |
||
| 120 | */ |
||
| 121 | public function getAllAddFiles($start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') |
||
| 122 | { |
||
| 123 | $criteriaAddFilesAdd = new \CriteriaCompo(); |
||
| 124 | $criteriaAddFilesAdd = $this->getAddFilesCriteria($criteriaAddFilesAdd, $start, $limit, $sort, $order); |
||
| 125 | |||
| 126 | return $this->getAll($criteriaAddFilesAdd); |
||
| 127 | } |
||
| 128 | |||
| 129 | /** |
||
| 130 | * Get All AddFiles By Module Id. |
||
| 131 | * @param $modId |
||
| 132 | * @param int $start |
||
| 133 | * @param int $limit |
||
| 134 | * @param string $sort |
||
| 135 | * @param string $order |
||
| 136 | * @return array |
||
| 137 | */ |
||
| 138 | public function getAllAddFilesByModuleId($modId, $start = 0, $limit = 0, $sort = 'file_id ASC, file_name', $order = 'ASC') |
||
| 139 | { |
||
| 140 | $criteriaAddFilesByModuleId = new \CriteriaCompo(); |
||
| 141 | $criteriaAddFilesByModuleId->add(new \Criteria('file_mid', $modId)); |
||
| 142 | $criteriaAddFilesByModuleId = $this->getAddFilesCriteria($criteriaAddFilesByModuleId, $start, $limit, $sort, $order); |
||
| 143 | |||
| 144 | return $this->getAll($criteriaAddFilesByModuleId); |
||
| 145 | } |
||
| 146 | |||
| 147 | /** |
||
| 148 | * Get AddFiles Criteria. |
||
| 149 | * @param $criteriaAddFiles |
||
| 150 | * @param $start |
||
| 151 | * @param $limit |
||
| 152 | * @param $sort |
||
| 153 | * @param $order |
||
| 154 | * @return |
||
| 155 | */ |
||
| 156 | private function getAddFilesCriteria($criteriaAddFiles, $start, $limit, $sort, $order) |
||
| 157 | { |
||
| 158 | $criteriaAddFiles->setStart($start); |
||
| 159 | $criteriaAddFiles->setLimit($limit); |
||
| 160 | $criteriaAddFiles->setSort($sort); |
||
| 161 | $criteriaAddFiles->setOrder($order); |
||
| 162 | |||
| 163 | return $criteriaAddFiles; |
||
| 164 | } |
||
| 165 | } |
||
| 166 |