public function view()
 {
     $dao = DAO::getDAO('UserDAO');
     if (isset($this->params[0]) && trim($this->params[0]) == 'remove') {
         // ex: requesting: /user-list/delete/2
         $id = trim(sanitizeString($this->params[1]));
         $dao->removeById($id);
     } else {
         if (isset($this->params[0]) && trim($this->params[0]) == 'add') {
             $randNum = mt_rand(0, 99999);
             $newUser = new User(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'createTime' => dbDateTime()));
             // #TODO: implement UserDao.create($newUser) instead.
             if ($dao->countAll() > 30) {
                 // Demo mode: clean up if too many users
                 $dao->execute("DELETE FROM user");
                 $dao->execute("vacuum");
             }
             $dao->insertInto("firstName, lastName, username, email, createTime", $newUser->getFields());
         }
     }
     $users = $dao->getAll();
     $v = $this->smarty;
     $v->assign('title', 'User List');
     $v->assign('inc_content', v('user_list.html'));
     $v->assign('users', $users);
     $v->assign('totalUsers', $dao->countAll());
     $this->display($v, v('index.html'));
 }
Beispiel #2
0
 /**
  * 支付
  *
  * @param $param
  */
 public function weixin($param)
 {
     if (!v('module.name') || !Session::get('member.uid') || empty($param['goods_name']) || empty($param['fee']) || empty($param['body']) || empty($param['tid'])) {
         message('支付参数错误,请重新提交', 'back', 'error');
     }
     if ($pay = Db::table('pay')->where('tid', $param['tid'])->first()) {
         if ($pay['status'] == 1) {
             message('定单已经支付完成', $param['back_url'], 'success');
         }
     }
     $data['siteid'] = SITEID;
     $data['uid'] = Session::get('member.uid');
     $data['tid'] = $param['tid'];
     $data['fee'] = $param['fee'];
     $data['goods_name'] = $param['goods_name'];
     $data['attach'] = isset($param['attach']) ? $param['attach'] : '';
     //附加数据
     $data['module'] = v('module.name');
     $data['body'] = $param['body'];
     $data['attach'] = $param['attach'];
     $data['status'] = 0;
     $data['is_usecard'] = isset($param['is_usecard']) ? $param['is_usecard'] : 0;
     $data['card_type'] = isset($param['card_type']) ? $param['card_type'] : '';
     $data['card_id'] = isset($param['is_usecard']) ? $param['card_id'] : 0;
     $data['card_fee'] = isset($param['card_fee']) ? $param['card_fee'] : 0;
     if (empty($pay)) {
         Db::table('pay')->insertGetId($data);
     }
     Session::set('pay', ['tid' => $data['tid'], 'module' => v('module.name'), 'siteid=' => SITEID]);
     View::with('data', $data);
     View::make('server/build/template/pay.html');
 }
Beispiel #3
0
    /**
     * Get content
     */
    public function getContent()
    {
        session("name");
        session_unset();
        if (post("login")) {
            v("message", t("login.1"));
            $user = RDR_User::login(post("username"), post("password"), post("remember"));
            if ($user) {
                if (get("redirect")) {
                    redirect(get("redirect"));
                }
                redirect(l("RDR_Home"), 302);
            }
        }
        ?>

        <div class="center">
            <img src="<?php 
        echo url()->getByAlias("public", "img/logo-1.png");
        ?>
" alt=""/>
        </div>
        <?php 
        $table = new Form_Table($this->getForm());
        $table->addSubmit("Login");
        echo $table->getHtml();
    }
