Jump to content

ScreenshotCenter 2.0


simpilot

Recommended Posts

Hi,

i tried, but it didn't work at first. Nothing was shown in the mail.

When i changed this ->

$comment = ScreenshotsData::getLatestComment($ss_id);

to that

$comment = ScreenshotsData::getLatestComment($id);

it returns the comment but not the last one. If there are 2 comments bellow the picture the first(older) one is displayed.

Therefore i changed this

public static function getLatestComment($ss_id) {
	$sql = "SELECT * FROM ".TABLE_PREFIX."screenshots_comments WHERE ss_id='$ss_id' ORDER BY ss_id DESC LIMIT 1";
	return DB::get_row($sql);
	}

to that

public static function getLatestComment($ss_id) {
	$sql = "SELECT * FROM ".TABLE_PREFIX."screenshots_comments WHERE ss_id='$ss_id' ORDER BY id DESC LIMIT 1";
	return DB::get_row($sql);
	}

Now everything works fine !

 

*****************************************************************************************************************************************************

I also received an idea from @web541 .

Entering this into the Screenshots.php everything worked fine without changes in the ScreenshotsData.class

$comment = ScreenshotsData::get_comments($id);
$comment = end($comment);

Many thanks to both of you for your great help.  😍 😃

Link to comment
Share on other sites

  • 1 month later...

Hello everyone!

 

I installed this module in my airline, everything is correctly installed and configured but for some reason it throws the following at me:

 

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Pagination has a deprecated constructor in /home/level/public_html/phpvms/core/common/Pagination.class.php on line 3

 

I would like to know how I solve it.

 

Thank you so much.

 

Error.jpg

Edited by VIELMA16
Link to comment
Share on other sites

  • Administrators
1 hour ago, VIELMA16 said:

Hello everyone!

 

I installed this module in my airline, everything is correctly installed and configured but for some reason it throws the following at me:

 

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Pagination has a deprecated constructor in /home/level/public_html/phpvms/core/common/Pagination.class.php on line 3

 

I would like to know how I solve it.

 

Thank you so much.

 

Error.jpg

 

Google is your friend... Google this:

Deprecated: Methods with the same name as their class will not be constructors

 

Link to comment
Share on other sites

28 minutes ago, ProAvia said:

 

Google is your friend... Google this:

Deprecated: Methods with the same name as their class will not be constructors

 

Thanks for your reply. I searched and read the information but I did not solve anything. I don't know what to do to fix it.

Link to comment
Share on other sites

  • Administrators

Look in /home/level/public_html/phpvms/core/common/Pagination.class.php on line 3

 

Pagination.class.php is not a file in the default install of phpVMS - so copy/paste the contents of that file here. My guess is that you may need to see what is in line 3 - but make a change to line 40 (if your file contents as the same as mine). But we need to see the contents of YOUR file first.

Link to comment
Share on other sites

6 hours ago, ProAvia said:

Busque en  /home/level/public_html/phpvms/core/common/Pagination.class.php  en la línea  3

 

Pagination.class.php no es un archivo en la instalación predeterminada de phpVMS, así que copie / pegue el contenido de ese archivo aquí. Supongo que es posible que necesite ver qué hay en la línea 3, pero realice un cambio en la línea 40 (si el contenido de su archivo es el mismo que el mío). Pero primero necesitamos ver el contenido de SU archivo.

This is the complete code of the file Pagination.class.php

 

 

<?php

class Pagination extends CodonData
{
	/**
	 * Current Page
	 *
	 * @var integer
	 */
	var $page;
	
	/**
	 * Size of the records per page
	 *
	 * @var integer
	 */
	var $size;
	
	/**
	 * Total records
	 *
	 * @var integer
	 */
	var $total_records;
	
	/**
	 * Link used to build navigation
	 *
	 * @var string
	 */
	var $link;
	
	/**
	 * Class Constructor
	 *
	 * @param integer $page
	 * @param integer $size
	 * @param integer $total_records
	 */
	function Pagination($page = null, $size = null, $total_records = null)
	{
		$this->page = $page;
		$this->size = $size;
		$this->total_records = $total_records;
	}
	
	/**
	 * Set's the current page
	 *
	 * @param unknown_type $page
	 */
	function setPage($page)
	{
		$this->page = 0+$page;
	}
	
	/**
	 * Set's the records per page
	 *
	 * @param integer $size
	 */
	function setSize($size)
	{
		$this->size = 0+$size;
	}
		
	/**
	 * Set's total records
	 *
	 * @param integer $total
	 */
	function setTotalRecords($total)
	{
		$this->total_records = 0+$total;
	}
	
	/**
	 * Sets the link url for navigation pages
	 *
	 * @param string $url
	 */
	function setLink($url)
	{
		$this->link = $url;
	}
	
	/**
	 * Returns the LIMIT sql statement
	 *
	 * @return string
	 */
	function getLimitSql()
	{
		$sql = "LIMIT " . $this->getLimit();
		return $sql;
	}
		
