Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Torrent Trader PDO/MVC 2021 Pre-Release
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / M-BiTsy / M-BiTsy Support

2022-03-27 05:26:26
ill look through these  😊 just little improvements now, https://torrenttrader.uk/post/user?id=1  &  https://torrenttrader.uk/comment/user?id=1
i did the comments & forum post and ill post them for a example of mvc - using this as a guide you can build stuff pretty quick

need to add sql & replace app/helpers_general_helper with https://github.com/M-jay84/M-BiTsy/blob/main/M-BiTsy/app/helpers/general_helper.php - added a function to tidy up a bit & sort ratio, avatar etc which i used for comments & forum which ill re-use everywhere

added new sql
ALTER TABLE `comments` ADD `type` VARCHAR(11) DEFAULT NULL;


first re-write model function - i only try use 1 query each page to get info from database - not always possible but makes life easier
app/models/Comments.php
    public static function join($id, $limit)
   {
       $row = DB::run("SELECT comments.id, comments.type, comments.news, comments.torrent, text, user, comments.added, avatar,
                              signature, username, users.title, class, uploaded, downloaded, privacy, donated,
                              news.title as newstitle,
                              torrents.name as torrenttitle
                       FROM comments
                       LEFT JOIN users
                       ON comments.user = users.id
                       LEFT JOIN news
                       ON comments.news = news.id
                       LEFT JOIN torrents
                       ON comments.torrent = torrents.id
                       WHERE user = $id ORDER BY comments.id $limit")->fetchAll();
       return $row;
   }


second write the controller (page) this is where we sort the data and send to view eg $_GET or query results
rewrite user function in app/controllers/users/Comment.php
    public function user()
   {
       // Get Id
       $id = (int) Input::get("id");

       // Run Some Checks
       if (!isset($id) || !$id) {
           Redirect::autolink(URLROOT, Lang::T("ERROR"));
       }
       
       // Count For Pager
       $count = DB::column('comments', 'count(*)', ['user' => $id]);
       list($pager, $limit) = Pagination::pager(20, $count, URLROOT . "/comment/user?id=$id&");
               
       // Grab All Data
       $row = Comments::join($id, $limit);
       //echo '<pre>'.print_r($row, true).'</pre>';  

       // Check If Data Returned
       if (!$row) {
           Redirect::autolink(URLROOT, "User has not posted any comments");
       }

       // Send Sorted Data
       $data = [
           'title' => Lang::T("Search Users Comments"),
           'id' => $id,
           'res' => $row,
           'pager' => $pager,
       ];
       View::render('comment/user', $data, 'user');
   }


Third make a view - this is where we go through the data sent from controller placing it into html
rewrite  app/views/user/comment
<p class="text-center"><a href='<?php echo URLROOT  ?>/profile?id=<?php echo $data['id']  ?>'>Go To Profile</a></p>
<?php
foreach ($data['res'] as $row) {
  // Quick Function To Tidy Results
  $user = userpostdetails($row); ?>

  <div class="container">
     <div class="row ttborder">
        <div class="col-2 d-none d-sm-block"> <?php
           if (Users::get('edit_users') == 'no' && $user['privacylevel'] == 'strong') {
              print('<td align="left" width="180"><center><small><a href="' . URLROOT . '/profile?id=' . $row['id'] . '"><b>' . $user['postername'] . '</b></a><br /><i>' . $user['title'] . '</i><img width="80" height="80" src="' . $user['avatar'] . '" alt="" /><br />Uploaded: ---<br />Downloaded: ---<br />Ratio: ' . get_ratio_color('---') . '</small><br /><br /><a href="' . URLROOT . '/profile?id=' . $row["user"] . '"><i class="fa fa-user tticon" title="Profile"></i></a> <a href="' . URLROOT . '/message/create?id=' . $row["user"] . '"><i class="fa fa-comment" title="Send PM"></i></a></center></td>');
           } else {
              print('<td align="left" width="180"><center><small><a href="' . URLROOT . '/profile?id=' . $row['id'] . '"><b>' . $user['postername'] . '</b></a><br /><i>' . $user['title'] . '</i><img width="80" height="80" src="' . $user['avatar'] . '" alt="" /><br />Uploaded: ' . $user['useruploaded'] . '<br />Downloaded: ' . $user['userdownloaded'] . '<br />Ratio: ' . get_ratio_color($user['userratio']) . '</small><br /><a href="' . URLROOT . '/profile?id=' . $row["user"] . '"><i class="fa fa-user" title="Profile"></i></a> <a href="/message/create?id=' . $row["user"] . '"><i class="fa fa-comment" title="Send PM"></i></a></center></td>');
           } ?>
        </div>
        <div class="col-10">
           <a href="<?php echo URLROOT ?>/topic?topicid=<?php echo $row['topicid']  ?>"><b><?php echo $row['subject'] ?></b></a> Posted: <?php echo date("d-m-Y \\a\\t H:i:s", TimeDate::utc_to_tz_time($row["added"]))  ?><a id="comment<?php echo $row["id"]  ?>"></a> in <a href="<?php echo URLROOT ?>/forum/view&forumid=<?php echo $row['forumid'] ?>"><b><?php echo $row['name'] ?></b></a>
           <p class="float-end"><?php echo $user['edit'] . $user['delete']  ?><a href="<?php echo URLROOT ?>/report/forum?forumid=<?php echo $row['topicid']  ?>&forumpost=<?php echo $row['id']  ?>"><i class="fa fa-flag" title='Report' aria-hidden="true"></i></a></p>
           <hr />
           <?php echo $user['commenttext']  ?>
           <hr />
           <?php echo $user['usersignature']  ?>
        </div>
     </div><br>
  </div> <?php
}
print($data['pager']);


here it is on github the user comments https://github.com/M-jay84/M-BiTsy/commit/0a2d20a3064fd1f0c2936e7ca8e66a489f1c49c0 and user forum post https://github.com/M-jay84/M-BiTsy/commit/82d00a4b0c58dabc1fc6d9ddfde8a07535fb5ba1

debug your own
the best way to build is printing out the data so in controller print out the data from the model make sure you have everything you want
        // Grab All Data
       $row = Comments::join($id, $limit);
       echo '<pre>'.print_r($row, true).'</pre>';


so before you start you plan on what you need and then in the controller we check the data been sent to the view
View::render('comment/user', $data, 'user');
echo '<pre>'.print_r($data, true).'</pre>';


here is example of the data sent to view for users comments - once you've got your model data its so easy hopefully 🤣 making it user friendly is something i;m more aware of
    [title] => Search Users Comments
   [id] => 1
   [res] => Array
       (
           [0] => Array
               (
                   [id] => 2
                   [type] => forum
                   [news] => 0
                   [torrent] => 28
                   [text] => jntrhjrh
                   [user] => 1
                   [added] => 2022-03-26 17:29:50
                   [avatar] =>
                   [signature] =>
                   [username] => M-jay
                   [title] =>
                   [class] => 7
                   [uploaded] => 524288000
                   [downloaded] => 1073741824
                   [privacy] => normal
                   [donated] => 0
                   [newstitle] =>
                   [torrenttitle] => MP3-daily-2022-March-17-Vocal
               )
 
Last edited by M-jay warn on 2022-03-27 06:32:30
2022-03-27 06:36:27
where does this happen
Quote:
- The picture in the profile for the user overlaps content when viewed on small screens
2022-03-28 16:10:40
Hi, why at PDO-MVC in settings.php is
 'MEMBERSONLY' => 0,
 'MEMBERSONLY_WAIT' => 1,

and on TTv3 config.php is

$site_config['MEMBERSONLY'] = true; //MAKE MEMBERS SIGNUP
$site_config['MEMBERSONLY_WAIT'] = false; //ENABLE WAIT TIMES FOR BAD RATIO

It's not the same thing in terms of functionality?
I know 0 mean false and 1 true. Which is the correct setting for PDO-MVC?

Thx


Last edited by ronan on 2022-03-28 16:13:41
2022-04-01 18:53:40
M-jay:
where does this happen
Quote:
- The picture in the profile for the user overlaps content when viewed on small screens


I used to happen on my phone, where it started overlapping the text in the column next right to it.
Now it does not, but the vertical reseizing is not yet in line with the horizontal reseizing. In other words the avatar gets stretched vertical.
If It Ain't Dutch, It Ain't Much!!
2022-04-02 04:06:10
in app/views/forum/topic/index.php line 79 should look like this for forum thanks
print("<a href='" . URLROOT . "/like/thanks?id=$arr[id]&type=thanksforum'><i class='fa fa-thumbs-up' title='Thanks'></i></a>&nbsp;");


Some one else has raised image re-sizing - stuff like the images in the bbcode and i found a nice piece of css that hopefully will solve the resize problems if you notice any

ill test here later so can be seen  👍


2023-01-24 10:42:40
github is dead ?

is this for last version : https://github.com/M-jay84/M-BiTsy ?

Ubuntu Linux 20.04.3 | MySQL 8 | Apache 2.4.41 | PHP 8.1.1

Last edited by kiki2020 on 2023-01-24 10:44:06
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728