mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-01 05:55:02 +03:00
Доработка конвертора
This commit is contained in:
parent
f7bae471f7
commit
41acf23ba3
|
@ -108,4 +108,6 @@ INSERT INTO `prefix_user_field` (`type`, `name`, `title`, `pattern`) VALUES
|
|||
('social', 'twitter', 'Twitter', '<a href="http://twitter.com/{*}/">{*}</a>'),
|
||||
('social', 'facebook', 'Facebook', '<a href="http://facebook.com/{*}">{*}</a>'),
|
||||
('social', 'vkontakte', 'ВКонтакте', '<a href="http://vk.com/{*}">{*}</a>'),
|
||||
('social', 'odnoklassniki', 'Одноклассники', '<a href="http://www.odnoklassniki.ru/profile/{*}/">{*}</a>');
|
||||
('social', 'odnoklassniki', 'Одноклассники', '<a href="http://www.odnoklassniki.ru/profile/{*}/">{*}</a>');
|
||||
|
||||
ALTER TABLE `prefix_favourite_tag` ADD INDEX ( `text` );
|
|
@ -1572,7 +1572,51 @@ class Install {
|
|||
if(!mysql_query($sQuery)){
|
||||
$aErrors[] = mysql_error();
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавление тегов в избранное
|
||||
*/
|
||||
$sTablefFavourite=$aParams['prefix'].'favourite';
|
||||
$sTablefTopicTag=$aParams['prefix'].'topic_tag';
|
||||
$sTablefFavouriteTag=$aParams['prefix'].'favourite_tag';
|
||||
$iPage=1;
|
||||
do {
|
||||
$iLimitStart=($iPage-1)*100;
|
||||
$sQuery="SELECT f.user_id, f.target_id, t.topic_tag_text FROM `{$sTablefFavourite}` as f, `{$sTablefTopicTag}` as t WHERE f.`target_type`='topic' and f.`target_id`=t.topic_id LIMIT {$iLimitStart},100";
|
||||
if(!$aResults = mysql_query($sQuery)){
|
||||
$aErrors[] = mysql_error();
|
||||
break;
|
||||
}
|
||||
if (mysql_num_rows($aResults)) {
|
||||
while($aRow = mysql_fetch_assoc($aResults)) {
|
||||
$iUserId=$aRow['user_id'];
|
||||
$iTargetId=$aRow['target_id'];
|
||||
$sText=mysql_real_escape_string($aRow['topic_tag_text']);
|
||||
/**
|
||||
* Проверяем наличие
|
||||
*/
|
||||
$sQuery2="SELECT * FROM {$sTablefFavouriteTag} WHERE user_id='{$iUserId}' and target_id='{$iTargetId}' and target_type='topic' and is_user=0 and text='{$sText}' LIMIT 0,1";
|
||||
if(!($aResults2 = mysql_query($sQuery2))){
|
||||
$aErrors[] = mysql_error();
|
||||
break;
|
||||
}
|
||||
if($aRow2 = mysql_fetch_assoc($aResults2)) {
|
||||
// пропускаем
|
||||
break;
|
||||
}
|
||||
/**
|
||||
* Создаем
|
||||
*/
|
||||
$sQuery2="INSERT INTO {$sTablefFavouriteTag} SET user_id='{$iUserId}', target_id='{$iTargetId}', target_type='topic', is_user=0, text='{$sText}' ";
|
||||
if(!($aResults2 = mysql_query($sQuery2))){
|
||||
$aErrors[] = mysql_error();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
$iPage++;
|
||||
} while (1);
|
||||
|
||||
if(count($aErrors)==0) {
|
||||
return array('result'=>true,'errors'=>null);
|
||||
|
|
|
@ -159,7 +159,8 @@ CREATE TABLE IF NOT EXISTS `prefix_favourite_tag` (
|
|||
`text` varchar(50) NOT NULL,
|
||||
KEY `user_id_target_type_id` (`user_id`,`target_type`,`target_id`),
|
||||
KEY `target_type_id` (`target_type`,`target_id`),
|
||||
KEY `is_user` (`is_user`)
|
||||
KEY `is_user` (`is_user`),
|
||||
KEY `text` (`text`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
|
|
Loading…
Reference in a new issue