diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-09-08 09:52:35 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-09-08 09:52:35 +0200 |
commit | 35f1055739f133cdeda290aa3a45992f97bb32fa (patch) | |
tree | 188798d75af9eedaa7884cb4522ada748eb3f4a7 | |
parent | 98d5ae91f5a716d415fa3dd639e9819ae7003202 (diff) | |
parent | 83b89b9576655c11a9beaaf2261b3a9013a52da5 (diff) | |
download | volse-hubzilla-35f1055739f133cdeda290aa3a45992f97bb32fa.tar.gz volse-hubzilla-35f1055739f133cdeda290aa3a45992f97bb32fa.tar.bz2 volse-hubzilla-35f1055739f133cdeda290aa3a45992f97bb32fa.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
-rw-r--r-- | Zotlabs/Module/Admin/Site.php | 27 | ||||
-rw-r--r-- | Zotlabs/Module/Dirsearch.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Photos.php | 64 | ||||
-rw-r--r-- | Zotlabs/Module/Pubsites.php | 6 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Account.php | 5 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/attach.php | 48 | ||||
-rw-r--r-- | include/zot.php | 16 | ||||
-rw-r--r-- | install/schema_mysql.sql | 1 | ||||
-rw-r--r-- | install/schema_postgres.sql | 1 | ||||
-rw-r--r-- | install/update.php | 10 | ||||
-rwxr-xr-x | view/tpl/admin_site.tpl | 6 | ||||
-rwxr-xr-x | view/tpl/photo_view.tpl | 3 |
13 files changed, 146 insertions, 47 deletions
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 791c58589..8397cabbd 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -59,6 +59,12 @@ class Site { $maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50); $feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0); $verify_email = ((x($_POST,'verify_email')) ? 1 : 0); + $techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0); + + $techlevel = null; + if(array_key_exists('techlevel',$_POST)) + $techlevel = intval($_POST['techlevel']); + set_config('system', 'server_role', $server_role); @@ -74,6 +80,10 @@ class Site { set_config('system', 'enable_context_help', $enable_context_help); set_config('system', 'verify_email', $verify_email); set_config('system', 'default_expire_days', $default_expire_days); + set_config('system', 'techlevel_lock', $techlevel_lock); + + if(! is_null($techlevel)) + set_config('system', 'techlevel', $techlevel); if($directory_server) set_config('system','directory_server',$directory_server); @@ -234,6 +244,18 @@ class Site { 'pro' => t('Professional') ]; + + $techlevels = [ + '0' => t('Beginner/Basic'), + '1' => t('Novice - not skilled but willing to learn'), + '2' => t('Intermediate - somewhat comfortable'), + '3' => t('Advanced - very comfortable'), + '4' => t('Expert - I can write computer code'), + '5' => t('Wizard - I probably know more than you do') + ]; + + + $homelogin = get_config('system','login_on_homepage'); $enable_context_help = get_config('system','enable_context_help'); @@ -254,6 +276,11 @@ class Site { '$server_role' => array('server_role', t("Server Configuration/Role"), get_config('system','server_role'),'',$server_roles), + '$techlevel' => [ 'techlevel', t('Site default technical skill level'), get_config('system','techlevel'), t('Used to provide a member experience matched to technical comfort level'), $techlevels ], + + '$techlock' => [ 'techlock', t('Lock the technical skill level setting'), get_config('system','techlevel_lock'), t('Members can set their own technical comfort level by default') ], + + '$banner' => array('banner', t("Banner/Logo"), $banner, ""), '$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php index 8f60910f1..ebd6c3715 100644 --- a/Zotlabs/Module/Dirsearch.php +++ b/Zotlabs/Module/Dirsearch.php @@ -448,9 +448,9 @@ class Dirsearch extends \Zotlabs\Web\Controller { $register = 'closed'; if(strpos($rr['site_url'],'https://') !== false) - $ret['sites'][] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project']); + $ret['sites'][] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project'], 'version' => $rr['site_version']); else - $insecure[] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project']); + $insecure[] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project'], 'version' => $rr['site_version']); } if($insecure) { $ret['sites'] = array_merge($ret['sites'],$insecure); diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 6aeac7af7..040a90aaa 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -50,7 +50,7 @@ class Photos extends \Zotlabs\Web\Controller { - function post() { + function post() { logger('mod-photos: photos_post: begin' , LOGGER_DEBUG); @@ -106,24 +106,6 @@ class Photos extends \Zotlabs\Web\Controller { /* - * RENAME photo album - */ - - $newalbum = notags(trim($_REQUEST['albumname'])); - if($newalbum != $album) { - - // @fixme - syncronise with DAV or disallow completely - - goaway(z_root() . '/' . $_SESSION['photo_return']); - - // $x = photos_album_rename($page_owner_uid,$album,$newalbum); - // if($x) { - // $newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']); - // goaway(z_root() . '/' . $newurl); - // } - } - - /* * DELETE photo album and all its photos */ @@ -229,15 +211,25 @@ class Photos extends \Zotlabs\Web\Controller { goaway(z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']); } - - - if((\App::$argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { - + + if((argc() > 2) && array_key_exists('move_to_album',$_POST)) { + $m = q("select folder from attach where hash = '%s' and uid = %d limit 1", + dbesc(argv(2)), + intval($page_owner_uid) + ); + if(($m) && ($m[0]['folder'] != $_POST['move_to_album'])) { + attach_move($page_owner_uid,argv(2),$_POST['move_to_album']); + if(! ($_POST['desc'] && $_POST['newtag'])) + goaway(z_root() . '/' . $_SESSION['photo_return']); + } + } + + if((argc() > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false))) { $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : ''); $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : ''); $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0); - $albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : ''); + $is_nsfw = ((x($_POST,'adult')) ? intval($_POST['adult']) : 0); $acl->set_from_array($_POST); @@ -245,10 +237,6 @@ class Photos extends \Zotlabs\Web\Controller { $resource_id = argv(2); - if(! strlen($albname)) - $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); - - if((x($_POST,'rotate') !== false) && ( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) { logger('rotate'); @@ -464,14 +452,15 @@ class Photos extends \Zotlabs\Web\Controller { } } - - goaway(z_root() . '/' . $_SESSION['photo_return']); - return; // NOTREACHED - + $sync = attach_export_data(\App::$data['channel'],$resource_id); if($sync) build_sync_packet($page_owner_uid,array('file' => array($sync))); + + goaway(z_root() . '/' . $_SESSION['photo_return']); + return; // NOTREACHED + } @@ -1023,12 +1012,22 @@ class Photos extends \Zotlabs\Web\Controller { $edit = null; if($can_post) { + + $m = q("select folder from attach where hash = '%s' and uid = %d limit 1", + dbesc($ph[0]['resource_id']), + intval($ph[0]['uid']) + ); + if($m) + $album_hash = $m[0]['folder']; + $album_e = $ph[0]['album']; $caption_e = $ph[0]['description']; $aclselect_e = (($_is_owner) ? populate_acl($ph[0], true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_storage')) : ''); $albums = ((array_key_exists('albums', \App::$data)) ? \App::$data['albums'] : photos_albums_list(\App::$data['channel'],\App::$data['observer'])); $_SESSION['album_return'] = bin2hex($ph[0]['album']); + + $folder_list = attach_folder_select_list($ph[0]['uid']); $edit = array( 'edit' => t('Edit photo'), @@ -1037,6 +1036,7 @@ class Photos extends \Zotlabs\Web\Controller { 'rotateccw' => t('Rotate CCW (left)'), 'albums' => $albums['albums'], 'album' => $album_e, + 'album_select' => [ 'move_to_album', t('Move photo to album'), $album_hash, '', $folder_list ], 'newalbum_label' => t('Enter a new album name'), 'newalbum_placeholder' => t('or select an existing one (doubleclick)'), 'nickname' => \App::$data['channel']['channel_address'], diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php index 35a305130..a66fd9c7a 100644 --- a/Zotlabs/Module/Pubsites.php +++ b/Zotlabs/Module/Pubsites.php @@ -36,9 +36,9 @@ class Pubsites extends \Zotlabs\Web\Controller { $o .= '</tr>'; if($j['sites']) { foreach($j['sites'] as $jj) { - $m = parse_url($jj['url']); - if(strpos($jj['project'],\Zotlabs\Lib\System::get_platform_name()) === false) + if(! $jj['project']) continue; + $m = parse_url($jj['url']); $host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3)); $rate_links = ((local_channel()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="fa fa-check-square-o"></i> ' . t('Rate') . '</a></td>' : ''); $location = ''; @@ -49,7 +49,7 @@ class Pubsites extends \Zotlabs\Web\Controller { $location = '<br /> '; } $urltext = str_replace(array('https://'), '', $jj['url']); - $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . '</td>'; + $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . (($jj['version']) ? ' ' . $jj['version'] : '') . '</td>'; if($rating_enabled) $o .= '<td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links ; $o .= '</tr>'; diff --git a/Zotlabs/Module/Settings/Account.php b/Zotlabs/Module/Settings/Account.php index 3cc9bd135..50bbc7be4 100644 --- a/Zotlabs/Module/Settings/Account.php +++ b/Zotlabs/Module/Settings/Account.php @@ -110,9 +110,8 @@ class Account { '5' => t('Wizard - I probably know more than you do') ]; - $def_techlevel = get_config('system','techlevel'); - if($def_techlevel === false) - $def_techlevel = \App::$account['account_level']; + + $def_techlevel = \App::$account['account_level']; $techlock = get_config('system','techlevel_lock'); $tpl = get_markup_template("settings_account.tpl"); @@ -47,7 +47,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '1.13.1' ); define ( 'ZOT_REVISION', '1.1' ); -define ( 'DB_UPDATE_VERSION', 1182 ); +define ( 'DB_UPDATE_VERSION', 1183 ); /** diff --git a/include/attach.php b/include/attach.php index 137d2b11c..237b06217 100644 --- a/include/attach.php +++ b/include/attach.php @@ -2165,3 +2165,51 @@ function attach_move($channel_id,$resource_id,$new_folder_hash) { } +function attach_folder_select_list($channel_id) { + + $r = q("select * from attach where is_dir = 1 and uid = %d", + intval($channel_id) + ); + + $out = []; + $out[''] = '/'; + + if($r) { + foreach($r as $rv) { + $x = attach_folder_rpaths($r,$rv); + if($x) + $out[$x[0]] = $x[1]; + } + } + return $out; +} + +function attach_folder_rpaths($all_folders,$that_folder) { + + $path = '/' . $that_folder['filename']; + $current_hash = $that_folder['hash']; + $parent_hash = $that_folder['folder']; + $error = false; + $found = false; + + if($parent_hash) { + do { + foreach($all_folders as $selected) { + if(! $selected['is_dir']) + continue; + if($selected['hash'] == $parent_hash) { + $path = '/' . $selected['filename'] . $path; + $current_hash = $selected['hash']; + $parent_hash = $selected['folder']; + $found = true; + break; + } + } + if(! $found) + $error = true; + } + while((! $found) && (! $error) && ($parent_hash != '')); + } + return (($error) ? false : [ $current_hash , $path ]); + +}
\ No newline at end of file diff --git a/include/zot.php b/include/zot.php index 6187e8a61..7093a255b 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2844,6 +2844,7 @@ function import_site($arr, $pubkey) { $site_location = htmlspecialchars($arr['location'],ENT_COMPAT,'UTF-8',false); $site_realm = htmlspecialchars($arr['realm'],ENT_COMPAT,'UTF-8',false); $site_project = htmlspecialchars($arr['project'],ENT_COMPAT,'UTF-8',false); + $site_version = ((array_key_exists('version',$arr)) ? htmlspecialchars($arr['version'],ENT_COMPAT,'UTF-8',false) : ''); // You can have one and only one primary directory per realm. // Downgrade any others claiming to be primary. As they have @@ -2863,14 +2864,16 @@ function import_site($arr, $pubkey) { || ($siterecord['site_location'] != $site_location) || ($siterecord['site_register'] != $register_policy) || ($siterecord['site_project'] != $site_project) - || ($siterecord['site_realm'] != $site_realm)) { + || ($siterecord['site_realm'] != $site_realm) + || ($siterecord['site_version'] != $site_version) ) { + $update = true; // logger('import_site: input: ' . print_r($arr,true)); // logger('import_site: stored: ' . print_r($siterecord,true)); - $r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s' + $r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s', site_version = '%s' where site_url = '%s'", dbesc($site_location), intval($site_directory), @@ -2882,6 +2885,7 @@ function import_site($arr, $pubkey) { dbesc($site_realm), intval(SITE_TYPE_ZOT), dbesc($site_project), + dbesc($site_version), dbesc($url) ); if(! $r) { @@ -2899,8 +2903,8 @@ function import_site($arr, $pubkey) { else { $update = true; - $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage, site_realm, site_type, site_project ) - values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s', '%s', %d, '%s' )", + $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage, site_realm, site_type, site_project, site_version ) + values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s', '%s', %d, '%s', '%s' )", dbesc($site_location), dbesc($url), intval($access_policy), @@ -2911,7 +2915,8 @@ function import_site($arr, $pubkey) { dbesc($sellpage), dbesc($site_realm), intval(SITE_TYPE_ZOT), - dbesc($site_project) + dbesc($site_project), + dbesc($site_version) ); if(! $r) { logger('import_site: record create failed. ' . print_r($arr,true)); @@ -3978,6 +3983,7 @@ function zotinfo($arr) { $ret['site']['location'] = get_config('system','site_location'); $ret['site']['realm'] = get_directory_realm(); $ret['site']['project'] = Zotlabs\Lib\System::get_platform_name() . ' ' . Zotlabs\Lib\System::get_server_role(); + $ret['site']['version'] = Zotlabs\Lib\System::get_project_version(); } diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 5e5b9d5be..9a4f58880 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -1151,6 +1151,7 @@ CREATE TABLE IF NOT EXISTS `site` ( `site_dead` smallint NOT NULL DEFAULT '0', `site_type` smallint NOT NULL DEFAULT '0', `site_project` char(255) NOT NULL DEFAULT '', + `site_version` varchar(32) NOT NULL DEFAULT '', PRIMARY KEY (`site_url`), KEY `site_flags` (`site_flags`), KEY `site_update` (`site_update`), diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 44711c190..b190a810a 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -1131,6 +1131,7 @@ CREATE TABLE "site" ( "site_dead" smallint NOT NULL DEFAULT '0', "site_type" smallint NOT NULL DEFAULT '0', "site_project" text NOT NULL DEFAULT '', + "site_version" text NOT NULL DEFAULT '', PRIMARY KEY ("site_url") ); create index "site_flags" on site ("site_flags"); diff --git a/install/update.php b/install/update.php index 2b3a9b338..9fd362fff 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1182 ); +define( 'UPDATE_VERSION' , 1183 ); /** * @@ -2436,3 +2436,11 @@ function update_r1181() { return UPDATE_SUCCESS; } +function update_r1182() { + + $r1 = q("alter table site add site_version varchar(32) not null default '' "); + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl index 56e6087d6..a5b32f08f 100755 --- a/view/tpl/admin_site.tpl +++ b/view/tpl/admin_site.tpl @@ -42,6 +42,12 @@ {{include file="field_input.tpl" field=$sitename}} {{include file="field_select.tpl" field=$server_role}} + + {{if $z_server_role == 'pro'}} + {{include file="field_select.tpl" field=$techlevel}} + {{include file="field_checkbox.tpl" field=$techlock}} + {{/if}} + {{include file="field_textarea.tpl" field=$banner}} {{include file="field_textarea.tpl" field=$admininfo}} {{include file="field_select.tpl" field=$language}} diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index ec827d990..db5ffe3f5 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -79,6 +79,9 @@ <input name="newtag" id="photo-edit-newtag" class="form-control" title="{{$edit.help_tags}}" type="text" /> </div> <div class="form-group"> + {{include file="field_select.tpl" field=$edit.album_select}} + </div> + <div class="form-group"> <label class="radio-inline" id="photo-edit-rotate-cw-label" for="photo-edit-rotate-cw"><input id="photo-edit-rotate-cw" type="radio" name="rotate" value="1" />{{$edit.rotatecw}}</label> <label class="radio-inline" id="photo-edit-rotate-ccw-label" for="photo-edit-rotate-ccw"><input id="photo-edit-rotate-ccw" type="radio" name="rotate" value="2" />{{$edit.rotateccw}}</label> </div> |