Jump to content

Recommended Posts

Posted

As you can see, it is calling the module class not the data class

Non-static method Screenshots::show_random_screenshot()

Try going into core/Screenshots/Screenshots.php and add the public static function on those functions

Non-static method ExtraData::get_pilots_newscreenshot()

I think you missed this one while going through the classes, ExtraData.class.php not ScreenshotsData.class.php

Posted

Thanks for the help. I just needed a fresh set of eyes.

That fixed the ExtraData class issue.

However, whenever I change the public function to public static function in the actual module it breaks.

Here is the error I'm still getting in the logs.

PHP Strict Standards: Non-static method Screenshots::get_pilots_newscreenshot() should not be called statically, assuming $this from incompatible context in /home/xxx/public_html/lib/skins/xxx/pilot_public_profile.php on line 162

Maybe it will help to tell you want I'm trying to do. I'm trying to show the last 4 screen shots of a pilot on the public profile. I had it working fine on the public version of PHPMVS but it's not working on the 5.5.2 version. It shows that I don't have any screenshots. Here is my ugly code for this on the public profile.

<?php
echo '<table class="table">';
echo '<thead>';
echo '<tr>';
echo '<th colspan="7">'.$userinfo->firstname . ' ' . $userinfo->lastname.'\'s Last 4 Submitted Screenshots</th>';
echo '</tr>';
echo '</thead>';
$allscreenshots = ExtraData::get_pilots_newscreenshot($userinfo->pilotid, 4);
if(is_array($allscreenshots))
{
echo '<tbody>';
$tiles=0;
$rowclass = 0;
foreach($allscreenshots as $screen)
{
if ($tiles == '0')
{
echo '<tr class="row'.$rowclass.'">';
}
echo '<td align="center" valign="top">
 <a href="'.SITE_URL.'/index.php/Screenshots/large_screenshot?id='.$screen->id.'">
 <img src="'.SITE_URL.'/pics/'.$screen->file_name.'" border="0" width="200px" height="150px" />
 </a><br />
 Date: '.date('m/d/Y', ($screen->date)).'
 </td>';
$tiles++;
if ($tiles == '4')
{
echo '</tr>';
$tiles=0;
}
$rowclass = 1 - $rowclass;
}
echo '</tbody>';
}
else
{
echo '<tr><td align="center">No Screenshots Yet!!</td></tr>';
}
echo '</table>';
?>

Here's the call from ExtraData

public static function get_pilots_newscreenshot($pilot_id, $count) {
 $query = "SELECT id, file_name, file_description, pilot_id, UNIX_TIMESTAMP(date_uploaded) AS date FROM screenshots WHERE pilot_id='$pilot_id' AND file_approved='1' ORDER BY date_uploaded DESC LIMIT $count;";
 return DB::get_results($query);
}

Posted

I just noticed that in your previous post that you said you modified the module

Just to clarify, in core/modules/Screenshots/Screenshots.php

You have these

