Skip to content

Commit

Permalink
use tables array for table names
Browse files Browse the repository at this point in the history
  • Loading branch information
michield committed Nov 19, 2015
1 parent 297ad13 commit 4295b92
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions plugins/restapi/includes/subscribers.php
Expand Up @@ -45,7 +45,7 @@ public static function subscribersGet($order_by = 'id', $order = 'asc', $limit =
'offset' => array($offset,PDO::PARAM_INT),
);

Common::select('Users', 'SELECT * FROM '.$GLOBALS['usertable_prefix']."user ORDER BY :order_by :order LIMIT :limit OFFSET :offset;",$params);
Common::select('Subscribers', 'SELECT * FROM '.$GLOBALS['tables']['user']." ORDER BY :order_by :order LIMIT :limit OFFSET :offset;",$params);
}

/**
Expand All @@ -60,7 +60,7 @@ public static function subscribersGet($order_by = 'id', $order = 'asc', $limit =
*/
public static function subscribersCount()
{
Common::select('Users', 'SELECT count(id) as total FROM '.$GLOBALS['usertable_prefix']."user",array(),true);
Common::select('Subscribers', 'SELECT count(id) as total FROM '.$GLOBALS['tables']['user'],array(),true);
}

/**
Expand All @@ -85,7 +85,7 @@ public static function subscriberGet($id = 0)
$params = array(
'id' => array($id,PDO::PARAM_INT),
);
Common::select('Subscriber', 'SELECT * FROM '.$GLOBALS['usertable_prefix']."user WHERE id = :id;",$params, true);
Common::select('Subscriber', 'SELECT * FROM '.$GLOBALS['tables']['user']." WHERE id = :id;",$params, true);
}

/**
Expand All @@ -106,7 +106,7 @@ public static function subscriberGetByEmail($email = '')
$params = array(
'email' => array($email,PDO::PARAM_STR)
);
Common::select('Subscriber', 'SELECT * FROM '.$GLOBALS['usertable_prefix']."user WHERE email = :email;",$params, true);
Common::select('Subscriber', 'SELECT * FROM '.$GLOBALS['tables']['user']." WHERE email = :email;",$params, true);
}

/**
Expand All @@ -127,7 +127,7 @@ public static function subscriberGetByForeignkey($foreignkey = '')
$params = array(
'foreignkey' => array($foreignkey,PDO::PARAM_STR)
);
Common::select('Subscriber', 'SELECT * FROM '.$GLOBALS['usertable_prefix']."user WHERE foreignkey = :foreignkey;",$params, true);
Common::select('Subscriber', 'SELECT * FROM '.$GLOBALS['tables']['user']." WHERE foreignkey = :foreignkey;",$params, true);
}

/**
Expand All @@ -148,7 +148,7 @@ public static function subscriberGetByForeignkey($foreignkey = '')
*/
public static function subscriberAdd()
{
$sql = 'INSERT INTO '.$GLOBALS['usertable_prefix'].'user
$sql = 'INSERT INTO '.$GLOBALS['tables']['user'].'
(email, confirmed, foreignkey, htmlemail, password, passwordchanged, subscribepage, disabled, entered, uniqid)
VALUES (:email, :confirmed, :foreignkey, :htmlemail, :password, now(), :subscribepage, :disabled, now(), :uniqid);';

Expand Down Expand Up @@ -256,7 +256,7 @@ public static function subscribe()
*/
public static function subscriberUpdate()
{
$sql = 'UPDATE '.$GLOBALS['usertable_prefix'].'user SET email=:email, confirmed=:confirmed, htmlemail=:htmlemail WHERE id=:id;';
$sql = 'UPDATE '.$GLOBALS['tables']['user'].' SET email=:email, confirmed=:confirmed, htmlemail=:htmlemail WHERE id=:id;';

$id = sprintf('%d',$_REQUEST['id']);
if (empty($id)) {
Expand Down Expand Up @@ -289,7 +289,7 @@ public static function subscriberUpdate()
*/
public static function subscriberDelete()
{
$sql = 'DELETE FROM '.$GLOBALS['usertable_prefix'].'user WHERE id=:id;';
$sql = 'DELETE FROM '.$GLOBALS['tables']['user'].' WHERE id=:id;';
try {
if (!is_numeric($_REQUEST['id'])) {
Response::outputErrorMessage('invalid call');
Expand Down

0 comments on commit 4295b92

Please sign in to comment.