コード例 #1
0
ファイル: ContactView.php プロジェクト: yiuked/tmcart
 public function postContact()
 {
     global $smarty, $cookie;
     session_start();
     if ($_SESSION['validate_code'] == strtolower(Tools::getRequest('validate_code'))) {
         if ($cookie->isLogged()) {
             $user = new User($cookie->id_user);
             $_POST['name'] = $user->first_name . ' ' . $user->last_name;
             $_POST['email'] = $user->email;
             if (isset($_POST['id_user'])) {
                 unset($_POST['id_user']);
             }
             $_POST['id_user'] = $user->id;
         }
         $contact = new Contact();
         $contact->copyFromPost();
         if ($contact->add()) {
             $vars = array('{name}' => $contact->name, '{subject}' => $contact->subject, '{email}' => $contact->email, '{message}' => $contact->content);
             Mail::Send('contact', $contact->subject, $vars, Configuration::get('TM_SHOP_EMAIL'));
             $this->_success = 'Your message has been successfully sent to our team.';
         } else {
             $this->_errors = $contact->_errors;
         }
     } else {
         $this->_errors[] = 'Confirmation code is error!';
     }
 }
コード例 #2
0
ファイル: LoginView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if ($cookie->logged) {
         Tools::redirect($link->getPage('MyaccountView'));
     }
     if (Tools::isSubmit('loginSubmit')) {
         if (Tools::getRequest('email') && Tools::getRequest('passwd')) {
             $user = new User();
             if ($user->getByEmail(Tools::getRequest('email'), Tools::getRequest('passwd'))) {
                 $user->logined();
                 if (Tools::G("step") == 2) {
                     Tools::redirect($link->getPage('CheckoutView'));
                 } else {
                     Tools::redirect($link->getPage('MyaccountView'));
                 }
             } else {
                 $smarty->assign('errors', $user->_errors);
             }
         } else {
             $smarty->assign('errors', 'invalid email password combination');
         }
     }
     return $smarty->fetch('login.tpl');
 }
コード例 #3
0
ファイル: SEOHelper.php プロジェクト: yiuked/tmcart
 public function updateProductMeta($post)
 {
     $pbrands = Tools::getRequest('id_brands');
     $brand_where = '';
     if (is_array($pbrands)) {
         $brand_where = ' AND p.id_brand IN(' . implode(",", $pbrands) . ')';
     }
     $rows = Db::getInstance()->getAll("SELECT p.id_product,p.ean13,p.special_price,p.price,p.name,c.name AS category,cl.name AS color\n\t\t\t\tFROM " . DB_PREFIX . "product AS p\n\t\t\t\tLeft Join " . DB_PREFIX . "category AS c ON p.id_category_default = c.id_category\n\t\t\t\tLeft Join " . DB_PREFIX . "color AS cl ON p.id_color = cl.id_color\n\t\t\t\tWHERE p.id_category_default IN(" . implode(",", $post["categoryBox"]) . ")" . $brand_where);
     foreach ($rows as $row) {
         $title = mb_substr(self::replaceProduct($post["title"], $row), 0, 255);
         $keyword = mb_substr(self::replaceProduct($post["keywords"], $row), 0, 255);
         $description = mb_substr(self::replaceProduct($post["description"], $row), 0, 255);
         $rewrite = preg_replace("/[^a-zA-Z0-9\\.]/", "-", self::replaceProduct($post["rewrite"], $row));
         $rewrite = strtolower(preg_replace("/(\\-{2,})/", "-", $rewrite));
         if (!empty($title)) {
             Db::getInstance()->exec("UPDATE " . DB_PREFIX . "product SET meta_title='" . pSQL($title) . "' WHERE id_product=" . intval($row['id_product']));
         }
         if (!empty($keyword)) {
             Db::getInstance()->exec("UPDATE " . DB_PREFIX . "product SET meta_keywords='" . pSQL($keyword) . "' WHERE id_product=" . intval($row['id_product']));
         }
         if (!empty($description)) {
             Db::getInstance()->exec("UPDATE " . DB_PREFIX . "product SET meta_description='" . pSQL($description) . "' WHERE id_product=" . intval($row['id_product']));
         }
         if (!empty($rewrite)) {
             Db::getInstance()->exec("UPDATE " . DB_PREFIX . "product SET rewrite='" . pSQL($rewrite) . "' WHERE id_product=" . intval($row['id_product']));
             Db::getInstance()->exec('UPDATE `' . DB_PREFIX . 'rule` SET `rule_link`="' . pSQL($rewrite) . '" WHERE `entity`="Product" AND `id_entity` =' . intval($row['id_product']));
         }
     }
 }
