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-02-01 16:15:19
M-jay:
this can be used for testing ill add to github when i know its fully workinghttps://mega.nz/file/ZUplHYSb#GTfGEEuKkxn7eNq1u-kArMi_E5v4q11yLOPYUAyObBc19.01.21 link updated


Installing and will let you know if I find any major bugs!
If It Ain't Dutch, It Ain't Much!!
2022-02-01 19:03:06
Suggestion >> To rename the "Bug Tracker" topic in the forum to "Bug Tracking for MVC/PDO" to avoid confusion and to stay on focus ;-)

For the user profile pages >>

- Admin menu page > Add PM Ban feature (see mod)
- Bookmark menu page > This page now has a refresh feature, and then refreshes towards frontpage - leading you out of your profile pages. Should refresh back into main profile page.
 Should this not simply be a list of your bookmarked torrent titles, with an option to remove them (1 by 1 and in bulk).
 ...showing this page more or less like a simplified Inbox of your PM's ?  
 Adding them should then be done inside the torrent details page.

- Spelling error: "You recieve 0.1 points per 60 minutes the system registers you as a seeder by torrent."   > receive
- Spelling suggestion: "This page displays the options that you can redeem accumulated points against depending on the share of torrents."  > where you can redeem accumulated bonus points
- Does the Messages menu item have a counter? Like Message (1) when you have a new message. And then the same on your Inbox (1)
- Spelling suggestion: "Receive 2 Invites for 1000.00 seedbonus points."  >>  Exchange 1000 points to receive 2 Invites.

Admin CP >> Seed Bonus option >>

- Editing the options does not work. All fields blank.

Main frontpage menu >>

- Your Messages, should this not be directly linking to the inbox of your PM's?
If It Ain't Dutch, It Ain't Much!!
Last edited by Propaganda on 2022-02-01 19:08:03
2022-02-04 23:20:43
M-jay
how to make one or few new pages for ex. About Us?

I try to add new folder in app-->views-->user-->aboutus-->index.php
but nothing shows, I'm always back on index page
(but if I change app-->views-->user-->faq-->index.php to my content it works)

