diff options
-rw-r--r-- | Zotlabs/Module/Admin/Accounts.php | 14 | ||||
-rw-r--r-- | Zotlabs/Module/Import.php | 19 | ||||
-rw-r--r-- | include/account.php | 2 | ||||
-rw-r--r-- | include/channel.php | 6 | ||||
-rw-r--r-- | include/import.php | 11 | ||||
-rw-r--r-- | view/tpl/admin_accounts.tpl | 92 |
6 files changed, 77 insertions, 67 deletions
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php index 76d332268..1c1911b3a 100644 --- a/Zotlabs/Module/Admin/Accounts.php +++ b/Zotlabs/Module/Admin/Accounts.php @@ -235,6 +235,13 @@ class Accounts { $pending[$n]['reg_atip_n'] = $atipn[$v['reg_atip']]; } + $pending[$n]['status'] = ''; + if($pending[$n]['reg_flags'] & ACCOUNT_UNVERIFIED > 0) + $pending[$n]['status'] = [t('Unverified'), 'bg-warning']; + + if($pending[$n]['status'] && $pending[$n]['reg_expires'] < datetime_convert()) + $pending[$n]['status'] = [t('Expired'), 'bg-danger text-white']; + // timezone adjust date_time for display $pending[$n]['reg_created'] = datetime_convert('UTC', date_default_timezone_get(), $pending[$n]['reg_created']); $pending[$n]['reg_startup'] = datetime_convert('UTC', date_default_timezone_get(), $pending[$n]['reg_startup']); @@ -300,13 +307,14 @@ class Accounts { '$title' => t('Administration'), '$page' => t('Accounts'), '$submit' => t('Submit'), - '$select_all' => t('select all'), + '$get_all' => (($get_all) ? t('Show verified registrations') : t('Show all registrations')), + '$get_all_link' => (($get_all) ? z_root() .'/admin/accounts' : z_root() .'/admin/accounts?get_all'), '$sel_tall' => t('Select toggle'), '$sel_deny' => t('Deny selected'), '$sel_aprv' => t('Approve selected'), - '$h_pending' => t('Verified registrations waiting for approval'), + '$h_pending' => (($get_all) ? t('All registrations') : t('Verified registrations waiting for approval')), '$th_pending' => array(t('Request date'), 'dId2', t('Email'), 'IP', t('Requests')), - '$no_pending' => t('No verified registrations.'), + '$no_pending' => (($get_all) ? t('No registrations available') : t('No verified registrations available')), '$approve' => t('Approve'), '$deny' => t('Deny'), '$delete' => t('Delete'), diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 8ef24b232..4622a588d 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -209,12 +209,6 @@ class Import extends \Zotlabs\Web\Controller { logger('import step 3'); - if(is_array($data['hubloc'])) { - import_hublocs($channel,$data['hubloc'],$seize,$moving); - } - - logger('import step 4'); - // create new hubloc for the new channel at this site if(array_key_exists('channel',$data)) { @@ -277,7 +271,7 @@ class Import extends \Zotlabs\Web\Controller { } - logger('import step 5'); + logger('import step 4'); // import xchans and contact photos @@ -335,7 +329,7 @@ class Import extends \Zotlabs\Web\Controller { } - logger('import step 6'); + logger('import step 5'); // import xchans $xchans = $data['xchan']; @@ -404,7 +398,14 @@ class Import extends \Zotlabs\Web\Controller { } } - logger('import step 7'); + logger('import step 6'); + } + + logger('import step 7'); + + // this must happen after xchans got imported! + if(is_array($data['hubloc'])) { + import_hublocs($channel,$data['hubloc'],$seize,$moving); } $friends = 0; diff --git a/include/account.php b/include/account.php index a7a87f331..349c6cfee 100644 --- a/include/account.php +++ b/include/account.php @@ -1276,7 +1276,7 @@ function get_pending_accounts($get_all = false) { if($get_all) $sql_extra = ''; - $r = q("SELECT reg_did2, reg_created, reg_startup, reg_expires, reg_email, reg_atip, reg_hash, reg_id, reg_stuff + $r = q("SELECT reg_did2, reg_created, reg_startup, reg_expires, reg_email, reg_atip, reg_hash, reg_id, reg_flags, reg_stuff FROM register WHERE reg_vital = 1 $sql_extra AND (reg_flags & %d) >= 0", intval(ACCOUNT_PENDING) ); diff --git a/include/channel.php b/include/channel.php index ecb7c24f7..31c7c407f 100644 --- a/include/channel.php +++ b/include/channel.php @@ -922,7 +922,7 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals $ret['photo'] = [ 'type' => $r[0]['mimetype'], 'data' => (($r[0]['os_storage']) - ? base64url_encode(file_get_contents($r[0]['content'])) : base64url_encode(dbunescbin($r[0]['content']))) + ? base64url_encode(file_get_contents(dbunescbin($r[0]['content']))) : base64url_encode(dbunescbin($r[0]['content']))) ]; } } @@ -991,11 +991,11 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals } if($xchans) { - $r = q("select * from xchan where xchan_hash in ( " . implode(',',$xchans) . " ) "); + $r = dbq("select * from xchan where xchan_hash in ( " . implode(',',$xchans) . " ) "); if($r) $ret['xchan'] = $r; - $r = q("select * from hubloc where hubloc_hash in ( " . implode(',',$xchans) . " ) "); + $r = dbq("select * from hubloc where hubloc_hash in ( " . implode(',',$xchans) . " ) "); if($r) $ret['hubloc'] = $r; } diff --git a/include/import.php b/include/import.php index 8ce582ede..42fa2f247 100644 --- a/include/import.php +++ b/include/import.php @@ -708,12 +708,12 @@ function import_items($channel, $items, $sync = false, $relocate = null) { $allow_code = channel_codeallowed($channel['channel_id']); $deliver = false; // Don't deliver any messages or notifications when importing - foreach($items as $i) { $item_result = false; $item = get_item_elements($i,$allow_code); - if(! $item) + if(! $item) { continue; + } // deprecated @@ -724,9 +724,10 @@ function import_items($channel, $items, $sync = false, $relocate = null) { item_url_replace($channel,$item,$relocate['url'],z_root(),$relocate['channel_address']); } - $r = q("select id, edited from item where mid = '%s' and uid = %d limit 1", + $r = q("select id, edited from item where mid = '%s' and uid = %d and revision = %d limit 1", dbesc($item['mid']), - intval($channel['channel_id']) + intval($channel['channel_id']), + intval($item['revision']) ); if($r) { @@ -734,7 +735,7 @@ function import_items($channel, $items, $sync = false, $relocate = null) { // so force an update even if we have the same timestamp if($item['edited'] >= $r[0]['edited']) { - $item['id'] = $r[0]['id']; + $item['id'] = $r[0]['id']; $item['uid'] = $channel['channel_id']; $item_result = item_store_update($item,$allow_code,$deliver); } diff --git a/view/tpl/admin_accounts.tpl b/view/tpl/admin_accounts.tpl index 490468e79..f4865f7a0 100644 --- a/view/tpl/admin_accounts.tpl +++ b/view/tpl/admin_accounts.tpl @@ -5,52 +5,52 @@ <input type="hidden" name="form_security_token" value="{{$form_security_token}}"> <h3>{{$h_pending}}</h3> - {{if $debug}}<div>{{$debug}}</div>{{/if}} - {{if $pending}} - <table id="pending"> - <thead> - <tr> - {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}} - <th></th> - <th></th> - </tr> - </thead> - <tbody> - {{foreach $pending as $n => $u}} - <tr class=""> - <td class="text-nowrap">{{$u.reg_created}}</td> - <td class="text-break">{{$u.reg_did2}}</td> - <td class="text-break">{{$u.reg_email}}</td> - <td class="">{{$u.reg_atip}}</td> - <td class="">{{$u.reg_atip_n}}</td> - <td class="checkbox_bulkedit"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$n}}" name="pending[]" value="{{$n}}"></td> - <td class="tools"> - <a id="zara_{{$n}}" {{* href="{{$baseurl}}/regmod/allow/{{$n}}" *}} class="zar2s zara btn btn-default btn-xs" title="{{$approve}}"><i class="fa fa-thumbs-o-up admin-icons"></i></a> - <a id="zard_{{$n}}" {{* href="{{$baseurl}}/regmod/deny/{{$n}}" *}} class="zar2s zard btn btn-default btn-xs" title="{{$deny}}"><i class="fa fa-thumbs-o-down admin-icons"></i></a> - <span id="zarreax_{{$n}}" class="zarreax"></span> - </td> - </tr> - <tr> - <td colspan="7"><strong>{{$msg}}:</strong> {{$u.msg}}</td> - </tr> - {{/foreach}} - </tbody> - </table> - {{* before, alternate: - * - <a href="#" onclick="return toggle_selectall('pending_ckbx');">{{$select_all}}</a> - * - *}} - <div class="selectall"> - <a id="zar2sat" class="btn btn-sm btn-primary" href="javascript:;">{{$sel_tall}}</a> - <a id="zar2aas" class="zar2xas btn btn-sm btn-success" href="javascript:;"><i class="fa fa-check"></i> {{$sel_aprv}}</a> - <a id="zar2das" class="zar2xas btn btn-sm btn-danger" href="javascript:;"><i class="fa fa-close"></i> {{$sel_deny}}</a> - </div> - {{else}} - <p>{{$no_pending}}</p> - {{/if}} - - + {{if $debug}}<div>{{$debug}}</div>{{/if}} + {{if $pending}} + <table id="pending"> + <thead> + <tr> + {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}} + <th></th> + <th></th> + </tr> + </thead> + <tbody> + {{foreach $pending as $n => $u}} + <tr title="{{$u.status.0}}" class="{{$u.status.1}}"> + <td class="text-nowrap">{{$u.reg_created}}</td> + <td class="text-nowrap">{{$u.reg_did2}}</td> + <td class="text-break">{{$u.reg_email}}</td> + <td class="">{{$u.reg_atip}}</td> + <td class="">{{$u.reg_atip_n}}</td> + <td class="checkbox_bulkedit"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$n}}" name="pending[]" value="{{$n}}"></td> + <td class="tools"> + <a id="zara_{{$n}}" {{* href="{{$baseurl}}/regmod/allow/{{$n}}" *}} class="zar2s zara btn btn-default btn-xs" title="{{$approve}}"><i class="fa fa-thumbs-o-up admin-icons"></i></a> + <a id="zard_{{$n}}" {{* href="{{$baseurl}}/regmod/deny/{{$n}}" *}} class="zar2s zard btn btn-default btn-xs" title="{{$deny}}"><i class="fa fa-thumbs-o-down admin-icons"></i></a> + <span id="zarreax_{{$n}}" class="zarreax"></span> + </td> + </tr> + <tr title="{{$u.status.0}}" class="{{$u.status.1}}"> + <td colspan="7"><strong>{{$msg}}:</strong> {{$u.msg}}</td> + </tr> + {{/foreach}} + </tbody> + </table> + <div class="float-right"> + <a id="zar2sat" class="btn btn-sm btn-primary" href="javascript:;">{{$sel_tall}}</a> + <a id="zar2aas" class="zar2xas btn btn-sm btn-success" href="javascript:;"><i class="fa fa-check"></i> {{$sel_aprv}}</a> + <a id="zar2das" class="zar2xas btn btn-sm btn-danger" href="javascript:;"><i class="fa fa-close"></i> {{$sel_deny}}</a> + </div> + {{else}} + <div class="text-muted"> + {{$no_pending}} + </div> + {{/if}} + <div class="float-left"> + <a class="btn btn-sm btn-link" href="{{$get_all_link}}">{{$get_all}}</a> + </div> + <div class="clearfix"></div> + <br><br> <h3>{{$h_users}}</h3> {{if $users}} <table id="users"> |