好!欢迎访问迷津渡口 现在时间是: 天气 °C ~ °C

迷津渡口

越感到迷惑 越接近真理

emlog MVC解构8--工具类们之Url、View、LoginAuth和其他

Url类

Url处理类Url和Dispatcher相辅相成,将生成文章、归档、分类、作者、标签、分页、评论和导航的动态链接。

方法表:

方法注释
static function log($blogId)静态方法,获取文章链接,根据是否可重写,开启别名,选择的链接模式和是否开启html后缀等Option的配置获取文章链接,$blogId参数为emlog_blog里面的日志唯一ID
static function record($record,$page=null)静态方法,获取归档链接,参数$record为xxxxxx或xxxxxxxx即年和月组成或年月日组成,$page就是页码
static function sort($sortId,$page=null)静态方法,获取分类链接,参数$sortId为emlog_sort里面分类的唯一ID,$page是页码
static function author($authorId,$page=null)静态方法,获取作者链接,参数$authorId为emlog_user里面会员的唯一ID,$page是页码
static function tag($tag,$page=null)
静态方法,获取标签链接,参数$tag是emlog_tag里面的tag_name即标签名,$page是页码
static function logPage()静态方法,获取首页文章分页链接
static function comment($blogId,$pageId,$cid)静态方法,获取评论链接,参数$blogId是emlog_comment里面的gid即日志ID,$cid是cid评论ID,$pageId是页码
static function navi($type,$typeId,$url)静态方法,获取导航链接,参数$type是导航的类型,根据Navi_Model里面的类常量给出,$typeId是emlog_navi里面的type_id,$url为默认url

View类

主要作用是获取前台模板里的文件链接和输出缓存:

方法表:

方法注释
public static function getView($template,$ext='.php')
静态方法,返回前台模板文件路径,注意是绝对路径不是URL,参数$template是模板文件名,$ext是模板入口文件的后缀,默认为.php。如果有问题则报错,提示需要更换模板
public static function output()输出清除缓存,在init.php开启了缓存机制,因此需要手动输出缓存和清除缓存,这个函数判断是否开启了gzip,如果开启了则进行压缩,否则直接输出

LoginAuth类

主要作用是进行前台登录验证。

三个常量:错误码

const LOGIN_ERROR_USER = -1;     // 用户名错误
const LOGIN_ERROR_PASSWD = -2;   // 密码错误
const LOGIN_ERROR_AUTHCODE = -3; // 验证码错误

方法表:

方法注释
public static function isLogin()
静态方法,主要通过Cookie验证用户是否处于登陆状态
public static function checkUser($username,$password,$imgcode,$logincode=false)静态方法,验证用户和密码,根据输入判断返回不同的错误码
public static function loginPage($errorCode=null)静态方法,获取验证码,如果验证错误则输出错误信息要求重新输入,利用View类获取前台模板里login.php的页面
public static function getUserDataByLogin($userLogin)静态方法,通过登录名查询管理员信息
public static function checkPassword($password,$hash)静态方法,利用PasswordHash类判断输入的明文密码和数据库加密后的密码进行验证
public static function setAuthCookie($user_login,$ispersis=false)静态方法,设置用于登陆验证的Cookie
public static function generateAuthCookie($user_login,$expiration)静态方法,生成哈希序列的cookie
private static function emHash($data)私有静态方法,生成加密的哈希序列
private static function validateAuthCookie($cookie='')私有静态方法,判断用户登陆的cookie是否有效
public static function genToken()静态方法,生成随机token,防御CSRF攻击
public static function checkToken()
静态方法,检查token,防御CSRF攻击

生成图片验证码的方法:

调用工具文件checkcode.php

Calendar类

主要作用是获取日历链接和生成日历

方法表:

方法注释
static function url()静态方法,获取日历调用地址
static function generate()静态方法,生成日历,当月某天的文章添加在日历添加归档链接,日历通过echo字符串的形式直接输出

PasswordHash类是引用的为密码加密的类,版本比较旧,需要了解的可自行谷歌。

点赞0
   支持一下
挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
 点赞
 签到
 表情
 图片
 代码
提交评论

清空信息
关闭评论
joubertets
 joubertets 2018-12-07 20:33回复
#19
<a href="http://www.bondhuberman.com/nike-flyknit-lunar-3-dam%C3%A4nner-gold-runningc">nike flyknit lunar 3 dam盲nner gold</a> <a href="http://www.governisation.com/womens-asics-gel-noosa-tri-10-black-purple-skoc">womens asics gel noosa tri 10 black purple</a> <a href="http://www.jmgtours.com/kansas-city-royals-championship-hat-hats">kansas city royals championship hat</a> <a href="http://www.honestmentor.com/billig-nike-free-trainer-5.0-herre-sort-sportsb">billig nike free trainer 5.0 herre sort</a> <a href="http://www.klarinettino.com/air-max-force-shoesm">air max force</a> <a href="http://www.inckua.com/womens-nike-blazer-grey-gold-footc">womens nike blazer grey gold</a>
joubertets http://www.joubertets.com/
gstavrakakis
 gstavrakakis 2018-12-06 15:39回复
