Example #1
0
if (isset($_GET['VIEW']) && !empty($_GET['VIEW']) || isset($_GET['PROFILE']) && !empty($_GET['PROFILE'])) {
    // Login as the user
    if (isset($_GET['VIEW'])) {
        $client_id = $_GET['VIEW'];
        $redirect_url = '/dashboard/dashboard';
    } else {
        $client_id = $_GET['PROFILE'];
        $redirect_url = '/users/profile';
    }
    $_SESSION['FAKE_LOGIN'] = $_SESSION['user']['PARTY_ID'];
    $client = users_get_login($client_id);
    user_login($client['USER_LOGIN_ID'], $client['CURRENT_PASSWORD']);
    $_SESSION['user']['IS_ADMIN'] = false;
    $_SESSION['user']['LAST_ACTION'] = time();
    header(sprintf('location: %s', $redirect_url));
    exit;
}
if (isset($_GET['DELETE']) && !empty($_GET['DELETE'])) {
    if (!party_exists($_GET['DELETE'])) {
        $errors[] = sprintf('Customer with id %s does not exist', $_GET['DELETE']);
    } else {
        $person = person_get($_GET['DELETE']);
        person_status_update($_GET['DELETE'], DELETED);
        $success[] = sprintf('Customer: %s %s has been marked as deleted', $person['FIRST_NAME'], $person['LAST_NAME']);
    }
}
$page = forms_get_page();
$customers = users_get_clients($page, 'pe.FIRST_NAME', 'ASC');
$template = set_template('users', 'index');
$link = THEME . 'template.php';
require_once $link;
Example #2
0
<?php

if (!isset($_SESSION['user'])) {
    header('location: /');
    exit;
}
import('pagination');
import('checkout');
$pagination = array();
$orders = get_all_orders($pagination);
$template = set_template('test', 'orders');
$link = THEME . 'template2.php';
require_once $link;
Example #3
0
// puhasta url
evaluate_url();
// siia mingi inputi valideerimine
define("FORCED_LANG", $_GET["lang"]);
$ex = explode(SLASH, $_GET["page"]);
if (valid_language($ex[0])) {
    array_shift($ex);
}
$page = implode(SLASH, $ex);
$subpages = false;
// kas selline leht on olemas?
$lang_page = language_oriented(PAGES, $page . PHP);
if ($lang_page) {
    require_once PATH . PAGES . SLASH . FORCED_LANG . SLASH . $page . PHP;
} elseif (file_exists(PATH . PAGES . SLASH . $page . PHP)) {
    require_once PATH . PAGES . SLASH . $page . PHP;
}
set_template($page);
$lang_template = language_oriented(TEMPLATES, TEMPLATE . TWIG);
// anna tagasi mille pihta kasutaja suunata
if ($lang_template) {
    echo substr($lang_template . SLASH . TEMPLATE, 1);
} elseif (file_exists(PATH . TEMPLATES . SLASH . TEMPLATE . TWIG)) {
    if (TEMPLATE == LANDING_PAGE) {
        echo FORCED_LANG;
    } else {
        echo FORCED_LANG . SLASH . TEMPLATE;
    }
} else {
    echo FORCED_LANG;
}
Example #4
0
                contact_delete($_SESSION['user']['PARTY_ID'], ORDER_CONTACTS);
                contact_add($_SESSION['user']['PARTY_ID'], COMPANY_CONTACT, array(CNT_ATTR_NAME => $_POST['NAME'], CNT_ATTR_STREET => $_POST['STREET'], CNT_ATTR_POSTAL => $_POST['POSTAL'], CNT_ATTR_CITY => $_POST['CITY'], CNT_ATTR_COUNTRY => $_POST['COUNTRY'], CNT_ATTR_PHONE => $_POST['PHONE']));
                contact_add($_SESSION['user']['PARTY_ID'], CONTACT_PERSON_CONTACT, array(CNT_ATTR_EMAIL => $_POST['CONTACT_EMAIL'], CNT_ATTR_PHONE => $_POST['CONTACT_PHONE']));
                contact_add($_SESSION['user']['PARTY_ID'], ORDER_CONTACTS, array(CNT_ATTR_EMAIL => $_POST['ORDER_EMAIL'], CNT_ATTR_FTP_ADDR => $_POST['ORDER_FTP_ADDRESS'], CNT_ATTR_FTP_USER => $_POST['ORDER_FTP_USER'], CNT_ATTR_FTP_PASS => $_POST['ORDER_FTP_PASS']));
                $success[] = 'Your profile has been updated';
            } catch (Exception $e) {
                $errors[] = $e->getMessage();
            }
        }
    }
    // Getting clients data
    $customer = person_get($_SESSION['user']['PARTY_ID']);
    $user_login = users_get_login($_SESSION['user']['PARTY_ID']);
    $affiliate = person_affiliate_get($_SESSION['user']['PARTY_ID']);
    $contacts = contact_mech_get($_SESSION['user']['PARTY_ID'], COMPANY_CONTACT);
    $contact_attributes = array();
    foreach ($contacts['attributes'] as $_attr) {
        $contact_attributes[$_attr['ATTR_NAME']] = $_attr['ATTR_VALUE'];
    }
    $contact_person_contacts = contact_mech_get($_SESSION['user']['PARTY_ID'], CONTACT_PERSON_CONTACT);
    foreach ($contact_person_contacts['attributes'] as $_attr) {
        $contact_person['CONTACT_' . $_attr['ATTR_NAME']] = $_attr['ATTR_VALUE'];
    }
    $order_contacts = contact_mech_get($_SESSION['user']['PARTY_ID'], ORDER_CONTACTS);
    foreach ($order_contacts['attributes'] as $_attr) {
        $order_contacts_attributes['ORDER_' . $_attr['ATTR_NAME']] = $_attr['ATTR_VALUE'];
    }
}
$template = set_template('users', 'profile');
$link = THEME . 'template.php';
require_once $link;
Example #5
0
import('delivery');
import('html');
import('contacts');
import('orders');
import('shipments');
import('forms');
import('contacts');
import('documents');
$order_id = $_GET['id'];
if (order_exists($order_id)) {
    $order = order_get($order_id);
    if ($order['PARTY_ID'] == $_SESSION['user']['PARTY_ID']) {
        $order_cart = unserialize($order['SESSION_SERILIALIZE']);
        $documents = documents_get($order_id);
        $shipment = shipment_get($order_id);
        if (!empty($shipment)) {
            if ($shipment['DESTINATION_CONTACT_MECH_ID'] == SHIPMENT_REQUISITION) {
                $address = 'Look at requisition files';
            } else {
                $address = contact_generate_string(contact_mech_get_attributes($shipment['DESTINATION_CONTACT_MECH_ID']));
            }
        }
    } else {
        $errors[] = sprintf('Order %d does not belong to you!', $order_id);
    }
} else {
    $errors[] = sprintf('Order %d does not exist!', $order_id);
}
$template = set_template('orders', 'view');
$link = THEME . 'template.php';
require_once $link;
Example #6
0
<?php