public function {

And in core/common/ScreenshotsData.class.php you have these

public static function {

If that doesn't work, then you might have to wait for Dave, you can try to hide the error in the meantime but that is not ideal

Posted

I just noticed that in your previous post that you said you modified the module

Just to clarify, in core/modules/Screenshots/Screenshots.php

You have these

public function {

And in core/common/ScreenshotsData.class.php you have these

public static function {

If that doesn't work, then you might have to wait for Dave, you can try to hide the error in the meantime but that is not ideal

That's correct. The errors are gone now but my above posted code no longer works in the 5.5.2 version. It worked fine on the previous version but I'm stumped as to way I'm now getting no errors but the screenshots are not showing up.

Posted

Maybe try this:

public static function get_pilots_newscreenshot($pilot_id, $count) {
	 $query = "SELECT id, file_name, file_description, pilot_id, UNIX_TIMESTAMP(date_uploaded) AS date FROM ".TABLE_PREFIX."screenshots WHERE pilot_id='$pilot_id' AND file_approved='1' ORDER BY date_uploaded DESC LIMIT $count;";
	 return DB::get_results($query);
}

I added the

".TABLE_PREFIX."

In front of the table name which should allow it to pick up the data now

  • 2 months later...
  • 2 weeks later...
Posted

I am having the same issue as Keith had. I have it running perfect on my main site. Having this issue on a dev site. Same server. Not sure why its not working. Does any any have the zip of this MOD?

Posted

I am having the same issue as Keith had. I have it running perfect on my main site. Having this issue on a dev site. Same server. Not sure why its not working. Does any any have the zip of this MOD?

I can zip mine up if you what that one?

  • 2 weeks later...
  • 1 month later...
  • 1 month later...
  • Administrators
Posted

phpVMS 5.5.2 - Latest version of ScreenShotCenter (see post one up from this for link)

Just in case anyone is getting this error:

Deprecated: Non-static method Screenshots::show_random_screenshot() should not be called statically, assuming $this from incompatible context in ... layout.php

Here's a possible fix - try calling it like this

$allpics = new Screenshots ();
$allpics->show_random_screenshot();

Instead of

Screenshots::show_random_screenshot();

Thanks to web541 for pointing me in the correct direction. See this post:

 

  • Like 1
  • 6 months later...
  • Moderators
Posted

Have you followed the step below?

Quote

- use the screenshotcenter.sql file to create the tables needed in your sql database using phpmyadmin or similar.

 

  • 4 weeks later...
Posted

Hi, wonderful addon, but when i try to implement it, I get this Error

 

Warning: move_uploaded_file(pics/1501323385_2017-7-26_10-58-12-492.bmp): failed to open stream: No such file or directory in /home/iflyva/public_html/icrew/core/modules/Screenshots/Screenshots.php on line 75

Warning: move_uploaded_file(): Unable to move '/tmp/phpFhZe3o' to 'pics/1501323385_2017-7-26_10-58-12-492.bmp' in /home/iflyva/public_html/icrew/core/modules/Screenshots/Screenshots.php on line 75   


I created a Folder called "Pics" in the Root folder, what else to do? Can anyone Help? Thanks in Advance :)

 
  • Moderators
Posted

The folder is called "Pics" or "pics"? The folder should be called "pics" (it is case sensitive) and you should update the folder permissions too based on the installation instructions.

Posted
13 minutes ago, servetas said:

The folder is called "Pics" or "pics"? The folder should be called "pics" (it is case sensitive) and you should update the folder permissions too based on the installation instructions.

Just Checked, its pics, its placed under Core. it had an "index.php" which was blank...

Posted (edited)
4 hours ago, servetas said:

The pics folder should be placed in the main folder of your phpVMS system (where admin, core and lib folders are located).

Okay, thanks. I'll check it out :)

EDIT : Browser says "Uploading", and once its done, it refreshes, and nothing happens... even checked the approval list. nothing there too

 

Edited by LeonardIGO4036
commented without checking.
  • 3 weeks later...
Posted
On 7/29/2017 at 8:48 PM, LeonardIGO4036 said:

Okay, thanks. I'll check it out :)

EDIT : Browser says "Uploading", and once its done, it refreshes, and nothing happens... even checked the approval list. nothing there too

 

I would suggest setting folder permissions to 777 and use only jpg or png pics

  • 2 years later...
Posted (edited)
On 6/21/2016 at 3:06 AM, web541 said:

Maybe try this:

 


public static function get_pilots_newscreenshot($pilot_id, $count) {
	 $query = "SELECT id, file_name, file_description, pilot_id, UNIX_TIMESTAMP(date_uploaded) AS date FROM ".TABLE_PREFIX."screenshots WHERE pilot_id='$pilot_id' AND file_approved='1' ORDER BY date_uploaded DESC LIMIT $count;";
	 return DB::get_results($query);
}
 

 

I added the

 


".TABLE_PREFIX."
 

 

In front of the table name which should allow it to pick up the data now

@web541

Hey, This whole conversation went right over my head, however I feel my solution is somewhere in here. 

Using php 5.5.2

Module is working fine, I am trying to show pictures on my dashboard (outside of the screenshot center): 
Deprecated: Non-static method Screenshots::show_newest_screenshot() should not be called statically, assuming $this from incompatible context in /home/tstamer/public_html/crew/lib/skins/crewcenter/profile_main.php on line 167

Here is that section: 

                <div class="box-header with-border">
                    <h3 class="box-title">Most Recent Screenshot</h3>
                </div>
                <div class="box-body">
                    <?php Screenshots::show_newest_screenshot(); ?>
                </div>
            </div>

Edited by djtiger76
Posted
5 hours ago, djtiger76 said:

Module is working fine, I am trying to show pictures on my dashboard (outside of the screenshot center): 
Deprecated: Non-static method Screenshots::show_newest_screenshot() should not be called statically, assuming $this from incompatible context in /home/tstamer/public_html/crew/lib/skins/crewcenter/profile_main.php on line 167

You'll want to make sure in core/common/ScreenshotsData.class.php (or similar named file), all the

public function xxx()...

are changed to (note the word static)

public static function xxx()...

 

Then if that doesn't work, instead of this

<?php Screenshots::show_newest_screenshot(); ?>

Try this

<?php
$screenshot = new Screenshots();
$screenshot->show_newest_screenshot();
?>

 

  • Thanks 1
  • 1 month later...
  • Moderators
Posted

Yeah, you should be able to do that. Open your core/modules/Screenshots/Screenshots.php file and find the following statement:

ScreenshotsData::send_message($who_to, $who_from, $subject, $message);

There should be two of these statements in the above mentioned file. One of them is within the "approve_screenshot" function and the second one is within the "reject_screenshot" function. Below the above mentioned statement you can add the following:

$pilotdata = PilotData::getPilotData($who_to);
$subject = "Screenshot Approved or Rejected";
$message = "Congratulations, you screenshot has been approved. etc";
Util::SendEmail($pilotdata->email, $subject, $message);

You can update any of the above variables (subject or message) to send the right message for "reject_screenshot" too. You can also comment out the statement that exists to send the airmail to the pilot like this:

//ScreenshotsData::send_message($who_to, $who_from, $subject, $message);
Posted

Hi @servetas

one further Question...

when sending the Pilot the mail that his screenshot was rejected i would like to send him the reason aswell.

The Reason is inserted as comment to the screenshot before rejection.

I tried with this code but no comment is displayed in the Mail?

 

$comment = ScreenshotsData::get_comments($ss_id);
$message = "Dear $pilot->firstname $pilot->lastname,"
."<br> unfortunately your screenshot has been rejected."
."<br> Reason: $comment->comment"

Thanks in advance for your help.

  • Moderators
Posted

Open your core/ScreenshotsData.class.php file and find this:

public static function get_comments($ss_id)   {
        $query = "SELECT * FROM ".TABLE_PREFIX."screenshots_comments
                    WHERE ss_id='$ss_id'";

        return DB::get_results($query);
    }

add the following after the closing bracket of the above statement:

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);
}

Then, within your code replace:

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

with this:

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

Let us know if it worked for you. 

 

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...