コード例 #4
0
ファイル: UserView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     if (Tools::isSubmit('joinCommit')) {
         if (User::checkPassword($user->id, Tools::encrypt($_POST['old_passwd']))) {
             if (Tools::getRequest('confirmation') == Tools::getRequest('passwd')) {
                 if (!empty($_POST['passwd']) && Validate::isPasswd($_POST['passwd'])) {
                     $user->copyFromPost();
                     if ($user->update()) {
                         $cookie->passwd = $user->passwd;
                         $cookie->write();
                         $smarty->assign('success', 'Your personal information has been successfully updated.');
                     }
                 } else {
                     $user->_errors[] = 'Password is invalid.';
                 }
             } else {
                 $user->_errors[] = 'Password and confirmation do not match.';
             }
         } else {
             $user->_errors[] = 'Your password is incorrect.';
         }
     }
     $smarty->assign(array('errors' => $user->_errors, 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount')), 'user' => $user));
     return $smarty->fetch('my-user.tpl');
 }
コード例 #5
0
ファイル: neworder.php プロジェクト: yiuked/tmcart
    /**
     * 后台配置模块
     * @return string
     */
    public function getContent()
    {
        if (Tools::isSubmit('Submit_Cardpay_CheckOut')) {
            if (empty($_POST['NEWORDER_MERCHANT_NO'])) {
                $this->_postErrors[] = 'Merchant No is required.';
            }
            if (!isset($_POST['NEWORDER_MERCHANT_KEY'])) {
                $this->_postErrors[] = 'Sign Key is required.';
            }
            if (!sizeof($this->_postErrors)) {
                Configuration::updateValue('NEWORDER_MERCHANT_NO', strval($_POST['NEWORDER_MERCHANT_NO']));
                Configuration::updateValue('NEWORDER_MERCHANT_KEY', strval($_POST['NEWORDER_MERCHANT_KEY']));
                Configuration::updateValue('NEWORDER_MERCHANT_LANG', strval($_POST['NEWORDER_MERCHANT_LANG']));
                $this->displayConf();
            } else {
                $this->displayErrors();
            }
        }
        $conf = Configuration::getMultiple(array('NEWORDER_MERCHANT_NO', 'NEWORDER_MERCHANT_KEY', 'NEWORDER_MERCHANT_LANG'));
        $lang = array_key_exists('NEWORDER_MERCHANT_LANG', $_POST) ? $_POST['NEWORDER_MERCHANT_LANG'] : (array_key_exists('NEWORDER_MERCHANT_LANG', $conf) ? $conf['NEWORDER_MERCHANT_LANG'] : '');
        $html = '<h2>Create a new order</h2>
        <form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
            <fieldset>
            <legend><img src="../modules/payment/neworder/logo.png" />Settings</legend>
                <p>First use the sandbox to test out the module then you can use the real mode if everything\'s fine. Don\'t forget to change your merchant key and id according to the mode!</p>
                <label>Merchant No.</label>
                <div class="margin-form">
                    <input type="text" name="NEWORDER_MERCHANT_NO" value="' . Tools::getRequest('NEWORDER_MERCHANT_NO', Configuration::get('NEWORDER_MERCHANT_NO')) . '" size="30" />
                </div>
				<label>Sign Key</label>
                <div class="margin-form">
                    <input type="text" name="NEWORDER_MERCHANT_KEY" value="' . Tools::getRequest('NEWORDER_MERCHANT_KEY', Configuration::get('NEWORDER_MERCHANT_KEY')) . '" size="30"/>
                </div>
				<label>Language</label>
                <div class="margin-form">
                    <input type="radio" name="NEWORDER_MERCHANT_LANG" value="en" ' . ($lang == "en" ? 'checked="checked"' : '') . '/>英国
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="fr" ' . ($lang == "fr" ? 'checked="checked"' : '') . '/>法国
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="de" ' . ($lang == "de" ? 'checked="checked"' : '') . '/>德国
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="it" ' . ($lang == "it" ? 'checked="checked"' : '') . '/>意大利
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="da" ' . ($lang == "da" ? 'checked="checked"' : '') . '/>丹麦
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="es" ' . ($lang == "es" ? 'checked="checked"' : '') . '/>西班牙
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="in" ' . ($lang == "in" ? 'checked="checked"' : '') . '/>印度尼西亚
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="iw" ' . ($lang == "iw" ? 'checked="checked"' : '') . '/>希伯来
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="ja" ' . ($lang == "ja" ? 'checked="checked"' : '') . '/>日本
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="ms" ' . ($lang == "ms" ? 'checked="checked"' : '') . '/>马来西亚
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="nl" ' . ($lang == "nl" ? 'checked="checked"' : '') . '/>荷兰
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="nn" ' . ($lang == "nn" ? 'checked="checked"' : '') . '/>挪威
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="pl" ' . ($lang == "pl" ? 'checked="checked"' : '') . '/>波兰
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="ru" ' . ($lang == "ru" ? 'checked="checked"' : '') . '/>俄罗斯
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="sv" ' . ($lang == "sv" ? 'checked="checked"' : '') . '/>瑞典
					<input type="radio" name="NEWORDER_MERCHANT_LANG" value="tr" ' . ($lang == "tr" ? 'checked="checked"' : '') . '/>土耳其
                </div>
				 <div class="margin-form"><input type="submit" name="Submit_Cardpay_CheckOut" class="button" value="Save And Update" /></div>
            </fieldset>
        </form>';
        return $html;
    }
コード例 #6
0
ファイル: PaymentResultView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $cookie, $smarty, $link;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('UserView'));
     }
     $payment = Module::hook((int) Tools::getRequest('id_module'));
     $smarty->assign('HOOK_PAYMENT_RESULT', $payment->resultPayment());
     return $smarty->fetch('payment_result.tpl');
 }