Beispiel #4
0
 public function post()
 {
     if (IS_POST) {
         $data = json_decode(Request::post('keyword'), TRUE);
         $data['rank'] = $data['istop'] == 1 ? 255 : min(255, intval($data['rank']));
         $data['module'] = v('module.name');
         $data['keywords'] = $data['keyword'];
         $rid = service('WeChat')->rule($data);
         //调用模块的执行方法
         $module = new $this->moduleClass();
         //字段验证
         if ($msg = $module->fieldsValidate($rid)) {
             message($msg, 'back', 'error');
         }
         //使模块保存回复内容
         $module->fieldsSubmit($rid);
         message('规则保存成功', u('post', ['rid' => $rid, 'm' => v('module.name')]));
     }
     //获取关键词回复
     if ($rid = Request::get('rid')) {
         $data = Db::table('rule')->find($rid);
         if (empty($data)) {
             message('回复规则不存在', 'back', 'error');
         }
         $data['keyword'] = Db::table('rule_keyword')->orderBy('id', 'asc')->where('rid', $rid)->get();
         View::with('rule', $data);
     }
     $module = new $this->moduleClass();
     $moduleForm = $module->fieldsDisplay($rid);
     return view()->with('moduleForm', $moduleForm);
 }
 /**
  * execute tests
  */
 public function test($action, $context)
 {
     $action = us($action);
     $test_data_dir = $context->getFile(s('%APPLICATION_DIR%/test_data/class/io'));
     switch ($action) {
         case "combined_regex":
             $filter1 = new Charcoal_RegExFileFilter(s('/sample_file1\\.txt/'));
             $filter2 = new Charcoal_RegExFileFilter(s('/sample_file[23]\\.txt/'));
             $filter = new Charcoal_CombinedFileFilter(v(array($filter1, $filter2)));
             $files = $test_data_dir->listFiles($filter);
             $files_found = array();
             foreach ($files as $file) {
                 $files_found[] = $file->getName();
             }
             $expected = array('sample_file1.txt', 'sample_file2.txt', 'sample_file3.txt');
             $this->assertEquals('array', gettype($files));
             $this->assertEquals(3, count($files));
             $this->assertEquals(array(), array_diff($files_found, $expected));
             return TRUE;
         case "combined_wildcard":
             return TRUE;
         case "combined_complexed":
             return TRUE;
     }
     return FALSE;
 }
Beispiel #6
0
 /**
  * 
  * @param CUploadedFile $fileInstance
  */
 public function addFile($fileInstance, $filename = false, $extraFormat = false)
 {
     $filePath = $this->pathToData . DIRECTORY_SEPARATOR . $this->prefix . $this->id . DIRECTORY_SEPARATOR;
     $accessModel = new PropertyfileModel();
     $generateName = 'u' . md5(uniqid(""));
     $fullNameParts = explode('.', $fileInstance->getName());
     if (!$extraFormat) {
         $format = array_pop($fullNameParts);
     } else {
         $format = $extraFormat;
     }
     if (!$filename) {
         $filename = $generateName;
     } else {
         $filename = str_replace(' ', '', $filename);
     }
     $generateName .= $generateName . '.' . $format;
     $folder = YII::getPathOfAlias('application.data.id' . $this->id) . DIRECTORY_SEPARATOR;
     if (!is_dir($folder)) {
         return false;
     }
     $accessModel->unsetAttributes();
     $accessModel->setAttributes(array('property_id' => $this->id, 'filename' => $filename . '.' . $format, 'systempath' => $generateName));
     if (!$accessModel->save()) {
         return false;
     }
     if (!$fileInstance->saveAs($folder . $generateName, false)) {
         var_dump($filename . '.' . $format);
         v($folder . $generateName);
         return false;
     }
     $resultData = array('filename' => $filename, 'systemname' => $generateName, 'id' => $accessModel->getAttribute('id'));
     return $resultData;
 }
Beispiel #7
0
 public function update($event, $val = null)
 {
     switch ($event) {
         case Render::CHUNK:
             $this->flags = $val;
             break;
         case Render::STANDALONE:
             if ($val) {
                 $this->registerElementMap(static::getDefaultElementMap());
                 $this->registerTextMap(static::getDefaultTextMap());
             }
             break;
         case Render::INIT:
             $this->setOutputDir(Config::output_dir() . strtolower($this->getFormatName()) . '/');
             $this->postConstruct();
             if (file_exists($this->getOutputDir())) {
                 if (!is_dir($this->getOutputDir())) {
                     v("Output directory is a file?", E_USER_ERROR);
                 }
             } else {
                 if (!mkdir($this->getOutputDir())) {
                     v("Can't create output directory", E_USER_ERROR);
                 }
             }
             if (Config::css()) {
                 $this->fetchStylesheet();
             }
             break;
         case Render::VERBOSE:
             v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
             break;
     }
 }
