Ejemplo n.º 1
0
 /**
  * Delete existing SMS message
  *
  * @param string response_type - The response type.
  * 
  * @return Array
  */
 public function _del_email_msg($response_type)
 {
     if ($_POST) {
         $post = Validation::factory($_POST);
         // Add some filters
         $post->pre_filter('trim', TRUE);
         // Add some rules, the input field, followed by a list of
         //checks, carried out in order
         $post->add_rules('action', 'required', 'alpha', 'length[1,1]');
         $post->add_rules('message_id.*', 'required', 'numeric');
         if ($post->validate()) {
             $email_id = $post->twitter_id;
             $email = new Message_Model($email_id);
             if ($email->loaded == true) {
                 $email->delete();
             } else {
                 //email id doesn't exist in DB
                 //TODO i18nize the string
                 $this->error_messages .= "Email ID does not exist.";
                 $this->ret_value = 1;
             }
         } else {
             //TODO i18nize the string
             $this->error_messages .= "Email ID is required.";
             $this->ret_value = 1;
         }
     } else {
         $this->ret_value = 3;
     }
     return $this->api_actions->_response($this->ret_value, $response_type);
 }
Ejemplo n.º 2
0
 /**
  * Delete existing Twitter message
  *
  * @return Array
  */
 private function _delete_twitter_msg()
 {
     $ret_value = 0;
     if ($_POST) {
         $post = Validation::factory($_POST);
         // Add some filters
         $post->pre_filter('trim', TRUE);
         // Add some rules, the input field, followed by a list of
         //checks, carried out in order
         $post->add_rules('action', 'required', 'alpha', 'length[1,1]');
         $post->add_rules('message_id.*', 'required', 'numeric');
         if ($post->validate()) {
             $twitter_id = $post->message_id;
             $sms = new Message_Model($twitter_id);
             if ($sms->loaded == true) {
                 $sms->delete();
             } else {
                 //Comment id doesn't exist in DB
                 //TODO i18nize the string
                 $this->error_messages .= "Twitter ID does not exist.";
                 $ret_value = 1;
             }
         } else {
             //TODO i18nize the string
             $this->error_messages .= "Twitter ID is required.";
             $ret_value = 1;
         }
     } else {
         $ret_value = 3;
     }
     $this->response_data = $this->response($ret_value, $this->error_messages);
 }
Ejemplo n.º 3
0
 /**
  * Delete existing email message
  *
  * @return Array
  */
 public function _delete_email_msg()
 {
     $ret_val = 0;
     // Initialize a 0 return value; successful execution
     if ($_POST) {
         $post = Validation::factory($_POST);
         // Add some filters
         $post->pre_filter('trim', TRUE);
         // Add some rules, the input field, followed by a list of
         //checks, carried out in order
         $post->add_rules('action', 'required', 'alpha', 'length[1,1]');
         $post->add_rules('message_id', 'required', 'numeric');
         if ($post->validate(FALSE)) {
             $email_id = $post->message_id;
             $email = new Message_Model($email_id);
             if ($email->loaded == true) {
                 $email->delete();
             } else {
                 //email id doesn't exist in DB
                 //TODO i18nize the string
                 $this->error_messages .= "Email ID does not exist.";
                 $ret_value = 1;
             }
         } else {
             //TODO i18nize the string
             $this->error_messages .= "Email ID is required.";
             $ret_value = 1;
         }
     } else {
         $ret_value = 3;
     }
     $this->response_data = $this->response($ret_value);
 }