コード例 #7
0
ファイル: PasswordView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $smarty, $link;
     $errors = array();
     $step = 1;
     $isExp = false;
     if (Tools::getRequest('reset') == 'passwd') {
         $step = 2;
     }
     if ($step == 1 && Tools::isSubmit('ResetPassword')) {
         $user = new User();
         $user->getByEmail(Tools::getRequest('email'));
         if (Validate::isLoadedObject($user)) {
             $md5_key = md5(_COOKIE_KEY_ . $user->email . $user->passwd . $user->upd_date);
             $subject = 'Reset your password in' . Configuration::get('TM_SHOP_DOMAIN');
             $vars = array('{name}' => $user->first_name . ' ' . $user->last_name, '{subject}' => $subject, '{link}' => $link->getPage('PasswordView') . '?reset=passwd&id_user='******'&key=' . $md5_key);
             if (Mail::Send('passwd', $subject, $vars, $user->email)) {
                 $step = 4;
             } else {
                 $errors[] = 'Send mail fail! Pless try agen!';
             }
         } else {
             $errors[] = 'The email don\'t exists!';
         }
     } elseif ($step == 2) {
         $sign = Tools::getRequest('key');
         $id_user = Tools::getRequest('id_user');
         $user = new User($id_user);
         if (Validate::isLoadedObject($user)) {
             $md5_key = md5(_COOKIE_KEY_ . $user->email . $user->passwd . $user->upd_date);
             if ($md5_key == $sign) {
                 if (Tools::isSubmit('confrimPassword')) {
                     $user->copyFromPost();
                     if (Validate::isPasswd(Tools::getRequest('passwd')) && $user->update()) {
                         $step = 3;
                     } else {
                         $errors[] = 'This passwd is incorrect';
                     }
                 }
             } else {
                 $isExp = true;
                 $errors[] = 'This link has expired!';
             }
         } else {
             $isExp = true;
             $errors[] = 'The customer don\'t exists!';
         }
     }
     $smarty->assign(array('step' => $step, 'isExp' => $isExp, 'errors' => $errors));
     return $smarty->fetch('password.tpl');
 }
コード例 #8
0
ファイル: MyordersView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     if ($reference = Tools::getRequest('reference')) {
         $order = Order::getByReference($reference);
         $smarty->assign(array('products' => $order->cart->getProducts(), 'h_order' => $order));
     }
     $smarty->assign(array('orders' => $user->getOrders(), 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount'))));
     return $smarty->fetch('my-orders.tpl');
 }
コード例 #9
0
ファイル: CartView.php プロジェクト: yiuked/tmcart
 public function requestAction()
 {
     global $smarty, $cookie, $cart, $link;
     parent::requestAction();
     if (!Validate::isLoadedObject($cart) && isset($cookie->id_cart)) {
         $cart = new Cart((int) $cookie->id_cart);
     }
     if (Tools::isSubmit('addToCart')) {
         if (!isset($cart) || !Validate::isLoadedObject($cart)) {
             $cart = new Cart();
             $cart->copyFromPost();
             if ($cart->add()) {
                 $cookie->id_cart = $cart->id;
             }
         }
         if (Tools::getRequest('id_product')) {
             $id_product = Tools::getRequest('id_product');
         }
         if (Tools::getRequest('quantity')) {
             $quantity = Tools::getRequest('quantity');
         }
         if (Tools::getRequest('id_attributes')) {
             $attributes = Tools::getRequest('id_attributes');
         }
         $product = new Product(intval($id_product));
         if (Validate::isLoadedObject($cart)) {
             $cart->addProduct($id_product, $quantity, $product->price, $attributes);
         }
         Tools::redirect($link->getPage('CartView'));
     }
     if (isset($_GET['delete']) and intval($_GET['delete']) > 0) {
         $cart->deleteProduct(intval($_GET['delete']));
         Tools::redirect($link->getPage('CartView'));
     }
     if (Tools::isSubmit('cart_update')) {
         $quantitys = Tools::getRequest('quantity');
         if (count($quantitys) > 0) {
             foreach ($quantitys as $key => $val) {
                 $cart->updateProduct($key, $val['quantity']);
             }
         }
         Tools::redirect($link->getPage('CartView'));
     }
     if (isset($cart) && Validate::isLoadedObject($cart)) {
         $this->cart_info = $cart->getCartInfo();
         $this->cart_info["cart_msg"] = $cart->msg;
     }
     $smarty->assign(array('cart_products' => $this->cart_info['cart_products'], 'cart_quantity' => $this->cart_info['cart_quantity'], 'cart_msg' => $this->cart_info['cart_msg'], 'cart_discount' => $this->cart_info['cart_discount'], 'cart_shipping' => $this->cart_info['cart_shipping'], 'cart_total' => $this->cart_info['cart_total'], 'enjoy_free_shipping' => (double) Configuration::get('ENJOY_FREE_SHIPPING')));
 }
コード例 #10
0
ファイル: SearchView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $smarty, $cookie;
     $query = Tools::getRequest('s');
     $query = str_replace(array('%', '\'', '*', '"'), '', $query);
     if ($query) {
         $this->loadFilter();
         $products = Product::getSreachProduct($query, $this->p, $this->n, $this->by, $this->way);
         $this->pagination($products['total']);
         if ($products) {
             $smarty->assign(array('query' => $query, 'total' => $products['total'], 'products' => $products['entitys']));
         }
     }
     return $smarty->fetch('search.tpl');
 }
コード例 #11
0
ファイル: CMSView.php プロジェクト: yiuked/tmcart
 public function postComment()
 {
     global $smarty;
     session_start();
     if ($_SESSION['validate_code'] == strtolower(Tools::getRequest('validate_code'))) {
         $comment = new CMSComment();
         $comment->copyFromPost();
         if ($comment->add()) {
             $this->_success = '添加评论成功,请等待管理员审核哟!';
         } else {
             $this->_errors = $comment->_errors;
         }
     } else {
         $this->_errors[] = '验证码错误!';
     }
 }
コード例 #12
0
ファイル: MyfeedbackView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $smarty, $link, $cookie;
     if (!$cookie->logged) {
         Tools::redirect($link->getPage('LoginView'));
     }
     $user = new User((int) $cookie->id_user);
     $errors = array();
     $success = false;
     //添加feedback
     //1.添加创建对象
     if (Tools::isSubmit('submit')) {
         $feedback = new Feedback();
         $feedback->copyFromPost();
         if ($feedback->rating <= 0 && $feedback->rating > 5) {
             $feedback->rating = 4;
         }
         $data = explode("-", base64_decode(Tools::getRequest("data")));
         $feedback->id_product = (int) $data[0];
         $feedback->unit_price = (double) $data[2];
         $feedback->quantity = (int) $data[3];
         $feedback->md5_key = md5(Tools::getRequest("data"));
         $feedback->name = substr($user->first_name, 0, 1) . "***" . substr($user->last_name, -1, 1);
         $feedback->id_user = $user->id;
         if ($feedback->add()) {
             $success = true;
         } else {
             $errors = $feedback->_errors;
         }
     }
     //2.获取用户评论过的MD5KEY
     $proids = Feedback::haveFeedbackWithUser($user->id);
     //3.获取用户购买过的产品
     $products = array();
     if ($result = $user->getPaymentedProduct()) {
         foreach ($result as &$row) {
             if (!in_array($row['md5_key'], $proids)) {
                 $products[] = $row;
             }
         }
     }
     $smarty->assign(array('success' => $success, 'errors' => $errors, 'products' => $products, 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount'))));
     return $smarty->fetch('my-feedback.tpl');
 }
コード例 #13
0
ファイル: ConfirmOrderView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $cookie, $link;
     if (!isset($cookie->id_cart) || !$cookie->logged) {
         Tools::redirect($link->getPage('UserView'));
     }
     if (!Tools::getRequest('id_module') || !Tools::getRequest('id_address')) {
         Tools::redirect($link->getPage('CheckoutView'));
     }
     $cart = new Cart((int) $cookie->id_cart);
     $cart->id_address = (int) Tools::getRequest('id_address');
     $cart->id_carrier = (int) Tools::getRequest('id_carrier');
     $cart->update();
     $payment = Module::hook((int) Tools::getRequest('id_module'));
     if (!$payment->active) {
         Tools::redirect($link->getPage('CheckoutView'));
     }
     return $payment->execPayment($cart);
 }
コード例 #14
0
ファイル: JoinView.php プロジェクト: yiuked/tmcart
 public function displayMain()
 {
     global $smarty, $link;
     $errors = array();
     if (Tools::isSubmit('CreateUser')) {
         if (!Validate::isEmail(Tools::getRequest('email')) || User::userExists(Tools::getRequest('email'))) {
             $errors[] = 'The email is invalid or an account is already registered with this e-mail!';
         } elseif (empty($_POST['passwd'])) {
             $errors[] = 'The password is empty!';
         } else {
             $user = new User();
             $user->copyFromPost();
             $user->active = 1;
             if ($user->add()) {
                 $address = new Address();
                 $address->copyFromPost();
                 $address->id_user = $user->id;
                 $address->is_default = 1;
                 if ($address->add()) {
                     $user->logined(array('id_address' => $address->id));
                     if (Tools::getRequest("step") == 2) {
                         Tools::redirect($link->getPage('CheckoutView'));
                     } else {
                         Tools::redirect($link->getPage('MyaccountView'));
                     }
                     return;
                 } else {
                     $errors = $address->_errors;
                 }
             } else {
                 $errors = $user->_errors;
             }
         }
     }
     $countrys = Country::loadData(1, 500, null, null, array('active' => 1));
     $smarty->assign(array('id_default_country' => Configuration::get('TM_DEFAULT_COUNTRY_ID'), 'countrys' => $countrys, 'step' => Tools::getRequest("step"), 'errors' => $errors));
     return $smarty->fetch('join.tpl');
 }
コード例 #15
0
ファイル: color.php プロジェクト: yiuked/tmcart
<?php

if (intval(Tools::getRequest('delete')) > 0) {
    $object = new Color(intval(Tools::getRequest('delete')));
    if (Validate::isLoadedObject($object)) {
        $object->delete();
    }
    if (is_array($object->_errors) and count($object->_errors) > 0) {
        $errors = $object->_errors;
    } else {
        UIAdminAlerts::conf('颜色已删除');
    }
} elseif (Tools::isSubmit('subDelete')) {
    $select_cat = Tools::P('itemsBox');
    $color = new Color();
    if ($color->deleteSelection($select_cat)) {
        UIAdminAlerts::conf('颜色已删除');
    }
}
echo UIAdminDndTable::loadHead();
$table = new UIAdminDndTable('color', 'Color', 'id_color');
$table->addAttribte('id', 'color-table');
$table->header = array(array('sort' => false, 'isCheckAll' => 'itemsBox[]'), array('name' => 'id_color', 'title' => 'ID'), array('name' => 'name', 'title' => '名称'), array('name' => 'code', 'title' => '颜色', 'color' => true), array('name' => 'position', 'title' => '排序'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'delete')));
$orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'position';
$orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'asc';
$result = Color::loadData($orderBy, $orderWay);
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
コード例 #16
0
ファイル: index.php プロジェクト: yiuked/tmcart
                        <li><a href="index.php?rule=onepage" title="单面管理">单面管理</a></li>
                        <li><a href="index.php?rule=rule" title="路由列表">路由列表</a></li>
                        <li><a href="index.php?rule=sitemap" title="路由列表">SiteMap</a></li>
                        <li><a href="index.php?rule=seo_meta" title="Meta批量管理">Meta批量管理</a></li>
                    </ul>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><span class=" pull-right logout"><span aria-hidden="true" class="glyphicon glyphicon-off"></span></span></li>
            </ul>
        </nav>
    </div>
</header>
<div class="container-fluid">
        <?php 
$rule = Tools::getRequest('rule');
require_once ADMIN_DIR . '/rule/' . ($rule ? $rule : 'index') . '.php';
?>
</div>
<div id="footer">
    <div class="version"><b>Version:TM Shop <?php 
echo _TM_VERSION_;
?>
</b> <?php 
$end = explode(" ", microtime());
echo "Time:" . ($end[1] + $end[0] - $start[1] - $start[0]);
printf(' memory usage: %01.2f MB', memory_get_usage() / 1024 / 1024);
?>
</div>
    <div class="copyright">Power by TM Shop</div>
</div>
コード例 #17
0
ファイル: feedback.php プロジェクト: yiuked/tmcart
    if (Validate::isLoadedObject($object)) {
        $object->delete();
    }
    if (is_array($object->_errors) and count($object->_errors) > 0) {
        $errors = $object->_errors;
    } else {
        echo '<div class="conf">删除对象成功</div>';
    }
} elseif (Tools::isSubmit('subDelete')) {
    $select_cat = Tools::getRequest('categoryBox');
    $feedbacks = new Feedback();
    if ($feedbacks->deleteSelection($select_cat)) {
        echo '<div class="conf">删除对象成功</div>';
    }
} elseif (Tools::isSubmit('subShowProductPage')) {
    $select_cat = Tools::getRequest('categoryBox');
    $feedbacks = new Feedback();
    if ($feedbacks->statusSelection($select_cat, true)) {
        echo '<div class="conf">启用对象成功</div>';
    }
}
$table = new UIAdminTable('feedback', 'Feedback', 'id_feedback');
$table->header = array(array('sort' => false, 'isCheckAll' => 'categoryBox[]'), array('name' => 'name', 'title' => 'ID', 'filter' => 'string'), array('name' => 'flag_code', 'title' => '国家', 'filter' => 'string'), array('name' => 'id_product', 'title' => '产品ID', 'filter' => 'string'), array('name' => 'rating', 'title' => '评分', 'filter' => 'string'), array('name' => 'feedback', 'title' => '内容'), array('name' => 'add_date', 'title' => '时间'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'width' => '120px', 'isAction' => array('delete')));
$filter = $table->initFilter();
$orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'id_feedback';
$orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'asc';
$limit = $cookie->getPost('pagination') ? $cookie->getPost('pagination') : '50';
$p = Tools::G('p') ? Tools::G('p') == 0 ? 1 : Tools::G('p') : 1;
$result = Feedback::loadData($p, $limit, $orderBy, $orderWay, $filter);
require_once dirname(__FILE__) . '/../errors.php';
$breadcrumb = new UIAdminBreadcrumb();
コード例 #18
0
ファイル: currency_edit.php プロジェクト: yiuked/tmcart
if (isset($_POST['sveCurrency']) && Tools::getRequest('sveCurrency') == 'add') {
    $currency = new Currency();
    $currency->copyFromPost();
    $currency->add();
    if (is_array($currency->_errors) and count($currency->_errors) > 0) {
        $errors = $currency->_errors;
    } else {
        $_GET['id'] = $currency->id;
        echo '<div class="conf">创建对象成功</div>';
    }
}
if (isset($_GET['id'])) {
    $id = (int) $_GET['id'];
    $obj = new Currency($id);
}
if (isset($_POST['sveCurrency']) && Tools::getRequest('sveCurrency') == 'edit') {
    if (Validate::isLoadedObject($obj)) {
        $obj->copyFromPost();
        $obj->update();
    }
    if (is_array($obj->_errors) and count($obj->_errors) > 0) {
        $errors = $obj->_errors;
    } else {
        echo '<div class="conf">更新对象成功</div>';
    }
}
/** 输出错误信息 */
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
/** 导航 */
コード例 #19
0
ファイル: Tools.php プロジェクト: yiuked/tmcart
 public static function radioStatus($entity, $key, $val)
 {
     if (isset($entity)) {
         if ($entity == $val) {
             return "checked";
         }
     } elseif (Tools::getRequest($key) == $val) {
         return "checked";
     }
     return;
 }
コード例 #20
0
ファイル: seo_meta.php プロジェクト: yiuked/tmcart
<?php

