user.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php include ('header.php'); ?>
  2. <main id="main">
  3. <?php include dirname(__FILE__).('/widgets/user_header.php'); ?>
  4. <div class="article_wrap">
  5. <aside class="left_column">
  6. <div class="profile_icon_box">
  7. <img id="js_profile_image" src="/assets/images/missing.png" mediaaccess="true">
  8. </div>
  9. <section class="profile_section_wrap">
  10. <h1 class="profile_displayname">
  11. <a id="js_profile_displayname" class="emoji_poss" href="#"></a>
  12. </h1>
  13. <h2 class="profile_username">
  14. @<a id="js_profile_username" href="#"></a><span class="profile_followed_by invisible">FOLLOWS YOU</span>
  15. </h2>
  16. <p id="js_profile_bio" class="profile_bio emoji_poss"></p>
  17. <?php include dirname(__FILE__).('/widgets/user_recent_images.php'); ?>
  18. </section>
  19. </aside>
  20. <article class="center_column">
  21. <header class="timeline_header">
  22. <ul class="header_items">
  23. <li class="item toots view">
  24. <a id="toots_link">
  25. Toots
  26. </a>
  27. </li>
  28. <li class="item wreplies">
  29. <a id="with_replies_link">
  30. Toots &amp; replies
  31. </a>
  32. </li>
  33. <li class="item media">
  34. <a id="media_link">
  35. Media
  36. </a>
  37. </li>
  38. </ul>
  39. </header>
  40. <div id="js-stream_update">
  41. <button>
  42. View <span></span> new Toots
  43. </button>
  44. </div>
  45. <ul id="js-timeline" class="timeline">
  46. </ul>
  47. <footer id="js-timeline_footer" class="timeline_footer">
  48. <i class="fa fa-spin fa-circle-o-notch" aria-hidden="true"></i>
  49. </footer>
  50. </article>
  51. <aside class="right_column">
  52. <section class="side_widgets_wrap">
  53. <?php include dirname(__FILE__).('/widgets/side_who_to_follow.php'); ?>
  54. </section>
  55. <?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
  56. </aside>
  57. </div>
  58. </main>
  59. <script>
  60. current_file = "/user";
  61. $("#toots_link").attr('href', location.pathname+location.search);
  62. $("#with_replies_link").attr('href', location.pathname+'/with_replies'+location.search);
  63. $("#media_link").attr('href', location.pathname+'/media'+location.search);
  64. $("#js-profile_nav_toots").toggleClass("view");
  65. $("#js-profile_nav_toots > a").attr('href', location.pathname+location.search);
  66. $("#js-profile_nav_following > a").attr('href', location.pathname+'/following'+location.search);
  67. $("#js-profile_nav_followers > a").attr('href', location.pathname+'/followers'+location.search);
  68. $("#js-profile_nav_favourites > a").attr('href', location.pathname+'/favourites'+location.search);
  69. <?php if (isset($_GET['mid'])): ?>
  70. $(function() {
  71. const account_id = <?= htmlspecialchars((string)filter_input(INPUT_GET, 'mid'), ENT_QUOTES) ?>;
  72. api.get('accounts/'+account_id, function(userprofile) {
  73. if ( userprofile !== null ) {
  74. $('title').text(replaced_emoji_return(userprofile.display_name)+' (@'+userprofile.acct+') | Halcyon');
  75. setAccount(userprofile);
  76. setTimeline("accounts/"+userprofile.id+"/statuses",[{name:'exclude_replies',data:'true'}]);
  77. setRecentImages(userprofile.id)
  78. } else {
  79. location.href = "/404.php";
  80. }
  81. });
  82. });
  83. <?php elseif((isset($_GET['user']))): ?>
  84. $(function(){
  85. <?php
  86. $name = preg_split("/@/", $_GET['user'])[1];
  87. $domain = preg_split("/@/", $_GET['user'])[2];
  88. $url= "https://$domain/@$name";
  89. ?>
  90. const query = '<?= htmlspecialchars((string)filter_input(INPUT_GET, 'user'), ENT_QUOTES) ?>';
  91. api.get('search', [{name:'q',data:query},{name:'resolve',data:'true'}], function(search) {
  92. if ( !search.accounts.length ) {
  93. location.href = "/404.php";
  94. } else if ("@"+search.accounts[0].acct === query || "@"+search.accounts[0].acct+"@"+localStorage.current_instance === query) {
  95. $('title').text(replaced_emoji_return(search.accounts[0].display_name)+' (@'+search.accounts[0].acct+') | Halcyon');
  96. setAccount(search.accounts[0]);
  97. setTimeline("accounts/"+search.accounts[0].id+"/statuses",[{name:'exclude_replies',data:'true'}]);
  98. setRecentImages(search.accounts[0].id)
  99. } else {
  100. location.href = "/404.php";
  101. }
  102. });
  103. })
  104. <?php endif; ?>
  105. </script>
  106. <?php include ('footer.php'); ?>