More usage of dbm::is_result($r) instead of count($r):
- count() returns very different results and never a boolean (not even false on error condition). - therefore you should NOT use it in boolean expressions. This still *can* be done in PHP because of its lazyness. But it is discouraged if it comes to more clean code. Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
293436e5fd
commit
6a8a36f12d
115 changed files with 439 additions and 437 deletions
|
@ -140,7 +140,7 @@ function videos_post(&$a) {
|
|||
dbesc($video_id)
|
||||
);
|
||||
|
||||
if(count($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
|
||||
intval(local_user()),
|
||||
dbesc($video_id)
|
||||
|
@ -259,7 +259,7 @@ function videos_content(&$a) {
|
|||
intval($contact_id),
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(count($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$can_post = true;
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
|
@ -287,7 +287,7 @@ function videos_content(&$a) {
|
|||
intval($contact_id),
|
||||
intval($owner_uid)
|
||||
);
|
||||
if(count($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
$remote_contact = true;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ function videos_content(&$a) {
|
|||
$sql_extra GROUP BY hash",
|
||||
intval($a->data['user']['uid'])
|
||||
);
|
||||
if(count($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
$a->set_pager_total(count($r));
|
||||
$a->set_pager_itemspage(20);
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ function videos_content(&$a) {
|
|||
|
||||
|
||||
$videos = array();
|
||||
if(count($r)) {
|
||||
if(dbm::is_result($r)) {
|
||||
foreach($r as $rr) {
|
||||
if($a->theme['template_engine'] === 'internal') {
|
||||
$alt_e = template_escape($rr['filename']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue