Skip to content

Commit

Permalink
refs #514 : merged with 2.0 tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
inureyes committed Mar 23, 2011
2 parents eb5878e + 7718497 commit eef7dda
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 52 deletions.
12 changes: 6 additions & 6 deletions framework/data/DBModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function doesExistTable($tablename) {
}

/* DBModel */
/* 1.4.0.20101224 */
/* 1.4.1.20110323 */
class DBModel extends Singleton implements IModel {
protected $_attributes, $_qualifiers, $_query;
protected $_relations, $_glues, $_filters, $_order, $_limitation, $table, $id, $_querysetCount;
Expand Down Expand Up @@ -115,8 +115,8 @@ public function getQualifier($name) {
return $this->_qualifiers[$name];
}

public function setQualifier($name, $condition, $value = null, $escape = false) {
$result = $this->getQualifierModel($name, $condition, $value, $escape);
public function setQualifier($name, $condition, $value = null, $escape = false, $autoquote = true) {
$result = $this->getQualifierModel($name, $condition, $value, $escape, $autoquote);
if($result) {
list($this->_qualifiers[$name],$this->_relations[$name]) = $result;
}
Expand Down Expand Up @@ -381,7 +381,7 @@ protected function _capsulateFields($requestedFieldArray) {
return $escapedFields;
}

protected function getQualifierModel($name, $condition, $value = null, $escape = false) {
protected function getQualifierModel($name, $condition, $value = null, $escape = false, $autoquote = true) {
//OR, setQualifier(string(name_condition_value), $escape = null) - Descriptive mode (NOT implemented)
if (is_null($condition)) {
$qualifiers = null;
Expand Down Expand Up @@ -438,7 +438,7 @@ protected function getQualifierModel($name, $condition, $value = null, $escape =
}
$qualifiers = $value;
} else {
$qualifiers = ($escape === false && (!is_string($value) || in_array($value,$this->_reservedFunctions)) ?
$qualifiers = ($escape === false && (!is_string($value) || in_array($value,$this->_reservedFunctions) || $autoquote == false) ?
$value : ($escape ? '\'' .
POD::escapeString(
(($relations == 'LIKE') ? '%'.$value.'%' : $value)
Expand All @@ -449,4 +449,4 @@ protected function getQualifierModel($name, $condition, $value = null, $escape =
return array($qualifiers, $relations);
}
}
?>
?>
3 changes: 2 additions & 1 deletion framework/legacy/Textcube.Data.Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ function isFiltered($type, $value) {

/*@static@*/
function isAllowed($whiteurl) {
if(empty($whiteurl)) return false;
$whiteurl = strtolower($whiteurl);
$query = DBModel::getInstance();
$query->reset('Filters');
$query->setQualifier('blogid','equals',getBlogId());
$query->setQualifier('filtertype','equals','whiteurl',true);
$query->setQualifier(POD::escapeString($whiteurl), 'like', "CONCAT('%', LOWER(pattern), '%')");
$query->setQualifier(POD::escapeString($whiteurl), 'like', "CONCAT('%', LOWER(pattern), '%')",false,false);
return $query->doesExist();
}

Expand Down
7 changes: 6 additions & 1 deletion library/blog.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,17 @@ function replaceSkinTag( & $contents, $tag) {
}

function insertGeneratorVersion(&$contents) {
$pattern = '/(<head>)/Ui';
if (stripos($contents, '<meta charset="utf-8">') !== false) {
$pattern = '/(<meta charset="utf-8">)/Ui';
} else {
$pattern = '/(<head>)/Ui';
}
$replacement = '$1'.CRLF.'<meta name="generator" content="'.TEXTCUBE_NAME.' '.TEXTCUBE_VERSION.'" />';

$contents = preg_replace($pattern, $replacement, $contents);
}


function setTempTag($name) {
return "[#####_#####_#####_{$name}_#####_#####_#####]";
}
Expand Down
10 changes: 7 additions & 3 deletions library/model/blog.comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ function addComment($blogid, & $comment) {
if (!$result || $result == 0)
return false;
}
$parent = $comment['parent'] == null ? 'null' : $comment['parent'];
$parent = $comment['parent'] == null ? null : $comment['parent'];
$userid = getUserId();
if (!empty($userid)) {
$comment['replier'] = $userid;
Expand All @@ -495,7 +495,7 @@ function addComment($blogid, & $comment) {
$homepage = User::getHomepage($userid);
if( empty($homepage) && $openid ) { $homepage = $openid; }
} else {
$comment['replier'] = 'null';
$comment['replier'] = null;
$name = $comment['name'];
$password = empty($comment['password']) ? '' : md5($comment['password']);
$homepage = $comment['homepage'];
Expand All @@ -508,7 +508,11 @@ function addComment($blogid, & $comment) {
$pool->setAttribute('blogid',$blogid);
$pool->setAttribute('replier',$comment['replier']);
$pool->setAttribute('id',$insertId);
$pool->setAttribute('openid',$openid,true);
if (is_null($openid)) {
$pool->setAttribute('openid','',true);
} else {
$pool->setAttribute('openid',$openid,true);
}
$pool->setAttribute('entry',$comment['entry']);
$pool->setAttribute('parent',$parent);
$pool->setAttribute('name',$name,true);
Expand Down
8 changes: 7 additions & 1 deletion library/preprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@
* Initialization
* Checks privilege
*/
$bootFiles = array(); // From PHP 5.3, DirectoryIterator does not gurantee the order.
foreach (new DirectoryIterator(ROOT.'/framework/boot') as $fileInfo) {
if($fileInfo->isFile()) require_once($fileInfo->getPathname());
if($fileInfo->isFile()) array_push($bootFiles, $fileInfo->getPathname());
}
sort($bootFiles);
foreach ($bootFiles as $bf) {
require_once($bf);
}
unset($bootFiles);

/** CHECK : Basic POST/GET variable validation.
-------------------------------------------
Expand Down
27 changes: 17 additions & 10 deletions skin/blog/musicpaper/skin.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h2>[##_desc_##]</h2>
</hgroup>
</header>
<nav id="menu">
<menu label="blog">
<menu label="blog" class="blog">
<li class="tab_home"><a href="[##_blog_link_##]">Home</a></li>
<li class="tab_cover"><a href="[##_blog_link_##]cover">Cover</a></li>
<li class="tab_notice"><a href="[##_blog_link_##]notice">Notice</a></li>
Expand Down Expand Up @@ -164,7 +164,7 @@ <h2>Keywords with size based on popularity</h2>
<article>
<hgroup>
<h1>Guestbook</h1>
<h2>Leave your greetings here</h2>
<h2>Leave your greetings</h2>
</hgroup>
<s_guest_input_form>
<fieldset>
Expand Down Expand Up @@ -334,16 +334,20 @@ <h2><a href="[##_article_rep_link_##]">[##_article_rep_title_##]</a></h2>
<dt class="response">Response</dt>
<dd class="response">
<menu>
<command id="[##_article_rep_tb_cnt_id_##]" href="#tb" onclick="[##_article_rep_tb_link_##]" label="Show/hide responses" class="button">
<!-- <command type="command" id="[##_article_rep_tb_cnt_id_##]" href="#tb" onclick="[##_article_rep_tb_link_##]" label="Show/hide responses" class="button">-->
<a id="[##_article_rep_tb_cnt_id_##]" href="#tb" onclick="[##_article_rep_tb_link_##]" label="Show/hide responses" class="button">
<s_tb_count>
<em>[##_article_rep_tb_cnt_##]</em> Trackbacks
</s_tb_count>
</command>,
<command id="[##_article_rep_rp_cnt_id_##]" href="#rp" onclick="[##_article_rep_rp_link_##]" title="Show/hide commments" class="button">
</a>
<!-- </command>,-->
<!-- <command id="[##_article_rep_rp_cnt_id_##]" href="#rp" onclick="[##_article_rep_rp_link_##]" title="Show/hide commments" class="button">-->
<a id="[##_article_rep_rp_cnt_id_##]" href="#rp" onclick="[##_article_rep_rp_link_##]" title="Show/hide commments" class="button">
<s_rp_count>
<em>[##_article_rep_rp_cnt_##]</em> Comments
</s_rp_count>
</command>
</a>
<!-- </command>-->
</menu>
</dd>
<dt class="feed">You can track responses via RSS / ATOM feed</dt>
Expand Down Expand Up @@ -394,8 +398,10 @@ <h2>ATOM Feed : [##_article_rep_rp_atomurl_##]</h2>
</dt>
<dd class="regdate"><time>[##_rp_rep_date_##]</time></dd>
<dd class="permalink"><a href="[##_rp_rep_link_##]" title="Permanent link" class="button">Permalink</a></dd>
<dd class="delete"><command onclick="[##_rp_rep_onclick_delete_##]" label="Modify/Delete" class="button"><abbr title="Modify or Delete">M/D</abbr></command></dd>
<dd class="write"><command onclick="[##_rp_rep_onclick_reply_##]" label="Write reply" class="button">Reply</command></dd>
<!-- <dd class="delete"><command onclick="[##_rp_rep_onclick_delete_##]" label="Modify/Delete" class="button"><abbr title="Modify or Delete">M/D</abbr></command></dd> -->
<dd class="delete"><a href="#" onclick="[##_rp_rep_onclick_delete_##]" label="Modify/Delete" class="button"><abbr title="Modify or Delete">M/D</abbr></a></dd>
<!-- <dd class="write"><command onclick="[##_rp_rep_onclick_reply_##]" label="Write reply" class="button">Reply</command></dd>-->
<dd class="write"><a href="#" onclick="[##_rp_rep_onclick_reply_##]" label="Write reply" class="button">Reply</a></dd>
<dd class="content"><p>[##_rp_rep_desc_##]</p></dd>
<s_rp2_container>
<dd class="reply">
Expand All @@ -406,7 +412,8 @@ <h2>ATOM Feed : [##_article_rep_rp_atomurl_##]</h2>
</dt>
<dd class="regdate"><time>[##_rp_rep_date_##]</time></dd>
<dd class="permalink"><a href="[##_rp_rep_link_##]" title="Permanent link" class="button">Permalink</a></dd>
<dd class="delete"><command onclick="[##_rp_rep_onclick_delete_##]" title="Modify/Delete" class="button"><abbr title="Modify or Delete">M/D</abbr></command></dd>
<!-- <dd class="delete"><command onclick="[##_rp_rep_onclick_delete_##]" title="Modify/Delete" class="button"><abbr title="Modify or Delete">M/D</abbr></command></dd>-->
<dd class="delete"><a href="#" onclick="[##_rp_rep_onclick_delete_##]" title="Modify/Delete" class="button"><abbr title="Modify or Delete">M/D</abbr></a></dd>
<dd class="content"><p>[##_rp_rep_desc_##]</p></dd>
</dl>
</s_rp2_rep>
Expand All @@ -420,7 +427,7 @@ <h2>ATOM Feed : [##_article_rep_rp_atomurl_##]</h2>
<section class="write comments">
<hgroup>
<h1>Comments</h1>
<h2>Leave your comment here</h2>
<h2>Leave your comment</h2>
</hgroup>
<fieldset>
<s_rp_member>
Expand Down
Loading

0 comments on commit eef7dda

Please sign in to comment.