Author page simplicity

This commit is contained in:
danpros 2021-04-21 20:20:31 +07:00
commit 80eacfe356
2 changed files with 7 additions and 7 deletions

View file

@ -202,7 +202,12 @@ get('/author/:name', function ($name) {
$posts = get_profile_posts($name, $page, $perpage); $posts = get_profile_posts($name, $page, $perpage);
$total = get_count($name, 'dirname'); $total = get_count('/'.$name.'/', 'dirname');
$username = 'config/users/' . $name . '.ini';
if ($total === 0 && !file_exists($username)) {
not_found();
}
$author = get_author($name); $author = get_author($name);

View file

@ -503,7 +503,6 @@ function get_category($category, $page, $perpage)
// Replaced string // Replaced string
$replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/'; $replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/';
// Author string
$str = explode('/', $replaced); $str = explode('/', $replaced);
$cat = $str[count($str) - 3]; $cat = $str[count($str) - 3];
@ -649,7 +648,6 @@ function get_type($type, $page, $perpage)
// Replaced string // Replaced string
$replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/'; $replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/';
// Author string
$str = explode('/', $replaced); $str = explode('/', $replaced);
$tp = $str[count($str) - 2]; $tp = $str[count($str) - 2];
@ -813,7 +811,7 @@ function get_author($name)
if (!empty($tmp) || file_exists($username)) { if (!empty($tmp) || file_exists($username)) {
return $tmp; return $tmp;
} else { } else {
not_found(); return false;
} }
} }
@ -1060,7 +1058,6 @@ function get_categorycount($var)
// Replaced string // Replaced string
$replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/'; $replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/';
// Author string
$str = explode('/', $replaced); $str = explode('/', $replaced);
$cat = '/blog/' . $str[count($str) - 3]; $cat = '/blog/' . $str[count($str) - 3];
if (stripos($cat, "$var") !== false) { if (stripos($cat, "$var") !== false) {
@ -1088,7 +1085,6 @@ function get_typecount($var)
// Replaced string // Replaced string
$replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/'; $replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/';
// Author string
$str = explode('/', $replaced); $str = explode('/', $replaced);
$tp = '/' . $str[count($str) - 2] . '/'; $tp = '/' . $str[count($str) - 2] . '/';
if (stripos($tp, "$var") !== false) { if (stripos($tp, "$var") !== false) {
@ -1117,7 +1113,6 @@ function get_draftcount($var)
// Replaced string // Replaced string
$replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/'; $replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/';
// Author string
$str = explode('/', $replaced); $str = explode('/', $replaced);
$cat = $str[count($str) - 5]; $cat = $str[count($str) - 5];