public function setSite($file) { $settings = parse_ini_file($file, true); $this->settings = $settings[$this->server]; /*foreach ($settings['general'] as $key => $value): $this->$key = $value; endforeach;*/ if (!$this->settings) { Uthando::go('/index3.php'); } $this->ini_dir = BASE . DS . 'Uthando-ini' . DS . $this->server; }
public function registerPath() { $br = new Browser(); switch ($br->Name) { case 'Firefox': case 'Mozilla': case 'Safari': case 'Opera': $browser = true; break; default: $browser = false; break; } if (!$browser) { Uthando::go('/index2.php'); } if ($this->path == '/index.php' || $this->path == '/') { $this->path = $this->get('admin_config.site.default_page'); parent::registerPath(); } else { parent::registerPath(); } }
<?php // no direct access defined('PARENT_FILE') or die('Restricted access'); if ($this->authorize()) { if ($post_zones = $this->getResult('post_zone_id, tax_code, zone', $ushop->db_name . 'post_zones', $ushop->db_name . 'tax_codes')) { $c = 0; $data = array(); foreach ($post_zones as $row) { $data[$c][] = $row->zone; $data[$c][] = $row->tax_code; $data[$c][] = '<a href="/ushop/postage/action-edit_zone/id-' . $row->post_zone_id . '" style="text-decoration:none;" ><img src="/images/24x24/Edit3.png" class="Tips" title="Edit Post Zone" rel="Click to edit this zone." /></a>'; $data[$c][] = '<a href="/ushop/postage/action-delete_zone/id-' . $row->post_zone_id . '" ><img src="/images/24x24/Delete.png" class="Tips" title="Delete Post Zone" rel="Click to delete this zone" /></a>'; $c++; } $header = array('Zone', 'Tax Code', '', ''); $table = $this->dataTable($data, $header); $zones = $table->toHtml(); } else { $params['TYPE'] = 'info'; $params['MESSAGE'] = !$tax_codes ? '<h2>First define some tax codes.</h2>' : '<h2>There are currently no records.</h2>'; } if (isset($params)) { $zones = $this->message($params); } } else { Uthando::go(); }
} else { $ed_message['TYPE'] = 'error'; $ed_message['MESSAGE'] = '<h2>Page could not be edited.</h2>'; } } else { $row = $this->getResult('page, content, params', $this->registry->core . 'pages', null, array('where' => 'page_id=' . $this->registry->params['id']), false); $row->params = parse_ini_string($row->params, true); $form->setDefaults(Uthando::objectToArray($row)); $renderer = new UthandoForm(TEMPLATES . $this->get('admin_config.site.template')); $renderer->setFormTemplate('form'); $renderer->setHeaderTemplate('header'); $renderer->setElementTemplate('element'); $form->accept($renderer); // output the form $menuBar = array('html' => '', 'edit' => '', 'params' => '', 'cancel' => '/' . $this->registry->component . '/overview', 'save' => ''); $this->content .= $this->makeToolbar($menuBar, 24); $this->content .= $renderer->toHtml(); $this->loadJavaScript(array('/editors/tiny_mce/tiny_mce_gzip.js', '/uthando-js/uthando/admin/tinyMCEGz.js', '/editors/CodeMirror/js/codemirror.js')); $this->addComponentJS(array('article', 'editor', 'editorConfig')); $this->addComponentCSS(array('FileManager', 'Additions')); $session = Utility::encodeString(session_id()); $this->addScriptDeclaration("UthandoAdmin.sid = ['" . $session[0] . "','" . $session[1] . "'];"); } if (isset($ed_message)) { $ed_message['CONTENT'] = $this->makeMessageBar($menuBar, 24); $this->content .= $this->message($ed_message); } } else { Uthando::go('/' . $this->registry->component . '/overview'); } }
// Apply form element filters. $form->freeze(); $values = $form->process(array(&$this, 'formValues'), false); $result = $this->update($values, $this->registry->core . 'menu_items', array('where' => 'item_id=' . $this->registry->params['id'])); $menuBar['back'] = '/menu/overview'; // Always check that result is not an error if ($result) { $params['TYPE'] = 'pass'; $params['MESSAGE'] = '<h2>Menu was successfully edited.</h2>'; } else { $params['TYPE'] = 'error'; $params['MESSAGE'] = '<h2>Menu could not be edited to the database.</h2>'; } } else { $form->setDefaults(array('item' => $row->item, 'menu_type_id' => $row->menu_type_id, 'status_id' => $row->status_id)); $renderer = new UthandoForm(TEMPLATES . $this->get('admin_config.site.template')); $renderer->setFormTemplate('form'); $renderer->setHeaderTemplate('header'); $renderer->setElementTemplate('element'); $form->accept($renderer); // output the form $this->content .= $renderer->toHtml(); } if (isset($params)) { $params['CONTENT'] = $this->makeMessageBar($menuBar, 24); $this->content .= $this->message($params); } } else { Uthando::go('/menu/overview'); } }
$validated = false; } } if ($validated) { session_regenerate_id(); $_SESSION['user_id'] = $row->user_id; $_SESSION['name'] = $row->name; $_SESSION['user_group'] = $row->user_group; if ($this->get('config.server.enable_ssl')) { $url = $this->get('config.server.ssl_url'); } else { $url = $this->get('config.server.web_url'); } if (isset($_SESSION['http_referer'])) { $page = urldecode($_SESSION['http_referer']); unset($_SESSION['http_referer']); } else { $page = null; } Uthando::go($page); } else { // password didn't match. $this->registry->Error('The password entered does not match that on file.', '<a href="' . $_SERVER['REQUEST_URI'] . '">Try Again</a>'); } } elseif ($num_row > 1) { $this->registry->Error("Are you trying to hack this site?"); } else { // no user found. $this->registry->Error('The email entered does not match those on file.', '<a href="' . $_SERVER['REQUEST_URI'] . '">Try Again</a>'); } }
$s->loadArray($country_opts); $form->addElement($s); $form->addElement('text', 'phone', 'Phone Number:', array('size' => 20, 'maxlength' => 100, 'class' => 'inputbox')); $form->addRule('address1', 'Please enter the first line of your address', 'required'); $form->addRule('city', 'Please enter your city', 'required'); $form->addRule('county', 'Please enter your county', 'required'); $form->addRule('post_code', 'Please enter your postcode', 'required'); $form->addRule('country_id', 'Please enter your country', 'required'); $form->addRule('phone', 'Please enter your phone number', 'required'); if ($form->validate()) { $form->applyFilter('__ALL__', 'escape_data'); $form->freeze(); $values = $form->process(array(&$this, 'formValues'), false); try { $res = $this->registry->db->update($values, $this->ushop->db_name . 'user_info', array('WHERE' => 'user_info_id=' . $user->user_info_id)); } catch (PDOException $e) { $this->registry->Error($e->getMessage()); } Uthando::go('/ushop/checkout'); } else { $form->setDefaults(array('prefix_id' => $user->prefix_id, 'address1' => $user->address1, 'address2' => $user->address2, 'address3' => $user->address3, 'city' => $user->city, 'county' => $user->county, 'post_code' => $user->post_code, 'country_id' => $user->country_id, 'phone' => $user->phone)); $form->addElement('submit', null, 'Send', array('class' => 'button')); // Output the form $this->addContent('<div id="products">'); $this->addContent($form->toHtml()); $this->addContent('</div>'); } } else { header("Location" . $this->registry->config->get('web_url', 'SERVER')); exit; }
<?php // no direct access defined('PARENT_FILE') or die('Restricted access'); if (UthandoUser::authorize()) { $_SESSION['http_referer'] = '/user/change_details'; $this->addContent('<p><a href="/user/change_details">Change your details</a></p>'); } else { Uthando::go('../../index.php'); }
$s = $form->createElement('select', 'country_id', 'Country:', null, array('class' => 'selectbox')); $s->loadArray($country_opts); $form->addElement($s); $form->addElement('text', 'phone', 'Phone Number:', array('size' => 20, 'maxlength' => 100, 'class' => 'inputbox')); $form->addRule('address1', 'Please enter the first line of your address', 'required'); $form->addRule('city', 'Please enter your city', 'required'); $form->addRule('county', 'Please enter your county', 'required'); $form->addRule('post_code', 'Please enter your postcode', 'required'); $form->addRule('country', 'Please enter your country', 'required'); $form->addRule('phone', 'Please enter your phone number', 'required'); if ($form->validate()) { // Apply form element filters. $form->applyFilter('__ALL__', 'escape_data'); $form->freeze(); $values = $form->process(array(&$this, 'formValues'), false); $values['user_id'] = $_SESSION['user_id']; try { $res = $this->registry->db->insert($values, $this->ushop->db_name . 'user_info'); } catch (PDOException $e) { $this->registry->Error($e->getMessage()); } Uthando::go($_SERVER['REQUEST_URI']); } else { $form->addElement('submit', null, 'Send', array('class' => 'button')); // Output the form $this->addContent($form->toHtml()); } } else { header("Location" . $this->registry->config->get('web_url', 'SERVER')); exit; }
$params['MESSAGE'] = 'You do not have permission to delete this user'; $pass = false; } elseif ($this->upid == 1 && $num_su == 1 && $user->user_group == 'super administrator') { $params['TYPE'] = 'info'; $params['MESSAGE'] = 'You must have at least one super administrator'; $pass = false; } else { $pass = true; } if (isset($this->registry->params['action']) == 'delete' && $pass) { $result = $this->registry->db->remove($this->registry->user . 'users', 'user_id=' . $this->registry->params['id']); // Always check that result is not an error if (!$result) { $this->registry->Error("Could not delete user."); } else { Uthando::go('/user/overview'); } } elseif ($pass) { $menuBar = array('cancel' => '/user/overview', 'delete' => '/user/delete/id-' . $this->registry->params['id'] . '/action-delete'); $params['TYPE'] = 'warning'; $params['MESSAGE'] = 'Are you sure you want to delete this user'; } else { $menuBar['back'] = '/user/overview'; } } else { $menuBar['back'] = '/user/overview'; $params['TYPE'] = 'info'; $params['MESSAGE'] = 'You do not have permission to delete this user'; } if (isset($params)) { $params['CONTENT'] = $this->makeMessageBar($menuBar, 24);