1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-04 23:44:25 +03:00

1. Исключены константы из /classes/modules/ и /classes/actions/

2. (!) В loader.php окончательно отключен define constants.
This commit is contained in:
Alexey Kachayev 2009-08-20 12:50:14 +00:00
parent 9be9867ec9
commit d40e6e5104
13 changed files with 118 additions and 111 deletions

View file

@ -21,7 +21,7 @@ class ActionSearch extends Action {
function EventOpenSearch(){ function EventOpenSearch(){
Router::SetIsShowStats(false); Router::SetIsShowStats(false);
$this->Viewer_Assign('sAdminMail', SYS_MAIL_FROM_EMAIL); $this->Viewer_Assign('sAdminMail', Config::Get('sys.mail.from_email'));
} }
/** /**
* Поиск топиков * Поиск топиков

View file

@ -37,7 +37,7 @@ class LsACL extends Module {
* @return bool * @return bool
*/ */
public function CanCreateBlog(UserEntity_User $oUser) { public function CanCreateBlog(UserEntity_User $oUser) {
if ($oUser->getRating()>=ACL_CAN_CREATE_BLOG) { if ($oUser->getRating()>=Config::Get('acl.create.blog.rating')) {
return true; return true;
} }
return false; return false;

View file

@ -23,7 +23,7 @@ class Mapper_Blog extends Mapper {
} }
public function AddBlog(BlogEntity_Blog $oBlog) { public function AddBlog(BlogEntity_Blog $oBlog) {
$sql = "INSERT INTO ".DB_TABLE_BLOG." $sql = "INSERT INTO ".Config::Get('db.table.blog')."
(user_owner_id, (user_owner_id,
blog_title, blog_title,
blog_description, blog_description,
@ -43,7 +43,7 @@ class Mapper_Blog extends Mapper {
} }
public function UpdateBlog(BlogEntity_Blog $oBlog) { public function UpdateBlog(BlogEntity_Blog $oBlog) {
$sql = "UPDATE ".DB_TABLE_BLOG." $sql = "UPDATE ".Config::Get('db.table.blog')."
SET SET
blog_title= ?, blog_title= ?,
blog_description= ?, blog_description= ?,
@ -73,7 +73,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
b.* b.*
FROM FROM
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
b.blog_id IN(?a) b.blog_id IN(?a)
ORDER BY FIELD(b.blog_id,?a) "; ORDER BY FIELD(b.blog_id,?a) ";
@ -87,7 +87,7 @@ class Mapper_Blog extends Mapper {
} }
public function AddRelationBlogUser(BlogEntity_BlogUser $oBlogUser) { public function AddRelationBlogUser(BlogEntity_BlogUser $oBlogUser) {
$sql = "INSERT INTO ".DB_TABLE_BLOG_USER." $sql = "INSERT INTO ".Config::Get('db.table.blog_user')."
(blog_id, (blog_id,
user_id user_id
) )
@ -100,7 +100,7 @@ class Mapper_Blog extends Mapper {
} }
public function DeleteRelationBlogUser(BlogEntity_BlogUser $oBlogUser) { public function DeleteRelationBlogUser(BlogEntity_BlogUser $oBlogUser) {
$sql = "DELETE FROM ".DB_TABLE_BLOG_USER." $sql = "DELETE FROM ".Config::Get('db.table.blog_user')."
WHERE WHERE
blog_id = ?d blog_id = ?d
AND AND
@ -113,7 +113,7 @@ class Mapper_Blog extends Mapper {
} }
public function UpdateRelationBlogUser(BlogEntity_BlogUser $oBlogUser) { public function UpdateRelationBlogUser(BlogEntity_BlogUser $oBlogUser) {
$sql = "UPDATE ".DB_TABLE_BLOG_USER." $sql = "UPDATE ".Config::Get('db.table.blog_user')."
SET SET
is_moderator= ?, is_moderator= ?,
is_administrator= ? is_administrator= ?
@ -145,7 +145,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
bu.* bu.*
FROM FROM
".DB_TABLE_BLOG_USER." as bu ".Config::Get('db.table.blog_user')." as bu
WHERE WHERE
".$sWhere." ".$sWhere."
; ;
@ -167,7 +167,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
bu.* bu.*
FROM FROM
".DB_TABLE_BLOG_USER." as bu ".Config::Get('db.table.blog_user')." as bu
WHERE WHERE
bu.user_id = ?d bu.user_id = ?d
AND AND
@ -183,7 +183,7 @@ class Mapper_Blog extends Mapper {
public function GetPersonalBlogByUserId($sUserId) { public function GetPersonalBlogByUserId($sUserId) {
$sql = "SELECT blog_id FROM ".DB_TABLE_BLOG." WHERE user_owner_id = ?d and blog_type='personal'"; $sql = "SELECT blog_id FROM ".Config::Get('db.table.blog')." WHERE user_owner_id = ?d and blog_type='personal'";
if ($aRow=$this->oDb->selectRow($sql,$sUserId)) { if ($aRow=$this->oDb->selectRow($sql,$sUserId)) {
return $aRow['blog_id']; return $aRow['blog_id'];
} }
@ -192,7 +192,7 @@ class Mapper_Blog extends Mapper {
public function GetBlogByTitle($sTitle) { public function GetBlogByTitle($sTitle) {
$sql = "SELECT blog_id FROM ".DB_TABLE_BLOG." WHERE blog_title = ? "; $sql = "SELECT blog_id FROM ".Config::Get('db.table.blog')." WHERE blog_title = ? ";
if ($aRow=$this->oDb->selectRow($sql,$sTitle)) { if ($aRow=$this->oDb->selectRow($sql,$sTitle)) {
return $aRow['blog_id']; return $aRow['blog_id'];
} }
@ -206,7 +206,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
b.blog_id b.blog_id
FROM FROM
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
b.blog_url = ? b.blog_url = ?
"; ";
@ -220,7 +220,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
b.blog_id b.blog_id
FROM FROM
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
b.user_owner_id = ? b.user_owner_id = ?
AND AND
@ -239,7 +239,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
b.blog_id b.blog_id
FROM FROM
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
b.blog_type<>'personal' b.blog_type<>'personal'
"; ";
@ -256,7 +256,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
b.blog_id b.blog_id
FROM FROM
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
b.blog_type<>'personal' b.blog_type<>'personal'
ORDER by b.blog_rating desc ORDER by b.blog_rating desc
@ -274,8 +274,8 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
b.* b.*
FROM FROM
".DB_TABLE_BLOG_USER." as bu, ".Config::Get('db.table.blog_user')." as bu,
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
bu.user_id = ?d bu.user_id = ?d
AND AND
@ -299,7 +299,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT $sql = "SELECT
b.* b.*
FROM FROM
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
b.user_owner_id = ?d b.user_owner_id = ?d
AND AND

View file

@ -21,7 +21,7 @@ class Mapper_Comment extends Mapper {
$sql = "SELECT $sql = "SELECT
comment_id comment_id
FROM FROM
".DB_TABLE_COMMENT." ".Config::Get('db.table.comment')."
WHERE WHERE
target_type = ? target_type = ?
AND AND
@ -44,7 +44,7 @@ class Mapper_Comment extends Mapper {
} }
public function GetCommentUnique($sTargetId,$sTargetType,$sUserId,$sCommentPid,$sHash) { public function GetCommentUnique($sTargetId,$sTargetType,$sUserId,$sCommentPid,$sHash) {
$sql = "SELECT comment_id FROM ".DB_TABLE_COMMENT." $sql = "SELECT comment_id FROM ".Config::Get('db.table.comment')."
WHERE WHERE
target_id = ?d target_id = ?d
AND AND
@ -66,7 +66,7 @@ class Mapper_Comment extends Mapper {
$sql = "SELECT $sql = "SELECT
comment_id comment_id
FROM FROM
".DB_TABLE_COMMENT." ".Config::Get('db.table.comment')."
WHERE WHERE
target_type = ? target_type = ?
AND AND
@ -93,7 +93,7 @@ class Mapper_Comment extends Mapper {
$sql = "SELECT $sql = "SELECT
* *
FROM FROM
".DB_TABLE_COMMENT." ".Config::Get('db.table.comment')."
WHERE WHERE
comment_id IN(?a) comment_id IN(?a)
ORDER by FIELD(comment_id,?a)"; ORDER by FIELD(comment_id,?a)";
@ -111,7 +111,7 @@ class Mapper_Comment extends Mapper {
$sql = "SELECT $sql = "SELECT
comment_id comment_id
FROM FROM
".DB_TABLE_COMMENT_ONLINE." ".Config::Get('db.table.comment_online')."
WHERE WHERE
target_type = ? target_type = ?
ORDER by comment_online_id desc limit 0, ?d ; "; ORDER by comment_online_id desc limit 0, ?d ; ";
@ -130,7 +130,7 @@ class Mapper_Comment extends Mapper {
comment_id as ARRAY_KEY, comment_id as ARRAY_KEY,
comment_pid as PARENT_KEY comment_pid as PARENT_KEY
FROM FROM
".DB_TABLE_COMMENT." ".Config::Get('db.table.comment')."
WHERE WHERE
target_id = ?d target_id = ?d
AND AND
@ -147,7 +147,7 @@ class Mapper_Comment extends Mapper {
$sql = "SELECT $sql = "SELECT
comment_id comment_id
FROM FROM
".DB_TABLE_COMMENT." ".Config::Get('db.table.comment')."
WHERE WHERE
target_id = ?d target_id = ?d
AND AND
@ -169,7 +169,7 @@ class Mapper_Comment extends Mapper {
$sql = "SELECT $sql = "SELECT
comment_id comment_id
FROM FROM
".DB_TABLE_COMMENT." ".Config::Get('db.table.comment')."
WHERE WHERE
user_id = ?d user_id = ?d
AND AND
@ -193,7 +193,7 @@ class Mapper_Comment extends Mapper {
$sql = "SELECT $sql = "SELECT
count(comment_id) as count count(comment_id) as count
FROM FROM
".DB_TABLE_COMMENT." ".Config::Get('db.table.comment')."
WHERE WHERE
user_id = ?d user_id = ?d
AND AND
@ -210,7 +210,7 @@ class Mapper_Comment extends Mapper {
} }
public function AddComment(CommentEntity_Comment $oComment) { public function AddComment(CommentEntity_Comment $oComment) {
$sql = "INSERT INTO ".DB_TABLE_COMMENT." $sql = "INSERT INTO ".Config::Get('db.table.comment')."
(comment_pid, (comment_pid,
target_id, target_id,
target_type, target_type,
@ -232,7 +232,7 @@ class Mapper_Comment extends Mapper {
public function AddCommentOnline(CommentEntity_CommentOnline $oCommentOnline) { public function AddCommentOnline(CommentEntity_CommentOnline $oCommentOnline) {
$sql = "REPLACE INTO ".DB_TABLE_COMMENT_ONLINE." $sql = "REPLACE INTO ".Config::Get('db.table.comment_online')."
SET SET
target_id= ?d , target_id= ?d ,
target_type= ? , target_type= ? ,
@ -246,7 +246,7 @@ class Mapper_Comment extends Mapper {
} }
public function DeleteCommentOnlineByTargetId($sTargetId,$sTargetType) { public function DeleteCommentOnlineByTargetId($sTargetId,$sTargetType) {
$sql = "DELETE FROM ".DB_TABLE_COMMENT_ONLINE." WHERE target_id = ?d and target_type = ? "; $sql = "DELETE FROM ".Config::Get('db.table.comment_online')." WHERE target_id = ?d and target_type = ? ";
if ($this->oDb->query($sql,$sTargetId,$sTargetType)) if ($this->oDb->query($sql,$sTargetId,$sTargetType))
{ {
return true; return true;
@ -257,7 +257,7 @@ class Mapper_Comment extends Mapper {
public function UpdateComment(CommentEntity_Comment $oComment) { public function UpdateComment(CommentEntity_Comment $oComment) {
$sql = "UPDATE ".DB_TABLE_COMMENT." $sql = "UPDATE ".Config::Get('db.table.comment')."
SET SET
comment_text= ?, comment_text= ?,
comment_rating= ?f, comment_rating= ?f,
@ -275,7 +275,7 @@ class Mapper_Comment extends Mapper {
} }
public function SetCommentsPublish($sTargetId,$sTargetType,$iPublish) { public function SetCommentsPublish($sTargetId,$sTargetType,$iPublish) {
$sql = "UPDATE ".DB_TABLE_COMMENT." $sql = "UPDATE ".Config::Get('db.table.comment')."
SET SET
comment_publish= ? comment_publish= ?
WHERE WHERE

View file

@ -18,7 +18,7 @@
class Mapper_Page extends Mapper { class Mapper_Page extends Mapper {
public function AddPage(PageEntity_Page $oPage) { public function AddPage(PageEntity_Page $oPage) {
$sql = "INSERT INTO ".DB_TABLE_PAGE." $sql = "INSERT INTO ".Config::Get('db.table.page')."
(page_pid, (page_pid,
page_url, page_url,
page_url_full, page_url_full,
@ -39,7 +39,7 @@ class Mapper_Page extends Mapper {
} }
public function UpdatePage(PageEntity_Page $oPage) { public function UpdatePage(PageEntity_Page $oPage) {
$sql = "UPDATE ".DB_TABLE_PAGE." $sql = "UPDATE ".Config::Get('db.table.page')."
SET page_pid = ? , SET page_pid = ? ,
page_url = ? , page_url = ? ,
page_url_full = ? , page_url_full = ? ,
@ -59,7 +59,7 @@ class Mapper_Page extends Mapper {
} }
public function SetPagesPidToNull() { public function SetPagesPidToNull() {
$sql = "UPDATE ".DB_TABLE_PAGE." $sql = "UPDATE ".Config::Get('db.table.page')."
SET SET
page_pid = null, page_pid = null,
page_url_full = page_url page_url_full = page_url
@ -72,7 +72,7 @@ class Mapper_Page extends Mapper {
} }
public function GetPageByUrlFull($sUrlFull,$iActive) { public function GetPageByUrlFull($sUrlFull,$iActive) {
$sql = "SELECT * FROM ".DB_TABLE_PAGE." WHERE page_url_full = ? and page_active = ?d "; $sql = "SELECT * FROM ".Config::Get('db.table.page')." WHERE page_url_full = ? and page_active = ?d ";
if ($aRow=$this->oDb->selectRow($sql,$sUrlFull,$iActive)) { if ($aRow=$this->oDb->selectRow($sql,$sUrlFull,$iActive)) {
return new PageEntity_Page($aRow); return new PageEntity_Page($aRow);
} }
@ -80,7 +80,7 @@ class Mapper_Page extends Mapper {
} }
public function GetPageById($sId) { public function GetPageById($sId) {
$sql = "SELECT * FROM ".DB_TABLE_PAGE." WHERE page_id = ? "; $sql = "SELECT * FROM ".Config::Get('db.table.page')." WHERE page_id = ? ";
if ($aRow=$this->oDb->selectRow($sql,$sId)) { if ($aRow=$this->oDb->selectRow($sql,$sId)) {
return new PageEntity_Page($aRow); return new PageEntity_Page($aRow);
} }
@ -88,7 +88,7 @@ class Mapper_Page extends Mapper {
} }
public function deletePageById($sId) { public function deletePageById($sId) {
$sql = "DELETE FROM ".DB_TABLE_PAGE." WHERE page_id = ? "; $sql = "DELETE FROM ".Config::Get('db.table.page')." WHERE page_id = ? ";
if ($aRow=$this->oDb->selectRow($sql,$sId)) { if ($aRow=$this->oDb->selectRow($sql,$sId)) {
return true; return true;
} }
@ -101,7 +101,7 @@ class Mapper_Page extends Mapper {
page_id as ARRAY_KEY, page_id as ARRAY_KEY,
page_pid as PARENT_KEY page_pid as PARENT_KEY
FROM FROM
".DB_TABLE_PAGE." ".Config::Get('db.table.page')."
ORDER by page_title asc; ORDER by page_title asc;
"; ";
if ($aRows=$this->oDb->select($sql)) { if ($aRows=$this->oDb->select($sql)) {
@ -111,7 +111,7 @@ class Mapper_Page extends Mapper {
} }
public function GetCountPage() { public function GetCountPage() {
$sql = "SELECT count(*) as count FROM ".DB_TABLE_PAGE." "; $sql = "SELECT count(*) as count FROM ".Config::Get('db.table.page')." ";
if ($aRow=$this->oDb->selectRow($sql)) { if ($aRow=$this->oDb->selectRow($sql)) {
return $aRow['count']; return $aRow['count'];
} }
@ -122,7 +122,7 @@ class Mapper_Page extends Mapper {
$sql = "SELECT $sql = "SELECT
* *
FROM FROM
".DB_TABLE_PAGE." ".Config::Get('db.table.page')."
WHERE WHERE
page_pid = ? "; page_pid = ? ";
$aResult=array(); $aResult=array();

View file

@ -17,7 +17,7 @@
class Mapper_Talk extends Mapper { class Mapper_Talk extends Mapper {
public function AddTalk(TalkEntity_Talk $oTalk) { public function AddTalk(TalkEntity_Talk $oTalk) {
$sql = "INSERT INTO ".DB_TABLE_TALK." $sql = "INSERT INTO ".Config::Get('db.table.talk')."
(user_id, (user_id,
talk_title, talk_title,
talk_text, talk_text,
@ -35,7 +35,7 @@ class Mapper_Talk extends Mapper {
} }
public function UpdateTalk(TalkEntity_Talk $oTalk) { public function UpdateTalk(TalkEntity_Talk $oTalk) {
$sql = "UPDATE ".DB_TABLE_TALK." SET $sql = "UPDATE ".Config::Get('db.table.talk')." SET
talk_date_last = ? , talk_date_last = ? ,
talk_count_comment = ? talk_count_comment = ?
WHERE WHERE
@ -52,7 +52,7 @@ class Mapper_Talk extends Mapper {
$sql = "SELECT $sql = "SELECT
t.* t.*
FROM FROM
".DB_TABLE_TALK." as t ".Config::Get('db.table.talk')." as t
WHERE WHERE
t.talk_id IN(?a) t.talk_id IN(?a)
ORDER BY FIELD(t.talk_id,?a) "; ORDER BY FIELD(t.talk_id,?a) ";
@ -73,7 +73,7 @@ class Mapper_Talk extends Mapper {
$sql = "SELECT $sql = "SELECT
t.* t.*
FROM FROM
".DB_TABLE_TALK_USER." as t ".Config::Get('db.table.talk_user')." as t
WHERE WHERE
t.user_id = ?d t.user_id = ?d
AND AND
@ -93,7 +93,7 @@ class Mapper_Talk extends Mapper {
t.*, t.*,
u.user_login as user_login u.user_login as user_login
FROM FROM
".DB_TABLE_TALK." as t, ".Config::Get('db.table.talk')." as t,
".Config::Get('db.table.user')." as u ".Config::Get('db.table.user')." as u
WHERE WHERE
t.talk_id = ?d t.talk_id = ?d
@ -108,7 +108,7 @@ class Mapper_Talk extends Mapper {
public function AddTalkUser(TalkEntity_TalkUser $oTalkUser) { public function AddTalkUser(TalkEntity_TalkUser $oTalkUser) {
$sql = "INSERT INTO ".DB_TABLE_TALK_USER." $sql = "INSERT INTO ".Config::Get('db.table.talk_user')."
(talk_id, (talk_id,
user_id, user_id,
date_last date_last
@ -123,7 +123,7 @@ class Mapper_Talk extends Mapper {
} }
public function UpdateTalkUser(TalkEntity_TalkUser $oTalkUser) { public function UpdateTalkUser(TalkEntity_TalkUser $oTalkUser) {
$sql = "UPDATE ".DB_TABLE_TALK_USER." $sql = "UPDATE ".Config::Get('db.table.talk_user')."
SET SET
date_last = ?, date_last = ?,
comment_id_last = ?d, comment_id_last = ?d,
@ -145,7 +145,7 @@ class Mapper_Talk extends Mapper {
$aTalkId=array($aTalkId); $aTalkId=array($aTalkId);
} }
$sql = "DELETE FROM ".DB_TABLE_TALK_USER." $sql = "DELETE FROM ".Config::Get('db.table.talk_user')."
WHERE WHERE
talk_id IN (?a) talk_id IN (?a)
AND AND
@ -165,7 +165,7 @@ class Mapper_Talk extends Mapper {
SELECT SELECT
SUM(tu.comment_count_new) as count_new SUM(tu.comment_count_new) as count_new
FROM FROM
".DB_TABLE_TALK_USER." as tu ".Config::Get('db.table.talk_user')." as tu
WHERE WHERE
tu.user_id = ?d tu.user_id = ?d
"; ";
@ -180,7 +180,7 @@ class Mapper_Talk extends Mapper {
SELECT SELECT
COUNT(tu.talk_id) as count_new COUNT(tu.talk_id) as count_new
FROM FROM
".DB_TABLE_TALK_USER." as tu ".Config::Get('db.table.talk_user')." as tu
WHERE WHERE
tu.date_last IS NULL tu.date_last IS NULL
AND AND
@ -196,8 +196,8 @@ class Mapper_Talk extends Mapper {
$sql = "SELECT $sql = "SELECT
tu.talk_id tu.talk_id
FROM FROM
".DB_TABLE_TALK_USER." as tu, ".Config::Get('db.table.talk_user')." as tu,
".DB_TABLE_TALK." as t ".Config::Get('db.table.talk')." as t
WHERE WHERE
tu.user_id = ?d tu.user_id = ?d
AND AND
@ -218,7 +218,7 @@ class Mapper_Talk extends Mapper {
$sql = "SELECT $sql = "SELECT
user_id user_id
FROM FROM
".DB_TABLE_TALK_USER." ".Config::Get('db.table.talk_user')."
WHERE WHERE
talk_id = ? "; talk_id = ? ";
$aReturn=array(); $aReturn=array();
@ -236,7 +236,7 @@ class Mapper_Talk extends Mapper {
} }
$sql = "UPDATE $sql = "UPDATE
".DB_TABLE_TALK_USER." ".Config::Get('db.table.talk_user')."
SET comment_count_new=comment_count_new+1 SET comment_count_new=comment_count_new+1
WHERE WHERE
talk_id = ? talk_id = ?

View file

@ -18,7 +18,7 @@
class Mapper_Topic extends Mapper { class Mapper_Topic extends Mapper {
public function AddTopic(TopicEntity_Topic $oTopic) { public function AddTopic(TopicEntity_Topic $oTopic) {
$sql = "INSERT INTO ".DB_TABLE_TOPIC." $sql = "INSERT INTO ".Config::Get('db.table.topic')."
(blog_id, (blog_id,
user_id, user_id,
topic_type, topic_type,
@ -46,7 +46,7 @@ class Mapper_Topic extends Mapper {
} }
public function AddTopicContent(TopicEntity_Topic $oTopic) { public function AddTopicContent(TopicEntity_Topic $oTopic) {
$sql = "INSERT INTO ".DB_TABLE_TOPIC_CONTENT." $sql = "INSERT INTO ".Config::Get('db.table.topic_content')."
(topic_id, (topic_id,
topic_text, topic_text,
topic_text_short, topic_text_short,
@ -64,7 +64,7 @@ class Mapper_Topic extends Mapper {
} }
public function AddTopicTag(TopicEntity_TopicTag $oTopicTag) { public function AddTopicTag(TopicEntity_TopicTag $oTopicTag) {
$sql = "INSERT INTO ".DB_TABLE_TOPIC_TAG." $sql = "INSERT INTO ".Config::Get('db.table.topic_tag')."
(topic_id, (topic_id,
user_id, user_id,
blog_id, blog_id,
@ -82,7 +82,7 @@ class Mapper_Topic extends Mapper {
public function DeleteTopicTagsByTopicId($sTopicId) { public function DeleteTopicTagsByTopicId($sTopicId) {
$sql = "DELETE FROM ".DB_TABLE_TOPIC_TAG." $sql = "DELETE FROM ".Config::Get('db.table.topic_tag')."
WHERE WHERE
topic_id = ?d topic_id = ?d
"; ";
@ -93,7 +93,7 @@ class Mapper_Topic extends Mapper {
} }
public function DeleteTopic($sTopicId) { public function DeleteTopic($sTopicId) {
$sql = "DELETE FROM ".DB_TABLE_TOPIC." $sql = "DELETE FROM ".Config::Get('db.table.topic')."
WHERE WHERE
topic_id = ?d topic_id = ?d
"; ";
@ -105,7 +105,7 @@ class Mapper_Topic extends Mapper {
public function GetTopicUnique($sUserId,$sHash) { public function GetTopicUnique($sUserId,$sHash) {
$sql = "SELECT topic_id FROM ".DB_TABLE_TOPIC." $sql = "SELECT topic_id FROM ".Config::Get('db.table.topic')."
WHERE WHERE
user_id = ?d user_id = ?d
AND AND
@ -126,8 +126,8 @@ class Mapper_Topic extends Mapper {
t.*, t.*,
tc.* tc.*
FROM FROM
".DB_TABLE_TOPIC." as t ".Config::Get('db.table.topic')." as t
JOIN ".DB_TABLE_TOPIC_CONTENT." AS tc ON t.topic_id=tc.topic_id JOIN ".Config::Get('db.table.topic_content')." AS tc ON t.topic_id=tc.topic_id
WHERE WHERE
t.topic_id IN(?a) t.topic_id IN(?a)
ORDER BY FIELD(t.topic_id,?a) "; ORDER BY FIELD(t.topic_id,?a) ";
@ -147,8 +147,8 @@ class Mapper_Topic extends Mapper {
$sql = "SELECT $sql = "SELECT
t.topic_id t.topic_id
FROM FROM
".DB_TABLE_TOPIC." as t, ".Config::Get('db.table.topic')." as t,
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
1=1 1=1
".$sWhere." ".$sWhere."
@ -170,8 +170,8 @@ class Mapper_Topic extends Mapper {
$sql = "SELECT $sql = "SELECT
count(t.topic_id) as count count(t.topic_id) as count
FROM FROM
".DB_TABLE_TOPIC." as t, ".Config::Get('db.table.topic')." as t,
".DB_TABLE_BLOG." as b ".Config::Get('db.table.blog')." as b
WHERE WHERE
1=1 1=1
@ -190,7 +190,7 @@ class Mapper_Topic extends Mapper {
SELECT SELECT
topic_id topic_id
FROM FROM
".DB_TABLE_TOPIC_TAG." ".Config::Get('db.table.topic_tag')."
WHERE WHERE
topic_tag_text = ? topic_tag_text = ?
ORDER BY topic_id DESC ORDER BY topic_id DESC
@ -210,7 +210,7 @@ class Mapper_Topic extends Mapper {
$sql = "SELECT $sql = "SELECT
t.topic_id t.topic_id
FROM FROM
".DB_TABLE_TOPIC." as t ".Config::Get('db.table.topic')." as t
WHERE WHERE
t.topic_publish = 1 t.topic_publish = 1
AND AND
@ -233,7 +233,7 @@ class Mapper_Topic extends Mapper {
tt.topic_tag_text, tt.topic_tag_text,
count(tt.topic_tag_text) as count count(tt.topic_tag_text) as count
FROM FROM
".DB_TABLE_TOPIC_TAG." as tt ".Config::Get('db.table.topic_tag')." as tt
GROUP BY GROUP BY
tt.topic_tag_text tt.topic_tag_text
ORDER BY ORDER BY
@ -259,7 +259,7 @@ class Mapper_Topic extends Mapper {
public function increaseTopicCountComment($sTopicId) { public function increaseTopicCountComment($sTopicId) {
$sql = "UPDATE ".DB_TABLE_TOPIC." $sql = "UPDATE ".Config::Get('db.table.topic')."
SET SET
topic_count_comment=topic_count_comment+1 topic_count_comment=topic_count_comment+1
WHERE WHERE
@ -272,7 +272,7 @@ class Mapper_Topic extends Mapper {
} }
public function UpdateTopic(TopicEntity_Topic $oTopic) { public function UpdateTopic(TopicEntity_Topic $oTopic) {
$sql = "UPDATE ".DB_TABLE_TOPIC." $sql = "UPDATE ".Config::Get('db.table.topic')."
SET SET
blog_id= ?d, blog_id= ?d,
topic_title= ?, topic_title= ?,
@ -301,7 +301,7 @@ class Mapper_Topic extends Mapper {
} }
public function UpdateTopicContent(TopicEntity_Topic $oTopic) { public function UpdateTopicContent(TopicEntity_Topic $oTopic) {
$sql = "UPDATE ".DB_TABLE_TOPIC_CONTENT." $sql = "UPDATE ".Config::Get('db.table.topic_content')."
SET SET
topic_text= ?, topic_text= ?,
topic_text_short= ?, topic_text_short= ?,
@ -350,7 +350,7 @@ class Mapper_Topic extends Mapper {
public function AddFavouriteTopic(TopicEntity_FavouriteTopic $oFavouriteTopic) { public function AddFavouriteTopic(TopicEntity_FavouriteTopic $oFavouriteTopic) {
$sql = "INSERT INTO ".DB_TABLE_FAVOURITE_TOPIC." $sql = "INSERT INTO ".Config::Get('db.table.favourite_topic')."
(user_id, (user_id,
topic_id, topic_id,
topic_publish topic_publish
@ -365,7 +365,7 @@ class Mapper_Topic extends Mapper {
} }
public function DeleteFavouriteTopic(TopicEntity_FavouriteTopic $oFavouriteTopic) { public function DeleteFavouriteTopic(TopicEntity_FavouriteTopic $oFavouriteTopic) {
$sql = "DELETE FROM ".DB_TABLE_FAVOURITE_TOPIC." $sql = "DELETE FROM ".Config::Get('db.table.favourite_topic')."
WHERE WHERE
user_id = ?d user_id = ?d
AND AND
@ -379,7 +379,7 @@ class Mapper_Topic extends Mapper {
} }
public function SetFavouriteTopicPublish($sTopicId,$iPublish) { public function SetFavouriteTopicPublish($sTopicId,$iPublish) {
$sql = "UPDATE ".DB_TABLE_FAVOURITE_TOPIC." $sql = "UPDATE ".Config::Get('db.table.favourite_topic')."
SET SET
topic_publish = ?d topic_publish = ?d
WHERE WHERE
@ -397,7 +397,7 @@ class Mapper_Topic extends Mapper {
$sql = "SELECT $sql = "SELECT
f.* f.*
FROM FROM
".DB_TABLE_FAVOURITE_TOPIC." as f ".Config::Get('db.table.favourite_topic')." as f
WHERE WHERE
f.user_id = ?d f.user_id = ?d
AND AND
@ -417,7 +417,7 @@ class Mapper_Topic extends Mapper {
SELECT SELECT
topic_id topic_id
FROM FROM
".DB_TABLE_FAVOURITE_TOPIC." ".Config::Get('db.table.favourite_topic')."
WHERE WHERE
user_id = ? user_id = ?
and and
@ -438,7 +438,7 @@ class Mapper_Topic extends Mapper {
$sql = "SELECT $sql = "SELECT
count(topic_id) as count count(topic_id) as count
FROM FROM
".DB_TABLE_FAVOURITE_TOPIC." ".Config::Get('db.table.favourite_topic')."
WHERE WHERE
user_id = ? user_id = ?
and and
@ -455,7 +455,7 @@ class Mapper_Topic extends Mapper {
$sql = "SELECT $sql = "SELECT
topic_tag_text topic_tag_text
FROM FROM
".DB_TABLE_TOPIC_TAG." ".Config::Get('db.table.topic_tag')."
WHERE WHERE
topic_tag_text LIKE ? topic_tag_text LIKE ?
GROUP BY GROUP BY
@ -472,7 +472,7 @@ class Mapper_Topic extends Mapper {
} }
public function UpdateTopicRead(TopicEntity_TopicRead $oTopicRead) { public function UpdateTopicRead(TopicEntity_TopicRead $oTopicRead) {
$sql = "UPDATE ".DB_TABLE_TOPIC_READ." $sql = "UPDATE ".Config::Get('db.table.topic_read')."
SET SET
comment_count_last = ? , comment_count_last = ? ,
comment_id_last = ? , comment_id_last = ? ,
@ -486,7 +486,7 @@ class Mapper_Topic extends Mapper {
} }
public function AddTopicRead(TopicEntity_TopicRead $oTopicRead) { public function AddTopicRead(TopicEntity_TopicRead $oTopicRead) {
$sql = "INSERT INTO ".DB_TABLE_TOPIC_READ." $sql = "INSERT INTO ".Config::Get('db.table.topic_read')."
SET SET
comment_count_last = ? , comment_count_last = ? ,
comment_id_last = ? , comment_id_last = ? ,
@ -506,7 +506,7 @@ class Mapper_Topic extends Mapper {
$sql = "SELECT $sql = "SELECT
t.* t.*
FROM FROM
".DB_TABLE_TOPIC_READ." as t ".Config::Get('db.table.topic_read')." as t
WHERE WHERE
t.user_id = ?d t.user_id = ?d
AND AND
@ -522,7 +522,7 @@ class Mapper_Topic extends Mapper {
} }
public function AddTopicQuestionVote(TopicEntity_TopicQuestionVote $oTopicQuestionVote) { public function AddTopicQuestionVote(TopicEntity_TopicQuestionVote $oTopicQuestionVote) {
$sql = "INSERT INTO ".DB_TABLE_TOPIC_QUESTION_VOTE." $sql = "INSERT INTO ".Config::Get('db.table.topic_question_vote')."
(topic_id, (topic_id,
user_voter_id, user_voter_id,
answer answer
@ -545,7 +545,7 @@ class Mapper_Topic extends Mapper {
$sql = "SELECT $sql = "SELECT
v.* v.*
FROM FROM
".DB_TABLE_TOPIC_QUESTION_VOTE." as v ".Config::Get('db.table.topic_question_vote')." as v
WHERE WHERE
v.user_voter_id = ?d v.user_voter_id = ?d
AND AND

View file

@ -416,7 +416,7 @@ class LsUser extends Module {
* Ставим куку * Ставим куку
*/ */
if ($bRemember) { if ($bRemember) {
setcookie('key',$sKey,time()+60*60*24*3,SYS_COOKIE_PATH,SYS_COOKIE_HOST); setcookie('key',$sKey,time()+60*60*24*3,Config::Get('sys.cookie.path'),Config::Get('sys.cookie.host'));
} }
} }
/** /**
@ -470,7 +470,7 @@ class LsUser extends Module {
/** /**
* Дропаем куку * Дропаем куку
*/ */
setcookie('key','',1,SYS_COOKIE_PATH,SYS_COOKIE_HOST); setcookie('key','',1,Config::Get('sys.cookie.path'),Config::Get('sys.cookie.host'));
} }
/** /**
* Обновление данных сессии * Обновление данных сессии

View file

@ -110,7 +110,7 @@ class Mapper_User extends Mapper {
$sql = "SELECT $sql = "SELECT
s.user_id s.user_id
FROM FROM
".DB_TABLE_SESSION." as s ".Config::Get('db.table.session')." as s
WHERE WHERE
s.session_key = ? s.session_key = ?
"; ";
@ -121,7 +121,7 @@ class Mapper_User extends Mapper {
} }
public function CreateSession(UserEntity_Session $oSession) { public function CreateSession(UserEntity_Session $oSession) {
$sql = "REPLACE INTO ".DB_TABLE_SESSION." $sql = "REPLACE INTO ".Config::Get('db.table.session')."
SET SET
session_key = ? , session_key = ? ,
user_id = ? , user_id = ? ,
@ -134,7 +134,7 @@ class Mapper_User extends Mapper {
} }
public function UpdateSession(UserEntity_Session $oSession) { public function UpdateSession(UserEntity_Session $oSession) {
$sql = "UPDATE ".DB_TABLE_SESSION." $sql = "UPDATE ".Config::Get('db.table.session')."
SET SET
session_ip_last = ? , session_ip_last = ? ,
session_date_last = ? session_date_last = ?
@ -151,7 +151,7 @@ class Mapper_User extends Mapper {
$sql = "SELECT $sql = "SELECT
s.* s.*
FROM FROM
".DB_TABLE_SESSION." as s ".Config::Get('db.table.session')." as s
WHERE WHERE
s.user_id IN(?a) "; s.user_id IN(?a) ";
$aRes=array(); $aRes=array();
@ -173,7 +173,7 @@ class Mapper_User extends Mapper {
IF(ua.user_id IS NULL,0,1) as user_is_administrator IF(ua.user_id IS NULL,0,1) as user_is_administrator
FROM FROM
".Config::Get('db.table.user')." as u ".Config::Get('db.table.user')." as u
LEFT JOIN ".DB_TABLE_USER_ADMINISTRATOR." AS ua ON u.user_id=ua.user_id LEFT JOIN ".Config::Get('db.table.user_administrator')." AS ua ON u.user_id=ua.user_id
WHERE WHERE
u.user_id IN(?a) u.user_id IN(?a)
ORDER BY FIELD(u.user_id,?a) "; ORDER BY FIELD(u.user_id,?a) ";
@ -229,7 +229,7 @@ class Mapper_User extends Mapper {
$sql = "SELECT $sql = "SELECT
user_id user_id
FROM FROM
".DB_TABLE_SESSION." ".Config::Get('db.table.session')."
ORDER BY ORDER BY
session_date_last DESC session_date_last DESC
LIMIT 0, ?d LIMIT 0, ?d
@ -291,7 +291,7 @@ class Mapper_User extends Mapper {
} }
public function GetCountUsersActive($sDateActive) { public function GetCountUsersActive($sDateActive) {
$sql = "SELECT count(user_id) as count FROM ".DB_TABLE_SESSION." WHERE session_date_last >= ? "; $sql = "SELECT count(user_id) as count FROM ".Config::Get('db.table.session')." WHERE session_date_last >= ? ";
$result=$this->oDb->selectRow($sql,$sDateActive); $result=$this->oDb->selectRow($sql,$sDateActive);
return $result['count']; return $result['count'];
} }
@ -316,7 +316,7 @@ class Mapper_User extends Mapper {
".Config::Get('db.table.country_user')." ".Config::Get('db.table.country_user')."
GROUP BY country_id LIMIT 0, ?d GROUP BY country_id LIMIT 0, ?d
) as cu ) as cu
JOIN ".DB_TABLE_COUNTRY." as c on cu.country_id=c.country_id JOIN ".Config::Get('db.table.country')." as c on cu.country_id=c.country_id
ORDER BY c.country_name ORDER BY c.country_name
"; ";
$result=$this->oDb->select($sql,$sLimit); $result=$this->oDb->select($sql,$sLimit);
@ -333,10 +333,10 @@ class Mapper_User extends Mapper {
count(user_id) as count, count(user_id) as count,
city_id city_id
FROM FROM
".DB_TABLE_CITY_USER." ".Config::Get('db.table.city_user')."
GROUP BY city_id LIMIT 0, ?d GROUP BY city_id LIMIT 0, ?d
) as cu ) as cu
JOIN ".DB_TABLE_CITY." as c on cu.city_id=c.city_id JOIN ".Config::Get('db.table.city')." as c on cu.city_id=c.city_id
ORDER BY c.city_name ORDER BY c.city_name
"; ";
$result=$this->oDb->select($sql,$sLimit); $result=$this->oDb->select($sql,$sLimit);
@ -574,8 +574,8 @@ class Mapper_User extends Mapper {
$sql = " $sql = "
SELECT cu.user_id SELECT cu.user_id
FROM FROM
".DB_TABLE_CITY." as c, ".Config::Get('db.table.city')." as c,
".DB_TABLE_CITY_USER." as cu ".Config::Get('db.table.city_user')." as cu
WHERE WHERE
c.city_name = ? c.city_name = ?
AND AND
@ -604,7 +604,7 @@ class Mapper_User extends Mapper {
public function SetCityUser($sCityId,$sUserId) { public function SetCityUser($sCityId,$sUserId) {
$sql = "REPLACE ".DB_TABLE_CITY_USER." $sql = "REPLACE ".Config::Get('db.table.city_user')."
SET SET
city_id = ? , city_id = ? ,
user_id = ? user_id = ?
@ -613,7 +613,7 @@ class Mapper_User extends Mapper {
} }
public function GetCityByName($sName) { public function GetCityByName($sName) {
$sql = "SELECT * FROM ".DB_TABLE_CITY." WHERE city_name = ? "; $sql = "SELECT * FROM ".Config::Get('db.table.city')." WHERE city_name = ? ";
if ($aRow=$this->oDb->selectRow($sql,$sName)) { if ($aRow=$this->oDb->selectRow($sql,$sName)) {
return new UserEntity_City($aRow); return new UserEntity_City($aRow);
} }
@ -621,7 +621,7 @@ class Mapper_User extends Mapper {
} }
public function AddCity(UserEntity_City $oCity) { public function AddCity(UserEntity_City $oCity) {
$sql = "INSERT INTO ".DB_TABLE_CITY." $sql = "INSERT INTO ".Config::Get('db.table.city')."
(city_name) (city_name)
VALUES(?) VALUES(?)
"; ";
@ -635,7 +635,7 @@ class Mapper_User extends Mapper {
$sql = "SELECT $sql = "SELECT
* *
FROM FROM
".DB_TABLE_CITY." ".Config::Get('db.table.city')."
WHERE WHERE
city_name LIKE ? city_name LIKE ?
LIMIT 0, ?d LIMIT 0, ?d

View file

@ -19,7 +19,7 @@ class Mapper_Vote extends Mapper {
public function AddVote(VoteEntity_Vote $oVote) { public function AddVote(VoteEntity_Vote $oVote) {
$sql = "INSERT INTO ".DB_TABLE_VOTE." $sql = "INSERT INTO ".Config::Get('db.table.vote')."
(target_id, (target_id,
target_type, target_type,
user_voter_id, user_voter_id,
@ -44,7 +44,7 @@ class Mapper_Vote extends Mapper {
$sql = "SELECT $sql = "SELECT
* *
FROM FROM
".DB_TABLE_VOTE." ".Config::Get('db.table.vote')."
WHERE WHERE
target_id IN(?a) target_id IN(?a)
AND AND

View file

@ -19,7 +19,11 @@
*/ */
require_once(dirname(__FILE__)."/../engine/lib/internal/ConfigSimple/Config.class.php"); require_once(dirname(__FILE__)."/../engine/lib/internal/ConfigSimple/Config.class.php");
Config::LoadFromFile(dirname(__FILE__).'/config.php'); Config::LoadFromFile(dirname(__FILE__).'/config.php');
Config::DefineConstant(); //
// Рефакторниг:
// Переход на новую систему конфиг-массивов
// Config::DefineConstant();
//
/** /**
* Загружает конфиги модулей вида /config/modules/[module_name]/config.php * Загружает конфиги модулей вида /config/modules/[module_name]/config.php
@ -116,6 +120,9 @@ if ($hDirConfig = opendir($sDirConfig)) {
} }
closedir($hDirConfig); closedir($hDirConfig);
} }
//
Config::DefineConstant(); // Рефакторниг:
// Переход на новую систему конфиг-массивов
// Config::DefineConstant();
//
?> ?>

View file

@ -75,7 +75,7 @@ class LsText extends Module {
$this->oJevix->cfgSetTagNoAutoBr(array('ul','ol')); $this->oJevix->cfgSetTagNoAutoBr(array('ul','ol'));
// Теги с обязательными параметрами // Теги с обязательными параметрами
$this->oJevix->cfgSetTagParamsAutoAdd('embed',array(array('name'=>'wmode','value'=>'opaque','rewrite'=>true))); $this->oJevix->cfgSetTagParamsAutoAdd('embed',array(array('name'=>'wmode','value'=>'opaque','rewrite'=>true)));
if (BLOG_URL_NO_INDEX) { if (Config::Get('view.noindex')) {
$this->oJevix->cfgSetTagParamsAutoAdd('a',array(array('name'=>'rel','value'=>'nofollow','rewrite'=>true))); $this->oJevix->cfgSetTagParamsAutoAdd('a',array(array('name'=>'rel','value'=>'nofollow','rewrite'=>true)));
} }
// Отключение авто-добавления <br> // Отключение авто-добавления <br>

View file

@ -1,7 +1,7 @@
<ul class="menu"> <ul class="menu">
<li {if $sMenuSubItemSelect=='add'}class="active"{/if}> <li {if $sMenuSubItemSelect=='add'}class="active"{/if}>
<a href="{$aConfig.path.root.web}/{if $sMenuItemSelect=='add_blog'}{$ROUTE_PAGE_TOPIC}{else}{$sMenuItemSelect}{/if}/add/">{$aLang.topic_menu_add}</a> <a href="{$aConfig.path.root.web}/{if $sMenuItemSelect=='add_blog'}topic{else}{$sMenuItemSelect}{/if}/add/">{$aLang.topic_menu_add}</a>
{if $sMenuSubItemSelect=='add'} {if $sMenuSubItemSelect=='add'}
<ul class="sub-menu" > <ul class="sub-menu" >
<li {if $sMenuItemSelect=='topic'}class="active"{/if}><div><a href="{router page='topic'}{$sMenuSubItemSelect}/">{$aLang.topic_menu_add_topic}</a></div></li> <li {if $sMenuItemSelect=='topic'}class="active"{/if}><div><a href="{router page='topic'}{$sMenuSubItemSelect}/">{$aLang.topic_menu_add_topic}</a></div></li>