示例#1
0
 public function __construct($registry)
 {
     $this->registry = $registry;
     $this->registry->path = $_GET['path'];
     $this->registry->registerPath();
     parent::__construct($this->registry);
 }
示例#2
0
 private function getTemplate($params)
 {
     $sql = "\n\t\t\tSELECT body\n\t\t\tFROM email_body\n\t\t\tWHERE template='" . $this->template . "'\n\t\t";
     $message = $this->registry->db->getRow($sql);
     if (PEAR::isError($message)) {
         $this->registry->Error($message->getMessage(), $message->getDebugInfo());
         $this->setMailBody(PEAR::raiseError('Database query failed.'));
     } else {
         $message->body = Uthando::templateParser($message->body, $params, '####', '####');
         $this->setMailBody($message->body);
     }
 }
示例#3
0
 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;
 }
示例#4
0
 private function parse_list()
 {
     $sections = Uthando::array_flatten($this->includes);
     foreach ($this->path as $value) {
         $folder = split('/', $value);
         foreach ($sections as $file) {
             if ($file == $folder[1]) {
                 array_push($this->scripts, $this->source_root . $value . '.js');
                 continue;
             }
         }
     }
     if ($this->add_at_end) {
         if (is_array($this->add_at_end)) {
             foreach ($this->add_at_end as $file) {
                 array_push($this->scripts, $file);
             }
         } else {
             array_push($this->scripts, $this->add_at_end);
         }
     }
 }
示例#5
0
 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();
     }
 }
示例#6
0
 public function __construct($registry)
 {
     parent::__construct($registry);
     $this->loadLang();
 }
示例#7
0
$ini_path = '.' . PATH_SEPARATOR . __PHP_PATH . PATH_SEPARATOR . __PHP_PATH . '/PEAR' . PATH_SEPARATOR . __PHP_PATH . '/Uthando' . PATH_SEPARATOR . __PHP_PATH . '/Uthando/functions' . PATH_SEPARATOR . __SITE_PATH . '/modules' . PATH_SEPARATOR . __SITE_PATH . '/components';
set_include_path($ini_path);
// Include functions.
require_once 'functions.php';
$timer = new Benchmark_Timer();
$timer->start();
$registry = new Registry();
require 'Dbug/FirePHP.class.php';
$registry->firephp = FirePHP::getInstance(true);
$registry->setSite(realpath(__SITE_PATH . '/../uthando/ini/uthandoSites.ini.php'));
$registry->loadIniFile('uthando', 'config');
$registry->setDefaults();
if ($registry->get('config.server.compat_router')) {
    require_once 'includes/CompatRouter.php';
}
$uthando = new Uthando($registry);
$registry->template = new HTML_Template($registry, $registry->get('config.site.template'));
$registry->template->addParameter('merchant_name', $registry->get('config.server.site_name'));
$registry->session = new Session($registry);
UthandoUser::setUserInfo();
if (UthandoUser::authorize()) {
    $registry->loggedInUser = true;
    $uthando->addParameter('login_status', "<p>You are logged in as: " . $_SESSION['name'] . "</p>");
} else {
    $registry->loggedInUser = false;
}
try {
    $registry->db = new DB_Core($registry);
    // Load component.
    $uthando->loadComponent();
    // Get Modules and add them.
示例#8
0
                $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>');
    }
}
示例#9
0
 public function displayCart()
 {
     global $uthando;
     $cb = file_get_contents('ushop/html/cart_body.html', true);
     $ci = file_get_contents('ushop/html/cart_items.html', true);
     if (!$uthando->ushop->checkout['vat_state']) {
         $ci = UShop_Utility::removeSection($ci, 'vat');
     }
     if (!$uthando->ushop->checkout['vat_state']) {
         $cb = UShop_Utility::removeSection($cb, 'vat');
     }
     $params = array('COLSPAN' => $uthando->ushop->checkout['vat_state'] == 1 ? 3 : 2, 'CART_ITEMS' => null);
     $items = $this->calculateCartItems();
     if (is_array($items)) {
         foreach ($items as $item) {
             $tr = Uthando::templateParser($ci, $item, '{', '}');
             $params['CART_ITEMS'] .= $tr;
         }
         if (isset($_SESSION['CountryCode'])) {
             $this->calculatePostage();
         } else {
             $this->cart['postCost'] = 0;
             $this->cart['postTax'] = 0;
             $cb = UShop_Utility::removeSection($cb, 'postage');
         }
         $params = array_merge($params, $this->getCartTotals());
         $html = Uthando::templateParser($cb, $params, '{', '}');
     } else {
         $html = $items;
     }
     return $html;
 }
示例#10
0
            } 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');
    }
}
示例#11
0
 public function displayCartInvoice($user)
 {
     $html = file_get_contents('ushop/html/invoice.html', true);
     $cart = $this->retrieveCart();
     $user_info = $this->getUserInfo($user);
     $params = array('CART' => $cart->displayCart(), 'USER_INFO' => $user_info['info'], 'USER_CDA' => $user_info['cda'], 'USER_EMAIL' => $user_info['email'], 'MERCHANT_DETAILS' => $this->getMerchantInfo());
     $html = Uthando::templateParser($html, $params, '{', '}');
     $html = preg_replace("/<th>(.*?)<\\/th>/s", "", $html);
     $remove = array('delete_item', 'item_quantity_input');
     if (!$this->invoice['display_top']) {
         $remove[] = 'top';
     }
     if (!$this->invoice['display_bottom']) {
         $remove[] = "bottom";
     }
     foreach ($remove as $value) {
         $html = UShop_Utility::removeSection($html, $value);
     }
     return $html;
 }
