Копирование музыки друг у друга.
Выполните SQL запрос в Вашу БД:
Code:
ALTER TABLE `se_music` ADD `owner_user_id` text AFTER `music_user_id`
Откройте include/class_user.php
Найдите:
Code:
return array
(
'collaborators' => &$collaborators,
'pms' => &$pms
);
}
После добавьте:
Code:
function is_already_music($music_id)
{
global $database;
$music_tb = $database->database_fetch_assoc($database->database_query("SELECT owner_user_id FROM se_music WHERE music_id='{$music_id}' LIMIT 1"));
$owner_user_id = $music_tb[owner_user_id];
if(substr_count($owner_user_id, $this->user_info['user_id']) == 0)
return 0;
else
return 1;
return 1;
}
Откройте include/class_music.php
Найти
Code:
if( $this->user_id ) $sql .= "
WHERE
se_music.music_user_id='{$this->user_id}'
";
Заменить на:
Code:
if( $this->user_id ) $sql .= "
WHERE
se_music.music_user_id='{$this->user_id}' OR FIND_IN_SET('{$this->user_id}', owner_user_id)";
Откройте browse_music.php
Найти
Code:
$music_object = new se_music();
Добавить
Code:
$music_id = $_GET['music_id'];
if( $_GET['task'] == "copy" && $music_id > 0)
{
ob_end_clean();
$music_tb = $database->database_fetch_assoc($database->database_query("SELECT owner_user_id FROM se_music WHERE music_id='{$music_id}' LIMIT 1"));
$owner_user_id = trim($music_tb[owner_user_id]);
if(strrchr($owner_user_id, ','))
{
$owner_user_id_text = explode(',', $owner_user_id);
$owner_user_id_update = "";
foreach($owner_user_id_text as $owner_user_id)
{
if($owner_user_id != $user->user_info['user_id'])
$owner_user_id_update = $owner_user_id_update . "" . $owner_user_id . ",";
}
$owner_user_id_update = $owner_user_id_update . "" . $user->user_info['user_id'];
}
else
{
if($owner_user_id == $user->user_info['user_id'] || strlen($owner_user_id) == 0)
$owner_user_id_update = $user->user_info['user_id'];
if( strlen($owner_user_id) > 0 )
$owner_user_id_update = $owner_user_id . "," . $user->user_info['user_id'];
}
$database->database_query("UPDATE `se_music` SET `owner_user_id` = '{$owner_user_id_update}' WHERE `music_id` = '{$music_id}' LIMIT 1");
}
Откройте user_music.php
Найти
Code:
$musiclist = $music->music_list();
Добавить
Code:
if( $task == "removesong" && $music_id > 0)
{
ob_end_clean();
$music_tb = $database->database_fetch_assoc($database->database_query("SELECT owner_user_id FROM se_music WHERE music_id='{$music_id}' LIMIT 1"));
$owner_user_id = $music_tb[owner_user_id];
if(strrchr($owner_user_id, ','))
{
$owner_user_id_text = explode(',', $owner_user_id);
$owner_user_id_db = "";
foreach($owner_user_id_text as $owner_user_id)
{
if($owner_user_id != $user->user_info['user_id'])
$owner_user_id_db = $owner_user_id_db . "" . $owner_user_id . ",";
}
$owner_user_id_db = trim(substr_replace($owner_user_id_db, "", strlen($owner_user_id_db) - 1));
}
else
{
if($owner_user_id == $user->user_info['user_id'])
$owner_user_id_text = '';
}
$database->database_query("UPDATE `se_music` SET `owner_user_id` = '{$owner_user_id_db}' WHERE `music_id` = '{$music_id}' LIMIT 1");
}
Откройте browse_music.tpl
Найти
Code:
{if $user->user_exists && $user->level_info.level_music_allow_downloads}
<div style='margin-top: 4px;'>
<a type="application/force-download" href="{$media_path}">{lang_print id=4000095}</a>
</div>
{/if}
</td>
Добавить после
Code:
<td style='vertical-align: top; padding-left: 10px;' width='50'>
{if $user->user_friended($browse_music_list[browse_music_list_loop].user_id, 1) && $user->is_already_music($browse_music_list[browse_music_list_loop].music_id) == 0}
<div style='font-weight: bold; font-size: 8pt; text-align: right;'><a href='browse_music.php?task=copy&music_id={$browse_music_list[browse_music_list_loop].music_id}' title='Скопировать музыку к себе'>Копировать</a></div>
{/if}
</td>
Откройте user_music.tpl
Найти
Code:
{assign var='media_dir' value=$url->url_userdir($user->user_info.user_id)}
{section name=music_loop loop=$musiclist}
Заменить на
Code:
{section name=music_loop loop=$musiclist}
{assign var='media_dir' value=$url->url_userdir($musiclist[music_loop].music_user_id)}
Найти
Code:
<input type='checkbox' name='delete_music_{$musiclist[music_loop].music_id}' value='1' />
Заменить на
Code:
{if $musiclist[music_loop].music_user_id == $user->user_info.user_id}<input type='checkbox' name='delete_music_{$musiclist[music_loop].music_id}' value='1' />{/if}
Найти
Code:
<span class="seMusicTitleEdit"> (<a href="javascript:void(0);" onclick="SocialEngine.Music.editMusicTitle({$musiclist[music_loop].music_id});">{lang_print id=187}</a>)</span>
Заменить на
Code:
{if $musiclist[music_loop].music_user_id == $user->user_info.user_id}<span class="seMusicTitleEdit"> (<a href="javascript:void(0);" onclick="SocialEngine.Music.editMusicTitle({$musiclist[music_loop].music_id});">{lang_print id=187}</a>)</span>{/if}
Найти
Code:
<span class="seMusicDelete"><a href="javascript:void(0);" onclick="SocialEngine.Music.deleteMusic({$musiclist[music_loop].music_id});">{lang_print id=155}</a> </span>
Заменить на
Code:
{if $musiclist[music_loop].music_user_id == $user->user_info.user_id}
<span class="seMusicDelete"><a href="javascript:void(0);" onclick="SocialEngine.Music.deleteMusic({$musiclist[music_loop].music_id});">{lang_print id=155}</a> </span>
{else}
<span class="seMusicDelete"><a href=" user_music.php?task=removesong&music_id={$musiclist[music_loop].music_id}">{lang_print id=155}</a> </span>
{/if}
Откройте music_ajax.php
Найдите и удалите код
Code:
$user_dir = $url->url_userdir($user_id);
Далее найдите
и замените на
Code:
{$url->url_userdir($song[music_user_id])}