phpcms_v9推送到其他栏目后再在其他栏目删除导致数据库出错

修改phpcms/model/content_model.class.php大概454行的update_category_items()函数
- private function update_category_items($catid,$action = 'add',$cache = 0) {
- $this->category_db = pc_base::load_model('category_model');
- if($action=='add') {
- $this->category_db->update(array('items'=>'+=1'),array('catid'=>$catid));
- } else {
- $this->category_db->update(array('items'=>'-=1'),array('catid'=>$catid));
- }
- if($cache) $this->cache_items();
- }
修改为:
- private function update_category_items($catid,$action = 'add',$cache = 0) {
- $this->category_db = pc_base::load_model('category_model');
- if($action=='add') {
- $this->category_db->update(array('items'=>'+=1'),array('catid'=>$catid));
- } else {
- $r =$this->category_db->get_one(array('catid'=>$catid));
- if($r['items']>0)
- {
- $this->category_db->update(array('items'=>'-=1'),array('catid'=>$catid));
- }
- //$this->category_db->update(array('items'=>'-=1'),array('catid'=>$catid));
- }
- if($cache) $this->cache_items();
- }
--prefix=/usr/local/PHP php 安装目录
--with-apxs2=/usr/local/apache/bin/apxs 表示使用apache2.0以上版本,apxs表示使用的apache1.0版本
--with-config-file-path=/usr/local/PHP/etc 指定php.ini位置
--with-MySQL=/usr/local/mysql mysql安装目录,对mysql的支持
--with-MySQLi=/usr/local/mysql/bin/mysql_config mysqli文件目录,优化支持
--enable-safe-mode 打开安全模式
--enable-ftp 打开ftp的支持
--enable-zip 打开对zip的支持
--with-bz2 打开对bz2文件的支持
--with-jpeg-dir 打开对jpeg图片的支持
--with-png-dir 打开对png图片的支持
--with-freetype-dir 打开对freetype字体库的支持
--without-iconv 关闭iconv函数,种字符集间的转换
--with-libXML-dir 打开libxml2库的支持
--with-XMLrpc 打开xml-rpc的c语言
--with-zlib-dir 打开zlib库的支持
--with-gd 打开gd库的支持
--enable-gd-native-ttf 支持TrueType字符串函数库
--with-curl 打开curl浏览工具的支持
--with-curlwrappers 运用curl工具打开url流
--with-ttf 打开freetype1.*的支持,可以不加了
--with-xsl 打开XSLT 文件支持,扩展了libXML2库 ,需要libxslt软件
--with-gettext 打开gnu 的gettext 支持,编码库用到
--with-pear 打开pear命令的支持,PHP扩展用的
--enable-calendar 打开日历扩展功能
--enable-mbstring 多字节,字符串的支持
--enable-bcmath 打开图片大小调整,用到zabbix监控的时候用到了这个模块
--enable-sockets 打开 sockets 支持
--enable-exif 图片的元数据支持
--enable-magic-quotes 魔术引用的支持
--disable-rpath 关闭额外的运行库文件
--disable-debug 关闭调试模式
--with-mime-magic=/usr/share/file/magic.mime 魔术头文件位置
CGI方式安装才用的参数
--enable-fpm 打上PHP-fpm 补丁后才有这个参数,CGI方式安装的启动程序
--enable-fastCGI 支持fastcgi方式启动PHP
--enable-force-CGI-redirect 同上 ,帮助里没有解释
--with-ncurses 支持ncurses 屏幕绘制以及基于文本终端的图形互动功能的动态库
--enable-pcntl freeTDS需要用到的,可能是链接mssql 才用到
mhash和mcrypt算法的扩展
--with-mcrypt 算法
--with-mhash 算法
--with-gmp
--enable-inline-optimization
--with-openssl openssl的支持,加密传输时用到的
--enable-dbase
--with-pcre-dir=/usr/local/bin/pcre-config perl的正则库案安装位置
--disable-dmalloc
--with-gdbm dba的gdbm支持
--enable-sigchild
--enable-sysvsem
--enable-sysvshm
--enable-zend-multibyte 支持zend的多字节
--enable-mbregex
--enable-wddx
--enable-shmop
--enable-soap
jQuery 获取屏幕高度、宽度

- 做手机Web开发做浏览器兼容用到了,所以在网上找了些汇总下。
- alert($(window).height()); //浏览器当前窗口可视区域高度
- alert($(document).height()); //浏览器当前窗口文档的高度
- alert($(document.body).height());//浏览器当前窗口文档body的高度
- alert($(document.body).outerHeight(true));//浏览器当前窗口文档body的总高度 包括border padding margin
- alert($(window).width()); //浏览器当前窗口可视区域宽度
- alert($(document).width());//浏览器当前窗口文档对象宽度
- alert($(document.body).width());//浏览器当前窗口文档body的高度
- alert($(document.body).outerWidth(true));//浏览器当前窗口文档body的总宽度 包括border padding margin
- // 获取页面的高度、宽度
- function getPageSize() {
- var xScroll, yScroll;
- if (window.innerHeight && window.scrollMaxY) {
- xScroll = window.innerWidth + window.scrollMaxX;
- yScroll = window.innerHeight + window.scrollMaxY;
- } else {
- if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
- xScroll = document.body.scrollWidth;
- yScroll = document.body.scrollHeight;
- } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
- xScroll = document.body.offsetWidth;
- yScroll = document.body.offsetHeight;
- }
- }
- var windowWidth, windowHeight;
- if (self.innerHeight) { // all except Explorer
- if (document.documentElement.clientWidth) {
- windowWidth = document.documentElement.clientWidth;
- } else {
- windowWidth = self.innerWidth;
- }
- windowHeight = self.innerHeight;
- } else {
- if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
- windowWidth = document.documentElement.clientWidth;
- windowHeight = document.documentElement.clientHeight;
- } else {
- if (document.body) { // other Explorers
- windowWidth = document.body.clientWidth;
- windowHeight = document.body.clientHeight;
- }
- }
- }
- // for small pages with total height less then height of the viewport
- if (yScroll < windowHeight) {
- pageHeight = windowHeight;
- } else {
- pageHeight = yScroll;
- }
- // for small pages with total width less then width of the viewport
- if (xScroll < windowWidth) {
- pageWidth = xScroll;
- } else {
- pageWidth = windowWidth;
- }
- arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
- return arrayPageSize;
- }
- // 滚动条
- document.body.scrollTop;
- $(document).scrollTop();
- $("#content").height();
- $("#content").innerHeight();//元素内部区域高度,忽略padding、border
- $("#content").outerHeight();//忽略边框
- $("#content").outerHeight(true);//包含边框高度
PHP禁止一些有潜在威胁性的函数

根据电脑51我改动过的:
- disable_functions = phpinfo,system,passthru,eval,exec,chroot,chgrp,chown,scandir,shell_exec,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen,popen,proc_open,opendir
disable_functions = system,passthru,exec,shell_exec,phpinfo,get_current_user,ini_restore,dl,scandir,popen,proc_open,opendir
其中opendir这个是文件浏览的重要函数,禁了这个,大部分PHP木马都没门了。
不过会对一些正常的PHP有时候会造成影响,但是不影响正常使用。比如DZ论坛的后台 文件校验、运行记录等。就有影响了。。。
更严格的一些函数:
- disable_functions = phpinfo,system,passthru,exec,chroot,chgrp,chown,scandir,shell_exec,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,get_current_user,leak,putenv,popen,proc_open,opendir
常用代码CSS Case Modules

- /*Top-sidebar-bg*/
- <div style="height: 30px; width: 100%; text-align: center; position: relative; line-height: 30px; background-color:#FFF9E1;" class="xiatui">幸福摩天轮,激情过山车!点击下载游乐主题精美壁纸,重拾童年美好记忆,尽享欢乐游戏时光!<a style="color:#fff;padding:5px 10px;background-color:#aca794;margin-left:5px;" target="_blank" href="#">过山车与摩天轮桌面主题</a><a style="padding-left:30px;" target="_target" href="#">查看更多</a><span style="position:absolute;left:50%;margin-left:490px;cursor:pointer;color:#cfcfcf;font-weight:bold;" id="UP">X</span></div>
- <div style="background-color: #0072BC;height: 40px;margin: 0 auto;width: 100%;"></div>
- /*背景AD: Left-Right*/
- <div style="background:url(http://stimgcn3.s-msn.com/msnportal/hp/2013/06/09/5381700f-5943-49a4-b751-9239db2b1dcb.jpg) no-repeat 0px 0px;height:450px;left: 50%;margin-left: -700px;position: fixed;top: 70px;width: 200px;" class="left_Bg"></div>
- <div style="background:url(http://stimgcn3.s-msn.com/msnportal/hp/2013/06/09/5381700f-5943-49a4-b751-9239db2b1dcb.jpg) no-repeat right top;height:450px;right: 50%;margin-right: -700px;position: fixed;top: 70px;width: 200px;" class="right_Bg"></div>
- /*video Baidu Change the width of sidebar and main margin-left */
- <div id="wrapper" style="height: 100%;position: relative;">
- <div id="sidebar" style="background: url("/browse_static/play_iframe/layout/bg_side_bbfcfbf7.gif") repeat-y scroll 100% 0 #323232;
- height: 100%;left: 0;position: absolute;top: 0;width: 136px;"></div>
- <div id="main" style="height: 100%;margin-left: 136px;"></div>
- </div>
jquery.cookie 使用方法