	/**
	 * Get the LIMIT statment
	 *
	 * @return string
	 */
	function getLimit()
	{
		if ($this->total_records == 0)
		{
			$lastpage = 0;
		}
		else 
		{
			$lastpage = ceil($this->total_records/$this->size);
		}
		
		$page = $this->page;		
		
		if ($this->page < 1)
		{
			$page = 1;
		} 
		else if ($this->page > $lastpage && $lastpage > 0)
		{
			$page = $lastpage;
		}
		else 
		{
			$page = $this->page;
		}
		
		$sql = ($page - 1) * $this->size . "," . $this->size;
		
		return $sql;
	}
	
	/**
	 * Creates page navigation links
	 *
	 * @return 	string
	 */
	function create_links()
	{
		$totalItems = $this->total_records;
		$perPage = $this->size;
		$currentPage = $this->page;
		$link = $this->link;
		
		$totalPages = floor($totalItems / $perPage);
		$totalPages += ($totalItems % $perPage != 0) ? 1 : 0;

		if ($totalPages < 1 || $totalPages == 1){
			return null;
		}

		$output = null;
		//$output = '<span id="total_page">Page (' . $currentPage . '/' . $totalPages . ')</span>&nbsp;';
				
		$loopStart = 1; 
		$loopEnd = $totalPages;

		if ($totalPages > 5)
		{
			if ($currentPage <= 3)
			{
				$loopStart = 1;
				$loopEnd = 5;
			}
			else if ($currentPage >= $totalPages - 2)
			{
				$loopStart = $totalPages - 4;
				$loopEnd = $totalPages;
			}
			else
			{
				$loopStart = $currentPage - 2;
				$loopEnd = $currentPage + 2;
			}
		}

		if ($loopStart != 1){
			$output .= sprintf('<li class="disabledpage"><a href="' . $link . '">&#171;</a></li>', '1');
		}
		
		if ($currentPage > 1){
			$output .= sprintf('<li class="nextpage"><a href="' . $link . '">Previous</a></li>', $currentPage - 1);
		}
		
		for ($i = $loopStart; $i <= $loopEnd; $i++)
		{
			if ($i == $currentPage){
				$output .= '<li class="currentpage">' . $i . '</li> ';
			} else {
				$output .= sprintf('<li><a href="' . $link . '">', $i) . $i . '</a></li> ';
			}
		}

		if ($currentPage < $totalPages){
			$output .= sprintf('<li class="nextpage"><a href="' . $link . '">Next</a></li>', $currentPage + 1);
		}
		
		if ($loopEnd != $totalPages){
			$output .= sprintf('<li class="nextpage"><a href="' . $link . '">&#187;</a></li>', $totalPages);
		}

		return '<div class="pagination"><ul>' . $output . '</ul></div>';
	}
}

?>

Thank you so much ProAvia!

Link to comment
Share on other sites

  • Administrators

I bet you are using PHP 7.0 or higher. Are you using phpVMS 5.5.2.72?

 

Here again is the error

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Pagination has a deprecated constructor in /home/level/public_html/phpvms/core/common/Pagination.class.php on line 3

 

The class is class Pagination extends CodonData on line 3

The method is function Pagination($page = null, $size = null, $total_records = null) on line 40

 

According to the error you can not have the class and the method (function in this case) be the same name. This is what is throwing the Deprecated ... you are seeing. The word Pagination can not be in both places.

 

The fix is to change line 40 from

function Pagination($page = null, $size = null, $total_records = null)

to

function __construct($page = null, $size = null, $total_records = null)

Note that there are two underscores ( _ ) before the word "construct".

 

The fix is outlined here: https://stackoverflow.com/questions/37100373/php-deprecated-methods-with-the-same-name

And was found with a quick Google search of: Deprecated: Methods with the same name as their class will not be constructors

 

The only reason I went into such detail is that many older modules may have this same issue when using PHP version 7 and above.

Link to comment
Share on other sites

4 hours ago, ProAvia said:

I bet you are using PHP 7.0 or higher. Are you using phpVMS 5.5.2.72?

 

Here again is the error

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Pagination has a deprecated constructor in /home/level/public_html/phpvms/core/common/Pagination.class.php on line 3

 

The class is class Pagination extends CodonData on line 3

The method is function Pagination($page = null, $size = null, $total_records = null) on line 40

 

According to the error you can not have the class and the method (function in this case) be the same name. This is what is throwing the Deprecated ... you are seeing. The word Pagination can not be in both places.

 

The fix is to change line 40 from


function Pagination($page = null, $size = null, $total_records = null)

to


function __construct($page = null, $size = null, $total_records = null)

Note that there are two underscores ( _ ) before the word "construct".

 

The fix is outlined here: https://stackoverflow.com/questions/37100373/php-deprecated-methods-with-the-same-name

And was found with a quick Google search of: Deprecated: Methods with the same name as their class will not be constructors

 

The only reason I went into such detail is that many older modules may have this same issue when using PHP version 7 and above.

 

Solved. Thank you so much ProAvia!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...