$old_url = $a->get_baseurl(true);
+ // Generate host names for relocation the addresses in the format user@address.tld
+ $new_host = str_replace("http://", "@", normalise_link($new_url));
+ $old_host = str_replace("http://", "@", normalise_link($old_url));
+
function update_table($table_name, $fields, $old_url, $new_url) {
global $db, $a;
}
// update tables
+ // update profile links in the format "http://server.tld"
update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
update_table("term", array('url'), $old_url, $new_url);
- update_table("contact", array('photo','thumb','micro','url','nurl','request','notify','poll','confirm','poco'), $old_url, $new_url);
- update_table("gcontact", array('photo','url','nurl','server_url'), $old_url, $new_url);
- update_table("item", array('owner-link','owner-avatar','author-name','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
+ update_table("contact", array('photo','thumb','micro','url','nurl','alias','request','notify','poll','confirm','poco', 'avatar'), $old_url, $new_url);
+ update_table("gcontact", array('url','nurl','photo','server_url','notify','alias'), $old_url, $new_url);
+ update_table("item", array('owner-link','owner-avatar','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
+
+ // update profile addresses in the format "user@server.tld"
+ update_table("contact", array('addr'), $old_host, $new_host);
+ update_table("gcontact", array('connect','addr'), $old_host, $new_host);
// update config
$a->set_baseurl($new_url);
'$advanced' => t('Advanced'),
'$portable_contacts' => t('Auto Discovered Contact Directory'),
'$performance' => t('Performance'),
+ '$worker_title' => t('Worker'),
'$relocate'=> t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
'$baseurl' => $a->get_baseurl(true),
// name, label, value, help string, extra data...
$a->set_pager_itemspage(100);
}
+ /* ordering */
+ $valid_orders = array(
+ 'contact.name',
+ 'user.email',
+ 'user.register_date',
+ 'user.login_date',
+ 'lastitem.lastitem_date',
+ 'user.page-flags'
+ );
+
+ $order = "contact.name";
+ $order_direction = "+";
+ if (x($_GET,'o')){
+ $new_order = $_GET['o'];
+ if ($new_order[0]==="-") {
+ $order_direction = "-";
+ $new_order = substr($new_order,1);
+ }
+
+ if (in_array($new_order, $valid_orders)){
+ $order = $new_order;
+ }
+ if (x($_GET,'d')){
+ $new_direction = $_GET['d'];
+
+ }
+ }
+ $sql_order = "`".str_replace('.','`.`',$order)."`";
+ $sql_order_direction = ($order_direction==="+")?"ASC":"DESC";
+
$users = q("SELECT `user`.* , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`, `user`.`account_expired`
FROM
(SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
`user`.`uid` = `contact`.`uid`
AND `user`.`verified` =1
AND `contact`.`self` =1
- ORDER BY `contact`.`name` LIMIT %d, %d
+ ORDER BY $sql_order $sql_order_direction LIMIT %d, %d
",
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
-
+
+ //echo "<pre>$users"; killme();
+
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
$_setup_users = function ($e) use ($adminlist){
$accounts = array(
array_push($users, array_pop($tmp_users));
}
+ $th_users = array_map(null,
+ array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')),
+ $valid_orders
+ );
+
$t = get_markup_template("admin_users.tpl");
$o = replace_macros($t, array(
// strings //
'$h_users' => t('Users'),
'$h_newuser' => t('New User'),
'$th_deleted' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since')),
- '$th_users' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')),
+ '$th_users' => $th_users,
+ '$order_users' => $order,
+ '$order_direction_users' => $order_direction,
'$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
'$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),