示例#1
0
 public function render()
 {
     echo "<script type='text/javascript' src='/myshop/js/jquery.validate.min.js'></script>";
     echo $this->message . "\n            <div class='content'>\n                <div class='container'>\n                    <div class='p-content'>\n                        <div class='p-content-header'>\n                            <div class='p-content-header-left'>\n                                 <h1>" . Trans::_('Login') . "</h1>\n                            </div>\n                            <div class='p-content-header-right'>\n\n                            </div>\n                            <div class='clearfix'> </div>\n                        </div>\n\n                        <form id='loginform' action='login' method='post'>\n                            <p>\n                                <label>" . Trans::_('Login') . "</label>\n                                <input name='login' required>\n                            </p>\n                            <p>\n                                <label>" . Trans::_('Password') . "</label>\n                                <input type='password' name='password' required>\n                            </p>\n                            <p>\n                                <input type='submit' value='" . Trans::_('Submit') . "'>\n                            </p>\n                        </form>\n                    </div>\n                </div>\n            </div>\n        ";
     //check the form
     echo "<script>\$('#loginform').validate();</script>";
 }
示例#2
0
 public function render()
 {
     //set locale acoording to model input
     if ($this->model !== null) {
         $locale = $this->model->__get('lang');
         $_COOKIE['locale'] = $locale;
         //reload header-menu
         echo "<script>\n                    \$(function() {\n                        \$('.top-nav').html(\"" . get_top_menu() . "\");\n                    });\n                </script>";
         $langs = "<li role='presentation' class='dropdown'><a class='dropdown-toggle' data-toggle='dropdown' href='#' role='button' aria-haspopup='true' aria-expanded='false'><img src='/myshop/images/flags/" . $_COOKIE['locale'] . ".png' /></a><ul class='dropdown-menu'>";
         foreach ($this->model->__get('languages') as $locale => $lang) {
             if ($this->model instanceof Product) {
                 $langs .= "<li class='lang'><a href='/myshop/" . $locale . "/" . Trans::_fd("product", $locale) . "/" . $lang . "'><img src='/myshop/images/flags/" . $locale . ".png' />" . Trans::_($locale) . "</a></li>";
             } else {
                 $langs .= "<li class='lang'><a href='/myshop/" . $locale . "/" . $lang . "'><img src='/myshop/images/flags/" . $locale . ".png' />" . Trans::_($locale) . "</a></li>";
             }
         }
         $langs .= "</ul></li>";
         echo "<script>\n                    \$(function() {\n                        \$('.langselect').html(\"" . $langs . "\");\n                    });\n                </script>";
     } else {
         echo "<script>\n                    \$(function() {\n                        \$('.top-nav').html(\"" . get_top_menu() . "\");\n                    });\n                </script>";
         $langs = "<li role='presentation' class='dropdown'><a class='dropdown-toggle' data-toggle='dropdown' href='#' role='button' aria-haspopup='true' aria-expanded='false'><img src='/myshop/images/flags/" . Trans::getDomain() . ".png' /></a><ul class='dropdown-menu'>";
         foreach (Trans::getAllDomains() as $lang) {
             if (strpos(RouteController::getCurrentRoute(), Trans::getDomain()) !== false) {
                 $langs .= "<li class='lang'><a href='/myshop" . str_replace(Trans::getDomain(), $lang, RouteController::getCurrentRoute()) . "'><img src='/myshop/images/flags/" . $lang . ".png' />" . Trans::_($lang) . "</a></li>";
             } else {
                 $langs .= "<li class='lang'><a href='/myshop/" . $lang . "'><img src='/myshop/images/flags/" . $lang . ".png' />" . Trans::_($lang) . "</a></li>";
             }
         }
         $langs .= "</ul></li>";
         echo "<script>\n                    \$(function() {\n                        \$('.langselect').html(\"" . $langs . "\");\n                    });\n                </script>";
     }
 }
示例#3
0
 public function render()
 {
     //welcom message
     echo "<div class='container'><div class='alert alert-success message' role='alert'><strong>" . Trans::_("Login successful") . ":</strong> " . Trans::_('Hello') . " <strong>" . $this->model->__get('firstname') . "</strong>!</div></div>";
     //hide message after x seconds
     echo "<script>\$(function() { setTimeout(function() { \$('.message').hide(400) }, 5000); }); </script>";
     echo "\n            <div class='content'>\n                <div class='container'>\n                    <div class='p-content'>\n                        <div class='p-content-header'>\n                            <div class='p-content-header-left'>\n                                 <h1>" . Trans::_('Customercenter') . "</h1>\n                            </div>\n                            <div class='p-content-header-right'>\n\n                            </div>\n                            <div class='clearfix'> </div>\n                        </div>\n\n                        <div class='row'>\n                            <div class='col-md-6'>\n                                <h2>" . Trans::_('shippingaddress') . "</h2>" . $this->model->title . "<br/>" . $this->model->firstname . " " . $this->model->lastname . "<br/>" . $this->model->address . "<br/>" . $this->model->zip . " " . $this->model->location . "<br/>" . "<h3>" . Trans::_('Contact Information') . "</h3>" . "<i class='fa fa-phone'></i>" . $this->model->phone . "<br/>" . "<i class='fa fa-envelope'></i><a href='mailto:" . $this->model->email . "'>" . $this->model->email . "</a>" . "\n                            </div>\n                            <div class='col-md-6'>\n                            <h2>" . Trans::_('billingaddress') . "</h2>" . $this->model->title2 . "<br/>" . $this->model->firstname2 . " " . $this->model->lastname2 . "<br/>" . $this->model->address2 . "<br/>" . $this->model->zip2 . " " . $this->model->location2 . "<br/>" . "\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        ";
 }
示例#4
0
 public function render()
 {
     $products = "";
     foreach ($this->model->getProducts() as $product) {
         $image = json_decode($product->__get('images'), true);
         $productlink = "/myshop/" . Trans::getDomain() . "/" . Trans::_('product') . "/" . $product->__get('nicename');
         $products .= "<div class='col-md-3 special-products-grid text-center'>\n                                <a class='brand-name' href='" . $productlink . "'><img src='/myshop/images/brands/" . $product->__get('brand_nicename') . ".jpg' title='" . $product->__get('brand') . "'></a>\n                                <a class='product-here' href='" . $productlink . "'><img src='/myshop/images/products/" . $image['thumb'] . "' title='" . $product->__get('name1') . "'></a>\n                                <h4><a href='" . $productlink . "'>" . $product->__get('name1') . "</a></h4>\n                                <a class='product-btn' href='" . $productlink . "'><span>" . $product->__get('price2') . "</span><small>" . Trans::_('Get now!') . "</small><label></label></a>\n                            </div>";
     }
     echo "\n            <div class='content'>\n                <div class='container'>\n                    <!----speical-products---->\n                    <div class='special-products'>\n                        <div class='s-products-head'>\n                            <div class='s-products-head-left'>\n                                <h3>SPECIAL <span>PRODUCTS</span></h3>\n                            </div>\n                            <div class='s-products-head-right'>\n                                <a href='" . Trans::_('products') . "'><span> </span>view all products</a>\n                            </div>\n                            <div class='clearfix'> </div>\n                        </div>\n                        <!----special-products-grids---->\n                        <div class='special-products-grids'>\n                        " . $products . "\n                        <div class='clearfix'> </div>\n                        </div>\n                        <!---//special-products-grids---->\n                    </div>\n                    <!---//speical-products---->\n                </div>\n                <!----//content---->\n        ";
 }