if (isset($_POST['SEOCateMetaUpdate'])) {
    if (isset($_POST['categoryBox']) && count($_POST['categoryBox']) > 0) {
        SEOHelper::updateCategoryMeta($_POST);
    }
}
/** 错误处理 */
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
/** 导航 */
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
$breadcrumb->add(array('href' => 'index.php?rule=seo_meta', 'title' => 'Meta管理'));
$breadcrumb->add(array('title' => '编辑', 'active' => true));
$bread = $breadcrumb->draw();
$btn_group = array(array('type' => 'a', 'title' => '产品Metat管理', 'href' => 'index.php?rule=seo_meta_product', 'class' => 'btn-primary', 'icon' => 'share'), array('type' => 'button', 'title' => '更新', 'id' => 'save-seo-meta-form', 'class' => 'btn-success', 'icon' => 'save'));
echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb');
/** 构建表单 */
$form = new UIAdminEditForm('post', 'index.php?rule=seo_meta', 'form-horizontal', 'seo-meta-form');
$cate = array();
if (isset($_POST['categoryBox'])) {
    $cate = Tools::getRequest('categoryBox');
}
$trads = array('Home' => '根分类', 'selected' => '选择', 'Collapse All' => '关闭', 'Expand All' => '展开', 'Check All' => '全选', 'Uncheck All' => '全不选');
$form->items = array('title' => array('title' => 'Title规则', 'type' => 'text', 'value' => Tools::Q('title'), 'info' => '可用参数:C_ID,C_NAME,{关键词1|关键词2|关键词3}'), 'keywords' => array('title' => 'Keywords规则', 'type' => 'text', 'value' => Tools::Q('keywords'), 'info' => '可用参数:C_ID,C_NAME,{关键词1|关键词2|关键词3}'), 'description' => array('title' => 'Keywords', 'type' => 'text', 'value' => Tools::Q('description'), 'info' => '可用参数:C_ID,C_NAME,{关键词1|关键词2|关键词3}'), 'rewrite' => array('title' => 'Keywords', 'type' => 'text', 'value' => Tools::Q('rewrite'), 'info' => '可用参数:C_ID,C_NAME,{关键词1|关键词2|关键词3}'), 'categoryBox' => array('title' => '应用到分类', 'type' => 'custom', 'value' => Helper::renderAdminCategorieTree($trads, $cate, 'categoryBox', false, 'Tree')), 'SEOCateMetaUpdate' => array('type' => 'submit', 'class' => 'btn-success', 'icon' => 'save', 'title' => '生成'));
echo UIViewBlock::area(array('title' => '编辑', 'body' => $form->draw()), 'panel');
コード例 #21
0
ファイル: coupon.php プロジェクト: yiuked/tmcart
    if (Validate::isLoadedObject($object)) {
        $object->delete();
    }
    if (is_array($object->_errors) and count($object->_errors) > 0) {
        $errors = $object->_errors;
    } else {
        UIAdminAlerts::conf('优惠码已删除');
    }
} elseif (Tools::isSubmit('subDelete')) {
    $select_cat = Tools::getRequest('categoryBox');
    $coupon = new Coupon();
    if ($coupon->deleteSelection($select_cat)) {
        UIAdminAlerts::conf('优惠码已删除');
    }
} elseif (intval(Tools::getRequest('toggleStatus')) > 0) {
    $object = new Coupon(intval(Tools::getRequest('toggleStatus')));
    if (Validate::isLoadedObject($object)) {
        $object->toggleStatus();
    }
    if (is_array($object->_errors) and count($object->_errors) > 0) {
        $errors = $object->_errors;
    } else {
        UIAdminAlerts::conf('优惠码已更新');
    }
}
$table = new UIAdminTable('coupon', 'Coupon', 'id_coupon');
$table->header = array(array('sort' => false, 'isCheckAll' => 'itemsBox[]'), array('name' => 'id_coupon', 'title' => 'ID', 'width' => '80px', 'filter' => 'string'), array('name' => 'id_user', 'title' => '状态码', 'filter' => 'string'), array('name' => 'off', 'title' => '状态信息', 'filter' => 'string'), array('name' => 'amount', 'title' => '状态信息', 'filter' => 'string'), array('name' => 'active', 'title' => '状态信息', 'filter' => 'string'), array('name' => 'add_date', 'title' => '状态信息', 'filter' => 'string'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'delete')));
$filter = $table->initFilter();
$orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'id_coupon';
$orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'desc';
$limit = $cookie->getPost('pagination') ? $cookie->getPost('pagination') : '50';
コード例 #22
0
ファイル: config.php プロジェクト: yiuked/tmcart
Configuration::loadConfiguration();
if (Configuration::get('TM_SHOP_DOMAIN') != $_SERVER['HTTP_HOST']) {
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . Tools::getShopDomain(true) . $_SERVER['REQUEST_URI']);
    exit;
}
$cookie = new Cookie();
$cookie->isLogged();
if (isset($cookie->id_cart) && !Cart::cartIsOrder($cookie->id_cart)) {
    $cart = new Cart((int) $cookie->id_cart);
    if (!Validate::isLoadedObject($cart)) {
        unset($cart);
        unset($cookie->id_cart);
    }
}
if ($id_currency = Tools::getRequest('id_currency')) {
    $currency = new Currency((int) $id_currency);
    $cookie->id_currency = $id_currency;
    $cookie->write();
    if (isset($cart) && Validate::isLoadedObject($cart)) {
        $cart->id_currency = (int) $id_currency;
        $cart->update();
    }
}
if (!(int) $cookie->id_currency) {
    $currency = new Currency((int) Configuration::get('ID_CURRENCY_DEFAULT'));
    $cookie->id_currency = $currency->id;
    $cookie->write();
}
if (isset($cart) && !(int) $cart->id_currency) {
    $cart->id_currency = (int) $cookie->id_currency;
コード例 #23
0
ファイル: order.php プロジェクト: yiuked/tmcart
    if (Validate::isLoadedObject($object)) {
        $object->delete();
    }
    if (is_array($object->_errors) and count($object->_errors) > 0) {
        $errors = $object->_errors;
    } else {
        echo '<div class="conf">删除对象成功</div>';
    }
} elseif (Tools::isSubmit('subDelete')) {
    $select_cat = Tools::getRequest('categoryBox');
    $order = new Order();
    if ($order->deleteSelection($select_cat)) {
        echo '<div class="conf">删除对象成功</div>';
    }
} elseif (intval(Tools::getRequest('toggleStatus')) > 0) {
    $object = new Order(intval(Tools::getRequest('toggleStatus')));
    if (Validate::isLoadedObject($object)) {
        $object->toggleStatus();
    }
    if (is_array($object->_errors) and count($object->_errors) > 0) {
        $errors = $object->_errors;
    } else {
        echo '<div class="conf">更新对象状态成功</div>';
    }
}
$table = new UIAdminTable('order', 'Order', 'id_order');
$table->header = array(array('sort' => false, 'isCheckAll' => 'orderBox[]'), array('name' => 'id_order', 'title' => 'ID', 'width' => '80px', 'filter' => 'string'), array('name' => 'reference', 'title' => '引用', 'width' => '110px', 'filter' => 'string'), array('name' => 'name', 'title' => '用户', 'filter' => 'string'), array('name' => 'amount', 'title' => '金额', 'width' => '80px', 'filter' => 'string'), array('name' => 'carrier', 'title' => '物流', 'filter' => 'string'), array('name' => 'payment', 'title' => '支付', 'filter' => 'string'), array('name' => 'status', 'title' => '状态', 'filter' => 'string', 'color' => true), array('name' => 'add_date', 'title' => '添加时间'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'delete')));
$filter = $table->initFilter();
$orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'id_order';
$orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'desc';
$limit = $cookie->getPost('pagination') ? $cookie->getPost('pagination') : '50';
コード例 #24
0
ファイル: cms.php プロジェクト: yiuked/tmcart
    UIAdminAlerts::MError($errors);
}
?>
<div class="row">
	<div class="col-md-2 sidebar">
		<div class="panel panel-default">
			<div class="panel-heading">检索分类</div>
			<div class="panel-body">
			<script type="text/javascript">
				$(document).ready(function(){
					var base_url = 'index.php?rule=cms';
					// Load category products page when category is clicked
					$(document).on('click','#categories-treeview input', function(){
						if (this.value !== "")
							location.href = base_url + '&id_cms_category=' + parseInt(this.value);
						else
							location.href = base_url;
					});
				});
			</script>
			<?php 
