示例#1
0
文件: setting.php 项目: daolei/grw
 function permission()
 {
     $acl = FeiClass(model_acl);
     if ($_POST['action'] == 'edit' && isset($_POST['aclid']) && !empty($_POST['aclid']) && !isset($_POST['from'])) {
         $this->P_s = $acl->findBy('aclid', $_POST['aclid']);
     } else {
         if ($_POST['action'] == 'edit' && $_POST['from'] == 'page') {
             //编辑
             $condition = array('aclid' => $this->FeiArgs('aclid'));
             $rows = array('name' => $this->FeiArgs('name'), 'controller' => $this->FeiArgs('controller'), 'action' => $this->FeiArgs('act'), 'acl_name' => $this->FeiArgs('acl'));
             if ($acl->update($condition, $rows)) {
                 $this->success('修改成功!', FeiUrl('setting', 'permission'));
             } else {
                 $this->error('错误', FeiUrl('setting', 'permission'));
             }
         } else {
             if (isset($_POST['acl_action']) && $_POST['acl_action'] == 'add') {
                 //添加
                 $rows = array('name' => $this->FeiArgs('name'), 'controller' => $this->FeiArgs('controller'), 'action' => $this->FeiArgs('action'), 'acl_name' => $this->FeiArgs('acl_name'));
                 if ($acl->create($rows)) {
                     echo 'success';
                     exit;
                 } else {
                     echo 'error';
                     exit;
                 }
             } else {
                 if (isset($_POST[action]) && $_POST[action] == 'del') {
                     //删除
                     //TODO:validate is for this user
                     $aclid = $this->FeiArgs('aclid');
                     $conditions = array('aclid' => $aclid);
                     if ($acl->delete($conditions)) {
                         echo 'success';
                         exit;
                     } else {
                         echo 'error';
                         exit;
                     }
                 }
             }
         }
     }
     $this->result = FeiClass(model_acl)->findAll();
 }
示例#2
0
文件: Grw.php 项目: daolei/grw
 /**
  * 获取用户提示
  */
 function alert()
 {
     #用户信息提示
     $user = FeiClass('model_user');
     $con = array('id' => $_SESSION['Fei_Userid']);
     if ($userinfo = $user->find($con)) {
         #联系信息
         $url = FeiUrl('profile');
         if ($userinfo['email'] == NULL) {
             $this->__alert('warning', "必须填写邮箱才能接收到各类通知哦![<a href=" . $url . ">立即填写</a>]");
         }
         if ($userinfo['phone'] || $userinfo['qq'] || $userinfo['address']) {
             $this->__alert('information', "完善个人信息将获得金币哦![<a href=" . $url . ">点击完善</a>]");
         }
         exit;
     } else {
         #查询出错
     }
 }
