Skip to content

Commit

Permalink
Merge pull request #76 from mambax7/master
Browse files Browse the repository at this point in the history
1.05 RC 3
  • Loading branch information
mambax7 committed Nov 11, 2017
2 parents 3520660 + 6308cf0 commit 02dde8d
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 509 deletions.
4 changes: 2 additions & 2 deletions class/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getCategoryPath($withAllLink = true)

try {
if ($parentObj->notLoaded()) {
throw new Exception(_NOPERM);
throw new RuntimeException(_NOPERM);
}
} catch (Exception $e) {
$this->publisher->addLog($e);
Expand Down Expand Up @@ -181,7 +181,7 @@ public function getCategoryPathForMetaTitle()

try {
if ($parentObj->notLoaded()) {
throw new Exception('NOT LOADED');
throw new RuntimeException('NOT LOADED');
}
} catch (Exception $e) {
$this->publisher->addLog($e);
Expand Down
6 changes: 6 additions & 0 deletions class/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,18 @@ public function getForm()
class PublisherFileHandler extends XoopsPersistableObjectHandler
{
public $table_link = '';
/**
* @var Publisher
* @access public
*/
public $publisher;

/**
* @param null|XoopsDatabase $db
*/
public function __construct(XoopsDatabase $db)
{
$this->publisher = Publisher::getInstance();
parent::__construct($db, 'publisher_files', 'PublisherFile', 'fileid', 'name');
}

Expand Down
9 changes: 6 additions & 3 deletions class/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ public function &getObjects(CriteriaElement $criteria = null, $idKey = 'none', $
$notNullFields = (null !== $notNullFields) ?: '';

$sql = 'SELECT * FROM ' . $this->db->prefix($this->publisher->getDirname() . '_items');
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
$whereClause = $criteria->renderWhere();
if ('WHERE ()' !== $whereClause) {
$sql .= ' ' . $criteria->renderWhere();
Expand Down Expand Up @@ -1282,7 +1282,7 @@ public function getCount(CriteriaElement $criteria = null, $notNullFields = '')
{

$sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix($this->publisher->getDirname() . '_items');
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
$whereClause = $criteria->renderWhere();
if ('WHERE ()' !== $whereClause) {
$sql .= ' ' . $criteria->renderWhere();
Expand Down Expand Up @@ -1696,7 +1696,10 @@ public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0,
$criteriaUser = new CriteriaCompo();
$criteriaUser->add(new Criteria('uid', $userid), 'OR');
}
$count = count($queryArray);
$count = 0;
if(is_array($queryArray)) {
$count = count($queryArray);
}
if (is_array($queryArray) && $count > 0) {
$criteriaKeywords = new CriteriaCompo();
$elementCount = count($queryArray);
Expand Down
12 changes: 6 additions & 6 deletions class/mimetype.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function insert(XoopsObject $obj, $force = false)// insert($obj, $force =
private function selectQuery($criteria = null)
{
$sql = sprintf('SELECT * FROM %s', $this->db->prefix($this->dbtable));
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
$sql .= ' ' . $criteria->renderWhere();
if ('' != $criteria->getSort()) {
$sql .= ' ORDER BY ' . $criteria->getSort() . '
Expand All @@ -223,7 +223,7 @@ private function selectQuery($criteria = null)
public function getCount(CriteriaElement $criteria = null) //getCount($criteria = null)
{
$sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix($this->dbtable);
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
$sql .= ' ' . $criteria->renderWhere();
}
if (!$result = $this->db->query($sql)) {
Expand Down Expand Up @@ -274,7 +274,7 @@ public function delete(XoopsObject $obj, $force = false) //delete($obj, $force =
public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
{
$sql = 'DELETE FROM ' . $this->db->prefix($this->dbtable);
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
$sql .= ' ' . $criteria->renderWhere();
}
if (!$result = $this->db->query($sql)) {
Expand All @@ -299,7 +299,7 @@ public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = n
{
$setClause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
$sql = 'UPDATE ' . $this->db->prefix($this->dbtable) . ' SET ' . $setClause;
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
$sql .= ' ' . $criteria->renderWhere();
}
if (!$result = $this->db->query($sql)) {
Expand Down Expand Up @@ -570,7 +570,7 @@ private function selectQuery(CriteriaElement $criteria = null, $join = false)

try {
if ($join) {
throw new Exception('no need for join...');
throw new RuntimeException('no need for join...');
}
} catch (Exception $e) {
$publisher = Publisher::getInstance();
Expand All @@ -580,7 +580,7 @@ private function selectQuery(CriteriaElement $criteria = null, $join = false)

$sql = sprintf('SELECT * FROM %s', $this->db->prefix($this->dbtable));

if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
$sql .= ' ' . $criteria->renderWhere();
if ('' != $criteria->getSort()) {
$sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
Expand Down
2 changes: 1 addition & 1 deletion class/permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getGrantedGroupsById($gpermName, $id)
$db = XoopsDatabaseFactory::getDatabaseConnection();
$limit = $start = 0;
$sql = 'SELECT gperm_groupid FROM ' . $db->prefix('group_permission');
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
$sql .= ' ' . $criteria->renderWhere();
$limit = $criteria->getLimit();
$start = $criteria->getStart();
Expand Down
Loading

0 comments on commit 02dde8d

Please sign in to comment.