user.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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" 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"></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. $(function() {
  70. <?php if(isset($_GET['mid'])) { ?>
  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. <?php } else if(isset($_GET['user'])) {
  75. $name = preg_split("/@/",$_GET['user'])[1];
  76. $domain = preg_split("/@/",$_GET['user'])[2];
  77. $url= "https://$domain/@$name";
  78. ?>
  79. const query = '<?= htmlspecialchars((string)filter_input(INPUT_GET, 'user'), ENT_QUOTES) ?>';
  80. api.get('search',[{name:'q',data:query},{name:'resolve',data:'true'}],function(search) {
  81. if(!search.accounts.length) {
  82. location.href = "/404.php";
  83. }
  84. else if("@"+search.accounts[0].acct === query || "@"+search.accounts[0].acct+"@"+localStorage.current_instance === query) {
  85. userprofile = search.accounts[0];
  86. <?php } ?>
  87. $('title').text(replaced_emoji_return(userprofile.display_name)+' (@'+userprofile.acct+') | Halcyon');
  88. setAccount(userprofile);
  89. api.get("accounts/"+userprofile.id+"/statuses",[{name:'pinned',data:'true'},{name:'limit',data:'40'}],function(statuses) {
  90. for(var i=0;i<statuses.length;i++) {
  91. timeline_pinned_template(statuses[i]).appendTo("#js-timeline");
  92. }
  93. replaceInternalLink();
  94. replace_emoji();
  95. setTimeline("accounts/"+userprofile.id+"/statuses",[{name:'exclude_replies',data:'true'}],"false",true);
  96. });
  97. setRecentImages(userprofile.id)
  98. }
  99. else {
  100. location.href = "/404.php";
  101. }
  102. });
  103. })
  104. </script>
  105. <?php include ('footer.php'); ?>