Example #1
0
 function Error($code, $additional_text = FALSE)
 {
     if (!$code) {
         $this->SystemError('Error code not passed to function.');
     }
     $errors = array('1000' => 'Invalid request.', '1001' => 'Unable to authenticate.', '1002' => 'Invalid request type.', '1004' => 'Required fields are missing for this request', '1005' => 'Gateway type is required.', '1006' => 'Invalid format passed.  Acceptable formats: xml, php, and json.', '1007' => 'Invalid country.', '1008' => 'Invalid email address', '1009' => 'Unspecified error in request.', '1010' => 'A secure SSL connection is required.', '1011' => 'Invalid timezone.', '1012' => 'For USA and Canada addresses, a valid 2-letter state/province abbreviation is required.', '2000' => 'Client is not authorized to create new clients.', '2001' => 'Invalid External API.', '2002' => 'Username is already in use.', '2003' => 'Password must be greater than 5 characters in length.', '2004' => 'Invalid client ID.', '2005' => 'Error contacting payment gateway.', '2006' => 'Only administrators can create new Service Provider accounts.', '2007' => 'Invalid client_type.', '3000' => 'Invalid gateway ID for this client.', '3001' => 'Gateway ID is required.', '3002' => 'Client ID is required.', '4000' => 'Invalid customer ID.', '4001' => 'Invalid charge ID.', '5000' => 'A valid Recurring ID is required.', '5001' => 'Start date cannot be in the past.', '5002' => 'End date cannot be in the past', '5003' => 'End date must be later than start date.', '5004' => 'A customer ID or cardholder name must be supplied.', '5005' => 'Error creating customer profile.', '5006' => 'Error creating customer payment profile.', '5007' => 'Dates must be valid and in YYYY-MM-DD format.', '5008' => 'Invalid credit card number', '5009' => 'Invalid amount.', '5010' => 'Recurring details are required.', '5011' => 'Invalid interval.', '5012' => 'A valid description is required.', '5014' => 'Error cancelling subscription', '5015' => 'You cannot modify the plan_id via UpdateRecurring.  You must use ChangeRecurringPlan to upgrade or downgrade a recurring charge.', '5016' => 'Recurring billings cannot be updated for this gateway. You must either (a) cancel this existing subscription and create a new one or (b) go and update the recurring transaction at your merchant control panel.', '5017' => 'Gateway is disabled.', '5018' => 'This gateway requires customer information to be processed.  Please include a customer_id of an existing customer or a customer node with new customer information in your request.', '5019' => 'This gateway requires the purchasing customer\'s IP address.  Please include a customer_ip_address node in your request.', '5020' => 'This gateway does not allow refunds via the API.', '5021' => 'Only active gateways can be updated with new credit card details.', '5022' => 'This subscription is free - updating credit card details is futile.', '5023' => 'The new gateway you have chosen requires customer information but this customer record currently doesn\'t exist.  Please use UpdateCustomer to add full customer details for this user before calling UpdateCreditCard.', '5024' => 'Only non-external gateways allow for a paid initial charge but free recurring charge.', '5025' => 'Subscriptions with a paid initial charge but free recurring charge must start immediately.', '6000' => 'A valid Charge ID is required.', '6001' => 'A valid Customer ID is required.', '6002' => 'A valid Recurring ID is required', '6003' => 'Nothing to update.', '6005' => 'Error updating Recurring details.', '6006' => 'A valid Plan ID is required.', '7000' => 'Invalid plan type.', '7001' => 'Invalid Plan ID.', '7002' => 'Invalid Free Trial amount.', '7003' => 'Invalid occurrences amount.', '8000' => 'Invalid Email Trigger.', '8001' => 'A valid Email ID is required.', '8002' => 'Email body must be encoded.');
     $error_array = array('error' => $code, 'error_text' => $errors[$code]);
     if ($additional_text != FALSE) {
         $error_array['error_text'] .= '  ' . $additional_text;
     }
     // if this isn't a control panel call, it's an API call
     // and we must report the error as such
     if (!defined("_CONTROLPANEL")) {
         return $this->FormatResponse($error_array);
     } elseif (defined("_INSTALLER")) {
         show_error($error_array['error_text']);
         die;
     } else {
         // let's format the error slightly
         $CI =& get_instance();
         $CI->navigation->PageTitle('System Error');
         $view = $CI->load->view(branded_view('cp/error.php'), $error_array, true);
         return $view;
     }
 }