#18
<a href="http://www.cakirgozoto.com/silver-pink-womens-nike-kaishi-shoes-foota">silver pink womens nike kaishi shoes</a> <a href="http://www.burayagidin.com/new-era-blank-camo-fitted-hats-lines-hatd">new era blank camo fitted hats lines</a> <a href="http://www.ftpronto.com/nike-free-ebay-kleinanzeigen-trainersb">nike free ebay kleinanzeigen</a> <a href="http://www.bukafalar.com/%EF%BB%BFconverse-shoes-shoesz">锘縞onverse shoes</a> <a href="http://www.essodustade.com/femminile-puma-future-cat-bianca-shoesn">femminile puma future cat bianca</a> <a href="http://www.biyotestatik.com/nobis-cartel-jacket-review-nobisr">nobis cartel jacket review</a>
mondirco
 mondirco 2018-12-03 04:52回复
#17
<a href="http://www.bharatovation.com/buffalo-bills-foam-hat-hatr">buffalo bills foam hat</a> <a href="http://www.donareseguros.com/jordan-4-fire-red-back-jordan-sportsc">jordan 4 fire red back jordan</a> <a href="http://www.cierreplus.com/billig-nike-free-flyknit-3.0-dam%C3%A4nner-schwarz-foota">billig nike free flyknit 3.0 dam盲nner schwarz</a> <a href="http://www.flypiip.com/jordan-future-grey-white-jorden-trainersce">jordan future grey white jorden</a> <a href="http://www.jimmysjulyjam.com/2015-2016-real-madrid-scccer-uniform-short-sleeves-jersey-black-no-patch-one-the-sleeves-nflv">2015 2016 real madrid scccer uniform short sleeves jersey black no patch one the sleeves</a> <a href="http://www.cakeeaterspgh.com/tory-burch-robinson-mini-shoulder-bag-toryburchr">tory burch robinson mini shoulder bag</a>
mondirco http://www.mondirco.com/
akncmusic
 akncmusic 2018-11-30 07:49回复
#16
<a href="http://www.lavantafilm.com/adidas-zx-flux-schwarz-and-rose-gold-dam%C3%A4nner-glasses-shoesv">adidas zx flux schwarz and rose gold dam盲nner glasses</a> <a href="http://www.floozyspeak.com/nike-air-max-shake-evolve-herre-guld-footd">nike air max shake evolve herre guld</a> <a href="http://www.newjerseycdl.com/nobis-stanford-vs-cartel-nobisr">nobis stanford vs cartel</a> <a href="http://www.issnederland.com/kobe-9-elite-shoesm">kobe 9 elite</a> <a href="http://www.ceespeters.com/air-max-thea-yellow-yarn-trainersa">air max thea yellow yarn</a> <a href="http://www.accsmonnaux.com/air-jordan-8-mens-white-silver-trainersf">air jordan 8 mens white silver</a>
akncmusic http://www.akncmusic.com/
rahwindsor
 rahwindsor 2018-11-29 14:37回复
#15
<a href="http://www.synergysimple.com/nike-dunk-low-mens-gold-orange-skob">nike dunk low mens gold orange</a> <a href="http://www.fhomestudio.com/womens-asics-gel-noosa-tri-8-purple-orange-sneakerd">womens asics gel noosa tri 8 purple orange</a> <a href="http://www.mozhizhou.com/parajumper-m%C3%B6ssa-parajumpersr">parajumper m枚ssa</a> <a href="http://www.getmovedin.com/air-jordan-1-model-all-white-trainersf">air jordan 1 model all white</a> <a href="http://www.webdevbook.com/purple-white-mens-nike-cortez-shoes-sportsd">purple white mens nike cortez shoes</a> <a href="http://www.hotellautram.com/nike-vomero-7-yellow-gold-trainersd">nike vomero 7 yellow gold</a>
rahwindsor http://www.rahwindsor.com/
ratedpractice
 ratedpractice 2018-11-29 02:30回复
