function sync()
 {
     $listSync = new listSync($this->db, MAILCHIMP_APIKEY, MAILCHIMP_LIST_ID, MAILCHIMP_LAST_SYNC_DATE, NULL, MAILCHIMP_SECURE);
     $response = $listSync->process();
     if (!isset($response["type"])) {
         $response = array();
         $response["type"] = "error";
         $response["details"] = array("message" => "Fatal error: no valid response from script.", "code" => NULL);
     }
     //end if
     $response = json_encode($response);
     echo $response;
 }
示例#2
0
 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |
 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |
 |                                                                         |
 +-------------------------------------------------------------------------+
*/
//uncomment if need debug
if (!class_exists("appError")) {
    include_once "../../include/session.php";
}
include "include/MCAPI.class.php";
//for MCAPI CLASS (listSync class uses it)
include "include/list_sync.php";
//for listSync class
$querystatement = "\n    SELECT\n        roleid\n    FROM\n        tableoptions\n    WHERE\n        name= 'massemail'\n        AND tabledefid = 'tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083'\n        ";
$queryresult = $this->db->query($querystatement);
$therecord = $this->db->fetchArray($queryresult);
if (!hasRights($therecord["roleid"])) {
    exit(false);
}
$listSync = new listSync($db, MAILCHIMP_APIKEY, MAILCHIMP_LIST_ID, MAILCHIMP_LAST_SYNC_DATE, NULL, MAILCHIMP_SECURE);
$response = $listSync->process();
if (isset($response["type"])) {
    if ($response["type"] != "success") {
        foreach ($response["details"] as $errorArray) {
            $message = "MailChimp sync " . $response["type"] . ": " . $errorArray["message"] . " (" . $errorArray["code"] . ")";
            $log = new phpbmsLog($message, "SCHEDULER", NULL, $db);
        }
    }
    //end if
}
//end if