<?php /** * Remove the logo from the account. */ namespace saasy; // Authorize user if (!App::authorize($page, $tpl)) { return; } $customer = App::customer(); $acct = App::acct(); if ($acct->type != 'owner') { $this->redirect(App::href() . '/account'); } $customer->remove_logo(); // TODO: add notification for user $this->redirect(App::href() . '/account');
<?php /** * Loads the custom handlers for each section, and provides * access control between customers. */ namespace saasy; // Authorize user if (!App::authorize($page, $tpl)) { return; } $section = isset($this->params[0]) ? $this->params[0] : false; // Redirect to internal handler if specified if (in_array($section, array('account', 'api', 'login', 'search', 'signup', 'user'))) { echo $this->run('saasy/' . $section); return; } if (!$section) { $this->redirect(App::href() . '/' . App::first_section()); } Section::set($section); $page->title = Section::name(); echo Section::body();
\User::val('email', $_POST['email']); if (!empty($_POST['new_pass'])) { \User::val('password', \User::encrypt_pass($_POST['new_pass'])); } \User::save(); if (is_uploaded_file($_FILES['photo']['tmp_name'])) { $acct->save_photo($_FILES['photo']); } if ($acct->type === 'owner') { // update customer too $customer->name = $_POST['customer_name']; if ($customer->subdomain !== $_POST['subdomain']) { $customer->subdomain = $_POST['subdomain']; $domain_has_changed = true; } else { $domain_has_changed = false; } if (!$customer->put()) { return false; } if (is_uploaded_file($_FILES['customer_logo']['tmp_name'])) { $customer->save_logo($_FILES['customer_logo']); } if ($domain_has_changed) { echo \View::render('saasy/account_redirect', array('redirect' => $form->controller->is_https() ? 'https://' . $customer->subdomain . '.' . App::base_domain() . '/' : 'http://' . $customer->subdomain . '.' . App::base_domain() . '/')); return; } } \Notifier::add_notice(__('Your settings have been updated.')); $form->controller->redirect(App::href() . '/account'); });