diff --git a/index.php b/index.php index 8ab3ed3..3efde7b 100644 --- a/index.php +++ b/index.php @@ -30,7 +30,8 @@ $routes = [ '/new' => 'new_twt.php', '/add' => 'add_feed.php', '/following' => 'following.php', - '/refresh' => 'load_twt_files.php', + //'/refresh' => 'load_twt_files.php', + '/refresh' => 'refresh.php', '/login' => 'login.php', '/logout' => 'logout.php', '/profile' => 'profile.php', diff --git a/style.css b/libs/timeline.css similarity index 95% rename from style.css rename to libs/timeline.css index af3fac8..1701d1d 100644 --- a/style.css +++ b/libs/timeline.css @@ -238,6 +238,26 @@ nav.pagnation { padding: 0.5rem 0; } + +/* === REFRESH === */ + +#refreshLabel { +} + +#refreshInfo { + font-weight: bold; +} + +#refreshURL { + display: block; +} + +#refreshCounter { + float: right; +} + + +/* === FOOTER === */ footer { border-top: thin solid grey; margin-top: 1rem; diff --git a/partials/header.php b/partials/header.php index e1109bd..5187cee 100644 --- a/partials/header.php +++ b/partials/header.php @@ -4,12 +4,14 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']); ?> + - - + + + <?= $title ?> @@ -42,6 +44,4 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']); -
- - +
\ No newline at end of file diff --git a/views/load_twt_files.php b/views/load_twt_files.php index 68acd17..96ce792 100644 --- a/views/load_twt_files.php +++ b/views/load_twt_files.php @@ -2,9 +2,13 @@ # Gets the followers from an URL and then gets all the Followers twtxt.txt files # Intended to be run in the background +/* require_once("libs/session.php"); // TODO: Move all to base.php require_once('libs/twtxt.php'); require_once('libs/hash.php'); +*/ + +require_once("partials/base.php"); $config = parse_ini_file('private/config.ini'); @@ -13,6 +17,7 @@ if (!isset($_SESSION['password'])) { exit(); } + $max_execution_time = intval($config['max_execution_time']); if ($max_execution_time < 1) { $max_execution_time = 1; @@ -20,9 +25,13 @@ if ($max_execution_time < 1) { ini_set('max_execution_time', $max_execution_time); -#ob_start(); +//ob_start(); -$config = parse_ini_file('private/config.ini'); +//require_once 'partials/header.php'; +//ob_flush(); + + +//$config = parse_ini_file('private/config.ini'); $url = $config['public_txt_url']; if (!empty($_GET['url'])) { diff --git a/views/refresh.php b/views/refresh.php new file mode 100644 index 0000000..56c2a2d --- /dev/null +++ b/views/refresh.php @@ -0,0 +1,92 @@ + + +

+ Loading feeds followed by: + + (1 of 10) +

+ + + + + document.getElementById("refreshInfo").innerHTML = " + Updating: + '.preg_replace('(^https?://)', '', $following[1]).' + ('.$i.' of '.$total.') + "; + document.getElementById("refreshProgress").value = "'.$float.'"; + document.getElementById("refreshProgress").innerHTML = "'.$percent.'"; + '; + + updateCachedFile($following[1]); + ob_flush(); // Send output to browser immediately + flush(); + $i++; +} + +// Tell user that the process is completed +echo ''; +