import('session');
import('forms');
if (!is_admin()) {
    header('location: /users/logut');
    exit;
}
if (isset($_POST) && !empty($_POST)) {
    foreach ($_POST as $key => $value) {
        set_setting($key, $value);
    }
    $success[] = 'New settings saved!';
    $system_settings = get_settings();
}
$template = set_template('dashboard', 'parameters');
$link = THEME . 'template.php';
require_once $link;
Example #7
0
File: eesti.php Project: p2ska/mass
<?php

set_template($subpages);
//set_template("midagi");
if (defined("CHECK_TEMPLATE")) {
    return false;
}
// data
$v->eesti = "kana";
if ($subpages) {
    $v->sina_siin = "tere!?";
}
Example #8
0
<?php

if (!isset($_SESSION['user'])) {
    header('location: /');
    exit;
}
$template = set_template('test', 'index');
$link = THEME . 'template2.php';
require_once $link;
Example #9
0
                        $Offer->addProduct($Product, $pageArr[0]);
                    }
                    break;
                case BEGINING_PRODUCT_PAGE:
                    // If we have reached the end of the page the
                    // address of megamedia has come and a new page has
                    // begun so we increment and switch that status
                    if ($_row == sprintf('%s/%s', $current_page, $Offer->max_pages)) {
                        parse_product_data($Offer, $current_product, $current_page);
                        $current_page++;
                        $current_product = [];
                        $status = MEGAMEDIA_ADDRESS;
                    } else {
                        $current_product[] = $_row;
                    }
                    break;
            }
            array_shift($debug);
        }
        // End of foreach
        $Offer->validateMotives();
        $Offer->validateDeliveryDates();
        $Offer->validateAmount();
        $Offer->validateQuality();
    } catch (Exception $e) {
        $errors[] = $e->getMessage();
    }
}
$template = set_template('parse', 'parse');
$link = THEME . 'template.php';
require_once $link;
Example #10
0
<?php