示例#12
0
    $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;
}
示例#13
0
<?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;
}
示例#15
0
         $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);
示例#16
0
define('COMPONENTS', BASE . DS . 'Uthando-Lib' . DS . 'components' . DS . 'public' . DS);
define('FUNCS', BASE . DS . 'Uthando-Lib' . DS . 'functions' . DS);
define('TEMPLATES', BASE . DS . 'Uthando-Templates' . DS);
define('SCHEME', isset($_SERVER['HTTPS']) ? 'https://' : 'http://');
define('HOST', $_SERVER['HTTP_HOST']);
define('REQUEST_URI', $_SERVER['REQUEST_URI']);
// Set include paths.
$ini_path = get_include_path() . PS . CLASSES . PS . FUNCS . PS . MODULES . PS . COMPONENTS;
set_include_path($ini_path);
// Include functions.
require_once 'functions.php';
$registry = new Registry($_GET['path']);
$registry->setSite(BASE . DS . 'Uthando-ini' . DS . 'UthandoSites.ini' . EXT);
$registry->loadIniFile('uthando', 'config');
$registry->setDefaults();
$uthando = new Uthando($registry);
$uthando->timer = new Benchmark_Timer();
$uthando->timer->start();
$registry->template = new AjaxContent($registry);
$registry->template->setTemplate('/home/' . $registry->get('settings.dir') . '/Public/' . $registry->get('settings.resolve') . '/template_files/html/ajax_content.php');
$registry->template->addParameter('merchant_name', $registry->get('config.server.site_name'));
$registry->session = new Session($registry);
UthandoUser::setUserInfo();
if (UthandoUser::authorize()) {
    $registry->loggedInUser = true;
    $uthando->AddParameter('login_status', "<p>You are logged in as: " . $_SESSION['name'] . "</p>");
} else {
    $registry->loggedInUser = false;
}
try {
    $registry->db = new DB_Core($registry);
示例#17
0
            // 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');
    }
}
示例#18
0
 protected function queryMenu($menu_id)
 {
     $menu = array();
     if ($this->status == "LI") {
         $status = "LO";
     } else {
         $status = "LI";
     }
     $tree = new NestedTree($this->db_table . 'menu_items', $menu_id, 'item');
     $decendants = $tree->getDecendants(true);
     $search_categories = null;
     if ($decendants) {
         foreach ($decendants as $key => $value) {
             $search_categories .= $decendants[$key]['item_id'] . ',';
         }
         $search_categories = substr($search_categories, 0, -1);
         $fields = 'item_id, item, status, url, enssl, page_id';
         $join = array($this->registry->core . 'menu_link_status', $this->db_table . 'menu_urls');
         $result = $this->registry->db->getResult($fields, 'menu_items', $join, array('WHERE' => "status != '" . $status . "'", 'AND' => 'item_id IN (' . $search_categories . ')', 'ORDER BY' => 'lft ASC'));
     } else {
         $result = false;
     }
     if ($result) {
         foreach ($result as $row) {
             $menu[] = Uthando::objectToArray($row);
         }
         foreach ($menu as $key => $value) {
             $return_menu[$key] = $value;
             if (is_numeric($value['page_id'])) {
                 $page = $this->registry->db->getResult('page', $this->db_table . 'pages', null, array('WHERE' => 'page_id=' . $value['page_id']), false);
                 $return_menu[$key]['page'] = $page->page;
             }
             $return_menu[$key]['lft'] = $decendants[$key]['lft'];
             $return_menu[$key]['rgt'] = $decendants[$key]['rgt'];
             $return_menu[$key]['depth'] = $decendants[$key]['depth'] - 1;
         }
         if ($return_menu) {
             foreach ($return_menu as $key => $value) {
                 $category[$key] = $value['lft'];
             }
             array_multisort($category, SORT_ASC, $return_menu);
         }
         return $return_menu;
     } else {
         return false;
     }
 }
示例#19
0
<?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();
}
示例#20
0
<?php

// no direct access
defined('PARENT_FILE') or die('Restricted access');
defined('SHOP_PARENT_FILE') or die('Restricted access');
defined('SHOP_STAGE_2') or die('Restricted access');
if (UthandoUser::authorize()) {
    $title .= ' - Cheque Payment';
    $this->addContent('<h2>Payment: Step 3 of 3</h2>');
    $this->addContent('<p>Thank you for your order we will depatch your goods as soon as we receive your cleared payment</p>');
    $this->addContent('<p>Please make cheques payable to: ' . $this->get('config.server.site_name') . '</p><p>And send it to:-</p>');
    $store = $this->ushop->store;
    $c = 0;
    $data = array();
    foreach ($store as $key => $value) {
        if ($value != '') {
            $data[$c] = array(ucwords(str_replace('_', ' ', $key)) . ':', $value);
            $c++;
        }
    }
    array_unshift($data, array('Company', $this->get('config.server.site_name')));
    $table = Uthando::dataTable($data);
    $table->setAttributes(array('id' => 'merchant_address'));
    $html = $table->toHtml();
    $html = preg_replace("/<th>(.*?)<\\/th>/s", "", $html);
    $this->addContent($html);
} else {
    header("Location" . $this->get('config.server.web_url'));
    exit;
}