示例#5
0
 public static function rss($news)
 {
     $string = "<rss version='2.0'>";
     $string .= "<channel>";
     $string .= "<title>Puškice</title>\n\t\t\t\t\t<link>" . Request::root() . "</link>\n\t\t\t\t\t<description>Tačka spajanja studenata FON-a</description>\n\t\t\t\t\t<language>sr-rs</language>\n\t\t\t\t\t<pubDate>" . date("D, d M Y H:i:s e", strtotime("now")) . "</pubDate>\n\t\t\t\t\t<lastBuildDate>" . date("D, d M Y H:i:s e", strtotime("now")) . "</lastBuildDate>\n\t\t\t\t\t<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n\t\t\t\t\t<generator>Puškice generator</generator>\n\t\t\t\t\t<managingEditor>info@puskice.org</managingEditor>\n\t\t\t\t\t<webMaster>info@puskice.org</webMaster>";
     foreach ($news as $article) {
         $string .= "<item>\n\t\t\t\t\t\t\t<title>" . $article->title . "</title>\n\t\t\t\t\t\t\t<link>" . Request::root() . "/vest/" . Puskice::dateToUrl($article->created_at) . "/" . $article->permalink . "</link>\n\t\t\t\t\t\t\t<description><![CDATA[" . Trans::_t($article->short_content) . "]]></description>\n\t\t\t\t\t\t\t<pubDate>" . date("D, d M Y H:i:s e", strtotime($article->created_at)) . "</pubDate>\n\t\t\t\t\t\t\t<guid>" . Request::root() . "/vest/" . Puskice::dateToUrl($article->created_at) . "/" . $article->permalink . "</guid>\n\t\t\t\t\t\t</item>";
     }
     $string .= "</channel>";
     $string .= "</rss>";
     return $string;
 }
示例#6
0
 public static function _t($text)
 {
     if (Session::get('trans') != 'lat' && Session::get('trans') != 'cyr') {
         Session::put('trans', "lat");
     }
     if (Input::get('l')) {
         Session::put('trans', Input::get('l'));
     }
     if (Session::get('trans') == "lat") {
         $text = Trans::cir2lat($text);
     }
     return html_entity_decode($text, ENT_QUOTES, "UTF-8");
 }
 public static function save($data, $id = 0)
 {
     if (0 == $id) {
         $path = $data['path'];
         $managerId = $data['manager_id'];
         // 判断manager是否存在
         $managerInfo = RootManagerInterface::getById(array('id' => $managerId));
         if (empty($managerInfo)) {
             throw new InterfaceException('管理员不存在!');
         }
         // 判断路径是否存在
         if (!RootPermissionInterface::findPath(array('path' => $path))) {
             throw new InterfaceException('路径不存在!');
         }
         // 判断是否已经添加
         $check = RootManagerInterface::checkPermission(array('id' => $managerId, 'path' => $path));
         if ($check) {
             return 0;
         }
         $trans = new Trans(DbConfig::$SERVER_TRANS);
         $trans->begin();
         $model = new RootRelationModel($trans);
         // 删除重复权限
         $dir = rtrim($path, '/') . '/';
         $where = array(array('manager_id', '=', $managerId), array('path', 'LIKE', "{$dir}%"));
         $model->delete($where);
         $insertData = $data;
         $id = $model->insert($insertData);
         $trans->commit();
         self::syncToRedis($managerId);
         return $id;
     } else {
         $model = new RootRelationModel();
         $updateData = $data;
         $affects = $model->updateById($id, $updateData);
         return $affects;
     }
 }
示例#8
0
 public function __construct()
 {
     //connect to db and get page with $id
     $db = DatabaseController::getInstance();
     $mysqli = $db->getConnection();
     $sql_query = "SELECT product_id FROM product WHERE lang = '" . Trans::getDomain() . "' AND hidden != 1;";
     if ($result = $mysqli->query($sql_query)) {
         while ($row = mysqli_fetch_row($result)) {
             $this->products[] = new Product($row[0]);
         }
         /* free result set */
         mysqli_free_result($result);
     }
 }
 public static function deleteById($id)
 {
     $managerInfo = self::getById($id);
     if (empty($managerInfo)) {
         return 0;
     }
     // 发起事务
     $trans = new Trans(DbConfig::$SERVER_TRANS);
     $trans->begin();
     $model = new RootManagerModel($trans);
     // 删除管理员权限 -> 删除管理员
     RootRelationInterface::deleteByManagerId(array('manager_id' => $id, 'trans' => $trans));
     $affects = $model->deleteById($id);
     // 删除redis中的数据
     $redis = RedisClient::getInstance(RedisConfig::$SERVER_COMMON);
     // 删除path
     $key = RedisKeys::ROOT_PATH_SET_ . $id;
     $redis->delete($key);
     // 删除user_id
     $key = RedisKeys::ROOT_ENABLED_HASH;
     $redis->hDel($key, $managerInfo['user_id']);
     $trans->commit();
     return $affects;
 }
