コード例 #1
0
ファイル: Conversation.php プロジェクト: centaurustech/bmradi
 public static function saveEmail()
 {
     $attachment_ref = '';
     if (Input::hasFile('attachment')) {
         $attachment_ref = Helpers::getUniqueID();
         Helpers::uploadCampaignFile(Input::file('attachment'), $attachment_ref);
     }
     DB::table('mradi_outbox_email_log')->insert(array("sender" => Helpers::getGlobalValue('SYSTEM_EMAIL'), "message" => Input::get('message'), "subject" => Input::get('subject'), "email_cc" => Input::get('email_cc'), "email_bcc" => Input::get('email_bcc'), "email_to" => Input::get('email_to'), "attachment_ref" => $attachment_ref));
     return true;
 }
コード例 #2
0
 public function SaveAccount()
 {
     /*
      * Validate input values
      */
     $rules = array('firstname' => 'required|min:2', 'lastname' => 'required|min:2', 'email' => 'required|email', 'account_type' => 'required', 'gender' => 'required', 'country' => 'required|min:1', 'phone_number' => 'required|min:4');
     $validator = Validator::make(Input::all(), $rules);
     $messages = $validator->messages();
     if ($validator->fails()) {
         return Redirect::to(URL::previous())->withErrors($validator)->withInput();
     } else {
         $results = DB::select('select * from accounts_dbx where email_address = ? and account_type = ?', array(Input::get('email'), Input::get('account_type')));
         $password = str_random(6) . rand(100, 999);
         if (empty($results)) {
             if (DB::table('accounts_dbx')->insert(array('firstname' => Input::get('firstname'), 'lastname' => Input::get('lastname'), 'email_address' => Input::get('email'), 'account_type' => Input::get('account_type'), 'password' => hash('sha256', $password), 'date_created' => date('Y-m-d H:i:s'), 'account_status' => 'ACTIVE', 'gender' => Input::get('gender'), 'country' => Input::get('country'), 'phone' => Input::get('phone_number')))) {
                 Session::put('email_names', Input::get('firstname') . ' ' . Input::get('lastname'));
                 Session::put('email_message', "Your Mradifund account has been created successfully. <br /> Email : " . Input::get('email') . " <br /> Password : {$password} ");
                 $data = array('message' => "Your Mradifund account has been created successfully. <br /> Email : " . Input::get('email') . " <br /> Password : {$password} ");
                 /*
                  * Send Login Email details and Log
                  */
                 if (Mail::send('emails.notice', $data, function ($message) {
                     $message->to(Input::get('email'), Input::get('firstname') . ' ' . Input::get('lastname'))->subject('Mradi Account');
                 })) {
                     Helpers::logEmailMessage(array("sender" => Helpers::getGlobalValue('SYSTEM_EMAIL'), "recipient" => Input::get('email'), "message" => str_replace($password, "xxxxxxx", Session::get('email_message')), "subject" => "Mradi Account", "source" => 'System'), true);
                 } else {
                     Helpers::logEmailMessage(array("sender" => Helpers::getGlobalValue('SYSTEM_EMAIL'), "recipient" => Input::get('email'), "message" => str_replace($password, "xxxxxxx", Session::get('email_message')), "subject" => "Mradi Account", "source" => 'System'), false);
                 }
                 Session::flash('common_feedback', '<div class="alert alert-success" style="width: 500px;">New mradi account request has been successfully sent! Please check your email for further instructions.</div>');
                 return View::make('common_feedback');
             } else {
                 Session::flash('common_feedback', '<div class="alert alert-warning" style="width: 500px;">Error creating a new Mradifund account request. Please try again later</div>');
                 return View::make('common_feedback');
             }
         } else {
             Session::flash('common_feedback', '<div class="alert alert-warning" style="width: 500px;">You already have an existing account, click ' . HTML::link('login', 'here') . ' to login.</div>');
             return View::make('common_feedback');
         }
     }
 }
コード例 #3
0
 public function validateUser()
 {
     $email = Input::get('_username');
     $password = hash('sha256', Input::get('_password'));
     $account_type = Input::get('account_type') == 'other' ? 'Admin' : Input::get('account_type');
     $results = DB::select("select * from accounts_dbx where email_address = ? and password = ? and account_type = ?", array($email, $password, $account_type));
     if (empty($results)) {
         Helpers::logAction($email . " attempted to login as " . $account_type, false);
         Helpers::logData("select * from accounts_dbx where email_address = {$email} and password = {$password} and account_type = {$account_type}");
         Session::flash('login_message', '<div class="alert alert-danger" style="width: 500px;">Error login! Please try again</div>');
         return Redirect::route('login');
     } else {
         $status = '';
         foreach ($results as $item) {
             Session::put('email_address', $item->email_address);
             Session::put('account_id', $item->account_id);
             Session::put('username', $item->email_address);
             Session::put('firstname', $item->firstname);
             Session::put('fullnames', $item->firstname . " " . $item->lastname);
             Session::put('membersince', date("M. Y", strtotime($item->date_created)));
             Session::put('country', $item->country);
             Session::put('gender', $item->gender);
             Session::put('phone_no', $item->phone);
             Session::put('account_type', $item->account_type);
             Session::put('rec_per_page', Helpers::getGlobalValue('RECORDS_PER_PAGE'));
             Session::put('template_price', Helpers::getGlobalValue('TEMPLATE_COST'));
             $status = $item->account_status;
         }
         Helpers::logAction("Logged in successfully");
         if ($status == 'ACTIVE') {
             return Redirect::route('dashboard');
         } else {
             Session::flash('login_message', '<div class="alert alert-danger" style="width: 500px;">Error login! Account hasn\'t been activated yet</div>');
             return Redirect::route('login');
         }
     }
 }
