+++ /dev/null
-<?php
-
-/**
- * Gaslight Media Members Database
- * PDF Output by admin-ajax
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 0.1
- */
-
-/**
- * Steve Note...
- *
- * You can get to this using the following URL.
- *
- * {host}/wp-admin/admin-ajax.php?action=glm_members_admin_ajax&glm_action=login
- *
- * You should be able to do this as POST or GET and should be able to add and read additional parameters.
- * I added a "mystuff" parameter to the URL above and it does output from the code in the
- * modelAction() function below.
- *
- * To add another model under models/admin/ajax all you need to do is create it and add it to the
- * setup/validActions.php file.
- *
- */
-
-/**
- * This class performs the work of handling images passed to it via
- * an AJAX call that goes through the WorPress AJAX Handler.
- *
- */
-class GlmMembersAdmin_ajax_checkEmail
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * Plugin Configuration Data
- *
- * @var $config
- * @access public
- */
- public $config;
-
- /*
- * Constructor
- *
- * This contructor sets up this model. At this time that only includes
- * storing away the WordPress data object.
- *
- * @return object Class object
- *
- */
- public function __construct ($wpdb, $config)
- {
-
- // Save WordPress Database object
- $this->wpdb = $wpdb;
-
- // Save plugin configuration object
- $this->config = $config;
-
- // Run constructor for data class
- //parent::__construct(false, false);
-
- }
-
- /*
- * Perform Model Action
- *
- * This model checks to see if the creditials passed in are correct.
- *
- * This model action does not return, it simply does it's work then calls die();
- *
- * @param $actionData
- *
- * Echos JSON string as response and does not return
- */
- public function modelAction( $actionData = false )
- {
- $return = false;
-
- if ( $email = filter_var( $_REQUEST['email'], FILTER_VALIDATE_EMAIL ) ) {
- $accountId = $this->wpdb->get_var(
- $this->wpdb->prepare(
- "SELECT id
- FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "account
- WHERE email = %s",
- $email
- )
- );
- if ( $accountId ) {
- $return = array(
- 'valid' => true,
- 'validEmail' => true,
- 'id' => (int)$accountId,
- 'email' => $email,
- );
- } else {
- $return = array(
- 'valid' => false,
- 'validEmail' => true,
- );
- }
- } else {
- $return = array(
- 'valid' => false,
- 'validEmail' => false,
- );
- }
- header('Content-type:application/json;charset=utf-8', true);
- echo json_encode( $return );
- exit();
- }
-}