Exemplo n.º 1
0
 public function subscribe()
 {
     $email = Input::get('email');
     $subscribe = new Subscribe();
     $subscribe->email = $email;
     $subscribe->save();
     return 'true';
 }
Exemplo n.º 2
0
 public function subscribe()
 {
     $email = Input::get('email');
     $subscribe = new Subscribe();
     $subscribe->email = $email;
     try {
         $subscribe->save();
         $data = Citrus::response('data', 'You have been successfully subscribed');
     } catch (Exception $e) {
         //$e->setMessage('You are already subscribed!');
         $data = Citrus::response('error', $e);
     }
     return $data;
 }
Exemplo n.º 3
0
 public function subscribe()
 {
     $validation = Validator::make(array('subscribe' => Input::get('subscribe')), array('subscribe' => array('required', 'email')));
     if ($validation->fails()) {
         if (\Request::ajax()) {
             $messages = $validation->messages();
             return \Response::JSON(array('messages' => $messages), 400);
         }
         return \Redirect::to(\Input::get('from'))->withInput()->withErrors($validation);
     }
     $subscribe = Subscribe::create(array('email' => Input::get('subscribe')));
     $subscribe->save();
     return 'Te haz suscrito correctamente!';
 }
 function actionUnSubscribe()
 {
     header('Content-type: application/json');
     if (!Yii::app()->request->isPostRequest) {
         IjoyPlusServiceUtils::exportServiceError(Constants::METHOD_NOT_SUPPORT);
         return;
     }
     if (!IjoyPlusServiceUtils::validateAPPKey()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID);
         return;
     }
     $prod_id = Yii::app()->request->getParam("prod_id");
     if (!isset($prod_id) || is_null($prod_id)) {
         IjoyPlusServiceUtils::exportServiceError(Constants::PARAM_IS_INVALID);
         return;
     }
     if (IjoyPlusServiceUtils::validateUserID()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::USER_ID_INVALID);
         return;
     }
     try {
         $userid = Yii::app()->user->id;
         $subscribe = Subscribe::model()->getSubscribeByProd($userid, $prod_id);
         if ($subscribe !== null) {
             $subscribe->delete();
         }
         IjoyPlusServiceUtils::exportServiceError(Constants::SUCC);
     } catch (Exception $e) {
         IjoyPlusServiceUtils::exportServiceError(Constants::SYSTEM_ERROR);
     }
 }
Exemplo n.º 5
0
#---------------------------------------------------------------------------#
# this Project Created by Mohammad Anzawi                                   #
#                                                                           #
# This project is intended for beginners and learners                       #
# The main objective of this project is to see the way do something similar,#
#  such as sending messages via e-mail, files Read the content and create   #
#  templates or other                                                       #
#   and saved on the server within a specific folder.                       #
# Can anyone who want to modify or development (add some functions, styles),#
# and use it in his dite, or commercially.                                  #
#                                                                           #
#  so if you have any question -> ask me on m.anzawi2013@gmail.com          #
# or visit my blog on http://www.phptricks.org                              #
#---------------------------------------------------------------------------#
$temp = new Template();
$subsc = new Subscribe();
if (isset($_POST['send'])) {
    $send = new Sender();
    $tempName = str_replace('.html', '', $_POST['tempName']);
    $templ['content'] = $temp->getContent($tempName);
    $templ['title'] = $_POST['title'];
    $emails = $_POST['subsc'];
    if ($send->sendNewsLitter($emails, $templ)) {
        echo "Send Succcessfuly";
    } else {
        echo "Unabl to Send";
    }
}
?>
<form method="POST">
    <div style="width:20%; float: left;">
Exemplo n.º 6
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Subscribe the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Subscribe::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 7
0
function deleteSubscribe()
{
    $subscribe = new Subscribe();
    $subscribe->setId($_REQUEST['id']);
    $subscribe->deleteSubscribe();
}
Exemplo n.º 8
0
 function unsubscribe_act()
 {
     $email = IFilter::act(IReq::get('email'), 'string');
     if ($email == null) {
         die("请填写完整的数据");
     }
     $re = Subscribe::unsubscribe($email, $content);
     if ($re['flag'] == true) {
         die('success');
     }
     die($re['data']);
 }
Exemplo n.º 9
0
# this Project Created by Mohammad Anzawi                                   #
#                                                                           #
# This project is intended for beginners and learners                       #
# The main objective of this project is to see the way do something similar,#
#  such as sending messages via e-mail, files Read the content and create   #
#  templates or other                                                       #
#   and saved on the server within a specific folder.                       #
# Can anyone who want to modify or development (add some functions, styles),#
# and use it in his dite, or commercially.                                  #
#                                                                           #
#  so if you have any question -> ask me on m.anzawi2013@gmail.com          #
# or visit my blog on http://www.phptricks.org                              #
#---------------------------------------------------------------------------#
#
// create object from Subscribe class
$subsc = new Subscribe();
/**
 * 
 * 
 * I do not know what I am documenting this file
 * so if you have any question -> ask me on m.anzawi2013@gmail.com
 * or visit my blog on http://www.phptricks.org
 * 
 * 
 */
if (isset($_GET['Activate'])) {
    $get = escape($_GET);
    // $subscriber = $subsc->getAllSubscribers("WHERE u_id={$get['activate']}");
    $data = array('u_id' => $get['Activate'], 'u_active' => 1);
    if ($subsc->update($data)) {
        echo "Activated";
Exemplo n.º 10
0
 /**
  * Sender::__construct()
  * 
  * @return void
  */
 public function __construct()
 {
     //$this->_db = DB::connect();
     parent::__construct();
 }
Exemplo n.º 11
0
# Can anyone who want to modify or development (add some functions, styles),#
# and use it in his dite, or commercially.                                  #
#                                                                           #
#  so if you have any question -> ask me on m.anzawi2013@gmail.com          #
# or visit my blog on http://www.phptricks.org                              #
#---------------------------------------------------------------------------#
/**
 * 
 * 
 * I do not know what I am documenting this file
 * so if you have any question -> ask me on m.anzawi2013@gmail.com
 * or visit my blog on http://www.phptricks.org
 * 
 * 
 */
$subsc = new Subscribe();
if (isset($_GET['delete'])) {
    $get = escape($_GET);
    if ($subsc->delete($get['delete'])) {
        echo "Deleted";
    } else {
        echo "Unable to Delete <br>" . implode('<br>', $subsc->errors());
    }
}
?>
<style>
    td {
        padding: 10px; text-align: center; border: 1px solid #333;
    }
</style>
<p>