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
Replace thisEach function
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2021-09-28 16:45:43
This is the function that fixed each been removed in php 7

I ended up removing thisEach function

mass search files for
thisEach


Here is blocks/themelang_block
while (list($ss_name, $ss_id) = thisEach($ss_sa)){


Replace with
foreach ($ss_sa as $ss_name => $ss_id) {


If process works use above as a guide to replace all other instances
2021-09-28 21:38:49
I think there are 14 instances of thisEach() in the 3.0 files according to my count. When I researched that fix it was to make a easy transition, but I agree with rewriting it. Each one of those 14 instances are slightly different than the others, so it will take some thought to change those code lines. Now I got to break off the rust and try this lol
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-09-28 21:44:17
2021-09-29 04:13:40
I removed it a while back, noticed i still had the function when cleaning the files up

From what i remember its used on stylesheet, language and timezone selection so a another example

while (list($key, $val) = thisEach($tzs)) {


the array var goes first in this case $tzs then the key ($key) followed by the value ($value)
foreach($tzs as $key => $val) {


2021-09-29 21:24:55
thanks m-jay. I will try this
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-10-01 21:50:15
stuck on what do I do with this one
while ((list($code, $url) = thisEach($smilies)) && $count<16) {
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-10-01 22:41:42
whats the code in the while brackets is it a calculation like $i = $count or $i++

just wonder if its grouping by 16 or limiting to 16.

we can try count through array = replace the while for a for()

for ($i = 0; $i < 16; $i++) {
   // vars
   $code = key($smilies);
   $url = current($smilies);
   // add
   next($smilies);
  // result
  var_dump($url);
}



2021-10-01 23:49:52
full function
function smile() {

 print "<div align='center'><table cellpadding='1' cellspacing='1'><tr><br />";

 global $smilies, $count;
 reset($smilies);

 while ((list($code, $url) = thisEach($smilies)) && $count<16) {
       print("\n<td><a href=\"javascript: SmileIT('".str_replace("'","\'",$code)."')\">
              <img border=\"0\" src=\"images/smilies/$url\" alt=\"$code\" /></a></td>");
             
       $count++;
 }

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-10-02 06:15:25
this seems to print out 16
function smile() {

       print "<div align='center'><table cellpadding='1' cellspacing='1'><tr><br />";
     
       global $smilies, $count;
       reset($smilies);
     
       for ($i = 0; $i < 16; $i++) {
           $code = key($smilies);
           $url = current($smilies);
           next($smilies);
           print("\n<td><a href=\"javascript: SmileIT('".str_replace("'","\'",$code)."')\">
           <img border=\"0\" src=\"images/smilies/$url\" alt=\"$code\" /></a></td>");
        }
   }
Last edited by M-jay warn on 2021-10-02 06:15:34
2021-10-02 14:49:16
that seems to work. thanks. How about this in mysql.class
	function read () {
$ret = "";
if (count($this->params)) {
reset($this->params);
for ($i = 0; $i < strlen($this->query); $i++) {
if ($this->query[$i] == "?") {
list(, $val) = thisEach($this->params);
$ret .= $val;
} else {
$ret .= $this->query[$i];
}
}
reset($this->params);
} else {
$ret = $this->query;
}
return $ret;
}

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-10-02 16:00:32
Try this replace
list(, $val) = thisEach($this->params);

With
 $val = current($this->params);
next($this->params);
2021-10-02 17:53:46
cool, I will give it a shot. Thanks again for your help. Everything seems stable. I will remove the function from the backend and see if everything is in order.
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
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: 8
  • Members: 0
  • Guests online: 8
  • Comments: 3
  • Messages: 1,728