- <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="js/jquery.cookie.js"></script>
- <head>
- <title>cookie保存用户名密码</title>
- <script src="Scripts/jquery-1.4.2.js" type="text/javascript"></script>
- <script src="Scripts/jquery.cookie.js" type="text/javascript"></script>
- <!--插件必须放在jquery下面-->
- <script type="text/javascript">
- $(function () {
- $("#btn").click(function () {
- var hname = $("#txtname").val();
- var hpassword = $("#txtpassword").val();
- $.cookie("hostname", hname, { expires: 1 });
- $.cookie("hostpassword", hpassword, { expires: 1 });
- if (hname == "admin" && hpassword == "123456") {
- alert("欢迎admin登入");
- }
- });
- var hname = $.cookie("hostname");
- var hpassword = $.cookie("hostpassword");
- if (hname && hpassword) {
- $("#txtname").val(hname);
- $("#txtpassword").val(hpassword);
- }
- });
- </script>
- </head>
- <body>
- <table border="1">
- <tr>
- <td>用户名:</td>
- <td><input type="text" id="txtname" /></td>
- </tr>
- <tr>
- <td>密码:</td>
- <td><input type="password" id="txtpassword" /></td>
- </tr>
- <tr>
- <td colspan="2"><input type="button" id="btn" value="进入" /></td>
- </tr>
- </table>
- </body>
使用jquery实现对cookie的操作 前段时间刚学完jquery和ajax,老师就要我们使用jquery和ajax做一个项目,功能类似于淘宝一样的网上购物,但是不允许使用服务器控件。那么要想保存用户登录信息的cookie也就只有使用jquery了。其实使用query操作cookie也不难。
- $(function() {
- //判断本地之后存在cookie,如果存在即取出里面的值
- if($.cookie("UserInfo")!=null)
- {
- //获取存放在cookie中的值 var cookieValue = $.cookie("UserInfo");
- //将获取到的cookie中的值以";"分割,会分别得到id与count的字符串
- //分割得到的值会存放还一个数组中 var cookieArr=cookieValue.split(';');
- //这样获取到得的cookieArr中的个元素以及值分别为:
- //cookieArr[0]:zhangsang 对应用户的用户名
- //cookieArr[1]:123456 对应用户的密码
- //cookieArr[2]:1 对应用户的编号
- }
- })
- $.ajax({
- type: "post",
- contentType: "application/json",
- url: "WebServices/UserWebService.asmx/GetUserInfo",
- data: "{userName:'" + userName + "',userPwd:'" + userPwd + "'}",
- dataType: "json",
- success: function (result)
- {
- $.cookie("UserInfo", result.d, { expires: 7 });
- }
- });
- $(".close").click(function(){
- $(this).parents('div.ad-box:eq(0)').hide();
- $.cookie('topad', 'test', { path: '/', expires: 1 });
- return false;
- })
- //判断如果topad不为空的话就执行
- if($.cookie("topad")!=null){
- $(".topad").hide();
- }
- <div class="firstad topad ad-box">
- <h4>这里的第一个广告</h4>
- <div id="close-boxs"><div class="close"></div></div>
- </div><!-- firstad end -->
- .firstad{width:800px;height:50px;line-height:50px;text-align:center;color:#fff;width:auto;background:#0000ff;position:relative;}
- .close{width:10px;height:10px;background:#FF0000;border:1px solid white;position:absolute;top:0px;rightright:0;cursor:pointer}
jQuery替换节点

如果要替换某个节点,jQuery提供了相应的方法,即replaceWith()和replaceAll()。replaceWith()方法的作用是将所有的元素都替换成指定的HTML或者DOM元素。
- $("p").replaceWith("<strong>我在学习jQuery</strong>");
也可以使用jQuery中另一种方法replaceAll()来实现,该方法与replaceWith()方法的左右相同,知识点到了replaceWith()操作,可以使用如下的jQuery代码实现同样的功能:
- $("<strong>我在学习jQuery</strong>").replaceAll("p");
该示例用到的HTML代码:
- <p>我在学习jQuery</p>
jQuery简易下拉面板实例教程

下面,让我们来学习制作一个简易的下拉面板。你可能已经见过许多下拉面板,在上面你只需要点击提示按钮,页面就会出现一个下拉面板。
下面是核心jQuery代码:
- $(document).ready(function(){
- $(".btn-slide").click(function(){
- $("#panel").slideToggle("slow");
- $(this).toggleClass("active");
- return false;
- });
- });
当点击一个带有class=”btn-slide”的元素时,jQuery就会对 <div id=”panel”> 元素进行展收操作(slideToggle),并且给<a class=”btn-slide”>元素添加一个class=”active”的属性。然后.active class通过CSS背景定位改变箭头的背景位置。
jQuery停止动画和判断是否处于动画状态

1、停止元素的动画
很多时候需要停止匹两己元素正在进行的动画,例如上例的动画,如l果需要在某处停止动画,需要使用stop()方法。stop()方法的语法缩构为:
stop([clearQueue][,gotoEnd]);
参数clearQHCHC和gotoEnd都足町选的参数,为Boolean值(ture或flase)。clearQueue代表足胥婴清空术执{j.完的动嘶队列,90toEnd代表是否直接将萨在执行的动画跳转到术状态。
2.判断元素是否处于动画状态
在使用animate()方法的时候,要避免动画积累而导致的动画与用户的行为不一致.当用户快速在某个元素上执行animate()动画的时,就会出现动画积累。解决方法是判断元素是否正处于动画状态,如果元素不处于动画状态,才为元素添加新的动画,否则不添加。代码如下:
- if (!$(element).is(":animated")) {
- //判断元素是否正处于动画状态
- //如果没有进行动画,则添加动画
- }
这个判断方法在animate()动画中经常被用到,需要特别注意。
jQuery CSS-DOM操作

CSS-DOM技术简单来书就是读取和设置style对象的各种属性。style属性很有用,但最大不足是无法通过它来提取到通过外部CSS设置的样式信息,然而在jQuery中,这些都是非常的简单。
可以直接利用css()方法获取元素的样式属性,jQuery代码如下;
- $("p").css("color"); // 获取<p>元素的样式颜色
无论color属性是外部CSS导入,还是直接拼接在HTML元素里,css()方法都可以获取到属性style里的其它属性的值。
也可以直接利用css()方法设置某个元素的单个样式,例如:
- $("p").css("color","red"); //设置<p>元素的样式颜色为红色
与attr()方法一样,css()方法也可以同时设置多个样式属性,代码如下:
- $("p").css({"fontsize":"30px", "backgroundcolor":"#EEE"})
- //同时设置字体大小和背景色
对透明度的设置,可以直接使用opacity属性,则可以通过如下jQuery代码实现:
- $("p").css("opacity","0.5");
如果获取某个元素的height属性,则可以通过如下jQuery代码实现;
- $(element).css("height");
在jQuery中还有另外一种方法也可以获取元素的高度,即height().他的左右是取得匹配元素当前计算的高度(px)。jQuery代码如下:
- $("p").height();
height()方法也能用来设置元素的高度,如果传递的值是一个数字,则默认单位为px.如果要用其他单位(例如em),则必须传递一个字符串。jQuery代码如下:
- $("p").height(100);
- $("p").height("10em");
与height()方法对应的还有一个width()方法,它可以取得匹配元素的宽度值(px)。
- $("p").width(); //获取<p>元素的宽度值
同样,width()方法也能用来设置元素的宽度
- $("p").width("400px"); //用来设置<p>元素的宽度值为400px
此外,在CSS-DOM中,还有以下几个经常使用的方法。
1.offset()方法
它的作用是获取元素在当前视窗的相对偏移,其中返回的对象包含两个属性,即top和left,它只对可见元素有效。例如用它来获取<p>元素的偏移量,jQuery代码如下:
- var offset = $("p").offset(); //获取<p>元素的offset()
- var left = offset.left;
- var top = offset.top;
2.position()方法
它的作用是获取元素相对于最近的一个postion样式属性设置为relative或者absolute的祖父节点的相对偏移,与offset()一样,它返回的对象也包括两个属性,即top和left。jQuery代码如下:
- var postion = $("p").postion(); //获取<p>元素的postion()
- var left = postion.left; //获取左偏移
- var top = postion.top; //获取右偏移
3.scrollTop方法和scrollLeft()方法
这两个方法的作用分别是获取元素的滚动条距顶端的距离和距左侧的距离。例如使用下面的代码获取<p>元素的滚动条距离:
- var $p = $("p")
- var scroolTop = $p.scrollTop();
- var scroolLeft = $p.scrollLeft();
另外,可以为这两个方法指定一个参数,控制元素的滚动条到指定位置。例如使用如下代码控制元素内的滚动条滚动到距顶端300和距左侧300的位置;
- $("textarea").scrollTop(300);
- $("textarea").scrollLeft(300);