Example #2
0
 public function add()
 {
     // Get our plans
     $this->load->model('plan_model');
     $plans = $this->plan_model->GetPlans($this->user->Get('client_id'), array('plan_type' => 'paid'));
     // Grab our coupon types
     $coupon_types = $this->coupon_model->get_coupon_types();
     // Prep our page
     $data = array('coupon_types' => $coupon_types, 'plans' => $plans, 'form_title' => 'Create New Coupon', 'action' => 'new', 'form_action' => site_url('/coupons/post_coupon/new'));
     $this->load->view(branded_view('cp/coupon_form'), $data);
 }
Example #3
0
 /**
  * Update Account
  *
  * Update your account details, password, etc.
  *
  * @return string view
  */
 function index()
 {
     $this->navigation->PageTitle('Update My Account');
     $this->load->model('states_model');
     $countries = $this->states_model->GetCountries();
     $states = $this->states_model->GetStates();
     $client = $this->client_model->GetClient($this->user->Get('client_id'), $this->user->Get('client_id'));
     $client['gmt_offset'] = $client['timezone'];
     $data = array('form_title' => 'Update My Account', 'form_action' => 'account/post', 'states' => $states, 'countries' => $countries, 'form' => $client);
     $this->load->view(branded_view('cp/account_form.php'), $data);
 }
Example #4
0
</p>
<p><b>Subscriptions Cronjob Last Run:</b> <?php 
echo $dates->cron_last_run_subs ? date('D M j, Y g:i A', strtotime($dates->cron_last_run_subs)) : 'Never';
?>
</p>

<p><b>Cronjob Commands for *nix Servers:</b></p>

<p>The following cronjobs should be setup in your web hosting control panel. If you are unsure how of how to do this, please contact your web host
or your server administrator.</p>

<pre class="code">
*/5 * * * * wget -q -O /dev/null <?php 
echo rtrim($cp_link, '/');
?>
/cron/sendnotifications/<?php 
echo $cron_key;
?>
 >/dev/null 2>&1
5 5 * * * wget -q -O /dev/null <?php 
echo rtrim($cp_link, '/');
?>
/cron/subscriptionmaintenance/<?php 
echo $cron_key;
?>
 >/dev/null 2>&1
</pre>

<?php 
echo $this->load->view(branded_view('cp/footer'));
Example #5
0
			<?php 
}
?>
			<li>
				<label for="password" class="full">Password</label>
			</li>
			<li>
				<input type="password" autocomplete="off" class="text required full" id="password" name="password" value="" />
			</li>	
			<li>
				<label for="password2" class="full">Repeat Password</label>
			</li>
			<li>
				<input type="password" autocomplete="off" class="text required full" id="password2" name="password2" value="" />
			</li>
			<li>
				<div class="help" style="margin-left:0px">Passwords must be at least 6 characters in length.</div>
			</li>
			<li>
				<label for="timezone">Timezone</label>
				<?php 
echo timezone_menu($gmt_offset);
?>
			</li>
		</ol>
	</fieldset>
	<div class="submit"><input type="submit" class="button" name="continue" id="continue" value="Create Account" /></div>
</form>
<?php 
echo $this->load->view(branded_view('install/footer'));
Example #6
0
 function index()
 {
     $this->load->view(branded_view('cp/login.php'));
 }
Example #7
0
 /**
  * Update Credit Card
  */
 function update_cc($id)
 {
     $this->load->model('recurring_model');
     $recurring = $this->recurring_model->GetRecurring($this->user->Get('client_id'), $id);
     // load existing gateways
     $this->load->model('gateway_model');
     $gateways = $this->gateway_model->GetGateways($this->user->Get('client_id'), array());
     // load plans if they exist
     $this->load->model('plan_model');
     $plans = $this->plan_model->GetPlans($this->user->Get('client_id'), array());
     $data = array('recurring' => $recurring, 'gateways' => $gateways, 'plans' => $plans);
     $this->load->view(branded_view('cp/update_cc'), $data);
 }
Example #8
0
 /**
  * Show login screen
  */
 function login()
 {
     $this->load->view(branded_view('cp/login'));
 }
Example #9
0
 /**
  * Edit customer
  *
  * Edit customer address, etc.
  *
  * @return string view
  */
 function edit($id)
 {
     $this->navigation->PageTitle('Edit Customer');
     $this->load->model('states_model');
     $countries = $this->states_model->GetCountries();
     $states = $this->states_model->GetStates();
     $this->load->model('customer_model');
     $customer = $this->customer_model->GetCustomer($this->user->Get('client_id'), $id);
     $data = array('form_title' => 'Edit Customer', 'form_action' => 'customers/post_edit/' . $id, 'states' => $states, 'countries' => $countries, 'form' => $customer);
     $this->load->view(branded_view('cp/customer_form.php'), $data);
 }