regards


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2022-02-05 06:13:31
When I move forum around I'll add a document section
2022-03-12 17:19:47
Hi, it looks like RSS is not working. I created a feed in both ruTorrent (seedbox) and qbit. It feeds me with a passkey which is correct but does not start downloading.
I get this error :  Error loading torrent. (https://............./download?id=18&passkey=..............................................)
Feed type:  Download link
Log-in type:  Alternative (no cookies)

I mention that I have 5 RSS feeds in my Seedbox and all of them work.
Please help me if is possible.

I use M-BiTsy MVC PDO

Regards
Last edited by ronan on 2022-03-12 17:43:34
2022-03-12 19:36:31
updated 13/03/22

Played around with rss and you can try this - i noticed guests where not allowed to view so that may have stopped it so the download file might as well let me know
there was a couple of small errors in the rss but seems to be working now you can check your rss feed
here

replace apps/views/blocks/rss_block.php
<?php
if ($_SESSION['loggedin'] == true) {
   // Enter Rss Feed Url eg $feedUrl = "http://localhost/M-BiTsy/rss?dllink=1";
   $feedUrl = "";

   Style::block_begin(Lang::T("RSS"));
   if (!$feedUrl) { ?>
       <p class="text-center"><small>This would need editing with an rss feed of your choice.</small></p> <?php
   } else {
       $domOBJ = new DOMDocument();
       $domOBJ->load($feedUrl);
       $content = $domOBJ->getElementsByTagName("item");
       foreach ($content as $data) {
           $title = $data->getElementsByTagName("title")->item(0)->nodeValue;
           $link = $data->getElementsByTagName("link")->item(0)->nodeValue;
           echo "<small>".CutName($title, 20)." <br> <a href='$link'>".CutName($link, 20)."</a></small><br><br>";
       }
   }

   Style::block_end();
}


replace app/controller.rss.php
<?php
class Rss
{

   public function __construct()
   {
       Auth::user(0, 0);
   }

   public function index()
   {
       $cat = $_GET["cat"];
       $dllink = (int) $_GET["dllink"];
       $passkey = $_GET["passkey"];
       $incldead = $_GET["incldead"];

       if (!get_row_count("users", "WHERE passkey=" . sqlesc($passkey))) {
           $passkey = "";
       }
       $where = "";
       $wherea = array();
       if (!$incldead) {
           $wherea[] = "visible='yes'";
       }
       if ($cat) {
           $cats = implode(", ", array_unique(array_map("intval", explode(",", (string) $cat))));
           $wherea[] = "category in ($cats)";
       }
       if (Validate::Id($_GET["user"])) {
           $wherea[] = "owner=$_GET[user]";
       }
       if ($wherea) {
           $where = "WHERE " . implode(" AND ", $wherea);
       }
       $limit = "LIMIT 50";
       
       header( "Content-type: text/xml");
       echo ('<?xml version="1.0" encoding="UTF-8" ?>
       <rss version="2.0">');
       
       echo ('
       <channel>
       <title>' . Config::get('SITENAME') . '</title>
       <link>' . URLROOT . '</link>
       <description>' . htmlspecialchars(Config::get('SITENAME')) . ' RSS Feed</description>');

       $res = DB::run("SELECT torrents.id, torrents.name, torrents.size, torrents.category, torrents.added, torrents.leechers, torrents.seeders, categories.parent_cat as cat_parent, categories.name AS cat_name FROM torrents LEFT JOIN categories ON category = categories.id $where ORDER BY added DESC $limit");
       while ($row = $res->fetch(PDO::FETCH_LAZY)) {
           list($id, $name, $size, $category, $added, $leechers, $seeders, $catname) = $row;
           //$guid = "".URLROOT . "/torrent?id=$id&hit=1";
           if ($dllink) {
               if ($passkey) {
                   $link = "".URLROOT."/download?id=$id&passkey=$passkey";
               } else {
                   $link = "".URLROOT."/download?id=$id";
               }
           } else {
               $link = "".URLROOT . "/torrent?id=$id&hit=1";
           }
           $pubdate = date("r", TimeDate::sql_timestamp_to_unix_timestamp($added));
           echo ("
           <item>
           <title>" . htmlspecialchars($name) . "</title>
           <guid>" . htmlspecialchars($link) . "</guid>
           <link>" . htmlspecialchars($link) . "</link>
           <pubDate>" . $pubdate . "</pubDate> <category> " . $row["cat_parent"] . ": " . $row["cat_name"] . "</category>
           <description>Category: " . $row["cat_parent"] . ": " . $row["cat_name"] . "  Size: " . mksize($size) . " Added: " . $added . " Seeders: " . $seeders . " Leechers: " . $leechers . "</description>
           </item>");
       }
       
       echo ('
       </channel>
       </rss>');
   }

   public function custom()
   {
       $resqn = DB::raw('categories', 'id, name, parent_cat', '', 'ORDER BY parent_cat ASC, sort_index ASC');
       $data = [
           'title' => Lang::T("CUSTOM_RSS_XML_FEED"),
           'resqn' => $resqn
       ];
       View::render('rss/custom', $data, 'user');
   }

   
   public function submit()
   {
       if ($_POST) {
           $params = array();
           if ($cats = $_POST["cats"]) {
               $catlist = array();
               foreach ($cats as $cat) {
                   if (is_numeric($cat)) {
                       $catlist[] = $cat;
                   }
               }
               if ($catlist) {
                   $params[] = "cat=" . implode(",", $catlist);
               }
           }
           if ($_POST["incldead"]) {
               $params[] = "incldead=1";
           }
           if ($_POST["dllink"]) {
               $params[] = "dllink=1";
           }
           if (!$_POST["cookies"] && $_SESSION['loggedin'] == true) {
               $params[] = "passkey=".Users::get('passkey')."";
           }
           if ($params) {
               $param = "?" . implode("&", $params);
           } else {
               $param = "";
           }
           $mss = "Your RSS link is: <a href=\"".URLROOT."/rss$param\">".URLROOT."/rss$param</a><br/><br/>";
           Redirect::autolink(URLROOT, $mss);
       }
   }
}
Last edited by M-jay warn on 2022-03-13 08:28:58
2022-03-13 12:08:11
Hi,  we solved the prb. The trick is in Download.php

Thank you for u'r support and time!

Regards
Last edited by ronan on 2022-03-13 20:15:54
2022-03-14 16:46:14
Good to know  😬

Can you post your download.php so I can check it, I'm assuming it's the verify user.
2022-03-14 17:16:02
Hope is helpful.


<?php
class Download
{

   public function __construct()
   {
       Auth::user(0, 1);
   }

   public function index()
   {
       // Check The User
       if ($_SESSION['loggedin']) {
           if (Users::get("can_download") == "no") {
               Redirect::autolink(URLROOT, Lang::T("NO_PERMISSION_TO_DOWNLOAD"));
           }
           if (Users::get("downloadbanned") == "yes") {
               Redirect::autolink(URLROOT, Lang::T("DOWNLOADBAN"));
           }
       }

       // Get The Id
       $id = (int) Input::get("id");

       if (!$id) {
           Redirect::autolink(URLROOT, Lang::T("ID_NOT_FOUND_MSG_DL"));
       }
       
       // Check The Torrent
       $row = DB::select('torrents', 'filename, banned, external, announce, owner, vip', ['id'=>intval($id)]);
       if (Users::get('class') < _VIP && $row['vip'] == "yes") {
           Redirect::autolink($_SERVER['HTTP_REFERER'], Lang::T("VIPTODOWNLOAD"));
       }
       if (!$row) {
           Redirect::autolink(URLROOT . '/home', Lang::T("ID_NOT_FOUND"));
       }
       if ($row["banned"] == "yes") {
           Redirect::autolink($_SERVER['HTTP_REFERER'], Lang::T("BANNED_TORRENT"));
       }

       // Thanks
       if (Config::get('FORCETHANKS') && $_SESSION['loggedin']) {
           if (Users::get("id") != $row["owner"]) {
               $like = DB::select('thanks', 'user', ['thanked'=>$id, 'type'=>'torrent', 'user'=>Users::get('id')]);
               if (!$like) {
                   Redirect::autolink($_SERVER['HTTP_REFERER'], Lang::T("PLEASE_THANK"));
               }
           }
       }

       // Check The File
       $fn = UPLOADDIR . "/torrents/$id.torrent";
       if (!is_file($fn)) {
           Redirect::autolink($_SERVER['HTTP_REFERER'], Lang::T("FILE_NOT_FILE"));
       }
       if (!is_readable($fn)) {
           Redirect::autolink($_SERVER['HTTP_REFERER'], Lang::T("FILE_UNREADABLE"));
       }

       // Name Download File
       $name = $row['filename'];
       $friendlyurl = str_replace("http://", "", URLROOT);
       $friendlyname = str_replace(".torrent", "", $name);
       $friendlyext = ".torrent";
       $name = $friendlyname . "[" . $friendlyurl . "]" . $friendlyext;
       

       // Update Hit When Downloaded
       $pvkey_var = "d_".$id;
       $views = $_SESSION[$pvkey_var] == 1 ? $row["hits"] + 0 : $row["hits"] + 1;
       $_SESSION[$pvkey_var] = 1;
       DB::update('torrents', ['hits'=>$views], ['id'=>$id]);

       // if user dont have a passkey generate one, only if current member
       if ($_SESSION['loggedin']) {
           if (strlen(Users::get('passkey')) != 32) {
               $rand = array_sum(explode(" ", microtime()));
               $passkey = md5(Users::get('username') . $rand . Users::get('secret') . ($rand * mt_rand()));
               DB::update('users', ['passkey'=>$passkey], ['id'=>Users::get('id')]);
           }
       }

       if (Users::get('passkey')) {
           $passkey = Users::get('passkey');
       }
       elseif ($_GET["passkey"]) {
           $passkey = $_GET["passkey"];
       }
       else {
           $passkey = "";
       }

       // Local Torrent To Add Passkey
       if ($row["external"] != 'yes') {
           // Bencode
           $dict = Bencode::decode(file_get_contents($fn));
           $dict['announce'] = sprintf(PASSKEYURL, $passkey);
           unset($dict['announce-list']);
           $data = Bencode::encode($dict);
           header('Content-Disposition: attachment; filename="' . $name . '"');
           header("Content-Type: application/x-bittorrent");
           print $data;
       } else {
           // Download External
           header('Content-Disposition: attachment; filename="' . $name . '"');
           header('Content-Length: ' . filesize($fn));
           header("Content-Type: application/x-bittorrent");
           readfile($fn);
       }
   }

   public function attachment()
   {
       $id = (int) Input::get("id");
       $filename = Input::get("hash");

       $fn = UPLOADDIR . "/attachment/$filename.data";
       $sql = DB::select('attachments', '*', ['id'=>$id]);
       $extension = substr($sql['filename'], -3);
       
       if (!file_exists($fn)) {
           Redirect::autolink($_SERVER['HTTP_REFERER'], "The file $filename does not exists");
       } else {
           header('Content-Disposition: attachment; filename="' . $sql['filename'] . '"');
           header('Content-Length: ' . filesize($fn));
           header("Content-Type: application/$extension");
           readfile($fn);
       }
   }

}
Last edited by ronan on 2022-03-14 17:23:21
2022-03-16 15:45:42
👍 thanks for posting, any little improvements like this its best to post so code can up updated - makes updating code much easier in future
Last edited by M-jay warn on 2022-03-16 15:46:12
2022-03-16 15:55:08
M-jay:
 👍 thanks for posting, any little improvements like this its best to post so code can up updated - makes updating code much easier in future


Has u say, sharing is caring.

🙂🙂🙂
2022-03-19 16:27:01
had a quick look at ratio colour & its calculated the same $user["uploaded"] / $user["downloaded"] but through out the code it's approached different ways

The best way to re-do it is to re-factor the code so its all the same but here is the idea - anywhere ratio is needed run this line
$ratio = $user["downloaded"] > 0 ? number_format($user["uploaded"] / $user["downloaded"], 1) : "---";


update 20/03/22
updated function
function get_ratio_color($ratio)
{
  if ($ratio == '---') {
      return "<font color='FFFFFF'>$ratio</font>";
  }
  if ($ratio < 0.5) {
      return "<font color='#fc0313'>$ratio</font>";
  }
  if ($ratio < 1) {
      return "<font color='#fc6203'>$ratio</font>";
  }
  if ($ratio < 1.5) {
      return "<font color='#ebc334'>$ratio</font>";
  }
  if ($ratio < 2) {
      return "<font color='#1a7d09'>$ratio</font>";
  }
  return "<font color='#0d6efd'>$ratio</font>";
}


it seemed a little silly to go up by 0.1 each time so used every 0.5 - header user ratio always same colour so theme needs no edit
made a few edits but is improved https://github.com/M-jay84/M-BiTsy/commit/22e9acf009e73e3f2a20f0705b5508127e42dc32
Last edited by M-jay warn on 2022-03-20 20:31:28
2022-03-24 07:33:03
Hello,

I have a misunderstanding on login class in app/controllers/user/Login.php

Why does it have to destroy cookie after user logging in?  

<?php
class Login
{

   public function __construct()
   {
       Auth::ipBanned();
       Auth::isClosed();
       $this->token = Cookie::csrf_token();
       Cookie::destroyAll();
   }
Last edited by nicholas08 on 2022-03-24 11:28:03
2022-03-24 15:31:07
This is for security
* if system doesn't like you (eg bad IP, not a member) you must login - after been logged out and all saved details removed

this is to stop endless loop as well - not member so logout - to login page - - not member so logout - to login page - etc etc

what we do for login is delete cookies read password & username - if confirmed write new ones

we use bycrypt for password so its not like md5 and keeps changing so is good for another way of checking user verified like crsf protection  👍
2022-03-25 19:17:01
For the user profile pages >>

- Missing Available slots in Profile tab of profile pages.
- Clicking on "Forum Posts" it will list the forum posts. All fine. WHat it doesnt not allow you is to click on the forum post and go back straight to the forum topic. It should
- Clicking on "Comments Posts" it will list the comments posts. All fine. WHat it doesn not allow you is to click on the comment post and go back straight to where the comment was posted. It should
- Finally same works should be added for Torrents posted in same manner.

- The picture in the profile for the user overlaps content when viewed on small screens

- Admin menu page > Add PM Ban feature (see mod)
- Bookmark menu page > This page now has a refresh feature, and then refreshes towards frontpage - leading you out of your profile pages. Should refresh back into main profile page.
 Should this not simply be a list of your bookmarked torrent titles, with an option to remove them (1 by 1 and in bulk).
 ...showing this page more or less like a simplified Inbox of your PM's ?
 
 Adding them should then be done inside the torrent details page.

- What about the MOD comments field, what does this capture?
If It Ain't Dutch, It Ain't Much!!
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