<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>UIcity &#187; blog</title>
	<atom:link href="http://uicity.net/archives/category/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://uicity.net</link>
	<description>26z’s blog, my life and the thing i interested in</description>
	<lastBuildDate>Mon, 16 Aug 2010 06:05:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Drupal Core templates</title>
		<link>http://uicity.net/archives/200</link>
		<comments>http://uicity.net/archives/200#comments</comments>
		<pubDate>Mon, 16 Aug 2010 06:04:13 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[drupal]]></category>

		<guid isPermaLink="false">http://uicity.net/archives/200</guid>
		<description><![CDATA[
Default templates:
These are the default template (.tpl.php) files provided  by core. Documentation on the variables and purpose of these templates  are located inside the templates. There is a default set of variables available to all templates.
The templates handled by PHPTemplate in 5.x were also moved. PHPTemplate no longer handles template files.
In order to [...]]]></description>
			<content:encoded><![CDATA[<dl>
<dt id="default-templates">Default templates:</dt>
<dd>These are the default template <em>(.tpl.php)</em> files provided  by core. Documentation on the variables and purpose of these templates  are located inside the templates. There is a <a href="http://drupal.org/node/226776">default set of variables</a> available to all templates.</p>
<p><em>The templates handled by PHPTemplate in 5.x were also moved. PHPTemplate no longer handles template files.</em></p>
<p>In order to override these templates, all you need to do is copy them into your theme folder and <a href="http://drupal.org/node/173880#theme-registry">clear the theme registry</a>.</p>
<dl>
<dt id="aggregator-tpl">Aggregator</dt>
<dd><em>&#8220;modules/aggregator/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/aggregator/aggregator-feed-source.tpl.php/6">aggregator-feed-source.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/aggregator/aggregator-item.tpl.php/6">aggregator-item.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/aggregator/aggregator-summary-item.tpl.php/6">aggregator-summary-item.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/aggregator/aggregator-summary-items.tpl.php/6">aggregator-summary-items.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/aggregator/aggregator-wrapper.tpl.php/6">aggregator-wrapper.tpl.php</a></li>
</ul>
</dd>
<dt id="block-tpl">Block</dt>
<dd><em>&#8220;modules/system/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/system/block.tpl.php/6">block.tpl.php</a></li>
</ul>
<p><em>&#8220;modules/block/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/block/block-admin-display-form.tpl.php/6">block-admin-display-form.tpl.php</a></li>
</ul>
</dd>
<dt id="book-tpl">Book</dt>
<dd><em>&#8220;modules/book/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/book/book-all-books-block.tpl.php/6">book-all-books-block.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/book/book-export-html.tpl.php/6">book-export-html.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/book/book-navigation.tpl.php/6">book-navigation.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/book/book-node-export-html.tpl.php/6">book-node-export-html.tpl.php</a></li>
</ul>
</dd>
<dt id="comment-tpl">Comment</dt>
<dd><em>&#8220;modules/comment/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/comment/comment-folded.tpl.php/6">comment-folded.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/comment/comment-wrapper.tpl.php/6">comment-wrapper.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/comment/comment.tpl.php/6">comment.tpl.php</a></li>
</ul>
</dd>
<dt id="forum-tpl">Forum</dt>
<dd><em>&#8220;modules/forum/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/forum/forum-icon.tpl.php/6">forum-icon.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/forum/forum-list.tpl.php/6">forum-list.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/forum/forum-submitted.tpl.php/6">forum-submitted.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/forum/forum-topic-list.tpl.php/6">forum-topic-list.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/forum/forum-topic-navigation.tpl.php/6">forum-topic-navigation.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/forum/forums.tpl.php/6">forums.tpl.php</a></li>
</ul>
</dd>
<dt id="node-tpl">Node</dt>
<dd><em>&#8220;modules/node/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/node/node.tpl.php/6">node.tpl.php</a></li>
</ul>
</dd>
<dt id="poll-tpl">Poll</dt>
<dd><em>&#8220;modules/poll/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/poll/poll-bar-block.tpl.php/6">poll-bar-block.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/poll/poll-bar.tpl.php/6">poll-bar.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/poll/poll-results-block.tpl.php/6">poll-results-block.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/poll/poll-results.tpl.php/6">poll-results.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/poll/poll-vote.tpl.php/6">poll-vote.tpl.php</a></li>
</ul>
</dd>
<dt id="profile-tpl">Profile</dt>
<dd><em>&#8220;modules/profile/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/profile/profile-block.tpl.php/6">profile-block.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/profile/profile-listing.tpl.php/6">profile-listing.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/profile/profile-wrapper.tpl.php/6">profile-wrapper.tpl.php</a></li>
</ul>
</dd>
<dt id="search-tpl">Search</dt>
<dd><em>&#8220;modules/search/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/search/search-block-form.tpl.php/6">search-block-form.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/search/search-result.tpl.php/6">search-result.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/search/search-results.tpl.php/6">search-results.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/search/search-theme-form.tpl.php/6">search-theme-form.tpl.php</a></li>
</ul>
</dd>
<dt id="user-tpl">User</dt>
<dd><em>&#8220;modules/user/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/user/user-picture.tpl.php/6">user-picture.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/user/user-profile-category.tpl.php/6">user-profile-category.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/user/user-profile-item.tpl.php/6">user-profile-item.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/user/user-profile.tpl.php/6">user-profile.tpl.php</a></li>
</ul>
</dd>
<dt id="system-tpl">System</dt>
<dd><em>&#8220;modules/system/&#8230;&#8221;</em></p>
<ul>
<li><a href="http://api.drupal.org/api/file/modules/system/page.tpl.php/6">page.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/system/maintenance-page.tpl.php/6">maintenance-page.tpl.php</a></li>
<li><a href="http://api.drupal.org/api/file/modules/system/box.tpl.php/6">box.tpl.php</a></li>
</ul>
</dd>
</dl>
</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/200/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>欢乐谷</title>
		<link>http://uicity.net/archives/197</link>
		<comments>http://uicity.net/archives/197#comments</comments>
		<pubDate>Thu, 27 May 2010 15:25:17 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://uicity.net/?p=197</guid>
		<description><![CDATA[




]]></description>
			<content:encoded><![CDATA[<p><a href="http://uicity.net/wp-content/uploads/2010/05/happy_valley_1.jpg"><img class="alignnone size-full wp-image-194" title="happy_valley_1" src="http://uicity.net/wp-content/uploads/2010/05/happy_valley_1.jpg" alt="" width="650" height="436" /></a><br />
<span id="more-197"></span></p>
<p><a href="http://uicity.net/wp-content/uploads/2010/05/happy_valley_2.jpg"><img class="alignnone size-full wp-image-195" title="happy_valley_2" src="http://uicity.net/wp-content/uploads/2010/05/happy_valley_2.jpg" alt="" width="650" height="436" /></a></p>
<p><a href="http://uicity.net/wp-content/uploads/2010/05/happy_valley_3.jpg"><img class="alignnone size-full wp-image-196" title="happy_valley_3" src="http://uicity.net/wp-content/uploads/2010/05/happy_valley_3.jpg" alt="" width="650" height="436" /></a></p>
<p><a href="http://uicity.net/wp-content/uploads/2010/05/happy_valley_4.jpg"><img class="alignnone size-full wp-image-193" title="happy_valley_4" src="http://uicity.net/wp-content/uploads/2010/05/happy_valley_4.jpg" alt="" width="500" height="745" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/197/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Spam 模块</title>
		<link>http://uicity.net/archives/186</link>
		<comments>http://uicity.net/archives/186#comments</comments>
		<pubDate>Sun, 28 Mar 2010 06:06:43 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.uicity.net/?p=186</guid>
		<description><![CDATA[网站上垃圾留言防不胜防，只好安装spam模块。
CAPTCHA：
不少人在使用的模块，但个人感觉每次必须输入验证码有碍用户体验，算不上理想的模块。
Mollom:
Drupal官方开发人员发布的模块，支持wordpress、drupal，在用户发布评论的同时进行验证，如果不确信是否为垃圾留言，就提示用户输入验证码。但是在使用的过程中发现，对明显不是垃圾评论的评论，mollom也出现验证码，并且在开启了ajax_comments时不太好用。
另外还有Spam、antispam两个模块可供选择。
]]></description>
			<content:encoded><![CDATA[<p>网站上垃圾留言防不胜防，只好安装spam模块。</p>
<p>CAPTCHA：<br />
不少人在使用的模块，但个人感觉每次必须输入验证码有碍用户体验，算不上理想的模块。</p>
<p>Mollom:<br />
Drupal官方开发人员发布的模块，支持wordpress、drupal，在用户发布评论的同时进行验证，如果不确信是否为垃圾留言，就提示用户输入验证码。但是在使用的过程中发现，对明显不是垃圾评论的评论，mollom也出现验证码，并且在开启了ajax_comments时不太好用。</p>
<p>另外还有Spam、antispam两个模块可供选择。</p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/186/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal &#8211; HTTP Server Request Fails</title>
		<link>http://uicity.net/archives/183</link>
		<comments>http://uicity.net/archives/183#comments</comments>
		<pubDate>Mon, 01 Mar 2010 07:23:21 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.uicity.net/?p=183</guid>
		<description><![CDATA[IDSOO转移到lighttpd后，在Drupal状态报告里看到“HTTP Server Request Fails”，即“HTTP 请求状态 失败”，后经在drupal.org查找，发现在setting.php中增加以下代码即可解决问题：
$conf['drupal_http_request_fails'] = FALSE;
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.idsoo.com/">IDSOO</a>转移到lighttpd后，在Drupal状态报告里看到“HTTP Server Request Fails”，即“HTTP 请求状态 失败”，后经在drupal.org查找，发现在setting.php中增加以下代码即可解决问题：</p>
<p>$conf['drupal_http_request_fails'] = FALSE;</p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/183/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ecshop会员整合</title>
		<link>http://uicity.net/archives/181</link>
		<comments>http://uicity.net/archives/181#comments</comments>
		<pubDate>Sun, 28 Feb 2010 12:16:58 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.uicity.net/?p=181</guid>
		<description><![CDATA[ECSHOP后台会员整合，只允许整合一个应用。
如果想整合多个应用，就需要先和UCenter整合，之后再通过UCenter去整合更多的应用。
整合之后工作流程：
1.首先在ini.php文件中使用 ini_user()函数来判断整合插件名称，此函数定义在lib_common.php文件中。
并生成相应的插件对象，方便以后调用。
$user = new $ini_user();

/**
* 初始化会员数据整合类
*
* @access public
* @return object
*/
function &#38;init_users()
{
$set_modules = false;
static $cls = null;
if ($cls != null)
{
return $cls;
}
include_once(ROOT_PATH . &#8216;includes/modules/integrates/&#8217; . $GLOBALS['_CFG']['integrate_code'] . &#8216;.php&#8217;);
$cfg = unserialize($GLOBALS['_CFG']['integrate_config']);
$cls = new $GLOBALS['_CFG']['integrate_code']($cfg);
return $cls;
}
ecshop整合过程将需要整合的应用数据库看做主库。
比如ec和pw整合，就以PW为主库，将ec的会员信息全部导入到pw会员表中。
之后在ecshop登陆的时候，会通过user.php中的$user-&#62;login($username, $password)函数，
和integrates/integrate.php中的sync()函数判断该用户是否在ecshop中存在，
如果不存在，则从PW中拷贝一条记录过来。
具体分析从ecshop登陆的过程：
1：检查username是否在pw_members表存在，如果存在，通过if($this-&#62;need_sync)判断是否需要同步登陆,
如果需要同步登陆，则调用$this-&#62;sync()函数。具体参考login函数.
function login($username, $password)
{
if ($this-&#62;check_user($username, $password) &#62; 0)
{
if ($this-&#62;need_sync)
{
$this-&#62;sync($username,$password);
}
$this-&#62;set_session($username);       //同步登陆成功后，设置session
$this-&#62;set_cookie($username);        //同步登陆成功后，设置cookie，保存登陆状态。
return true;
}
else
{
return false;
}
}
2：同步登陆 sync 函数分析：
首先通过 get_profile_by_name [...]]]></description>
			<content:encoded><![CDATA[<p>ECSHOP后台会员整合，只允许整合一个应用。<br />
如果想整合多个应用，就需要先和UCenter整合，之后再通过UCenter去整合更多的应用。</p>
<p><span style="font-size: small;"><strong>整合之后工作流程：</strong></span></p>
<p>1.首先在ini.php文件中使用 ini_user()函数来判断整合插件名称，此函数定义在lib_common.php文件中。<br />
并生成相应的插件对象，方便以后调用。</p>
<p>$user = new $ini_user();<br />
<span id="more-181"></span><br />
<strong>/**<br />
* 初始化会员数据整合类<br />
*<br />
* @access public<br />
* @return object<br />
*/<br />
function &amp;init_users()<br />
{<br />
$set_modules = false;<br />
static $cls = null;<br />
if ($cls != null)<br />
{<br />
return $cls;<br />
}<br />
include_once(ROOT_PATH . &#8216;includes/modules/integrates/&#8217; . $GLOBALS['_CFG']['integrate_code'] . &#8216;.php&#8217;);<br />
$cfg = unserialize($GLOBALS['_CFG']['integrate_config']);<br />
$cls = new $GLOBALS['_CFG']['integrate_code']($cfg);</p>
<p>return $cls;<br />
}</strong></p>
<p>ecshop整合过程将需要整合的应用数据库看做主库。<br />
比如ec和pw整合，就以PW为主库，将ec的会员信息全部导入到pw会员表中。<br />
之后在ecshop登陆的时候，会通过user.php中的$user-&gt;login($username, $password)函数，<br />
和integrates/integrate.php中的sync()函数判断该用户是否在ecshop中存在，<br />
如果不存在，则从PW中拷贝一条记录过来。</p>
<p>具体分析从ecshop登陆的过程：<br />
1：检查username是否在pw_members表存在，如果存在，通过if($this-&gt;need_sync)判断是否需要同步登陆,<br />
如果需要同步登陆，则调用$this-&gt;sync()函数。具体参考login函数.</p>
<p><strong>function login($username, $password)<br />
{<br />
if ($this-&gt;check_user($username, $password) &gt; 0)<br />
{<br />
if ($this-&gt;need_sync)<br />
{<br />
$this-&gt;sync($username,$password);<br />
}<br />
$this-&gt;set_session($username);       //同步登陆成功后，设置session<br />
$this-&gt;set_cookie($username);        //同步登陆成功后，设置cookie，保存登陆状态。</p>
<p>return true;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}</strong></p>
<p>2：同步登陆 sync 函数分析：</p>
<p>首先通过 get_profile_by_name 函数从pw_members表中来获得用户基本信息。<br />
SQL语句如下：<br />
<strong>SELECT uid AS user_id,username AS user_name,email AS email,gender AS sex,<br />
bday AS birthday,regdate AS reg_time, password AS password<br />
FROM `phpwind_53`.`pw_members` WHERE username=&#8217;测试&#8217;;</strong></p>
<p>然后从ecs_users表中根据 username 来获取用户信息，<br />
如果信息为空，则表明ecshop中不存在该用户，就将该用户的信息插入到ecs_users表中。<br />
如果信息不为空，则判断ecs_users表中和pw_members表中的用户信息是否一致，<br />
如果不一致，则以pw_members表中的数据为准，进而需要update下ecs_users表中的信息数据，使其与pw中数据一致。</p>
<p>/**<br />
*  会员同步<br />
*<br />
* @access  public<br />
* @param<br />
*<br />
* @return void<br />
*/<br />
<strong> function sync ($username, $password=&#8221;, $md5password=&#8221;)<br />
{<br />
if ((!empty($password)) &amp;&amp; empty($md5password))<br />
{<br />
$md5password = md5($password);<br />
}</p>
<p>$main_profile = $this-&gt;get_profile_by_name($username);</p>
<p>if (empty($main_profile))<br />
{<br />
return false;<br />
}</p>
<p>$sql = &#8220;SELECT user_name, email, password, sex, birthday&#8221;.<br />
&#8221; FROM &#8221; . $GLOBALS['ecs']-&gt;table(&#8216;users&#8217;).<br />
&#8221; WHERE user_name = &#8216;$username&#8217;&#8221;;</p>
<p>$profile = $GLOBALS['db']-&gt;getRow($sql);<br />
if (empty($profile))<br />
{<br />
/* 向商城表插入一条新记录 */<br />
if (empty($md5password))<br />
{<br />
$sql = &#8220;INSERT INTO &#8221; . $GLOBALS['ecs']-&gt;table(&#8216;users&#8217;).<br />
&#8220;(user_name, email, sex, birthday, reg_time)&#8221;.<br />
&#8221; VALUES(&#8216;$username&#8217;, &#8216;&#8221; .$main_profile['email'].&#8221;&#8216;,&#8217;&#8221;.<br />
$main_profile['sex'] . &#8220;&#8216;,&#8217;&#8221; . $main_profile['birthday'] . &#8220;&#8216;,&#8217;&#8221; . $main_profile['reg_time'] . &#8220;&#8216;)&#8221;;<br />
}<br />
else<br />
{<br />
$sql = &#8220;INSERT INTO &#8221; . $GLOBALS['ecs']-&gt;table(&#8216;users&#8217;).<br />
&#8220;(user_name, email, sex, birthday, reg_time, password)&#8221;.<br />
&#8221; VALUES(&#8216;$username&#8217;, &#8216;&#8221; .$main_profile['email'].&#8221;&#8216;,&#8217;&#8221;.<br />
$main_profile['sex'] . &#8220;&#8216;,&#8217;&#8221; . $main_profile['birthday'] . &#8220;&#8216;,&#8217;&#8221; .<br />
$main_profile['reg_time'] . &#8220;&#8216;, &#8216;$md5password&#8217;)&#8221;;</p>
<p>}</p>
<p>$GLOBALS['db']-&gt;query($sql);</p>
<p>return true;<br />
}<br />
else<br />
{<br />
$values = array();<br />
if ($main_profile['email'] != $profile['email'])<br />
{<br />
$values[] = &#8220;email=&#8217;&#8221; . $main_profile['email'] . &#8220;&#8216;&#8221;;<br />
}<br />
if ($main_profile['sex'] != $profile['sex'])<br />
{<br />
$values[] = &#8220;sex=&#8217;&#8221; . $main_profile['sex'] . &#8220;&#8216;&#8221;;<br />
}<br />
if ($main_profile['birthday'] != $profile['birthday'])<br />
{<br />
$values[] = &#8220;birthday=&#8217;&#8221; . $main_profile['birthday'] . &#8220;&#8216;&#8221;;<br />
}<br />
if ((!empty($md5password)) &amp;&amp; ($md5password != $profile['password']))<br />
{<br />
$values[] = &#8220;password=&#8217;&#8221; . $md5password . &#8220;&#8216;&#8221;;<br />
}</p>
<p>if (empty($values))<br />
{<br />
return  true;<br />
}<br />
else<br />
{<br />
$sql = &#8220;UPDATE &#8221; . $GLOBALS['ecs']-&gt;table(&#8216;users&#8217;).<br />
&#8221; SET &#8221; . implode(&#8220;, &#8220;, $values).<br />
&#8221; WHERE user_name=&#8217;$username&#8217;&#8221;;</p>
<p>$GLOBALS['db']-&gt;query($sql);</p>
<p>return true;<br />
}<br />
}<br />
}</strong></p>
<p>3.设置cookies<br />
ECSHOP所需的cookies是通过integrate/integrate.php中的 set_cookies来完成设置<br />
PHPwind所需的是通过整合接口文件phpwind.php中的set_cookies来完成设置</p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/181/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ECSHOP 会员整合功能分析</title>
		<link>http://uicity.net/archives/179</link>
		<comments>http://uicity.net/archives/179#comments</comments>
		<pubDate>Fri, 26 Feb 2010 09:12:14 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.uicity.net/?p=179</guid>
		<description><![CDATA[ECSHOP后台会员整合，只允许整合一个应用。
如果想整合多个应用，就需要先和UCenter整合，之后再通过UCenter去整合更多的应用。
整合之后工作流程：
1.首先在ini.php文件中使用 ini_user()函数来判断整合插件名称，此函数定义在lib_common.php文件中。
并生成相应的插件对象，方便以后调用。

$user = new $ini_user();
/**
* 初始化会员数据整合类
*
* @access public
* @return object
*/
function &#38;init_users()
{
$set_modules = false;
static $cls = null;
if ($cls != null)
{
return $cls;
}
include_once(ROOT_PATH . &#8216;includes/modules/integrates/&#8217; . $GLOBALS['_CFG']['integrate_code'] . &#8216;.php&#8217;);
$cfg = unserialize($GLOBALS['_CFG']['integrate_config']);
$cls = new $GLOBALS['_CFG']['integrate_code']($cfg);
return $cls;
}
ecshop整合过程将需要整合的应用数据库看做主库。
比如ec和pw整合，就以PW为主库，将ec的会员信息全部导入到pw会员表中。
之后在ecshop登陆的时候，会通过user.php中的$user-&#62;login($username, $password)函数，
和integrates/integrate.php中的sync()函数判断该用户是否在ecshop中存在，
如果不存在，则从PW中拷贝一条记录过来。
具体分析从ecshop登陆的过程：
1：检查username是否在pw_members表存在，如果存在，通过if($this-&#62;need_sync)判断是否需要同步登陆,
如果需要同步登陆，则调用$this-&#62;sync()函数。具体参考login函数.
function login($username, $password)
{
if ($this-&#62;check_user($username, $password) &#62; 0)
{
if ($this-&#62;need_sync)
{
$this-&#62;sync($username,$password);
}
$this-&#62;set_session($username);       //同步登陆成功后，设置session
$this-&#62;set_cookie($username);        //同步登陆成功后，设置cookie，保存登陆状态。
return true;
}
else
{
return false;
}
}
2：同步登陆 sync 函数分析：
首先通过 get_profile_by_name [...]]]></description>
			<content:encoded><![CDATA[<p>ECSHOP后台会员整合，只允许整合一个应用。<br />
如果想整合多个应用，就需要先和UCenter整合，之后再通过UCenter去整合更多的应用。</p>
<p><span style="font-size: small;"><strong>整合之后工作流程：</strong></span></p>
<p>1.首先在ini.php文件中使用 ini_user()函数来判断整合插件名称，此函数定义在lib_common.php文件中。<br />
并生成相应的插件对象，方便以后调用。<br />
<span id="more-179"></span><br />
$user = new $ini_user();</p>
<p><strong>/**<br />
* 初始化会员数据整合类<br />
*<br />
* @access public<br />
* @return object<br />
*/<br />
function &amp;init_users()<br />
{<br />
$set_modules = false;<br />
static $cls = null;<br />
if ($cls != null)<br />
{<br />
return $cls;<br />
}<br />
include_once(ROOT_PATH . &#8216;includes/modules/integrates/&#8217; . $GLOBALS['_CFG']['integrate_code'] . &#8216;.php&#8217;);<br />
$cfg = unserialize($GLOBALS['_CFG']['integrate_config']);<br />
$cls = new $GLOBALS['_CFG']['integrate_code']($cfg);</p>
<p>return $cls;<br />
}</strong></p>
<p>ecshop整合过程将需要整合的应用数据库看做主库。<br />
比如ec和pw整合，就以PW为主库，将ec的会员信息全部导入到pw会员表中。<br />
之后在ecshop登陆的时候，会通过user.php中的$user-&gt;login($username, $password)函数，<br />
和integrates/integrate.php中的sync()函数判断该用户是否在ecshop中存在，<br />
如果不存在，则从PW中拷贝一条记录过来。</p>
<p>具体分析从ecshop登陆的过程：<br />
1：检查username是否在pw_members表存在，如果存在，通过if($this-&gt;need_sync)判断是否需要同步登陆,<br />
如果需要同步登陆，则调用$this-&gt;sync()函数。具体参考login函数.</p>
<p><strong>function login($username, $password)<br />
{<br />
if ($this-&gt;check_user($username, $password) &gt; 0)<br />
{<br />
if ($this-&gt;need_sync)<br />
{<br />
$this-&gt;sync($username,$password);<br />
}<br />
$this-&gt;set_session($username);       //同步登陆成功后，设置session<br />
$this-&gt;set_cookie($username);        //同步登陆成功后，设置cookie，保存登陆状态。</p>
<p>return true;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}</strong></p>
<p>2：同步登陆 sync 函数分析：</p>
<p>首先通过 get_profile_by_name 函数从pw_members表中来获得用户基本信息。<br />
SQL语句如下：<br />
<strong>SELECT uid AS user_id,username AS user_name,email AS email,gender AS sex,<br />
bday AS birthday,regdate AS reg_time, password AS password<br />
FROM `phpwind_53`.`pw_members` WHERE username=&#8217;测试&#8217;;</strong></p>
<p>然后从ecs_users表中根据 username 来获取用户信息，<br />
如果信息为空，则表明ecshop中不存在该用户，就将该用户的信息插入到ecs_users表中。<br />
如果信息不为空，则判断ecs_users表中和pw_members表中的用户信息是否一致，<br />
如果不一致，则以pw_members表中的数据为准，进而需要update下ecs_users表中的信息数据，使其与pw中数据一致。</p>
<p>/**<br />
*  会员同步<br />
*<br />
* @access  public<br />
* @param<br />
*<br />
* @return void<br />
*/<br />
<strong> function sync ($username, $password=&#8221;, $md5password=&#8221;)<br />
{<br />
if ((!empty($password)) &amp;&amp; empty($md5password))<br />
{<br />
$md5password = md5($password);<br />
}</p>
<p>$main_profile = $this-&gt;get_profile_by_name($username);</p>
<p>if (empty($main_profile))<br />
{<br />
return false;<br />
}</p>
<p>$sql = &#8220;SELECT user_name, email, password, sex, birthday&#8221;.<br />
&#8221; FROM &#8221; . $GLOBALS['ecs']-&gt;table(&#8216;users&#8217;).<br />
&#8221; WHERE user_name = &#8216;$username&#8217;&#8221;;</p>
<p>$profile = $GLOBALS['db']-&gt;getRow($sql);<br />
if (empty($profile))<br />
{<br />
/* 向商城表插入一条新记录 */<br />
if (empty($md5password))<br />
{<br />
$sql = &#8220;INSERT INTO &#8221; . $GLOBALS['ecs']-&gt;table(&#8216;users&#8217;).<br />
&#8220;(user_name, email, sex, birthday, reg_time)&#8221;.<br />
&#8221; VALUES(&#8216;$username&#8217;, &#8216;&#8221; .$main_profile['email'].&#8221;&#8216;,&#8217;&#8221;.<br />
$main_profile['sex'] . &#8220;&#8216;,&#8217;&#8221; . $main_profile['birthday'] . &#8220;&#8216;,&#8217;&#8221; . $main_profile['reg_time'] . &#8220;&#8216;)&#8221;;<br />
}<br />
else<br />
{<br />
$sql = &#8220;INSERT INTO &#8221; . $GLOBALS['ecs']-&gt;table(&#8216;users&#8217;).<br />
&#8220;(user_name, email, sex, birthday, reg_time, password)&#8221;.<br />
&#8221; VALUES(&#8216;$username&#8217;, &#8216;&#8221; .$main_profile['email'].&#8221;&#8216;,&#8217;&#8221;.<br />
$main_profile['sex'] . &#8220;&#8216;,&#8217;&#8221; . $main_profile['birthday'] . &#8220;&#8216;,&#8217;&#8221; .<br />
$main_profile['reg_time'] . &#8220;&#8216;, &#8216;$md5password&#8217;)&#8221;;</p>
<p>}</p>
<p>$GLOBALS['db']-&gt;query($sql);</p>
<p>return true;<br />
}<br />
else<br />
{<br />
$values = array();<br />
if ($main_profile['email'] != $profile['email'])<br />
{<br />
$values[] = &#8220;email=&#8217;&#8221; . $main_profile['email'] . &#8220;&#8216;&#8221;;<br />
}<br />
if ($main_profile['sex'] != $profile['sex'])<br />
{<br />
$values[] = &#8220;sex=&#8217;&#8221; . $main_profile['sex'] . &#8220;&#8216;&#8221;;<br />
}<br />
if ($main_profile['birthday'] != $profile['birthday'])<br />
{<br />
$values[] = &#8220;birthday=&#8217;&#8221; . $main_profile['birthday'] . &#8220;&#8216;&#8221;;<br />
}<br />
if ((!empty($md5password)) &amp;&amp; ($md5password != $profile['password']))<br />
{<br />
$values[] = &#8220;password=&#8217;&#8221; . $md5password . &#8220;&#8216;&#8221;;<br />
}</p>
<p>if (empty($values))<br />
{<br />
return  true;<br />
}<br />
else<br />
{<br />
$sql = &#8220;UPDATE &#8221; . $GLOBALS['ecs']-&gt;table(&#8216;users&#8217;).<br />
&#8221; SET &#8221; . implode(&#8220;, &#8220;, $values).<br />
&#8221; WHERE user_name=&#8217;$username&#8217;&#8221;;</p>
<p>$GLOBALS['db']-&gt;query($sql);</p>
<p>return true;<br />
}<br />
}<br />
}</strong></p>
<p>3.设置cookies<br />
ECSHOP所需的cookies是通过integrate/integrate.php中的 set_cookies来完成设置<br />
PHPwind所需的是通过整合接口文件phpwind.php中的set_cookies来完成设置</p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/179/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress 和 Drupal 在 lighttpd下的rewrite（伪静态）规则</title>
		<link>http://uicity.net/archives/177</link>
		<comments>http://uicity.net/archives/177#comments</comments>
		<pubDate>Fri, 26 Feb 2010 02:15:47 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.uicity.net/?p=177</guid>
		<description><![CDATA[以前IDSOO一直运行在Apache下，这次服务商发邮件说CPU超限，于是继续折腾，转移到了Lighttpd下，下面是Druap在lighttpd下开启clean url的规则，附送wordpress的。
Drupal:
url.rewrite = (
&#8220;^/system/test/(.*)$&#8221; =&#62; &#8220;/index.php?q=system/test/$1&#8243;,
&#8220;^/system/test-clean-url/(.*)$&#8221; =&#62; &#8220;/index.php?q=system/test-clean-url/$1&#8243;,
&#8220;/rss.xml$&#8221; =&#62; &#8220;/index.php?q=rss.xml&#8221;,
&#8220;^/search/(.*)$&#8221; =&#62; &#8220;/index.php?q=search/$1&#8243;,
&#8220;^/([^.?]*)\?(.*)$&#8221; =&#62; &#8220;/index.php?q=$1&#38;$2&#8243;,
&#8220;^/([^.?]*)$&#8221; =&#62; &#8220;/index.php?q=$1&#8243;,
)
Wordpress:
url.rewrite = (
&#8220;^/?$&#8221; =&#62; &#8220;/index.php&#8221;,
&#8220;^/(?.*)$&#8221; =&#62; &#8220;/index.php$1&#8243;,
&#8220;^/(wp-.+)$&#8221; =&#62; &#8220;$0&#8243;,
&#8220;^/([^.]+)/?$&#8221; =&#62; &#8220;/index.php?$1&#8243;,
)
]]></description>
			<content:encoded><![CDATA[<p>以前<a href="http://www.idsoo.com/">IDSOO</a>一直运行在Apache下，这次服务商发邮件说CPU超限，于是继续折腾，转移到了Lighttpd下，下面是Druap在lighttpd下开启clean url的规则，附送wordpress的。</p>
<p>Drupal:<br />
url.rewrite = (<br />
&#8220;^/system/test/(.*)$&#8221; =&gt; &#8220;/index.php?q=system/test/$1&#8243;,<br />
&#8220;^/system/test-clean-url/(.*)$&#8221; =&gt; &#8220;/index.php?q=system/test-clean-url/$1&#8243;,<br />
&#8220;/rss.xml$&#8221; =&gt; &#8220;/index.php?q=rss.xml&#8221;,<br />
&#8220;^/search/(.*)$&#8221; =&gt; &#8220;/index.php?q=search/$1&#8243;,<br />
&#8220;^/([^.?]*)\?(.*)$&#8221; =&gt; &#8220;/index.php?q=$1&amp;$2&#8243;,<br />
&#8220;^/([^.?]*)$&#8221; =&gt; &#8220;/index.php?q=$1&#8243;,<br />
)</p>
<p>Wordpress:<br />
url.rewrite = (<br />
&#8220;^/?$&#8221; =&gt; &#8220;/index.php&#8221;,<br />
&#8220;^/(?.*)$&#8221; =&gt; &#8220;/index.php$1&#8243;,<br />
&#8220;^/(wp-.+)$&#8221; =&gt; &#8220;$0&#8243;,<br />
&#8220;^/([^.]+)/?$&#8221; =&gt; &#8220;/index.php?$1&#8243;,<br />
)</p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/177/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>因为有你，成都更美好</title>
		<link>http://uicity.net/archives/167</link>
		<comments>http://uicity.net/archives/167#comments</comments>
		<pubDate>Wed, 10 Jun 2009 15:34:11 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.uicity.net/?p=167</guid>
		<description><![CDATA[一组喜欢的广告。





]]></description>
			<content:encoded><![CDATA[<p>一组喜欢的广告。</p>
<p><img class="alignnone size-full wp-image-170" title="sunjing" src="http://www.uicity.net/wp-content/uploads/2009/06/sunjing.jpg" alt="sunjing" width="550" height="235" /><br />
<span id="more-167"></span></p>
<p><img class="alignnone size-full wp-image-169" title="chenjie" src="http://www.uicity.net/wp-content/uploads/2009/06/chenjie.jpg" alt="chenjie" width="550" height="235" /></p>
<p><img class="alignnone size-full wp-image-171" title="tanqiao" src="http://www.uicity.net/wp-content/uploads/2009/06/tanqiao.jpg" alt="tanqiao" width="550" height="235" /></p>
<p><img class="alignnone size-full wp-image-168" title="zhangliangying" src="http://www.uicity.net/wp-content/uploads/2009/06/zhangliangying.jpg" alt="zhangliangying" width="550" height="235" /></p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/167/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Justhost</title>
		<link>http://uicity.net/archives/163</link>
		<comments>http://uicity.net/archives/163#comments</comments>
		<pubDate>Thu, 21 May 2009 14:00:55 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.uicity.net/?p=163</guid>
		<description><![CDATA[因注册justhost会员的时候，使用了自己已有的域名，本身他们是赠送一个域名的，这两天想注册域名，就下午给他们提交了ticket，问免费域名是否还可以注册，处理的速度很快，比以前的lunarpages强N倍，以下是邮件和他们交涉的详细，赞一个。

如果你想尝试一下，可以在这里注册成为Justhost的会员。
]]></description>
			<content:encoded><![CDATA[<p>因注册<a href="http://stats.justhost.com/track?c689750530af3c137643ad7aae34ee50d">justhost</a>会员的时候，使用了自己已有的域名，本身他们是赠送一个域名的，这两天想注册域名，就下午给他们提交了ticket，问免费域名是否还可以注册，处理的速度很快，比以前的<a href="http://www.lunarpages.com/">lunarpages</a>强N倍，以下是邮件和他们交涉的详细，赞一个。</p>
<p><img class="alignnone size-full wp-image-164" title="justhost" src="http://www.uicity.net/wp-content/uploads/2009/05/justhost.jpg" alt="justhost" width="570" height="235" /></p>
<p>如果你想尝试一下，可以在这里注册成为<a href="http://stats.justhost.com/track?c689750530af3c137643ad7aae34ee50d">Justhost</a>的会员。</p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/163/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>交行服务</title>
		<link>http://uicity.net/archives/160</link>
		<comments>http://uicity.net/archives/160#comments</comments>
		<pubDate>Fri, 01 May 2009 18:20:46 +0000</pubDate>
		<dc:creator>26z</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://www.uicity.net/?p=160</guid>
		<description><![CDATA[下午使用google checkout，由于需要绑定信用卡，就绑定了交行的信用卡，1分钟过后就接到了交行的电话，说为了保证信用卡使用安全，和我确认下刚才是否使用信用卡在网上消费。凌晨2点钟，更新了paypal里的信用卡信息，还是绑定的交行的，在网上刷完美元后立刻接到了交行的电话，询问刚才是否网上消费，在凌晨2点这样大脑缺氧的时刻，交行反应能如此迅速，让我这个交行的新用户感到很贴心，难道，接下的若干年交行会和招行一样深受用户喜欢？
在使用了2年 lunarpages后，还是放弃了它，由于dreamhost不支持paypal，就选择了justhost，使用50%的discount，价格还不错。
深夜记录。
]]></description>
			<content:encoded><![CDATA[<p>下午使用google checkout，由于需要绑定信用卡，就绑定了交行的信用卡，1分钟过后就接到了交行的电话，说为了保证信用卡使用安全，和我确认下刚才是否使用信用卡在网上消费。凌晨2点钟，更新了paypal里的信用卡信息，还是绑定的交行的，在网上刷完美元后立刻接到了交行的电话，询问刚才是否网上消费，在凌晨2点这样大脑缺氧的时刻，交行反应能如此迅速，让我这个交行的新用户感到很贴心，难道，接下的若干年交行会和招行一样深受用户喜欢？</p>
<p>在使用了2年 lunarpages后，还是放弃了它，由于dreamhost不支持paypal，就选择了justhost，使用50%的discount，价格还不错。</p>
<p>深夜记录。</p>
]]></content:encoded>
			<wfw:commentRss>http://uicity.net/archives/160/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