Beispiel #8
0
 public function update($event, $val = null)
 {
     switch ($event) {
         case Render::CHUNK:
         case Render::STANDALONE:
         case Render::VERBOSE:
             parent::update($event, $val);
             break;
         case Render::INIT:
             $this->setOutputDir(Config::output_dir() . strtolower($this->getFormatName()) . '/');
             $this->postConstruct();
             if (file_exists($this->getOutputDir())) {
                 if (!is_dir($this->getOutputDir())) {
                     v("Output directory is a file?", E_USER_ERROR);
                 }
             } else {
                 if (!mkdir($this->getOutputDir(), 0777, true)) {
                     v("Can't create output directory", E_USER_ERROR);
                 }
             }
             if (Config::css()) {
                 $this->fetchStylesheet();
             }
             break;
     }
 }
Beispiel #9
0
 public function delete_planet(array $params)
 {
     $planetID = array_val_required($params, 'planetID');
     $planet = m('Planet', $planetID);
     $planet->delete();
     v('json/success', 'Planet deleted');
 }
Beispiel #10
0
 public function register()
 {
     //系统维护检测
     service('user')->checkSystemClose();
     if (IS_POST) {
         Validate::make([['code', 'captcha', '验证码输入错误', 1], ['password', 'confirm:password2', '两次密码输入不一致', 3]]);
         //默认用户组
         $User = new User();
         $User['username'] = Request::post('username');
         //用户组过期时间
         $daylimit = Db::table('user_group')->where('id', v('config.register.groupid'))->pluck('daylimit');
         $User['endtime'] = time() + $daylimit * 3600 * 24;
         //获取密码与加密密钥
         $info = $User->getPasswordAndSecurity();
         $User['password'] = $info['password'];
         $User['security'] = $info['security'];
         $User['email'] = Request::post('email');
         $User['qq'] = Request::post('qq');
         $User['mobile'] = Request::post('mobile');
         $User['groupid'] = v('config.register.groupid');
         $User['status'] = v('config.register.audit');
         if (!$User->save()) {
             message($User->getError(), 'back', 'error');
         }
         message('注册成功,请登录系统', u('login', ['from' => $_GET['from']]));
     }
     return view();
 }
Beispiel #11
0
function execute_request(&$db)
{
    // do not append or prepend anything to output if we have to download
    $output = v($_REQUEST["type"]) == 'download' ? false : true;
    if ($output) {
        startForm($db);
    }
    if (isset($_REQUEST["type"])) {
        $module_requested = $_REQUEST["type"];
        $_REQUEST["query"] = trim(v($_REQUEST["query"], ""), " \t\r\n;");
        $module = BASE_PATH . "/modules/" . $module_requested . ".php";
        if (ctype_alpha($module_requested) && file_exists($module)) {
            require BASE_PATH . '/config/modules.php';
            // check for module access type and allow/disallow as needed
            if (MODULE_ACCESS_MODE == 'deny' && in_array($module_requested, $DENY_MODULES)) {
                createErrorPage();
            } else {
                if (MODULE_ACCESS_MODE == 'allow' && !in_array($module_requested, $ALLOW_MODULES)) {
                    createErrorPage();
                } else {
                    include $module;
                    function_exists('processRequest') ? processRequest($db) : createErrorGrid($db, "");
                }
            }
        } else {
            createErrorPage();
        }
        // unidentified type requested
    }
    if ($output) {
        print "</form>\n";
        print "</body></html>";
    }
}
Beispiel #12
0
 public function view()
 {
     $v = $this->smarty;
     $v->assign('title', 'Our Products');
     $v->assign('inc_content', v('products/jackets.html'));
     $this->display($v, v('index.html'));
 }
Beispiel #13
0
 public function format_root_set($open, $name, $attrs, $props)
 {
     if ($open) {
         parent::newChunk();
         $this->cchunk = $this->dchunk;
         $pdfDoc = new PdfWriter();
         try {
             $pdfDoc->setCompressionMode(\HaruDoc::COMP_ALL);
         } catch (\HaruException $e) {
             v("PDF Compression failed, you need to compile libharu with Zlib...", E_USER_WARNING);
         }
         parent::setPdfDoc($pdfDoc);
         if (isset($attrs[Reader::XMLNS_XML]["base"]) && ($base = $attrs[Reader::XMLNS_XML]["base"])) {
             parent::setChunkInfo("xml-base", $base);
         }
         $id = $attrs[Reader::XMLNS_XML]["id"];
         $this->cchunk["root-outline"] = $this->cchunk["id-to-outline"][$id] = $pdfDoc->createOutline(Format::getShortDescription($id), null, true);
         $this->setIdToPage($id);
     } else {
         $this->resolveLinks($this->cchunk["setname"]);
         $pdfDoc = parent::getPdfDoc();
         v("Writing Full PDF Manual (%s)", $this->cchunk["setname"], VERBOSE_TOC_WRITING);
         $filename = $this->getOutputDir();
         if (Config::output_filename()) {
             $filename .= Config::output_filename();
         } else {
             $filename .= strtolower($this->getFormatName()) . $this->getExt();
         }
         $pdfDoc->saveToFile($filename);
         unset($pdfDoc);
     }
     return "";
 }
Beispiel #14
0
 /**
  * Load the View
  */
 public function onLoad()
 {
     needRole(RDR_User::ROLE_ADMIN, true);
     $this->user = new RDR_User(db());
     if (get("id")) {
         $tmp = RDR_User::getById(get("id"));
         if ($tmp) {
             $this->user = $tmp;
         }
     }
     $this->form = $this->getForm();
     if (post("save")) {
         if (!$this->form->validateAllFields()) {
             v("message", t("form.validation.error"));
         } elseif (post("password") && post("password") != post("password2")) {
             v("message", t("admin.user.2"));
         } else {
             $this->form->setObjectMembersBySubmittedValues($this->user);
             if (post("password")) {
                 $this->user->setPassword(post("password"));
             }
             $this->user->store();
             v("message", t("saved"));
             $this->form = $this->getForm();
         }
     }
     view("RDR_BasicFrame", array("view" => $this));
 }
Beispiel #15
0
 public function view()
 {
     $v = $this->smarty;
     $v->assign('title', 'About Us');
     $v->assign('inc_content', v('editable_page.html'));
     $this->display($v, v('index.html'));
 }
Beispiel #16
0
Datei: m.php Projekt: xurenlu/tik
 function action_comments_list()
 {
     global $data;
     $comm = new model("comments");
     $data["articles"] = $comm->page("service_id,object_id,id,ip,create_time,author,service_name");
     v();
 }
Beispiel #17
0
function displayUserForm(&$db, &$editor, $message, $action)
{
    $dbList = $db->getDatabases();
    $userList = $editor->getUsersList();
    $privilegeNames = Privileges::getNames();
    $dbPrivilegeNames = DbPrivileges::getNames();
    // current user name is not plaintext in case of 'update' action
    $userName = '';
    if ($action == 'update') {
        $obj = json_decode(v($_REQUEST['query']));
        if (is_object($obj)) {
            $userName = $obj->username . '@' . $obj->hostname;
        }
    } else {
        $userName = v($_REQUEST['query']);
    }
    $currentUser = selectUser($userList, $userName);
    $privileges = array();
    $dbPrivileges = array();
    $userInfo = array();
    if ($currentUser) {
        $privileges = $currentUser->getGlobalPrivileges();
        foreach ($dbList as $db_name) {
            $dbPrivileges[$db_name] = $currentUser->getDbPrivileges($db_name);
        }
        $userInfo = array('username' => $currentUser->userName, 'host' => $currentUser->host);
    }
    $users = userOptions($userList, $currentUser);
    $replace = array('ID' => v($_REQUEST["id"]) ? htmlspecialchars($_REQUEST["id"]) : '', 'MESSAGE' => $message, 'USERS' => $users, 'USER_INFO' => json_encode($userInfo), 'DATABASES' => json_encode($dbList), 'PRIVILEGES' => json_encode($privileges), 'DB_PRIVILEGES' => json_encode($dbPrivileges), 'PRIVILEGE_NAMES' => json_encode($privilegeNames), 'DB_PRIVILEGE_NAMES' => json_encode($dbPrivilegeNames));
    echo view('usermanager', $replace);
}
Beispiel #18
0
 public function view()
 {
     $v = $this->smarty;
     $v->assign('title', t('product_page_title'));
     $v->assign('inc_content', v('products/our_products.html'));
     $this->display($v, v('index.html'));
 }