示例#10
0
 public function render()
 {
     echo "<div class='content'>\n                <div class='container'>\n                    <div class='p-content'>\n                        <div class='p-content-header'>\n                            <div class='p-content-header-left'>\n                                 <h1>" . Trans::_('Your Cart') . "</h1>\n                            </div>\n                            <div class='p-content-header-right'>\n\n                            </div>\n                            <div class='clearfix'> </div>\n                        </div>";
     $products = "";
     foreach ($this->model->getProducts() as $product) {
         $images = json_decode($product->__get('images'), true);
         $products .= "<tr>\n                            <td>\n                                <a href='/myshop/" . Trans::getDomain() . "/" . Trans::_('product') . "/" . $product->__get('nicename') . "'><img src='/myshop/images/products/" . $images['thumb'] . "' class='cartthumb' height='60px'/></a><a href='/myshop/" . Trans::getDomain() . "/" . Trans::_('product') . "/" . $product->__get('nicename') . "' class='cartproductlink'><b>" . $product->__get('name1') . "</b></a><br />" . Trans::_('size') . ": " . $product->__get('selectedoption') . "\n                            </td>\n                            <td>\n                                <input type='number' id='" . $product->__get('number') . "' min='0' value='" . $product->__get('amount') . "' disabled>\n                                <a href='/myshop/" . Trans::getDomain() . "/" . Trans::_('cart') . "/update/" . $product->__get('uid') . "/" . ($product->__get('amount') + 1) . "'><i class='fa fa-plus-square'></i></a>\n                                <a href='/myshop/" . Trans::getDomain() . "/" . Trans::_('cart') . "/update/" . $product->__get('uid') . "/" . ($product->__get('amount') - 1) . "'><i class='fa fa-minus-square'></i></a>\n                            </td>\n                            <td>" . number_format($product->__get('price2'), 2) . "</td>\n                            <td>" . number_format($product->__get('price2') * $product->__get('amount'), 2) . "</td>\n                            <td>\n                                <a href='/myshop/" . Trans::getDomain() . "/" . Trans::_('cart') . "/delete/" . $product->__get('uid') . "'><i class='fa fa-trash'></i></a>\n                            </td>\n                           </tr>";
     }
     if ($products == "") {
         echo Trans::_('cart empty');
     } else {
         echo "<form id='cartform' action='/myshop/" . Trans::getDomain() . "/" . Trans::_('checkout') . "' method='post'>\n                    <div class='table-responsive'>\n                      <table class='table'>\n                        <thead>\n                          <tr>\n                            <th>" . Trans::_('details') . "</th>\n                            <th>" . Trans::_('amount') . "</th>\n                            <th>" . Trans::_('single price') . "</th>\n                            <th>" . Trans::_('total price') . "</th>\n                            <th></th>\n                          </tr>\n                        </thead>\n                        <tbody>\n\n                        " . $products . "\n\n                        </tbody>\n                      </table>\n                    </div>\n                    <div class='container-fluid'>\n                        <div class='row'>\n                            <div class='col-md-8'>\n                                <strong>Total: " . number_format($this->model->getCartBalance(), 2) . " CHF</strong>\n                            </div>\n                            <div class='col-md-4'>\n                                <button id='checkout' name='checkout' class='btn btn-success'>" . Trans::_('Checkout') . "</button>\n                            </div>\n                        </div>\n                    </div>\n                  </form>";
     }
     echo "    </div>\n                </div>\n            </div>";
 }
示例#11
0
function get_bottom_menu()
{
    $menu = "<ul class='unstyled-list list-inline'>";
    $lang = Trans::getDomain();
    $pages = array();
    //add products page to menu
    if ($lang == "en_EN") {
        $pages[] = array("Products", "/myshop/products");
    } else {
        if ($lang == "de_DE") {
            $pages[] = array("Produkte", "/myshop/produkte");
        } else {
            if ($lang == "fr_FR") {
                $pages[] = array("Produits", "/myshop/produits");
            }
        }
    }
    // dynamically create page-routes from db
    $db = DatabaseController::getInstance();
    $mysqli = $db->getConnection();
    $sql_query = "SELECT `nicename`,`title`,`pos` FROM pages WHERE lang = '" . $lang . "' AND inmenu = '1' ORDER BY pos DESC;";
    $result = $mysqli->query($sql_query) or trigger_error($mysqli->error . "[{$sql_query}]");
    while ($row = $result->fetch_row()) {
        $pages[] = array($row[1], "/myshop/" . $row[0]);
    }
    //add contact page to menu
    if ($lang == "en_EN" || $lang == "fr_FR") {
        $pages[] = array("Contact", "/myshop/contact");
    } else {
        if ($lang == "de_DE") {
            $pages[] = array("Kontakt", "/myshop/kontakt");
        }
    }
    $l = count($pages);
    //add menu with separators
    for ($i = 0; $i < $l; $i++) {
        if ($i == $l - 1) {
            $menu .= "<li><a href='" . $pages[$i][1] . "'> " . $pages[$i][0] . "</a></li>";
        } else {
            $menu .= "<li><a href='" . $pages[$i][1] . "'> " . $pages[$i][0] . "</a><span></span></li>";
        }
    }
    $menu .= "<div class='clearfix'></div></ul>";
    return $menu;
}
示例#12
0
 public function __construct(Route $model)
 {
     $this->model = $model;
     // get all the parameters from the page uri
     $uriGetParam = isset($_GET['uri']) ? "/" . $_GET['uri'] : '/';
     self::$currentRoute = $uriGetParam;
     foreach (Trans::getAllDomains() as $value) {
         if (strpos($uriGetParam, $value) !== false) {
             Trans::setDomain($value);
         }
         $uriGetParam = str_replace("/" . $value, "", $uriGetParam);
     }
     $uriView = explode("/", $uriGetParam);
     if (isset($uriView[1])) {
         $this->uriView = "/" . $uriView[1];
     } else {
         $this->uriView = "/" . $uriView[0];
     }
     $this->additionalParam = explode("/", $uriGetParam);
     setNewLangInCookie();
 }
示例#13
0
 public function backup($writeLock, $justFetchList = false)
 {
     $backupDir = $this->parameters['backup_path'];
     $menuDir = $this->parameters['menu_path'];
     if (!@is_dir($backupDir) && !@mkdir($backupDir)) {
         throw new YamlMenuException($justFetchList ? Trans::__("Please make sure that there is a menueditor/backups folder or disable the backup-feature in config.yml") : $writeLock, 5);
     }
     if (false === $justFetchList && !@copy($menuDir . '/menu.yml', $backupDir . '/menu.' . time() . '.yml')) {
         throw new YamlMenuException($writeLock, 5);
     }
     // clean up
     $backupFiles = array();
     foreach (new \DirectoryIterator($backupDir) as $fileInfo) {
         if ($fileInfo->isFile() && preg_match("~^menu\\.[0-9]{10}\\.yml\$~i", $fileInfo->getFilename())) {
             $backupFiles[$fileInfo->getMTime()] = $fileInfo->getFilename();
         }
     }
     if ($justFetchList) {
         // make sure there's at least one backup file (first use...)
         if (count($backupFiles) == 0) {
             if (!@copy($menuDir . '/menu.yml', $backupDir . '/menu.' . time() . '.yml')) {
                 throw new YamlMenuException(Trans::__("Please make sure that the menueditor/backups folder is writeable by your webserver or disable the backup-feature in config.yml"));
             }
             return $this->backup(0, true);
         }
         krsort($backupFiles);
         return $backupFiles;
     }
     ksort($backupFiles);
     foreach ($backupFiles as $timestamp => $backupFile) {
         if (count($backupFiles) <= (int) $this->config['keepBackups']) {
             break;
         }
         @unlink($this->backupDir . '/' . $backupFile);
         unset($backupFiles[$timestamp]);
     }
 }
