├── .gitattributes ├── .gitignore ├── README.md ├── application ├── .htaccess ├── cache │ ├── .htaccess │ └── index.html ├── config │ ├── autoload.php │ ├── config.php │ ├── constants.php │ ├── database.php │ ├── doctypes.php │ ├── foreign_chars.php │ ├── hooks.php │ ├── index.html │ ├── migration.php │ ├── mimes.php │ ├── profiler.php │ ├── routes.php │ ├── smileys.php │ └── user_agents.php ├── controllers │ ├── index.php │ ├── manage │ │ ├── member.php │ │ ├── menu.php │ │ ├── node.php │ │ └── role.php │ └── product │ │ └── index.php ├── errors │ ├── error_404.php │ ├── error_db.php │ ├── error_general.php │ ├── error_php.php │ └── index.html ├── helpers │ └── index.html ├── hooks │ └── index.html ├── index.html ├── language │ └── english │ │ └── index.html ├── libraries │ └── index.html ├── logs │ └── index.html ├── models │ └── index.html ├── third_party │ ├── index.html │ └── rbac │ │ ├── config │ │ ├── memcached.php │ │ └── rbac.php │ │ ├── controllers │ │ ├── index.php │ │ └── manage │ │ │ ├── member.php │ │ │ ├── menu.php │ │ │ ├── node.php │ │ │ └── role.php │ │ ├── helpers │ │ └── rbac_helper.php │ │ ├── hooks │ │ ├── index.html │ │ └── rbac_hook.php │ │ ├── libraries │ │ └── memcached.php │ │ ├── models │ │ └── rbac_model.php │ │ └── views │ │ ├── foot.php │ │ ├── head.php │ │ ├── login.php │ │ ├── main.php │ │ ├── manage │ │ ├── member.php │ │ ├── member │ │ │ ├── add.php │ │ │ ├── delete.php │ │ │ └── edit.php │ │ ├── menu.php │ │ ├── menu │ │ │ ├── add.php │ │ │ ├── delete.php │ │ │ └── edit.php │ │ ├── node.php │ │ ├── node │ │ │ ├── add.php │ │ │ ├── delete.php │ │ │ └── edit.php │ │ ├── role.php │ │ └── role │ │ │ ├── action.php │ │ │ ├── add.php │ │ │ ├── delete.php │ │ │ └── edit.php │ │ ├── menu.php │ │ └── redirect.php └── views │ └── product │ └── index.php ├── index.php ├── mysql.sql ├── static ├── bootstrap │ ├── css │ │ ├── bootstrap-theme.min.css │ │ └── bootstrap.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── js │ │ ├── bootstrap.min.js │ │ └── respond.min.js ├── jquery.1102.min.js └── offcanvas.css └── system ├── .htaccess ├── core ├── Benchmark.php ├── CodeIgniter.php ├── Common.php ├── Config.php ├── Controller.php ├── Exceptions.php ├── Hooks.php ├── Input.php ├── Lang.php ├── Loader.php ├── Model.php ├── Output.php ├── Router.php ├── Security.php ├── URI.php ├── Utf8.php └── index.html ├── database ├── DB.php ├── DB_active_rec.php ├── DB_cache.php ├── DB_driver.php ├── DB_forge.php ├── DB_result.php ├── DB_utility.php ├── drivers │ ├── cubrid │ │ ├── cubrid_driver.php │ │ ├── cubrid_forge.php │ │ ├── cubrid_result.php │ │ ├── cubrid_utility.php │ │ └── index.html │ ├── index.html │ ├── mssql │ │ ├── index.html │ │ ├── mssql_driver.php │ │ ├── mssql_forge.php │ │ ├── mssql_result.php │ │ └── mssql_utility.php │ ├── mysql │ │ ├── index.html │ │ ├── mysql_driver.php │ │ ├── mysql_forge.php │ │ ├── mysql_result.php │ │ └── mysql_utility.php │ ├── mysqli │ │ ├── index.html │ │ ├── mysqli_driver.php │ │ ├── mysqli_forge.php │ │ ├── mysqli_result.php │ │ └── mysqli_utility.php │ ├── oci8 │ │ ├── index.html │ │ ├── oci8_driver.php │ │ ├── oci8_forge.php │ │ ├── oci8_result.php │ │ └── oci8_utility.php │ ├── odbc │ │ ├── index.html │ │ ├── odbc_driver.php │ │ ├── odbc_forge.php │ │ ├── odbc_result.php │ │ └── odbc_utility.php │ ├── pdo │ │ ├── index.html │ │ ├── pdo_driver.php │ │ ├── pdo_forge.php │ │ ├── pdo_result.php │ │ └── pdo_utility.php │ ├── postgre │ │ ├── index.html │ │ ├── postgre_driver.php │ │ ├── postgre_forge.php │ │ ├── postgre_result.php │ │ └── postgre_utility.php │ ├── sqlite │ │ ├── index.html │ │ ├── sqlite_driver.php │ │ ├── sqlite_forge.php │ │ ├── sqlite_result.php │ │ └── sqlite_utility.php │ └── sqlsrv │ │ ├── index.html │ │ ├── sqlsrv_driver.php │ │ ├── sqlsrv_forge.php │ │ ├── sqlsrv_result.php │ │ └── sqlsrv_utility.php └── index.html ├── fonts ├── index.html └── texb.ttf ├── helpers ├── array_helper.php ├── captcha_helper.php ├── cookie_helper.php ├── date_helper.php ├── directory_helper.php ├── download_helper.php ├── email_helper.php ├── file_helper.php ├── form_helper.php ├── html_helper.php ├── index.html ├── inflector_helper.php ├── language_helper.php ├── number_helper.php ├── path_helper.php ├── security_helper.php ├── smiley_helper.php ├── string_helper.php ├── text_helper.php ├── typography_helper.php ├── url_helper.php └── xml_helper.php ├── index.html ├── language ├── english │ ├── calendar_lang.php │ ├── date_lang.php │ ├── db_lang.php │ ├── email_lang.php │ ├── form_validation_lang.php │ ├── ftp_lang.php │ ├── imglib_lang.php │ ├── index.html │ ├── migration_lang.php │ ├── number_lang.php │ ├── profiler_lang.php │ ├── unit_test_lang.php │ └── upload_lang.php └── index.html └── libraries ├── Cache ├── Cache.php └── drivers │ ├── Cache_apc.php │ ├── Cache_dummy.php │ ├── Cache_file.php │ └── Cache_memcached.php ├── Calendar.php ├── Cart.php ├── Driver.php ├── Email.php ├── Encrypt.php ├── Form_validation.php ├── Ftp.php ├── Image_lib.php ├── Javascript.php ├── Log.php ├── Migration.php ├── Pagination.php ├── Parser.php ├── Profiler.php ├── Session.php ├── Sha1.php ├── Table.php ├── Trackback.php ├── Typography.php ├── Unit_test.php ├── Upload.php ├── User_agent.php ├── Xmlrpc.php ├── Xmlrpcs.php ├── Zip.php ├── index.html └── javascript └── Jquery.php /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SmartCI v1.6 2 | ======= 3 | 基于CI的RBAC访问控制 4 | 5 | 框架:CI 2.1.4 6 | 前端:bootstrap3.0 7 | 模型:RBAC0(甚至更简单) 8 | 9 |
11 | application->controllers->manage[目录] 12 | 此目录为RBAC的后端管理(不实现方法,只是简单调用,只是简单调用third_party下文件) 13 |14 |
15 | application->controllers->index.php 16 | RBAC登录,用户主页(不实现方法,只是简单调用third_party下文件) 17 |18 |
19 | application->third_party[目录] 20 | 这里面就是整体的RBAC实现了,如果有更新,基本上只更新此目录即可[除非有特殊声明更新其他文件] 21 |22 | 23 |
25 | Autoload: 26 | packages APPPATH.'third_party/rbac' 27 |28 |
29 | Hooks: 30 | post_controller_constructor RBAC验证 31 | display_override 重写显示(注意:默认重写view,如果不想重写则在方法中调用$this->view_override = FALSE;) 32 | pre_system 开启原生SESSION 33 |34 | 35 |
37 | /* Location: ./application/third_party/rbac/config/rbac.php */ 38 | $config['rbac_auth_on'] = TRUE; //是否开启认证 39 | $config['rbac_auth_type'] = '2'; //认证方式1,登录认证;2,实时认证 40 | $config['rbac_auth_key'] = 'MyAuth'; //SESSION标记 41 | $config['rbac_auth_gateway'] = 'Index/login'; //默认认证网关 42 | $config['rbac_default_index'] = 'product/index/index'; //成功登录默认跳转模块 43 | $config['rbac_manage_menu_hidden'] = array('后台管理'); //后台管理导航中不显示的菜单 44 | $config['rbac_manage_node_hidden'] = array('manage'); //后台管理节点中不显示的菜单 45 | $config['rbac_notauth_dirc'] = array(''); //默认无需认证目录array("public","manage") 46 |47 | 48 |
Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/config/autoload.php: -------------------------------------------------------------------------------- 1 | '', 5 | 'xhtml1-strict' => '', 6 | 'xhtml1-trans' => '', 7 | 'xhtml1-frame' => '', 8 | 'html5' => '', 9 | 'html4-strict' => '', 10 | 'html4-trans' => '', 11 | 'html4-frame' => '' 12 | ); 13 | 14 | /* End of file doctypes.php */ 15 | /* Location: ./application/config/doctypes.php */ -------------------------------------------------------------------------------- /application/config/foreign_chars.php: -------------------------------------------------------------------------------- 1 | 'ae', 12 | '/ö|œ/' => 'oe', 13 | '/ü/' => 'ue', 14 | '/Ä/' => 'Ae', 15 | '/Ü/' => 'Ue', 16 | '/Ö/' => 'Oe', 17 | '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A', 18 | '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a', 19 | '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', 20 | '/ç|ć|ĉ|ċ|č/' => 'c', 21 | '/Ð|Ď|Đ/' => 'D', 22 | '/ð|ď|đ/' => 'd', 23 | '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E', 24 | '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e', 25 | '/Ĝ|Ğ|Ġ|Ģ/' => 'G', 26 | '/ĝ|ğ|ġ|ģ/' => 'g', 27 | '/Ĥ|Ħ/' => 'H', 28 | '/ĥ|ħ/' => 'h', 29 | '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I', 30 | '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i', 31 | '/Ĵ/' => 'J', 32 | '/ĵ/' => 'j', 33 | '/Ķ/' => 'K', 34 | '/ķ/' => 'k', 35 | '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L', 36 | '/ĺ|ļ|ľ|ŀ|ł/' => 'l', 37 | '/Ñ|Ń|Ņ|Ň/' => 'N', 38 | '/ñ|ń|ņ|ň|ʼn/' => 'n', 39 | '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O', 40 | '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o', 41 | '/Ŕ|Ŗ|Ř/' => 'R', 42 | '/ŕ|ŗ|ř/' => 'r', 43 | '/Ś|Ŝ|Ş|Š/' => 'S', 44 | '/ś|ŝ|ş|š|ſ/' => 's', 45 | '/Ţ|Ť|Ŧ/' => 'T', 46 | '/ţ|ť|ŧ/' => 't', 47 | '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U', 48 | '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u', 49 | '/Ý|Ÿ|Ŷ/' => 'Y', 50 | '/ý|ÿ|ŷ/' => 'y', 51 | '/Ŵ/' => 'W', 52 | '/ŵ/' => 'w', 53 | '/Ź|Ż|Ž/' => 'Z', 54 | '/ź|ż|ž/' => 'z', 55 | '/Æ|Ǽ/' => 'AE', 56 | '/ß/'=> 'ss', 57 | '/IJ/' => 'IJ', 58 | '/ij/' => 'ij', 59 | '/Œ/' => 'OE', 60 | '/ƒ/' => 'f' 61 | ); 62 | 63 | /* End of file foreign_chars.php */ 64 | /* Location: ./application/config/foreign_chars.php */ -------------------------------------------------------------------------------- /application/config/hooks.php: -------------------------------------------------------------------------------- 1 | 'Rbac', 15 | 'function' => 'aoto_verify', 16 | 'filename' => 'rbac_hook.php', 17 | 'filepath' => 'third_party/rbac/hooks', 18 | 'params' => '', 19 | ); 20 | 21 | $hook['display_override'] = array( 22 | 'class' => 'Rbac', 23 | 'function' => 'view_override', 24 | 'filename' => 'rbac_hook.php', 25 | 'filepath' => 'third_party/rbac/hooks', 26 | 'params' => '', 27 | ); 28 | 29 | //默认开启SESSION 30 | $hook['pre_system'] = array( 31 | 'class' => '', 32 | 'function' => 'session_start', 33 | 'filename' => '', 34 | 'filepath' => '', 35 | 'params' => '', 36 | ); 37 | /* End of file hooks.php */ 38 | /* Location: ./application/config/hooks.php */ -------------------------------------------------------------------------------- /application/config/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/config/migration.php: -------------------------------------------------------------------------------- 1 | migration->latest() this is the version that schema will 21 | | be upgraded / downgraded to. 22 | | 23 | */ 24 | $config['migration_version'] = 0; 25 | 26 | 27 | /* 28 | |-------------------------------------------------------------------------- 29 | | Migrations Path 30 | |-------------------------------------------------------------------------- 31 | | 32 | | Path to your migrations folder. 33 | | Typically, it will be within your application path. 34 | | Also, writing permission is required within the migrations path. 35 | | 36 | */ 37 | $config['migration_path'] = APPPATH . 'migrations/'; 38 | 39 | 40 | /* End of file migration.php */ 41 | /* Location: ./application/config/migration.php */ -------------------------------------------------------------------------------- /application/config/profiler.php: -------------------------------------------------------------------------------- 1 | array('grin.gif', '19', '19', 'grin'), 20 | ':lol:' => array('lol.gif', '19', '19', 'LOL'), 21 | ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), 22 | ':)' => array('smile.gif', '19', '19', 'smile'), 23 | ';-)' => array('wink.gif', '19', '19', 'wink'), 24 | ';)' => array('wink.gif', '19', '19', 'wink'), 25 | ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), 26 | ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), 27 | ':-S' => array('confused.gif', '19', '19', 'confused'), 28 | ':wow:' => array('surprise.gif', '19', '19', 'surprised'), 29 | ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), 30 | ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), 31 | '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), 32 | ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), 33 | ':P' => array('raspberry.gif', '19', '19', 'raspberry'), 34 | ':blank:' => array('blank.gif', '19', '19', 'blank stare'), 35 | ':long:' => array('longface.gif', '19', '19', 'long face'), 36 | ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), 37 | ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), 38 | ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), 39 | '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), 40 | ':down:' => array('downer.gif', '19', '19', 'downer'), 41 | ':red:' => array('embarrassed.gif', '19', '19', 'red face'), 42 | ':sick:' => array('sick.gif', '19', '19', 'sick'), 43 | ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), 44 | ':-/' => array('hmm.gif', '19', '19', 'hmmm'), 45 | '>:(' => array('mad.gif', '19', '19', 'mad'), 46 | ':mad:' => array('mad.gif', '19', '19', 'mad'), 47 | '>:-(' => array('angry.gif', '19', '19', 'angry'), 48 | ':angry:' => array('angry.gif', '19', '19', 'angry'), 49 | ':zip:' => array('zip.gif', '19', '19', 'zipper'), 50 | ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), 51 | ':ahhh:' => array('shock.gif', '19', '19', 'shock'), 52 | ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), 53 | ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), 54 | ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), 55 | ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), 56 | ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), 57 | ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), 58 | ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), 59 | ':snake:' => array('snake.gif', '19', '19', 'snake'), 60 | ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'), 61 | ':question:' => array('question.gif', '19', '19', 'question') // no comma after last item 62 | 63 | ); 64 | 65 | /* End of file smileys.php */ 66 | /* Location: ./application/config/smileys.php */ -------------------------------------------------------------------------------- /application/controllers/index.php: -------------------------------------------------------------------------------- 1 | view_override = FALSE; 13 | $header = array( 14 | 'header_title'=>'测试系统页面' 15 | ); 16 | $this->load->view("product/index",$header); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /application/errors/error_404.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Severity:
6 |Message:
7 |Filename:
8 |Line Number:
9 | 10 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/helpers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/hooks/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/language/english/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/libraries/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/logs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/models/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/third_party/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/third_party/rbac/config/memcached.php: -------------------------------------------------------------------------------- 1 | array('192.168.4.37:11211'), 13 | 'debug' => false 14 | ); 15 | 16 | /* End of file memcached.php */ 17 | /* Location: ./application/third_party/rbac/config/memcached.php */ -------------------------------------------------------------------------------- /application/third_party/rbac/config/rbac.php: -------------------------------------------------------------------------------- 1 | config->item('rbac_auth_gateway'),"请先登录!"); 21 | }else{ 22 | success_redirct($this->config->item('rbac_default_index'),"您已成功登录,正在跳转请稍候!","1"); 23 | } 24 | 25 | } 26 | /** 27 | * 用户登录 28 | */ 29 | public function login(){ 30 | 31 | $this->load->model("rbac_model"); 32 | $username = $this->input->post('username'); 33 | $password = $this->input->post('password'); 34 | if($username&&$password){ 35 | $STATUS = $this->rbac_model->check_user($username,md5($password)); 36 | if($STATUS===TRUE){ 37 | success_redirct($this->config->item('rbac_default_index'),"登录成功!"); 38 | }else{ 39 | error_redirct($this->config->item('rbac_auth_gateway'),$STATUS); 40 | die(); 41 | } 42 | }else{ 43 | $this->load->view("login"); 44 | } 45 | 46 | } 47 | /* 48 | * 用户退出 49 | */ 50 | public function logout(){ 51 | session_destroy(); 52 | success_redirct($this->config->item('rbac_auth_gateway'),"登出成功!",2); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /application/third_party/rbac/controllers/manage/node.php: -------------------------------------------------------------------------------- 1 | load->database(); 13 | } 14 | /** 15 | * 节点首页 16 | */ 17 | public function index() 18 | { 19 | $rbac_where = ""; 20 | $node_hidden_array = $this->config->item('rbac_manage_node_hidden'); 21 | if(!empty($node_hidden_array)){ 22 | $rbac_where = "WHERE "; 23 | foreach($node_hidden_array as $node_hidden){ 24 | $rbac_where.= "dirc != '$node_hidden' AND "; 25 | } 26 | $rbac_where = substr($rbac_where,0,-4); 27 | } 28 | $query = $this->db->query("SELECT * FROM rbac_node {$rbac_where} ORDER BY dirc,cont,func"); 29 | $data = $query->result(); 30 | foreach($data as $vo){ 31 | $node_list[$vo->dirc][$vo->cont][$vo->func] = $vo; 32 | } 33 | $this->load->view('manage/node',array('node'=>$node_list)); 34 | } 35 | /** 36 | * 新增节点 37 | * @param string $dirc 38 | * @param string $cont 39 | * @param string $func 40 | */ 41 | public function add($dirc=NULL,$cont=NULL,$func=NULL){ 42 | if($this->input->post()){ 43 | $dirc = $this->input->post("dirc")?$this->input->post("dirc"):$dirc; 44 | $cont = $this->input->post("cont")?$this->input->post("cont"):$cont; 45 | $func = $this->input->post("func"); 46 | $memo = $this->input->post("memo"); 47 | $status = $this->input->post("status")==1?1:0; 48 | if($dirc&&$cont&&$func&&$memo){ 49 | $query = $this->db->query("SELECT id FROM rbac_node WHERE dirc = '".$dirc."' AND cont = '".$cont."' AND func = '".$func."'"); 50 | $data = $query->row_array(); 51 | if(!$data){ 52 | $sql = "INSERT INTO rbac_node (`dirc`,`cont`,`func`,`status`,`memo`) values('{$dirc}','{$cont}','{$func}','{$status}','{$memo}')"; 53 | //echo $sql;die(); 54 | $this->db->query($sql); 55 | success_redirct('manage/node/index','节点添加成功!'); 56 | }else{ 57 | error_redirct('',"该节点已存在!"); 58 | } 59 | }else{ 60 | error_redirct('',"信息填写不全!"); 61 | } 62 | } 63 | $this->load->view('manage/node/add',array('dirc'=>$dirc,'cont'=>$cont,'func'=>$func)); 64 | } 65 | /** 66 | * 删除节点 67 | * @param string $dirc 68 | * @param string $cont 69 | * @param string $func 70 | */ 71 | public function delete($dirc=NULL,$cont=NULL,$func=NULL){ 72 | if($dirc==NULL){error_redirct("manage/node/index","操作失败");} 73 | if($this->input->post()){ 74 | $verfiy = $this->input->post("verfiy"); 75 | if($verfiy){ 76 | $where_dirc = "dirc = '{$dirc}'"; 77 | $where_cont = $cont==NULL?"":" AND cont = '{$cont}'"; 78 | $where_func = $func==NULL?"":" AND func = '{$func}'"; 79 | $query = $this->db->query("SELECT GROUP_CONCAT(id) as node_id FROM rbac_node WHERE {$where_dirc} {$where_cont} {$where_func}"); 80 | $node_list = $query->row_array(); 81 | $sql = "UPDATE rbac_menu SET node_id = NULL WHERE node_id in (".$node_list['node_id'].")"; 82 | $this->db->query($sql); 83 | $sql = "DELETE FROM rbac_node WHERE {$where_dirc} {$where_cont} {$where_func} "; 84 | $this->db->query($sql); 85 | success_redirct("manage/node/index","删除成功"); 86 | }else{ 87 | error_redirct("manage/node/index","操作失败"); 88 | } 89 | 90 | } 91 | $this->load->view('manage/node/delete',array('dirc'=>$dirc,'cont'=>$cont,'func'=>$func)); 92 | } 93 | /** 94 | * 修改节点 95 | * @param unknown $id 96 | */ 97 | public function edit($id){ 98 | $query = $this->db->query("SELECT * FROM rbac_node WHERE id = ".$id); 99 | $data = $query->row_array(); 100 | if($data){ 101 | if($this->input->post()){ 102 | $memo = $this->input->post("memo"); 103 | $status = $this->input->post("status")==1?1:0; 104 | if($memo){ 105 | $sql = "UPDATE rbac_node set `memo`='{$memo}',`status` = '{$status}' WHERE id = {$id}"; 106 | $this->db->query($sql); 107 | success_redirct("manage/node/index","节点修改成功"); 108 | }else{ 109 | error_redirct('',"信息填写不全!"); 110 | } 111 | } 112 | $this->load->view("manage/node/edit",array('data'=>$data)); 113 | }else{ 114 | error_redirct("manage/node/index","未找到此节点"); 115 | } 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /application/third_party/rbac/helpers/rbac_helper.php: -------------------------------------------------------------------------------- 1 | config->load('memcached',TRUE); 20 | if($ci_obj->config->item('flag','memcached')===FALSE) return FALSE; 21 | $ci_obj->load->library('memcached'); 22 | static $static_memc; 23 | if($static_memc)return $static_memc; 24 | $memc = new memcached($ci_obj->config->item('config','memcached')); 25 | $static_memc = $memc; 26 | return $static_memc; 27 | } 28 | } 29 | 30 | //获取&设置RBAC数据[基于SESSION|MEMCACHED] 31 | if(!function_exists('rbac_conf')){ 32 | function rbac_conf($arr_key,$value=NULL){ 33 | $ci_obj = &get_instance(); 34 | //获取 35 | if(mem_inst()){ 36 | if(!$config = mem_inst()->get(mem_id())){ 37 | $config = $_SESSION[$ci_obj->config->item('rbac_auth_key')]; 38 | } 39 | }else{ 40 | $config = @$_SESSION[$ci_obj->config->item('rbac_auth_key')]; 41 | } 42 | $conf[-1] = &$config; 43 | foreach($arr_key as $k=>$ar){ 44 | $conf[$k] = &$conf[$k-1][$ar]; 45 | } 46 | if($value !==NULL){ 47 | $conf[count($arr_key)-1] = $value; 48 | } 49 | //设置 50 | if(mem_inst()){ 51 | if(!mem_inst()->set(mem_id(),$config)){ 52 | $_SESSION[$ci_obj->config->item('rbac_auth_key')] = $config; 53 | } 54 | }else{ 55 | $_SESSION[$ci_obj->config->item('rbac_auth_key')] = $config; 56 | } 57 | return isset($conf[count($arr_key)-1])?$conf[count($arr_key)-1]:FALSE; 58 | } 59 | } 60 | //用户退出 61 | if(!function_exists('rbac_logout')){ 62 | function rbac_logout($arr_key,$value=NULL){ 63 | if(mem_inst()){ 64 | mem_inst()->delete(mem_id()); 65 | } 66 | session_destroy(); 67 | } 68 | } 69 | 70 | //错误跳转 71 | if(!function_exists("error_redirct")){ 72 | function error_redirct($url="",$contents="操作失败",$time = 3){ 73 | 74 | $ci_obj = &get_instance(); 75 | if($url!=""){ 76 | $url = base_url("index.php/".$url); 77 | }else{ 78 | $url = isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:site_url(); 79 | } 80 | $data['url'] = $url; 81 | $data['time'] = $time; 82 | $data['type'] = "error"; 83 | $data['contents'] = $contents; 84 | $ci_obj->load->view("redirect",$data); 85 | $ci_obj->output->_display($ci_obj->output->get_output()); 86 | die(); 87 | } 88 | } 89 | 90 | //正确跳转 91 | if(!function_exists("success_redirct")){ 92 | function success_redirct($url,$contents="操作成功",$time = 3){ 93 | $ci_obj = &get_instance(); 94 | if($url!=""){ 95 | $url = base_url("index.php/".$url); 96 | }else{ 97 | $url = isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:site_url(); 98 | } 99 | $data['url'] = $url; 100 | $data['time'] = $time; 101 | $data['type'] = "success"; 102 | $data['contents'] = $contents; 103 | $ci_obj->load->view("redirect",$data); 104 | $ci_obj->output->_display($ci_obj->output->get_output()); 105 | die(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /application/third_party/rbac/hooks/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |Directory access is forbidden.
8 | 9 | 10 | -------------------------------------------------------------------------------- /application/third_party/rbac/models/rbac_model.php: -------------------------------------------------------------------------------- 1 | load->database(); 13 | } 14 | 15 | /* 16 | * 获取权限列表 17 | */ 18 | public function get_acl($role_id){ 19 | $query = $this->db->query("SELECT id,dirc,cont,func FROM `rbac_node` WHERE id in (SELECT node_id FROM `rbac_auth` WHERE role_id = ".$role_id.")"); 20 | $role_data = $query->result(); 21 | foreach($role_data as $vo){ 22 | $Tmp_role[$vo->dirc][$vo->cont][$vo->func] = TRUE; 23 | } 24 | rbac_conf(array('ACL'),$Tmp_role); 25 | } 26 | 27 | /* 28 | * 用户登录检测 29 | */ 30 | public function check_user($username,$password){ 31 | $query = $this->db->query("SELECT id,password,nickname,email,role_id,status FROM `rbac_user` WHERE username = '".$username."' LIMIT 1"); 32 | $data = $query->row_array(); 33 | if($data){ 34 | if($data['status']==1){ 35 | if($data['password']==$password){ 36 | rbac_conf(array('INFO','id'),$data['id']); 37 | rbac_conf(array('INFO','role_id'),$data['role_id']); 38 | rbac_conf(array('INFO','email'),$data['email']); 39 | rbac_conf(array('INFO','nickname'),$data['nickname']); 40 | $this->get_acl($data['role_id']); 41 | return TRUE; 42 | } 43 | else{ 44 | return "用户密码错误!"; 45 | } 46 | }else{ 47 | return "该用户已禁用!"; 48 | } 49 | }else{ 50 | return "该用户不存!"; 51 | } 52 | } 53 | 54 | /* 55 | * 用户登录检测 By id 56 | */ 57 | public function check_user_by_id($id){ 58 | $query = $this->db->query("SELECT id,password,nickname,email,role_id,status FROM `rbac_user` WHERE id = '".$id."' LIMIT 1"); 59 | $data = $query->row_array(); 60 | if($data){ 61 | if($data['status']==1){ 62 | rbac_conf(array('INFO','id'),$data['id']); 63 | rbac_conf(array('INFO','role_id'),$data['role_id']); 64 | rbac_conf(array('INFO','email'),$data['email']); 65 | rbac_conf(array('INFO','nickname'),$data['nickname']); 66 | $this->get_acl($data['role_id']); 67 | return TRUE; 68 | }else{ 69 | return "该用户已禁用!"; 70 | } 71 | }else{ 72 | return "该用户不存!"; 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /application/third_party/rbac/views/foot.php: -------------------------------------------------------------------------------- 1 |