init search

This commit is contained in:
themohooks 2024-07-08 23:01:54 +03:00
parent ac7deee234
commit 3357da8339
4 changed files with 87 additions and 1 deletions

View file

@ -0,0 +1,18 @@
<?php
namespace App\Controllers;
use \App\Services\{Router, Auth, DB, Json};
use \App\Controllers\ExceptionRegister;
use \App\Core\Page;
class SearchController
{
public static function i()
{
Page::set('Search');
}
}

View file

@ -29,12 +29,16 @@ class Routes
Router::get('/lk/upload', 'ProfileController@upload'); Router::get('/lk/upload', 'ProfileController@upload');
Router::get('/lk/history', 'ProfileController@lkhistory'); Router::get('/lk/history', 'ProfileController@lkhistory');
Router::get('/lk/profile', 'ProfileController@lkprofile'); Router::get('/lk/profile', 'ProfileController@lkprofile');
Router::get('/search', 'SearchController@i');
Router::post('/api/upload', 'ApiController@upload'); Router::post('/api/upload', 'ApiController@upload');
Router::post('/api/profile/update', 'ApiController@updateprofile'); Router::post('/api/profile/update', 'ApiController@updateprofile');
Router::post('/api/photo/comment', 'ApiController@photocomment'); Router::post('/api/photo/comment', 'ApiController@photocomment');
Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload'); Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload');
Router::get('/api/photo/vote', 'ApiController@photovote'); Router::get('/api/photo/vote', 'ApiController@photovote');
Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote'); Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote');
Router::get('/logout', 'MainController@logout'); Router::get('/logout', 'MainController@logout');
Router::get('/404', 'ExceptionRegister@notfound'); Router::get('/404', 'ExceptionRegister@notfound');
} else { } else {

View file

@ -208,7 +208,7 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
</td> </td>
</tr> </tr>
</table> </table>
<div><b><a href="/search?aid=<?=$userprofile->i('id')?>">Найти все фотографии, сделанные этим пользователем</a></b></div>
</td> </td>
</tr> </tr>
<tr> <tr>

64
views/pages/Search.php Normal file
View file

@ -0,0 +1,64 @@
<?php
use App\Services\{Router, Auth, DB, Date};
?>
<html lang="ru">
<head>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/LoadHead.php'); ?>
</head>
<body>
<div id="backgr"></div>
<table class="tmain">
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?>
<tr>
<td class="main">
<h1>Результаты поиска</h1>
<div>Найдено изображений: <b>12</b> &nbsp;·&nbsp; <a href="#sf">Новый поиск</a></div><br>
<?php
$photos = DB::query('SELECT * FROM photos WHERE user_id=:uid ORDER BY id DESC', array(':uid'=>$_GET['id']));
foreach ($photos as $p) {
echo ' <div class="p20p">
<table>
<tbody>
<tr>
<td class="pb_photo" id="p1936120"><a href="/photo/'.$p['id'].'" target="_blank" class="prw"><img class="f" src="'.$p['photourl'].'">
</a></td>
<td class="pb_descr">
<p><b class="pw-place">'.$p['place'].'</b></p>
<span class="pw-descr">'.$p['postbody'].'</span>
<p class="sm"><b>'.Date::zmdate($p['timeupload']).'</b><br>Автор: <a href="/author/'.$p['user_id'].'/">mohooks</a></p>
</td>
</tr>
</tbody>
</table>
</div>';
}
?>
</tbody>
</table>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-1" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-2" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-3" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-4" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-5" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-6" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-7" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-8" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-9" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-10" tabindex="0" style="display: none;"></ul>
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" id="ui-id-11" tabindex="0" style="display: none;"></ul>
</body>
</html>