$trads = array('Home' => '根分类', 'selected' => '选择', 'Collapse All' => '关闭', 'Expand All' => '展开');
echo Helper::renderAdminCategorieTree($trads, array(Tools::getRequest('id_cms_category') ? Tools::getRequest('id_cms_category') : 1), 'categoryBox', true, 'CMSTree');
?>
		 </div>
		</div>
	</div>
</div>
<?php 
$btn_group = array(array('type' => 'button', 'title' => '删除选中', 'confirm' => '确定要删除选中项?', 'name' => 'subDelete', 'btn_type' => 'submit', 'class' => 'btn-danger'), array('type' => 'button', 'title' => '激活选中', 'name' => 'subActiveON', 'btn_type' => 'submit', 'class' => 'btn-default'), array('type' => 'button', 'title' => '关闭选中', 'name' => 'subActiveOFF', 'btn_type' => 'submit', 'class' => 'btn-default'));
echo UIViewBlock::area(array('title' => '文章', 'table' => $table, 'class' => 'col-md-10 col-md-offset-2', 'result' => $result, 'btn_groups' => $btn_group), 'table');
コード例 #25
0
ファイル: employee_edit.php プロジェクト: yiuked/tmcart
    }
    if (is_array($employee->_errors) and count($employee->_errors) > 0) {
        $errors = $employee->_errors;
    } else {
        $_GET['id'] = $employee->id;
        UIAdminAlerts::conf('管理员已添加');
    }
}
if (isset($_GET['id'])) {
    $id = (int) $_GET['id'];
    $obj = new Employee($id);
}
if (Tools::P('saveEmployee') == 'edit') {
    if (Tools::P('passwd') != Tools::P('passwd_conf')) {
        $obj->_errors[] = '两次输入的密码不一样!';
    } elseif (Tools::P('email') != $obj->email && Employee::employeeExists(Tools::getRequest('email'))) {
        $obj->_errors[] = '邮箱地址已存在!';
    } elseif (Validate::isLoadedObject($obj)) {
        $obj->copyFromPost();
        $obj->update();
    }
    if (is_array($obj->_errors) and count($obj->_errors) > 0) {
        $errors = $obj->_errors;
    } else {
        UIAdminAlerts::conf('管理员已更新');
    }
}
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
$breadcrumb = new UIAdminBreadcrumb();
コード例 #26
0
ファイル: pay.php プロジェクト: yiuked/tmcart
    @set_time_limit(HTTP_TIMEOUT + 10);
}
if (ini_get('max_execution_time') < HTTP_TIMEOUT) {
    @ini_set('max_execution_time', HTTP_TIMEOUT + 10);
}
define('PAY_DEBUG', true);
if (PAY_DEBUG) {
    error_reporting(E_ALL);
    @ini_set('display_errors', 'On');
} else {
    error_reporting(0);
}
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : _TM_ROOT_URL_;
$homePageUrl = 'http://' . $_SERVER['HTTP_HOST'];
$userAgent = $_SERVER['HTTP_USER_AGENT'];
if (isset($_POST['validateCreditCard']) && Tools::getRequest('validateCreditCard') == 'connect') {
    if (!isset($cart)) {
        if (!isset($cookie->id_cart) || !isset($cookie->id_user)) {
            Paylog::msg(0, "100", "检测不到id_cart或者id_user");
            die(json_encode(array("isError" => "YES", "msg" => "100")));
        }
        $cart = new Cart($cookie->id_cart);
    }
    $Amount = $Amount1 = number_format($cart->getOrderTotal(), 2, '.', '');
    $BillNo = $cart->id;
    $MerNo = Configuration::get('MODULE_PAYMENT_SHT_SELLER');
    $MD5key = Configuration::get('MODULE_PAYMENT_SHT_MD5KEY');
    $handler = Configuration::get('MODULE_PAYMENT_SHT_HANDLER');
    $ReturnURL = Configuration::get('MODULE_PAYMENT_SHT_RETURN_URL');
    $Language = Configuration::get('MODULE_PAYMENT_SHT_LANGUAGE');
    $Currencytype = Configuration::get('MODULE_PAYMENT_SHT_MONEYTYPE');
コード例 #27
0
ファイル: address_edit.php プロジェクト: yiuked/tmcart
if (isset($_POST['sveAddress']) && Tools::getRequest('sveAddress') == 'add') {
    $address = new Address();
    $address->copyFromPost();
    $address->add();
    if (is_array($address->_errors) and count($address->_errors) > 0) {
        $errors = $address->_errors;
    } else {
        $_GET['id'] = $address->id;
        UIAdminAlerts::conf('地址已添加');
    }
}
if (isset($_GET['id'])) {
    $id = (int) $_GET['id'];
    $obj = new Address($id);
}
if (isset($_POST['sveAddress']) && Tools::getRequest('sveAddress') == 'edit') {
    if (Validate::isLoadedObject($obj)) {
        $obj->copyFromPost();
        $obj->update();
    }
    if (is_array($obj->_errors) and count($obj->_errors) > 0) {
        $errors = $obj->_errors;
    } else {
        UIAdminAlerts::conf('地址已更新');
    }
}
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
コード例 #28
0
ファイル: order_edit.php プロジェクト: yiuked/tmcart
<?php

if (isset($_GET['id'])) {
    $id = (int) $_GET['id'];
    $obj = new Order($id);
}
if (Tools::isSubmit('orderStatusUpdate')) {
    $obj->id_order_status = (int) Tools::getRequest('id_order_status');
    if (strlen(trim(Tools::getRequest('track_number'))) > 0) {
        $obj->track_number = Tools::getRequest('track_number');
        Alert::send($obj->id_user, "Your order:#" . sprintf("%09d", intval($obj->id)) . " has been shipped.");
    }
    $obj->update();
    $obj->order_status = new OrderStatus((int) $obj->id_order_status);
}
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
$breadcrumb->add(array('title' => '定单 #' . sprintf("%09d", $id), 'active' => true));
$bread = $breadcrumb->draw();
$btn_group = array(array('type' => 'button', 'title' => '提交到定单系统', 'id' => 'send-to-order-system', 'class' => 'btn-success', 'icon' => 'wrench'), array('type' => 'a', 'title' => '预览', 'href' => 'index.php?rule=order_view&id=' . $obj->id, 'class' => 'btn-warning', 'icon' => 'eye-open'), array('type' => 'a', 'title' => '返回', 'href' => 'index.php?rule=order', 'class' => 'btn-primary', 'icon' => 'level-up'));
echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb');
?>

<div class="order_base_info">
	<div style="width: 49%; float:left;">
		<fieldset class="small">
			<legend><img src="<?php 
echo $_tmconfig['ico_dir'];
?>
tab-customers.gif">用户</legend>
			<span style="font-weight: bold; font-size: 14px;"><a href="index.php?rule=user_edit&id=<?php 
コード例 #29
0
ファイル: payment_edit.php プロジェクト: yiuked/tmcart
<?php

if (!($id = Tools::getRequest('id'))) {
    die('无法载入对象!');
}
$obj = Module::loadModule($id);
echo $obj->getContent();
コード例 #30
0
ファイル: product_edit.php プロジェクト: yiuked/tmcart
        $categoryBox = Product::getProductCategoriesFullId($obj->id);
    }
}
echo Helper::renderAdminCategorieTree($trads, $categoryBox, 'categoryBox', false, 'Tree');
?>
											<a href="index.php?rule=category_edit" class="btn btn-link bt-icon confirm_leave">
												<span class="glyphicon glyphicon-plus"></span> 创建一个新分类 <span class="glyphicon glyphicon-new-window"></span>
											</a>
										</div>
									</div>
									<?php 
if (!isset($obj)) {
    $selectedCat = Category::getCategoryInformations(Tools::getRequest('categoryBox'));
} else {
    if (Tools::isSubmit('categoryBox')) {
        $selectedCat = Category::getCategoryInformations(Tools::getRequest('categoryBox'));
    } else {
        $selectedCat = Product::getProductCategoriesFull($obj->id);
    }
}
?>
									<div class="form-group">
										<label for="id_category_default" class="col-sm-2 control-label">默认分类</label>
										<div class="col-sm-10">
											<select name="id_category_default" class="form-control" id="id_category_default" <?php 
if (!$selectedCat || count($selectedCat) == 0) {
    echo 'style="display:none"';
}
?>
>
												<?php