mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 15:55:13 +00:00
cleanup
This commit is contained in:
parent
0902f21ca9
commit
1a6bc9d435
4 changed files with 42 additions and 47 deletions
|
@ -19,30 +19,30 @@ class DB_Upgrade
|
|||
$this->func_prefix = '_';
|
||||
|
||||
$build = get_config('system', 'db_version', 0);
|
||||
if (!intval($build)) {
|
||||
if (!(int)$build)) {
|
||||
$build = set_config('system', 'db_version', $db_revision);
|
||||
}
|
||||
|
||||
if ($build == $db_revision) {
|
||||
if ((int)$build === (int)$db_revision) {
|
||||
// Nothing to be done.
|
||||
return;
|
||||
} else {
|
||||
$stored = intval($build);
|
||||
if (!$stored) {
|
||||
$storedVersion = (int)$build;
|
||||
if (!$storedVersion) {
|
||||
logger('Critical: check_config unable to determine database schema version');
|
||||
return;
|
||||
}
|
||||
|
||||
$current = intval($db_revision);
|
||||
$newVersion = (int)$db_revision;
|
||||
|
||||
if ($stored < $current) {
|
||||
if ($storedVersion < $newVersion) {
|
||||
// The last update we performed was $stored.
|
||||
// Start at $stored + 1 and continue until we have completed $current
|
||||
|
||||
for ($x = $stored + 1; $x <= $current; $x++) {
|
||||
$s = '_' . $x;
|
||||
$cls = '\\Code\Update\\' . $s;
|
||||
if (!class_exists($cls)) {
|
||||
for ($currentUpdate = $storedVersion + 1; $currentUpdate <= $newVersion; $currentUpdate++) {
|
||||
$configString = '_' . $currentUpdate;
|
||||
$updateClass = '\\Code\Update\\' . $configString;
|
||||
if (!class_exists($updateClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -56,18 +56,18 @@ class DB_Upgrade
|
|||
|
||||
Config::Load('database');
|
||||
|
||||
if (get_config('database', $s)) {
|
||||
if (get_config('database', $configString)) {
|
||||
break;
|
||||
}
|
||||
set_config('database', $s, '1');
|
||||
set_config('database', $configString, '1');
|
||||
|
||||
|
||||
$c = new $cls();
|
||||
$update = new $updateClass();
|
||||
|
||||
$retval = $c->run();
|
||||
$retval = $update->run();
|
||||
|
||||
if ($retval != UPDATE_SUCCESS) {
|
||||
$source = t('Source code of failed update: ') . "\n\n" . @file_get_contents('Code/Update/' . $s . '.php');
|
||||
$source = t('Source code of failed update: ') . "\n\n" . @file_get_contents('Code/Update/' . $configString . '.php');
|
||||
|
||||
|
||||
// Prevent sending hundreds of thousands of emails by creating
|
||||
|
@ -80,7 +80,7 @@ class DB_Upgrade
|
|||
}
|
||||
@unlink($lockfile);
|
||||
//send the administrator an e-mail
|
||||
file_put_contents($lockfile, $x);
|
||||
file_put_contents($lockfile, $currentUpdate);
|
||||
|
||||
$r = q(
|
||||
"select account_language from account where account_email = '%s' limit 1",
|
||||
|
@ -96,8 +96,8 @@ class DB_Upgrade
|
|||
[
|
||||
'$sitename' => App::$config['system']['sitename'],
|
||||
'$siteurl' => z_root(),
|
||||
'$update' => $x,
|
||||
'$error' => sprintf(t('Update %s failed. See error logs.'), $x),
|
||||
'$update' => $currentUpdate,
|
||||
'$error' => sprintf(t('Update %s failed. See error logs.'), $currentUpdate),
|
||||
'$baseurl' => z_root(),
|
||||
'$source' => $source
|
||||
]
|
||||
|
@ -106,10 +106,10 @@ class DB_Upgrade
|
|||
);
|
||||
|
||||
//try the logger
|
||||
logger('CRITICAL: Update Failed: ' . $x);
|
||||
logger('CRITICAL: Update Failed: ' . $currentUpdate);
|
||||
pop_lang();
|
||||
} else {
|
||||
set_config('database', $s, 'success');
|
||||
set_config('database', $configString, 'success');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,7 +580,7 @@ class Photos extends Controller
|
|||
|
||||
if (!x(App::$data, 'channel')) {
|
||||
notice(t('No photos selected') . EOL);
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
$ph = photo_factory('');
|
||||
|
@ -633,7 +633,7 @@ class Photos extends Controller
|
|||
|
||||
if (!$can_view) {
|
||||
notice(t('Access to this item is restricted.') . EOL);
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
$sql_item = item_permissions_sql($owner_uid, get_observer_hash());
|
||||
|
@ -642,12 +642,12 @@ class Photos extends Controller
|
|||
|
||||
Navbar::set_selected('Photos');
|
||||
|
||||
$o = '<script src="vendor/blueimp/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
|
||||
$output = '<script src="vendor/blueimp/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
|
||||
<script src="vendor/blueimp/jquery-file-upload/js/jquery.iframe-transport.js"></script>
|
||||
<script src="vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js"></script>';
|
||||
|
||||
|
||||
$o .= "<script> var profile_uid = " . App::$profile['profile_uid']
|
||||
$output .= "<script> var profile_uid = " . App::$profile['profile_uid']
|
||||
. "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
|
||||
|
||||
$_is_owner = (local_channel() && (local_channel() == $owner_uid));
|
||||
|
@ -858,19 +858,19 @@ class Photos extends Controller
|
|||
|
||||
if ($_REQUEST['aj']) {
|
||||
if ($photos) {
|
||||
$o = replace_macros(Theme::get_template('photosajax.tpl'), array(
|
||||
$output = replace_macros(Theme::get_template('photosajax.tpl'), array(
|
||||
'$photos' => $photos,
|
||||
'$album_id' => $datum
|
||||
));
|
||||
} else {
|
||||
$o = '<div id="content-complete"></div>';
|
||||
$output = '<div id="content-complete"></div>';
|
||||
}
|
||||
echo $o;
|
||||
echo $output;
|
||||
killme();
|
||||
} else {
|
||||
$o .= "<script> var page_query = '" . escape_tags(urlencode($_GET['req'])) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
|
||||
$output .= "<script> var page_query = '" . escape_tags(urlencode($_GET['req'])) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
|
||||
$tpl = Theme::get_template('photo_album.tpl');
|
||||
$o .= replace_macros($tpl, array(
|
||||
$output .= replace_macros($tpl, array(
|
||||
'$photos' => $photos,
|
||||
'$album' => $album,
|
||||
'$album_id' => $datum,
|
||||
|
@ -885,7 +885,7 @@ class Photos extends Controller
|
|||
'$usage' => $usage_message
|
||||
));
|
||||
|
||||
return $o;
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -929,7 +929,7 @@ class Photos extends Controller
|
|||
} else {
|
||||
notice(t('Photo not available') . EOL);
|
||||
}
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
@ -1307,7 +1307,7 @@ class Photos extends Controller
|
|||
|
||||
$responses = get_responses($conv_responses, $response_verbs, '', $link_item);
|
||||
|
||||
$o .= replace_macros(Theme::get_template('photo_view.tpl'), [
|
||||
$output .= replace_macros(Theme::get_template('photo_view.tpl'), [
|
||||
'$id' => $ph[0]['id'],
|
||||
'$album' => $album_e,
|
||||
'$tools_label' => t('Photo Tools'),
|
||||
|
@ -1343,8 +1343,8 @@ class Photos extends Controller
|
|||
'$paginate' => $paginate,
|
||||
]);
|
||||
|
||||
App::$data['photo_html'] = $o;
|
||||
return $o;
|
||||
App::$data['photo_html'] = $output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Default - show recent photos
|
||||
|
@ -1402,19 +1402,19 @@ class Photos extends Controller
|
|||
|
||||
if ($_REQUEST['aj']) {
|
||||
if ($photos) {
|
||||
$o = replace_macros(Theme::get_template('photosajax.tpl'), [
|
||||
$output = replace_macros(Theme::get_template('photosajax.tpl'), [
|
||||
'$photos' => $photos,
|
||||
'$album_id' => bin2hex(t('Recent Photos'))
|
||||
]);
|
||||
} else {
|
||||
$o = '<div id="content-complete"></div>';
|
||||
$output = '<div id="content-complete"></div>';
|
||||
}
|
||||
echo $o;
|
||||
echo $output;
|
||||
killme();
|
||||
} else {
|
||||
$o .= "<script>var page_query = '" . escape_tags($_GET['req']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
|
||||
$output .= "<script>var page_query = '" . escape_tags($_GET['req']) . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
|
||||
|
||||
$o .= replace_macros(Theme::get_template('photos_recent.tpl'), [
|
||||
$output .= replace_macros(Theme::get_template('photos_recent.tpl'), [
|
||||
'$title' => t('Recent Photos'),
|
||||
'$album_id' => bin2hex(t('Recent Photos')),
|
||||
'$file_view' => t('View files'),
|
||||
|
@ -1426,7 +1426,7 @@ class Photos extends Controller
|
|||
'$usage' => $usage_message
|
||||
]);
|
||||
|
||||
return $o;
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class Receiver
|
|||
} else {
|
||||
$this->rawdata = file_get_contents('php://input');
|
||||
|
||||
// All access to the zot endpoint must use http signatures
|
||||
// All access to the nomad endpoint must use http signatures
|
||||
|
||||
if (!$this->Valid_Httpsig()) {
|
||||
logger('signature failed');
|
||||
|
@ -75,8 +75,6 @@ class Receiver
|
|||
|
||||
logger('received_json: ' . json_encode($this->data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), LOGGER_DATA);
|
||||
|
||||
logger('received: ' . print_r($this->data, true), LOGGER_DATA);
|
||||
|
||||
if ($this->data && is_array($this->data)) {
|
||||
$this->encrypted = array_key_exists('encrypted', $this->data) && intval($this->data['encrypted']);
|
||||
|
||||
|
|
5
boot.php
5
boot.php
|
@ -89,8 +89,6 @@ function sys_boot() {
|
|||
* Try to open the database;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (! App::$install) {
|
||||
DBA::dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, App::$install);
|
||||
if (! DBA::$dba->connected) {
|
||||
|
@ -795,8 +793,7 @@ function clean_urls() {
|
|||
function z_path() {
|
||||
$base = z_root();
|
||||
if(! clean_urls())
|
||||
$base .= '/?q=';
|
||||
|
||||
$base .= '/?req=';
|
||||
return $base;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue