mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 05:35:12 +00:00
Merge branch 'master' of https://github.com/redmatrix/hubzilla
This commit is contained in:
commit
22729da2a2
7 changed files with 222 additions and 29 deletions
|
@ -1253,6 +1253,24 @@ function advanced_profile(&$a) {
|
|||
|
||||
if($a->profile['name']) {
|
||||
|
||||
$profile_fields_basic = get_profile_fields_basic();
|
||||
$profile_fields_advanced = get_profile_fields_advanced();
|
||||
|
||||
$advanced = ((feature_enabled($a->profile['profile_uid'],'advanced_profiles')) ? true : false);
|
||||
if($advanced)
|
||||
$fields = $profile_fields_advanced;
|
||||
else
|
||||
$fields = $profile_fields_basic;
|
||||
|
||||
$clean_fields = array();
|
||||
if($fields) {
|
||||
foreach($fields as $k => $v) {
|
||||
$clean_fields[] = trim($k);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$tpl = get_markup_template('profile_advanced.tpl');
|
||||
|
||||
$profile = array();
|
||||
|
@ -1370,6 +1388,7 @@ function advanced_profile(&$a) {
|
|||
'$canlike' => (($profile['canlike'])? true : false),
|
||||
'$likethis' => t('Like this thing'),
|
||||
'$profile' => $profile,
|
||||
'$fields' => $clean_fields,
|
||||
'$editmenu' => profile_edit_menu($a->profile['profile_uid']),
|
||||
'$things' => $things
|
||||
));
|
||||
|
|
|
@ -1197,7 +1197,7 @@ function widget_forums($arr) {
|
|||
|
||||
$perms_sql = item_permissions_sql(local_channel()) . item_normal();
|
||||
|
||||
$r1 = q("select * from abook left join xchan on abook_xchan = xchan_hash where ( xchan_pubforum = 1 or ((abook_their_perms & %d ) != 0 and (abook_their_perms & %d ) = 0) ) and abook_channel = %d order by xchan_name $limit ",
|
||||
$r1 = q("select * from abook left join xchan on abook_xchan = xchan_hash where ( xchan_pubforum = 1 or ((abook_their_perms & %d ) != 0 and (abook_their_perms & %d ) = 0) ) and xchan_deleted = 0 and abook_channel = %d order by xchan_name $limit ",
|
||||
intval(PERMS_W_TAGWALL),
|
||||
intval(PERMS_W_STREAM),
|
||||
intval(local_channel())
|
||||
|
|
121
mod/admin.php
121
mod/admin.php
|
@ -1620,26 +1620,47 @@ readable.");
|
|||
|
||||
function admin_page_profs_post(&$a) {
|
||||
|
||||
if($_REQUEST['id']) {
|
||||
$r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d",
|
||||
dbesc($_REQUEST['field_name']),
|
||||
dbesc($_REQUEST['field_type']),
|
||||
dbesc($_REQUEST['field_desc']),
|
||||
dbesc($_REQUEST['field_help']),
|
||||
dbesc($_REQUEST['field_inputs']),
|
||||
intval($_REQUEST['id'])
|
||||
);
|
||||
if(array_key_exists('basic',$_REQUEST)) {
|
||||
$arr = explode(',',$_REQUEST['basic']);
|
||||
for($x = 0; $x < count($arr); $x ++)
|
||||
if(trim($arr[$x]))
|
||||
$arr[$x] = trim($arr[$x]);
|
||||
set_config('system','profile_fields_basic',$arr);
|
||||
|
||||
if(array_key_exists('advanced',$_REQUEST)) {
|
||||
$arr = explode(',',$_REQUEST['advanced']);
|
||||
for($x = 0; $x < count($arr); $x ++)
|
||||
if(trim($arr[$x]))
|
||||
$arr[$x] = trim($arr[$x]);
|
||||
set_config('system','profile_fields_advanced',$arr);
|
||||
}
|
||||
goaway(z_root() . '/admin/profs');
|
||||
}
|
||||
else {
|
||||
$r = q("insert into profdef ( field_name, field_type, field_desc, field_help, field_inputs ) values ( '%s' , '%s', '%s', '%s', '%s' )",
|
||||
dbesc($_REQUEST['field_name']),
|
||||
dbesc($_REQUEST['field_type']),
|
||||
dbesc($_REQUEST['field_desc']),
|
||||
dbesc($_REQUEST['field_help']),
|
||||
dbesc($_REQUEST['field_inputs'])
|
||||
);
|
||||
|
||||
|
||||
if(array_key_exists('field_name',$_REQUEST)) {
|
||||
if($_REQUEST['id']) {
|
||||
$r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d",
|
||||
dbesc($_REQUEST['field_name']),
|
||||
dbesc($_REQUEST['field_type']),
|
||||
dbesc($_REQUEST['field_desc']),
|
||||
dbesc($_REQUEST['field_help']),
|
||||
dbesc($_REQUEST['field_inputs']),
|
||||
intval($_REQUEST['id'])
|
||||
);
|
||||
}
|
||||
else {
|
||||
$r = q("insert into profdef ( field_name, field_type, field_desc, field_help, field_inputs ) values ( '%s' , '%s', '%s', '%s', '%s' )",
|
||||
dbesc($_REQUEST['field_name']),
|
||||
dbesc($_REQUEST['field_type']),
|
||||
dbesc($_REQUEST['field_desc']),
|
||||
dbesc($_REQUEST['field_help']),
|
||||
dbesc($_REQUEST['field_inputs'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// add to chosen array basic or advanced
|
||||
|
||||
goaway(z_root() . '/admin/profs');
|
||||
|
@ -1686,4 +1707,70 @@ function admin_page_profs(&$a) {
|
|||
'$submit' => t('Save')
|
||||
));
|
||||
}
|
||||
|
||||
$basic = '';
|
||||
$barr = array();
|
||||
$fields = get_profile_fields_basic();
|
||||
if(! $fields)
|
||||
$fields = get_profile_fields_basic(1);
|
||||
if($fields) {
|
||||
foreach($fields as $k => $v) {
|
||||
if($basic)
|
||||
$basic .= ', ';
|
||||
$basic .= trim($k);
|
||||
$barr[] = trim($k);
|
||||
}
|
||||
}
|
||||
|
||||
$advanced = '';
|
||||
$fields = get_profile_fields_advanced();
|
||||
if(! $fields)
|
||||
$fields = get_profile_fields_advanced(1);
|
||||
if($fields) {
|
||||
foreach($fields as $k => $v) {
|
||||
if(in_array(trim($k),$barr))
|
||||
continue;
|
||||
if($advanced)
|
||||
$advanced .= ', ';
|
||||
$advanced .= trim($k);
|
||||
}
|
||||
}
|
||||
|
||||
$all = '';
|
||||
$fields = get_profile_fields_advanced(1);
|
||||
if($fields) {
|
||||
foreach($fields as $k => $v) {
|
||||
if($all)
|
||||
$all .= ', ';
|
||||
$all .= trim($k);
|
||||
}
|
||||
}
|
||||
|
||||
$r = q("select * from profdef where true");
|
||||
if($r) {
|
||||
foreach($r as $rr) {
|
||||
if($all)
|
||||
$all .= ', ';
|
||||
$all .= $rr['field_name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$o = replace_macros(get_markup_template('admin_profiles.tpl'),array(
|
||||
'$title' => t('Profile Management'),
|
||||
'$basic' => array('basic',t('Basic Profile Fields'),$basic,''),
|
||||
'$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('In addition to basic fields')),
|
||||
'$all' => $all,
|
||||
'$all_desc' => t('All available fields'),
|
||||
'$cust_field_desc' => t('Custom Fields'),
|
||||
'$cust_fields' => $r,
|
||||
'$edit' => t('Edit'),
|
||||
'$drop' => t('Delete'),
|
||||
'$new' => t('Create'),
|
||||
'$submit' => t('Submit')
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
2016-02-29.1322H
|
||||
2016-03-01.1323H
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<li><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
|
||||
<li><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
|
||||
<li><a href='{{$admin.features.0}}'>{{$admin.features.1}}</a></li>
|
||||
<li><a href='{{$admin.profs.0}}'>{{$admin.profs.1}}</a></li>
|
||||
<li><a href='{{$admin.dbsync.0}}'>{{$admin.dbsync.1}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
31
view/tpl/admin_profiles.tpl
Normal file
31
view/tpl/admin_profiles.tpl
Normal file
|
@ -0,0 +1,31 @@
|
|||
<div class="generic-content-wrapper">
|
||||
<h2>{{$title}}</h2>
|
||||
|
||||
<form action="admin/profs" method="post">
|
||||
|
||||
{{include file="field_textarea.tpl" field=$basic}}
|
||||
{{include file="field_textarea.tpl" field=$advanced}}
|
||||
|
||||
<input type="submit" name="submit" value="{{$submit}}" />
|
||||
|
||||
</form>
|
||||
|
||||
<div>{{$all_desc}}</div>
|
||||
|
||||
<div>{{$all}}</div>
|
||||
|
||||
<br /><br />
|
||||
<div>{{$cust_field_desc}}</div>
|
||||
|
||||
<button href="admin/profs/new">{{$new}}</button>
|
||||
|
||||
{{if $cust_fields}}
|
||||
<table>
|
||||
{{foreach $cust_fields as $field}}
|
||||
<tr><td>{{$field.field_desc}}</td><td>{{$field.field_name}}</td><td><a href="admin/profs/{{$field.id}}" >{{$edit}}</a> <a href="admin/profs/drop/{{$field.id}}">{{$drop}}</a></td></tr>
|
||||
{{/foreach}}
|
||||
</table>
|
||||
{{/if}}
|
||||
|
||||
|
||||
</div>
|
|
@ -31,186 +31,241 @@
|
|||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="section-content-wrapper">
|
||||
<dl id="aprofile-fullname" class="aprofile">
|
||||
<dt>{{$profile.fullname.0}}</dt>
|
||||
<dd>{{$profile.fullname.1}}</dd>
|
||||
</dl>
|
||||
|
||||
{{foreach $fields as $f}}
|
||||
{{if $f == 'name'}}
|
||||
<dl id="aprofile-fullname" class="aprofile">
|
||||
<dt>{{$profile.fullname.0}}</dt>
|
||||
<dd>{{$profile.fullname.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'gender'}}
|
||||
{{if $profile.gender}}
|
||||
<dl id="aprofile-gender" class="aprofile">
|
||||
<dt>{{$profile.gender.0}}</dt>
|
||||
<dd>{{$profile.gender.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'birthday'}}
|
||||
{{if $profile.birthday}}
|
||||
<dl id="aprofile-birthday" class="aprofile">
|
||||
<dt>{{$profile.birthday.0}}</dt>
|
||||
<dd>{{$profile.birthday.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'age'}}
|
||||
{{if $profile.age}}
|
||||
<dl id="aprofile-age" class="aprofile">
|
||||
<dt>{{$profile.age.0}}</dt>
|
||||
<dd>{{$profile.age.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if $f == 'marital'}}
|
||||
{{if $profile.marital}}
|
||||
<dl id="aprofile-marital" class="aprofile">
|
||||
<dt><span class="heart">♥</span> {{$profile.marital.0}}</dt>
|
||||
<dd>{{$profile.marital.1}}{{if $profile.marital.with}} ({{$profile.marital.with}}){{/if}}{{if $profile.howlong}} {{$profile.howlong}}{{/if}}</dd>
|
||||
<dd>{{$profile.marital.1}}{{if in_array('with',$fields)}}{{if $profile.marital.with}} ({{$profile.marital.with}}){{/if}}{{/if}}{{if in_array('howlong',$fields)}}{{if $profile.howlong}} {{$profile.howlong}}{{/if}}{{/if}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'sexual'}}
|
||||
{{if $profile.sexual}}
|
||||
<dl id="aprofile-sexual" class="aprofile">
|
||||
<dt>{{$profile.sexual.0}}</dt>
|
||||
<dd>{{$profile.sexual.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'keywords'}}
|
||||
{{if $profile.keywords}}
|
||||
<dl id="aprofile-tags" class="aprofile">
|
||||
<dt>{{$profile.keywords.0}}</dt>
|
||||
<dd>{{$profile.keywords.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'homepage'}}
|
||||
{{if $profile.homepage}}
|
||||
<dl id="aprofile-homepage" class="aprofile">
|
||||
<dt>{{$profile.homepage.0}}</dt>
|
||||
<dd>{{$profile.homepage.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'hometown'}}
|
||||
{{if $profile.hometown}}
|
||||
<dl id="aprofile-hometown" class="aprofile">
|
||||
<dt>{{$profile.hometown.0}}</dt>
|
||||
<dd>{{$profile.hometown.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if $f == 'politic'}}
|
||||
{{if $profile.politic}}
|
||||
<dl id="aprofile-politic" class="aprofile">
|
||||
<dt>{{$profile.politic.0}}</dt>
|
||||
<dd>{{$profile.politic.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'religion'}}
|
||||
{{if $profile.religion}}
|
||||
<dl id="aprofile-religion" class="aprofile">
|
||||
<dt>{{$profile.religion.0}}</dt>
|
||||
<dd>{{$profile.religion.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'about'}}
|
||||
{{if $profile.about}}
|
||||
<dl id="aprofile-about" class="aprofile">
|
||||
<dt>{{$profile.about.0}}</dt>
|
||||
<dd>{{$profile.about.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'interest'}}
|
||||
{{if $profile.interest}}
|
||||
<dl id="aprofile-interest" class="aprofile">
|
||||
<dt>{{$profile.interest.0}}</dt>
|
||||
<dd>{{$profile.interest.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'likes'}}
|
||||
{{if $profile.likes}}
|
||||
<dl id="aprofile-likes" class="aprofile">
|
||||
<dt>{{$profile.likes.0}}</dt>
|
||||
<dd>{{$profile.likes.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'dislikes'}}
|
||||
{{if $profile.dislikes}}
|
||||
<dl id="aprofile-dislikes" class="aprofile">
|
||||
<dt>{{$profile.dislikes.0}}</dt>
|
||||
<dd>{{$profile.dislikes.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'contact'}}
|
||||
{{if $profile.contact}}
|
||||
<dl id="aprofile-contact" class="aprofile">
|
||||
<dt>{{$profile.contact.0}}</dt>
|
||||
<dd>{{$profile.contact.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'channels'}}
|
||||
{{if $profile.channels}}
|
||||
<dl id="aprofile-channels" class="aprofile">
|
||||
<dt>{{$profile.channels.0}}</dt>
|
||||
<dd>{{$profile.channels.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if $f == 'music'}}
|
||||
{{if $profile.music}}
|
||||
<dl id="aprofile-music" class="aprofile">
|
||||
<dt>{{$profile.music.0}}</dt>
|
||||
<dd>{{$profile.music.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if $f == 'book'}}
|
||||
{{if $profile.book}}
|
||||
<dl id="aprofile-book" class="aprofile">
|
||||
<dt>{{$profile.book.0}}</dt>
|
||||
<dd>{{$profile.book.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if $f == 'tv'}}
|
||||
{{if $profile.tv}}
|
||||
<dl id="aprofile-tv" class="aprofile">
|
||||
<dt>{{$profile.tv.0}}</dt>
|
||||
<dd>{{$profile.tv.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if $f == 'film'}}
|
||||
{{if $profile.film}}
|
||||
<dl id="aprofile-film" class="aprofile">
|
||||
<dt>{{$profile.film.0}}</dt>
|
||||
<dd>{{$profile.film.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if $f == 'romance'}}
|
||||
{{if $profile.romance}}
|
||||
<dl id="aprofile-romance" class="aprofile">
|
||||
<dt>{{$profile.romance.0}}</dt>
|
||||
<dd>{{$profile.romance.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if $f == 'work'}}
|
||||
{{if $profile.work}}
|
||||
<dl id="aprofile-work" class="aprofile">
|
||||
<dt>{{$profile.work.0}}</dt>
|
||||
<dd>{{$profile.work.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $f == 'education'}}
|
||||
{{if $profile.education}}
|
||||
<dl id="aprofile-education" class="aprofile">
|
||||
<dt>{{$profile.education.0}}</dt>
|
||||
<dd>{{$profile.education.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{foreach $profile.extra_fields as $f}}
|
||||
{{if $profile.$f}}
|
||||
<dl id="aprofile-{{$f}}" class="aprofile">
|
||||
<dt>{{$profile.$f.0}}</dt>
|
||||
<dd>{{$profile.$f.1}}</dd>
|
||||
{{foreach $profile.extra_fields as $fld}}
|
||||
{{if $f == $fld}}
|
||||
{{if $profile.$fld}}
|
||||
<dl id="aprofile-{{$fld}}" class="aprofile">
|
||||
<dt>{{$profile.$fld.0}}</dt>
|
||||
<dd>{{$profile.$fld.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
|
||||
{{if $things}}
|
||||
|
|
Loading…
Reference in a new issue