示例#3
0
文件: FeiView.php 项目: daolei/grw
 /**
  * 生成单个静态页面
  * @param Feiurl         FeiUrl的参数
  * @param alias_url      生成HTML文件的名称,如果不设置alias_url,将使用年月日生成目录及随机数为文件名的形式生成HTML文件。
  * @param update_mode    更新模式,默认2为同时更新列表及文件
  *                       0是仅更新列表
  *                       1是仅更新文件
  */
 public function make($Feiurl, $alias_url = NULL, $update_mode = 2)
 {
     if (1 == FeiAccess('r', 'Fei_html_making')) {
         $this->Feiurls[] = array($Feiurl, $alias_url);
         return;
     }
     @(list($controller, $action, $args, $anchor) = $Feiurl);
     if ($url_item = FeiHtml::getUrl($controller, $action, $args, $anchor, TRUE)) {
         @(list($baseuri, $realfile) = $url_item);
         $update_mode = 1;
     } else {
         $file_root_name = '' == $GLOBALS['G_Fei']['html']['file_root_name'] ? '' : $GLOBALS['G_Fei']['html']['file_root_name'] . '/';
         if (NULL == $alias_url) {
             $filedir = $file_root_name . date('Y/n/d') . '/';
             $filename = substr(time(), 3, 10) . substr(mt_rand(100000, substr(time(), 3, 10)), 4) . ".html";
         } else {
             $filedir = $file_root_name . dirname($alias_url) . '/';
             $filename = basename($alias_url);
         }
         $baseuri = rtrim(dirname($GLOBALS['G_Fei']['url']["url_path_base"]), '/\\') . "/" . $filedir . $filename;
         $realfile = APP_PATH . "/" . $filedir . $filename;
     }
     if (0 == $update_mode or 2 == $update_mode) {
         FeiHtml::setUrl($Feiurl, $baseuri, $realfile);
     }
     if (1 == $update_mode or 2 == $update_mode) {
         $remoteurl = 'http://' . $_SERVER["SERVER_NAME"] . ':' . $_SERVER['SERVER_PORT'] . '/' . ltrim(FeiUrl($controller, $action, $args, $anchor, TRUE), '/\\');
         $cachedata = file_get_contents($remoteurl);
         if (FALSE === $cachedata) {
             $cachedata = $this->curl_get_file_contents($remoteurl);
             if (FALSE === $cachedata) {
                 FeiError("无法从网络获取页面数据,请检查:<br />1. FeiUrl生成地址是否正确!<a href='{$remoteurl}' target='_blank'>点击这里测试</a>。<br />2. 设置php.ini的allow_url_fopen为On。<br />3. 检查是否防火墙阻止了APACHE/PHP访问网络。<br />4. 建议安装CURL函数库。");
             }
         }
         __mkdirs(dirname($realfile));
         file_put_contents($realfile, $cachedata);
     }
 }
示例#4
0
文件: profile.php 项目: daolei/grw
 function product()
 {
     $product = FeiClass('model_product');
     if (isset($_FILES['product_pic']) && !empty($_FILES['product_pic'])) {
         $upload = FeiClass('FeiUpload');
         if ($upload->upload_file($_FILES['product_pic'])) {
             //Upload Success
             $conditions = array('name' => $this->FeiArgs('product_name'), 'pic' => $upload->new_name, 'link' => $this->FeiArgs('product_link'), 'description' => $this->FeiArgs('product_desc'), 'userid' => $_SESSION['Fei_Userid']);
             if ($product->create($conditions)) {
                 $this->jump(FeiUrl('profile', 'product'));
             } else {
                 $this->error('error', FeiUrl('profile', 'product'));
             }
         } else {
             $this->error($upload->errmsg, FeiUrl('profile', 'product'));
         }
     } elseif (isset($_POST['action']) && $_POST['action'] == 'get_product_content') {
         $conditions = array('userid' => $_SESSION['Fei_Userid']);
         $products = $product->findAll($conditions);
         $str = "";
         foreach ($products as $p) {
             $str .= "<div class=\"image\">\n                            <span class=\"badge\">\n                                新\n                            </span>\n                            <a href=\"" . $this->PIC . $p['pic'] . "\">\n                            <img src=\"" . $this->PIC . $p['pic'] . "\" width=\"160\" />\n                            </a>\n                            <span>" . $p['name'] . "</span>\n                        </div>";
         }
         echo $str;
         exit;
     }
 }
示例#5
0
文件: model_user.php 项目: daolei/grw
 /**
  * 无权限提示及跳转
  */
 public function acljump()
 {
     $url = FeiUrl("FeiTm", "login");
     echo "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><script>function sptips(){alert(\"对不起,您没有权限进行此操作!\");window.location = 'http://www.grw.name';}</script></head><body onload=\"sptips()\"></body></html>";
     exit;
 }
示例#6
0
文件: FeiAcl.php 项目: ivanberry/grw
 /**
  * 默认的无权限提示跳转
  */
 public function def_prompt()
 {
     $url = FeiUrl();
     // 跳转到首页,在强制权限的情况下,请将该页面设置成可以进入。
     echo "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><script>function sptips(){alert(\"Access Failed!\");location.href=\"{$url}\";}</script></head><body onload=\"sptips()\"></body></html>";
     exit;
 }