示例#14
0
文件: cookies.php 项目: audef1/myShop
function setNewLangInCookie()
{
    $_COOKIE['locale'] = Trans::getDomain();
    //setcookie("locale",Trans::getDomain(),time()+(60*60*24*360));
}
 /**
  * Executes any command triggered on the admin page.
  */
 protected function processAdminCommand()
 {
     if (isset($_POST['command'], $_POST['id']) && $_POST['command'] === 'delete') {
         $trans = Trans::model()->findbyPk($_POST['id']);
         ChangeLog::addLog('DELETE', 'Trans', $trans->toString());
         $trans->delete();
         // reload the current page to avoid duplicated delete actions
         $this->refresh();
     }
 }
示例#16
0
        $txtWithdraw = P("txtDeposit");
        $txtDTWithdraw = P("txtDTWithdraw");
        $trans = Trans::getInstance();
        $ret = $trans->saveWithdraw($txtWithdraw, $txtDTWithdraw, $bank);
        if ($ret == -1) {
            array_push($errmsg, "รายการนี้ได้มีการแจ้งเข้ามาแล้ว กรุณารอผู้ดูแลยืนยันข้อมูลสักครู่ค่ะ");
        } elseif ($ret == -2) {
            array_push($errmsg, "จำนวนเงินที่ถอนมีมากกว่าเงินในระบบ");
        } elseif ($ret == -3) {
            array_push($errmsg, "รายการที่เรียกขอเข้ามา มีจำนวนมากกว่าเงินในระบบ ท่านต้องยกเลิกรายการเก่าเสียก่อน");
        } else {
            array_push($sucmsg, "ได้รับการแจ้งถอนเงินเข้ามาแล้ว กรุณารอสักครู่ ระบบกำลังดำเนินการ");
        }
    } elseif ($submit == "frmBankWithdrawCancel") {
        $tid = P("tid");
        $ret = Trans::getInstance()->setWithdrawCancelByOwn($tid);
        if ($ret == 1) {
            array_push($sucmsg, "ยกเลิกรายการเสร็จสมบูรณ์");
        } elseif ($ret == -1) {
            array_push($errmsg, "ทำรายการไม่สมบูรณ์");
        }
    }
} elseif (REQUEST_METHOD == "GET" && isset($_SESSION["FB_TOKEN"])) {
    $data = file_get_contents("https://graph.facebook.com/v2.5/me?fields=name,email,picture&access_token=" . $_SESSION["FB_TOKEN"]);
    $data = json_decode($data, true);
    $fbid = $data["id"];
    $fbtoken = $_SESSION["FB_TOKEN"];
    $user = (new Users())->getCurrentUser();
    $ret = $user->fbConnect($fbid, $fbtoken);
    if ($ret == 1) {
        array_push($sucmsg, "เชื่อมต่อบัญชีของคุณกับเฟสบุคเสร็จสมบูรณ์");
示例#17
0
文件: trans.php 项目: cloverink/lotto
 function saveWithdraw($val, $dt, $bank)
 {
     $val = escapeSQL($val);
     $dt = escapeSQL($dt);
     $bank = escapeSQL($bank);
     $uid = S("user")['uid'];
     $value = "{$val},{$dt},{$bank}";
     $withdraw = intval($val);
     if ($withdraw > Trans::getInstance()->getBalance()) {
         return -2;
     }
     $withdrawpending = $withdraw + Trans::getInstance()->getWithdrawPending();
     if ($withdrawpending > Trans::getInstance()->getBalance()) {
         return -3;
     }
     $sql = "select count(*) cnt from trans where trans_value = '{$value}' and uid = {$uid} and trans_type = 'W'";
     $o = queryScalar($sql);
     if ($o->cnt) {
         return -1;
     }
     $sql = "insert into trans(uid, trans_type, trans_value) values({$uid}, 'W', '{$value}')";
     mysql_query($sql);
     return 1;
 }
示例#18
0
文件: index.php 项目: audef1/myShop
<?php

/**
 * Created by PhpStorm.
 * User: florianauderset
 * Date: 27.11.15
 * Time: 08:57
 */
require_once "inc/autoloader.php";
session_start();
Trans::init();
require_once "inc/cookies.php";
?>
<!DOCTYPE html>
<html>
    <head>
        <?php 
require_once "inc/head.php";
?>
    </head>
    <body>
        <!--- content --->
        <?php 
$routecontroller->renderView();
?>
        <!--- end content --->
    </body>
</html>
示例#19
0
文件: routes.php 项目: dhaval48/cms
*/
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
// Home page for the website.
Route::get('/', 'PublicController@home');
// Dashboard for administartor
// User routes
Route::group(['middleware' => 'web'], function () {
    Route::auth();
    Route::get('/home', 'UserController@home');
    Route::get('/admin', 'AdminController@home');
    // Routes for facades testing
    Route::get('facade/test', function (\Illuminate\Http\Request $request) {
        return \Trans::to('en/admin/page/page');
    });
});
// Routes for facades testing
Route::get('test/crypt', function () {
});
// Routes for facades testing
Route::get('test/decrypt', function () {
    return strlen('eyJpdiI6IkI2R0Yxc2tNR0hGdEtpVWR6ZzA3OEE9PSIsInZhbHVlIjoiSUxadEF5b3BZMEZYWU02cnRRcGxqdHFrM29tbzk4cXh6M1RVbkxFTXNUUXVHTmhEXC9qQVc1VWltVWlDayswQ0QiLCJtYWMiOiJkYzdmYzBiNzM3ZjM4M2E3Mzg3Mzg2YzZkYjZhNWFmZTE2ZTg0ZWMyN2MwYmY3NDc0MmFlZTdlODFiMjgxN2FlIn0=');
});
示例#20
0
 public function postToCyrilic()
 {
     return Response::json(array('status' => 'success', 'response' => html_entity_decode(Trans::lat2cir(htmlspecialchars_decode(Trans::stripuj(Input::get('text')))), ENT_QUOTES, "UTF-8")));
 }
示例#21
0
文件: i18n.php 项目: audef1/myShop
<?php

/**
 * Created by PhpStorm.
 * User: florianauderset
 * Date: 04.12.15
 * Time: 11:41
 */
//Internationalisation
if (isset($_COOKIE['locale'])) {
    $locale = $_COOKIE['locale'];
    Trans::setDomain($locale);
}
示例#22
0
 /**
  * 同步数据到oj_solution
  *
  * @throws  Exception
  */
 public function sync()
 {
     $solutionInfo = OjSolutionInterface::getById(array('id' => $this->solutionId));
     if (empty($solutionInfo)) {
         Logger::error('judge', "SOLUTION_ID:{$this->solutionId},Solution不存在!");
         throw new Exception("SOLUTION_ID:{$this->solutionId},Solution不存在!");
     }
     if ($solutionInfo['remote'] != StatusVars::REMOTE_POJ) {
         Logger::error('judge', "SOLUTION_ID:{$this->solutionId},必须是POJ的Solution!");
         throw new Exception("SOLUTION_ID:{$this->solutionId},必须是POJ的Solution!");
     }
     if (empty($solutionInfo['run_id'])) {
         Logger::error('judge', "RUN_ID为0!");
         throw new Exception("SOLUTION_ID:{$this->solutionId},RUN_ID为0!");
     }
     if ($solutionInfo['remote_uid'] != -1 && $solutionInfo['remote_uid'] != $this->uid) {
         Logger::error('judge', "SOLUTION_ID:{$this->solutionId},当前uid不等于remote_uid,无法获取其他用户的状态!");
         throw new Exception("SOLUTION_ID:{$this->solutionId},当前uid不等于remote_uid,无法获取其他用户的状态!");
     }
     // 尝试多次获取结果
     $rowInfo = array();
     $i = 1;
     while ($i <= 10) {
         $rowInfo = $this->getResult($solutionInfo['run_id']);
         if (false === $rowInfo || in_array($rowInfo['result'], StatusVars::$pojResultMap)) {
             break;
         }
         $i > 5 ? sleep(2) : usleep(500000);
         $i++;
     }
     // 获取获取结果超时
     if (false === $rowInfo) {
         Logger::info('judge', "SOLUTION_ID:{$this->solutionId},获取结果失败2,写入TIME_OUT");
         $data = array('id' => $this->solutionId, 'result' => StatusVars::TIME_OUT, 'time_cost' => 0, 'memory_cost' => 0);
         OjSolutionInterface::save($data);
     } else {
         Logger::info('judge', "SOLUTION_ID:{$this->solutionId},POJ远程judge成功!尝试次数:{$i}");
         $trans = new Trans(DbConfig::$SERVER_TRANS);
         $trans->begin();
         $data = array('trans' => $trans, 'id' => $this->solutionId, 'result' => $rowInfo['result'], 'time_cost' => $rowInfo['time_cost'], 'memory_cost' => $rowInfo['memory_cost']);
         OjSolutionInterface::save($data);
         // 保存Log
         $dataLog = array('trans' => $trans, 'solution_id' => $this->solutionId, 'ce' => Arr::get('ce', $rowInfo['judge_log'], ''), 're' => Arr::get('re', $rowInfo['judge_log'], ''));
         OjSolutionLogInterface::save($dataLog);
         $trans->commit();
     }
 }
示例#23
0
文件: Trans.php 项目: audef1/myShop
 public static function setDomain($key)
 {
     self::$domain = $key;
 }
示例#24
0
    ?>
</td>
    <td><?php 
    echo CHtml::encode($model->changedBy);
    ?>
</td>
    <td><?php 
    echo CHtml::encode(User::getDateFormatted($model->dateChanged, $cLoc, $dateformatter));
    ?>
</td>
    <td>
      <?php 
    echo CHtml::link(Yii::t('lazy8', 'Update'), array('update', 'id' => $model->id));
    ?>
      <?php 
    if (Trans::model()->find('periodId=' . $model->id) == null || Yii::app()->user->getState('allowReEditingOfTransactions')) {
        $deletebutton = CHtml::linkButton(Yii::t('lazy8', 'Delete'), array('submit' => '', 'params' => array('command' => 'delete', 'id' => $model->id), 'confirm' => Yii::t('lazy8', "Are you sure to delete?") . ' - ' . $model->dateStart . "\n" . Yii::t('lazy8', 'This will delete all transactions in this period')));
    } else {
        $deletebutton = CHtml::linkButton(Yii::t('lazy8', 'Delete'), array('submit' => '', 'params' => array('command' => 'admin', 'id' => $model->id), 'confirm' => Yii::t('lazy8', "You cannot delete this record because other records are dependent on it.")));
    }
    echo $deletebutton;
    ?>
	</td>
  </tr>
<?php 
}
?>
  </tbody>
</table>
<br/>
<?php 
示例#25
0
 public function dotext($keyword, $fromUsername)
 {
     $go = new Trans();
     $keyword = $go->t2c($keyword);
     //database
     $ctype = 'general';
     $contentStr = '';
     $moretext = '';
     if (strlen($keyword) > 0) {
         $flag = secret_getflag($fromUsername);
         if ($flag == SECRET_TEXT) {
             secret_inserttext($fromUsername, $keyword);
             $user = secret_gettouser($fromUsername);
             $contentStr = "发送成功!\n如果TA也关注我,\n输入 @" . $user . " 就可以看到你的匿名纸条啦。快让身边的人也来吐露心声吧~~\n";
             $contentStr .= secret_ending();
             secret_updateflag($fromUsername, 0);
         } else {
             //查看最新
             if (preg_match("/^kk([\\s\\S]*)\$/", trim(strtolower($keyword)), $match)) {
                 $contentStr = secret_latestwords($fromUsername);
                 $ctype = 'kk';
             } else {
                 if ($keyword == '有缘人') {
                     $contentStr = secret_wordsbyuser(trim($match[1]));
                 } else {
                     if (preg_match("/^mm([\\s\\S]*)\$/", trim(strtolower($keyword)), $match)) {
                         secret_updateflag($fromUsername, MM_TEXT);
                         secret_inserttouser($fromUsername, '有缘人');
                         $contentStr = "现在以@开头输入你想说的话, 可以说个笑话或者分享一段糗事啊或者分享你的心情,\n而且记得加上联系方式哦~ \nQQ、邮箱、微信号都行啦 这样有缘人才能联系上你~~" . "\n\n输入  @有缘人  查看最新发布";
                         $ctype = 'mm';
                     } else {
                         if (preg_match("/^kta([\\s\\S]*)\$/", trim(strtolower($keyword)), $match)) {
                             secret_updateflag($fromUsername, SECRET_KTA);
                             $contentStr = "以@开头,输入想要查看的的名字,如输入:\n@李小四";
                             $ctype = 'kta';
                         } else {
                             if (preg_match("/^ta([\\s\\S]*)\$/", trim(strtolower($keyword)), $match)) {
                                 secret_updateflag($fromUsername, SECRET_TA);
                                 $contentStr = "以@开头,先输入TA的名字,如输入:\n@李小四";
                                 $ctype = 'ta';
                             } else {
                                 if (preg_match("/^@([\\s\\S]+)\$/", trim($keyword), $match)) {
                                     if (strlen(trim($match[1])) == 0) {
                                         $contentStr = "请在@后面加上名字哦~\n";
                                         $contentStr .= secret_ending();
                                     } else {
                                         if (trim($match[1]) == '有缘人') {
                                             $contentStr = secret_wordsbyuser(trim($match[1]));
                                         } else {
                                             if ($flag == MM_TEXT) {
                                                 secret_inserttext($fromUsername, trim($match[1]));
                                                 $contentStr = "发送成功!\n你的有缘人看到了 一定会联系你的!!\n";
                                                 $contentStr .= secret_ending();
                                                 secret_updateflag($fromUsername, 0);
                                             } else {
                                                 if (strstr(trim($match[1]), ' ') && strpos(trim($match[1]), ' ') < 6) {
                                                     $index = strpos(trim($match[1]), ' ');
                                                     $touser = substr(trim($match[1]), 0, $index);
                                                     secret_inserttouser($fromUsername, $touser);
                                                     secret_inserttext($fromUsername, trim($match[1]));
                                                     if ($touser == '有缘人') {
                                                         $contentStr = "发送成功!\n你的有缘人看到了 一定会联系你的!!\n";
                                                     } else {
                                                         $contentStr = "发送成功!\n如果TA也关注我,\n输入 @" . $touser . " 就可以看到你的匿名纸条啦。快让身边的人也来吐露心声吧~~\n";
                                                     }
                                                     $contentStr .= secret_ending();
                                                     secret_updateflag($fromUsername, 0);
                                                 } else {
                                                     if (mb_strlen(trim($match[1]), 'utf-8') > 8) {
                                                         $touser = '******';
                                                         $index = strpos(trim($match[1]), ' ');
                                                         if ($index != null && index < 6) {
                                                             $touser = substr(trim($match[1]), 0, $index);
                                                         } else {
                                                             $index = strpos(trim($match[1]), ',');
                                                             if ($index != null && index < 6) {
                                                                 $touser = substr(trim($match[1]), 0, $index);
                                                             }
                                                         }
                                                         secret_inserttouser($fromUsername, $touser);
                                                         secret_inserttext($fromUsername, trim($match[1]));
                                                         if ($touser == '有缘人') {
                                                             $contentStr = "发送成功!\n你的有缘人看到了 一定会联系你的!!\n";
                                                         } else {
                                                             $contentStr = "发送成功!\n如果TA也关注我,\n输入 @" . $touser . " 就可以看到你的匿名纸条啦。快让身边的人也来吐露心声吧~~\n";
                                                         }
                                                         $contentStr .= secret_ending();
                                                         secret_updateflag($fromUsername, 0);
                                                     } else {
                                                         if ($flag == SECRET_KTA) {
                                                             $contentStr = secret_wordsbyuser(trim($match[1]));
                                                         } else {
                                                             if ($flag == SECRET_TA) {
                                                                 secret_updateflag($fromUsername, SECRET_TEXT);
                                                                 secret_inserttouser($fromUsername, trim($match[1]));
                                                                 $contentStr = '现在输入你想说的话,可以留下署名哦 这样可能会有人回复你呢';
                                                             } else {
                                                                 $contentStr = secret_wordsbyuser(trim($match[1]));
                                                                 //	$contentStr = secret_welcome();
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                     $ctype = '@';
                                 } else {
                                     if (strtolower($keyword) == 'jx' || strstr($keyword, "匿名小纸条")) {
                                         $contentStr = secret_welcome();
                                         $ctype = 'jx';
                                     } else {
                                         $webchat_textmsgObj = new webchat_textmsg();
                                         list($contentStr, $ctype) = $webchat_textmsgObj->dotext($keyword, $fromUsername);
                                         if ($flag == MM_TEXT && mb_strlen($keyword, 'utf-8') > 10) {
                                             $touser = '******';
                                             secret_inserttouser($fromUsername, $touser);
                                             secret_inserttext($fromUsername, $keyword);
                                             $contentStr .= "\n-----------\n发送成功!\n你的有缘人看到了 一定会联系你的!!\n";
                                             secret_updateflag($fromUsername, 0);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $namesArray = array('傻逼', '生殖器官', '交配', '约炮');
     $contentStr = trim(str_replace($namesArray, '**', $contentStr));
     return array($contentStr, $ctype);
 }
示例#26
0
文件: gash.php 项目: helenseo/pay
 public function ask_payment_again()
 {
     //其他补救脚本方法,非正式功能
     $COID = $this->input->get('order_sn');
     $AMOUNT = $this->input->get('amount');
     $CUID = $this->input->get('currency');
     $data['pay_type_id'] = 7;
     $data['method_id'] = 1;
     //由于method_id = 1, 2是的商家信息是一样的。所以此处可以这么写,但是我不知道是谁写的
     $this->initial_merchant_data($data);
     $trans = new Trans(null);
     $this->trans->k = $this->k;
     $this->trans->v = $this->v;
     $this->trans->p = $this->p;
     // 交易訊息代碼
     $trans->nodes["MSG_TYPE"] = "0500";
     // 請款請使用 0500
     // 交易處理代碼
     $trans->nodes["PCODE"] = "300000";
     // 一般交易請使用 300000, 月租交易請使用 303000, 月租退租請使用 330000
     // 商家遊戲代碼
     $trans->nodes["CID"] = $this->cid;
     // 商家訂單編號
     $trans->nodes["COID"] = $COID;
     // 幣別 ISO Alpha Code
     $trans->nodes["CUID"] = $CUID;
     // 付款代收業者代碼
     $trans->nodes["PAID"] = 'COPGAM02';
     // "COPGAM02" gash点数卡储值,浏览器通用
     // 交易金額
     $trans->nodes["AMOUNT"] = $AMOUNT;
     // 以商家密碼、商家密鑰 I , II ( 已於 Common.php 內設定 ) 取得 ERQC
     $erqc = $trans->GetERQC($this->trans->p, $this->trans->k, $this->trans->v);
     // 商家請款驗證壓碼
     $trans->nodes["ERQC"] = $erqc;
     // 取得送出之交易資料
     $data = $trans->GetSendData();
     $origin_transData = $data;
     $log_res['step'] = 'ask_payment_request_again';
     //请款request
     $log_res = json_encode($log_res);
     log_message('gash', $log_res);
     try {
         // 設定請款服務位置
         $serviceURL = "https://api.eg.gashplus.com/CP_Module/settle.asmx?wsdl";
         //  $serviceURL = "https://stage-api.eg.gashplus.com/CP_Module/settle.asmx?wsdl";
         // 進行請款
         $client = new SoapClient($serviceURL);
         $result = $client->getResponse(array("data" => $origin_transData));
         // 取得結果
         $transData = $result->getResponseResult;
         //请款的回传结果
         $log_res = array();
         $log_res['data'] = $transData;
         $log_res['step'] = 'ask_payment_response_again';
         $log_res = json_encode($log_res);
         log_message('gash', $log_res);
         // 解析回傳結果
         $this->trans = new Trans($transData);
         $this->trans->k = $this->k;
         $this->trans->v = $this->v;
         $this->trans->p = $this->p;
         $isSuccess = $this->trans->nodes["RCODE"] == "0000";
         $isCorrect = false;
         if ($isSuccess) {
             // 檢核 GPS 請款驗證壓碼
             $isCorrect = $this->trans->VerifyERPC($this->trans->k, $this->trans->v);
             if ($isCorrect) {
                 $get_payment_order['order_sn'] = $this->trans->nodes["COID"];
                 $update_to_get_payment_res = $this->CI->payorder->update_order_to_get_payment($get_payment_order);
                 if (!$update_to_get_payment_res) {
                     $ask_res['res_msg'] = '更新訂單至請款成功步驟失敗';
                     return $ask_res;
                 }
                 $condition['recharge_id'] = $this->trans->nodes["COID"];
                 $recharge_info = $this->CI->pay_model->get_recharge_order($condition['recharge_id']);
                 $offer_data_res = $this->offer_service($recharge_info->order_sn, $recharge_info->game_id);
                 //在游戏中发放元宝
                 if (!$offer_data_res['status']) {
                     $ask_res['res_msg'] = '發放元寶失敗';
                     return $ask_res;
                 }
                 $offer_order = array();
                 $offer_order['order_sn'] = $recharge_info->order_sn;
                 $this->CI->payorder->update_order_to_offer_service($offer_order);
                 $ask_res['res'] = TRUE;
                 return $ask_res;
             } else {
                 $ask_res['res_msg'] = ' GPS 請款驗證壓碼錯誤';
                 return $ask_res;
             }
         } else {
             $ask_res['res_msg'] = $this->trans->recvDesc;
             return $ask_res;
         }
     } catch (Exception $ex) {
         $transData = "";
     }
 }
示例#27
0
 public function render()
 {
     echo "<script type='text/javascript' src='/myshop/js/jquery.validate.min.js'></script>";
     echo "\n            <div class='content'>\n                <div class='container'>\n                    <div class='p-content'>\n                        <div class='p-content-header'>\n                            <div class='p-content-header-left'>\n                                 <h1>" . Trans::_('Register') . "</h1>\n                            </div>\n                            <div class='p-content-header-right'>\n\n                            </div>\n                            <div class='clearfix'> </div>\n                        </div>\n\n                        <form id='regform' name='regform' action='/myshop/" . Trans::getDomain() . "/" . Trans::_('register') . "' method='POST' class='form-horizontal'>\n                            <fieldset>\n                                <legend>" . Trans::_('logininformation') . "</legend>\n                                 <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='login'>" . Trans::_('loginname') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='login' name='login' type='text' class='form-control input-md' required=''>\n                                  </div>\n                                </div>\n\n                                <!-- Password input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='password'>" . Trans::_('password') . "</label>\n                                  <div class='col-md-5'>\n                                    <input id='password' name='password' type='password' class='form-control input-md' required=''>\n                                  </div>\n                                </div>\n\n                                <!-- Password input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='password2'>" . Trans::_('repeat password') . "</label>\n                                  <div class='col-md-5'>\n                                    <input id='password2' name='password2' type='password' class='form-control input-md' required=''>\n                                  </div>\n                                </div>\n                            </fieldset>\n\n                            <fieldset>\n                                <legend>" . Trans::_('shippingaddress') . "</legend>\n                                <!-- Select Basic -->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='title'>" . Trans::_('title') . "</label>\n                                  <div class='col-md-4'>\n                                    <select id='title' name='title' class='form-control' required>\n                                      <option value='" . Trans::_('mr') . "'>" . Trans::_('mr') . "</option>\n                                      <option value='" . Trans::_('mrs') . "'>" . Trans::_('mrs') . "</option>\n                                    </select>\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='firstname'>" . Trans::_('firstname') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='firstname' name='firstname' type='text' class='form-control input-md' required>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='lastname'>" . Trans::_('lastname') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='lastname' name='lastname' type='text' class='form-control input-md' required>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='address'>" . Trans::_('address') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='address' name='address' type='text' class='form-control input-md' required>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='zip'>" . Trans::_('zip') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='zip' name='zip' type='text' class='form-control input-md' required>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='location'>" . Trans::_('location') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='location' name='location' type='text' class='form-control input-md' required>\n\n                                  </div>\n                                </div>\n                            </fieldset>\n\n                            <fieldset>\n                                <legend>" . Trans::_('contactinformation') . "</legend>\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='email'>" . Trans::_('email') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='email' name='email' type='text' class='form-control input-md' required>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='phone'>" . Trans::_('phone') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='phone' name='phone' type='text' class='form-control input-md'>\n\n                                  </div>\n                                </div>\n                            </fieldset>\n\n                            <fieldset>\n                                <legend>" . Trans::_('billingaddress') . "</legend>\n                                <!-- Select Basic -->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='title2'>" . Trans::_('title') . "</label>\n                                  <div class='col-md-4'>\n                                    <select id='title2' name='title2' class='form-control'>\n                                      <option value=''></option>\n                                      <option value='" . Trans::_('mr') . "'>" . Trans::_('mr') . "</option>\n                                      <option value='" . Trans::_('mrs') . "'>" . Trans::_('mrs') . "</option>\n                                    </select>\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='firstname2'>" . Trans::_('firstname') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='firstname2' name='firstname2' type='text' class='form-control input-md'>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='lastname2'>" . Trans::_('lastname') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='lastname2' name='lastname2' type='text' class='form-control input-md'>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='address2'>" . Trans::_('address') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='address2' name='address2' type='text' class='form-control input-md'>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='zip2'>" . Trans::_('zip') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='zip2' name='zip2' type='text' class='form-control input-md'>\n\n                                  </div>\n                                </div>\n\n                                <!-- Text input-->\n                                <div class='form-group'>\n                                  <label class='col-md-4 control-label' for='location2'>" . Trans::_('location') . "</label>\n                                  <div class='col-md-5'>\n                                  <input id='location2' name='location2' type='text' class='form-control input-md'>\n\n                                  </div>\n                                </div>\n                            </fieldset>\n\n                            <!-- Multiple Checkboxes -->\n                            <div class='form-group'>\n                              <label class='col-md-4 control-label' for='billingaddress'>" . Trans::_('billingaddress') . "</label>\n                              <div class='col-md-4'>\n                              <div class='checkbox'>\n                                <label for='billingaddress-0'>\n                                  <input type='checkbox' name='billingaddress' id='billingaddress-0' value='1' checked>\n                                  " . Trans::_('isbillingaddress') . "\n                                </label>\n                                </div>\n                              </div>\n                            </div>\n\n                            <!-- Button -->\n                            <div class='form-group'>\n                              <label class='col-md-4 control-label' for='register'></label>\n                              <div class='col-md-4'>\n                                <input type='hidden' name='reggo' id='reggo' value='1' style='display: none;' />\n                                <button id='register' name='register' type='submit' class='btn btn-default'>" . Trans::_('Register') . "</button>\n                              </div>\n                            </div>\n\n                            </fieldset>\n                        </form>\n\n                         <script>\n\n                         \$.validator.addMethod('nospecialchars', function(value, element) {\n                                return this.optional(element) || /^[a-z A-Z 0-9 ÖÄÜäöüéèà +._-]+\$/i.test(value);\n                         }, 'No special Characters allowed.');\n\n                         \$('#regform').validate({\n                           rules: {\n                                login: {\n                                  required: true,\n                                  remote: {\n                                        url: '/myshop/inc/logincheck.php',\n                                        type: 'post',\n                                  },\n                                  nospecialchars: true,\n                                },\n                                password: '******',\n                                password2: {\n                                  equalTo: '#password'\n                                },\n                                email: {\n                                  required: true,\n                                  email: true\n                                },\n                                phone: 'nospecialchars',\n                                title: 'required',\n                                firstname: {\n                                    required: true,\n                                    nospecialchars: true,\n                                },\n                                lastname: {\n                                    required: true,\n                                    nospecialchars: true,\n                                },\n                                address: {\n                                    required: true,\n                                    nospecialchars: true,\n                                },\n                                zip: {\n                                    required: true,\n                                    nospecialchars: true,\n                                },\n                                location: {\n                                    required: true,\n                                    nospecialchars: true,\n                                },\n                                firstname2: {\n                                    nospecialchars: true,\n                                },\n                                lastname2: {\n                                    nospecialchars: true,\n                                },\n                                address2: {\n                                    nospecialchars: true,\n                                },\n                                zip2: {\n                                    nospecialchars: true,\n                                },\n                                location2: {\n                                    nospecialchars: true,\n                                },\n                           },\n                           messages: {\n                                login: {\n                                    required: '" . Trans::_('required') . "',\n                                    remote: '" . Trans::_('usertaken') . "',\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                password: '******'required') . "',\n                                password2: {\n                                    required: '" . Trans::_('required') . "',\n                                    equalTo: '" . Trans::_('notequal') . "',\n                                },\n                                email: {\n                                    required: '" . Trans::_('required') . "',\n                                    email: '" . Trans::_('validemail') . "',\n                                },\n                                phone: {\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                title: {\n                                    required: '" . Trans::_('required') . "',\n                                },\n                                firstname: {\n                                    required: '" . Trans::_('required') . "',\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                lastname: {\n                                    required: '" . Trans::_('required') . "',\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                address: {\n                                    required: '" . Trans::_('required') . "',\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                zip: {\n                                    required: '" . Trans::_('required') . "',\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                location: {\n                                    required: '" . Trans::_('required') . "',\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                firstname2: {\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                lastname2: {\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                address2: {\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                zip2: {\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                                location2: {\n                                    nospecialchars: '" . Trans::_('nospecialchars') . "',\n                                },\n                           },\n                         });\n                         </script>\n                </div>\n            </div>\n        ";
 }
 /**
  * Executes any command triggered on the admin page.
  */
 protected function processAdminCommand()
 {
     if (isset($_POST['command'], $_POST['id']) && $_POST['command'] === 'delete') {
         $deletePeriod = $this->loadPeriod($_POST['id']);
         if (Yii::app()->user->getState('allowReEditingOfTransactions') || Trans::model()->find('periodId=' . $_POST['id']) == null) {
             ChangeLog::addLog('DELETE', 'Period', $deletePeriod->toString());
             $deletePeriod->delete();
             $usersModel = User::model()->findbyPk(Yii::app()->user->id);
             $usersModel->setStates(true);
         }
         // reload the current page to avoid duplicated delete actions
         $this->refresh();
     }
 }
示例#29
0
文件: wiki.php 项目: roryliu/icoding
 function getcontent_zh($keyword)
 {
     // 初始化一个 cURL 对象
     $curl = curl_init();
     // 设置你需要抓取的URL
     curl_setopt($curl, CURLOPT_URL, 'http://zh.wikipedia.org/wiki/' . urlencode($keyword));
     // 设置header
     curl_setopt($curl, CURLOPT_HEADER, 0);
     curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
     // 设置cURL 参数,要求结果保存到字符串中还是输出到屏幕上。
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     //使用自动跳转
     curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
     // 设置cURL 参数,时间超时
     curl_setopt($curl, CURLOPT_TIMEOUT, 4);
     // 运行cURL,请求网页
     $data = curl_exec($curl);
     // 关闭URL请求
     curl_close($curl);
     if ($data == false) {
         $go = new Trans();
         $keyword = $go->c2t($keyword);
         $re = $this->getextracts_zh($keyword);
         if (preg_match("/REDIRECT/", trim($re))) {
             $index = strpos($re, ' ');
             $index2 = strpos($re, ' ', $index + 1);
             if ($index2 === false) {
                 $keyword = substr($re, $index + 1);
             } else {
                 $keyword = substr($re, $index + 1, $index2 - $index - 1);
             }
             $re = $this->getextracts_zh($keyword);
         }
         return $re;
     }
     $content = '';
     while (true) {
         $index = strpos($data, '<p>');
         if ($index === false) {
             break;
         }
         $index2 = strpos($data, '</p>', $index);
         if ($index2 === false) {
             break;
         }
         $tmp = substr($data, $index + 3, $index2 - $index - 3);
         $data = substr($data, $index2);
         $re = '';
         while (strstr($tmp, '<')) {
             $index = strpos($tmp, '<');
             $index2 = strpos($tmp, '>', $index);
             $tmp = substr($tmp, 0, $index) . substr($tmp, $index2 + 1);
         }
         $re = $tmp;
         if (strstr($re, '[') !== false) {
             $tmp = $re;
             $re = '';
             while (strstr($tmp, '[')) {
                 $index = strpos($tmp, '[');
                 $index2 = strpos($tmp, ']');
                 if ($index == 0) {
                     $tmp = trim(substr($tmp, $index2 + 1));
                 } else {
                     $re .= trim(substr($tmp, 0, $index));
                     $tmp = substr($tmp, $index2 + 1);
                 }
             }
         }
         //	$re = str_replace(' ',"\n", $re);
         if (strpos($re, '坐标:') === 0) {
             continue;
         } else {
             $content .= $re . "\n";
         }
     }
     return $content;
 }
示例#30
0
文件: __nav.php 项目: cloverink/lotto
                <div class="float-right avtc">
                  
                  <div style="background-image: url('<?php 
    echo $_SESSION['user']['avt'];
    ?>
')"></div>

                  <ul>
                    <li><a href="/profile"><i class="fa fa-user"></i> Profile</a></li>
                    <li><a href="/setting"><i class="fa fa-cog"></i> Setting</a></li>
                    <li><a href="/logout"><i class="fa fa-sign-out"></i> Sign Out</a></li>
                  </ul>
                  
                  <span class="label label-success"><?php 
    echo number_format(Trans::getInstance()->getBalance());
    ?>
</span>

                </div>

              <?php 
} else {
    ?>
                <a href="/signup" class="btn btn-success float-right"><i class="fa fa-user"></i> สมัครสมาชิก</a>
                <a href="/login" class="btn btn-primary float-right"><i class="fa fa-sign-in"></i> เข้าสู่ระบบ</a>
              <?php 
}
?>
            </li>