import('session');
import('orders');
import('forms');
$page = forms_get_page();
$orders = orders_get($page, [ORDER_APPROVED, ORDER_OFFER], ORDER_NORMAL, $_SESSION['user']['PARTY_ID'], false, false, false);
$template = set_template('orders', 'list');
$link = THEME . 'template.php';
require_once $link;
Example #11
0
    if (empty($weeks)) {
        insert_to_db('orders_weeks', array('order_id' => $order_id, 'week_number' => $week_number, 'type' => $type_key));
    } else {
        update_in_db('orders_weeks', array('week_number' => $week_number), 'id = ' . $weeks['id']);
    }
    $_SESSION['order_id'] = $order_id;
    header('location: /test/checkout');
    exit;
}
import('store');
import('checkout');
$template_name = 'additional_' . $type;
// if user clicked last button getting last order details and showing last order template
if ('last' == get_url_param(3)) {
    $additional_orders = get_last_additional_banner_order($_SESSION['user']['id'], $type_key);
    if ($additional_orders) {
        $template_name .= '_last';
    } else {
        header('location: /test/additional/' . $type);
        exit;
    }
}
//setting view template
$template = set_template('test', $template_name);
$link = THEME . 'template2.php';
$stores = db_query_to_array("SELECT * FROM stores");
$stores_methods = array();
foreach ($stores as $store) {
    $stores_methods[$store['id']] = get_store_hanging_methods($store['id']);
}
require_once $link;
Example #12
0
}
$store = db_query_to_row("SELECT * FROM `stores` WHERE id = {$id}");
if (!$store) {
    die('store not found');
}
import('store');
if (isset($_POST['shop_name'])) {
    $update = array();
    if (!store_validate($update)) {
        $error_msg = 'All fields must be filled';
    } else {
        $hanging_methods = $update['hanging_methods'];
        unset($update['hanging_methods']);
        if (update_in_db('stores', $update, '`id`=' . $id)) {
            delete_from_db('stores_hanging_methods', '`store_id`=' . $id);
            $store_hanging_methods = array();
            foreach ($hanging_methods as $value) {
                $store_hanging_methods[] = array('store_id' => $id, 'hanging_method_id' => $value);
            }
            insert_multi_to_db('stores_hanging_methods', $store_hanging_methods);
            $_SESSION['edit_store_msg'] = 'Store Successfully Updated';
            header('location: /store/edit/' . $id);
            die;
        }
    }
}
$hanging_methods = get_hanging_methods();
$store_hanging_methods = db_query_to_list('SELECT `hanging_method_id` FROM `stores_hanging_methods` WHERE `store_id`=' . $id, 'hanging_method_id');
$template = set_template('store', 'edit');
$link = THEME . 'template2.php';
require_once $link;
Example #13
0
<?php

import('store');
if (isset($_POST['shop_name'])) {
    $insert = array();
    if (!store_validate($insert)) {
        $error_msg = 'All fields must be filled';
    } else {
        $hanging_methods = $insert['hanging_methods'];
        unset($insert['hanging_methods']);
        $id = insert_to_db('stores', $insert);
        if ($id) {
            $store_hanging_methods = array();
            foreach ($hanging_methods as $value) {
                $store_hanging_methods[] = array('store_id' => $id, 'hanging_method_id' => $value);
            }
            insert_multi_to_db('stores_hanging_methods', $store_hanging_methods);
            $_SESSION['edit_store_msg'] = 'Store Successfully Created';
            header('location: /store/edit/' . $id);
            die;
        }
    }
}
$hanging_methods = get_hanging_methods();
$template = set_template('store', 'index');
$link = THEME . 'template2.php';
require_once $link;
Example #14
0
import('person');
import('products');
if (!is_admin()) {
    header('location: /users/logut');
    exit;
}
$party_id = forms_get('PARTY_ID');
define('PAGE_PRICE_TYPE', $party_id ? CUSTOMER_PRICE : GENERAL_PRICE);
if (isset($_POST) && !empty($_POST)) {
    // Saving prices for a customer
    foreach ($_POST['APPL_TYPE_ID'] as $product_feat_appl_id => $price) {
        // If the price is empty we delete it
        $price = str_replace(',', '.', $price);
        if ((int) $price == 0 || product_feature_price_exists($product_feat_appl_id, PAGE_PRICE_TYPE, $party_id)) {
            product_feature_price_delete($product_feat_appl_id, PAGE_PRICE_TYPE, $party_id);
        }
        if ((int) $price > 0) {
            product_feature_price_add($product_feat_appl_id, PAGE_PRICE_TYPE, $party_id, $price, DEFAULT_CURRENCY);
        }
    }
}
if ($party_id) {
    $person = person_get($party_id);
} else {
    $person['FIRST_NAME'] = 'General';
    $person['LAST_NAME'] = 'Prices';
}
$categories = products_get_categories(false);
$template = set_template('products', 'prices');
$link = THEME . 'template.php';
require_once $link;