diff --git a/Code/Daemon/Cron_daily.php b/Code/Daemon/Cron_daily.php
index d3ca3e4ff..b5a9c7684 100644
--- a/Code/Daemon/Cron_daily.php
+++ b/Code/Daemon/Cron_daily.php
@@ -95,8 +95,8 @@ class Cron_daily
Run::Summon([ 'Expire' ]);
remove_obsolete_hublocs();
-
- Hook::call('cron_daily', datetime_convert());
+ $data = datetime_convert();
+ Hook::call('cron_daily', $data);
set_config('system', 'last_expire_day', intval(datetime_convert('UTC', 'UTC', 'now', 'd')));
diff --git a/Code/Lib/ThreadItem.php b/Code/Lib/ThreadItem.php
index 5cf73bdcb..e78a1dfb9 100644
--- a/Code/Lib/ThreadItem.php
+++ b/Code/Lib/ThreadItem.php
@@ -5,10 +5,10 @@
namespace Code\Lib;
use App;
-use Code\Lib\Features;
use Code\Extend\Hook;
use Code\Render\Theme;
+
/**
* A thread item
*/
@@ -99,14 +99,10 @@ class ThreadItem
$item = $this->get_data();
- $commentww = '';
$sparkle = '';
- $buttons = '';
$dropping = false;
$star = false;
- $isstarred = "unstarred fa-star-o";
$is_comment = false;
- $is_item = false;
$osparkle = '';
$total_children = $this->count_descendants();
$unseen_comments = ((isset($item['real_uid']) && $item['real_uid']) ? 0 : $this->count_unseen_descendants());
@@ -525,9 +521,7 @@ class ThreadItem
// place to store all the author addresses (links if not available) in the thread so we can auto-mention them in JS.
$result['authors'] = [];
// fix to add in sub-replies if replying to a comment on your own post from the top level.
- if ($observer && ($profile_addr === $observer['xchan_hash'] || $profile_addr === $observer['xchan_addr'])) {
- // ignore it
- } else {
+ if (!($observer && ($profile_addr === $observer['xchan_hash'] || $profile_addr === $observer['xchan_addr']))) {
$result['authors'][] = $profile_addr;
}
@@ -787,7 +781,6 @@ class ThreadItem
public function get_data_value($name)
{
if (!isset($this->data[$name])) {
-// logger('[ERROR] Item::get_data_value : Item has no value name "'. $name .'".', LOGGER_DEBUG);
return false;
}
@@ -921,7 +914,7 @@ class ThreadItem
// logger('Commentable conv: ' . $conv->is_commentable());
if (! $this->is_commentable()) {
- return;
+ return false;
}
$template = Theme::get_template($this->get_comment_box_template());
@@ -1037,17 +1030,17 @@ class ThreadItem
foreach ($items as $child) {
if ($child['author']['abook_id'] && (! intval($child['author']['abook_self']))) {
return [
- 'url' => chanlink_hash($child['author']['xchan_hash']),
+ 'url' => chanlink_hash($child['author']['xchan_hash']),
'photo' => $child['author']['xchan_photo_m'],
- 'name' => $child['author']['xchan_name'],
- 'addr' => $child['author']['xchan_addr'],
+ 'name' => $child['author']['xchan_name'],
+ 'addr' => $child['author']['xchan_addr'],
'censored' => (($child['author']['xchan_censored'] || $child['author']['abook_censor']) ? true : false)
];
- if ($child['children']) {
- $ret = $this->find_a_friend($child['children']);
- if ($ret) {
- break;
- }
+ }
+ if ($child['children']) {
+ $ret = $this->find_a_friend($child['children']);
+ if ($ret) {
+ break;
}
}
}
diff --git a/Code/Lib/Url.php b/Code/Lib/Url.php
index 973ad4086..1e7c599f0 100644
--- a/Code/Lib/Url.php
+++ b/Code/Lib/Url.php
@@ -96,7 +96,7 @@ class Url {
$instance_headers = ((array_key_exists('headers', $opts) && is_array($opts['headers'])) ? $opts['headers'] : []);
if (x($opts, 'session')) {
- if (strpos($url, z_root()) === 0) {
+ if (str_starts_with($url, z_root())) {
$instance_headers[] = 'Cookie: PHPSESSID=' . session_id();
}
}
@@ -161,7 +161,7 @@ class Url {
}
}
- // don't let curl abort the entire application'
+ // don't let curl abort the entire application
// if it throws any errors.
$s = curl_exec($ch);
@@ -198,7 +198,7 @@ class Url {
$matches = [];
preg_match('/(Location:|URI:)(.*?)\n/i', $header, $matches);
$newurl = trim(array_pop($matches));
- if (strpos($newurl, '/') === 0) {
+ if (str_starts_with($newurl, '/')) {
// We received a redirect to a relative path.
// Find the base component of the original url and re-assemble it with the new location
$base = @parse_url($url);
@@ -303,7 +303,7 @@ class Url {
$instance_headers = ((array_key_exists('headers', $opts) && is_array($opts['headers'])) ? $opts['headers'] : []);
if (x($opts, 'session')) {
- if (strpos($url, z_root()) === 0) {
+ if (str_starts_with($url, z_root())) {
$instance_headers[] = 'Cookie: PHPSESSID=' . session_id();
}
}
@@ -407,7 +407,7 @@ class Url {
$matches = [];
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
$newurl = trim(array_pop($matches));
- if (strpos($newurl, '/') === 0) {
+ if (str_starts_with($newurl, '/')) {
// We received a redirect to a relative path.
// Find the base component of the original url and re-assemble it with the new location
$base = @parse_url($url);
diff --git a/Code/Module/Editpost.php b/Code/Module/Editpost.php
index e031a1ece..f9d07680d 100644
--- a/Code/Module/Editpost.php
+++ b/Code/Module/Editpost.php
@@ -70,8 +70,8 @@ class Editpost extends Controller
$catsenabled = ((Apps::system_app_installed($owner_uid, 'Categories')) ? 'categories' : '');
// we have a single item, but fetch_post_tags expects an array. Convert it before and after.
-
- $item = array_shift(fetch_post_tags([$item]));
+ $arr = fetch_post_tags([$item]);
+ $item = array_shift($arr);
if ($catsenabled) {
$cats = get_terms_oftype($item['term'], TERM_CATEGORY);
diff --git a/Code/Module/Embedphotos.php b/Code/Module/Embedphotos.php
index 97718164f..a5f8d4269 100644
--- a/Code/Module/Embedphotos.php
+++ b/Code/Module/Embedphotos.php
@@ -52,7 +52,8 @@ class Embedphotos extends Controller
if (!$href) {
json_return_and_die(array('errormsg' => 'Error retrieving link ' . $href, 'status' => false));
}
- $resource_id = array_pop(explode("/", $href));
+ $tmp = explode('/', $href);
+ $resource_id = array_pop($tmp);
$x = self::photolink($resource_id, $channel_id);
if ($x) {
diff --git a/include/attach.php b/include/attach.php
index 9c89a201e..a681425d1 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -116,7 +116,6 @@ function z_mime_content_type($filename)
'odf' => 'application/vnd.oasis.opendocument.formula',
'odi' => 'application/vnd.oasis.opendocument.image',
'odm' => 'application/vnd.oasis.opendocument.text-master',
- 'odb' => 'application/vnd.oasis.opendocument.base',
'odb' => 'application/vnd.oasis.opendocument.database',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
@@ -2349,19 +2348,11 @@ function get_dirpath_by_cloudpath($channel, $path)
$h['path'] = substr($h['path'], 1);
}
$folders = explode('/', $h['path']);
- $f = array_shift($folders);
-
$nick = $channel['channel_address'];
- //check to see if the absolute path was provided (/cloud/channelname/path/to/folder)
- if ($f === 'cloud') {
- $g = array_shift($folders);
- if ($g !== $nick) {
- // if nick does not follow "cloud", then the top level folder must be called "cloud"
- // and the given path must be relative to "/cloud/channelname/".
- $folders = array_unshift(array_unshift($folders, $g), $f);
- }
- } else {
- array_unshift($folders, $f);
+
+ if (count($folders) > 1 && $folders[0] === 'cloud' && $folders[1] === $nick) {
+ array_shift($folders);
+ array_shift($folders);
}
$clouddir = 'store/' . $nick . '/' ;
$subdir = '/';
diff --git a/install/migrate-mypg.php b/install/migrate-mypg.php
deleted file mode 100644
index e619c8285..000000000
--- a/install/migrate-mypg.php
+++ /dev/null
@@ -1,394 +0,0 @@
-exec($stmt);
- if ($r === false) {
- echo "\nError executing $stmt: " . var_export($db->errorInfo(), true) . "\n";
- $err++;
- } else {
- $n++;
- }
- if ($n % 5 == 0) {
- echo "\033[255DExecuting: $file, $n/$c\033[K";
- }
- }
- echo "\n";
-}
-
-$drivers = true;
-if (!class_exists('PDO')) {
- $drivers = false;
-}
-if ($drivers) {
- $drivers = PDO::getAvailableDrivers();
- if (!in_array('pgsql', $drivers) || !in_array('mysql', $drivers)) {
- $drivers = false;
- }
-}
-if (!$drivers) {
- echo "Sorry. This migration tool requires both mysql and pgsql PDO drivers.\n";
- $r = ask_question("If you are on dreamhost you can enable them. This might work on other shared hosts too. Type 'n' to do it yourself.\nWould you like to try (Y/n)? ", array('y', 'n'), 'y');
- if ($r == 'y') {
- $path = $_SERVER['HOME'] . '/.php/5.4';
- if (!file_exists($path)) {
- mkdir($path, 0770, true);
- }
-
- $rcfile = $path . '/phprc';
-
- $str = '';
- $mods = get_loaded_extensions();
- foreach (array('pdo_mysql','pdo_pgsql','pgsql') as $ext) {
- if (!in_array($ext, $mods)) {
- $str .= 'extension=' . $ext . ".so\n";
- }
- }
-
- file_put_contents($rcfile, $str, FILE_APPEND);
- echo "drivers enabled.\nNow type: \033[1m/usr/local/bin/php-5.4 install/" . basename($argv[0]) . "\033[0m\n";
- }
- exit();
-}
-
-foreach (array('install','include','mod','view') as $dir) {
- if (!file_exists($dir)) {
- echo "You must execute from inside the webroot like the cron\n";
- exit();
- }
-}
-
-$cfgfile = '.htconfig.php';
-if ($argc >= 2 && $argv[1] == '--resume') {
- if ($argc < 4) {
- echo "Resume usage {$argv[0]} --resume
\n";
- exit();
- }
- $starttable = $argv[2];
- $startrow = $argv[3];
- $cfgfile = '.htconfig.php-mysql';
-}
-
-$cfg = parse_htconfig($cfgfile);
-$type = get_configtype($cfg);
-if ($type != 'mysql') {
- echo "Error. Must start with standard mysql installation in .htconfig.php.\n";
- exit();
-}
-
-if (!$cfg['port']) {
- $cfg['port'] = 3306;
-}
-try {
- $mydb = new PDO("mysql:host={$cfg['host']};dbname={$cfg['data']};port={$cfg['port']}", $cfg['user'], $cfg['pass']);
-} catch (PDOException $e) {
- echo "Error connecting to mysql DB: " . $e->getMessage() . "\n";
- exit();
-}
-
-// mysql insists on buffering even when you use fetch() instead of fetchAll() for some stupid reason
-// http://stackoverflow.com/questions/6895098/pdo-mysql-memory-consumption-with-large-result-set
-$mydb->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
-
-if (!file_exists('.htconfig.php-pgsql')) {
- echo "Enter postgres server info:\n";
- $p['host'] = get_data("Hostname: ", '/[\w.]+/');
- $p['port'] = get_data("Enter port (0 for default): ", '/\d+/');
- $p['user'] = get_data("Username: ", '/\w+/');
- $p['pass'] = get_data("Password: ", '/[[:print:]]+/');
- $p['data'] = get_data("Database name: ", '/\w+/');
- $old = file_get_contents('.htconfig.php');
- $new = preg_replace(
- array(
- '/^(\$db_host\s*=\s*\')([\w.]+)(\';)$/m',
- '/^(\$db_port\s*=\s*\')(\d+)(\';)$/m',
- '/^(\$db_user\s*=\s*\')(\w+)(\';)$/m',
- '/^(\$db_pass\s*=\s*\')([[:print:]]+)(\';)/m',
- '/^(\$db_data\s*=\s*\')(\w+)(\';)$/m',
- '/^(\$db_type\s*=\s*\')(\d)(\';)$/m' // in case they already have it
- ),
- array(
- "$1{$p['host']}$3",
- "\${1}{$p['port']}$3",
- "$1{$p['user']}$3",
- "$1{$p['pass']}$3",
- "$1{$p['data']}$3\n\$db_type = '1';\n", // they probably don't
- "\${1}1$3"
- ),
- $old,
- 1,
- $repl
- );
- if ($new === false || $repl < 5) {
- echo "Failed. Please make a postgres config file named .htconfig.php-pgsql - Be sure to add \"\$db_type = '1';\" to your config.\n";
- exit();
- }
- file_put_contents('.htconfig.php-pgsql', $new);
-}
-
-$pcfg = parse_htconfig('.htconfig.php-pgsql');
-$ptype = get_configtype($pcfg);
-if ($ptype != 'pgsql') {
- echo "Error. Must have a valid pgsql config named .htconfig.php-pgsql. Be sure to add \"\$db_type = '1';\" to your config.\n";
- exit();
-}
-
-if (!$pcfg['port']) {
- $pcfg['port'] = 5432;
-}
-try {
- $pgdb = new PDO("pgsql:host={$pcfg['host']};dbname={$pcfg['data']};port={$pcfg['port']}", $pcfg['user'], $pcfg['pass']);
-} catch (PDOException $e) {
- echo "Error connecting to pgsql DB: " . $e->getMessage() . "\n";
- echo "cfg string: " . "pgsql:host={$pcfg['host']};dbname={$pcfg['data']};port={$pcfg['port']}\n";
- exit();
-}
-$B = "\033[0;34m";
-$H = "\033[0;35m";
-$W = "\033[1;37m";
-$M = "\033[1;31m";
-$N = "\033[0m";
-
-if (isset($starttable)) {
- $r = ask_question(
- "Ready to migrate {$W}Red{$M}(#){$W}Matrix$N from mysql db @$B{$cfg['host']}$N/$B{$cfg['data']}$N to postgres db @$B{$pcfg['host']}$N/$B{$pcfg['data']}$N.
-
-Resuming failed migration ({$M}experimental$N) starting at table '$starttable' row $startrow.
-Are you ready to begin (N/y)? ",
- array('y', 'n'),
- 'n'
- );
- if ($r == 'n') {
- exit();
- }
-} else {
- $r = ask_question("Ready to migrate {$W}Red{$M}(#){$W}Matrix$N from mysql db @$B{$cfg['host']}$N/$B{$cfg['data']}$N to postgres db @$B{$pcfg['host']}$N/$B{$pcfg['data']}$N.
-The site will be disabled during the migration by moving the $H.htconfig.php$N file to $H.htconfig.php-mysql$N.
-If for any reason the migration fails, you will need to move the config file back into place manually before trying again.
-
-Are you ready to begin (N/y)? ", array('y','n'), 'n');
-
- if ($r == 'n') {
- exit();
- }
-
- rename('.htconfig.php', '.htconfig.php-mysql');
-
- run_sql('install/schema_postgres.sql', $pgdb, $err, $n);
- if ($err) {
- echo "There were $err errors creating the pgsql schema. Unable to continue.\n";
- exit();
- }
-
- echo "pgsql schema created. $n queries executed successfully.\n";
-}
-
-$res = $pgdb->query("select relname, attname, pg_type.typname from ((pg_attribute inner join pg_class on attrelid=pg_class.oid) inner join pg_type on atttypid=pg_type.oid) inner join pg_namespace on relnamespace=pg_namespace.oid where nspname='public' and atttypid not in (26,27,28,29) and relkind='r' and attname <> 'item_search_vector';");
-if ($res === false) {
- echo "Error reading back schema. Unable to continue.\n";
- var_export($pgdb->errorInfo());
- exit();
-}
-$schema = [];
-while (($row = $res->fetch()) !== false) {
- $schema[$row[0]][$row[1]] = $row[2];
-}
-
-$res = $pgdb->query("select relname, attname from pg_attribute inner join pg_class on attrelid=pg_class.oid inner join pg_constraint on conrelid=pg_class.oid and pg_attribute.attnum = any (conkey) where contype='p';");
-if ($res === false) {
- echo "Error reading back primary keys. Unable to continue.\n";
- var_export($pgdb->errorInfo());
- exit();
-}
-$pkeys = [];
-while (($row = $res->fetch()) !== false) {
- $pkeys[$row[0]] = $row[1];
-}
-
-$err = 0;
-$n = 0;
-$reserved = array('ignore','key','with');
-foreach ($schema as $table => $fields) {
- if (isset($starttable) && !$n && $table != $starttable) {
- echo "Skipping table $table\n";
- continue;
- }
- $fnames = array_keys($fields);
- $pfnames = array_keys($fields);
-
- foreach ($fnames as &$fname) {
- if (in_array($fname, $reserved)) {
- $fname = '`' . $fname . '`';
- }
- }
- $fstr = implode(',', $fnames);
-
- foreach ($pfnames as &$pfname) {
- if (in_array($pfname, $reserved)) {
- $pfname = '"' . $pfname . '"';
- }
- }
- $pfstr = implode(',', $pfnames);
-
- $cres = $mydb->query("SELECT count(*) FROM $table;");
- if ($cres === false) {
- echo "Fatal error counting table $table: " . var_export($mydb->errorInfo(), true) . "\n";
- exit();
- }
- $nrows = $cres->fetchColumn(0);
- $cres->closeCursor();
-
- if (!$nrows) {
- echo "TABLE $table has 0 rows in mysql db.\n";
- continue;
- }
-
- $pstr = '';
- for ($x = 0, $c = count($fields); $x < $c; $x++) {
- $pstr .= ($x ? ',?' : '?');
- }
-
- if (isset($starttable) && $table == $starttable) {
- $selectsql = "SELECT $fstr FROM $table ORDER BY {$pkeys[$table]} LIMIT $nrows OFFSET $startrow;";
- $crow = $startrow;
- } else {
- $selectsql = "SELECT $fstr FROM $table ORDER BY {$pkeys[$table]};";
- $crow = 0;
- }
-
- echo "\033[255DTABLE: $table [$c fields] $crow/$nrows (" . number_format(($crow / $nrows) * 100, 2) . "%)\033[K";
-
- $res = $mydb->query($selectsql);
- if ($res === false) {
- echo "Fatal Error importing table $table: " . var_export($mydb->errorInfo(), true) . "\n";
- exit();
- }
-
- $istmt = $pgdb->prepare("INSERT INTO $table ($pfstr) VALUES ($pstr);");
- if ($istmt === false) {
- echo "Fatal error preparing query. Aborting.\n";
- var_export($pgdb->errorInfo());
- exit();
- }
-
- while (($row = $res->fetch(PDO::FETCH_NUM)) !== false) {
- foreach ($row as $idx => &$val) {
- if (array_slice(array_values($fields), $idx, 1)[0] == 'timestamp' && $val == '0000-00-00 00:00:00') {
- $istmt->bindParam($idx + 1, ($nulldate = '0001-01-01 00:00:00'));
- } elseif (array_slice(array_values($fields), $idx, 1)[0] == 'bytea') {
- $istmt->bindParam($idx + 1, $val, PDO::PARAM_LOB);
- } else {
- $istmt->bindParam($idx + 1, $val);
- }
- }
- $r = $istmt->execute();
- if ($r === false) {
- $err++;
- echo "Insert error: " . var_export(array($pgdb->errorInfo(), $table, $fields, $row), true) . "\nResume with {$argv[0]} --resume $table $crow\n";
- exit();
- } else {
- $n++;
- }
- $crow++;
- if (($crow % 10) == 0 || $crow == $nrows) {
- echo "\033[255DTABLE: $table [$c fields] $crow/$nrows (" . number_format(($crow / $nrows) * 100, 2) . "%)\033[K";
- }
- }
- $res->closeCursor();
- echo "\n";
-}
-
-echo "Done with $err errors and $n inserts.\n";
-if ($err) {
- echo "Migration had errors. Aborting.\n";
- exit();
-}
-
-run_sql('install/migrate_mypg_fixseq.sql', $pgdb, $err, $n);
-echo "Sequences updated with $err errors and $n inserts.\n";
-if ($err) {
- exit();
-}
-
-$r = ask_question("Everything successful. Once you connect up the pg database there is no going back. Do you want to make it live (N,y)?", array('y', 'n'), 'n');
-if ($r == 'n') {
- echo "You can make active by renaming .htconfig.php-pgsql to .htconfig.php, or start over by renaming .htconfig.php-mysql to .htconfig.php\n";
- exit();
-}
-
-rename('.htconfig.php-pgsql', '.htconfig.php');
-echo "Done. {$W}Red{$M}(#){$W}Matrix$N now running on postgres.\n";
diff --git a/install/migrate_mypg_fixseq.sql b/install/migrate_mypg_fixseq.sql
deleted file mode 100644
index fde187dc7..000000000
--- a/install/migrate_mypg_fixseq.sql
+++ /dev/null
@@ -1,55 +0,0 @@
- SELECT SETVAL('public.abook_abook_id_seq', COALESCE(MAX(abook_id), 1) ) FROM public.abook;
- SELECT SETVAL('public.account_account_id_seq', COALESCE(MAX(account_id), 1) ) FROM public.account;
- SELECT SETVAL('public.addon_id_seq', COALESCE(MAX(id), 1) ) FROM public.addon;
- SELECT SETVAL('public.app_id_seq', COALESCE(MAX(id), 1) ) FROM public.app;
- SELECT SETVAL('public.attach_id_seq', COALESCE(MAX(id), 1) ) FROM public.attach;
- SELECT SETVAL('public.channel_channel_id_seq', COALESCE(MAX(channel_id), 1) ) FROM public.channel;
- SELECT SETVAL('public.chat_chat_id_seq', COALESCE(MAX(chat_id), 1) ) FROM public.chat;
- SELECT SETVAL('public.chatpresence_cp_id_seq', COALESCE(MAX(cp_id), 1) ) FROM public.chatpresence;
- SELECT SETVAL('public.chatroom_cr_id_seq', COALESCE(MAX(cr_id), 1) ) FROM public.chatroom;
- SELECT SETVAL('public.config_id_seq', COALESCE(MAX(id), 1) ) FROM public.config;
- SELECT SETVAL('public.conv_id_seq', COALESCE(MAX(id), 1) ) FROM public.conv;
- SELECT SETVAL('public.event_id_seq', COALESCE(MAX(id), 1) ) FROM public.event;
- SELECT SETVAL('public.fcontact_id_seq', COALESCE(MAX(id), 1) ) FROM public.fcontact;
- SELECT SETVAL('public.ffinder_id_seq', COALESCE(MAX(id), 1) ) FROM public.ffinder;
- SELECT SETVAL('public.fserver_id_seq', COALESCE(MAX(id), 1) ) FROM public.fserver;
- SELECT SETVAL('public.fsuggest_id_seq', COALESCE(MAX(id), 1) ) FROM public.fsuggest;
- SELECT SETVAL('public.group_member_id_seq', COALESCE(MAX(id), 1) ) FROM public.group_member;
- SELECT SETVAL('public.groups_id_seq', COALESCE(MAX(id), 1) ) FROM public.groups;
- SELECT SETVAL('public.hook_id_seq', COALESCE(MAX(id), 1) ) FROM public.hook;
- SELECT SETVAL('public.hubloc_hubloc_id_seq', COALESCE(MAX(hubloc_id), 1) ) FROM public.hubloc;
- SELECT SETVAL('public.issue_issue_id_seq', COALESCE(MAX(issue_id), 1) ) FROM public.issue;
- SELECT SETVAL('public.item_id_id_seq', COALESCE(MAX(id), 1) ) FROM public.item_id;
- SELECT SETVAL('public.item_id_seq', COALESCE(MAX(id), 1) ) FROM public.item;
- SELECT SETVAL('public.likes_id_seq', COALESCE(MAX(id), 1) ) FROM public.likes;
- SELECT SETVAL('public.mail_id_seq', COALESCE(MAX(id), 1) ) FROM public.mail;
- SELECT SETVAL('public.manage_id_seq', COALESCE(MAX(id), 1) ) FROM public.manage;
- SELECT SETVAL('public.menu_item_mitem_id_seq', COALESCE(MAX(mitem_id), 1) ) FROM public.menu_item;
- SELECT SETVAL('public.menu_menu_id_seq', COALESCE(MAX(menu_id), 1) ) FROM public.menu;
- SELECT SETVAL('public.notify_id_seq', COALESCE(MAX(id), 1) ) FROM public.notify;
- SELECT SETVAL('public.obj_obj_id_seq', COALESCE(MAX(obj_id), 1) ) FROM public.obj;
- SELECT SETVAL('public.pconfig_id_seq', COALESCE(MAX(id), 1) ) FROM public.pconfig;
- SELECT SETVAL('public.photo_id_seq', COALESCE(MAX(id), 1) ) FROM public.photo;
- SELECT SETVAL('public.poll_elm_pelm_id_seq', COALESCE(MAX(pelm_id), 1) ) FROM public.poll_elm;
- SELECT SETVAL('public.poll_poll_id_seq', COALESCE(MAX(poll_id), 1) ) FROM public.poll;
- SELECT SETVAL('public.profdef_id_seq', COALESCE(MAX(id), 1) ) FROM public.profdef;
- SELECT SETVAL('public.profext_id_seq', COALESCE(MAX(id), 1) ) FROM public.profext;
- SELECT SETVAL('public.profile_check_id_seq', COALESCE(MAX(id), 1) ) FROM public.profile_check;
- SELECT SETVAL('public.profile_id_seq', COALESCE(MAX(id), 1) ) FROM public.profile;
- SELECT SETVAL('public.register_id_seq', COALESCE(MAX(id), 1) ) FROM public.register;
- SELECT SETVAL('public.session_id_seq', COALESCE(MAX(id), 1) ) FROM public.session;
- SELECT SETVAL('public.shares_share_id_seq', COALESCE(MAX(share_id), 1) ) FROM public.shares;
- SELECT SETVAL('public.sign_id_seq', COALESCE(MAX(id), 1) ) FROM public.sign;
- SELECT SETVAL('public.source_src_id_seq', COALESCE(MAX(src_id), 1) ) FROM public.source;
- SELECT SETVAL('public.spam_id_seq', COALESCE(MAX(id), 1) ) FROM public.spam;
- SELECT SETVAL('public.sys_perms_id_seq', COALESCE(MAX(id), 1) ) FROM public.sys_perms;
- SELECT SETVAL('public.term_tid_seq', COALESCE(MAX(tid), 1) ) FROM public.term;
- SELECT SETVAL('public.updates_ud_id_seq', COALESCE(MAX(ud_id), 1) ) FROM public.updates;
- SELECT SETVAL('public.verify_id_seq', COALESCE(MAX(id), 1) ) FROM public.verify;
- SELECT SETVAL('public.vote_vote_id_seq', COALESCE(MAX(vote_id), 1) ) FROM public.vote;
- SELECT SETVAL('public.xchat_xchat_id_seq', COALESCE(MAX(xchat_id), 1) ) FROM public.xchat;
- SELECT SETVAL('public.xconfig_id_seq', COALESCE(MAX(id), 1) ) FROM public.xconfig;
- SELECT SETVAL('public.xign_id_seq', COALESCE(MAX(id), 1) ) FROM public.xign;
- SELECT SETVAL('public.xlink_xlink_id_seq', COALESCE(MAX(xlink_id), 1) ) FROM public.xlink;
- SELECT SETVAL('public.xtag_xtag_id_seq', COALESCE(MAX(xtag_id), 1) ) FROM public.xtag;
- SELECT SETVAL('public.xperm_xp_id_seq', COALESCE(MAX(xp_id), 1) ) FROM public.xperm;
diff --git a/library/epub-meta/index.php b/library/epub-meta/index.php
index 57bb31b5c..ae1c0f8c2 100644
--- a/library/epub-meta/index.php
+++ b/library/epub-meta/index.php
@@ -86,7 +86,8 @@
if($cover) @unlink($cover);
// rename
- $author = array_shift(array_keys($epub->Authors()));
+ $array = array_keys($epub->Authors());
+ $author = array_shift($array);
$title = $epub->Title();
$new = to_file($author.'-'.$title);
$new = $bookdir.$new.'.epub';