migrated and improved two functions regarding PDO stuff, refs #1287
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -26,17 +26,19 @@
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function domainHasApsInstances($domainid = 0)
|
function domainHasApsInstances($domainid = 0) {
|
||||||
{
|
|
||||||
global $db, $settings, $theme;
|
global $settings, $theme;
|
||||||
|
|
||||||
if($settings['aps']['aps_active'] == '1')
|
if ($settings['aps']['aps_active'] == '1') {
|
||||||
{
|
if ($domainid > 0) {
|
||||||
if($domainid > 0)
|
$instances_stmt = Database::prepare("
|
||||||
{
|
SELECT COUNT(`ID`) AS `count` FROM `" . TABLE_APS_SETTINGS . "`
|
||||||
$instances = $db->query_first("SELECT COUNT(`ID`) AS `count` FROM `" . TABLE_APS_SETTINGS . "` WHERE `Name`='main_domain' AND `Value`='" . (int)$domainid . "'");
|
WHERE `Name` = 'main_domain' AND `Value` = :domainid"
|
||||||
if((int)$instances['count'] != 0)
|
);
|
||||||
{
|
$instances = Database::pexecute_first($instances_stmt, array('domainid' => $domainid));
|
||||||
|
|
||||||
|
if ((int)$instances['count'] != 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ function domainHasMainSubDomains($id = 0) {
|
|||||||
SELECT COUNT(`id`) as `mainsubs` FROM `".TABLE_PANEL_DOMAINS."`
|
SELECT COUNT(`id`) as `mainsubs` FROM `".TABLE_PANEL_DOMAINS."`
|
||||||
WHERE `ismainbutsubto` = :id"
|
WHERE `ismainbutsubto` = :id"
|
||||||
);
|
);
|
||||||
Database::pexecute($result_stmt, array('id' => $id));
|
$result = Database::pexecute_first($result_stmt, array('id' => $id));
|
||||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
|
|
||||||
if (isset($result['mainsubs'])
|
if (isset($result['mainsubs'])
|
||||||
&& $result['mainsubs'] > 0
|
&& $result['mainsubs'] > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user