コード例 #1
0
ファイル: create.php プロジェクト: andrewkrug/repucaution
 public function add_cron_post($post)
 {
     if ($this->template->is_ajax()) {
         $post['post_to_groups'] = array($this->profile->id);
         $post['timezone'] = User_timezone::get_user_timezone($this->c_user->id);
         $post['user_id'] = $this->c_user->id;
         $errors = Social_post::validate_post($post);
         if (empty($errors)) {
             $errors = Social_post_cron::validate_cron($post);
             if (empty($errors)) {
                 Social_post_cron::add_new_post($post, $this->c_user->id, $this->profile->id);
                 $result['success'] = true;
                 $result['message'] = lang('post_was_successfully_added');
             } else {
                 $result['success'] = false;
                 $result['errors'] = $errors;
             }
         } else {
             $result['success'] = false;
             $result['errors'] = $errors;
         }
         echo json_encode($result);
     }
     exit;
 }