コード例 #4
0
 public function SaveCampaignSummary()
 {
     $rules = array('listing_logo' => 'required_if:listing_logo_h,0|image', 'business_name' => 'required|between:1,50', 'business_summary' => 'required|between:2,140', 'money_valuation' => 'numeric', 'max_investment' => 'numeric', 'money_util' => 'required|between:2,300', 'categories' => 'required', 'website_address' => 'url', 'facebook_address' => 'url', 'twitter_address' => 'url', 'linkedin_address' => 'url');
     $validator = Validator::make(Input::all(), $rules);
     // check if the validator failed -----------------------
     if ($validator->fails()) {
         return Redirect::to(URL::previous())->withErrors($validator)->withInput()->with('activetab', Input::get('activetab'));
     } else {
         if (Helpers::isNewCampaign(Input::get('campaign'), 1)) {
             $campaign_logo_ref = Helpers::getUniqueID();
             DB::table('tbl_campaign_summary')->insert(array('listing_logo' => $campaign_logo_ref, 'campaign_id' => Helpers::getCampaignID(Input::get('campaign')), 'business_name' => Input::get('business_name'), 'business_summary' => Input::get('business_summary'), 'min_investment' => Helpers::getGlobalValue('MINIMUM_INV_SOUGHT'), 'percent_equity' => Input::get('min_inv_percent'), 'pre_money_valuation' => Input::get('money_valuation'), 'max_investment' => Input::get('max_investment'), 'max_percent_equity' => Input::get('max_inv_percent'), 'money_use' => Input::get('money_util'), 'categories' => Input::get('categories'), 'facebook' => Input::get('facebook_address'), 'twitter' => Input::get('twitter_address'), 'linkedin' => Input::get('linkedin_address'), 'website' => Input::get('website_address')));
             /*
              * Insert upload file data
              */
             $listing_logo_file = Helpers::uploadCampaignFile(Input::file('listing_logo'), $campaign_logo_ref);
             Helpers::uploadFileData($campaign_logo_ref, $listing_logo_file['original'], $listing_logo_file['alias']);
             /*
              * Progress Campaign progress
              */
             Helpers::progressCampaign(Input::get('campaign'), 1);
         } else {
             DB::table('tbl_campaign_summary')->where('campaign_id', Helpers::getCampaignID(Input::get('campaign')))->update(array('business_name' => Input::get('business_name'), 'business_summary' => Input::get('business_summary'), 'min_investment' => Input::get('min_investment'), 'percent_equity' => Input::get('min_inv_percent'), 'pre_money_valuation' => Input::get('money_valuation'), 'max_investment' => Input::get('max_investment'), 'max_percent_equity' => Input::get('max_inv_percent'), 'money_use' => Input::get('money_util'), 'categories' => Input::get('categories'), 'facebook' => Input::get('facebook_address'), 'twitter' => Input::get('twitter_address'), 'linkedin' => Input::get('linkedin_address'), 'website' => Input::get('website_address')));
             $campaign_logo_ref = Input::get('listing_logo_h');
             if (Input::hasFile('listing_logo')) {
                 /*
                  * Insert upload file data
                  */
                 $listing_logo_file = Helpers::uploadCampaignFile(Input::file('listing_logo'), $campaign_logo_ref);
                 //Helpers::uploadFileData(Input::get('listing_logo_h'), $listing_logo_file['original'], $listing_logo_file['alias'], true);
             }
         }
         $tab = explode("_", Input::get('activetab'));
         $active_tab = "tab_" . ($tab[1] + 1);
         return Redirect::to(URL::route('campaign_info', array('campaign' => Input::get('campaign'))))->with('activetab', $active_tab);
     }
 }
コード例 #5
0
ファイル: Helpers.php プロジェクト: centaurustech/bmradi
 public static function sendMail($emailData, $template)
 {
     if (!$template) {
         Session::flash('email_names', $emailData['names']);
         Session::flash('email_message', $emailData['message']);
         Session::flash('campaign_status', $emailData['status']);
         $data = array('messages' => "");
         /*
          * Send Login Email details and Log
          */
         if (Mail::send('emails.status_notification', $data, function ($message) use($emailData) {
             $message->to($emailData['to'], $emailData['names'])->subject('MradiFund Campaign Status Changed');
         })) {
             Helpers::logEmailMessage(array("sender" => Helpers::getGlobalValue('SYSTEM_EMAIL'), "recipient" => $emailData['to'], "message" => $emailData['message'], "subject" => "Mradi Account3", "source" => 'System'), true);
         }
     } else {
         Session::flash('email_names', $emailData['names']);
         Session::flash('email_message', $emailData['message']);
         //Session::flash('campaign_status', $emailData['status']);
         $data = array('messages' => "");
         //Send tempalte download link
         if (Mail::send('emails.notice', $data, function ($message) use($emailData) {
             $message->to($emailData['to'], $emailData['names'])->subject('MradiFund Financials Template');
         })) {
             Helpers::logEmailMessage(array("sender" => Helpers::getGlobalValue('SYSTEM_EMAIL'), "recipient" => $emailData['to'], "message" => $emailData['message'], "subject" => "MradiFund Financials", "source" => 'System'), true);
         }
     }
 }