Example #10
0
<?php

echo $this->load->view(branded_view('cp/html_header'));
?>
<body>
	<div id="notices"><?php 
echo get_notices();
?>
</div>
	<div id="header">
		<div id="app_bar">
			<span class="app_name"><a href="<?php 
echo site_url();
?>
" class="tooltip" title="Open the homepage of your website."><?php 
echo setting('site_name');
?>
</a></span> | Control Panel
			<div id="logged_in">
				logged in as <span class="username"><?php 
echo $this->user_model->get('username');
?>
</span> (<a href="<?php 
echo site_url('admincp/logout');
?>
">logout</a>)
			</div>
			<a id="get_support" href="<?php 
echo setting('app_support');
?>
">Get Support</a>
Example #11
0
 /**
  * API Access
  *
  * Display the current API login ID and Secret Key.
  *
  */
 function api()
 {
     $data = array('api_id' => $this->user->Get('api_id'), 'secret_key' => $this->user->Get('secret_key'));
     $this->load->view(branded_view('cp/api_key.php'), $data);
 }
Example #12
0
 function complete()
 {
     $this->load->model('client_model');
     $this->load->library('session');
     $this->load->helper('url');
     $this->load->helper('file');
     $client_id = $this->session->userdata('client_id');
     // get admin client
     $client = $this->client_model->GetClient($client_id, $client_id);
     // write the file that disables the installer - they can't even refresh this page now
     write_file(APPPATH . 'config/installed.php', '<?php /* OpenGateway is installed */ ?>', 'w');
     $vars = array('client' => $client, 'password' => $this->session->userdata('client_password'), 'cron_key' => $this->config->item('cron_key'), 'cp_link' => site_url(), 'api_link' => site_url('api'));
     $this->load->view(branded_view('install/complete.php'), $vars);
 }
Example #13
0
 /**
  * Edit Plan
  *
  * Show the plan form, preloaded with variables
  *
  * @param int $id the ID of the plan
  *
  * @return string The plan form view
  */
 function edit($id)
 {
     $this->navigation->PageTitle('Edit Plan');
     $this->load->model('plan_model');
     $this->load->model('email_model');
     $triggers = $this->email_model->GetTriggers();
     $plan = $this->plan_model->GetPlan($this->user->Get('client_id'), $id);
     $form = array('name' => $plan['name'], 'type' => $plan['type'], 'amount' => $plan['type'] != 'free' ? $plan['amount'] : '', 'interval' => $plan['interval'], 'notification_url' => $plan['notification_url'] == '' ? 'http://' : $plan['notification_url'], 'occurrences' => $plan['occurrences'], 'free_trial' => $plan['free_trial']);
     $data = array('form_title' => 'Edit Plan', 'form_action' => 'plans/post/edit/' . $plan['id'], 'form' => $form, 'triggers' => $triggers);
     $this->load->view(branded_view('cp/plan_form.php'), $data);
 }
Example #14
0
 function complete()
 {
     $this->load->helper('file');
     // write the file that disables the installer - they can't even refresh this page now
     write_file(APPPATH . 'config/installed.php', '<?php /* App is installed */ ?>', 'w');
     $vars = array('username' => $this->session->userdata('username'), 'email' => $this->session->userdata('email'), 'password' => $this->session->userdata('password'), 'cron_key' => $this->config->item('cron_key'), 'cp_link' => site_url('admincp'));
     $this->load->view(branded_view('install/complete.php'), $vars);
 }
Example #15
0
 /**
  * Edit Client
  *
  * Edit an existing client
  *
  * @return string view
  */
 function edit($id)
 {
     $this->navigation->PageTitle('Edit Client');
     $this->load->model('states_model');
     $countries = $this->states_model->GetCountries();
     $states = $this->states_model->GetStates();
     $client = $this->client_model->GetClient($this->user->Get('client_id'), $id);
     $client['gmt_offset'] = $client['timezone'];
     $client['client_type'] = $client['client_type_id'];
     $data = array('form_title' => 'Edit Client', 'form_action' => 'clients/post/edit/' . $id, 'action' => 'edit', 'states' => $states, 'countries' => $countries, 'form' => $client);
     $this->load->view(branded_view('cp/client_form.php'), $data);
 }