mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Add private messages feature
Add follow/unfollow users feature Add simple maintenance mode (/.maintenance file) Add user option to receive email on new content related shouts or private messages
This commit is contained in:
parent
2835e4c330
commit
edc85b1612
31 changed files with 1275 additions and 168 deletions
12
browse.php
12
browse.php
|
@ -56,6 +56,7 @@ switch ($_REQUEST['action']) {
|
|||
case 'clip':
|
||||
case 'personal_video':
|
||||
case 'label':
|
||||
case 'pvmsg':
|
||||
$browse->set_type($_REQUEST['action']);
|
||||
$browse->set_simple_browse(true);
|
||||
break;
|
||||
|
@ -190,6 +191,17 @@ switch ($_REQUEST['action']) {
|
|||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
case 'pvmsg':
|
||||
$browse->set_sort('creation_date','DESC');
|
||||
$folder = $_REQUEST['folder'];
|
||||
if ($folder === "sent") {
|
||||
$browse->set_filter('user', $GLOBALS['user']->id);
|
||||
} else {
|
||||
$browse->set_filter('to_user', $GLOBALS['user']->id);
|
||||
}
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
|
|
|
@ -124,7 +124,7 @@ class Ampache_RSS
|
|||
// Default to now playing
|
||||
$type = self::validate_type($type);
|
||||
|
||||
$string = '<a href="' . AmpConfig::get('web_path') . '/rss.php?type=' . $type . '">' . UI::get_icon('feed', T_('RSS Feed')) . '</a>';
|
||||
$string = '<a rel="nohtml" href="' . AmpConfig::get('web_path') . '/rss.php?type=' . $type . '">' . UI::get_icon('feed', T_('RSS Feed')) . '</a>';
|
||||
|
||||
return $string;
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ class Browse extends Query
|
|||
$box_req = AmpConfig::get('prefix') . '/templates/show_albums.inc.php';
|
||||
break;
|
||||
case 'user':
|
||||
$box_title = T_('Manage Users') . $match;
|
||||
$box_title = T_('Users') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_users.inc.php';
|
||||
break;
|
||||
case 'artist':
|
||||
|
@ -330,6 +330,10 @@ class Browse extends Query
|
|||
$box_title = T_('Labels');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_labels.inc.php';
|
||||
break;
|
||||
case 'pvmsg':
|
||||
$box_title = T_('Private Messages');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_pvmsgs.inc.php';
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
|
|
|
@ -88,24 +88,23 @@ class Playlist extends playlist_object
|
|||
|
||||
/**
|
||||
* get_playlists
|
||||
* Returns a list of playlists accessible by the current user.
|
||||
* Returns a list of playlists accessible by the user.
|
||||
*/
|
||||
public static function get_playlists()
|
||||
public static function get_playlists($incl_public = true, $user_id = null)
|
||||
{
|
||||
$sql = 'SELECT `id` from `playlist`';
|
||||
$sql_order = ' ORDER BY `name`';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
$sql .= " WHERE `type`='public' OR " .
|
||||
"`user`='" . $GLOBALS['user']->id . "'";
|
||||
if (!$user_id) {
|
||||
$user_id = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
$sql .= $sql_order;
|
||||
|
||||
$db_results = Dba::read($sql);
|
||||
$sql = 'SELECT `id` FROM `playlist`' .
|
||||
' WHERE `user` = ?';
|
||||
if ($incl_public) {
|
||||
$sql .= " OR `type` = 'public'";
|
||||
}
|
||||
$sql .= ' ORDER BY `name`';
|
||||
|
||||
$db_results = Dba::read($sql, array($user_id));
|
||||
$results = array();
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
$results[] = $row['id'];
|
||||
}
|
||||
|
|
|
@ -282,17 +282,9 @@ class Preference extends database_object
|
|||
*/
|
||||
public static function insert($name,$description,$default,$level,$type,$catagory)
|
||||
{
|
||||
// Clean em up
|
||||
$name = Dba::escape($name);
|
||||
$description = Dba::escape($description);
|
||||
$default = Dba::escape($default);
|
||||
$level = intval($level);
|
||||
$type = Dba::escape($type);
|
||||
$catagory = Dba::escape($catagory);
|
||||
|
||||
$sql = "INSERT INTO `preference` (`name`,`description`,`value`,`level`,`type`,`catagory`) " .
|
||||
"VALUES (?, ?, ?, ?, ?, ?)";
|
||||
$db_results = Dba::write($sql, param($name, $description, $default, intval($level), $type, $catagory));
|
||||
$db_results = Dba::write($sql, array($name, $description, $default, intval($level), $type, $catagory));
|
||||
|
||||
if (!$db_results) {
|
||||
return false;
|
||||
|
|
203
lib/class/privatemsg.class.php
Normal file
203
lib/class/privatemsg.class.php
Normal file
|
@ -0,0 +1,203 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* PrivateMsg class
|
||||
*
|
||||
* This is the class responsible for handling the PrivateMsg object
|
||||
* it is related to the user_pvmsg table in the database.
|
||||
*/
|
||||
class PrivateMsg extends database_object
|
||||
{
|
||||
/* Variables from DB */
|
||||
|
||||
/**
|
||||
* @var int $id
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @var string $subject
|
||||
*/
|
||||
public $subject;
|
||||
/**
|
||||
* @var string $message
|
||||
*/
|
||||
public $message;
|
||||
/**
|
||||
* @var integer $from_user
|
||||
*/
|
||||
public $from_user;
|
||||
/**
|
||||
* @var integer $to_user
|
||||
*/
|
||||
public $to_user;
|
||||
/**
|
||||
* @var integer $creation_date
|
||||
*/
|
||||
public $creation_date;
|
||||
/**
|
||||
* @var boolean $is_read
|
||||
*/
|
||||
public $is_read;
|
||||
|
||||
/**
|
||||
* @var string $f_subject
|
||||
*/
|
||||
public $f_subject;
|
||||
/**
|
||||
* @var string $f_message
|
||||
*/
|
||||
public $f_message;
|
||||
/**
|
||||
* @var string $link
|
||||
*/
|
||||
public $link;
|
||||
/**
|
||||
* @var string $f_link
|
||||
*/
|
||||
public $f_link;
|
||||
/**
|
||||
* @var string $f_from_user_link
|
||||
*/
|
||||
public $f_from_user_link;
|
||||
/**
|
||||
* @var string $f_to_user_link
|
||||
*/
|
||||
public $f_to_user_link;
|
||||
/**
|
||||
* @var string $f_creation_date
|
||||
*/
|
||||
public $f_creation_date;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*/
|
||||
public function __construct($id=null)
|
||||
{
|
||||
if (!$id) { return false; }
|
||||
|
||||
$info = $this->get_info($id, 'user_pvmsg');
|
||||
foreach ($info as $key=>$value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function format($details = true)
|
||||
{
|
||||
$this->f_subject = scrub_out($this->subject);
|
||||
$this->f_message = scrub_out($this->message);
|
||||
$this->f_creation_date = date("Y/m/d H:i:s", $this->creation_date);
|
||||
$from_user = new User($this->from_user);
|
||||
$from_user->format();
|
||||
$this->f_from_user_link = $from_user->f_link;
|
||||
$to_user = new User($this->to_user);
|
||||
$to_user->format();
|
||||
$this->f_to_user_link = $to_user->f_link;
|
||||
$this->link = AmpConfig::get('web_path') . '/pvmsg.php?pvmsg_id=' . $this->id;
|
||||
$this->f_link = "<a href=\"" . $this->link . "\">" . $this->f_subject . "</a>";
|
||||
}
|
||||
|
||||
public function set_is_read($read)
|
||||
{
|
||||
$sql = "UPDATE `user_pvmsg` SET `is_read` = ? WHERE `id` = ?";
|
||||
return Dba::write($sql, array($read ? 1 : 0, $this->id));
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$subject = trim(strip_tags($data['subject']));
|
||||
$message = trim(strip_tags($data['message']));
|
||||
|
||||
if (empty($subject)) {
|
||||
Error::add('subject', T_('Error: Subject Required'));
|
||||
}
|
||||
|
||||
$to_user = User::get_from_username($data['to_user']);
|
||||
if (!$to_user->id) {
|
||||
Error::add('to_user', T_('Error: Unknown user'));
|
||||
}
|
||||
|
||||
if (!Error::occurred()) {
|
||||
$from_user = $data['from_user'] ?: $GLOBALS['user']->id;
|
||||
$sql = "INSERT INTO `user_pvmsg` (`subject`, `message`, `from_user`, `to_user`, `creation_date`, `is_read`) " .
|
||||
"VALUES (?, ?, ?, ?, ?, ?)";
|
||||
if (Dba::write($sql, array($subject, $message, $from_user, $to_user->id, time(), '0'))) {
|
||||
$insert_id = Dba::insert_id();
|
||||
|
||||
if (Preference::get_by_user($to_user->id, 'notify_email')) {
|
||||
if (!empty($to_user->id->email)) {
|
||||
$libitem->format();
|
||||
$domain = parse_url(AmpConfig::get('web_path'), PHP_URL_HOST);
|
||||
|
||||
$mailer = new Mailer();
|
||||
$mailer->set_default_sender();
|
||||
$mailer->recipient = $to_user->email;
|
||||
$mailer->recipient_name = $to_user->fullname;
|
||||
$mailer->subject = "[" . $domain . "] " . $subject;
|
||||
$mailer->message = sprintf(T_("You just received a new private message from %s.\n\n
|
||||
----------------------
|
||||
%s
|
||||
----------------------
|
||||
|
||||
%s
|
||||
"), $GLOBALS['user']->fullname, $message, AmpConfig::get('web_path') . "/shout.php?action=show&pvmsg_id=" . $insert_id);
|
||||
$mailer->send();
|
||||
}
|
||||
}
|
||||
|
||||
return $insert_id;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_private_msgs
|
||||
* Get the user received private messages.
|
||||
* @param integer $to_user
|
||||
* @param boolean $unread_only
|
||||
* @param integer $from_user
|
||||
* @return int[]
|
||||
*/
|
||||
public static function get_private_msgs($to_user, $unread_only = false, $from_user = 0)
|
||||
{
|
||||
$sql = "SELECT `id` FROM `user_pvmsg` WHERE `to_user` = ?";
|
||||
$params = array($to_user);
|
||||
if ($unread_only) {
|
||||
$sql .= " AND `is_read` = '0'";
|
||||
}
|
||||
if ($from_user > 0) {
|
||||
$sql .= " AND `from_user` = ?";
|
||||
$params[] = $from_user;
|
||||
}
|
||||
|
||||
$db_results = Dba::read($sql, $params);
|
||||
$results = array();
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
$results[] = $row['id'];
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
}
|
|
@ -219,6 +219,18 @@ class Query
|
|||
'regex_match',
|
||||
'regex_not_match',
|
||||
'starts_with'
|
||||
),
|
||||
'pvmsg' => array(
|
||||
'alpha_match',
|
||||
'regex_match',
|
||||
'regex_not_match',
|
||||
'starts_with',
|
||||
'user',
|
||||
'to_user'
|
||||
),
|
||||
'follower' => array(
|
||||
'user',
|
||||
'to_user',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -368,6 +380,17 @@ class Query
|
|||
'name',
|
||||
'category',
|
||||
'user'
|
||||
),
|
||||
'pvmsg' => array(
|
||||
'subject',
|
||||
'to_user',
|
||||
'creation_date',
|
||||
'is_read'
|
||||
),
|
||||
'follower' => array(
|
||||
'user',
|
||||
'follow_user',
|
||||
'follow_date'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -451,6 +474,8 @@ class Query
|
|||
case 'season_lt':
|
||||
case 'season_lg':
|
||||
case 'season_eq':
|
||||
case 'user':
|
||||
case 'to_user':
|
||||
$this->_state['filter'][$key] = intval($value);
|
||||
break;
|
||||
case 'exact_match':
|
||||
|
@ -688,6 +713,8 @@ class Query
|
|||
case 'personal_video':
|
||||
case 'clip':
|
||||
case 'label':
|
||||
case 'pvmsg':
|
||||
case 'follower':
|
||||
// Set it
|
||||
$this->_state['type'] = $type;
|
||||
$this->set_base_sql(true, $custom_base);
|
||||
|
@ -1035,6 +1062,14 @@ class Query
|
|||
$this->set_select("`label`.`id`");
|
||||
$sql = "SELECT %%SELECT%% FROM `label` ";
|
||||
break;
|
||||
case 'pvmsg':
|
||||
$this->set_select("`user_pvmsg`.`id`");
|
||||
$sql = "SELECT %%SELECT%% FROM `user_pvmsg` ";
|
||||
break;
|
||||
case 'follower':
|
||||
$this->set_select("`user_follower`.`id`");
|
||||
$sql = "SELECT %%SELECT%% FROM `user_follower` ";
|
||||
break;
|
||||
case 'playlist_song':
|
||||
case 'song':
|
||||
default:
|
||||
|
@ -1671,6 +1706,44 @@ class Query
|
|||
break;
|
||||
} // end filter
|
||||
break;
|
||||
case 'pvmsg':
|
||||
switch ($filter) {
|
||||
case 'alpha_match':
|
||||
$filter_sql = " `user_pvmsg`.`subject` LIKE '%" . Dba::escape($value) . "%' AND ";
|
||||
break;
|
||||
case 'regex_match':
|
||||
if (!empty($value)) $filter_sql = " `user_pvmsg`.`subject` REGEXP '" . Dba::escape($value) . "' AND ";
|
||||
break;
|
||||
case 'regex_not_match':
|
||||
if (!empty($value)) $filter_sql = " `user_pvmsg`.`subject` NOT REGEXP '" . Dba::escape($value) . "' AND ";
|
||||
break;
|
||||
case 'starts_with':
|
||||
$filter_sql = " `user_pvmsg`.`subject` LIKE '" . Dba::escape($value) . "%' AND ";
|
||||
break;
|
||||
case 'user':
|
||||
$filter_sql = " `user_pvmsg`.`from_user` = '" . Dba::escape($value) . "' AND ";
|
||||
break;
|
||||
case 'to_user':
|
||||
$filter_sql = " `user_pvmsg`.`to_user` = '" . Dba::escape($value) . "' AND ";
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
} // end filter
|
||||
break;
|
||||
case 'follower':
|
||||
switch ($filter) {
|
||||
case 'user':
|
||||
$filter_sql = " `user_follower`.`user` = '" . Dba::escape($value) . "' AND ";
|
||||
break;
|
||||
case 'to_user':
|
||||
$filter_sql = " `user_follower`.`follow_user` = '" . Dba::escape($value) . "' AND ";
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
} // end filter
|
||||
break;
|
||||
} // end switch on type
|
||||
|
||||
return $filter_sql;
|
||||
|
@ -2008,6 +2081,35 @@ class Query
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case 'pvmsg':
|
||||
switch ($field) {
|
||||
case 'subject':
|
||||
$sql = "`user_pvmsg`.`subject`";
|
||||
break;
|
||||
case 'to_user':
|
||||
$sql = "`user_pvmsg`.`to_user`";
|
||||
break;
|
||||
case 'creation_date':
|
||||
$sql = "`user_pvmsg`.`creation_date`";
|
||||
break;
|
||||
case 'is_read':
|
||||
$sql = "`user_pvmsg`.`is_read`";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'follower':
|
||||
switch ($field) {
|
||||
case 'user':
|
||||
$sql = "`user_follower`.`user`";
|
||||
break;
|
||||
case 'follow_user':
|
||||
$sql = "`user_follower`.`follow_user`";
|
||||
break;
|
||||
case 'follow_date':
|
||||
$sql = "`user_follower`.`follow_date`";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
|
|
|
@ -519,6 +519,14 @@ class Search extends playlist_object
|
|||
'widget' => array('input', 'text')
|
||||
);
|
||||
break;
|
||||
case 'user':
|
||||
$this->types[] = array(
|
||||
'name' => 'username',
|
||||
'label' => T_('Username'),
|
||||
'type' => 'text',
|
||||
'widget' => array('input', 'text')
|
||||
);
|
||||
break;
|
||||
} // end switch on searchtype
|
||||
|
||||
} // end constructor
|
||||
|
@ -558,6 +566,7 @@ class Search extends playlist_object
|
|||
case 'song':
|
||||
case 'playlist':
|
||||
case 'label':
|
||||
case 'user':
|
||||
$request['type'] = $data['type'];
|
||||
break;
|
||||
default:
|
||||
|
@ -1481,4 +1490,51 @@ class Search extends playlist_object
|
|||
'having_sql' => ''
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* user_to_sql
|
||||
*
|
||||
* Handles the generation of the SQL for user searches.
|
||||
*/
|
||||
private function user_to_sql()
|
||||
{
|
||||
$sql_logic_operator = $this->logic_operator;
|
||||
$where = array();
|
||||
$table = array();
|
||||
|
||||
foreach ($this->rules as $rule) {
|
||||
$type = $this->name_to_basetype($rule[0]);
|
||||
$operator = array();
|
||||
foreach ($this->basetypes[$type] as $op) {
|
||||
if ($op['name'] == $rule[1]) {
|
||||
$operator = $op;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$input = $this->_mangle_data($rule[2], $type, $operator);
|
||||
$sql_match_operator = $operator['sql'];
|
||||
|
||||
switch ($rule[0]) {
|
||||
case 'username':
|
||||
$where[] = "`user`.`username` $sql_match_operator '$input'";
|
||||
break;
|
||||
default:
|
||||
// Nihil
|
||||
break;
|
||||
} // switch on ruletype
|
||||
} // foreach rule
|
||||
|
||||
$where_sql = implode(" $sql_logic_operator ", $where);
|
||||
|
||||
return array(
|
||||
'base' => 'SELECT DISTINCT(`user`.`id`) FROM `user`',
|
||||
'join' => $join,
|
||||
'where' => $where,
|
||||
'where_sql' => $where_sql,
|
||||
'table' => $table,
|
||||
'table_sql' => '',
|
||||
'group_sql' => '',
|
||||
'having_sql' => ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,15 +189,47 @@ class Shoutbox
|
|||
*/
|
||||
public static function create(array $data)
|
||||
{
|
||||
if (!Core::is_library_item($data['object_type']))
|
||||
return false;
|
||||
|
||||
$sticky = isset($data['sticky']) ? 1 : 0;
|
||||
$user = intval($data['user'] ?: $GLOBALS['user']->id);
|
||||
$date = intval($data['date'] ?: time());
|
||||
$comment = strip_tags($data['comment']);
|
||||
|
||||
$sql = "INSERT INTO `user_shout` (`user`,`date`,`text`,`sticky`,`object_id`,`object_type`, `data`) " .
|
||||
"VALUES (? , ?, ?, ?, ?, ?, ?)";
|
||||
Dba::write($sql, array($user, $date, strip_tags($data['comment']), $sticky, $data['object_id'], $data['object_type'], $data['data']));
|
||||
Dba::write($sql, array($user, $date, $comment, $sticky, $data['object_id'], $data['object_type'], $data['data']));
|
||||
|
||||
$insert_id = Dba::insert_id();
|
||||
|
||||
// Never send email in case of user impersonation
|
||||
if (!isset($data['user']) && $insert_id) {
|
||||
$libitem = new $data['object_type']($data['object_id']);
|
||||
$item_owner_id = $libitem->get_user_owner();
|
||||
if ($item_owner_id) {
|
||||
if (Preference::get_by_user($item_owner_id, 'notify_email')) {
|
||||
$item_owner = new User($item_owner_id);
|
||||
if (!empty($item_owner->email)) {
|
||||
$libitem->format();
|
||||
$mailer = new Mailer();
|
||||
$mailer->set_default_sender();
|
||||
$mailer->recipient = $item_owner->email;
|
||||
$mailer->recipient_name = $item_owner->fullname;
|
||||
$mailer->subject = T_('New shout on your content');
|
||||
$mailer->message = sprintf(T_("You just received a new shout from %s on your content `%s`.\n\n
|
||||
----------------------
|
||||
%s
|
||||
----------------------
|
||||
|
||||
%s
|
||||
"), $GLOBALS['user']->fullname, $libitem->get_fullname(), $comment, AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=" . $data['object_type'] . "&id=" . $data['object_id'] . "#shout" . $insert_id);
|
||||
$mailer->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $insert_id;
|
||||
|
||||
} // create
|
||||
|
|
|
@ -500,6 +500,9 @@ class Update
|
|||
$update_string = " - Add Label tables.<br />";
|
||||
$version[] = array('version' => '370033','description' => $update_string);
|
||||
|
||||
$update_string = " - Add User messages and user follow tables.<br />";
|
||||
$version[] = array('version' => '370034','description' => $update_string);
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
|
@ -3443,4 +3446,42 @@ class Update
|
|||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* update_370034
|
||||
*
|
||||
* Add User messages and user follow tables.
|
||||
*/
|
||||
public static function update_370034()
|
||||
{
|
||||
$retval = true;
|
||||
|
||||
$sql = "CREATE TABLE `user_pvmsg` (" .
|
||||
"`id` int(11) unsigned NOT NULL AUTO_INCREMENT," .
|
||||
"`subject` varchar(80) NOT NULL," .
|
||||
"`message` TEXT CHARACTER SET utf8 NULL," .
|
||||
"`from_user` int(11) unsigned NOT NULL," .
|
||||
"`to_user` int(11) unsigned NOT NULL," .
|
||||
"`is_read` tinyint(1) unsigned NOT NULL DEFAULT '0'," .
|
||||
"`creation_date` int(11) unsigned NULL," .
|
||||
"PRIMARY KEY (`id`)) ENGINE = MYISAM";
|
||||
$retval = Dba::write($sql) ? $retval : false;
|
||||
|
||||
$sql = "CREATE TABLE `user_follower` (" .
|
||||
"`id` int(11) unsigned NOT NULL AUTO_INCREMENT," .
|
||||
"`user` int(11) unsigned NOT NULL," .
|
||||
"`follow_user` int(11) unsigned NOT NULL," .
|
||||
"`follow_date` int(11) unsigned NULL," .
|
||||
"PRIMARY KEY (`id`)) ENGINE = MYISAM";
|
||||
$retval = Dba::write($sql) ? $retval : false;
|
||||
|
||||
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
|
||||
"VALUES ('notify_email','0','Receive notifications by email (shouts, private messages, ...)',25,'boolean','options')";
|
||||
$retval = Dba::write($sql) ? $retval : false;
|
||||
$id = Dba::insert_id();
|
||||
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
|
||||
$retval = Dba::write($sql, array($id)) ? $retval : false;
|
||||
|
||||
return $retval;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -974,7 +974,8 @@ class User extends database_object
|
|||
if (!$this->create_date) { $this->f_create_date = T_('Unknown'); } else { $this->f_create_date = date("m\/d\/Y - H:i",$this->create_date); }
|
||||
|
||||
// Base link
|
||||
$this->f_link = '<a href="' . AmpConfig::get('web_path') . '/stats.php?action=show_user&user_id=' . $this->id . '">' . $this->fullname . '</a>';
|
||||
$this->link = AmpConfig::get('web_path') . '/stats.php?action=show_user&user_id=' . $this->id;
|
||||
$this->f_link = '<a href="' . $this->link . '">' . $this->fullname . '</a>';
|
||||
|
||||
/* Calculate their total Bandwidth Usage */
|
||||
$sql = "SELECT `song`.`size` FROM `song` LEFT JOIN `object_count` ON `song`.`id`=`object_count`.`object_id` " .
|
||||
|
@ -1128,16 +1129,16 @@ class User extends database_object
|
|||
admin
|
||||
*/
|
||||
if ($this->has_access(100)) {
|
||||
$sql = "SELECT `id` FROM `user` WHERE `access`='100' AND id !='" . Dba::escape($this->id) . "'";
|
||||
$db_results = Dba::read($sql);
|
||||
$sql = "SELECT `id` FROM `user` WHERE `access`='100' AND id != ?";
|
||||
$db_results = Dba::read($sql, array($this->id));
|
||||
if (!Dba::num_rows($db_results)) {
|
||||
return false;
|
||||
}
|
||||
} // if this is an admin check for others
|
||||
|
||||
// Delete their playlists
|
||||
$sql = "DELETE FROM `playlist` WHERE `user`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `playlist` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Clean up the playlist data table
|
||||
$sql = "DELETE FROM `playlist_data` USING `playlist_data` " .
|
||||
|
@ -1146,47 +1147,55 @@ class User extends database_object
|
|||
Dba::write($sql);
|
||||
|
||||
// Delete any stats they have
|
||||
$sql = "DELETE FROM `object_count` WHERE `user`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `object_count` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Clear the IP history for this user
|
||||
$sql = "DELETE FROM `ip_history` WHERE `user`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `ip_history` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Nuke any access lists that are specific to this user
|
||||
$sql = "DELETE FROM `access_list` WHERE `user`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `access_list` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Delete their ratings
|
||||
$sql = "DELETE FROM `rating` WHERE `user`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `rating` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Delete their tags
|
||||
$sql = "DELETE FROM `tag_map` WHERE `user`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `tag_map` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Clean out the tags
|
||||
$sql = "DELETE FROM `tags` USING `tag_map` LEFT JOIN `tag_map` ON tag_map.id=tags.map_id AND tag_map.id IS NULL";
|
||||
Dba::write($sql);
|
||||
|
||||
// Delete their preferences
|
||||
$sql = "DELETE FROM `user_preference` WHERE `user`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `user_preference` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Delete their voted stuff in democratic play
|
||||
$sql = "DELETE FROM `user_vote` WHERE `user`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `user_vote` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Delete their shoutbox posts
|
||||
$sql = "DELETE FROM `user_shout` WHERE `user='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `user_shout` WHERE `user` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
// Delete their private messages posts
|
||||
$sql = "DELETE FROM `user_pvmsg` WHERE `from_user` = ? OR `to_user` = ?";
|
||||
Dba::write($sql, array($this->id, $this->id));
|
||||
|
||||
// Delete their following/followers
|
||||
$sql = "DELETE FROM `user_follow` WHERE `user` = ? OR `follow_user` = ?";
|
||||
Dba::write($sql, array($this->id, $this->id));
|
||||
|
||||
// Delete the user itself
|
||||
$sql = "DELETE FROM `user` WHERE `id`='$this->id'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `user` WHERE `id` = ?";
|
||||
Dba::write($sql, array($this->id));
|
||||
|
||||
$sql = "DELETE FROM `session` WHERE `username`='" . Dba::escape($this->username) . "'";
|
||||
Dba::write($sql);
|
||||
$sql = "DELETE FROM `session` WHERE `username` = ?";
|
||||
Dba::write($sql, array($this->username));
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -1379,6 +1388,108 @@ class User extends database_object
|
|||
|
||||
} // is_xmlrpc
|
||||
|
||||
/**
|
||||
* get_followers
|
||||
* Get users following this user
|
||||
* @return int[]
|
||||
*/
|
||||
public function get_followers()
|
||||
{
|
||||
$sql = "SELECT `user` FROM `user_follower` WHERE `follow_user` = ?";
|
||||
$db_results = Dba::read($sql, array($this->id));
|
||||
$results = array();
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
$results[] = $row['user'];
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_following
|
||||
* Get users followed by this user
|
||||
* @return int[]
|
||||
*/
|
||||
public function get_following()
|
||||
{
|
||||
$sql = "SELECT `follow_user` FROM `user_follower` WHERE `user` = ?";
|
||||
$db_results = Dba::read($sql, array($this->id));
|
||||
$results = array();
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
$results[] = $row['follow_user'];
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* is_followed_by
|
||||
* Get if an user is followed by this user
|
||||
* @param integer $user_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_followed_by($user_id)
|
||||
{
|
||||
$sql = "SELECT `id` FROM `user_follower` WHERE `user` = ? AND `follow_user` = ?";
|
||||
$db_results = Dba::read($sql, array($user_id, $this->id));
|
||||
return (Dba::num_rows($db_results) > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* is_following
|
||||
* Get if this user is following an user
|
||||
* @param integer $user_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_following($user_id)
|
||||
{
|
||||
$sql = "SELECT `id` FROM `user_follower` WHERE `user` = ? AND `follow_user` = ?";
|
||||
$db_results = Dba::read($sql, array($this->id, $user_id));
|
||||
return (Dba::num_rows($db_results) > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* toggle_follow
|
||||
* @param integer $user_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function toggle_follow($user_id)
|
||||
{
|
||||
if (!$user_id || $user_id === $this->id)
|
||||
return false;
|
||||
|
||||
$params = array($this->id, $user_id);
|
||||
if ($this->is_following($user_id)) {
|
||||
$sql = "DELETE FROM `user_follower` WHERE `user` = ? AND `follow_user` = ?";
|
||||
} else {
|
||||
$sql = "INSERT INTO `user_follower` (`user`, `follow_user`, `follow_date`) VALUES (?, ?, ?)";
|
||||
$params[] = time();
|
||||
}
|
||||
|
||||
return Dba::write($sql, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* get_display_follow
|
||||
* Get html code to display the follow/unfollow link
|
||||
* @param $display_user_id int|null
|
||||
* @return string
|
||||
*/
|
||||
public function get_display_follow($user_id = null)
|
||||
{
|
||||
if (!$user_id) {
|
||||
$user_id = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
if ($user_id === $this->id)
|
||||
return "";
|
||||
|
||||
$followed = $this->is_followed_by($user_id);
|
||||
|
||||
$html = "<span id='button_follow_" . $this->id . "' class='followbtn'>";
|
||||
$html .= Ajax::text('?page=user&action=flip_follow&user_id=' . $this->id, ($followed ? T_('Unfollow') : T_('Follow')) . ' (' . count($this->get_followers()) . ')', 'flip_follow_' . $this->id);
|
||||
$html .= "</span>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* check_username
|
||||
* This checks to make sure the username passed doesn't already
|
||||
|
|
|
@ -35,6 +35,11 @@ $load_time_begin = microtime(true);
|
|||
$ampache_path = dirname(__FILE__);
|
||||
$prefix = realpath($ampache_path . "/../");
|
||||
$configfile = $prefix . '/config/ampache.cfg.php';
|
||||
|
||||
if (file_exists($prefix . '/.maintenance')) {
|
||||
require_once($prefix . '/.maintenance');
|
||||
}
|
||||
|
||||
require_once $prefix . '/lib/general.lib.php';
|
||||
require_once $prefix . '/lib/class/ampconfig.class.php';
|
||||
require_once $prefix . '/lib/class/core.class.php';
|
||||
|
|
73
pvmsg.php
Normal file
73
pvmsg.php
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once 'lib/init.php';
|
||||
|
||||
if (!Access::check('interface','25') || !AmpConfig::get('sociable')) {
|
||||
debug_event('UI::access_denied', 'Access Denied: sociable features are not enabled.', '3');
|
||||
UI::access_denied();
|
||||
exit();
|
||||
}
|
||||
|
||||
UI::show_header();
|
||||
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
||||
|
||||
switch ($action) {
|
||||
case 'show_add_message':
|
||||
if (isset($_REQUEST['reply_to'])) {
|
||||
$pvmsg = new PrivateMsg($_REQUEST['reply_to']);
|
||||
if ($pvmsg->id && ($pvmsg->from_user === $GLOBALS['user']->id || $pvmsg->to_user === $GLOBALS['user']->id)) {
|
||||
$to_user = new User($pvmsg->from_user);
|
||||
$_REQUEST['to_user'] = $to_user->username;
|
||||
$_REQUEST['subject'] = "RE: " . $pvmsg->subject;
|
||||
$_REQUEST['message'] = "\n\n\n---\n> " . str_replace("\n", "\n> ", $pvmsg->message);
|
||||
}
|
||||
}
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_pvmsg.inc.php';
|
||||
break;
|
||||
case 'add_message':
|
||||
// Remove unauthorized defined values from here
|
||||
if (isset($_POST['from_user'])) {
|
||||
unset($_POST['from_user']);
|
||||
}
|
||||
|
||||
$pvmsg_id = PrivateMsg::create($_POST);
|
||||
if (!$pvmsg_id) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_pvmsg.inc.php';
|
||||
} else {
|
||||
$body = T_('Message Sent');
|
||||
$title = '';
|
||||
show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=pvmsg');
|
||||
}
|
||||
break;
|
||||
case 'show':
|
||||
default:
|
||||
$pvmsg = new PrivateMsg($_REQUEST['pvmsg_id']);
|
||||
$pvmsg->format();
|
||||
if (!$pvmsg->is_read) {
|
||||
$pvmsg->set_is_read(true);
|
||||
}
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_pvmsg.inc.php';
|
||||
break;
|
||||
}
|
||||
|
||||
UI::show_footer();
|
|
@ -74,6 +74,9 @@ switch ($page) {
|
|||
case 'player':
|
||||
require_once AmpConfig::get('prefix') . '/server/player.ajax.php';
|
||||
exit;
|
||||
case 'user':
|
||||
require_once AmpConfig::get('prefix') . '/server/user.ajax.php';
|
||||
exit;
|
||||
default:
|
||||
// A taste of compatibility
|
||||
break;
|
||||
|
|
|
@ -162,7 +162,7 @@ switch ($_REQUEST['action']) {
|
|||
'rule_1' => 'name',
|
||||
);
|
||||
$sres = Search::run($searchreq);
|
||||
debug_event('aaaaa', print_r($sres, true), 5);
|
||||
|
||||
// Litmit not reach, new search with another operator
|
||||
if (count($sres) < $limit) {
|
||||
$searchreq['limit'] = $limit - count($sres);
|
||||
|
@ -202,6 +202,37 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($target == 'user' && AmpConfig::get('sociable')) {
|
||||
$searchreq = array(
|
||||
'limit' => $limit,
|
||||
'type' => 'user',
|
||||
'rule_1_input' => $search,
|
||||
'rule_1_operator' => '2', // Starts with...
|
||||
'rule_1' => 'username',
|
||||
);
|
||||
$sres = Search::run($searchreq);
|
||||
|
||||
// Litmit not reach, new search with another operator
|
||||
if (count($sres) < $limit) {
|
||||
$searchreq['limit'] = $limit - count($sres);
|
||||
$searchreq['rule_1_operator'] = '0';
|
||||
$sres = array_unique(array_merge($sres, Search::run($searchreq)));
|
||||
}
|
||||
foreach ($sres as $id) {
|
||||
$user = new User($id);
|
||||
$user->format();
|
||||
$avatar = $user->get_avatar();
|
||||
$results[] = array(
|
||||
'type' => T_('Users'),
|
||||
'link' => '',
|
||||
'label' => $user->username,
|
||||
'value' => $user->username,
|
||||
'rels' => '',
|
||||
'image' => $avatar['url'] ?: '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$results['rfc3514'] = '0x1';
|
||||
|
|
47
server/user.ajax.php
Normal file
47
server/user.ajax.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sub-Ajax page, requires AJAX_INCLUDE
|
||||
*/
|
||||
if (!defined('AJAX_INCLUDE')) { exit; }
|
||||
|
||||
$user_id = intval($_REQUEST['user_id']);
|
||||
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'flip_follow':
|
||||
if (Access::check('interface', 25) && AmpConfig::get('sociable')) {
|
||||
$fuser = new User($user_id);
|
||||
if ($fuser->id > 0 && $user_id !== $GLOBALS['user']->id) {
|
||||
$GLOBALS['user']->toggle_follow($user_id);
|
||||
$results['button_follow_' . $user_id] = $fuser->get_display_follow();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$results['rfc3514'] = '0x1';
|
||||
break;
|
||||
} // switch on action;
|
||||
|
||||
// We always do this
|
||||
echo xoutput_from_array($results);
|
|
@ -281,3 +281,41 @@ a.tag_size1, a.tag_size2, a.tag_size3, a.tag_size4 { text-decoration: none; }
|
|||
-webkit-transform: scaleX(-1);
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
||||
#notification {
|
||||
position: fixed;
|
||||
top: auto;
|
||||
bottom: 20px;
|
||||
left: 50%;
|
||||
z-index: 8888;
|
||||
width: 50%;
|
||||
padding: 5px 20px;
|
||||
margin: 0;
|
||||
background-color: #000;
|
||||
border-radius: 10px;
|
||||
-webkit-box-shadow: 0 4px 12px rgba(0,0,0,.5);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,.5);
|
||||
-webkit-transition: all .5s;
|
||||
transition: all .5s;
|
||||
-webkit-transform: translate(-50%,0);
|
||||
-ms-transform: translate(-50%,0);
|
||||
transform: translate(-50%,0);
|
||||
}
|
||||
|
||||
#notification.notification-out {
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
-webkit-transform: translate(-50%,80px);
|
||||
-ms-transform: translate(-50%,80px);
|
||||
transform: translate(-50%,80px);
|
||||
}
|
||||
|
||||
#notification img {
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
#notification-content {
|
||||
margin-left: 10px;
|
||||
}
|
|
@ -134,11 +134,17 @@ $_SESSION['login'] = false;
|
|||
<script type="text/javascript">
|
||||
$.widget( "custom.catcomplete", $.ui.autocomplete, {
|
||||
_renderItem: function( ul, item ) {
|
||||
var itemhtml = "<a href='" + item.link + "'>";
|
||||
var itemhtml = "";
|
||||
if (item.link !== '') {
|
||||
itemhtml += "<a href='" + item.link + "'>";
|
||||
} else {
|
||||
itemhtml += "<a>";
|
||||
}
|
||||
if (item.image != '') {
|
||||
itemhtml += "<img src='" + item.image + "' class='searchart' />";
|
||||
}
|
||||
itemhtml += "<span class='searchitemtxt'>" + item.label + ((item.rels == '') ? "" : " - " + item.rels) + "</span></a>"
|
||||
itemhtml += "<span class='searchitemtxt'>" + item.label + ((item.rels == '') ? "" : " - " + item.rels) + "</span>";
|
||||
itemhtml += "</a>";
|
||||
|
||||
return $( "<li class='ui-menu-item'>" )
|
||||
.data("ui-autocomplete-item", item)
|
||||
|
@ -307,7 +313,13 @@ $_SESSION['login'] = false;
|
|||
<?php require_once AmpConfig::get('prefix') . '/templates/show_search_bar.inc.php'; ?>
|
||||
<?php if (User::is_registered()) { ?>
|
||||
<?php require_once AmpConfig::get('prefix') . '/templates/show_playtype_switch.inc.php'; ?>
|
||||
<span id="loginInfo"><a href="<?php echo $web_path; ?>/preferences.php?tab=account"><?php echo $GLOBALS['user']->fullname; ?></a> <a rel="nohtml" href="<?php echo $web_path; ?>/logout.php">[<?php echo T_('Log out'); ?>]</a></span>
|
||||
<span id="loginInfo">
|
||||
<a href="<?php echo $web_path; ?>/stats.php?action=show_user&user_id=<?php echo $GLOBALS['user']->id; ?>"><?php echo $GLOBALS['user']->fullname; ?></a>
|
||||
<?php if (AmpConfig::get('sociable')) { ?>
|
||||
<a href="<?php echo $web_path; ?>/browse.php?action=pvmsg" title="<?php echo T_('New messages'); ?>">(<?php echo count(PrivateMsg::get_private_msgs($GLOBALS['user']->id, true)); ?>)</a>
|
||||
<?php } ?>
|
||||
<a rel="nohtml" href="<?php echo $web_path; ?>/logout.php">[<?php echo T_('Log out'); ?>]</a>
|
||||
</span>
|
||||
<?php } else { ?>
|
||||
<span id="loginInfo">
|
||||
<a href="<?php echo $web_path; ?>/login.php" rel="nohtml"><?php echo T_('Login'); ?></a>
|
||||
|
|
85
templates/show_add_pvmsg.inc.php
Normal file
85
templates/show_add_pvmsg.inc.php
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
?>
|
||||
<?php UI::show_box_top(T_('Compose Message'), 'box box_add_pvmsg'); ?>
|
||||
<form name="label" method="post" action="<?php echo AmpConfig::get('web_path'); ?>/pvmsg.php?action=add_message">
|
||||
<table class="tabledata" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><?php echo T_('Recipient'); ?></td>
|
||||
<td>
|
||||
<input type="text" name="to_user" value="<?php echo scrub_out($_REQUEST['to_user']); ?>" id="pvmsg_to_user" />
|
||||
<?php Error::display('to_user'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo T_('Subject'); ?></td>
|
||||
<td>
|
||||
<input type="text" name="subject" value="<?php echo scrub_out($_REQUEST['subject']); ?>" />
|
||||
<?php Error::display('subject'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo T_('Message'); ?></td>
|
||||
<td>
|
||||
<textarea name="message" cols="64" rows="10"><?php echo scrub_out($_REQUEST['message']); ?></textarea>
|
||||
<?php Error::display('message'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="formValidation">
|
||||
<?php echo Core::form_register('add_pvmsg'); ?>
|
||||
<input class="button" type="submit" value="<?php echo T_('Send'); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$( "#pvmsg_to_user" ).catcomplete({
|
||||
source: function( request, response ) {
|
||||
$.getJSON( jsAjaxUrl, {
|
||||
page: 'search',
|
||||
action: 'search',
|
||||
target: 'user',
|
||||
search: request.term,
|
||||
xoutput: 'json'
|
||||
}, response );
|
||||
},
|
||||
search: function() {
|
||||
// custom minLength
|
||||
if (this.value.length < 2) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
focus: function() {
|
||||
// prevent value inserted on focus
|
||||
return false;
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
if (ui.item != null) {
|
||||
$(this).val(ui.item.value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php UI::show_box_bottom(); ?>
|
|
@ -44,6 +44,7 @@ if ($directplay_limit > 0) {
|
|||
}
|
||||
?>
|
||||
<?php UI::show_box_top($title,'info-box'); ?>
|
||||
|
||||
<div class="item_right_info">
|
||||
<div class="external_links">
|
||||
<a href="http://www.google.com/search?q=%22<?php echo rawurlencode($album->f_artist); ?>%22+%22<?php echo rawurlencode($album->f_name); ?>%22" target="_blank"><?php echo UI::get_icon('google', T_('Search on Google ...')); ?></a>
|
||||
|
@ -75,6 +76,18 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$owner_id = $album->get_user_owner();
|
||||
if (AmpConfig::get('sociable') && $owner_id > 0) {
|
||||
$owner = new User($owner_id);
|
||||
$owner->format();
|
||||
?>
|
||||
<div class="item_uploaded_by">
|
||||
<?php echo T_('Uploaded by'); ?> <?php echo $owner->f_link; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div id="information_actions">
|
||||
<h3><?php echo T_('Actions'); ?>:</h3>
|
||||
<ul>
|
||||
|
|
|
@ -73,6 +73,18 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$owner_id = $artist->get_user_owner();
|
||||
if (AmpConfig::get('sociable') && $owner_id > 0) {
|
||||
$owner = new User($owner_id);
|
||||
$owner->format();
|
||||
?>
|
||||
<div class="item_uploaded_by">
|
||||
<?php echo T_('Uploaded by'); ?> <?php echo $owner->f_link; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div id="information_actions">
|
||||
<h3><?php echo T_('Actions'); ?>:</h3>
|
||||
<ul>
|
||||
|
|
|
@ -89,7 +89,7 @@ if (Art::is_enabled()) {
|
|||
<?php echo UI::get_icon('edit', T_('Edit')); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if (Catalog::can_remove($artist)) { ?>
|
||||
<?php if (Catalog::can_remove($libitem)) { ?>
|
||||
<a id="<?php echo 'delete_artist_'.$libitem->id ?>" href="<?php echo AmpConfig::get('web_path'); ?>/artists.php?action=delete&artist_id=<?php echo $libitem->id; ?>">
|
||||
<?php echo UI::get_icon('delete', T_('Delete')); ?>
|
||||
</a>
|
||||
|
|
45
templates/show_pvmsg.inc.php
Normal file
45
templates/show_pvmsg.inc.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
UI::show_box_top($pvmsg->f_subject, 'info-box');
|
||||
?>
|
||||
<div>
|
||||
<?php echo T_('Sent by') . ' ' . $pvmsg->f_from_user_link . ' at ' . $pvmsg->f_creation_date; ?>
|
||||
</div>
|
||||
<div id="information_actions">
|
||||
<h3><?php echo T_('Actions'); ?>:</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a id="<?php echo 'reply_pvmsg_'.$label->id ?>" href="<?php echo AmpConfig::get('web_path'); ?>/pvmsg.php?action=show_add_message&reply_to=<?php echo $pvmsg->id; ?>">
|
||||
<?php echo UI::get_icon('mail', T_('Reply')); ?> <?php echo T_('Reply'); ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<div>
|
||||
<?php echo nl2br($pvmsg->f_message); ?>
|
||||
</div>
|
||||
|
||||
<?php UI::show_box_bottom(); ?>
|
32
templates/show_pvmsg_row.inc.php
Normal file
32
templates/show_pvmsg_row.inc.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
?>
|
||||
<td class="cel_subject"><?php echo $libitem->f_link; ?></td>
|
||||
<td class="cel_from_user"><?php echo $libitem->f_from_user_link; ?></td>
|
||||
<td class="cel_to_user"><?php echo $libitem->f_to_user_link; ?></td>
|
||||
<td class="cel_creation_date"><?php echo $libitem->f_creation_date; ?></td>
|
||||
<td class="cel_action">
|
||||
<a id="<?php echo 'reply_pvmsg_'.$libitem->id ?>" href="<?php echo AmpConfig::get('web_path'); ?>/pvmsg.php?action=show_add_message&reply_to=<?php echo $libitem->id; ?>">
|
||||
<?php echo UI::get_icon('mail', T_('Reply')); ?>
|
||||
</a>
|
||||
</td>
|
70
templates/show_pvmsgs.inc.php
Normal file
70
templates/show_pvmsgs.inc.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
$thcount = 5;
|
||||
?>
|
||||
<div id="information_actions">
|
||||
<ul>
|
||||
<li><?php echo UI::get_icon('mail', T_('Compose')); ?> <a href="<?php echo AmpConfig::get('web_path'); ?>/pvmsg.php?action=show_add_message"><?php echo T_('Compose a new message'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
|
||||
<table class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="label">
|
||||
<thead>
|
||||
<tr class="th-top">
|
||||
<th class="cel_subject essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=pvmsg&sort=subject', T_('Subject'),'pvmsg_sort_subject'); ?></th>
|
||||
<th class="cel_from_user essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=pvmsg&sort=from_user', T_('Sender'),'pvmsg_sort_from_user'); ?></th>
|
||||
<th class="cel_to_user essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=pvmsg&sort=to_user', T_('Recipient'),'pvmsg_sort_to_user'); ?></th>
|
||||
<th class="cel_creation_date essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=pvmsg&sort=creation_date', T_('Date'),'pvmsg_sort_creation_date'); ?></th>
|
||||
<th class="cel_action essential"><?php echo T_('Action'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
/* Foreach through every label that has been passed to us */
|
||||
foreach ($object_ids as $pvmg_id) {
|
||||
$libitem = new PrivateMsg($pvmg_id);
|
||||
$libitem->format();
|
||||
?>
|
||||
<tr id="label_<?php echo $libitem->id; ?>" class="<?php echo UI::flip_class(); ?> <?php echo (!$libitem->is_read) ? "unread" : "" ?>">
|
||||
<?php require AmpConfig::get('prefix') . '/templates/show_pvmsg_row.inc.php'; ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if (!count($object_ids)) { ?>
|
||||
<tr class="<?php echo UI::flip_class(); ?>">
|
||||
<td colspan="<?php echo $thcount; ?>"><span class="nodata"><?php echo T_('No message found'); ?></span></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="th-bottom">
|
||||
<th class="cel_subject essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=pvmsg&sort=subject', T_('Subject'),'pvmsg_sort_subject'); ?></th>
|
||||
<th class="cel_from_user essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=pvmsg&sort=from_user', T_('Sender'),'pvmsg_sort_from_user'); ?></th>
|
||||
<th class="cel_to_user essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=pvmsg&sort=to_user', T_('Recipient'),'pvmsg_sort_to_user'); ?></th>
|
||||
<th class="cel_creation_date essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=pvmsg&sort=creation_date', T_('Date'),'pvmsg_sort_creation_date'); ?></th>
|
||||
<th class="cel_action essential"><?php echo T_('Action'); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<?php show_table_render(); ?>
|
||||
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
|
|
@ -27,7 +27,7 @@
|
|||
$shout = new Shoutbox($shout_id);
|
||||
$shout->format();
|
||||
?>
|
||||
<div class="shout <?php echo UI::flip_class(); ?>">
|
||||
<div id="shout<?php echo $shout->id; ?>" class="shout <?php echo UI::flip_class(); ?>">
|
||||
<?php echo $shout->get_display(true, true); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -151,6 +151,14 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
}
|
||||
}
|
||||
|
||||
$owner_id = $song->get_user_owner();
|
||||
if (AmpConfig::get('sociable') && $owner_id > 0) {
|
||||
$owner = new User($owner_id);
|
||||
$owner->format();
|
||||
$songprops[gettext_noop('Uploaded by')] = $owner->f_link;
|
||||
}
|
||||
|
||||
|
||||
foreach ($songprops as $key => $value) {
|
||||
if (trim($value)) {
|
||||
$rowparity = UI::flip_class();
|
||||
|
|
|
@ -25,29 +25,47 @@ $create_date = $client->create_date ? date("m\/d\/y - H:i",$client->create_date)
|
|||
$client->format();
|
||||
?>
|
||||
<?php UI::show_box_top($client->fullname); ?>
|
||||
<div class="user_avatar">
|
||||
<?php
|
||||
if ($client->f_avatar) {
|
||||
echo '<div class="user_avatar">' . $client->f_avatar . '</div>';
|
||||
echo $client->f_avatar . "<br /><br />";
|
||||
}
|
||||
?>
|
||||
<?php echo $client->get_display_follow(); ?>
|
||||
</div>
|
||||
<dl class="media_details">
|
||||
<?php $rowparity = UI::flip_class(); ?>
|
||||
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Full Name'); ?></dt>
|
||||
<dd class="<?php echo $rowparity; ?>"><?php echo $client->fullname; ?></dd>
|
||||
<dd class="<?php echo $rowparity; ?>">
|
||||
<?php echo $client->fullname; ?>
|
||||
<?php if (Access::check('interface','25') && AmpConfig::get('sociable')) { ?>
|
||||
<a id="<?php echo 'reply_pvmsg_'.$client->id ?>" href="<?php echo AmpConfig::get('web_path'); ?>/pvmsg.php?action=show_add_message&to_user=<?php echo $client->username; ?>">
|
||||
<?php echo UI::get_icon('mail', T_('Send private message')); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if (Access::check('interface','100')) { ?>
|
||||
<a href="<?php echo AmpConfig::get('web_path'); ?>/admin/users.php?action=show_edit&user_id=<?php echo $client->id; ?>"><?php echo UI::get_icon('edit', T_('Edit')); ?></a>
|
||||
<a href="<?php echo AmpConfig::get('web_path'); ?>/admin/users.php?action=show_preferences&user_id=<?php echo $client->id; ?>"><?php echo UI::get_icon('preferences', T_('Preferences')); ?></a>
|
||||
<?php } elseif ($client->id == $GLOBALS['user']->id) { ?>
|
||||
<a href="<?php echo AmpConfig::get('web_path'); ?>/preferences.php?tab=account"><?php echo UI::get_icon('edit', T_('Edit')); ?></a>
|
||||
<?php } ?>
|
||||
</dd>
|
||||
<?php $rowparity = UI::flip_class(); ?>
|
||||
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Create Date'); ?></dt>
|
||||
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Member Since'); ?></dt>
|
||||
<dd class="<?php echo $rowparity; ?>"><?php echo $create_date; ?></dd>
|
||||
<?php $rowparity = UI::flip_class(); ?>
|
||||
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Last Seen'); ?></dt>
|
||||
<dd class="<?php echo $rowparity; ?>"><?php echo $last_seen; ?></dd>
|
||||
<?php $rowparity = UI::flip_class(); ?>
|
||||
<?php if (Access::check('interface','50')) { ?>
|
||||
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Activity'); ?></dt>
|
||||
<dd class="<?php echo $rowparity; ?>">
|
||||
<?php echo $client->f_useage; ?>
|
||||
<?php if (AmpConfig::get('statistical_graphs') && Access::check('interface','50')) { ?>
|
||||
<?php if (AmpConfig::get('statistical_graphs')) { ?>
|
||||
<a href="<?php echo AmpConfig::get('web_path'); ?>/stats.php?action=graph&user_id=<?php echo $client->id; ?>"><?php echo UI::get_icon('statistics', T_('Graphs')); ?></a>
|
||||
<?php } ?>
|
||||
</dd>
|
||||
<?php } ?>
|
||||
<?php $rowparity = UI::flip_class(); ?>
|
||||
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Status'); ?></dt>
|
||||
<dd class="<?php echo $rowparity; ?>">
|
||||
|
@ -59,25 +77,30 @@ if ($client->f_avatar) {
|
|||
</dd>
|
||||
</dl><br />
|
||||
<?php UI::show_box_bottom(); ?>
|
||||
<?php
|
||||
if (AmpConfig::get('allow_upload') &&!AmpConfig::get('upload_user_artist')) {
|
||||
$sql = Catalog::get_uploads_sql('artist', $client->id);
|
||||
$browse = new Browse();
|
||||
$browse->set_type('artist', $sql);
|
||||
$browse->set_simple_browse(true);
|
||||
if ($browse->get_total() > 0) {
|
||||
$browse->show_objects();
|
||||
$browse->store();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$tmp_playlist = new Tmp_Playlist(Tmp_Playlist::get_from_userid($client->id));
|
||||
$object_ids = $tmp_playlist->get_items();
|
||||
if (count($object_ids) > 0) {
|
||||
|
||||
<div class="tabs_wrapper">
|
||||
<div id="tabs_container">
|
||||
<ul id="tabs">
|
||||
<li class="tab_active"><a href="#recentlyplayed"><?php echo T_('Recently Played'); ?></a></li>
|
||||
<?php if (AmpConfig::get('allow_upload')) { ?>
|
||||
<li><a href="#artists"><?php echo T_('Artists'); ?></a></li>
|
||||
<?php } ?>
|
||||
<li><a href="#playlists"><?php echo T_('Playlists'); ?></a></li>
|
||||
<?php if (AmpConfig::get('sociable')) { ?>
|
||||
<li><a href="#following"><?php echo T_('Following'); ?></a></li>
|
||||
<li><a href="#followers"><?php echo T_('Followers'); ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="tabs_content">
|
||||
<div id="recentlyplayed" class="tab_content" style="display: block;">
|
||||
<?php
|
||||
$tmp_playlist = new Tmp_Playlist(Tmp_Playlist::get_from_userid($client->id));
|
||||
$object_ids = $tmp_playlist->get_items();
|
||||
if (count($object_ids) > 0) {
|
||||
UI::show_box_top(T_('Active Playlist'));
|
||||
?>
|
||||
<table cellspacing="0">
|
||||
?>
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<?php
|
||||
|
@ -90,12 +113,59 @@ if (count($object_ids) > 0) {
|
|||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table><br />
|
||||
<?php UI::show_box_bottom(); ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
</table><br />
|
||||
<?php UI::show_box_bottom(); ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$data = Song::get_recently_played($client->id);
|
||||
Song::build_cache(array_keys($data));
|
||||
$user_id = $client->id;
|
||||
require AmpConfig::get('prefix') . '/templates/show_recently_played.inc.php';
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
<?php if (AmpConfig::get('allow_upload')) { ?>
|
||||
<div id="artists" class="tab_content">
|
||||
<?php
|
||||
$sql = Catalog::get_uploads_sql('artist', $client->id);
|
||||
$browse = new Browse();
|
||||
$browse->set_type('artist', $sql);
|
||||
$browse->set_simple_browse(true);
|
||||
$browse->show_objects();
|
||||
$browse->store();
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div id="playlists" class="tab_content">
|
||||
<?php
|
||||
$playlist_ids = Playlist::get_playlists(false, $client->id);
|
||||
$browse = new Browse();
|
||||
$browse->set_type('playlist');
|
||||
$browse->set_simple_browse(false);
|
||||
$browse->show_objects($playlist_ids);
|
||||
$browse->store();
|
||||
?>
|
||||
</div>
|
||||
<?php if (AmpConfig::get('sociable')) { ?>
|
||||
<div id="following" class="tab_content">
|
||||
<?php
|
||||
$following_ids = $client->get_following();
|
||||
$browse = new Browse();
|
||||
$browse->set_type('user');
|
||||
$browse->set_simple_browse(false);
|
||||
$browse->show_objects($following_ids);
|
||||
$browse->store();
|
||||
?>
|
||||
</div>
|
||||
<div id="followers" class="tab_content">
|
||||
<?php
|
||||
$follower_ids = $client->get_followers();
|
||||
$browse = new Browse();
|
||||
$browse->set_type('user');
|
||||
$browse->set_simple_browse(false);
|
||||
$browse->show_objects($follower_ids);
|
||||
$browse->store();
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -32,6 +32,7 @@ if ($libitem->f_avatar_mini) {
|
|||
</td>
|
||||
<td class="cel_lastseen"><?php echo $last_seen; ?></td>
|
||||
<td class="cel_registrationdate"><?php echo $create_date; ?></td>
|
||||
<?php if (Access::check('interface', 50)) { ?>
|
||||
<td class="cel_activity"><?php echo $libitem->f_useage; ?></td>
|
||||
<?php if (AmpConfig::get('track_user_ip')) { ?>
|
||||
<td class="cel_lastip">
|
||||
|
@ -40,7 +41,15 @@ if ($libitem->f_avatar_mini) {
|
|||
</a>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if (Access::check('interface', 25) && AmpConfig::get('sociable')) { ?>
|
||||
<td class="cel_follow"><?php echo $libitem->get_display_follow(); ?></td>
|
||||
<?php } ?>
|
||||
<td class="cel_action">
|
||||
<?php if (Access::check('interface', 25) && AmpConfig::get('sociable')) { ?>
|
||||
<a id="<?php echo 'reply_pvmsg_'.$libitem->id ?>" href="<?php echo AmpConfig::get('web_path'); ?>/pvmsg.php?action=show_add_message&to_user=<?php echo $libitem->username; ?>"><?php echo UI::get_icon('mail', T_('Send private message')); ?></a>
|
||||
<?php } ?>
|
||||
<?php if (Access::check('interface', 100)) { ?>
|
||||
<a href="<?php echo $web_path; ?>/admin/users.php?action=show_edit&user_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('edit', T_('Edit')); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/admin/users.php?action=show_preferences&user_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('preferences', T_('Preferences')); ?></a>
|
||||
<?php
|
||||
|
@ -52,6 +61,7 @@ if ($libitem->f_avatar_mini) {
|
|||
}
|
||||
?>
|
||||
<a href="<?php echo $web_path; ?>/admin/users.php?action=delete&user_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('delete', T_('Delete')); ?></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php
|
||||
if (($libitem->is_logged_in()) AND ($libitem->is_online())) {
|
||||
|
|
|
@ -29,23 +29,30 @@ $web_path = AmpConfig::get('web_path');
|
|||
<col id="col_username" />
|
||||
<col id="col_lastseen" />
|
||||
<col id="col_registrationdate" />
|
||||
<?php if (Access::check('interface', 50)) { ?>
|
||||
<col id="col_activity" />
|
||||
<?php if (AmpConfig::get('track_user_ip')) { ?>
|
||||
<?php if (AmpConfig::get('track_user_ip')) { ?>
|
||||
<col id="col_lastip" />
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<col id="col_action" />
|
||||
<col id="col_online" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="th-top">
|
||||
<th class="cel_username"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=fullname', T_('Fullname'),'users_sort_fullname'); ?>( <?php echo Ajax::text('?page=browse&action=set_sort&type=user&sort=username', T_('Username'),'users_sort_username');?>)</th>
|
||||
<th class="cel_username essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=fullname', T_('Fullname'),'users_sort_fullname'); ?> (<?php echo Ajax::text('?page=browse&action=set_sort&type=user&sort=username', T_('Username'),'users_sort_username');?>)</th>
|
||||
<th class="cel_lastseen"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=last_seen', T_('Last Seen'),'users_sort_lastseen'); ?></th>
|
||||
<th class="cel_registrationdate"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=create_date', T_('Registration Date'),'users_sort_createdate'); ?></th>
|
||||
<?php if (Access::check('interface', 50)) { ?>
|
||||
<th class="cel_activity"><?php echo T_('Activity'); ?></th>
|
||||
<?php if (AmpConfig::get('track_user_ip')) { ?>
|
||||
<th class="cel_lastip"><?php echo T_('Last Ip'); ?></th>
|
||||
<?php } ?>
|
||||
<th class="cel_action"><?php echo T_('Action'); ?></th>
|
||||
<?php } ?>
|
||||
<?php if (Access::check('interface', 25) && AmpConfig::get('sociable')) { ?>
|
||||
<th class="cel_follow essential"><?php echo T_('Following'); ?></th>
|
||||
<?php } ?>
|
||||
<th class="cel_action essential"><?php echo T_('Action'); ?></th>
|
||||
<th class="cel_online"><?php echo T_('On-line'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -67,10 +74,15 @@ foreach ($object_ids as $user_id) {
|
|||
<th class="cel_username"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=fullname', T_('Fullname'),'users_sort_fullname1'); ?>( <?php echo Ajax::text('?page=browse&action=set_sort&type=user&sort=username', T_('Username'),'users_sort_username1');?>)</th>
|
||||
<th class="cel_lastseen"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=last_seen', T_('Last Seen'),'users_sort_lastseen1'); ?></th>
|
||||
<th class="cel_registrationdate"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=create_date', T_('Registration Date'),'users_sort_createdate1'); ?></th>
|
||||
<?php if (Access::check('interface', 50)) { ?>
|
||||
<th class="cel_activity"><?php echo T_('Activity'); ?></th>
|
||||
<?php if (AmpConfig::get('track_user_ip')) { ?>
|
||||
<th class="cel_lastip"><?php echo T_('Last Ip'); ?></th>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if (Access::check('interface', 25) && AmpConfig::get('sociable')) { ?>
|
||||
<th class="cel_follow"><?php echo T_('Following'); ?></th>
|
||||
<?php } ?>
|
||||
<th class="cel_action"><?php echo T_('Action'); ?></th>
|
||||
<th class="cel_online"><?php echo T_('On-line'); ?></th>
|
||||
</tr>
|
||||
|
|
|
@ -188,44 +188,6 @@ input[type=button]:focus:active, input[type=submit]:focus:active {
|
|||
background-position: right;
|
||||
}
|
||||
|
||||
#notification {
|
||||
position: fixed;
|
||||
top: auto;
|
||||
bottom: 20px;
|
||||
left: 50%;
|
||||
z-index: 8888;
|
||||
width: 50%;
|
||||
padding: 5px 20px;
|
||||
margin: 0;
|
||||
background-color: #000;
|
||||
border-radius: 10px;
|
||||
-webkit-box-shadow: 0 4px 12px rgba(0,0,0,.5);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,.5);
|
||||
-webkit-transition: all .5s;
|
||||
transition: all .5s;
|
||||
-webkit-transform: translate(-50%,0);
|
||||
-ms-transform: translate(-50%,0);
|
||||
transform: translate(-50%,0);
|
||||
}
|
||||
|
||||
#notification.notification-out {
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
-webkit-transform: translate(-50%,80px);
|
||||
-ms-transform: translate(-50%,80px);
|
||||
transform: translate(-50%,80px);
|
||||
}
|
||||
|
||||
#notification img {
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
#notification-content {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
Header
|
||||
***********************************************/
|
||||
|
@ -904,6 +866,10 @@ table.tabledata tbody tr:hover .cel_play_content, table.tabledata tbody tr:focus
|
|||
display: none;
|
||||
}
|
||||
|
||||
table.tabledata tbody tr.unread {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.tabledata tbody .cel_add {
|
||||
max-width: 60px;
|
||||
min-width: 60px;
|
||||
|
@ -1370,6 +1336,12 @@ span.fatalerror {
|
|||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.item_uploaded_by {
|
||||
padding-left: 0px;
|
||||
padding-top: 10px;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.item_right_info {
|
||||
float: right;
|
||||
max-width: 60%;
|
||||
|
@ -1593,3 +1565,20 @@ a.option-list:hover {
|
|||
.stats_graph {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.followbtn {
|
||||
background-repeat: repeat-x;
|
||||
position: relative;
|
||||
padding: 5px 12px 4px;
|
||||
font-size: 15px;
|
||||
line-height: normal;
|
||||
border: 0px none;
|
||||
cursor: pointer;
|
||||
border-radius: 2px;
|
||||
background-position: 0px -10px;
|
||||
transition: background-position 0.1s linear 0s;
|
||||
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.5);
|
||||
text-decoration: none;
|
||||
min-width: 100px;
|
||||
background-color: #363F4A;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue