/**
  * Function to call for login.
  * 
  * <p><strong>Parameters:</strong><br/>
  * [*login] {string} loginname as an admin to phpList<br/>
  * [*password] {string} the password
  * </p>.
  */
 public static function login()
 {
     Response::outputMessage('Welcome!');
 }
 /**
  * Unassigns a list from a campaign.
  * 
  * <p><strong>Parameters:</strong><br/>
  * [*list_id] {integer} the ID of the list.<br/>
  * [*campaign_id] {integer} the ID of the campaign.
  * </p>
  * <p><strong>Returns:</strong><br/>
  * System message of action.
  * </p>
  */
 public static function listCampaignDelete($list_id = 0, $campaign_id = 0)
 {
     if ($list_id == 0) {
         $list_id = $_REQUEST['list_id'];
     }
     if ($campaign_id == 0) {
         $campaign_id = $_REQUEST['campaign_id'];
     }
     $sql = 'DELETE FROM ' . $GLOBALS['tables']['listmessage'] . ' WHERE listid=:list_id AND messageid=:campaign_id;';
     try {
         $db = PDO::getConnection();
         $stmt = $db->prepare($sql);
         $stmt->bindParam('campaign_id', $campaign_id, PDO::PARAM_INT);
         $stmt->bindParam('list_id', $list_id, PDO::PARAM_INT);
         $stmt->execute();
         $db = null;
         Response::outputMessage('Campaign ' . $campaign_id . ' wsa removed from list ' . $list_id);
     } catch (\Exception $e) {
         Response::outputError($e);
     }
     die(0);
 }
Example #3
0
if (strcmp($_SERVER['REQUEST_METHOD'], 'POST')) {
    include_once 'doc/doc.php';
    $doc = new phpListRestapiDoc();
    $doc->addClass('Actions');
    $doc->addClass('Lists');
    $doc->addClass('Subscribers');
    $doc->addClass('Templates');
    $doc->addClass('Campaigns');
    print $doc->output();
    return;
}
ob_end_clean();
$cmd = $_REQUEST['cmd'];
$cmd = preg_replace('/\\W/', '', $cmd);
if (empty($cmd)) {
    Response::outputMessage('OK! For action, please provide Post Param Key [cmd] !');
}
if (function_exists('api_request_log')) {
    api_request_log();
}
if (empty($plugin->coderoot)) {
    Response::outputErrorMessage('Not authorized! Please login with [login] and [password] as admin first!');
}
if ($cmd != 'login') {
    Common::logRequest($cmd);
    Common::enforceRequestLimit(getConfig('restapi_limit'));
}
$ipAddress = getConfig('restapi_ipaddress');
if (!empty($ipAddress) && $GLOBALS['remoteAddr'] != $ipAddress) {
    $response->outputErrorMessage('Incorrect ip address for request. Check your settings.');
    die(0);