#14
<a href="http://www.bambubaits.com/adidas-zx-flux-schwarz-and-rose-gold-dam%C3%A4nner-glasses-shoesv">adidas zx flux schwarz and rose gold dam盲nner glasses</a> <a href="http://www.dandoelroll.com/selfridges-mulberry-bayswater-mulberryr">selfridges mulberry bayswater</a> <a href="http://www.olgroupusainc.com/hermes-belt-buckle-replica-hermesr">hermes belt buckle replica</a> <a href="http://www.joubertets.com/air-jordan-11-red-snakeskin-foote">air jordan 11 red snakeskin</a> <a href="http://www.vspeyedoctors.com/replica-burberry-scarf-uk-scarfr">replica burberry scarf uk</a> <a href="http://www.printonlypros.com/how-much-do-air-jordan-12-cost-foote">how much do air jordan 12 cost</a>
ratedpractice http://www.ratedpractice.com/
reganwhimpey
 reganwhimpey 2018-11-26 07:06回复
#13
<a href="http://www.webgiganten.com/air-jordan-imminent-kvinners-s%C3%B8lv-skoc">air jordan imminent kvinners s酶lv</a> <a href="http://www.ratedpractice.com/air-jordan-1-og-skox">air jordan 1 og</a> <a href="http://www.guntruther.com/womens-nike-free-5.0-v2-mint-green-footc">womens nike free 5.0 v2 mint green</a> <a href="http://www.gstavrakakis.com/adidas-forum-mid-zwart-edition-runningb">adidas forum mid zwart edition</a> <a href="http://www.aesqpharm.com/nike-hyperdunk-2015-flyknit-low-womens-red-silver-sneakera">nike hyperdunk 2015 flyknit low womens red silver</a> <a href="http://www.glasshalfgeek.com/black-moncler-jacket-monclerr">black moncler jacket</a>
[url=http://www.reganwhimpey.com/]reganwhimpey[/url]
ksmartcity
 ksmartcity 2018-11-24 02:10回复
#12
<a href="http://www.instabuttons.com/vintage-burberry-tie-tier">vintage burberry tie</a> <a href="http://www.natalbags.com/new-balance-990-dam%C3%A4nner-lila-sportsb">new balance 990 dam盲nner lila</a> <a href="http://www.oricastg.com/orange-grey-womens-adidas-damian-lillard-shoes-shoesa">orange grey womens adidas damian lillard shoes</a> <a href="http://www.raynne.com/ralph-lauren-big-pony-zip-hoodie-polor">ralph lauren big pony zip hoodie</a> <a href="http://www.elitoyreviews.com/adidas-gray-charlotte-bobcats-nba-bobcats-core-xp-new-era-cap-hatg">adidas gray charlotte bobcats nba bobcats core xp new era cap</a> <a href="http://www.gaeconomics.com/nike-st.-louis-rams-12-steve-smith-elite-navy-blue-team-color-jersey-nflb">nike st. louis rams 12 steve smith elite navy blue team color jersey</a>
ksmartcity http://www.ksmartcity.com/
glasshalfgeek
 glasshalfgeek 2018-11-21 05:43回复
#11
<a href="http://www.belronctx.com/nike-womens-air-max-thea-running-sneakers-skor">nike womens air max thea running sneakers</a> <a href="http://www.reganwhimpey.com/%EF%BB%BFconverse-shoes-shoesz">锘縞onverse shoes</a> <a href="http://www.eryasaat.com/air-jordan-ultra-fly-virginia-tech-skod">air jordan ultra fly virginia tech</a> <a href="http://www.itsanomadlife.com/nike-air-max-1-all-black-skor">nike air max 1 all black</a> <a href="http://www.onlymytouch.com/adidas-tubular-shadow-singapore-skox">adidas tubular shadow singapore</a> <a href="http://www.araricambi.com/flyknit-trainer-kanye-kendrick-footf">flyknit trainer kanye kendrick</a>
glasshalfgeek http://www.glasshalfgeek.com/
captmollie
 captmollie 2018-11-18 16:30回复
#10
<a href="http://www.bonairecliffs.com/toddler-knit-beanie-hat-pattern-toddler-hatf">toddler knit beanie hat pattern toddler</a> <a href="http://www.maxfullforce.com/nike-free-trainer-v7-white-footc">nike free trainer v7 white</a> <a href="http://www.exomotors.com/nike-air-huarache-all-white-zombies-sportsf">nike air huarache all white zombies</a> <a href="http://www.missladymagic.com/new-balance-kids-shoes-skos">new balance kids shoes</a> <a href="http://www.avalonsoccer.com/bon-march%C3%A9-asics-gel-kinsei-2-femmes-or-footc">bon march茅 asics gel kinsei 2 femmes or</a> <a href="http://www.notbore.com/nike-flyknit-trainer-mens-gold-black-skod">nike flyknit trainer mens gold black</a>
captmollie http://www.captmollie.com/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