Beispiel #19
0
 public function view()
 {
     $dao = DAO::getDAO('SearchDAO');
     if (isset($this->params[0]) && trim($this->params[0]) == 'remove') {
         // ex: requesting: /search/delete/2
         $id = trim(sanitizeString($this->params[1]));
         $dao->removeById($id);
     } else {
         if (isset($this->params[0]) && trim($this->params[0]) == 'add') {
             $randNum = mt_rand(0, 99999);
             $newSearch = new Search(array('username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'created' => dbDateTime()));
             // #TODO: implement UserDao.create($newUser) instead.
             if ($dao->countAll() > 30) {
                 // Demo mode: clean up if too many searchs
                 $dao->execute("DELETE FROM searchs");
                 $dao->execute("vacuum");
             }
             $dao->insertInto("username, email, created", $newSearch->getFields());
         }
     }
     $search = $dao->getAll();
     $v = $this->smarty;
     $v->assign('title', 'Search List');
     $v->assign('inc_content', v('search.html'));
     $v->assign('search', $search);
     $v->assign('totalSearch', $dao->countAll());
     $this->display($v, v('index.html'));
 }
Beispiel #20
0
 public function delete_inhabitant(array $params)
 {
     $inhabitantID = array_val_required($params, 'inhabitantID');
     $inhabitant = m('inhabitant', $inhabitantID);
     $inhabitant->delete();
     v('json/success', 'Inhabitant deleted');
 }
Beispiel #21
0
 function checklogin()
 {
     header("Content-type: text/html; charset=utf-8");
     $username = v('username');
     $password = v('password');
     $user_info = get_master_info($username);
     if ($user_info) {
         $realpass = md5($password);
         if ($realpass == $user_info['password']) {
             session_start();
             $_SESSION['user'] = $username;
             $_SESSION['pass'] = md5($realpass);
             echo "<script>";
             echo "window.location.href = '" . c($site_url) . "?c=backedit'";
             echo "</script>";
         } else {
             echo "<script>";
             echo "alert('用户名或密码错误');";
             echo "window.location.href = '" . c($site_url) . "?c=login'";
             echo "</script>";
         }
     } else {
         echo "<script>";
         echo "alert('用户名或密码错误');";
         echo "window.location.href = '" . c($site_url) . "?c=login'";
         echo "</script>";
     }
 }
Beispiel #22
0
 public function login()
 {
     if (Auth::check()) {
         return redirect()->route('admin');
     } else {
         return v();
     }
 }
Beispiel #23
0
 static function f()
 {
     function v()
     {
         echo __METHOD__;
     }
     v();
 }
Beispiel #24
0
 public function view()
 {
     $v = $this->smarty;
     $v->assign('title', t('home_page_title'));
     $v->assign('inc_content', v('welcome.html'));
     $v->assign('text_today', t('today_is', date('d/m/Y')));
     $this->display($v, v('index.html'));
 }
Beispiel #25
0
 function lawdetail()
 {
     $caseid = v('num');
     $data['casecontent'] = get_law_by_id($caseid);
     $data['categorys'] = get_all_lawcat();
     $data['catename'] = get_catname_by_cat($data['casecontent']['category']);
     $data['title'] = $data['top_title'] = $data['casecontent']['title'];
     render($data);
 }
Beispiel #26
0
 function modify($id)
 {
     $data = array();
     $data['title'] = z(v('title'));
     $data['subtitle'] = z(v('subtitle'));
     $data['state'] = z(v('state'));
     $this->db->where('id', $id)->limit(1);
     $this->db->update('w2_form', $data);
 }
Beispiel #27
0
 public function test_v()
 {
     // hit
     $_REQUEST['name'] = 'oldtimes';
     $this->assertEqual(v('name'), 'oldtimes');
     // not hit
     unset($_REQUEST['name']);
     $this->assertEqual(v('name'), false);
 }
Beispiel #28
0
 protected function moduleInitialize()
 {
     if ($name = q('get.m')) {
         v('module', Db::table('modules')->where('name', $name)->first());
     }
     //扩展模块访问
     if (!empty(Request::get('a'))) {
         Request::get('s', 'site/module/entry');
     }
 }
Beispiel #29
0
 public function getKeywords()
 {
     $key = q('post.key');
     if ($key) {
         $content = Db::table('rule_keyword')->where("content LIKE '%{$key}%'")->where('siteid', SITEID)->where('status', 1)->get();
     } else {
         $content = Db::table('rule_keyword')->where('siteid', v('site.siteid'))->where('status', 1)->limit(10)->get();
     }
     ajax($content);
 }
Beispiel #30
0
 public function remove()
 {
     $userGroup = new UserGroup();
     foreach ((array) Request::post('id') as $id) {
         $userGroup->delete($id);
         //更改默认用户组
         Db::table('user')->where('groupid', $id)->update(['groupid' => v('system.register.groupid')]);
     }
     message('更新用户组成功', 'lists', 'success');
 }