├── README.md ├── index.php ├── public ├── admin │ ├── images │ │ ├── y.jpg │ │ ├── 11.jpg │ │ ├── bg.jpg │ │ ├── passcode.jpg │ │ └── tmbg-white.png │ ├── css │ │ └── admin.css │ └── js │ │ └── pintuer.js └── index │ ├── images │ ├── bg.jpg │ ├── tou.png │ ├── album.png │ ├── arrows.png │ ├── author.png │ ├── avator.jpg │ ├── google.png │ ├── print.png │ ├── ribbon.png │ ├── skype.png │ ├── vimeo.png │ ├── blog │ │ ├── 01.jpg │ │ ├── 02.jpg │ │ └── 03.jpg │ ├── comment.png │ ├── facebook.png │ ├── loading.gif │ ├── passcode.jpg │ ├── podcast.png │ ├── twitter.png │ ├── twitter2.png │ ├── youtube.png │ ├── chart-pie.png │ ├── closelabel.gif │ ├── nextlabel.gif │ ├── prevlabel.gif │ ├── slider │ │ ├── 01.jpg │ │ ├── 02.jpg │ │ ├── 03.jpg │ │ └── 04.jpg │ ├── tmbg-white.png │ ├── portfolio │ │ ├── 01.jpg │ │ ├── 02.jpg │ │ ├── 03.jpg │ │ ├── 04.jpg │ │ ├── 05.jpg │ │ ├── 06.jpg │ │ ├── 07.jpg │ │ └── 08.jpg │ ├── slider_nav_bg.png │ ├── carousel_next_bg.png │ ├── templatemo_list.png │ ├── templatemo_logo.png │ ├── templatemo_more.png │ ├── slider_nav_button.png │ ├── templatemo_bottom.png │ ├── templatemo_bullet.png │ ├── templatemo_button.png │ ├── templatemo_footer.jpg │ ├── templatemo_footer.png │ ├── templatemo_header.png │ ├── templatemo_main_b.png │ ├── templatemo_main_t.png │ ├── templatemo_search.png │ ├── carousel_previous_bg.png │ ├── templatemo_body_home.jpg │ ├── templatemo_copyright.jpg │ ├── templatemo_image_01.jpg │ ├── templatemo_image_02.jpg │ ├── templatemo_image_02.png │ ├── templatemo_image_03.jpg │ ├── templatemo_image_03.png │ ├── templatemo_image_04.jpg │ ├── templatemo_image_04.png │ ├── templatemo_image_05.jpg │ ├── templatemo_image_05.png │ ├── templatemo_image_06.jpg │ ├── templatemo_image_06.png │ ├── templatemo_image_07.jpg │ ├── templatemo_image_07.png │ ├── templatemo_image_08.jpg │ ├── templatemo_image_09.jpg │ ├── templatemo_image_10.jpg │ ├── templatemo_image_11.jpg │ ├── templatemo_image_12.jpg │ ├── templatemo_image_13.jpg │ ├── templatemo_image_14.jpg │ ├── templatemo_image_15.jpg │ ├── templatemo_image_16.jpg │ ├── templatemo_image_17.jpg │ ├── templatemo_menu_hover.png │ ├── templatemo_sidebar_sc.png │ ├── templatemo_submenu_b.png │ ├── templatemo_submenu_m.png │ ├── templatemo_submenu_t.png │ ├── templatemo_twitter_bg.png │ ├── templatemo_body_subpage.jpg │ ├── templatemo_slider_frame.png │ ├── templatemo_testimonial.png │ ├── templatemo_image_frame_12.png │ ├── templatemo_image_frame_13.png │ ├── templatemo_image_frame_14.png │ ├── templatemo_image_frame_23.png │ ├── templatemo_menu_item_hover.png │ ├── templatemo_paggin_button.png │ ├── templatemo_sidebar_title.png │ ├── templatemo_slider_button.png │ └── templatemo_slider_imageframe.png │ ├── js │ ├── logging.js │ ├── jquery.timers-1.2.js │ ├── slimbox2.js │ ├── jquery.dualSlider.0.3.min.js │ ├── ddsmoothmenu.js │ ├── jquery.dualSlider.0.3.js │ ├── jquery.easing.1.3.js │ ├── jquery.nivo.slider.pack.js │ ├── pintuer.js │ └── jquery.nivo.slider.js │ ├── css │ ├── orman.css │ ├── slimbox2.css │ ├── nivo-slider.css │ ├── ddsmoothmenu.css │ ├── jquery.dualSlider.0.2.css │ └── admin.css │ └── templatemo_style.css ├── config ├── database.php └── namespace.php ├── app ├── index │ ├── controller │ │ ├── IndexController.php │ │ └── BaseController.php │ └── view │ │ └── index │ │ └── index.html └── admin │ └── controller │ └── IndexController.php ├── boot ├── Router.php └── Psr4Autoload.php └── vendor └── cz └── framework └── src ├── VerifyCode.php ├── Page.php ├── Template.php ├── Upload.php ├── Image.php └── Model.php /README.md: -------------------------------------------------------------------------------- 1 | # easy_mvc 2 | 封装简单的MVC框架,含各种封装类 3 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 'localhost', 4 | 'DB_USER' => 'root', 5 | 'DB_PWD' => '6636', 6 | 'DB_NAME' => 'cz_blogs', 7 | 'DB_CHARSET' => 'utf8', 8 | 'DB_PREFIX' => 'blogs_', 9 | 'DB_CACHE' => './cache' 10 | 11 | ]; 12 | 13 | 14 | -------------------------------------------------------------------------------- /config/namespace.php: -------------------------------------------------------------------------------- 1 | 'app/index/controller', 4 | 'index\\model' =>'app/index/model', 5 | 'index\\view' =>'app/index/view', 6 | 'admin\\controller' => 'app/admin/controller', 7 | 'admin\\model' =>'app/admin/model', 8 | 'admin\\view' =>'app/admin/view', 9 | 'cz\\framework' =>'vendor/cz/framework/src' 10 | ]; 11 | -------------------------------------------------------------------------------- /app/index/controller/IndexController.php: -------------------------------------------------------------------------------- 1 | user = new UserModel(); 18 | 19 | } 20 | 21 | public function index() 22 | { 23 | 24 | //加载首页 25 | $this->display(); 26 | } 27 | 28 | 29 | 30 | 31 | } -------------------------------------------------------------------------------- /app/admin/controller/IndexController.php: -------------------------------------------------------------------------------- 1 | user = new UserModel(); 14 | 15 | } 16 | 17 | //加载后台首页 18 | public function index() 19 | { 20 | if(empty($_SESSION['admin'])) 21 | { 22 | $this->error('非管理员登录!!禁止访问!!!','index.php'); 23 | }else{ 24 | 25 | $this->display(); 26 | } 27 | 28 | } 29 | 30 | 31 | } -------------------------------------------------------------------------------- /boot/Router.php: -------------------------------------------------------------------------------- 1 | maps=$config; 10 | } 11 | //向系统注册自己自动加载方法 12 | spl_autoload_register([$this,'loadClass']); 13 | } 14 | 15 | protected function loadClass($className) 16 | { 17 | //取出类名 18 | $arr = explode('\\', $className); 19 | $className = array_pop($arr); 20 | //取出命名空间 21 | $namespace = join('\\',$arr); 22 | //加载映射关系 23 | 24 | $this->loadMap($namespace,$className); 25 | 26 | } 27 | /** 28 | * 把命名空间变成目录,加载类文件 29 | * @param [type] $namespace [命名空间] 30 | * @param [type] $realClass [类名] 31 | * @return [type] [无] 32 | */ 33 | protected function loadMap($namespace,$className) 34 | { 35 | //如果命名空间存在在映射表中,直接取得目录 36 | if(array_key_exists($namespace, $this->maps)) 37 | { 38 | $path = $this->maps[$namespace]; 39 | }else{//如果不存在,直接把命名空间当做目录名 40 | $path = str_replace('\\','/',$namespace); 41 | } 42 | $path = rtrim($path,'/').'/'; 43 | $path.=$className.'.php'; 44 | if(file_exists($path)){ 45 | include $path; 46 | }else{ 47 | exit($path.'文件不存在!'); 48 | } 49 | 50 | } 51 | 52 | public function addNamespace($namespace,$className) 53 | { 54 | $namespace = trim(str_replace('/','\\',$namespace),'\\'); 55 | $className = trim(str_replace('\\','/',$className),'/'); 56 | if (array_key_exists($namespace, $this->maps)) { 57 | exit("命名空间已经存在映射表中"); 58 | } 59 | $this->maps[$namespace] = $realPath; 60 | 61 | } 62 | 63 | 64 | } -------------------------------------------------------------------------------- /public/index/css/orman.css: -------------------------------------------------------------------------------- 1 | /* 2 | Skin Name: Orman Theme 3 | Skin URI: http://nivo.dev7studios.com 4 | Skin Type: fixed 5 | Description: A light and green skin for the Nivo Slider. 6 | Version: 1.0 7 | Author: Gilbert Pellegrom & Orman Clark 8 | Author URI: # 9 | */ 10 | 11 | .theme-orman.slider-wrapper { 12 | width: 960px; 13 | height: 320px; 14 | position:relative; 15 | } 16 | 17 | .theme-orman .nivoSlider { 18 | position:relative; 19 | width:960px; 20 | height:320px; 21 | background:url(../images/loading.gif) no-repeat 50% 50%; 22 | } 23 | .theme-orman .nivoSlider img { 24 | position:absolute; 25 | top:0px; 26 | left:0px; 27 | display:none; 28 | width:960px; /* Make sure your images are the same size */ 29 | height:320px; /* Make sure your images are the same size */ 30 | } 31 | .theme-orman .nivoSlider a { 32 | border:0; 33 | display:block; 34 | } 35 | 36 | .theme-orman .nivo-directionNav a { 37 | display:block; 38 | width: 64px; 39 | height: 64px; 40 | background:url(../images/arrows.png) no-repeat 0% 50%; 41 | text-indent:-9999px; 42 | border:0; 43 | top:130px; 44 | z-index: 500; 45 | } 46 | .theme-orman a.nivo-nextNav { 47 | background-position:100% 50%; 48 | right:-32px; 49 | } 50 | .theme-orman a.nivo-prevNav { 51 | left:-32px; 52 | } 53 | 54 | .theme-orman .nivo-caption { 55 | font-family: Helvetica, Arial, sans-serif; 56 | } 57 | .theme-orman .nivo-caption a { 58 | color:#fff; 59 | border-bottom:1px dotted #fff; 60 | } 61 | .theme-orman .nivo-caption a:hover { 62 | color:#fff; 63 | } 64 | -------------------------------------------------------------------------------- /app/index/controller/BaseController.php: -------------------------------------------------------------------------------- 1 | _init(); 13 | } 14 | 15 | public function _init() 16 | { 17 | 18 | } 19 | //通过url的参数加载html文件 20 | public function display($viewFile=null,$isExtract=true) 21 | { 22 | if(empty($viewFile)){ 23 | $viewFile = $_GET['c'].'/'.$_GET['a'].'.html'; 24 | } 25 | parent::display($viewFile,$isExtract); 26 | } 27 | 28 | /** 29 | * [notice 信息提示] 30 | * @param [type] $msg [消息] 31 | * @param integer $code [成功是1,失败是0] 32 | * @param [type] $url [跳转地址] 33 | * @param integer $wait [等候秒数] 34 | * @return [type] [无] 35 | */ 36 | public function notice($msg,$code=1,$url=null,$wait=3) 37 | { 38 | if (empty($url)) { 39 | $url = $_SERVER['HTTP_REFERER']; 40 | } 41 | 42 | include "app/index/view/notice.html"; 43 | } 44 | 45 | /** 46 | * [success 成功时通知] 47 | * @param [type] $msg [消息] 48 | * @param [type] $url [跳转地址] 49 | * @param integer $wait [等候秒数] 50 | * @return [type] [无] 51 | */ 52 | public function success($msg,$url=null,$wait=3) 53 | { 54 | $this->notice($msg,1,$url,$wait); 55 | } 56 | 57 | /** 58 | * [error 失败时通知] 59 | * @param [type] $msg [消息] 60 | * @param [type] $url [跳转地址] 61 | * @param integer $wait [等候秒数] 62 | * @return [type] [无] 63 | */ 64 | public function error($msg,$url=null,$wait=3) 65 | { 66 | $this->notice($msg,0,$url,$wait); 67 | } 68 | 69 | 70 | 71 | } -------------------------------------------------------------------------------- /public/index/css/slimbox2.css: -------------------------------------------------------------------------------- 1 | /* SLIMBOX */ 2 | 3 | #lbOverlay { 4 | position: fixed; 5 | z-index: 9999; 6 | left: 0; 7 | top: 0; 8 | width: 100%; 9 | height: 100%; 10 | background-color: #000; 11 | cursor: pointer; 12 | } 13 | 14 | #lbCenter, #lbBottomContainer { 15 | position: absolute; 16 | z-index: 9999; 17 | overflow: hidden; 18 | background-color: #fff; 19 | } 20 | 21 | .lbLoading { 22 | background: #fff url(../images/loading.gif) no-repeat center; 23 | } 24 | 25 | #lbImage { 26 | position: absolute; 27 | left: 0; 28 | top: 0; 29 | border: 10px solid #fff; 30 | background-repeat: no-repeat; 31 | } 32 | 33 | #lbPrevLink, #lbNextLink { 34 | display: block; 35 | position: absolute; 36 | top: 0; 37 | width: 50%; 38 | outline: none; 39 | } 40 | 41 | #lbPrevLink { 42 | left: 0; 43 | } 44 | 45 | #lbPrevLink:hover { 46 | background: transparent url(../images/prevlabel.gif) no-repeat 0 15%; 47 | } 48 | 49 | #lbNextLink { 50 | right: 0; 51 | } 52 | 53 | #lbNextLink:hover { 54 | background: transparent url(../images/nextlabel.gif) no-repeat 100% 15%; 55 | } 56 | 57 | #lbBottom { 58 | font-family: Verdana, Arial, Geneva, Helvetica, sans-serif; 59 | font-size: 10px; 60 | color: #666; 61 | line-height: 1.4em; 62 | text-align: left; 63 | border: 10px solid #fff; 64 | border-top-style: none; 65 | } 66 | 67 | #lbCloseLink { 68 | display: block; 69 | float: right; 70 | width: 66px; 71 | height: 22px; 72 | background: transparent url(../images/closelabel.gif) no-repeat center; 73 | margin: 5px 0; 74 | outline: none; 75 | } 76 | 77 | #lbCaption, #lbNumber { 78 | margin-right: 71px; 79 | } 80 | 81 | #lbCaption { 82 | font-weight: bold; 83 | } -------------------------------------------------------------------------------- /public/index/css/nivo-slider.css: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Nivo Slider v2.6 3 | * http://nivo.dev7studios.com 4 | * 5 | * Copyright 2011, Gilbert Pellegrom 6 | * Free to use and abuse under the MIT license. 7 | * http://www.opensource.org/licenses/mit-license.php 8 | * 9 | * March 2010 10 | */ 11 | 12 | 13 | /* The Nivo Slider styles */ 14 | 15 | .nivoSlider { 16 | position:relative; 17 | } 18 | .nivoSlider img { 19 | position:absolute; 20 | top:0px; 21 | left:0px; 22 | } 23 | /* If an image is wrapped in a link */ 24 | .nivoSlider a.nivo-imageLink { 25 | position:absolute; 26 | top:0px; 27 | left:0px; 28 | width:100%; 29 | height:100%; 30 | border:0; 31 | padding:0; 32 | margin:0; 33 | z-index:6; 34 | display:none; 35 | } 36 | /* The slices and boxes in the Slider */ 37 | .nivo-slice { 38 | display:block; 39 | position:absolute; 40 | z-index:5; 41 | height:100%; 42 | } 43 | .nivo-box { 44 | display:block; 45 | position:absolute; 46 | z-index:5; 47 | } 48 | /* Caption styles */ 49 | .nivo-caption { 50 | position:absolute; 51 | left:0px; 52 | bottom: 0px; 53 | background:#000; 54 | color:#fff; 55 | opacity:0.8; /* Overridden by captionOpacity setting */ 56 | width:100%; 57 | z-index:8; 58 | text-align: center; 59 | } 60 | .nivo-caption p { 61 | padding:5px 50px; 62 | margin:0; 63 | } 64 | .nivo-caption a { 65 | display:inline !important; 66 | } 67 | .nivo-html-caption { 68 | display:none; 69 | } 70 | /* Direction nav styles (e.g. Next & Prev) */ 71 | .nivo-directionNav a { 72 | position:absolute; 73 | top:45%; 74 | z-index:9; 75 | cursor:pointer; 76 | } 77 | .nivo-prevNav { 78 | left:0px; 79 | } 80 | .nivo-nextNav { 81 | right:0px; 82 | } 83 | /* Control nav styles (e.g. 1,2,3...) */ 84 | .nivo-controlNav a { 85 | position:relative; 86 | z-index:9; 87 | cursor:pointer; 88 | } 89 | .nivo-controlNav a.active { 90 | font-weight:bold; 91 | } -------------------------------------------------------------------------------- /public/index/css/ddsmoothmenu.css: -------------------------------------------------------------------------------- 1 | 2 | .ddsmoothmenu ul{ 3 | z-index:100; 4 | margin: 0; 5 | padding: 0; 6 | list-style-type: none; 7 | } 8 | 9 | /*Top level list items*/ 10 | .ddsmoothmenu ul li{ 11 | position: relative; 12 | display: inline; 13 | float: left; 14 | } 15 | 16 | /*Top level menu link items style*/ 17 | .ddsmoothmenu ul li a { 18 | display: block; 19 | height: 30px; 20 | width: 77px; 21 | margin-right: 5px; 22 | line-height: 29px; 23 | font-size: 13px; 24 | color: #333; 25 | text-align: center; 26 | text-decoration: none; 27 | font-weight: 400; 28 | outline: none; 29 | 30 | } 31 | 32 | * html .ddsmoothmenu ul li a{ /*IE6 hack to get sub menu links to behave correctly*/ 33 | display: inline-block; 34 | } 35 | 36 | .ddsmoothmenu ul li a.selected, .ddsmoothmenu ul li a:hover { /*CSS class that's dynamically added to the currently active menu items' LI A element*/ 37 | color: #fff; 38 | background: url(../images/templatemo_menu_hover.png) 39 | } 40 | 41 | /*1st sub level menu*/ 42 | .ddsmoothmenu ul li ul { 43 | position: absolute; 44 | width: 184px; 45 | margin: 0 0 0 3px; 46 | display: none; /*collapse all sub menus to begin with*/ 47 | visibility: hidden; 48 | background: #cfccc9; 49 | } 50 | 51 | /*Sub level menu list items (undo style from Top level List Items)*/ 52 | .ddsmoothmenu ul li ul li{ 53 | display: list-item; 54 | float: none; 55 | } 56 | 57 | /*All subsequent sub menu levels vertical offset after 1st level sub menu */ 58 | .ddsmoothmenu ul li ul li ul{ 59 | top: 0; 60 | } 61 | 62 | /* Sub level menu links style */ 63 | .ddsmoothmenu ul li ul li a{ 64 | font-weight: 500; 65 | width: 140px; /*width of sub menus*/ 66 | margin: 0 3px 0 1px; 67 | height: 28px; 68 | line-height: 28px; 69 | padding: 5px 20px; 70 | font-size: 11px; 71 | text-align: left; 72 | background: none; 73 | color: #666; 74 | border-bottom: 1px solid #bab5b0; 75 | z-index: 10000 76 | } 77 | 78 | .ddsmoothmenu ul li ul li .last { 79 | border-bottom: none; 80 | } 81 | 82 | .ddsmoothmenu ul li ul li a.selected, .ddsmoothmenu ul li ul li a:hover { 83 | color: #fff; 84 | width: 139px; 85 | padding-left: 21px; 86 | background: #bab5b0; 87 | } 88 | 89 | /* Holly Hack for IE \*/ 90 | * html .ddsmoothmenu{height: 1%;} /*Holly Hack for IE7 and below*/ -------------------------------------------------------------------------------- /public/index/css/jquery.dualSlider.0.2.css: -------------------------------------------------------------------------------- 1 | /* CAROUSEL */ 2 | 3 | #carousel{ 4 | float: left; 5 | position:relative; 6 | width: 400px; 7 | height: 240px; 8 | } 9 | 10 | #slider-image-frame { 11 | display: block; 12 | width: 400px; 13 | height: 240px; 14 | overflow: hidden; 15 | position: relative; 16 | } 17 | 18 | #slider-image-frame span.slider_frame { 19 | position: absolute; 20 | display: block; 21 | z-index: 100; 22 | top: 0; 23 | left: 0; 24 | width: 400px; 25 | height: 240px; 26 | background: url(../images/templatemo_slider_imageframe.png) 27 | } 28 | 29 | #carousel .backgrounds{ 30 | display: block; 31 | width: 400px; 32 | height: 240px; 33 | overflow: hidden; 34 | background: none; 35 | } 36 | 37 | #carousel .backgrounds .item{ 38 | width: 400px; 39 | height: 240px; 40 | float:left; 41 | z-index:1; 42 | text-align: right; 43 | } 44 | 45 | #carousel .backgrounds .item_1{ 46 | } 47 | #carousel .backgrounds .item_2{ 48 | } 49 | 50 | #carousel .backgrounds .item_3{ 51 | } 52 | 53 | #carousel .panel{ 54 | color: #fff; 55 | position:absolute; 56 | right: -400px; 57 | top:0; 58 | height: 240px; 59 | width: 360px; 60 | z-index:10; 61 | } 62 | 63 | #carousel .next{ 64 | position:absolute; 65 | right: -480px; 66 | top: 95px; 67 | display:block; 68 | width: 33px; 69 | height: 45px; 70 | background: transparent url(../images/carousel_next_bg.png) no-repeat 0 0; 71 | text-indent: -6000px; 72 | } 73 | 74 | #carousel .previous{ 75 | position:absolute; 76 | left: -80px; 77 | top: 95px; 78 | display:block; 79 | width: 33px; 80 | height: 45px; 81 | z-index: 10000; 82 | background: transparent url(../images/carousel_previous_bg.png) no-repeat 0 0; 83 | text-indent: -6000px; 84 | } 85 | 86 | #carousel .panel .details_wrapper { 87 | position:absolute; 88 | top:0; 89 | left:0; 90 | width: 360px; 91 | overflow:hidden; 92 | height: 240px; 93 | } 94 | #carousel .panel .details_wrapper .details{ 95 | height: 240px; 96 | } 97 | #carousel .panel .details_wrapper .details .detail{ 98 | width: 360px; 99 | height: 200px; 100 | padding: 20px 0; 101 | float:left; 102 | 103 | } 104 | #carousel .panel .details_wrapper .details h2{ 105 | font-size: 30px; 106 | margin: 0 0 30px 0; 107 | color: #000; 108 | } 109 | #carousel .panel .details_wrapper .details p { 110 | font-size: 14px; 111 | line-height: 1.6em; 112 | color: #363013; 113 | } 114 | #carousel .panel .details_wrapper .details a.slider_more{ 115 | float: left; 116 | margin-top: 20px; 117 | display: block; 118 | width: 168px; 119 | height: 53px; 120 | line-height: 50px; 121 | text-align: center; 122 | color: #363013; 123 | background: url(../images/templatemo_slider_button.png); 124 | font-size:1.2em; 125 | font-weight: 700; 126 | text-decoration: none; 127 | } 128 | #carousel .panel .details_wrapper .details a.slider_more:hover { 129 | text-decoration: none; 130 | } 131 | /* END CAROUSEL */ 132 | -------------------------------------------------------------------------------- /vendor/cz/framework/src/VerifyCode.php: -------------------------------------------------------------------------------- 1 | width = $width <= 0?$this->width:$width; 17 | $this->height = $height <= 0?$this->height:$height; 18 | $this->length = ($length <3 || $length>6)?$this->length:$length; 19 | $this->imageType = $this->getImageType($imageType); 20 | 21 | } 22 | /** 23 | * 获取验证码上的内容 24 | * @return [type] [description] 25 | */ 26 | public function getCode() 27 | { 28 | return $this->code; 29 | } 30 | /** 31 | * 产生一个验证码 32 | */ 33 | public function outputCode() 34 | { 35 | // 1)、创建画布 36 | $this->createCanvas(); 37 | 38 | // 2)、生成验证码字符串 39 | $this->createString(); 40 | // 3)、将验证码字符串画到画布上 41 | $this->drawCode(); 42 | // 4)、画干扰元素 43 | $this->drawDisturb(); 44 | // 5)、发送验证码 45 | $this->sendCode(); 46 | // 6)、释放资源 47 | $this->destory(); 48 | } 49 | /** 50 | * 销毁画布 51 | * @return [type] [description] 52 | */ 53 | protected function destory() 54 | { 55 | imagedestroy($this->canvas); 56 | } 57 | /** 58 | * 画干扰项 59 | * @return [type] [description] 60 | */ 61 | protected function drawDisturb() 62 | { 63 | for ($i=0; $i <200 ; $i++) { 64 | $x= rand(1,$this->width-1); 65 | $y= rand(1,$this->height-1); 66 | imagesetpixel($this->canvas, $x, $y,$this->randColor(1,127)); 67 | } 68 | } 69 | /** 70 | * 画字符串 71 | * @return [type] [description] 72 | */ 73 | protected function drawCode() 74 | { 75 | for ($i=0; $i <$this->length ; $i++) { 76 | $x= 10+$i*(int)(($this->width-5)/$this->length); 77 | $y =rand(5,$this->height-20); 78 | //水平地画一个字符 79 | imagechar($this->canvas,5,$x,$y,$this->code[$i],$this->randColor(0,127)); 80 | } 81 | } 82 | /** 83 | * 随机生成指定长度的字符串 84 | * @return [type] [description] 85 | */ 86 | protected function createString() 87 | { 88 | $str = ''; 89 | for ($i=0; $i <$this->length ; $i++) { 90 | $str.=rand(0,9); 91 | } 92 | $this->code=$str; 93 | } 94 | /** 95 | * 在浏览器显示画布 96 | * @return [type] [description] 97 | */ 98 | protected function sendCode() 99 | { 100 | header("content-type:image/".$this->imageType); 101 | $funcName ='image'.$this->imageType; 102 | // var_dump($funcName,$this);exit; 103 | if(function_exists($funcName)){ 104 | $funcName($this->canvas); 105 | }else{ 106 | exit('不支持该图片类型!'); 107 | } 108 | } 109 | /** 110 | * 创建画布 111 | * @return [type] [description] 112 | */ 113 | protected function createCanvas() 114 | { 115 | //创建画布 116 | $this->canvas = imagecreatetruecolor($this->width, $this->height); 117 | $color = $this->randColor(127,254); 118 | //区域填充 119 | imagefill($this->canvas,0,0,$color); 120 | 121 | } 122 | /** 123 | * 产生一个随机颜色 124 | * @param [type] $low [颜色上界] 125 | * @param [type] $high [颜色下界] 126 | * @return [type] [description] 127 | */ 128 | protected function randColor($low,$high) 129 | { 130 | //为一幅图像分配颜色 131 | return imagecolorallocate($this->canvas,rand($low,$high), rand($low,$high), rand($low,$high)); 132 | 133 | } 134 | /** 135 | * 获取图片颜色 136 | * @param [type] $imageType [description] 137 | * @return [type] [description] 138 | */ 139 | protected function getImageType($imageType) 140 | { 141 | $arr = [ 142 | 'jpg' => 'jpeg', 143 | 'pjpeg' => 'jpeg', 144 | 'bmp' => 'wbmp' 145 | ]; 146 | if(array_key_exists($imageType,$arr)){ 147 | $imageType = $arr[$imageType]; 148 | } 149 | return $imageType; 150 | } 151 | } -------------------------------------------------------------------------------- /public/index/js/jquery.timers-1.2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery.timers - Timer abstractions for jQuery 3 | * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com) 4 | * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/). 5 | * Date: 2009/10/16 6 | * 7 | * @author Blair Mitchelmore 8 | * @version 1.2 9 | * 10 | **/ 11 | 12 | jQuery.fn.extend({ 13 | everyTime: function(interval, label, fn, times) { 14 | return this.each(function() { 15 | jQuery.timer.add(this, interval, label, fn, times); 16 | }); 17 | }, 18 | oneTime: function(interval, label, fn) { 19 | return this.each(function() { 20 | jQuery.timer.add(this, interval, label, fn, 1); 21 | }); 22 | }, 23 | stopTime: function(label, fn) { 24 | return this.each(function() { 25 | jQuery.timer.remove(this, label, fn); 26 | }); 27 | } 28 | }); 29 | 30 | jQuery.extend({ 31 | timer: { 32 | global: [], 33 | guid: 1, 34 | dataKey: "jQuery.timer", 35 | regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/, 36 | powers: { 37 | // Yeah this is major overkill... 38 | 'ms': 1, 39 | 'cs': 10, 40 | 'ds': 100, 41 | 's': 1000, 42 | 'das': 10000, 43 | 'hs': 100000, 44 | 'ks': 1000000 45 | }, 46 | timeParse: function(value) { 47 | if (value == undefined || value == null) 48 | return null; 49 | var result = this.regex.exec(jQuery.trim(value.toString())); 50 | if (result[2]) { 51 | var num = parseFloat(result[1]); 52 | var mult = this.powers[result[2]] || 1; 53 | return num * mult; 54 | } else { 55 | return value; 56 | } 57 | }, 58 | add: function(element, interval, label, fn, times) { 59 | var counter = 0; 60 | 61 | if (jQuery.isFunction(label)) { 62 | if (!times) 63 | times = fn; 64 | fn = label; 65 | label = interval; 66 | } 67 | 68 | interval = jQuery.timer.timeParse(interval); 69 | 70 | if (typeof interval != 'number' || isNaN(interval) || interval < 0) 71 | return; 72 | 73 | if (typeof times != 'number' || isNaN(times) || times < 0) 74 | times = 0; 75 | 76 | times = times || 0; 77 | 78 | var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {}); 79 | 80 | if (!timers[label]) 81 | timers[label] = {}; 82 | 83 | fn.timerID = fn.timerID || this.guid++; 84 | 85 | var handler = function() { 86 | if ((++counter > times && times !== 0) || fn.call(element, counter) === false) 87 | jQuery.timer.remove(element, label, fn); 88 | }; 89 | 90 | handler.timerID = fn.timerID; 91 | 92 | if (!timers[label][fn.timerID]) 93 | timers[label][fn.timerID] = window.setInterval(handler,interval); 94 | 95 | this.global.push( element ); 96 | 97 | }, 98 | remove: function(element, label, fn) { 99 | var timers = jQuery.data(element, this.dataKey), ret; 100 | 101 | if ( timers ) { 102 | 103 | if (!label) { 104 | for ( label in timers ) 105 | this.remove(element, label, fn); 106 | } else if ( timers[label] ) { 107 | if ( fn ) { 108 | if ( fn.timerID ) { 109 | window.clearInterval(timers[label][fn.timerID]); 110 | delete timers[label][fn.timerID]; 111 | } 112 | } else { 113 | for ( var fn in timers[label] ) { 114 | window.clearInterval(timers[label][fn]); 115 | delete timers[label][fn]; 116 | } 117 | } 118 | 119 | for ( ret in timers[label] ) break; 120 | if ( !ret ) { 121 | ret = null; 122 | delete timers[label]; 123 | } 124 | } 125 | 126 | for ( ret in timers ) break; 127 | if ( !ret ) 128 | jQuery.removeData(element, this.dataKey); 129 | } 130 | } 131 | } 132 | }); 133 | 134 | jQuery(window).bind("unload", function() { 135 | jQuery.each(jQuery.timer.global, function(index, item) { 136 | jQuery.timer.remove(item); 137 | }); 138 | }); -------------------------------------------------------------------------------- /public/index/js/slimbox2.js: -------------------------------------------------------------------------------- 1 | /* 2 | Slimbox v2.03 - The ultimate lightweight Lightbox clone for jQuery 3 | (c) 2007-2009 Christophe Beyls 4 | MIT-style license. 5 | */ 6 | (function(w){var E=w(window),u,g,F=-1,o,x,D,v,y,L,s,n=!window.XMLHttpRequest,e=window.opera&&(document.compatMode=="CSS1Compat")&&(w.browser.version>=9.3),m=document.documentElement,l={},t=new Image(),J=new Image(),H,a,h,q,I,d,G,c,A,K;w(function(){w("body").append(w([H=w('
')[0],a=w('
')[0],G=w('
')[0]]).css("display","none"));h=w('
').appendTo(a).append(q=w('
').append([I=w('').click(B)[0],d=w('').click(f)[0]])[0])[0];c=w('
').appendTo(G).append([w('').add(H).click(C)[0],A=w('
')[0],K=w('
')[0],w('
')[0]])[0]});w.slimbox=function(O,N,M){u=w.extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeEasing:"swing",initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},M);if(typeof O=="string"){O=[[O,N]];N=0}y=E.scrollTop()+((e?m.clientHeight:E.height())/2);L=u.initialWidth;s=u.initialHeight;w(a).css({top:Math.max(0,y-(s/2)),width:L,height:s,marginLeft:-L/2}).show();v=n||(H.currentStyle&&(H.currentStyle.position!="fixed"));if(v){H.style.position="absolute"}w(H).css("opacity",u.overlayOpacity).fadeIn(u.overlayFadeDuration);z();k(1);g=O;u.loop=u.loop&&(g.length>1);return b(N)};w.fn.slimbox=function(M,P,O){P=P||function(Q){return[Q.href,Q.title]};O=O||function(){return true};var N=this;return N.unbind("click").click(function(){var S=this,U=0,T,Q=0,R;T=w.grep(N,function(W,V){return O.call(S,W,V)});for(R=T.length;Q=0)?C():(M(N,u.nextKeys)>=0)?f():(M(N,u.previousKeys)>=0)?B():false}function B(){return b(x)}function f(){return b(D)}function b(M){if(M>=0){F=M;o=g[F][0];x=(F||(u.loop?g.length:0))-1;D=((F+1)%g.length)||(u.loop?0:-1);r();a.className="lbLoading";l=new Image();l.onload=j;l.src=o}return false}function j(){a.className="";w(h).css({backgroundImage:"url("+o+")",visibility:"hidden",display:""});w(q).width(l.width);w([q,I,d]).height(l.height);w(A).html(g[F][1]||"");w(K).html((((g.length>1)&&u.counterText)||"").replace(/{x}/,F+1).replace(/{y}/,g.length));if(x>=0){t.src=g[x][0]}if(D>=0){J.src=g[D][0]}L=h.offsetWidth;s=h.offsetHeight;var M=Math.max(0,y-(s/2));if(a.offsetHeight!=s){w(a).animate({height:s,top:M},u.resizeDuration,u.resizeEasing)}if(a.offsetWidth!=L){w(a).animate({width:L,marginLeft:-L/2},u.resizeDuration,u.resizeEasing)}w(a).queue(function(){w(G).css({width:L,top:M+s,marginLeft:-L/2,visibility:"hidden",display:""});w(h).css({display:"none",visibility:"",opacity:""}).fadeIn(u.imageFadeDuration,i)})}function i(){if(x>=0){w(I).show()}if(D>=0){w(d).show()}w(c).css("marginTop",-c.offsetHeight).animate({marginTop:0},u.captionAnimationDuration);G.style.visibility=""}function r(){l.onload=null;l.src=t.src=J.src=o;w([a,h,c]).stop(true);w([I,d,h,G]).hide()}function C(){if(F>=0){r();F=x=D=-1;w(a).hide();w(H).stop().fadeOut(u.overlayFadeDuration,k)}return false}})(jQuery); 7 | 8 | // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED) 9 | if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) { 10 | jQuery(function($) { 11 | $("a[rel^='lightbox']").slimbox({/* Put custom options here */}, null, function(el) { 12 | return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel)); 13 | }); 14 | }); 15 | } -------------------------------------------------------------------------------- /vendor/cz/framework/src/Page.php: -------------------------------------------------------------------------------- 1 | total=$total<2?$this->total:$total; 22 | $this->perpage = $count<1?$this->perpage:$count; 23 | $this->totalPage = ceil($this->total/$this->perpage); 24 | $this->getPage();//获取当前页 25 | 26 | $this->url = $this->getUrl();//url不带page参数 27 | 28 | } 29 | 30 | /** 31 | * 返回第一页的url 32 | * @return [type] [description] 33 | */ 34 | public function first() 35 | { 36 | return $this->setUrl(1); 37 | } 38 | /** 39 | * 返回最后一页的url 40 | * @return [type] [description] 41 | */ 42 | public function last() 43 | { 44 | return $this->setUrl($this->totalPage); 45 | } 46 | /** 47 | * 返回上一页的url 48 | * @return function [description] 49 | */ 50 | public function pre() 51 | { 52 | if($this->curPage - 1 <= 1){ 53 | return $this->setUrl(1); 54 | } 55 | return $this->setUrl($this->curPage - 1); 56 | } 57 | 58 | /** 59 | * 返回下一页的url 60 | * @return function [description] 61 | */ 62 | public function next() 63 | { 64 | if($this->curPage + 1 >=$this->totalPage){ 65 | return $this->setUrl($this->totalPage); 66 | } 67 | return $this->setUrl($this->curPage + 1); 68 | } 69 | /** 70 | * 跳转指定页 71 | * @return [type] [description] 72 | */ 73 | public function jumpPage($page) 74 | { 75 | if ($page<1 || $page>$this->totalPage) { 76 | return $this->setUrl($this->curPage); 77 | } 78 | return $this->setUrl($page); 79 | } 80 | /** 81 | * 获取分页的偏移量 82 | * @return [type] [description] 83 | */ 84 | public function limit() 85 | { 86 | $offset = ($this->curPage-1)*$this->perpage; 87 | return ' '.$offset.','.$this->perpage; 88 | } 89 | /** 90 | * 返回所有页的url 91 | * @return [type] [description] 92 | */ 93 | public function allPage() 94 | { 95 | return [ 96 | 'first' => $this->first(), 97 | 'pre'=> $this->pre(), 98 | 'next' => $this->next(), 99 | 'last' => $this->last() 100 | ]; 101 | } 102 | /** 103 | * 拼接为带参数的url 104 | * @param [type] $page [description] 105 | */ 106 | /*protected function setUrl($page){ 107 | return $this->url.'?page='.$page; 108 | }*/ 109 | protected function setUrl($page) 110 | { 111 | //判断url中是否有? 112 | //http://localhost/1707/hight/5/Page.php?page=1 113 | if (stripos($this->url,'?')) { 114 | return $this->url . "&page=".$page; 115 | } else { 116 | return $this->url . "?page=".$page; 117 | } 118 | } 119 | /** 120 | * 获取不带参数的url 121 | * @return [type] [description] 122 | */ 123 | /*protected function getUrl() 124 | { 125 | $url = $_SERVER['REQUEST_SCHEME']; 126 | $url = $url.'://'.$_SERVER['SERVER_NAME']; 127 | $url.=$_SERVER['SCRIPT_NAME']; 128 | return $url; 129 | } */ 130 | 131 | protected function getUrl() 132 | { 133 | $url = $_SERVER['REQUEST_SCHEME'] .'://';//获取协议 134 | $url .= $_SERVER['HTTP_HOST']; //拼接主机地址 135 | $url .= ':' . $_SERVER['SERVER_PORT'];//拼接端口 136 | $data = parse_url($_SERVER['REQUEST_URI']); 137 | $url .= $data['path'];//拼接路径 138 | if (!empty($data['query'])) { 139 | parse_str($data['query'],$paras);//获取查询参数,然后放到$paras数组中 140 | unset($paras['page']);//销毁page元素 141 | $url .= '?' . http_build_query($paras); 142 | 143 | } 144 | $url = rtrim($url,'?');//干掉最后一个问号 145 | return $url; 146 | } 147 | 148 | /** 149 | * 获取当前页码 150 | * @return [type] [description] 151 | */ 152 | protected function getPage() 153 | { 154 | if(empty($_GET['page'])){ 155 | $this->curPage = 1; 156 | }else{ 157 | if ($_GET['page']<2) { 158 | $this->curPage = 1; 159 | }else if($_GET['page']>$this->totalPage){ 160 | $this->curPage = $this->totalPage; 161 | }else{ 162 | $this->curPage = $_GET['page']; 163 | } 164 | } 165 | 166 | } 167 | 168 | } -------------------------------------------------------------------------------- /public/index/js/jquery.dualSlider.0.3.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery.fn.dualSlider - Dual sliders, why not? 3 | * Date: June 2010 4 | * 5 | * @author Rob Phillips (Front End Developer - Hugo & Cat - http://www.hugoandcat.com) 6 | * @version 0.2 7 | * @web http://www.hugoandcat.com/DualSlider/index.html 8 | * 9 | * Requirements: 10 | * jquery.1.3.2.js - http://jquery.com/ 11 | * jquery.easing.1.3.js - http://gsgd.co.uk/sandbox/jquery/easing/ 12 | * jquery.timers-1.2.js - http://plugins.jquery.com/project/timers 13 | * 14 | * 0.2 - Tested and fixed for IE6+, auto loops, manual pause/play controls 15 | * - Disabled buttons until animation finishes - Thanks for the bug John. 16 | * 0.3 - Now with a seamless loop, instead of that nasty rewind...was 'too much' apparently 17 | * 18 | **/ 19 | 20 | (function($){$.fn.dualSlider=function(options){var defaults={auto:true,autoDelay:10000,easingCarousel:'swing',easingDetails:'easeOutBack',durationCarousel:1000,durationDetails:600};var options=$.extend(defaults,options);this.each(function(){var obj=$(this);var carousel;var carouselTotal=$(".backgrounds",obj).children().length;var carouselPosition=1;var carouselLinkIndex=1;var carouselLinks="";var carouselwidth=$(obj).width();var detailWidth=$(".panel .details_wrapper",obj).width();var locked=false;if(options.auto==true){$(".backgrounds",obj).prepend($(".backgrounds .item:last-child",obj).clone().css("margin-left","-"+carouselwidth+"px"));$(".backgrounds",obj).append($(".backgrounds .item:nth-child(2)",obj).clone());$(".details",obj).prepend($(".details .detail:last-child",obj).clone().css("margin-left","-"+detailWidth+"px"));$(".details",obj).append($(".details .detail:nth-child(2)",obj).clone())}else{$(".previous",obj).hide();$(".play, .pause",obj).hide()}$(".backgrounds",obj).css("width",((carouselTotal+1)*carouselwidth)+100+"px");$(".details_wrapper .details",obj).css("width",detailWidth*carouselwidth+"px");for(i=1;i<=carouselTotal;i++){(i==1)?carouselLinks+=""+carouselLinkIndex+"":carouselLinks+=""+carouselLinkIndex+"";carouselLinkIndex++}$("#numbers",obj).html(carouselLinks);$(".next",obj).click(function(){carouselPage(parseInt(carouselPosition+1),false);lock()});$(".previous",obj).click(function(){carouselPage(parseInt(carouselPosition-1),false);lock()});$("#numbers a",obj).click(function(){carouselPage($(this).attr("rel"),false);lock()});$(".pause",obj).click(function(){autoPause()});$(".play",obj).click(function(){autoPlay()});function lock(){locked=true}function unLock(){locked=false}function checkPreviousNext(){$("#numbers a",obj).removeClass("selected");$("#numbers .link"+carouselPosition,obj).addClass("selected");if(options.auto==false){(carouselPosition==carouselTotal)?$(".next",obj).hide():$(".next",obj).show();(carouselPosition<2)?$(".previous",obj).hide():$(".previous",obj).show()}}function adjust(){if(carouselPosition<1){$(".backgrounds",obj).css("margin-left",(-1*((carouselTotal-1)*carouselwidth)));$(".details",obj).css("margin-left",(-1*((carouselTotal-1)*detailWidth)));carouselPosition=carouselTotal}if(carouselPosition>carouselTotal){$(".backgrounds",obj).css("margin-left",0);$(".details",obj).css("margin-left",0);carouselPosition=1}}function carouselPage(x,y){if(locked!=true){carouselPosition=parseFloat(x);if(y==false)autoPause();var newPage=(x*carouselwidth)-carouselwidth;var newPageDetail=(x*detailWidth)-detailWidth;if(newPage!=0){newPage=newPage*-1;newPageDetail=newPageDetail*-1}$(".backgrounds",obj).animate({marginLeft:newPage},{"duration":options.durationCarousel,"easing":options.easingCarousel,complete:function(){$(".details",obj).animate({marginLeft:newPageDetail},{"duration":options.durationDetails,"easing":options.easingDetails});adjust();checkPreviousNext();unLock()}})}}function autoPause(){$(".pause",obj).hide();$(".play",obj).show();$("body").stopTime("autoScroll")}function autoPlay(){$(".pause",obj).show();$(".play",obj).hide();$("body").everyTime(options.autoDelay,"autoScroll",function(){carouselPage(carouselPosition+1,true);lock()})}if(options.auto==true){autoPlay()}})}})(jQuery); -------------------------------------------------------------------------------- /public/admin/css/admin.css: -------------------------------------------------------------------------------- 1 | body{ color:#333; font-size:13px;} 2 | input,select,textarea{color:#333;} 3 | .bg{ width:100%; height:100%; position:absolute; background:url(../images/bg.jpg) } 4 | .panel{background:#fff;} 5 | form .form-group:last-child{padding-bottom:0;} 6 | .passcode{position:absolute;right:0;bottom:0;height:32px;margin:1px;border-left:solid 1px #ddd;text-align:center;line-height:32px;border-radius:0 4px 4px 0;} 7 | ul,li{ list-style-type:none;} 8 | 9 | .lefter{position:relative;float:left;width:180px;margin-right:-180px;background:#e6f2fb;text-align:center;} 10 | .righter{float:right;width:100%;padding-top:15px;background:#e6f2fb;} 11 | .mainer{margin-left:180px;} 12 | .field-icon-right .icon{ bottom:0px; top:auto} 13 | .logo{ float:left; color:#FFF; margin-top:10px; line-height:45px;} 14 | .logo img{ float:left; margin-right:10px;} 15 | .loginbox { background:url(../images/tmbg-white.png); border:0px;} 16 | /********头部******/ 17 | .header{height:70px; overflow:hidden; background:url(../images/bg.jpg) no-repeat 0 -1000px; } 18 | .head-l{ float:left; margin-top:17px; margin-left:15px; } 19 | .head-l .button{ padding:8px 15px;} 20 | .head-l .bg-blue:hover{ background-color:#03b6fd;} 21 | .leftnav{width:180px; height:100%; position:fixed; top:70px; left:0px;} 22 | .leftnav-title { height:50px; background:url(../images/bg.jpg) no-repeat 0 -1000px; color:#FFF; padding-left:22px; font-size:14px; line-height:50px;} 23 | .leftnav-title span{ margin-right:10px;} 24 | .leftnav h2{ padding:10px 0 10px 22px; transition:all .1s ease-in-out; display:block; cursor:pointer; font-weight:bold; font-size:14px; border-top:1px solid #b5cfd9;} 25 | .leftnav h2.on{ color:#09c;} 26 | .leftnav .border-bottom{ border-bottom:1px solid #b5cfd9;} 27 | .leftnav h2 span{ margin-right:10px;} 28 | .leftnav h2:hover{ color:#09c;} 29 | .leftnav ul {display:none; border-top:1px solid #b5cfd9; padding:5px 0; opacity:1;} 30 | .leftnav ul li{ list-style-type:none; } 31 | .leftnav ul li a{ display:block;padding-left:30px;line-height:30px; } 32 | .leftnav ul li span{ margin-right:8px;} 33 | .leftnav ul li a:hover,.leftnav ul li a.on{ color:#09c;} 34 | 35 | /***主要内容***/ 36 | .admin{background:#fff;position:fixed;border-left:solid 1px #b5cfd9;right:0;bottom:0;top:110px;left:180px; padding:15px; padding-right:0px; padding-bottom:0px; overflow:auto; border-top:1px solid #b5cfd9; padding-right:15px;} 37 | .content{width:100%;} 38 | .body-content{padding:20px 0; overflow:hidden;} 39 | .content .title{ border-bottom:1px solid #dfdfdf; line-height:35px; font-size:14px; font-weight:bold; color:#09c} 40 | .form-x .form-group .label{ width:10%;} 41 | .form-x .form-button { margin-left:10%;} 42 | .w50 { width:25%; float:left;} 43 | .form-x .tipss{ float:left; padding-left:10px; color:#888; line-height:42px;} 44 | .input-help { float:left; line-height:30px;} 45 | .input-help li{ float:left;margin-left:10px;} 46 | .bread{ margin-left:190px; margin-top:4px;} 47 | .bread li{ float:left;} 48 | .label label{ font-weight:normal; color:#333;} 49 | .form-group{ margin-bottom:12px;} 50 | .button{ padding:10px 15px;} 51 | .form-group .field .file{ background:#FFF; border:0px;} 52 | .form-group .field input[type=radio]{ vertical-align:middle; line-height:35px; margin-right:5px;} 53 | .form-group .radio { line-height:35px;} 54 | .table th{ text-align:center;} 55 | .table td { vertical-align:middle;} 56 | .tip img{width:100px; height:100px;} 57 | .clear{ clear:both; overflow:hidden;} 58 | .pagelist {padding:10px 0; text-align:center;} 59 | .pagelist span,.pagelist a{ border-radius:3px; border:1px solid #dfdfdf;display:inline-block; padding:5px 12px;} 60 | .pagelist a{ margin:0 3px;} 61 | .pagelist span.current{ background:#09F; color:#FFF; border-color:#09F; margin:0 2px;} 62 | .pagelist a:hover{background:#09F; color:#FFF; border-color:#09F; } 63 | .pagelist label{ padding-left:15px; color:#999;} 64 | .pagelist label b{color:red; font-weight:normal; margin:0 3px;} 65 | 66 | .search{ overflow:hidden;} 67 | .search li{float:left; margin-right:15px; line-height:35px;} 68 | 69 | .button.bg-main.icon-check-square-o{ padding:10px 30px;} 70 | .button.bg-main.icon-check-square-o:hover{ background:#08bbe1;} 71 | input[type="checkbox"], input[type="radio"]{ width:15px; height:15px; vertical-align:-3px; margin-right:5px;} 72 | 73 | textarea[name=content]{width:100%; height:500px; border:1px solid #ddd; border-radius:3px; -webkit-border-radius:3px;} 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /public/index/css/admin.css: -------------------------------------------------------------------------------- 1 | body{ color:#333; font-size:13px;} 2 | input,select,textarea{color:#333;} 3 | .bg{ width:100%; height:100%; position:absolute; background:url(../images/bg.jpg) } 4 | .panel{background:#fff;} 5 | form .form-group:last-child{padding-bottom:0;} 6 | .passcode{position:absolute;right:0;bottom:0;height:32px;margin:1px;border-left:solid 1px #ddd;text-align:center;line-height:32px;border-radius:0 4px 4px 0;} 7 | ul,li{ list-style-type:none;} 8 | 9 | .lefter{position:relative;float:left;width:180px;margin-right:-180px;background:#e6f2fb;text-align:center;} 10 | .righter{float:right;width:100%;padding-top:15px;background:#e6f2fb;} 11 | .mainer{margin-left:180px;} 12 | .field-icon-right .icon{ bottom:0px; top:auto} 13 | .logo{ float:left; color:#FFF; margin-top:10px; line-height:45px;} 14 | .logo img{ float:left; margin-right:10px;} 15 | .loginbox { background:url(../images/tmbg-white.png); border:0px;} 16 | /********头部******/ 17 | .header{height:70px; overflow:hidden; background:url(../images/bg.jpg) no-repeat 0 -1000px; } 18 | .head-l{ float:left; margin-top:17px; margin-left:15px; } 19 | .head-l .button{ padding:8px 15px;} 20 | .head-l .bg-blue:hover{ background-color:#03b6fd;} 21 | .leftnav{width:180px; height:100%; position:fixed; top:70px; left:0px;} 22 | .leftnav-title { height:50px; background:url(../images/bg.jpg) no-repeat 0 -1000px; color:#FFF; padding-left:22px; font-size:14px; line-height:50px;} 23 | .leftnav-title span{ margin-right:10px;} 24 | .leftnav h2{ padding:10px 0 10px 22px; transition:all .1s ease-in-out; display:block; cursor:pointer; font-weight:bold; font-size:14px; border-top:1px solid #b5cfd9;} 25 | .leftnav h2.on{ color:#09c;} 26 | .leftnav .border-bottom{ border-bottom:1px solid #b5cfd9;} 27 | .leftnav h2 span{ margin-right:10px;} 28 | .leftnav h2:hover{ color:#09c;} 29 | .leftnav ul {display:none; border-top:1px solid #b5cfd9; padding:5px 0; opacity:1;} 30 | .leftnav ul li{ list-style-type:none; } 31 | .leftnav ul li a{ display:block;padding-left:30px;line-height:30px; } 32 | .leftnav ul li span{ margin-right:8px;} 33 | .leftnav ul li a:hover,.leftnav ul li a.on{ color:#09c;} 34 | 35 | /***主要内容***/ 36 | .admin{background:#fff;position:fixed;border-left:solid 1px #b5cfd9;right:0;bottom:0;top:110px;left:180px; padding:15px; padding-right:0px; padding-bottom:0px; overflow:auto; border-top:1px solid #b5cfd9; padding-right:15px;} 37 | .content{width:100%;} 38 | .body-content{padding:20px 0; overflow:hidden;} 39 | .content .title{ border-bottom:1px solid #dfdfdf; line-height:35px; font-size:14px; font-weight:bold; color:#09c} 40 | .form-x .form-group .label{ width:10%;} 41 | .form-x .form-button { margin-left:10%;} 42 | .w50 { width:25%; float:left;} 43 | .form-x .tipss{ float:left; padding-left:10px; color:#888; line-height:42px;} 44 | .input-help { float:left; line-height:30px;} 45 | .input-help li{ float:left;margin-left:10px;} 46 | .bread{ margin-left:190px; margin-top:4px;} 47 | .bread li{ float:left;} 48 | .label label{ font-weight:normal; color:#333;} 49 | .form-group{ margin-bottom:12px;} 50 | .button{ padding:10px 15px;} 51 | .form-group .field .file{ background:#FFF; border:0px;} 52 | .form-group .field input[type=radio]{ vertical-align:middle; line-height:35px; margin-right:5px;} 53 | .form-group .radio { line-height:35px;} 54 | .table th{ text-align:center;} 55 | .table td { vertical-align:middle;} 56 | .tip img{width:100px; height:100px;} 57 | .clear{ clear:both; overflow:hidden;} 58 | .pagelist {padding:10px 0; text-align:center;} 59 | .pagelist span,.pagelist a{ border-radius:3px; border:1px solid #dfdfdf;display:inline-block; padding:5px 12px;} 60 | .pagelist a{ margin:0 3px;} 61 | .pagelist span.current{ background:#09F; color:#FFF; border-color:#09F; margin:0 2px;} 62 | .pagelist a:hover{background:#09F; color:#FFF; border-color:#09F; } 63 | .pagelist label{ padding-left:15px; color:#999;} 64 | .pagelist label b{color:red; font-weight:normal; margin:0 3px;} 65 | 66 | .search{ overflow:hidden;} 67 | .search li{float:left; margin-right:15px; line-height:35px;} 68 | 69 | .button.bg-main.icon-check-square-o{ padding:10px 30px;} 70 | .button.bg-main.icon-check-square-o:hover{ background:#08bbe1;} 71 | input[type="checkbox"], input[type="radio"]{ width:15px; height:15px; vertical-align:-3px; margin-right:5px;} 72 | 73 | textarea[name=content]{width:100%; height:500px; border:1px solid #ddd; border-radius:3px; -webkit-border-radius:3px;} 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /vendor/cz/framework/src/Template.php: -------------------------------------------------------------------------------- 1 | tplDir = $this->checkDir($tplDir); 15 | $this->cacheDir = $this->checkDir($cacheDir); 16 | $this->expireTime = $expireTime; 17 | } 18 | 19 | /** 20 | * [assign 分配变量] 21 | * @param [type] $name [变量名] 22 | * @param [type] $value [变量值] 23 | * @return [type] [没有] 24 | */ 25 | public function assign($name,$value) 26 | { 27 | $this->vars[$name] = $value; 28 | } 29 | 30 | 31 | /** 32 | * [display 编译模板文件,加载缓存文件,显示] 33 | * @param [type] $viewFile [模板文件名] 34 | * @param [type] $isExtract [是否还原变量] 35 | * @return [type] [无] 36 | */ 37 | public function display($viewFile,$isExtract=true) 38 | { 39 | //1 拼接模板文件和缓存文件的路径 40 | $tplFile = $this->tplDir . $viewFile; 41 | $cacheFile = $this->joinCachePath($viewFile); 42 | //2 检测模板文件是否存在 43 | if (!file_exists($tplFile)) { 44 | exit('模板文件不存在!'); 45 | } 46 | 47 | //3 编译模板文件 48 | //3.1模板文件不存在或者模板文件修改时间晚于缓存文件创建时间 49 | if(!file_exists($cacheFile)|| 50 | filectime($cacheFile) < filemtime($tplFile)|| 51 | filectime($cacheFile) + $this->expireTime < time() 52 | ) 53 | { 54 | // index/index.html 55 | $this->checkDir(dirname($cacheFile)); 56 | $content = $this->compile($tplFile); 57 | file_put_contents($cacheFile, $content); 58 | } else { 59 | $this->updateInclude($tplFile); 60 | } 61 | 62 | 63 | //4 分配变量。加载缓存 64 | if ($isExtract) { 65 | extract($this->vars); 66 | include $cacheFile; 67 | } 68 | 69 | } 70 | 71 | protected function updateInclude($tplFile) 72 | { 73 | //读取模板文件内容 74 | $content = file_get_contents($tplFile); 75 | $pattern = '/\{include (.+)\}/'; 76 | preg_match_all($pattern, $content, $matches); 77 | foreach ($matches[1] as $key => $value) { 78 | $value = trim($value ,'\'"'); 79 | $this->display($value,false); 80 | } 81 | } 82 | 83 | protected function compile($fileName) 84 | { 85 | //读文件内容 86 | $content = file_get_contents($fileName); 87 | $rule = [ 88 | '{$%%}' => '', 89 | '{if %%}' => '', 90 | '{else}' => '', 91 | '{elseif %%}' => '', 92 | '{else if %%}' => '', 93 | '{/if}' => '', 94 | '{include %%}' => '', 95 | '{switch %%}' => '', 96 | '{case %%}' => '', 97 | '{break}' => '', 98 | '{default}' => '', 99 | '{/switch}' => '', 100 | '{foreach %%}' => '', 101 | '{/foreach}' => '', 102 | '{for %%}' => '', 103 | '{/for}' => '', 104 | '__%%__' => '', 105 | '{while %%}' => '', 106 | '{/while}' => '', 107 | '{continue}' => '', 108 | '{$%%++}' => '', 109 | '{$%%--}' => '', 110 | '{/*}' => ' '*/?>', 112 | '{section}' => ' '?>', 114 | '{$%% = $%%}' => '', 115 | ]; 116 | 117 | foreach ($rule as $key => $value) { 118 | $key = preg_quote($key,'/'); 119 | $pattern = '/'.str_replace('%%', '(.+)', $key) . '/U'; 120 | if (stripos($key,'include')) { 121 | $content = preg_replace_callback($pattern, [$this,'parseInclude'], $content); 122 | } else { 123 | $content = preg_replace($pattern, $value, $content); 124 | } 125 | } 126 | return $content; 127 | } 128 | 129 | protected function parseInclude($data) 130 | { 131 | $file = trim($data[1],'\'"'); 132 | 133 | $this->display($file,false);//编译模板文件,不还原变量 134 | $cacheFile = $this->joinCachePath($file);//缓存文件的路径 135 | return ""; 136 | } 137 | 138 | //index.html index_html.php 139 | protected function joinCachePath($viewFile) 140 | { 141 | return $this->cacheDir . str_replace('.', '_', $viewFile).'.php'; 142 | } 143 | protected function checkDir($dir) 144 | { 145 | $dir = str_replace('\\','/', $dir); 146 | $dir = rtrim($dir,'/') . '/'; 147 | $flag = true; 148 | if (!is_dir($dir)) { 149 | $flag = mkdir($dir,0777,true); 150 | } else if (!is_readable($dir) || !is_writable($dir)) { 151 | $flag = chmod($dir, 0777); 152 | } 153 | if (!$flag) { 154 | exit('目录不存在或不可写'); 155 | } 156 | return $dir; 157 | } 158 | 159 | } -------------------------------------------------------------------------------- /vendor/cz/framework/src/Upload.php: -------------------------------------------------------------------------------- 1 | '没有上传信息', 18 | -2=>'上传目录不存在', 19 | -3 => '上传目录不具备读写权限', 20 | -4 =>'上传超过规定', 21 | -5 => '文件后缀不符合要求', 22 | -6 => '文件MIME类型不符合规定', 23 | -7 => '不是上传文件', 24 | 0 => '上传成功', 25 | 1 =>'上传的文件超过了 php.ini 中 upload_max_filesize 选项限制的值', 26 | 2=>'上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值', 27 | 3=>'文件只有部分被上传。', 28 | 4=>'没有文件被上传。', 29 | 6=>'找不到临时文件夹。PHP 4.3.10 和 PHP 5.0.3 引进', 30 | 7=>'文件写入失败', 31 | 32 | ]; 33 | //['uploadDir'=>'./upload/2017/06/14','isRandName'=>false] 34 | public function __construct(array $config = null) 35 | { 36 | if (!empty($config)) { 37 | foreach ($config as $key => $value) { 38 | //判断是否存在该属性 39 | if (property_exists(__CLASS__, $key)) { 40 | $this->$key = $value; 41 | } 42 | } 43 | } 44 | $this->uploadDir = $this->replaceSeperator($this->uploadDir); 45 | } 46 | 47 | /** 48 | * [upload 文件上传] 49 | * @param [type] $key [表单中的input的name] 50 | * @return [type] [如果上传错误,返回false, 51 | * 如果成功,返回文件路径] 52 | */ 53 | public function upload($key) 54 | { 55 | // 1)、检查上传信息 56 | if (!$this->checkUploadInfo($key)) { 57 | return false; 58 | } 59 | 60 | // 2)、检查上传目录 61 | if (!$this->checkUploadDir($this->uploadDir)) { 62 | return false; 63 | } 64 | 65 | // 3)、检查标准上传错误 66 | if (!$this->checkSystemError()) { 67 | return false; 68 | } 69 | 70 | // 4)、检查自定义的错误(大小、后缀、MIME) 71 | if (!$this->checkCustomError()) { 72 | return false; 73 | } 74 | // 5)、判断是否是上传文件 75 | if (!$this->checkUploadedFile()) { 76 | return false; 77 | } 78 | // 6)、移动上传文件到指定目录 79 | if (!$this->checkMoveFile()) { 80 | return false; 81 | } 82 | return $this->uploadedPath; 83 | } 84 | 85 | protected function checkMoveFile() 86 | { 87 | //1 拼接目录 88 | $path = $this->uploadDir; 89 | if ($this->isdateDir) { 90 | $date = date('Y/m/d');//2017/06/14 91 | 92 | //如果不存在日期目录,则创建 93 | if (!is_dir($date)) { 94 | mkdir($date,0777,true); 95 | } 96 | 97 | //在上传目录下创建日期目录 98 | $path .= $date .'/'; 99 | } 100 | 101 | //2 是否是随机文件名 102 | if ($this->isRandName) { 103 | $path .= uniqid() . '.'.$this->extName($this->uploadInfo['name']); 104 | } else { 105 | $path .= $this->uploadInfo['name']; 106 | } 107 | if (!move_uploaded_file($this->uploadInfo['tmp_name'], $path)) { 108 | $this->errNo = -8; 109 | return false; 110 | } 111 | $this->uploadedPath = $path; 112 | return true; 113 | 114 | } 115 | protected function extName($file) 116 | { 117 | return pathinfo($file)['extension']; 118 | } 119 | 120 | protected function checkUploadedFile() 121 | { 122 | if (!is_uploaded_file($this->uploadInfo['tmp_name'])) { 123 | $this->errNo = -7; 124 | return false; 125 | } 126 | return true; 127 | } 128 | 129 | protected function checkCustomError() 130 | { 131 | //1 检测文件大小是否超过规定 132 | if ($this->uploadInfo['size'] > $this->maxFileSize) { 133 | $this->errNo = -4; 134 | return false; 135 | } 136 | 137 | //检测文件后缀是否在规定范围内 138 | $extension = pathinfo($this->uploadInfo['name'])['extension']; 139 | if (!in_array($extension, $this->allowedSubfix)) { 140 | $this->errNo = -5; 141 | return false; 142 | } 143 | 144 | // mime类型检测 145 | if (!in_array($this->uploadInfo['type'], $this->allowedMIME)) { 146 | $this->errNo = -6; 147 | return false; 148 | } 149 | return true; 150 | } 151 | 152 | /** 153 | * [checkSystemError 检测系统错误] 154 | * @return [type] [] 155 | */ 156 | protected function checkSystemError() 157 | { 158 | $this->errNo = $this->uploadInfo['error']; 159 | if ($this->errNo == 0) { 160 | return true; 161 | } 162 | return false; 163 | } 164 | 165 | /** 166 | * [checkDir 检测目录] 167 | * @param [type] $dir [目录名] 168 | * @return [type] [description] 169 | */ 170 | protected function checkUploadDir($dir) 171 | { 172 | //不是目录则创建 173 | if (!is_dir($dir)) { 174 | if (!mkdir($dir,0777,true)) { 175 | $this->errNo = -2; 176 | return false; 177 | } 178 | return true; 179 | } 180 | //检测目录是否具有读写权限 181 | if (!is_readable($dir) || !is_writable($dir)) { 182 | if (!chmod($dir, 0777)) { 183 | $this->errNo = -3; 184 | return false; 185 | } 186 | } 187 | return true; 188 | } 189 | 190 | protected function checkUploadInfo($key) 191 | { 192 | //1 检测有没有上传信息 193 | if ($_FILES[$key]['error']) { 194 | $this->errNo = -1; 195 | return false; 196 | } 197 | //2 保存上传信息 198 | $this->uploadInfo = $_FILES[$key]; 199 | return true; 200 | } 201 | 202 | /** 203 | * [replaceSeperator 替换目录中的反斜线为正斜线] 204 | * @param [type] $dir [目录名] 205 | * @return [type] [返回替换后的目录名] 206 | */ 207 | protected function replaceSeperator($dir) 208 | { 209 | // 4/demo/ 4\demo 4\demo\ 210 | $dir = str_replace('\\', '/', $dir); 211 | $dir = rtrim($dir,'/') .'/'; 212 | return $dir; 213 | } 214 | } -------------------------------------------------------------------------------- /vendor/cz/framework/src/Image.php: -------------------------------------------------------------------------------- 1 | replaceSeperator($saveDir); 14 | $this->saveDir = $saveDir; 15 | if (!$this->checkDir($saveDir)) { 16 | exit('目录不存在或不可读写'); 17 | } 18 | 19 | $this->imageType = $this->getImageType($imageType); 20 | $this->isRandFile = $isRandFile; 21 | } 22 | 23 | public function watermark(string $dest,string $source,int $pos = 5,float $alpha = 100) 24 | { 25 | // 1)、路径检测 26 | if (!file_exists($dest) || !file_exists($source)) { 27 | exit('源文件或目标文件不存在!'); 28 | } 29 | 30 | // 2)、计算图片尺寸 31 | list($destWidth,$destHeight) = getimagesize($dest); 32 | list($sourceWidth,$sourceHeight) = getimagesize($source); 33 | if ($sourceWidth > $destWidth || $sourceHeight > $destHeight) { 34 | exit('水印图片比目标图片大!'); 35 | } 36 | 37 | // 3)、计算水印位置 38 | $position = $this->getPosition($destWidth,$destHeight,$sourceWidth,$sourceHeight,$pos); 39 | 40 | // 4)、合并图片 41 | $destImage = $this->openImage($dest); 42 | $sourceImage = $this->openImage($source); 43 | if (!$destImage || !$sourceImage) { 44 | exit('无法打开图片文件!'); 45 | } 46 | imagecopymerge($destImage, $sourceImage, $position['x'], $position['y'], 0, 0, $sourceWidth, $sourceHeight, $alpha); 47 | 48 | // 5)、保存图片 49 | $this->saveFile($destImage,$dest); 50 | 51 | // 6)、释放资源 52 | imagedestroy($sourceImage); 53 | imagedestroy($destImage); 54 | } 55 | 56 | 57 | public function zoom($imageFile,$width,$height) 58 | { 59 | // 1)、路径检测 60 | if (!file_exists($imageFile)) { 61 | exit('图片文件不存在!'); 62 | } 63 | 64 | // 2)、计算缩放尺寸 65 | list($oldWidth,$oldHeight) = getimagesize($imageFile); 66 | $size = $this->computeScale($oldWidth,$oldHeight,$width,$height); 67 | 68 | // 3)、合并图片 69 | $oldImage = $this->openImage($imageFile); 70 | $destImage = imagecreatetruecolor($width, $height); 71 | $this->merageImage($destImage,$oldImage,$size,$oldWidth, $oldHeight); 72 | 73 | 74 | // 4)、保存图片 75 | $this->saveFile($destImage,$imageFile); 76 | // 5)、释放资源 77 | imagedestroy($oldImage); 78 | imagedestroy($destImage); 79 | 80 | } 81 | 82 | protected function merageImage($destImage,$oldImage,$size,$oldWidth, $oldHeight) 83 | { 84 | //获取原图片的透明色 85 | $alphaColor = imagecolortransparent($oldImage); 86 | // var_dump($alphaColor); 87 | if ($alphaColor < 0) { 88 | //指定目标图片中黑色是透明色 89 | $alphaColor = imagecolorallocate($destImage, 0, 0, 0); 90 | } 91 | // var_dump($alphaColor); 92 | imagefill($destImage, 0, 0, $alphaColor); 93 | imagecolortransparent($destImage,$alphaColor); 94 | 95 | imagecopyresampled($destImage, $oldImage, $size['x'], $size['y'], 0, 0, $size['newWidth'], $size['newHeight'], $oldWidth, $oldHeight); 96 | } 97 | 98 | protected function computeScale($oldWidth,$oldHeight,$width,$height) 99 | { 100 | $widthScale = $width / $oldWidth; 101 | $heightScale = $height / $oldHeight; 102 | 103 | $minScale = min($widthScale,$heightScale); 104 | $newWidth = $oldWidth * $minScale; 105 | $newHeight = $oldHeight * $minScale; 106 | 107 | if ($widthScale < $heightScale) { 108 | $y = ($height - $newHeight) / 2; 109 | $x = 0; 110 | } else { 111 | $y = 0; 112 | $x = ($width - $newWidth)/2; 113 | } 114 | return ['newWidth'=>$newWidth,'newHeight'=>$newHeight,'x'=>$x,'y'=>$y]; 115 | 116 | } 117 | protected function saveFile($image,$originFile) 118 | { 119 | if ($this->isRandFile) { 120 | $path = $this->saveDir . uniqid() .'.'. $this->imageType; 121 | } else { 122 | $path = $this->saveDir . pathinfo($originFile)['filename'].'.'.$this->imageType; 123 | } 124 | $funcName = 'image' . $this->imageType; 125 | // var_dump($path,$funcName);die; 126 | if (function_exists($funcName)) { 127 | $funcName($image,$path); 128 | } else { 129 | exit('图片无法保存!'); 130 | } 131 | } 132 | 133 | protected function openImage($imageFile) 134 | { 135 | //image 136 | $type = exif_imagetype($imageFile); 137 | 138 | $types = [0,'gif','jpeg','png','swf','psd','wbmp']; 139 | 140 | $funcName = 'imagecreatefrom'. $types[$type]; 141 | 142 | if (function_exists($funcName)) { 143 | return $funcName($imageFile); 144 | } 145 | return false; 146 | } 147 | protected function getPosition($destWidth,$destHeight,$sourceWidth,$sourceHeight,$pos) 148 | { 149 | if ($pos < 1 || $pos > 9) { 150 | $x = rand(0,$destWidth-$sourceWidth); 151 | $y = rand(0,$destHeight-$sourceHeight); 152 | } else { 153 | $x = ($pos -1)%3 * ($destWidth - $sourceWidth) / 2; 154 | $y = (int)(($pos-1)/3) * ($destHeight - $sourceHeight) / 2; 155 | } 156 | return ['x' => $x,'y' => $y]; 157 | } 158 | 159 | /** 160 | * 转换图片格式 161 | * 162 | * @param $imageType 用户给的图片格式 163 | */ 164 | protected function getImageType($imageType) 165 | { 166 | $types = [ 167 | 'jpg' => 'jpeg', 168 | 'pjpeg' => 'jpeg', 169 | 'bmp' => 'wbmp' 170 | ]; 171 | if (array_key_exists($imageType, $types)) { 172 | $imageType = $types[$imageType]; 173 | } 174 | return $imageType; 175 | } 176 | 177 | /** 178 | * [checkDir 检测目录] 179 | * @param [type] $dir [目录名] 180 | * @return [type] [description] 181 | */ 182 | protected function checkDir($dir) 183 | { 184 | //不是目录则创建 185 | if (!is_dir($dir)) { 186 | return mkdir($dir,0777,true); 187 | } 188 | //检测目录是否具有读写权限 189 | if (!is_readable($dir) || !is_writable($dir)) { 190 | chmod($dir, 0777); 191 | } 192 | return true; 193 | } 194 | 195 | /** 196 | * [replaceSeperator 替换目录中的反斜线为正斜线] 197 | * @param [type] $dir [目录名] 198 | * @return [type] [返回替换后的目录名] 199 | */ 200 | protected function replaceSeperator($dir) 201 | { 202 | // 4/demo/ 4\demo 4\demo\ 203 | $dir = str_replace('\\', '/', $dir); 204 | $dir = rtrim($dir,'/') .'/'; 205 | return $dir; 206 | } 207 | } -------------------------------------------------------------------------------- /public/index/js/ddsmoothmenu.js: -------------------------------------------------------------------------------- 1 | //** Smooth Navigational Menu- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com 2 | //** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/ 3 | //** Menu created: Nov 12, 2008 4 | 5 | //** Dec 12th, 08" (v1.01): Fixed Shadow issue when multiple LIs within the same UL (level) contain sub menus: http://www.dynamicdrive.com/forums/showthread.php?t=39177&highlight=smooth 6 | 7 | //** Feb 11th, 09" (v1.02): The currently active main menu item (LI A) now gets a CSS class of ".selected", including sub menu items. 8 | 9 | //** May 1st, 09" (v1.3): 10 | //** 1) Now supports vertical (side bar) menu mode- set "orientation" to 'v' 11 | //** 2) In IE6, shadows are now always disabled 12 | 13 | //** July 27th, 09" (v1.31): Fixed bug so shadows can be disabled if desired. 14 | //** Feb 2nd, 10" (v1.4): Adds ability to specify delay before sub menus appear and disappear, respectively. See showhidedelay variable below 15 | 16 | var ddsmoothmenu={ 17 | 18 | //Specify full URL to down and right arrow images (23 is padding-right added to top level LIs with drop downs): 19 | arrowimages: {down:['downarrowclass', 'down.gif', 23], right:['rightarrowclass', 'right.gif']}, 20 | transition: {overtime:300, outtime:300}, //duration of slide in/ out animation, in milliseconds 21 | shadow: {enable:false, offsetx:5, offsety:5}, //enable shadow? 22 | showhidedelay: {showdelay: 100, hidedelay: 200}, //set delay in milliseconds before sub menus appear and disappear, respectively 23 | 24 | ///////Stop configuring beyond here/////////////////////////// 25 | 26 | detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, //detect WebKit browsers (Safari, Chrome etc) 27 | detectie6: document.all && !window.XMLHttpRequest, 28 | 29 | getajaxmenu:function($, setting){ //function to fetch external page containing the panel DIVs 30 | var $menucontainer=$('#'+setting.contentsource[0]) //reference empty div on page that will hold menu 31 | $menucontainer.html("Loading Menu...") 32 | $.ajax({ 33 | url: setting.contentsource[1], //path to external menu file 34 | async: true, 35 | error:function(ajaxrequest){ 36 | $menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText) 37 | }, 38 | success:function(content){ 39 | $menucontainer.html(content) 40 | ddsmoothmenu.buildmenu($, setting) 41 | } 42 | }) 43 | }, 44 | 45 | 46 | buildmenu:function($, setting){ 47 | var smoothmenu=ddsmoothmenu 48 | var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu UL 49 | $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu" 50 | var $headers=$mainmenu.find("ul").parent() 51 | $headers.hover( 52 | function(e){ 53 | $(this).children('a:eq(0)').addClass('selected') 54 | }, 55 | function(e){ 56 | $(this).children('a:eq(0)').removeClass('selected') 57 | } 58 | ) 59 | $headers.each(function(i){ //loop through each LI header 60 | var $curobj=$(this).css({zIndex: 100-i}) //reference current LI header 61 | var $subul=$(this).find('ul:eq(0)').css({display:'block'}) 62 | $subul.data('timers', {}) 63 | this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()} 64 | this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header? 65 | $subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0}) 66 | if (smoothmenu.shadow.enable){ 67 | this._shadowoffset={x:(this.istopheader?$subul.offset().left+smoothmenu.shadow.offsetx : this._dimensions.w), y:(this.istopheader? $subul.offset().top+smoothmenu.shadow.offsety : $curobj.position().top)} //store this shadow's offsets 68 | if (this.istopheader) 69 | $parentshadow=$(document.body) 70 | else{ 71 | var $parentLi=$curobj.parents("li:eq(0)") 72 | $parentshadow=$parentLi.get(0).$shadow 73 | } 74 | this.$shadow=$('
').prependTo($parentshadow).css({left:this._shadowoffset.x+'px', top:this._shadowoffset.y+'px'}) //insert shadow DIV and set it to parent node for the next shadow div 75 | } 76 | $curobj.hover( 77 | function(e){ 78 | var $targetul=$subul //reference UL to reveal 79 | var header=$curobj.get(0) //reference header LI as DOM object 80 | clearTimeout($targetul.data('timers').hidetimer) 81 | $targetul.data('timers').showtimer=setTimeout(function(){ 82 | header._offsets={left:$curobj.offset().left, top:$curobj.offset().top} 83 | var menuleft=header.istopheader && setting.orientation!='v'? 0 : header._dimensions.w 84 | menuleft=(header._offsets.left+menuleft+header._dimensions.subulw>$(window).width())? (header.istopheader && setting.orientation!='v'? -header._dimensions.subulw+header._dimensions.w : -header._dimensions.w) : menuleft //calculate this sub menu's offsets from its parent 85 | if ($targetul.queue().length<=1){ //if 1 or less queued animations 86 | $targetul.css({left:menuleft+"px", width:header._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'}, ddsmoothmenu.transition.overtime) 87 | if (smoothmenu.shadow.enable){ 88 | var shadowleft=header.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft 89 | var shadowtop=header.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : header._shadowoffset.y 90 | if (!header.istopheader && ddsmoothmenu.detectwebkit){ //in WebKit browsers, restore shadow's opacity to full 91 | header.$shadow.css({opacity:1}) 92 | } 93 | header.$shadow.css({overflow:'', width:header._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:header._dimensions.subulh+'px'}, ddsmoothmenu.transition.overtime) 94 | } 95 | } 96 | }, ddsmoothmenu.showhidedelay.showdelay) 97 | }, 98 | function(e){ 99 | var $targetul=$subul 100 | var header=$curobj.get(0) 101 | clearTimeout($targetul.data('timers').showtimer) 102 | $targetul.data('timers').hidetimer=setTimeout(function(){ 103 | $targetul.animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime) 104 | if (smoothmenu.shadow.enable){ 105 | if (ddsmoothmenu.detectwebkit){ //in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them 106 | header.$shadow.children('div:eq(0)').css({opacity:0}) 107 | } 108 | header.$shadow.css({overflow:'hidden'}).animate({height:0}, ddsmoothmenu.transition.outtime) 109 | } 110 | }, ddsmoothmenu.showhidedelay.hidedelay) 111 | } 112 | ) //end hover 113 | }) //end $headers.each() 114 | $mainmenu.find("ul").css({display:'none', visibility:'visible'}) 115 | }, 116 | 117 | init:function(setting){ 118 | if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set? 119 | var mainmenuid='#'+setting.mainmenuid 120 | var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid 121 | document.write('') 125 | } 126 | this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow 127 | jQuery(document).ready(function($){ //ajax menu? 128 | if (typeof setting.contentsource=="object"){ //if external ajax menu 129 | ddsmoothmenu.getajaxmenu($, setting) 130 | } 131 | else{ //else if markup menu 132 | ddsmoothmenu.buildmenu($, setting) 133 | } 134 | }) 135 | } 136 | 137 | } //end ddsmoothmenu variable 138 | -------------------------------------------------------------------------------- /public/index/js/jquery.dualSlider.0.3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery.fn.dualSlider - Dual sliders, why not? 3 | * Date: June 2010 4 | * 5 | * @author Rob Phillips (Front End Developer - Hugo & Cat - http://www.hugoandcat.com) 6 | * @version 0.3 7 | * @web http://www.hugoandcat.com/DualSlider/index.html 8 | * 9 | * Requirements: 10 | * jquery.1.3.2.js - http://jquery.com/ 11 | * jquery.easing.1.3.js - http://gsgd.co.uk/sandbox/jquery/easing/ 12 | * jquery.timers-1.2.js - http://plugins.jquery.com/project/timers 13 | * 14 | * 0.2 - Tested and fixed for IE6+, auto loops, manual pause/play controls 15 | * - Disabled buttons until animation finishes - Thanks for the bug John. 16 | * 0.3 - Now with a seamless loop, instead of that nasty rewind...was 'too much' apparently 17 | * 18 | **/ 19 | 20 | 21 | (function($) { 22 | 23 | $.fn.dualSlider = function(options) { 24 | 25 | // default configuration properties 26 | var defaults = { 27 | auto: true, 28 | autoDelay: 10000, 29 | easingCarousel: 'swing', 30 | easingDetails: 'easeOutBack', 31 | durationCarousel: 1000, 32 | durationDetails: 600 33 | }; 34 | 35 | var options = $.extend(defaults, options); 36 | 37 | this.each(function() { 38 | 39 | var obj = $(this); 40 | var carousel; 41 | var carouselTotal = $(".backgrounds", obj).children().length; 42 | var carouselPosition = 1; 43 | var carouselLinkIndex = 1; 44 | var carouselLinks = ""; 45 | var carouselwidth = $(obj).width(); 46 | var detailWidth = $(".panel .details_wrapper", obj).width(); 47 | var locked = false; 48 | 49 | if(options.auto == true) 50 | { 51 | //Creat duplicates for seamless looping 52 | $(".backgrounds", obj).prepend($(".backgrounds .item:last-child", obj).clone().css("margin-left", "-" + carouselwidth + "px")); 53 | $(".backgrounds", obj).append($(".backgrounds .item:nth-child(2)", obj).clone()); 54 | 55 | $(".details", obj).prepend($(".details .detail:last-child", obj).clone().css("margin-left", "-" + detailWidth + "px")); 56 | $(".details", obj).append($(".details .detail:nth-child(2)", obj).clone()); 57 | } 58 | else{ 59 | $(".previous", obj).hide(); 60 | $(".play, .pause", obj).hide(); 61 | } 62 | 63 | 64 | //Set main background width 65 | $(".backgrounds", obj).css("width", ((carouselTotal+1) * carouselwidth) + 100 + "px"); 66 | 67 | 68 | //Set main detail width 69 | $(".details_wrapper .details", obj).css("width", detailWidth * carouselwidth + "px"); 70 | 71 | for (i = 1; i <= carouselTotal; i++) { 72 | (i == 1) ? carouselLinks += "" + carouselLinkIndex + "" : carouselLinks += "" + carouselLinkIndex + ""; 73 | carouselLinkIndex++; 74 | } 75 | $("#numbers", obj).html(carouselLinks); 76 | 77 | //Bind carousel controls 78 | $(".next", obj).click(function() { 79 | carouselPage(parseInt(carouselPosition + 1), false); 80 | lock(); 81 | }); 82 | 83 | $(".previous", obj).click(function() { 84 | carouselPage(parseInt(carouselPosition - 1), false); 85 | lock(); 86 | }); 87 | 88 | $("#numbers a", obj).click(function() { 89 | carouselPage($(this).attr("rel"), false); 90 | lock(); 91 | }); 92 | 93 | $(".pause", obj).click(function() { 94 | autoPause(); 95 | }); 96 | $(".play", obj).click(function() { 97 | autoPlay(); 98 | }); 99 | 100 | function lock() { 101 | locked = true; 102 | } 103 | 104 | function unLock() { 105 | locked = false; 106 | } 107 | 108 | 109 | function checkPreviousNext() { 110 | $("#numbers a", obj).removeClass("selected"); 111 | $("#numbers .link" + carouselPosition, obj).addClass("selected"); 112 | 113 | if(options.auto == false) 114 | { 115 | (carouselPosition == carouselTotal) ? $(".next", obj).hide() : $(".next", obj).show(); 116 | (carouselPosition < 2) ? $(".previous", obj).hide() : $(".previous", obj).show(); 117 | } 118 | } 119 | 120 | function adjust() { 121 | 122 | if (carouselPosition < 1) { 123 | //alert("trickery required"); 124 | $(".backgrounds", obj).css("margin-left", (-1 * ((carouselTotal - 1) * carouselwidth))); 125 | $(".details", obj).css("margin-left", (-1 * ((carouselTotal - 1) * detailWidth))); 126 | carouselPosition = carouselTotal; 127 | 128 | } 129 | if (carouselPosition > carouselTotal) { 130 | //alert("more trickery required"); 131 | $(".backgrounds", obj).css("margin-left", 0); 132 | $(".details", obj).css("margin-left", 0); 133 | carouselPosition = 1; 134 | } 135 | 136 | } 137 | 138 | function carouselPage(x, y) { 139 | 140 | if (locked != true) { 141 | 142 | //console.log("New page: " + x); 143 | carouselPosition = parseFloat(x); 144 | //Cancel timer if manual click 145 | if (y == false) autoPause(); 146 | 147 | var newPage = (x * carouselwidth) - carouselwidth; 148 | var newPageDetail = (x * detailWidth) - detailWidth; 149 | 150 | if (newPage != 0) { 151 | newPage = newPage * -1; 152 | newPageDetail = newPageDetail * -1; 153 | } 154 | 155 | $(".backgrounds", obj).animate({ 156 | marginLeft: newPage 157 | }, { 158 | "duration": options.durationCarousel, "easing": options.easingCarousel, 159 | 160 | complete: function() { 161 | 162 | //Now animate the details 163 | $(".details", obj).animate({ 164 | marginLeft: newPageDetail 165 | }, { 166 | "duration": options.durationDetails, "easing": options.easingDetails 167 | 168 | }); 169 | adjust(); 170 | checkPreviousNext(); 171 | unLock(); 172 | } 173 | }); 174 | } 175 | 176 | 177 | } 178 | 179 | function autoPause() { 180 | $(".pause", obj).hide(); 181 | $(".play", obj).show(); 182 | $("body").stopTime("autoScroll"); 183 | } 184 | 185 | function autoPlay() { 186 | $(".pause", obj).show(); 187 | $(".play", obj).hide(); 188 | $("body").everyTime(options.autoDelay, "autoScroll", function() { 189 | carouselPage(carouselPosition + 1, true); 190 | lock(); 191 | }); 192 | } 193 | 194 | if (options.auto == true) { 195 | autoPlay(); 196 | } 197 | 198 | }); 199 | 200 | }; 201 | 202 | })(jQuery); 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /public/index/js/jquery.easing.1.3.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 3 | * 4 | * Uses the built in easing capabilities added In jQuery 1.1 5 | * to offer multiple easing options 6 | * 7 | * TERMS OF USE - jQuery Easing 8 | * 9 | * Open source under the BSD License. 10 | * 11 | * Copyright © 2008 George McGinley Smith 12 | * All rights reserved. 13 | * 14 | * Redistribution and use in source and binary forms, with or without modification, 15 | * are permitted provided that the following conditions are met: 16 | * 17 | * Redistributions of source code must retain the above copyright notice, this list of 18 | * conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above copyright notice, this list 20 | * of conditions and the following disclaimer in the documentation and/or other materials 21 | * provided with the distribution. 22 | * 23 | * Neither the name of the author nor the names of contributors may be used to endorse 24 | * or promote products derived from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 27 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 30 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 31 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 34 | * OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | */ 37 | 38 | // t: current time, b: begInnIng value, c: change In value, d: duration 39 | jQuery.easing['jswing'] = jQuery.easing['swing']; 40 | 41 | jQuery.extend( jQuery.easing, 42 | { 43 | def: 'easeOutQuad', 44 | swing: function (x, t, b, c, d) { 45 | //alert(jQuery.easing.default); 46 | return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 47 | }, 48 | easeInQuad: function (x, t, b, c, d) { 49 | return c*(t/=d)*t + b; 50 | }, 51 | easeOutQuad: function (x, t, b, c, d) { 52 | return -c *(t/=d)*(t-2) + b; 53 | }, 54 | easeInOutQuad: function (x, t, b, c, d) { 55 | if ((t/=d/2) < 1) return c/2*t*t + b; 56 | return -c/2 * ((--t)*(t-2) - 1) + b; 57 | }, 58 | easeInCubic: function (x, t, b, c, d) { 59 | return c*(t/=d)*t*t + b; 60 | }, 61 | easeOutCubic: function (x, t, b, c, d) { 62 | return c*((t=t/d-1)*t*t + 1) + b; 63 | }, 64 | easeInOutCubic: function (x, t, b, c, d) { 65 | if ((t/=d/2) < 1) return c/2*t*t*t + b; 66 | return c/2*((t-=2)*t*t + 2) + b; 67 | }, 68 | easeInQuart: function (x, t, b, c, d) { 69 | return c*(t/=d)*t*t*t + b; 70 | }, 71 | easeOutQuart: function (x, t, b, c, d) { 72 | return -c * ((t=t/d-1)*t*t*t - 1) + b; 73 | }, 74 | easeInOutQuart: function (x, t, b, c, d) { 75 | if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 76 | return -c/2 * ((t-=2)*t*t*t - 2) + b; 77 | }, 78 | easeInQuint: function (x, t, b, c, d) { 79 | return c*(t/=d)*t*t*t*t + b; 80 | }, 81 | easeOutQuint: function (x, t, b, c, d) { 82 | return c*((t=t/d-1)*t*t*t*t + 1) + b; 83 | }, 84 | easeInOutQuint: function (x, t, b, c, d) { 85 | if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 86 | return c/2*((t-=2)*t*t*t*t + 2) + b; 87 | }, 88 | easeInSine: function (x, t, b, c, d) { 89 | return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 90 | }, 91 | easeOutSine: function (x, t, b, c, d) { 92 | return c * Math.sin(t/d * (Math.PI/2)) + b; 93 | }, 94 | easeInOutSine: function (x, t, b, c, d) { 95 | return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 96 | }, 97 | easeInExpo: function (x, t, b, c, d) { 98 | return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 99 | }, 100 | easeOutExpo: function (x, t, b, c, d) { 101 | return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 102 | }, 103 | easeInOutExpo: function (x, t, b, c, d) { 104 | if (t==0) return b; 105 | if (t==d) return b+c; 106 | if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 107 | return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 108 | }, 109 | easeInCirc: function (x, t, b, c, d) { 110 | return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 111 | }, 112 | easeOutCirc: function (x, t, b, c, d) { 113 | return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 114 | }, 115 | easeInOutCirc: function (x, t, b, c, d) { 116 | if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 117 | return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 118 | }, 119 | easeInElastic: function (x, t, b, c, d) { 120 | var s=1.70158;var p=0;var a=c; 121 | if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 122 | if (a < Math.abs(c)) { a=c; var s=p/4; } 123 | else var s = p/(2*Math.PI) * Math.asin (c/a); 124 | return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 125 | }, 126 | easeOutElastic: function (x, t, b, c, d) { 127 | var s=1.70158;var p=0;var a=c; 128 | if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 129 | if (a < Math.abs(c)) { a=c; var s=p/4; } 130 | else var s = p/(2*Math.PI) * Math.asin (c/a); 131 | return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 132 | }, 133 | easeInOutElastic: function (x, t, b, c, d) { 134 | var s=1.70158;var p=0;var a=c; 135 | if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 136 | if (a < Math.abs(c)) { a=c; var s=p/4; } 137 | else var s = p/(2*Math.PI) * Math.asin (c/a); 138 | if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 139 | return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 140 | }, 141 | easeInBack: function (x, t, b, c, d, s) { 142 | if (s == undefined) s = 1.70158; 143 | return c*(t/=d)*t*((s+1)*t - s) + b; 144 | }, 145 | easeOutBack: function (x, t, b, c, d, s) { 146 | if (s == undefined) s = 1.70158; 147 | return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 148 | }, 149 | easeInOutBack: function (x, t, b, c, d, s) { 150 | if (s == undefined) s = 1.70158; 151 | if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 152 | return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 153 | }, 154 | easeInBounce: function (x, t, b, c, d) { 155 | return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 156 | }, 157 | easeOutBounce: function (x, t, b, c, d) { 158 | if ((t/=d) < (1/2.75)) { 159 | return c*(7.5625*t*t) + b; 160 | } else if (t < (2/2.75)) { 161 | return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 162 | } else if (t < (2.5/2.75)) { 163 | return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 164 | } else { 165 | return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 166 | } 167 | }, 168 | easeInOutBounce: function (x, t, b, c, d) { 169 | if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 170 | return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 171 | } 172 | }); 173 | 174 | /* 175 | * 176 | * TERMS OF USE - EASING EQUATIONS 177 | * 178 | * Open source under the BSD License. 179 | * 180 | * Copyright © 2001 Robert Penner 181 | * All rights reserved. 182 | * 183 | * Redistribution and use in source and binary forms, with or without modification, 184 | * are permitted provided that the following conditions are met: 185 | * 186 | * Redistributions of source code must retain the above copyright notice, this list of 187 | * conditions and the following disclaimer. 188 | * Redistributions in binary form must reproduce the above copyright notice, this list 189 | * of conditions and the following disclaimer in the documentation and/or other materials 190 | * provided with the distribution. 191 | * 192 | * Neither the name of the author nor the names of contributors may be used to endorse 193 | * or promote products derived from this software without specific prior written permission. 194 | * 195 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 196 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 197 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 198 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 199 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 200 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 201 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 202 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 203 | * OF THE POSSIBILITY OF SUCH DAMAGE. 204 | * 205 | */ -------------------------------------------------------------------------------- /app/index/view/index/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 博客-首页 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
39 | 40 | {include public.html} 41 | 42 |
43 |
44 |
45 | slider image 2 46 | slider image 2 47 | slider image 2 48 | slider image 4 49 |
50 |
51 | 博客乐园,意想不到的乐趣! 52 |
53 |
54 | 55 | 56 | 64 |
65 | 66 |
67 | 想了解更多的最新知识资讯吗?来博客乐园,这里有你意想不到的爆炸知识,最新资讯,来和我们一起遨游在知识的海洋中吧!!! 68 |
69 |
Collect from Website Template
70 |
71 | 72 |
73 |

一起开始吧!

74 |
75 | 76 | {foreach $title as $v} 77 |
78 | 99 | 查看 100 |
浏览量:{$v['looks']}    评论数:{$v['replys']} 101 |
102 |
103 | {/foreach} 104 | 105 | 106 |
107 |
    108 |
  • 首页
  • 109 |
  • 上一页
  • 110 | 111 | {if ($p<=$totalPage)} 112 |
  • {$p}
  • 113 | {/if} 114 | {if ($p+1<=$totalPage)} 115 |
  • {$p+1}
  • 116 | {/if} 117 | {if ($p+2<=$totalPage)} 118 |
  • {$p+2}
  • 119 | {/if} 120 |
  • 下一页
  • 121 |
  • 尾页
  • 122 | 当前页码为:{$curPage} 123 |
    共有{$totalPage}页 124 |
125 | 126 |
127 |
128 | 129 |
130 | 131 |
132 | 133 | 134 | 135 |
136 | 137 | 138 |
139 | 140 |
141 |
142 | 143 |
144 |

Photo Gallery

145 | 153 |
154 |
155 | 156 |
157 |

Twitter

158 | 164 |
165 | 166 |
167 |

Follow Us

168 | 176 |
177 | 178 |
179 |
180 | 181 |
182 | 183 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /public/index/templatemo_style.css: -------------------------------------------------------------------------------- 1 | /* Credit: http://www.cssmoban.com */ 2 | 3 | body { 4 | margin: 0; 5 | padding: 0; 6 | color: #666; 7 | font-family: Verdana, Arial, Helvetica, sans-serif; 8 | font-size: 11px; 9 | line-height: 1.4em; 10 | background-color: #fff; 11 | background-position: top; 12 | background-repeat: repeat-x; 13 | } 14 | 15 | #home { background-image: url(images/templatemo_body_home.jpg) } 16 | #subpage { background-image: url(images/templatemo_body_subpage.jpg) } 17 | 18 | h1, h2, h3, h4, h5, h6 { 19 | color:#333; 20 | font-weight:400; 21 | padding: 0; 22 | margin: 0 0 10px 0; 23 | font-family: Georgia, "Times New Roman", Times, serif 24 | } 25 | 26 | h1 { font-size:32px } 27 | h2 { font-size:26px; margin-bottom: 30px; line-height: 20px; } 28 | h3 { font-size:20px } 29 | h4 { font-size:18px } 30 | h5 { font-size:16px } 31 | h6 { font-size:12px } 32 | 33 | .left { float:left } 34 | .right { float:right } 35 | .clear { clear: both } 36 | .h30 { height: 30px } 37 | .h60 { height: 60px } 38 | 39 | img { margin: 0; padding: 0; border: 0 } 40 | .img_border { border: 1px solid #999; background: #fff; padding: 3px; } 41 | .img_border_b { border: 1px solid #999; background: #fff; padding: 6px } 42 | 43 | .img_fl { float: left; display: block; margin: 1px 20px 8px 0 } 44 | .img_fr { float: right; margin: 1px 0 8px 20px } 45 | 46 | p { margin: 0 0 10px 0; padding: 0 } 47 | em { color: #333 } 48 | hr { margin-bottom: 40px; padding-top: 20px; border: none; border-bottom: 1px solid #ccc } 49 | 50 | a:link, a:visited { color:#76a33b; text-decoration: none} 51 | a:hover { text-decoration:none; } 52 | a:hover,a:active { outline:none } 53 | 54 | a.more { display: block; margin-top: 15px; color: #fff; width: 80px; height: 24px; line-height: 24px; text-align: center; background: url(images/templatemo_more.png) } 55 | 56 | ul.nobullet { margin: 0; padding: 0; list-style: none } 57 | ul.nobullet li { margin: 0; padding: 0 } 58 | 59 | ul.list_bullet { margin: 10px 0 10px 15px; padding: 0; list-style: none } 60 | ul.list_bullet li { color:#555; margin: 0 0 7px 0; padding: 0 0 0 20px; background: url(images/templatemo_bullet.png) no-repeat scroll 0 5px } 61 | ul.list_bullet li a { color: #555; font-weight: normal; text-decoration: none } 62 | ul.list_bullet li a:hover { color: #555 } 63 | 64 | #templatemo_wrapper { 65 | width: 960px; 66 | padding: 0 10px; 67 | margin: 0 auto; 68 | } 69 | #templatemo_header { 70 | height: 60px; 71 | padding: 50px 70px 20px 70px; 72 | } 73 | #templatemo_slider { 74 | clear: both; 75 | width: 960px; 76 | height: 320px; 77 | position: relative; 78 | margin-bottom: 50px; 79 | } 80 | #templatemo_slider span.sliderframe { 81 | position: absolute; 82 | top: 0; 83 | left: 0; 84 | width: 960px; 85 | height: 320px; 86 | z-index: 50; 87 | background: url(images/templatemo_slider_frame.png) 88 | } 89 | #templatemo_twitter { 90 | clear: both; 91 | width: 650px; 92 | height: 50px; 93 | padding: 25px 25px 25px 145px; 94 | margin: 0 auto; 95 | margin-bottom: 50px; 96 | font-size: 18px; 97 | line-height: 24px; 98 | color: #333; 99 | background: url(images/twitter.png) no-repeat 100 | } 101 | #templatemo_main { 102 | clear: both; 103 | width: 960px; 104 | margin: 0 auto 40px; 105 | } 106 | #templatemo_bottom_wrapper { 107 | width: 100%; 108 | background: #646464 url(images/templatemo_bottom.png) top repeat-x 109 | } 110 | #templatemo_bottom { 111 | width: 960px; 112 | margin: 0 auto; 113 | padding: 50px 10px 0; 114 | color: #ccc 115 | } 116 | #templatemo_bottom h4 { color: #fff; margin-bottom: 30px } 117 | #templatemo_bottom a { color: #fff } 118 | 119 | #templatemo_footer_wrapper { 120 | width: 100%; 121 | background: url(images/templatemo_footer.png) top repeat-x 122 | } 123 | #templatemo_footer { 124 | width: 960px; 125 | margin: 0 auto; 126 | padding: 20px 10px 10px; 127 | text-align: center 128 | } 129 | .copyrights{text-indent:-9999px;height:0;line-height:0;font-size:0;overflow:hidden;} 130 | ul.footer_gallery li { display: block; float: left; margin: 0 10px 10px 0 } 131 | ul.footer_gallery li img { border: 1px solid #777; padding: 4px; background: #333 } 132 | 133 | #site_title { float: left; 134 | margin-left: 100px; 135 | margin-top: 5px; 136 | font-size: 30px; } 137 | #site_title a { 138 | text-decoration: none; 139 | text-indent: -10000px;} 140 | 141 | #templatemo_menu { float: right; margin-top: 10px } 142 | 143 | #templatemo_page_intro { 144 | clear: both; 145 | height: 96px; 146 | padding: 40px 0; 147 | margin-bottom: 50px; 148 | } 149 | 150 | #templatemo_page_intro h1 { 151 | color: #fff; 152 | margin-bottom: 30px; 153 | } 154 | #templatemo_page_intro p { 155 | color: #eee; 156 | font-size: 18px; 157 | line-height: 22px; 158 | } 159 | 160 | .col { margin: 0 30px 30px 0; float: left } 161 | .col_2 { width: 465px } 162 | .col_3 { width: 300px } 163 | .col_32 { width: 630px } 164 | .col_4 { width: 217.5px } 165 | .col_43 { width: 712.5px } 166 | .col_w216 { width: 216px } 167 | 168 | #templatemo_content { 169 | width: 630px; 170 | } 171 | 172 | #templatemo_sidebar { 173 | width: 300px; 174 | } 175 | 176 | #templatemo_content .col_2 { width: 300px } 177 | #templatemo_content .col_3 { width: 190px } 178 | #templatemo_content .col_32 { width: 410px } 179 | 180 | 181 | #templatemo_sidebar h3 { margin-bottom: 15px } 182 | 183 | .sidebar_section { 184 | margin-bottom: 40px; 185 | } 186 | 187 | .sidebar_section_bg { 188 | padding: 20px; 189 | background: #f3f3f3 190 | } 191 | 192 | .testimonial { 193 | margin-bottom: 40px; 194 | background: url(images/templatemo_testimonial.png) no-repeat top left 195 | } 196 | 197 | .testimonial p.testimonial_text { 198 | display: block; 199 | width: 260px; 200 | height: 157px; 201 | padding: 20px; 202 | margin: 0; 203 | color: #fff; 204 | font-size: 16px; 205 | line-height: 24px; 206 | font-style: italic; 207 | font-family: Georgia, "Times New Roman", Times, serif 208 | } 209 | .testimonial p { color: #333; padding: 0 20px } 210 | 211 | p.image_caption { padding: 20px; background: #f2f2f2 } 212 | 213 | .sidebar_link_list { 214 | margin: 0; 215 | padding: 0; 216 | list-style: none 217 | } 218 | .sidebar_link_list li { 219 | margin: 0; 220 | padding: 10px; 221 | border-bottom: 1px dashed #fff 222 | } 223 | .sidebar_link_list li{ 224 | color: #666; 225 | } 226 | .sidebar_link_list li:hover{ 227 | background: #9FC812; 228 | } 229 | .comment li { color: #999 } 230 | .comment li a { color: #df8601 } 231 | .comment li span { display: block; } 232 | .comment_meta { display: block; padding: 10px 0px; font-size: 10px; } 233 | 234 | 235 | .post-item { clear: both; margin: 0 0 40px 0; padding: 0 0 40px 0; border-bottom: 1px solid #ccc } 236 | .post-item h2 { padding: 0; margin-bottom: 10px } 237 | .post-meta { margin-bottom: 20px; position: relative; } 238 | 239 | .post-meta span.post_comment { position: absolute; font-size: 20px; line-height: 40px; text-align: center; right: 0; top: 0; width: 80px; height: 54px; background: url(images/comment.png) } 240 | 241 | .post-meta img { float: left; margin-right: 20px } 242 | 243 | .last_post { border-bottom: none; padding: 0; } 244 | 245 | .comment_list { margin: 0; padding: 0; list-style: none } 246 | .comment_list .comment_box { padding: 20px; border-bottom: 1px solid #efefef } 247 | .comment_list li { margin-bottom: 20px } 248 | .comment_list li ul { list-style: none; background: none } 249 | .comment_list li ul li { } 250 | .comment_list li ul li .comment_box { background: #eee } 251 | .comment_content { float: right; width: 460px } 252 | .comment_list li ul li.depth_2 .comment_content { width: 420px } 253 | .comment_list li ul li.depth_3 .comment_box { background: #ddd } 254 | .comment_list li ul li.depth_3 .comment_content { width: 380px } 255 | 256 | 257 | #comment_form { margin-top: 40px } 258 | 259 | #comment_form textarea { 260 | color: #666; 261 | background:#fff none repeat fixed 0 0; 262 | border: 1px solid #ccc; 263 | display:block; 264 | font-size:1.1em; 265 | height:150px; 266 | margin-top:5px; 267 | padding:5px; 268 | width: 360px; 269 | } 270 | 271 | #comment_form .form_row { 272 | width: 100%; 273 | margin-bottom: 15px; 274 | } 275 | 276 | #comment_form form input { 277 | color: #666; 278 | margin-top: 5px; 279 | padding: 3px 0; 280 | width: 200px; 281 | background:#fff none repeat fixed 0 0; 282 | border: 1px solid #ccc; 283 | } 284 | 285 | #contact_form { padding: 0; margin-bottom: 40px; width: 630px; } 286 | #contact_form form { margin: 0px; padding: 0px; } 287 | 288 | #contact_form form .input_field { 289 | width: 290px; 290 | padding: 5px; 291 | margin-bottom: 20px; 292 | color: #808b98; 293 | background: #fff; 294 | border: 1px solid #dedede; 295 | font-family: Verdana, Arial, Helvetica, sans-serif; 296 | } 297 | #contact_form form label { 298 | display: block; 299 | width: 300px; 300 | margin-bottom: 10px; 301 | font-size: 11px 302 | } 303 | 304 | #contact_form form textarea { 305 | width: 290px; 306 | height: 170px; 307 | padding: 5px; 308 | margin-bottom: 10px; 309 | color: #808b98; 310 | background: #fff; 311 | border: 1px solid #dedede; 312 | font-family: Verdana, Arial, Helvetica, sans-serif; 313 | } 314 | 315 | #contact_form .submit_btn, #comment_form .submit_btn { 316 | display: block; 317 | width: 70px; 318 | height: 30px; 319 | line-height: 30px; 320 | padding: 0 8px; 321 | text-align: center; 322 | text-decoration: none; 323 | font-weight: bold; 324 | background-color: #91c63e; 325 | border: 1px solid #5f8c19; 326 | color: #fff; 327 | font-size: 11px; 328 | cursor: pointer; 329 | } 330 | 331 | #templatemo_footer .col_3 { 332 | width: 300px; 333 | } 334 | 335 | #templatemo_footer h4 { margin-bottom: 15px } 336 | #templatemo_footer a { color: #000 } 337 | 338 | ul.social li { margin: 0; padding: 5px 0; display: block; width: 150px; float: left; } 339 | ul.social li a { 340 | display: block; 341 | padding: 5px 0 5px 40px; 342 | height: 32px; 343 | line-height: 32px; 344 | font-size: 12px; 345 | background-position: left center; 346 | background-repeat: no-repeat 347 | } 348 | 349 | #templatemo_bottom li a.rower {text-decoration:none; color:#ccc; cursor:text;} 350 | 351 | ul.social li a.facebook { background-image: url(images/facebook.png) } 352 | ul.social li a.twitter { background-image: url(images/twitter2.png) } 353 | ul.social li a.youtube { background-image: url(images/youtube.png) } 354 | ul.social li a.vimeo { background-image: url(images/vimeo.png) } 355 | ul.social li a.google { background-image: url(images/google.png) } 356 | ul.social li a.skype { background-image: url(images/skype.png) } 357 | 358 | ul.twitter li { margin: 0 0 20px 0; padding: 0 } 359 | 360 | .templatemo_paging { margin: 0 0 20px; padding: 0 } 361 | .templatemo_paging ul { margin: 0; padding: 0; list-style: none } 362 | .templatemo_paging ul li { margin: 0; padding: 0; display: inline } 363 | 364 | .templatemo_paging ul li a { float: left; 365 | display: block; 366 | color: #666; 367 | text-decoration: none; 368 | margin-right: 5px; 369 | padding: 5px 10px; 370 | background: #ebe7e4; 371 | border: 1px solid #d6d0cc; 372 | } 373 | 374 | .templatemo_paging ul li a:hover { color: #fff; background: #91c63e; border: 1px solid #5f8c19 } 375 | 376 | .no_mr { margin-right: 0 } -------------------------------------------------------------------------------- /vendor/cz/framework/src/Model.php: -------------------------------------------------------------------------------- 1 | host = $config['DB_HOST']; 26 | $this->user =$config['DB_USER']; 27 | $this->pwd = $config['DB_PWD']; 28 | $this->dbName = $config['DB_NAME']; 29 | $this->charset = $config['DB_CHARSET']; 30 | $this->prefix = $config['DB_PREFIX']; 31 | 32 | $this->table = $this->getTable(); 33 | $this->options = $this->initOptions(); 34 | $this->link = $this->sql_connect(); 35 | 36 | $cache= $config['DB_CACHE']; 37 | if($this->checkDir($cache)){ 38 | $this->cacheDir = $cache; 39 | }else{ 40 | exit('缓存目录不存在!'); 41 | } 42 | 43 | $this->cacheField = $this->initCache(); 44 | 45 | } 46 | //初始化参数数组 47 | protected function initOptions() 48 | { 49 | return [ 50 | 'field'=>'*', 51 | 'table'=>$this->table, 52 | 'where'=>'', 53 | 'group'=>'', 54 | 'order'=>'', 55 | 'having'=>'', 56 | 'limit'=>'', 57 | 'values'=>'' 58 | 59 | ]; 60 | 61 | } 62 | protected function initCache() 63 | { 64 | //获取缓存的表字段文件路径 65 | $path = rtrim($this->cacheDir,'/').'/'.$this->table.'.php'; 66 | if(file_exists($path)){ 67 | return include $path; 68 | } 69 | //查表结构获取所有字段名 70 | $sql = ' desc '. $this->table; 71 | // $data = $this->query($sql,MYSQLI_ASSOC); 72 | $result = mysqli_query($this->link,$sql); 73 | 74 | while($rows = mysqli_fetch_assoc($result)){ 75 | //把主键也添加到数组 76 | if($rows['Key'] == 'PRI'){ 77 | $field['PRI'] = $rows['Field']; 78 | } 79 | $field[] = $rows['Field']; 80 | 81 | } 82 | //生成字段数组语法形式 83 | $str = "table)) 97 | { 98 | return $this->prefix.$this->table; 99 | } 100 | //从类名获得表名 101 | //获取当前对象的类名,并且转换为小写 102 | $className = strtolower(get_class($this)); 103 | //app\index\UserModel 104 | //用反斜线分割类名 105 | $className = explode('\\',$className); 106 | $className= array_pop($className); 107 | if(stripos($className, 'model') === false){ 108 | return $this->prefix.$className; 109 | } 110 | $table = substr($className,0,-5); 111 | return $this->prefix.$table; 112 | } 113 | /** 114 | * 检查缓存目录,如果不存在就创建该目录 115 | * @param [type] $dir [description] 116 | * @return [type] [description] 117 | */ 118 | protected function checkDir($dir) 119 | { 120 | if(!is_dir($dir)){ 121 | return mkdir($dir,0777,true); 122 | } 123 | if(!is_readable($dir) || !is_writable($dir)) 124 | { 125 | return chmod($dir, 0777); 126 | } 127 | return true; 128 | } 129 | 130 | /** 131 | * 连接数据库 132 | * @return [type] [description] 133 | */ 134 | public function sql_connect() 135 | { 136 | $link = mysqli_connect($this->host,$this->user,$this->pwd); 137 | if(!$link){ 138 | exit('连接数据库失败!'); 139 | } 140 | if(!mysqli_select_db($link,$this->dbName)){ 141 | mysqli_close($link); 142 | exit('选择数据库失败!'); 143 | } 144 | if(!mysqli_set_charset($link,$this->charset)) 145 | { 146 | mysqli_close($link); 147 | exit('设置字符集失败!'); 148 | } 149 | return $link; 150 | 151 | } 152 | //联表查询 153 | public function table(string $table) 154 | { 155 | //"user,php_blog" 156 | $tables = explode(',',$table); 157 | foreach ($tables as $key => $value) { 158 | $tbName = ltrim($value,$this->prefix); 159 | $tbName = $this->prefix.$tbName; 160 | $tables[$key] = $tbName; 161 | } 162 | $this->options['table'] = join(',',$tables); 163 | return $this; 164 | } 165 | /** 166 | * 获取查询条件 167 | * @param [type] $where [查询条件] 168 | * @return [type] [返回查询条件] 169 | */ 170 | public function where($where) 171 | { 172 | //['uid=0','name=aa'] 173 | if(is_string($where)) 174 | { 175 | $this->options['where'] = ' where '.$where; 176 | }else if(is_array($where)){ 177 | $this->options['where'] = ' where '.join(' and ',$where); 178 | } 179 | return $this; 180 | } 181 | /** 182 | * 获取分组条件 183 | * @param [type] $group [分组条件] 184 | * @return [type] [返回分组条件] 185 | */ 186 | public function group($group) 187 | { 188 | if(is_string($group)) 189 | { 190 | $this->options['group'] = ' group by '.$group; 191 | }else if(is_array($group)){ 192 | $this->options['group'] = ' group by '.join(',',$group); 193 | } 194 | return $this; 195 | } 196 | /** 197 | * 获取排序条件 198 | * @param [type] $order [排序条件] 199 | * @return [type] [返回排序条件] 200 | */ 201 | public function order($order) 202 | { 203 | if(is_string($order)) 204 | { 205 | $this->options['order'] = ' order by '.$order; 206 | }else if(is_array($order)){ 207 | $this->options['order'] = ' order by '.join(',',$order); 208 | } 209 | return $this; 210 | } 211 | /** 212 | * 获取分组过滤条件 213 | * @param [type] $having [分组过滤条件] 214 | * @return [type] [返回分组过滤条件] 215 | */ 216 | public function having($having) 217 | { 218 | if(is_string($having)) 219 | { 220 | $this->options['having'] = ' having '.$having; 221 | }else if(is_array($having)){ 222 | $this->options['having'] = ' having '.join(' and ',$having); 223 | } 224 | return $this; 225 | } 226 | /** 227 | * 获取limit条件 228 | * @param [type] $limit [limit条件] 229 | * @return [type] [返回limit条件] 230 | */ 231 | public function limit($limit) 232 | { 233 | if(is_string($limit)) 234 | { 235 | $this->options['limit'] = ' limit '.$limit; 236 | }else if(is_array($limit)){ 237 | $this->options['limit'] = ' limit '.join(',',$limit); 238 | } 239 | return $this; 240 | } 241 | /** 242 | * 获取字段列表 243 | * @param [type] $field [字段列表] 244 | * @return [type] [返回字段列表] 245 | */ 246 | public function field($field) 247 | { 248 | if(is_string($field)) 249 | { 250 | $this->options['field'] = $field; 251 | }else if(is_array($field)){ 252 | $this->options['field'] = join(',',$field); 253 | } 254 | return $this; 255 | } 256 | 257 | /** 258 | * 查询数据库 259 | * @param [type] $resultType [查询结果类型] 260 | * @return [type] [返回查询结果集] 261 | */ 262 | public function select($resultType= MYSQLI_BOTH) 263 | { 264 | //select uid,username from bbs_user where uid<100 group by uid having uid>0 order by uid limit 5"; 265 | $sql = 'SELECT %FIELD% FROM %TABLE% %WHERE% %GROUP% %HAVING% %ORDER% %LIMIT%'; 266 | 267 | $sql = str_replace( 268 | ['%FIELD%','%TABLE%','%WHERE%','%GROUP%','%HAVING%','%ORDER%','%LIMIT%'], 269 | 270 | [ $this->options['field'], 271 | $this->options['table'], 272 | $this->options['where'], 273 | $this->options['group'], 274 | $this->options['having'], 275 | $this->options['order'], 276 | $this->options['limit'], 277 | 278 | ],$sql); 279 | return $this->query($sql,$resultType); 280 | } 281 | /** 282 | * 执行sql语句,并返回查询结果 283 | * @param [type] $sql [sql语句] 284 | * @param [type] $resultType [查询结果类型] 285 | * @return [type] [] 286 | */ 287 | public function query($sql,$resultType) 288 | { 289 | //给sql赋值 290 | $this->sql = $sql; 291 | //清空参数数组 292 | $this->options=$this->initOptions(); 293 | //执行sql语句 294 | $result = mysqli_query($this->link,$sql); 295 | if($result && mysqli_affected_rows($this->link)>0){ 296 | return mysqli_fetch_all($result,$resultType); 297 | } 298 | return false; 299 | 300 | } 301 | public function delete() 302 | { 303 | $sql = "DELETE FROM %TABLE% %WHERE% %ORDER% %LIMIT%"; 304 | $sql = str_replace(['%TABLE%','%WHERE%','%ORDER%','%LIMIT%'], 305 | [ 306 | $this->options['table'], 307 | $this->options['where'], 308 | $this->options['order'], 309 | $this->options['limit'] 310 | 311 | ],$sql); 312 | // var_dump($sql);die; 313 | return $this->exec($sql); 314 | 315 | } 316 | /** 317 | * 更新数据库 318 | * @param array $data [description] 319 | * @return [type] [description] 320 | */ 321 | public function update(array $data) 322 | { 323 | //给字符数据添加单引号 324 | $data = $this->addQuote($data); 325 | 326 | //过滤无效字段 327 | $data = $this->validField($data); 328 | //拼接修改字段数组值为字符串 329 | $data = $this->setString($data); 330 | $this->options['values'] = $data; 331 | $sql = "UPDATE %TABLE% SET %VALUES% %WHERE% %ORDER% %LIMIT% "; 332 | 333 | $sql = str_replace( ['%TABLE%','%VALUES%','%WHERE%','%ORDER%','%LIMIT%'], 334 | [ 335 | $this->options['table'], 336 | $this->options['values'], 337 | $this->options['where'], 338 | $this->options['order'], 339 | $this->options['limit'] 340 | 341 | ],$sql); 342 | 343 | return $this->exec($sql); 344 | 345 | } 346 | //拼接修改字段数组值为字符串 347 | protected function setString($data) 348 | { 349 | $str = ''; 350 | foreach ($data as $k => $v) { 351 | $str .= $k.'='.$v.','; 352 | } 353 | return rtrim($str,','); 354 | } 355 | /** 356 | * 向数据库插入数据 357 | * @param array $data [description] 358 | * @return [type] [description] 359 | */ 360 | public function insert(array $data,$isInsertId = false) 361 | { 362 | //给字符数据添加单引号 363 | $data = $this->addQuote($data); 364 | 365 | //过滤无效字段 366 | $data = $this->validField($data); 367 | //拼接插入的字段 368 | $this->options['field']= join(',',array_keys($data)); 369 | //拼接插入的值 370 | $this->options['values'] = join(',',array_values($data)); 371 | $sql = 'INSERT INTO %TABLE%(%FIELD%) VALUES(%VALUES%)'; 372 | 373 | $sql = str_replace( 374 | ['%TABLE%','%FIELD%','%VALUES%'], 375 | 376 | [ 377 | $this->options['table'], 378 | $this->options['field'], 379 | $this->options['values'], 380 | 381 | ], $sql); 382 | return $this->exec($sql,$isInsertId); 383 | 384 | } 385 | 386 | //给字符数据添加单引号 387 | protected function addQuote($data) 388 | { 389 | if(is_array($data)){ 390 | foreach ($data as $key => $value) { 391 | if(is_string($value)) 392 | { 393 | $data[$key] = "'$value'"; 394 | } 395 | } 396 | } 397 | return $data; 398 | } 399 | //过滤无效的字段 400 | protected function validField($data) 401 | { 402 | //['id' =>1,'username' => 'aa'] 403 | //0 => 'id',1 => 'username', 404 | //将缓存的表字段键值对调 405 | $field = array_flip($this->cacheField); 406 | 407 | //使用键名比较计算数组的交集 408 | $data = array_intersect_key($data, $field); 409 | return $data; 410 | } 411 | /** 412 | * 执行增删改语句 413 | * @param [type] $sql [sql语句] 414 | * @param boolean $isInsertId [是否返回自增主键的值] 415 | * @return [type] [如果执行成功,isInsertId为真,返回主键值,否则返回true,失败返回false] 416 | */ 417 | public function exec($sql,$isInsertId= false) 418 | { 419 | //给sql赋值 420 | $this->sql = $sql; 421 | //清空参数数组 422 | $this->options=$this->initOptions(); 423 | //执行sql语句 424 | $result = mysqli_query($this->link,$sql); 425 | if($result && $isInsertId){ 426 | //返回插入位置的主键id的值 427 | return mysqli_insert_id($this->link); 428 | } 429 | return $result; 430 | } 431 | /** 432 | * 魔术方法实现不可访问方法getBy__ 433 | * @param [type] $name [方法名] 434 | * @param [type] $value [参数值] 435 | * @return [type] [description] 436 | */ 437 | public function __call($name,$value) 438 | { 439 | if(substr($name,0,5) == 'getBy'){ 440 | $name = substr($name, 5); 441 | return $this->getBy($name,$value); 442 | } 443 | 444 | } 445 | /** 446 | * [根据字段获取记录] 447 | * @param [type] $name [字段名] 448 | * @param [type] $value [字段值] 449 | * @return [type] [记录的关联数组] 450 | */ 451 | protected function getBy($name,$value) 452 | { 453 | $name = strtolower($name); 454 | if(count($value)>0){ 455 | if(is_string($value[0])){ 456 | $this->options['where'] = 'where '.$name.'='."'".$value[0]."'"; 457 | }else{ 458 | $this->options['where'] = 'where '.$name.'='.$value[0]; 459 | } 460 | 461 | return $this->select(MYSQLI_ASSOC); 462 | } 463 | 464 | } 465 | /** 466 | * 获取最后执行的sql 467 | * @param [type] $name [属性名] 468 | * @return [type] [返回sql] 469 | */ 470 | public function __get($name) 471 | { 472 | if ('sql' ==$name) { 473 | return $this->sql; 474 | } 475 | } 476 | 477 | // 1 实现find方法,只返回查询结果的第一条语句 478 | public function find() 479 | { 480 | return $this->order('id')->limit('1')->select(MYSQLI_ASSOC); 481 | } 482 | 483 | // 2 实现setField(字段名,字段值),更新特定记录的指定字段的值 484 | public function setField($fieldName,$value) 485 | { 486 | if(is_string($value)){ 487 | 488 | $this->options['values'] = $fieldName.'='."'".$value."'"; 489 | }else{ 490 | 491 | $this->options['values'] = $fieldName.'='.$value; 492 | } 493 | $sql = "UPDATE %TABLE% SET %VALUES% %WHERE% %ORDER% %LIMIT% "; 494 | 495 | $sql = str_replace( ['%TABLE%','%VALUES%','%WHERE%','%ORDER%','%LIMIT%'], 496 | [ 497 | $this->options['table'], 498 | $this->options['values'], 499 | $this->options['where'], 500 | $this->options['order'], 501 | $this->options['limit'] 502 | 503 | ],$sql); 504 | 505 | return $this->exec($sql); 506 | } 507 | 508 | } 509 | -------------------------------------------------------------------------------- /public/index/js/jquery.nivo.slider.pack.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Nivo Slider v2.6 3 | * http://nivo.dev7studios.com 4 | * 5 | * Copyright 2011, Gilbert Pellegrom 6 | * Free to use and abuse under the MIT license. 7 | * http://www.opensource.org/licenses/mit-license.php 8 | * 9 | * March 2010 10 | */ 11 | 12 | (function($){var NivoSlider=function(element,options){var settings=$.extend({},$.fn.nivoSlider.defaults,options);var vars={currentSlide:0,currentImage:'',totalSlides:0,randAnim:'',running:false,paused:false,stop:false};var slider=$(element);slider.data('nivo:vars',vars);slider.css('position','relative');slider.addClass('nivoSlider');var kids=slider.children();kids.each(function(){var child=$(this);var link='';if(!child.is('img')){if(child.is('a')){child.addClass('nivo-imageLink');link=child;} 13 | child=child.find('img:first');} 14 | var childWidth=child.width();if(childWidth==0)childWidth=child.attr('width');var childHeight=child.height();if(childHeight==0)childHeight=child.attr('height');if(childWidth>slider.width()){slider.width(childWidth);} 15 | if(childHeight>slider.height()){slider.height(childHeight);} 16 | if(link!=''){link.css('display','none');} 17 | child.css('display','none');vars.totalSlides++;});if(settings.startSlide>0){if(settings.startSlide>=vars.totalSlides)settings.startSlide=vars.totalSlides-1;vars.currentSlide=settings.startSlide;} 18 | if($(kids[vars.currentSlide]).is('img')){vars.currentImage=$(kids[vars.currentSlide]);}else{vars.currentImage=$(kids[vars.currentSlide]).find('img:first');} 19 | if($(kids[vars.currentSlide]).is('a')){$(kids[vars.currentSlide]).css('display','block');} 20 | slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');slider.append($('

').css({display:'none',opacity:settings.captionOpacity}));var processCaption=function(settings){var nivoCaption=$('.nivo-caption',slider);if(vars.currentImage.attr('title')!=''&&vars.currentImage.attr('title')!=undefined){var title=vars.currentImage.attr('title');if(title.substr(0,1)=='#')title=$(title).html();if(nivoCaption.css('display')=='block'){nivoCaption.find('p').fadeOut(settings.animSpeed,function(){$(this).html(title);$(this).fadeIn(settings.animSpeed);});}else{nivoCaption.find('p').html(title);} 21 | nivoCaption.fadeIn(settings.animSpeed);}else{nivoCaption.fadeOut(settings.animSpeed);}} 22 | processCaption(settings);var timer=0;if(!settings.manualAdvance&&kids.length>1){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);} 23 | if(settings.directionNav){slider.append('');if(settings.directionNavHide){$('.nivo-directionNav',slider).hide();slider.hover(function(){$('.nivo-directionNav',slider).show();},function(){$('.nivo-directionNav',slider).hide();});} 24 | $('a.nivo-prevNav',slider).live('click',function(){if(vars.running)return false;clearInterval(timer);timer='';vars.currentSlide-=2;nivoRun(slider,kids,settings,'prev');});$('a.nivo-nextNav',slider).live('click',function(){if(vars.running)return false;clearInterval(timer);timer='';nivoRun(slider,kids,settings,'next');});} 25 | if(settings.controlNav){var nivoControl=$('
');slider.append(nivoControl);for(var i=0;i');}else{nivoControl.append('');}}else{nivoControl.append(''+(i+1)+'');}} 27 | $('.nivo-controlNav a:eq('+vars.currentSlide+')',slider).addClass('active');$('.nivo-controlNav a',slider).live('click',function(){if(vars.running)return false;if($(this).hasClass('active'))return false;clearInterval(timer);timer='';slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');vars.currentSlide=$(this).attr('rel')-1;nivoRun(slider,kids,settings,'control');});} 28 | if(settings.keyboardNav){$(window).keypress(function(event){if(event.keyCode=='37'){if(vars.running)return false;clearInterval(timer);timer='';vars.currentSlide-=2;nivoRun(slider,kids,settings,'prev');} 29 | if(event.keyCode=='39'){if(vars.running)return false;clearInterval(timer);timer='';nivoRun(slider,kids,settings,'next');}});} 30 | if(settings.pauseOnHover){slider.hover(function(){vars.paused=true;clearInterval(timer);timer='';},function(){vars.paused=false;if(timer==''&&!settings.manualAdvance){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);}});} 31 | slider.bind('nivo:animFinished',function(){vars.running=false;$(kids).each(function(){if($(this).is('a')){$(this).css('display','none');}});if($(kids[vars.currentSlide]).is('a')){$(kids[vars.currentSlide]).css('display','block');} 32 | if(timer==''&&!vars.paused&&!settings.manualAdvance){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);} 33 | settings.afterChange.call(this);});var createSlices=function(slider,settings,vars){for(var i=0;i
').css({left:(sliceWidth*i)+'px',width:(slider.width()-(sliceWidth*i))+'px',height:'0px',opacity:'0',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((sliceWidth+(i*sliceWidth))-sliceWidth)+'px 0%'}));}else{slider.append($('
').css({left:(sliceWidth*i)+'px',width:sliceWidth+'px',height:'0px',opacity:'0',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((sliceWidth+(i*sliceWidth))-sliceWidth)+'px 0%'}));}}} 34 | var createBoxes=function(slider,settings,vars){var boxWidth=Math.round(slider.width()/settings.boxCols);var boxHeight=Math.round(slider.height()/settings.boxRows);for(var rows=0;rows
').css({opacity:0,left:(boxWidth*cols)+'px',top:(boxHeight*rows)+'px',width:(slider.width()-(boxWidth*cols))+'px',height:boxHeight+'px',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((boxWidth+(cols*boxWidth))-boxWidth)+'px -'+((boxHeight+(rows*boxHeight))-boxHeight)+'px'}));}else{slider.append($('
').css({opacity:0,left:(boxWidth*cols)+'px',top:(boxHeight*rows)+'px',width:boxWidth+'px',height:boxHeight+'px',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((boxWidth+(cols*boxWidth))-boxWidth)+'px -'+((boxHeight+(rows*boxHeight))-boxHeight)+'px'}));}}}} 35 | var nivoRun=function(slider,kids,settings,nudge){var vars=slider.data('nivo:vars');if(vars&&(vars.currentSlide==vars.totalSlides-1)){settings.lastSlide.call(this);} 36 | if((!vars||vars.stop)&&!nudge)return false;settings.beforeChange.call(this);if(!nudge){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}else{if(nudge=='prev'){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');} 37 | if(nudge=='next'){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}} 38 | vars.currentSlide++;if(vars.currentSlide==vars.totalSlides){vars.currentSlide=0;settings.slideshowEnd.call(this);} 39 | if(vars.currentSlide<0)vars.currentSlide=(vars.totalSlides-1);if($(kids[vars.currentSlide]).is('img')){vars.currentImage=$(kids[vars.currentSlide]);}else{vars.currentImage=$(kids[vars.currentSlide]).find('img:first');} 40 | if(settings.controlNav){$('.nivo-controlNav a',slider).removeClass('active');$('.nivo-controlNav a:eq('+vars.currentSlide+')',slider).addClass('active');} 41 | processCaption(settings);$('.nivo-slice',slider).remove();$('.nivo-box',slider).remove();if(settings.effect=='random'){var anims=new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade','boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');vars.randAnim=anims[Math.floor(Math.random()*(anims.length+1))];if(vars.randAnim==undefined)vars.randAnim='fade';} 42 | if(settings.effect.indexOf(',')!=-1){var anims=settings.effect.split(',');vars.randAnim=anims[Math.floor(Math.random()*(anims.length))];if(vars.randAnim==undefined)vars.randAnim='fade';} 43 | vars.running=true;if(settings.effect=='sliceDown'||settings.effect=='sliceDownRight'||vars.randAnim=='sliceDownRight'||settings.effect=='sliceDownLeft'||vars.randAnim=='sliceDownLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceDownLeft'||vars.randAnim=='sliceDownLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);slice.css({'top':'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));} 44 | timeBuff+=50;i++;});} 45 | else if(settings.effect=='sliceUp'||settings.effect=='sliceUpRight'||vars.randAnim=='sliceUpRight'||settings.effect=='sliceUpLeft'||vars.randAnim=='sliceUpLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceUpLeft'||vars.randAnim=='sliceUpLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);slice.css({'bottom':'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));} 46 | timeBuff+=50;i++;});} 47 | else if(settings.effect=='sliceUpDown'||settings.effect=='sliceUpDownRight'||vars.randAnim=='sliceUpDown'||settings.effect=='sliceUpDownLeft'||vars.randAnim=='sliceUpDownLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var v=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceUpDownLeft'||vars.randAnim=='sliceUpDownLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);if(i==0){slice.css('top','0px');i++;}else{slice.css('bottom','0px');i=0;} 48 | if(v==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));} 49 | timeBuff+=50;v++;});} 50 | else if(settings.effect=='fold'||vars.randAnim=='fold'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;$('.nivo-slice',slider).each(function(){var slice=$(this);var origWidth=slice.width();slice.css({top:'0px',height:'100%',width:'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({width:origWidth,opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({width:origWidth,opacity:'1.0'},settings.animSpeed);},(100+timeBuff));} 51 | timeBuff+=50;i++;});} 52 | else if(settings.effect=='fade'||vars.randAnim=='fade'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':slider.width()+'px'});firstSlice.animate({opacity:'1.0'},(settings.animSpeed*2),'',function(){slider.trigger('nivo:animFinished');});} 53 | else if(settings.effect=='slideInRight'||vars.randAnim=='slideInRight'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':'0px','opacity':'1'});firstSlice.animate({width:slider.width()+'px'},(settings.animSpeed*2),'',function(){slider.trigger('nivo:animFinished');});} 54 | else if(settings.effect=='slideInLeft'||vars.randAnim=='slideInLeft'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':'0px','opacity':'1','left':'','right':'0px'});firstSlice.animate({width:slider.width()+'px'},(settings.animSpeed*2),'',function(){firstSlice.css({'left':'0px','right':''});slider.trigger('nivo:animFinished');});} 55 | else if(settings.effect=='boxRandom'||vars.randAnim=='boxRandom'){createBoxes(slider,settings,vars);var totalBoxes=settings.boxCols*settings.boxRows;var i=0;var timeBuff=0;var boxes=shuffle($('.nivo-box',slider));boxes.each(function(){var box=$(this);if(i==totalBoxes-1){setTimeout(function(){box.animate({opacity:'1'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){box.animate({opacity:'1'},settings.animSpeed);},(100+timeBuff));} 56 | timeBuff+=20;i++;});} 57 | else if(settings.effect=='boxRain'||vars.randAnim=='boxRain'||settings.effect=='boxRainReverse'||vars.randAnim=='boxRainReverse'||settings.effect=='boxRainGrow'||vars.randAnim=='boxRainGrow'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){createBoxes(slider,settings,vars);var totalBoxes=settings.boxCols*settings.boxRows;var i=0;var timeBuff=0;var rowIndex=0;var colIndex=0;var box2Darr=new Array();box2Darr[rowIndex]=new Array();var boxes=$('.nivo-box',slider);if(settings.effect=='boxRainReverse'||vars.randAnim=='boxRainReverse'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){boxes=$('.nivo-box',slider)._reverse();} 58 | boxes.each(function(){box2Darr[rowIndex][colIndex]=$(this);colIndex++;if(colIndex==settings.boxCols){rowIndex++;colIndex=0;box2Darr[rowIndex]=new Array();}});for(var cols=0;cols<(settings.boxCols*2);cols++){var prevCol=cols;for(var rows=0;rows=0&&prevCol=0){ 104 | for(var i=0;i<$checkdata.length;i++){ 105 | var $checktype=$checkdata[i].split(':'); 106 | if(! $pintuercheck(e,$checktype[0],$checkvalue)){ 107 | $checkstate=false; 108 | $checktext=$checktext+"
  • "+$checktype[1]+"
  • "; 109 | } 110 | } 111 | }; 112 | if($checkstate){ 113 | e.closest('.form-group').removeClass("check-error"); 114 | e.parent().find(".input-help").remove(); 115 | e.closest('.form-group').addClass("check-success"); 116 | }else{ 117 | e.closest('.form-group').removeClass("check-success"); 118 | e.closest('.form-group').addClass("check-error"); 119 | e.closest('.field').append('
      '+$checktext+'
    '); 120 | } 121 | } 122 | }); 123 | $pintuercheck=function(element,type,value){ 124 | $pintu=value.replace(/(^\s*)|(\s*$)/g, ""); 125 | switch(type){ 126 | case "required":return /[^(^\s*)|(\s*$)]/.test($pintu);break; 127 | case "chinese":return /^[\u0391-\uFFE5]+$/.test($pintu);break; 128 | case "number":return /^\d+$/.test($pintu);break; 129 | case "integer":return /^[-\+]?\d+$/.test($pintu);break; 130 | case "plusinteger":return /^[+]?\d+$/.test($pintu);break; 131 | case "double":return /^[-\+]?\d+(\.\d+)?$/.test($pintu);break; 132 | case "plusdouble":return /^[+]?\d+(\.\d+)?$/.test($pintu);break; 133 | case "english":return /^[A-Za-z]+$/.test($pintu);break; 134 | case "username":return /^[a-z]\w{3,}$/i.test($pintu);break; 135 | case "mobile":return /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$|170\d{8}?$|147\d{8}?$/.test($pintu);break; 136 | case "phone":return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/.test($pintu);break; 137 | case "tel":return /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$|170\d{8}?$|147\d{8}?$/.test($pintu) || /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/.test($pintu);break; 138 | case "email":return /^[^@]+@[^@]+\.[^@]+$/.test($pintu);break; 139 | case "url":return /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/.test($pintu);break; 140 | case "ip":return /^[\d\.]{7,15}$/.test($pintu);break; 141 | case "qq":return /^[1-9]\d{4,10}$/.test($pintu);break; 142 | case "currency":return /^\d+(\.\d+)?$/.test($pintu);break; 143 | case "zip":return /^[1-9]\d{5}$/.test($pintu);break; 144 | case "radio": 145 | var radio=element.closest('form').find('input[name="'+element.attr("name")+'"]:checked').length; 146 | return eval(radio==1); 147 | break; 148 | default: 149 | var $test=type.split('#'); 150 | if($test.length>1){ 151 | switch($test[0]){ 152 | case "compare": 153 | return eval(Number($pintu)+$test[1]); 154 | break; 155 | case "regexp": 156 | return new RegExp($test[1],"gi").test($pintu); 157 | break; 158 | case "length": 159 | var $length; 160 | if(element.attr("type")=="checkbox"){ 161 | $length=element.closest('form').find('input[name="'+element.attr("name")+'"]:checked').length; 162 | }else{ 163 | $length=$pintu.replace(/[\u4e00-\u9fa5]/g,"***").length; 164 | } 165 | return eval($length+$test[1]); 166 | break; 167 | case "ajax": 168 | var $getdata; 169 | var $url=$test[1]+$pintu; 170 | $.ajaxSetup({async:false}); 171 | $.getJSON($url,function(data){ 172 | //alert(data.getdata); 173 | $getdata=data.getdata; 174 | }); 175 | if($getdata=="true"){return true;} 176 | break; 177 | case "repeat": 178 | return $pintu==jQuery('input[name="'+$test[1]+'"]').eq(0).val(); 179 | break; 180 | default:return true;break; 181 | } 182 | break; 183 | }else{ 184 | return true; 185 | } 186 | } 187 | }; 188 | $('form').submit(function(){ 189 | $(this).find('input[data-validate],textarea[data-validate],select[data-validate]').trigger("blur"); 190 | $(this).find('input[placeholder],textarea[placeholder]').each(function(){$hideplaceholder($(this));}); 191 | var numError = $(this).find('.check-error').length; 192 | if(numError){ 193 | $(this).find('.check-error').first().find('input[data-validate],textarea[data-validate],select[data-validate]').first().focus().select(); 194 | return false; 195 | } 196 | }); 197 | $('.form-reset').click(function(){ 198 | $(this).closest('form').find(".input-help").remove(); 199 | $(this).closest('form').find('.form-submit').removeAttr('disabled'); 200 | $(this).closest('form').find('.form-group').removeClass("check-error"); 201 | $(this).closest('form').find('.form-group').removeClass("check-success"); 202 | }); 203 | $('.tab .tab-nav li').each(function(){ 204 | var e=$(this); 205 | var trigger=e.closest('.tab').attr("data-toggle"); 206 | if (trigger=="hover"){ 207 | e.mouseover(function(){ 208 | $showtabs(e); 209 | }); 210 | e.click(function(){ 211 | return false; 212 | }); 213 | }else{ 214 | e.click(function(){ 215 | $showtabs(e); 216 | return false; 217 | }); 218 | } 219 | }); 220 | $showtabs=function(e){ 221 | var detail=e.children("a").attr("href"); 222 | e.closest('.tab .tab-nav').find("li").removeClass("active"); 223 | e.closest('.tab').find(".tab-body .tab-panel").removeClass("active"); 224 | e.addClass("active"); 225 | $(detail).addClass("active"); 226 | }; 227 | $('.dialogs').each(function(){ 228 | var e=$(this); 229 | var trigger=e.attr("data-toggle"); 230 | if (trigger=="hover"){ 231 | e.mouseover(function(){ 232 | $showdialogs(e); 233 | }); 234 | }else if(trigger=="click"){ 235 | e.click(function(){ 236 | $showdialogs(e); 237 | }); 238 | } 239 | }); 240 | $showdialogs=function(e){ 241 | var trigger=e.attr("data-toggle"); 242 | var getid=e.attr("data-target"); 243 | var data=e.attr("data-url"); 244 | var mask=e.attr("data-mask"); 245 | var width=e.attr("data-width"); 246 | var detail=""; 247 | var masklayout=$('
    '); 248 | if(width==null){width="80%";} 249 | 250 | if (mask=="1"){ 251 | $("body").append(masklayout); 252 | } 253 | detail='
    '; 254 | if(getid!=null){detail=detail+$(getid).html();} 255 | if(data!=null){detail=detail+$.ajax({url:data,async:false}).responseText;} 256 | //alert(detail); 257 | detail=detail+'
    '; 258 | 259 | var win=$(detail); 260 | win.find(".dialog").addClass("open"); 261 | $("body").append(win); 262 | var x=parseInt($(window).width()-win.outerWidth())/2; 263 | var y=parseInt($(window).height()-win.outerHeight())/2; 264 | if (y<=10){y="10"} 265 | win.css({"left":x,"top":y}); 266 | win.find(".dialog-close,.close").each(function(){ 267 | $(this).click(function(){ 268 | win.remove(); 269 | $('.dialog-mask').remove(); 270 | }); 271 | }); 272 | masklayout.click(function(){ 273 | win.remove(); 274 | $(this).remove(); 275 | }); 276 | }; 277 | $('.tips').each(function(){ 278 | var e=$(this); 279 | var title=e.attr("title"); 280 | var trigger=e.attr("data-toggle"); 281 | e.attr("title",""); 282 | if (trigger=="" || trigger==null){trigger="hover";} 283 | if (trigger=="hover"){ 284 | e.mouseover(function(){ 285 | $showtips(e,title); 286 | }); 287 | }else if(trigger=="click"){ 288 | e.click(function(){ 289 | $showtips(e,title); 290 | }); 291 | }else if(trigger=="show"){ 292 | e.ready(function(){ 293 | $showtips(e,title); 294 | }); 295 | } 296 | }); 297 | $showtips=function(e,title){ 298 | var trigger=e.attr("data-toggle"); 299 | var place=e.attr("data-place"); 300 | var width=e.attr("data-width"); 301 | var css=e.attr("data-style"); 302 | var image=e.attr("data-image"); 303 | var content=e.attr("content"); 304 | var getid=e.attr("data-target"); 305 | var data=e.attr("data-url"); 306 | var x=0; 307 | var y=0; 308 | var html=""; 309 | var detail=""; 310 | 311 | if(image!=null){detail=detail+'';} 312 | if(content!=null){detail=detail+'

    '+content+'

    ';} 313 | if(getid!=null){detail=detail+$(getid).html();} 314 | if(data!=null){detail=detail+$.ajax({url:data,async:false}).responseText;} 315 | if(title!=null && title!=""){ 316 | if(detail!=null && detail!=""){detail='

    '+title+'

    '+detail;}else{detail='

    '+title+'

    ';} 317 | } 318 | detail='
    '+detail+'
    '; 319 | html=$(detail); 320 | 321 | $("body").append( html ); 322 | if(width!=null){ 323 | html.css("width",width); 324 | } 325 | if(place=="" || place==null){place="top";} 326 | if(place=="left"){ 327 | x=e.offset().left - html.outerWidth()-5; 328 | y=e.offset().top - html.outerHeight()/2 + e.outerHeight()/2; 329 | }else if(place=="top"){ 330 | x=e.offset().left - html.outerWidth()/2 + e.outerWidth()/2; 331 | y=e.offset().top - html.outerHeight()-5; 332 | }else if(place=="right"){ 333 | x=e.offset().left + e.outerWidth()+5; 334 | y=e.offset().top - html.outerHeight()/2 + e.outerHeight()/2; 335 | }else if(place=="bottom"){ 336 | x=e.offset().left - html.outerWidth()/2 + e.outerWidth()/2; 337 | y=e.offset().top + e.outerHeight()+5; 338 | } 339 | if (css!=""){html.addClass(css);} 340 | html.css({"left":x+"px","top":y+"px","position":"absolute"}); 341 | if (trigger=="hover" || trigger=="click" || trigger==null){ 342 | e.mouseout(function(){html.remove();e.attr("title",title)}); 343 | } 344 | }; 345 | $('.alert .close').each(function(){ 346 | $(this).click(function(){ 347 | $(this).closest('.alert').remove(); 348 | }); 349 | }); 350 | $('.radio label').each(function(){ 351 | var e=$(this); 352 | e.click(function(){ 353 | e.closest('.radio').find("label").removeClass("active"); 354 | e.addClass("active"); 355 | }); 356 | }); 357 | $('.checkbox label').each(function(){ 358 | var e=$(this); 359 | e.click(function(){ 360 | if(e.find('input').is(':checked')){ 361 | e.addClass("active"); 362 | }else{ 363 | e.removeClass("active"); 364 | }; 365 | }); 366 | }); 367 | $('.collapse .panel-head').each(function(){ 368 | var e=$(this); 369 | e.click(function(){ 370 | e.closest('.collapse').find(".panel").removeClass("active"); 371 | e.closest('.panel').addClass("active"); 372 | }); 373 | }); 374 | $('.icon-navicon').each(function(){ 375 | var e=$(this); 376 | var target=e.attr("data-target"); 377 | e.click(function(){ 378 | $(target).toggleClass("nav-navicon"); 379 | }); 380 | }); 381 | $('.banner').each(function(){ 382 | var e=$(this); 383 | var pointer=e.attr("data-pointer"); 384 | var interval=e.attr("data-interval"); 385 | var style=e.attr("data-style"); 386 | var items=e.attr("data-item"); 387 | var items_s=e.attr("data-small"); 388 | var items_m=e.attr("data-middle"); 389 | var items_b=e.attr("data-big"); 390 | var num=e.find(".carousel .item").length; 391 | var win=$(window).width(); 392 | var i=1; 393 | 394 | if(interval==null){interval=5}; 395 | if(items==null || items<1){items=1}; 396 | if(items_s!=null && win>760){items=items_s}; 397 | if(items_m!=null && win>1000){items=items_m}; 398 | if(items_b!=null && win>1200){items=items_b}; 399 | 400 | var itemWidth=Math.ceil(e.outerWidth()/items); 401 | var page=Math.ceil(num/items); 402 | e.find(".carousel .item").css("width",itemWidth+ "px"); 403 | e.find(".carousel").css("width",itemWidth*num + "px"); 404 | 405 | var carousel=function(){ 406 | i++; 407 | if(i>page){i=1;} 408 | $showbanner(e,i,items,num); 409 | }; 410 | var play=setInterval(carousel,interval*600); 411 | 412 | e.mouseover(function(){clearInterval(play);}); 413 | e.mouseout(function(){play=setInterval(carousel,interval*600);}); 414 | 415 | if(pointer!=0 && page>1){ 416 | var point='
    • '; 417 | for (var j=1;j'; 419 | }; 420 | point=point+'
    '; 421 | var pager=$(point); 422 | if(style!=null){pager.addClass(style);}; 423 | e.append(pager); 424 | pager.css("left",e.outerWidth()*0.5 - pager.outerWidth()*0.5+"px"); 425 | pager.find("li").click(function(){ 426 | $showbanner(e,$(this).val(),items,num); 427 | }); 428 | var lefter=$('
    '); 429 | var righter=$('
    '); 430 | if(style!=null){lefter.addClass(style);righter.addClass(style);}; 431 | e.append(lefter); 432 | e.append(righter); 433 | 434 | lefter.click(function(){ 435 | i--; 436 | if(i<1){i=page;} 437 | $showbanner(e,i,items,num); 438 | }); 439 | righter.click(function(){ 440 | i++; 441 | if(i>page){i=1;} 442 | $showbanner(e,i,items,num); 443 | }); 444 | }; 445 | }); 446 | $showbanner=function(e,i,items,num){ 447 | var after=0,leftx=0; 448 | leftx = - Math.ceil(e.outerWidth()/items)*(items)*(i-1); 449 | if(i*items > num){after=i*items-num;leftx= - Math.ceil(e.outerWidth()/items)*(num-items);}; 450 | e.find(".carousel").stop(true, true).animate({"left":leftx+"px"},800); 451 | e.find(".pointer li").removeClass("active"); 452 | e.find(".pointer li").eq(i-1).addClass("active"); 453 | }; 454 | $(".spy a").each(function(){ 455 | var e=$(this); 456 | var t=e.closest(".spy"); 457 | var target=t.attr("data-target"); 458 | var top=t.attr("data-offset-spy"); 459 | var thistarget=""; 460 | var thistop=""; 461 | if(top==null){top=0;}; 462 | if(target==null){thistarget=$(window);}else{thistarget=$(target);}; 463 | 464 | thistarget.bind("scroll",function(){ 465 | if(target==null){ 466 | thistop=$(e.attr("href")).offset().top - $(window).scrollTop() - parseInt(top); 467 | }else{ 468 | thistop=$(e.attr("href")).offset().top - thistarget.offset().top - parseInt(top); 469 | }; 470 | 471 | if(thistop<0){ 472 | t.find('li').removeClass("active"); 473 | e.parents('li').addClass("active"); 474 | }; 475 | 476 | }); 477 | }); 478 | $(".fixed").each(function(){ 479 | var e=$(this); 480 | var style=e.attr("data-style"); 481 | var top=e.attr("data-offset-fixed"); 482 | if(top==null){top=e.offset().top;}else{top=e.offset().top - parseInt(top);}; 483 | if(style==null){style="fixed-top";}; 484 | 485 | $(window).bind("scroll",function(){ 486 | var thistop=top - $(window).scrollTop(); 487 | if(style=="fixed-top" && thistop<0){ 488 | e.addClass("fixed-top"); 489 | }else{ 490 | e.removeClass("fixed-top"); 491 | }; 492 | 493 | var thisbottom=top - $(window).scrollTop()-$(window).height(); 494 | if(style=="fixed-bottom" && thisbottom>0){ 495 | e.addClass("fixed-bottom"); 496 | }else{ 497 | e.removeClass("fixed-bottom"); 498 | }; 499 | }); 500 | 501 | }); 502 | 503 | }) -------------------------------------------------------------------------------- /public/index/js/pintuer.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | $(".win-homepage").click(function(){ 3 | if(document.all){ 4 | document.body.style.behavior = 'url(#default#homepage)'; 5 | document.body.setHomePage(document.URL); 6 | }else{alert("设置首页失败,请手动设置!");} 7 | }); 8 | $(".win-favorite").click(function(){ 9 | var sURL=document.URL; 10 | var sTitle=document.title; 11 | try {window.external.addFavorite(sURL, sTitle);} 12 | catch(e){ 13 | try{window.sidebar.addPanel(sTitle, sURL, "");} 14 | catch(e){alert("加入收藏失败,请使用Ctrl+D进行添加");} 15 | } 16 | }); 17 | $(".win-forward").click(function(){ 18 | window.history.forward(1); 19 | }); 20 | $(".win-back").click(function(){ 21 | window.history.back(-1); 22 | }); 23 | $(".win-backtop").click(function(){$('body,html').animate({scrollTop:0},1000);return false;}); 24 | $(".win-refresh").click(function(){ 25 | window.location.reload(); 26 | }); 27 | $(".win-print").click(function(){ 28 | window.print(); 29 | }); 30 | $(".win-close").click(function(){ 31 | window.close(); 32 | }); 33 | $('.checkall').click(function(){ 34 | var e=$(this); 35 | var name=e.attr("name"); 36 | var checkfor=e.attr("checkfor"); 37 | var type; 38 | if (checkfor!='' && checkfor!=null && checkfor!=undefined){ 39 | type=e.closest('form').find("input[name='"+checkfor+"']"); 40 | }else{ 41 | type=e.closest('form').find("input[type='checkbox']"); 42 | }; 43 | if (name=="checkall"){ 44 | $(type).each(function(index, element){ 45 | element.checked=true; 46 | }); 47 | e.attr("name","ok"); 48 | }else{ 49 | $(type).each(function(index, element){ 50 | element.checked=false; 51 | }); 52 | e.attr("name","checkall"); 53 | } 54 | }); 55 | $('.dropdown-toggle').click(function(){ 56 | $(this).closest('.button-group, .drop').addClass("open"); 57 | }); 58 | $(document).bind("click",function(e){ 59 | if($(e.target).closest(".button-group.open, .drop.open").length == 0){ 60 | $(".button-group, .drop").removeClass("open"); 61 | } 62 | }); 63 | $checkplaceholder=function(){ 64 | var input = document.createElement('input'); 65 | return 'placeholder' in input; 66 | }; 67 | if(!$checkplaceholder()){ 68 | $("textarea[placeholder], input[placeholder]").each(function(index, element){ 69 | var content=false; 70 | if($(this).val().length ===0 || $(this).val()==$(this).attr("placeholder")){content=true}; 71 | if(content){ 72 | $(element).val($(element).attr("placeholder")); 73 | $(element).css("color","rgb(169,169,169)"); 74 | $(element).data("pintuerholder",$(element).css("color")); 75 | $(element).focus(function(){$hideplaceholder($(this));}); 76 | $(element).blur(function(){$showplaceholder($(this));}); 77 | } 78 | }) 79 | }; 80 | $showplaceholder=function(element){ 81 | if( ($(element).val().length ===0 || $(element).val()==$(element).attr("placeholder")) && $(element).attr("type")!="password"){ 82 | $(element).val($(element).attr("placeholder")); 83 | $(element).data("pintuerholder",$(element).css("color")); 84 | $(element).css("color","rgb(169,169,169)"); 85 | } 86 | }; 87 | var $hideplaceholder=function(element){ 88 | if($(element).data("pintuerholder")){ 89 | $(element).val(""); 90 | $(element).css("color", $(element).data("pintuerholder")); 91 | $(element).removeData("pintuerholder"); 92 | } 93 | }; 94 | $('textarea, input, select').blur(function(){ 95 | var e=$(this); 96 | if(e.attr("data-validate")){ 97 | e.closest('.field').find(".input-help").remove(); 98 | var $checkdata=e.attr("data-validate").split(','); 99 | var $checkvalue=e.val(); 100 | var $checkstate=true; 101 | var $checktext=""; 102 | if(e.attr("placeholder")==$checkvalue){$checkvalue="";} 103 | if($checkvalue!="" || e.attr("data-validate").indexOf("required")>=0){ 104 | for(var i=0;i<$checkdata.length;i++){ 105 | var $checktype=$checkdata[i].split(':'); 106 | if(! $pintuercheck(e,$checktype[0],$checkvalue)){ 107 | $checkstate=false; 108 | $checktext=$checktext+"
  • "+$checktype[1]+"
  • "; 109 | } 110 | } 111 | }; 112 | if($checkstate){ 113 | e.closest('.form-group').removeClass("check-error"); 114 | e.parent().find(".input-help").remove(); 115 | e.closest('.form-group').addClass("check-success"); 116 | }else{ 117 | e.closest('.form-group').removeClass("check-success"); 118 | e.closest('.form-group').addClass("check-error"); 119 | e.closest('.field').append('
      '+$checktext+'
    '); 120 | } 121 | } 122 | }); 123 | $pintuercheck=function(element,type,value){ 124 | $pintu=value.replace(/(^\s*)|(\s*$)/g, ""); 125 | switch(type){ 126 | case "required":return /[^(^\s*)|(\s*$)]/.test($pintu);break; 127 | case "chinese":return /^[\u0391-\uFFE5]+$/.test($pintu);break; 128 | case "number":return /^\d+$/.test($pintu);break; 129 | case "integer":return /^[-\+]?\d+$/.test($pintu);break; 130 | case "plusinteger":return /^[+]?\d+$/.test($pintu);break; 131 | case "double":return /^[-\+]?\d+(\.\d+)?$/.test($pintu);break; 132 | case "plusdouble":return /^[+]?\d+(\.\d+)?$/.test($pintu);break; 133 | case "english":return /^[A-Za-z]+$/.test($pintu);break; 134 | case "username":return /^[a-z]\w{3,}$/i.test($pintu);break; 135 | case "mobile":return /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$|170\d{8}?$|147\d{8}?$/.test($pintu);break; 136 | case "phone":return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/.test($pintu);break; 137 | case "tel":return /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$|170\d{8}?$|147\d{8}?$/.test($pintu) || /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/.test($pintu);break; 138 | case "email":return /^[^@]+@[^@]+\.[^@]+$/.test($pintu);break; 139 | case "url":return /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/.test($pintu);break; 140 | case "ip":return /^[\d\.]{7,15}$/.test($pintu);break; 141 | case "qq":return /^[1-9]\d{4,10}$/.test($pintu);break; 142 | case "currency":return /^\d+(\.\d+)?$/.test($pintu);break; 143 | case "zip":return /^[1-9]\d{5}$/.test($pintu);break; 144 | case "radio": 145 | var radio=element.closest('form').find('input[name="'+element.attr("name")+'"]:checked').length; 146 | return eval(radio==1); 147 | break; 148 | default: 149 | var $test=type.split('#'); 150 | if($test.length>1){ 151 | switch($test[0]){ 152 | case "compare": 153 | return eval(Number($pintu)+$test[1]); 154 | break; 155 | case "regexp": 156 | return new RegExp($test[1],"gi").test($pintu); 157 | break; 158 | case "length": 159 | var $length; 160 | if(element.attr("type")=="checkbox"){ 161 | $length=element.closest('form').find('input[name="'+element.attr("name")+'"]:checked').length; 162 | }else{ 163 | $length=$pintu.replace(/[\u4e00-\u9fa5]/g,"***").length; 164 | } 165 | return eval($length+$test[1]); 166 | break; 167 | case "ajax": 168 | var $getdata; 169 | var $url=$test[1]+$pintu; 170 | $.ajaxSetup({async:false}); 171 | $.getJSON($url,function(data){ 172 | //alert(data.getdata); 173 | $getdata=data.getdata; 174 | }); 175 | if($getdata=="true"){return true;} 176 | break; 177 | case "repeat": 178 | return $pintu==jQuery('input[name="'+$test[1]+'"]').eq(0).val(); 179 | break; 180 | default:return true;break; 181 | } 182 | break; 183 | }else{ 184 | return true; 185 | } 186 | } 187 | }; 188 | $('form').submit(function(){ 189 | $(this).find('input[data-validate],textarea[data-validate],select[data-validate]').trigger("blur"); 190 | $(this).find('input[placeholder],textarea[placeholder]').each(function(){$hideplaceholder($(this));}); 191 | var numError = $(this).find('.check-error').length; 192 | if(numError){ 193 | $(this).find('.check-error').first().find('input[data-validate],textarea[data-validate],select[data-validate]').first().focus().select(); 194 | return false; 195 | } 196 | }); 197 | $('.form-reset').click(function(){ 198 | $(this).closest('form').find(".input-help").remove(); 199 | $(this).closest('form').find('.form-submit').removeAttr('disabled'); 200 | $(this).closest('form').find('.form-group').removeClass("check-error"); 201 | $(this).closest('form').find('.form-group').removeClass("check-success"); 202 | }); 203 | $('.tab .tab-nav li').each(function(){ 204 | var e=$(this); 205 | var trigger=e.closest('.tab').attr("data-toggle"); 206 | if (trigger=="hover"){ 207 | e.mouseover(function(){ 208 | $showtabs(e); 209 | }); 210 | e.click(function(){ 211 | return false; 212 | }); 213 | }else{ 214 | e.click(function(){ 215 | $showtabs(e); 216 | return false; 217 | }); 218 | } 219 | }); 220 | $showtabs=function(e){ 221 | var detail=e.children("a").attr("href"); 222 | e.closest('.tab .tab-nav').find("li").removeClass("active"); 223 | e.closest('.tab').find(".tab-body .tab-panel").removeClass("active"); 224 | e.addClass("active"); 225 | $(detail).addClass("active"); 226 | }; 227 | $('.dialogs').each(function(){ 228 | var e=$(this); 229 | var trigger=e.attr("data-toggle"); 230 | if (trigger=="hover"){ 231 | e.mouseover(function(){ 232 | $showdialogs(e); 233 | }); 234 | }else if(trigger=="click"){ 235 | e.click(function(){ 236 | $showdialogs(e); 237 | }); 238 | } 239 | }); 240 | $showdialogs=function(e){ 241 | var trigger=e.attr("data-toggle"); 242 | var getid=e.attr("data-target"); 243 | var data=e.attr("data-url"); 244 | var mask=e.attr("data-mask"); 245 | var width=e.attr("data-width"); 246 | var detail=""; 247 | var masklayout=$('
    '); 248 | if(width==null){width="80%";} 249 | 250 | if (mask=="1"){ 251 | $("body").append(masklayout); 252 | } 253 | detail='
    '; 254 | if(getid!=null){detail=detail+$(getid).html();} 255 | if(data!=null){detail=detail+$.ajax({url:data,async:false}).responseText;} 256 | //alert(detail); 257 | detail=detail+'
    '; 258 | 259 | var win=$(detail); 260 | win.find(".dialog").addClass("open"); 261 | $("body").append(win); 262 | var x=parseInt($(window).width()-win.outerWidth())/2; 263 | var y=parseInt($(window).height()-win.outerHeight())/2; 264 | if (y<=10){y="10"} 265 | win.css({"left":x,"top":y}); 266 | win.find(".dialog-close,.close").each(function(){ 267 | $(this).click(function(){ 268 | win.remove(); 269 | $('.dialog-mask').remove(); 270 | }); 271 | }); 272 | masklayout.click(function(){ 273 | win.remove(); 274 | $(this).remove(); 275 | }); 276 | }; 277 | $('.tips').each(function(){ 278 | var e=$(this); 279 | var title=e.attr("title"); 280 | var trigger=e.attr("data-toggle"); 281 | e.attr("title",""); 282 | if (trigger=="" || trigger==null){trigger="hover";} 283 | if (trigger=="hover"){ 284 | e.mouseover(function(){ 285 | $showtips(e,title); 286 | }); 287 | }else if(trigger=="click"){ 288 | e.click(function(){ 289 | $showtips(e,title); 290 | }); 291 | }else if(trigger=="show"){ 292 | e.ready(function(){ 293 | $showtips(e,title); 294 | }); 295 | } 296 | }); 297 | $showtips=function(e,title){ 298 | var trigger=e.attr("data-toggle"); 299 | var place=e.attr("data-place"); 300 | var width=e.attr("data-width"); 301 | var css=e.attr("data-style"); 302 | var image=e.attr("data-image"); 303 | var content=e.attr("content"); 304 | var getid=e.attr("data-target"); 305 | var data=e.attr("data-url"); 306 | var x=0; 307 | var y=0; 308 | var html=""; 309 | var detail=""; 310 | 311 | if(image!=null){detail=detail+'';} 312 | if(content!=null){detail=detail+'

    '+content+'

    ';} 313 | if(getid!=null){detail=detail+$(getid).html();} 314 | if(data!=null){detail=detail+$.ajax({url:data,async:false}).responseText;} 315 | if(title!=null && title!=""){ 316 | if(detail!=null && detail!=""){detail='

    '+title+'

    '+detail;}else{detail='

    '+title+'

    ';} 317 | } 318 | detail='
    '+detail+'
    '; 319 | html=$(detail); 320 | 321 | $("body").append( html ); 322 | if(width!=null){ 323 | html.css("width",width); 324 | } 325 | if(place=="" || place==null){place="top";} 326 | if(place=="left"){ 327 | x=e.offset().left - html.outerWidth()-5; 328 | y=e.offset().top - html.outerHeight()/2 + e.outerHeight()/2; 329 | }else if(place=="top"){ 330 | x=e.offset().left - html.outerWidth()/2 + e.outerWidth()/2; 331 | y=e.offset().top - html.outerHeight()-5; 332 | }else if(place=="right"){ 333 | x=e.offset().left + e.outerWidth()+5; 334 | y=e.offset().top - html.outerHeight()/2 + e.outerHeight()/2; 335 | }else if(place=="bottom"){ 336 | x=e.offset().left - html.outerWidth()/2 + e.outerWidth()/2; 337 | y=e.offset().top + e.outerHeight()+5; 338 | } 339 | if (css!=""){html.addClass(css);} 340 | html.css({"left":x+"px","top":y+"px","position":"absolute"}); 341 | if (trigger=="hover" || trigger=="click" || trigger==null){ 342 | e.mouseout(function(){html.remove();e.attr("title",title)}); 343 | } 344 | }; 345 | $('.alert .close').each(function(){ 346 | $(this).click(function(){ 347 | $(this).closest('.alert').remove(); 348 | }); 349 | }); 350 | $('.radio label').each(function(){ 351 | var e=$(this); 352 | e.click(function(){ 353 | e.closest('.radio').find("label").removeClass("active"); 354 | e.addClass("active"); 355 | }); 356 | }); 357 | $('.checkbox label').each(function(){ 358 | var e=$(this); 359 | e.click(function(){ 360 | if(e.find('input').is(':checked')){ 361 | e.addClass("active"); 362 | }else{ 363 | e.removeClass("active"); 364 | }; 365 | }); 366 | }); 367 | $('.collapse .panel-head').each(function(){ 368 | var e=$(this); 369 | e.click(function(){ 370 | e.closest('.collapse').find(".panel").removeClass("active"); 371 | e.closest('.panel').addClass("active"); 372 | }); 373 | }); 374 | $('.icon-navicon').each(function(){ 375 | var e=$(this); 376 | var target=e.attr("data-target"); 377 | e.click(function(){ 378 | $(target).toggleClass("nav-navicon"); 379 | }); 380 | }); 381 | $('.banner').each(function(){ 382 | var e=$(this); 383 | var pointer=e.attr("data-pointer"); 384 | var interval=e.attr("data-interval"); 385 | var style=e.attr("data-style"); 386 | var items=e.attr("data-item"); 387 | var items_s=e.attr("data-small"); 388 | var items_m=e.attr("data-middle"); 389 | var items_b=e.attr("data-big"); 390 | var num=e.find(".carousel .item").length; 391 | var win=$(window).width(); 392 | var i=1; 393 | 394 | if(interval==null){interval=5}; 395 | if(items==null || items<1){items=1}; 396 | if(items_s!=null && win>760){items=items_s}; 397 | if(items_m!=null && win>1000){items=items_m}; 398 | if(items_b!=null && win>1200){items=items_b}; 399 | 400 | var itemWidth=Math.ceil(e.outerWidth()/items); 401 | var page=Math.ceil(num/items); 402 | e.find(".carousel .item").css("width",itemWidth+ "px"); 403 | e.find(".carousel").css("width",itemWidth*num + "px"); 404 | 405 | var carousel=function(){ 406 | i++; 407 | if(i>page){i=1;} 408 | $showbanner(e,i,items,num); 409 | }; 410 | var play=setInterval(carousel,interval*600); 411 | 412 | e.mouseover(function(){clearInterval(play);}); 413 | e.mouseout(function(){play=setInterval(carousel,interval*600);}); 414 | 415 | if(pointer!=0 && page>1){ 416 | var point='
    • '; 417 | for (var j=1;j'; 419 | }; 420 | point=point+'
    '; 421 | var pager=$(point); 422 | if(style!=null){pager.addClass(style);}; 423 | e.append(pager); 424 | pager.css("left",e.outerWidth()*0.5 - pager.outerWidth()*0.5+"px"); 425 | pager.find("li").click(function(){ 426 | $showbanner(e,$(this).val(),items,num); 427 | }); 428 | var lefter=$('
    '); 429 | var righter=$('
    '); 430 | if(style!=null){lefter.addClass(style);righter.addClass(style);}; 431 | e.append(lefter); 432 | e.append(righter); 433 | 434 | lefter.click(function(){ 435 | i--; 436 | if(i<1){i=page;} 437 | $showbanner(e,i,items,num); 438 | }); 439 | righter.click(function(){ 440 | i++; 441 | if(i>page){i=1;} 442 | $showbanner(e,i,items,num); 443 | }); 444 | }; 445 | }); 446 | $showbanner=function(e,i,items,num){ 447 | var after=0,leftx=0; 448 | leftx = - Math.ceil(e.outerWidth()/items)*(items)*(i-1); 449 | if(i*items > num){after=i*items-num;leftx= - Math.ceil(e.outerWidth()/items)*(num-items);}; 450 | e.find(".carousel").stop(true, true).animate({"left":leftx+"px"},800); 451 | e.find(".pointer li").removeClass("active"); 452 | e.find(".pointer li").eq(i-1).addClass("active"); 453 | }; 454 | $(".spy a").each(function(){ 455 | var e=$(this); 456 | var t=e.closest(".spy"); 457 | var target=t.attr("data-target"); 458 | var top=t.attr("data-offset-spy"); 459 | var thistarget=""; 460 | var thistop=""; 461 | if(top==null){top=0;}; 462 | if(target==null){thistarget=$(window);}else{thistarget=$(target);}; 463 | 464 | thistarget.bind("scroll",function(){ 465 | if(target==null){ 466 | thistop=$(e.attr("href")).offset().top - $(window).scrollTop() - parseInt(top); 467 | }else{ 468 | thistop=$(e.attr("href")).offset().top - thistarget.offset().top - parseInt(top); 469 | }; 470 | 471 | if(thistop<0){ 472 | t.find('li').removeClass("active"); 473 | e.parents('li').addClass("active"); 474 | }; 475 | 476 | }); 477 | }); 478 | $(".fixed").each(function(){ 479 | var e=$(this); 480 | var style=e.attr("data-style"); 481 | var top=e.attr("data-offset-fixed"); 482 | if(top==null){top=e.offset().top;}else{top=e.offset().top - parseInt(top);}; 483 | if(style==null){style="fixed-top";}; 484 | 485 | $(window).bind("scroll",function(){ 486 | var thistop=top - $(window).scrollTop(); 487 | if(style=="fixed-top" && thistop<0){ 488 | e.addClass("fixed-top"); 489 | }else{ 490 | e.removeClass("fixed-top"); 491 | }; 492 | 493 | var thisbottom=top - $(window).scrollTop()-$(window).height(); 494 | if(style=="fixed-bottom" && thisbottom>0){ 495 | e.addClass("fixed-bottom"); 496 | }else{ 497 | e.removeClass("fixed-bottom"); 498 | }; 499 | }); 500 | 501 | }); 502 | 503 | }) -------------------------------------------------------------------------------- /public/index/js/jquery.nivo.slider.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Nivo Slider v2.6 3 | * http://nivo.dev7studios.com 4 | * 5 | * Copyright 2011, Gilbert Pellegrom 6 | * Free to use and abuse under the MIT license. 7 | * http://www.opensource.org/licenses/mit-license.php 8 | * 9 | * March 2010 10 | */ 11 | 12 | (function($) { 13 | 14 | var NivoSlider = function(element, options){ 15 | //Defaults are below 16 | var settings = $.extend({}, $.fn.nivoSlider.defaults, options); 17 | 18 | //Useful variables. Play carefully. 19 | var vars = { 20 | currentSlide: 0, 21 | currentImage: '', 22 | totalSlides: 0, 23 | randAnim: '', 24 | running: false, 25 | paused: false, 26 | stop: false 27 | }; 28 | 29 | //Get this slider 30 | var slider = $(element); 31 | slider.data('nivo:vars', vars); 32 | slider.css('position','relative'); 33 | slider.addClass('nivoSlider'); 34 | 35 | //Find our slider children 36 | var kids = slider.children(); 37 | kids.each(function() { 38 | var child = $(this); 39 | var link = ''; 40 | if(!child.is('img')){ 41 | if(child.is('a')){ 42 | child.addClass('nivo-imageLink'); 43 | link = child; 44 | } 45 | child = child.find('img:first'); 46 | } 47 | //Get img width & height 48 | var childWidth = child.width(); 49 | if(childWidth == 0) childWidth = child.attr('width'); 50 | var childHeight = child.height(); 51 | if(childHeight == 0) childHeight = child.attr('height'); 52 | //Resize the slider 53 | if(childWidth > slider.width()){ 54 | slider.width(childWidth); 55 | } 56 | if(childHeight > slider.height()){ 57 | slider.height(childHeight); 58 | } 59 | if(link != ''){ 60 | link.css('display','none'); 61 | } 62 | child.css('display','none'); 63 | vars.totalSlides++; 64 | }); 65 | 66 | //Set startSlide 67 | if(settings.startSlide > 0){ 68 | if(settings.startSlide >= vars.totalSlides) settings.startSlide = vars.totalSlides - 1; 69 | vars.currentSlide = settings.startSlide; 70 | } 71 | 72 | //Get initial image 73 | if($(kids[vars.currentSlide]).is('img')){ 74 | vars.currentImage = $(kids[vars.currentSlide]); 75 | } else { 76 | vars.currentImage = $(kids[vars.currentSlide]).find('img:first'); 77 | } 78 | 79 | //Show initial link 80 | if($(kids[vars.currentSlide]).is('a')){ 81 | $(kids[vars.currentSlide]).css('display','block'); 82 | } 83 | 84 | //Set first background 85 | slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); 86 | 87 | //Create caption 88 | slider.append( 89 | $('

    ').css({ display:'none', opacity:settings.captionOpacity }) 90 | ); 91 | 92 | // Process caption function 93 | var processCaption = function(settings){ 94 | var nivoCaption = $('.nivo-caption', slider); 95 | if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){ 96 | var title = vars.currentImage.attr('title'); 97 | if(title.substr(0,1) == '#') title = $(title).html(); 98 | 99 | if(nivoCaption.css('display') == 'block'){ 100 | nivoCaption.find('p').fadeOut(settings.animSpeed, function(){ 101 | $(this).html(title); 102 | $(this).fadeIn(settings.animSpeed); 103 | }); 104 | } else { 105 | nivoCaption.find('p').html(title); 106 | } 107 | nivoCaption.fadeIn(settings.animSpeed); 108 | } else { 109 | nivoCaption.fadeOut(settings.animSpeed); 110 | } 111 | } 112 | 113 | //Process initial caption 114 | processCaption(settings); 115 | 116 | //In the words of Super Mario "let's a go!" 117 | var timer = 0; 118 | if(!settings.manualAdvance && kids.length > 1){ 119 | timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime); 120 | } 121 | 122 | //Add Direction nav 123 | if(settings.directionNav){ 124 | slider.append(''); 125 | 126 | //Hide Direction nav 127 | if(settings.directionNavHide){ 128 | $('.nivo-directionNav', slider).hide(); 129 | slider.hover(function(){ 130 | $('.nivo-directionNav', slider).show(); 131 | }, function(){ 132 | $('.nivo-directionNav', slider).hide(); 133 | }); 134 | } 135 | 136 | $('a.nivo-prevNav', slider).live('click', function(){ 137 | if(vars.running) return false; 138 | clearInterval(timer); 139 | timer = ''; 140 | vars.currentSlide -= 2; 141 | nivoRun(slider, kids, settings, 'prev'); 142 | }); 143 | 144 | $('a.nivo-nextNav', slider).live('click', function(){ 145 | if(vars.running) return false; 146 | clearInterval(timer); 147 | timer = ''; 148 | nivoRun(slider, kids, settings, 'next'); 149 | }); 150 | } 151 | 152 | //Add Control nav 153 | if(settings.controlNav){ 154 | var nivoControl = $('
    '); 155 | slider.append(nivoControl); 156 | for(var i = 0; i < kids.length; i++){ 157 | if(settings.controlNavThumbs){ 158 | var child = kids.eq(i); 159 | if(!child.is('img')){ 160 | child = child.find('img:first'); 161 | } 162 | if (settings.controlNavThumbsFromRel) { 163 | nivoControl.append(''); 164 | } else { 165 | nivoControl.append(''); 166 | } 167 | } else { 168 | nivoControl.append(''+ (i + 1) +''); 169 | } 170 | 171 | } 172 | //Set initial active link 173 | $('.nivo-controlNav a:eq('+ vars.currentSlide +')', slider).addClass('active'); 174 | 175 | $('.nivo-controlNav a', slider).live('click', function(){ 176 | if(vars.running) return false; 177 | if($(this).hasClass('active')) return false; 178 | clearInterval(timer); 179 | timer = ''; 180 | slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); 181 | vars.currentSlide = $(this).attr('rel') - 1; 182 | nivoRun(slider, kids, settings, 'control'); 183 | }); 184 | } 185 | 186 | //Keyboard Navigation 187 | if(settings.keyboardNav){ 188 | $(window).keypress(function(event){ 189 | //Left 190 | if(event.keyCode == '37'){ 191 | if(vars.running) return false; 192 | clearInterval(timer); 193 | timer = ''; 194 | vars.currentSlide-=2; 195 | nivoRun(slider, kids, settings, 'prev'); 196 | } 197 | //Right 198 | if(event.keyCode == '39'){ 199 | if(vars.running) return false; 200 | clearInterval(timer); 201 | timer = ''; 202 | nivoRun(slider, kids, settings, 'next'); 203 | } 204 | }); 205 | } 206 | 207 | //For pauseOnHover setting 208 | if(settings.pauseOnHover){ 209 | slider.hover(function(){ 210 | vars.paused = true; 211 | clearInterval(timer); 212 | timer = ''; 213 | }, function(){ 214 | vars.paused = false; 215 | //Restart the timer 216 | if(timer == '' && !settings.manualAdvance){ 217 | timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime); 218 | } 219 | }); 220 | } 221 | 222 | //Event when Animation finishes 223 | slider.bind('nivo:animFinished', function(){ 224 | vars.running = false; 225 | //Hide child links 226 | $(kids).each(function(){ 227 | if($(this).is('a')){ 228 | $(this).css('display','none'); 229 | } 230 | }); 231 | //Show current link 232 | if($(kids[vars.currentSlide]).is('a')){ 233 | $(kids[vars.currentSlide]).css('display','block'); 234 | } 235 | //Restart the timer 236 | if(timer == '' && !vars.paused && !settings.manualAdvance){ 237 | timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime); 238 | } 239 | //Trigger the afterChange callback 240 | settings.afterChange.call(this); 241 | }); 242 | 243 | // Add slices for slice animations 244 | var createSlices = function(slider, settings, vars){ 245 | for(var i = 0; i < settings.slices; i++){ 246 | var sliceWidth = Math.round(slider.width()/settings.slices); 247 | if(i == settings.slices-1){ 248 | slider.append( 249 | $('
    ').css({ 250 | left:(sliceWidth*i)+'px', width:(slider.width()-(sliceWidth*i))+'px', 251 | height:'0px', 252 | opacity:'0', 253 | background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px 0%' 254 | }) 255 | ); 256 | } else { 257 | slider.append( 258 | $('
    ').css({ 259 | left:(sliceWidth*i)+'px', width:sliceWidth+'px', 260 | height:'0px', 261 | opacity:'0', 262 | background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px 0%' 263 | }) 264 | ); 265 | } 266 | } 267 | } 268 | 269 | // Add boxes for box animations 270 | var createBoxes = function(slider, settings, vars){ 271 | var boxWidth = Math.round(slider.width()/settings.boxCols); 272 | var boxHeight = Math.round(slider.height()/settings.boxRows); 273 | 274 | for(var rows = 0; rows < settings.boxRows; rows++){ 275 | for(var cols = 0; cols < settings.boxCols; cols++){ 276 | if(cols == settings.boxCols-1){ 277 | slider.append( 278 | $('
    ').css({ 279 | opacity:0, 280 | left:(boxWidth*cols)+'px', 281 | top:(boxHeight*rows)+'px', 282 | width:(slider.width()-(boxWidth*cols))+'px', 283 | height:boxHeight+'px', 284 | background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((boxWidth + (cols * boxWidth)) - boxWidth) +'px -'+ ((boxHeight + (rows * boxHeight)) - boxHeight) +'px' 285 | }) 286 | ); 287 | } else { 288 | slider.append( 289 | $('
    ').css({ 290 | opacity:0, 291 | left:(boxWidth*cols)+'px', 292 | top:(boxHeight*rows)+'px', 293 | width:boxWidth+'px', 294 | height:boxHeight+'px', 295 | background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((boxWidth + (cols * boxWidth)) - boxWidth) +'px -'+ ((boxHeight + (rows * boxHeight)) - boxHeight) +'px' 296 | }) 297 | ); 298 | } 299 | } 300 | } 301 | } 302 | 303 | // Private run method 304 | var nivoRun = function(slider, kids, settings, nudge){ 305 | //Get our vars 306 | var vars = slider.data('nivo:vars'); 307 | 308 | //Trigger the lastSlide callback 309 | if(vars && (vars.currentSlide == vars.totalSlides - 1)){ 310 | settings.lastSlide.call(this); 311 | } 312 | 313 | // Stop 314 | if((!vars || vars.stop) && !nudge) return false; 315 | 316 | //Trigger the beforeChange callback 317 | settings.beforeChange.call(this); 318 | 319 | //Set current background before change 320 | if(!nudge){ 321 | slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); 322 | } else { 323 | if(nudge == 'prev'){ 324 | slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); 325 | } 326 | if(nudge == 'next'){ 327 | slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); 328 | } 329 | } 330 | vars.currentSlide++; 331 | //Trigger the slideshowEnd callback 332 | if(vars.currentSlide == vars.totalSlides){ 333 | vars.currentSlide = 0; 334 | settings.slideshowEnd.call(this); 335 | } 336 | if(vars.currentSlide < 0) vars.currentSlide = (vars.totalSlides - 1); 337 | //Set vars.currentImage 338 | if($(kids[vars.currentSlide]).is('img')){ 339 | vars.currentImage = $(kids[vars.currentSlide]); 340 | } else { 341 | vars.currentImage = $(kids[vars.currentSlide]).find('img:first'); 342 | } 343 | 344 | //Set active links 345 | if(settings.controlNav){ 346 | $('.nivo-controlNav a', slider).removeClass('active'); 347 | $('.nivo-controlNav a:eq('+ vars.currentSlide +')', slider).addClass('active'); 348 | } 349 | 350 | //Process caption 351 | processCaption(settings); 352 | 353 | // Remove any slices from last transition 354 | $('.nivo-slice', slider).remove(); 355 | 356 | // Remove any boxes from last transition 357 | $('.nivo-box', slider).remove(); 358 | 359 | if(settings.effect == 'random'){ 360 | var anims = new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade', 361 | 'boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse'); 362 | vars.randAnim = anims[Math.floor(Math.random()*(anims.length + 1))]; 363 | if(vars.randAnim == undefined) vars.randAnim = 'fade'; 364 | } 365 | 366 | //Run random effect from specified set (eg: effect:'fold,fade') 367 | if(settings.effect.indexOf(',') != -1){ 368 | var anims = settings.effect.split(','); 369 | vars.randAnim = anims[Math.floor(Math.random()*(anims.length))]; 370 | if(vars.randAnim == undefined) vars.randAnim = 'fade'; 371 | } 372 | 373 | //Run effects 374 | vars.running = true; 375 | if(settings.effect == 'sliceDown' || settings.effect == 'sliceDownRight' || vars.randAnim == 'sliceDownRight' || 376 | settings.effect == 'sliceDownLeft' || vars.randAnim == 'sliceDownLeft'){ 377 | createSlices(slider, settings, vars); 378 | var timeBuff = 0; 379 | var i = 0; 380 | var slices = $('.nivo-slice', slider); 381 | if(settings.effect == 'sliceDownLeft' || vars.randAnim == 'sliceDownLeft') slices = $('.nivo-slice', slider)._reverse(); 382 | 383 | slices.each(function(){ 384 | var slice = $(this); 385 | slice.css({ 'top': '0px' }); 386 | if(i == settings.slices-1){ 387 | setTimeout(function(){ 388 | slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); 389 | }, (100 + timeBuff)); 390 | } else { 391 | setTimeout(function(){ 392 | slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed); 393 | }, (100 + timeBuff)); 394 | } 395 | timeBuff += 50; 396 | i++; 397 | }); 398 | } 399 | else if(settings.effect == 'sliceUp' || settings.effect == 'sliceUpRight' || vars.randAnim == 'sliceUpRight' || 400 | settings.effect == 'sliceUpLeft' || vars.randAnim == 'sliceUpLeft'){ 401 | createSlices(slider, settings, vars); 402 | var timeBuff = 0; 403 | var i = 0; 404 | var slices = $('.nivo-slice', slider); 405 | if(settings.effect == 'sliceUpLeft' || vars.randAnim == 'sliceUpLeft') slices = $('.nivo-slice', slider)._reverse(); 406 | 407 | slices.each(function(){ 408 | var slice = $(this); 409 | slice.css({ 'bottom': '0px' }); 410 | if(i == settings.slices-1){ 411 | setTimeout(function(){ 412 | slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); 413 | }, (100 + timeBuff)); 414 | } else { 415 | setTimeout(function(){ 416 | slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed); 417 | }, (100 + timeBuff)); 418 | } 419 | timeBuff += 50; 420 | i++; 421 | }); 422 | } 423 | else if(settings.effect == 'sliceUpDown' || settings.effect == 'sliceUpDownRight' || vars.randAnim == 'sliceUpDown' || 424 | settings.effect == 'sliceUpDownLeft' || vars.randAnim == 'sliceUpDownLeft'){ 425 | createSlices(slider, settings, vars); 426 | var timeBuff = 0; 427 | var i = 0; 428 | var v = 0; 429 | var slices = $('.nivo-slice', slider); 430 | if(settings.effect == 'sliceUpDownLeft' || vars.randAnim == 'sliceUpDownLeft') slices = $('.nivo-slice', slider)._reverse(); 431 | 432 | slices.each(function(){ 433 | var slice = $(this); 434 | if(i == 0){ 435 | slice.css('top','0px'); 436 | i++; 437 | } else { 438 | slice.css('bottom','0px'); 439 | i = 0; 440 | } 441 | 442 | if(v == settings.slices-1){ 443 | setTimeout(function(){ 444 | slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); 445 | }, (100 + timeBuff)); 446 | } else { 447 | setTimeout(function(){ 448 | slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed); 449 | }, (100 + timeBuff)); 450 | } 451 | timeBuff += 50; 452 | v++; 453 | }); 454 | } 455 | else if(settings.effect == 'fold' || vars.randAnim == 'fold'){ 456 | createSlices(slider, settings, vars); 457 | var timeBuff = 0; 458 | var i = 0; 459 | 460 | $('.nivo-slice', slider).each(function(){ 461 | var slice = $(this); 462 | var origWidth = slice.width(); 463 | slice.css({ top:'0px', height:'100%', width:'0px' }); 464 | if(i == settings.slices-1){ 465 | setTimeout(function(){ 466 | slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); 467 | }, (100 + timeBuff)); 468 | } else { 469 | setTimeout(function(){ 470 | slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed); 471 | }, (100 + timeBuff)); 472 | } 473 | timeBuff += 50; 474 | i++; 475 | }); 476 | } 477 | else if(settings.effect == 'fade' || vars.randAnim == 'fade'){ 478 | createSlices(slider, settings, vars); 479 | 480 | var firstSlice = $('.nivo-slice:first', slider); 481 | firstSlice.css({ 482 | 'height': '100%', 483 | 'width': slider.width() + 'px' 484 | }); 485 | 486 | firstSlice.animate({ opacity:'1.0' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); }); 487 | } 488 | else if(settings.effect == 'slideInRight' || vars.randAnim == 'slideInRight'){ 489 | createSlices(slider, settings, vars); 490 | 491 | var firstSlice = $('.nivo-slice:first', slider); 492 | firstSlice.css({ 493 | 'height': '100%', 494 | 'width': '0px', 495 | 'opacity': '1' 496 | }); 497 | 498 | firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); }); 499 | } 500 | else if(settings.effect == 'slideInLeft' || vars.randAnim == 'slideInLeft'){ 501 | createSlices(slider, settings, vars); 502 | 503 | var firstSlice = $('.nivo-slice:first', slider); 504 | firstSlice.css({ 505 | 'height': '100%', 506 | 'width': '0px', 507 | 'opacity': '1', 508 | 'left': '', 509 | 'right': '0px' 510 | }); 511 | 512 | firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){ 513 | // Reset positioning 514 | firstSlice.css({ 515 | 'left': '0px', 516 | 'right': '' 517 | }); 518 | slider.trigger('nivo:animFinished'); 519 | }); 520 | } 521 | else if(settings.effect == 'boxRandom' || vars.randAnim == 'boxRandom'){ 522 | createBoxes(slider, settings, vars); 523 | 524 | var totalBoxes = settings.boxCols * settings.boxRows; 525 | var i = 0; 526 | var timeBuff = 0; 527 | 528 | var boxes = shuffle($('.nivo-box', slider)); 529 | boxes.each(function(){ 530 | var box = $(this); 531 | if(i == totalBoxes-1){ 532 | setTimeout(function(){ 533 | box.animate({ opacity:'1' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); 534 | }, (100 + timeBuff)); 535 | } else { 536 | setTimeout(function(){ 537 | box.animate({ opacity:'1' }, settings.animSpeed); 538 | }, (100 + timeBuff)); 539 | } 540 | timeBuff += 20; 541 | i++; 542 | }); 543 | } 544 | else if(settings.effect == 'boxRain' || vars.randAnim == 'boxRain' || settings.effect == 'boxRainReverse' || vars.randAnim == 'boxRainReverse' || 545 | settings.effect == 'boxRainGrow' || vars.randAnim == 'boxRainGrow' || settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){ 546 | createBoxes(slider, settings, vars); 547 | 548 | var totalBoxes = settings.boxCols * settings.boxRows; 549 | var i = 0; 550 | var timeBuff = 0; 551 | 552 | // Split boxes into 2D array 553 | var rowIndex = 0; 554 | var colIndex = 0; 555 | var box2Darr = new Array(); 556 | box2Darr[rowIndex] = new Array(); 557 | var boxes = $('.nivo-box', slider); 558 | if(settings.effect == 'boxRainReverse' || vars.randAnim == 'boxRainReverse' || 559 | settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){ 560 | boxes = $('.nivo-box', slider)._reverse(); 561 | } 562 | boxes.each(function(){ 563 | box2Darr[rowIndex][colIndex] = $(this); 564 | colIndex++; 565 | if(colIndex == settings.boxCols){ 566 | rowIndex++; 567 | colIndex = 0; 568 | box2Darr[rowIndex] = new Array(); 569 | } 570 | }); 571 | 572 | // Run animation 573 | for(var cols = 0; cols < (settings.boxCols * 2); cols++){ 574 | var prevCol = cols; 575 | for(var rows = 0; rows < settings.boxRows; rows++){ 576 | if(prevCol >= 0 && prevCol < settings.boxCols){ 577 | /* Due to some weird JS bug with loop vars 578 | being used in setTimeout, this is wrapped 579 | with an anonymous function call */ 580 | (function(row, col, time, i, totalBoxes) { 581 | var box = $(box2Darr[row][col]); 582 | var w = box.width(); 583 | var h = box.height(); 584 | if(settings.effect == 'boxRainGrow' || vars.randAnim == 'boxRainGrow' || 585 | settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){ 586 | box.width(0).height(0); 587 | } 588 | if(i == totalBoxes-1){ 589 | setTimeout(function(){ 590 | box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3, '', function(){ slider.trigger('nivo:animFinished'); }); 591 | }, (100 + time)); 592 | } else { 593 | setTimeout(function(){ 594 | box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3); 595 | }, (100 + time)); 596 | } 597 | })(rows, prevCol, timeBuff, i, totalBoxes); 598 | i++; 599 | } 600 | prevCol--; 601 | } 602 | timeBuff += 100; 603 | } 604 | } 605 | } 606 | 607 | // Shuffle an array 608 | var shuffle = function(arr){ 609 | for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x); 610 | return arr; 611 | } 612 | 613 | // For debugging 614 | var trace = function(msg){ 615 | if (this.console && typeof console.log != "undefined") 616 | console.log(msg); 617 | } 618 | 619 | // Start / Stop 620 | this.stop = function(){ 621 | if(!$(element).data('nivo:vars').stop){ 622 | $(element).data('nivo:vars').stop = true; 623 | trace('Stop Slider'); 624 | } 625 | } 626 | 627 | this.start = function(){ 628 | if($(element).data('nivo:vars').stop){ 629 | $(element).data('nivo:vars').stop = false; 630 | trace('Start Slider'); 631 | } 632 | } 633 | 634 | //Trigger the afterLoad callback 635 | settings.afterLoad.call(this); 636 | 637 | return this; 638 | }; 639 | 640 | $.fn.nivoSlider = function(options) { 641 | 642 | return this.each(function(key, value){ 643 | var element = $(this); 644 | // Return early if this element already has a plugin instance 645 | if (element.data('nivoslider')) return element.data('nivoslider'); 646 | // Pass options to plugin constructor 647 | var nivoslider = new NivoSlider(this, options); 648 | // Store plugin object in this element's data 649 | element.data('nivoslider', nivoslider); 650 | }); 651 | 652 | }; 653 | 654 | //Default settings 655 | $.fn.nivoSlider.defaults = { 656 | effect: 'random', 657 | slices: 15, 658 | boxCols: 8, 659 | boxRows: 4, 660 | animSpeed: 500, 661 | pauseTime: 3000, 662 | startSlide: 0, 663 | directionNav: true, 664 | directionNavHide: true, 665 | controlNav: true, 666 | controlNavThumbs: false, 667 | controlNavThumbsFromRel: false, 668 | controlNavThumbsSearch: '.jpg', 669 | controlNavThumbsReplace: '_thumb.jpg', 670 | keyboardNav: true, 671 | pauseOnHover: true, 672 | manualAdvance: false, 673 | captionOpacity: 0.8, 674 | prevText: 'Prev', 675 | nextText: 'Next', 676 | beforeChange: function(){}, 677 | afterChange: function(){}, 678 | slideshowEnd: function(){}, 679 | lastSlide: function(){}, 680 | afterLoad: function(){} 681 | }; 682 | 683 | $.fn._reverse = [].reverse; 684 | 685 | })(jQuery); --------------------------------------------------------------------------------