protected function check ($version)
{
$version_to_check = $version;
// make the cURL request
$curl = curl_init('http://www.savamarkovic.com/loa.csv');
curl_setopt($curl, CURLOPT_FAILonerror, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$read = curl_exec($curl);
if ($read[0] > $version_to_check && $read[2] == "1") { $critical = TRUE; } // If its 1, set ciritcal to true
if ($read[0] > $version_to_check) { $update = TRUE; } // Anything other than 1 set update to true
if ($read[0] == $version_to_check) {
echo '<p id="success">Your version of this module is up to date. Wohooooo! )</p>';
}else if ($critical) {
echo '<h4>CRITICAL UPDATE FOUND!</h4>';
echo '<p id="error">There is a critical update available! Here is the information associated with the update. <br/><b>Version:
'.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
}else if ($update){
echo '<h4>NON CRITICAL UPDATE FOUND!</h4>';
echo '<p id="error" style="background:#fffca7;border-color:orange">There is NON critical update available! Here is the information associated with the update. <br/><b>Version:
'.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
}
}
If I change the onerror to onerror the errors go away but I no longer get the update box either. The onerror should be all caps, but for some damn reason this thing won’t capitalize them.
I already post for that copy/paste this in your admin/modules/LoA/LoA.php
<?php
/**
* Leave of Absence (LoA) v.1.0 Module
*
* phpVMS Module for pilots to submit a LoA request that is stored in a database
* and an option for staff to view all the LoA requests through the admin panel
* This module is released under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
* You are free to redistribute and alter this work as you wish but you must keep the original 'copyright' information on all the places it comes in the original work.
* You are not allowed to delete the copyright information and/or gain any profit by adopting or using this module.
*
* @author Sava Markovic - savamarkovic.com
* @copyright Copyright (c) 2012, Sava Markovic
* @link http://www.savamarkovic.com
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
*/
class LoA extends CodonModule {
public $title = "Leave of Absence Admin";
public function HTMLHead()
{
$this->set('sidebar', 'loa/loa_admin_sidebar.tpl');
}
public function NavBar ()
{
echo '<li><a href="'.SITE_URL.'/admin/index.php/LoA">LoA Admin</a></li>';
}
public function index ()
{
$version = '1.0';
$leaves = LoAData::GetAllRequests(array());
$this->set('all_leaves', $leaves);
$this->render('loa/loa_admin_index.tpl');
$this->check($version);
}
public function viewLOA()
{
$id = $this->get->id;
$getinfo = LoAData::GetInfoByID($id);
$this->set('info', $getinfo);
$this->render('loa/loa_admin_view_request.tpl');
}
public function confirmDeleteLOA()
{
$id = $this->get->id;
$getinfo = LoAData::GetInfoById($id);
$this->set('info', $getinfo);
$this->render('loa/loa_admin_confirm_delete_request.tpl');
}
public function deleteLOA()
{
$id = $this->get->id;
$getinfo = LoAData::DeleteLoA($id);
if (mysql_affected_rows() == -1)
{
$this->set('message', 'The LoA Reqest hasn\'t been deleted from the database for some reason. This isn\'t suppose to happen. Check the phpVMS forums for support.');
$this->render('loa/loa_admin_delete_request.tpl');
}
else
{
$this->set('message', 'The LoA Reqest has been successfuly deleted from the database.');
$this->render('loa/loa_admin_delete_request.tpl');
}
}
protected function check ($version)
{
$version_to_check = $version;
// make the cURL request
$url = 'http://www.savamarkovic.com/loa.csv';
$file = new CodonWebService();
$read = @$file->get($url);
if ($read[0] > $version_to_check && $read[2] == "1") { $critical = TRUE; } // If its 1, set ciritcal to true
if ($read[0] > $version_to_check) { $update = TRUE; } // Anything other than 1 set update to true
if ($read[0] == $version_to_check) {
echo '<p id="success">Your version of this module is up to date. Wohooooo! )</p>';
}else if ($critical) {
echo '<h4>CRITICAL UPDATE FOUND!</h4>';
echo '<p id="error">There is a critical update available! Here is the information associated with the update. <br/><b>Version:
'.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
}else if ($update){
echo '<h4>NON CRITICAL UPDATE FOUND!</h4>';
echo '<p id="error" style="background:#fffca7;border-color:orange">There is NON critical update available! Here is the information associated with the update. <br/><b>Version:
'.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
}
}
}
Jut installed this with ver 5.5 running. on the Pilot Side emails being sent ok,2 issues. How can the pilot select a start date? and the following errors are shown, no data being sent to DB.
Strict Standards: Non-static method LoAData::CheckPilotID() should not be called statically, assuming $this from incompatible context in /var/www/vhosts/…com/core/modules/LoA/LoA.php on line 66
Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/vhosts//…com.com/core/common/LoAData.class.php on line 24
Warning: mysql_query(): Access denied for user ‘’@‘localhost’ (using password: NO) in /var/www/vhosts//…com.com/core/common/LoAData.class.php on line 24
Warning: mysql_query(): A link to the server could not be established in /var/www/vhosts//…com.com/core/common/LoAData.class.php on line 24
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /var/www/vhosts//…com.com/core/common/LoAData.class.php on line 25
Strict Standards: Non-static method LoAData::AddLoa() should not be called statically, assuming $this from incompatible context in /var/www/vhosts//…com.com/core/modules/LoA/LoA.php on line 76
Your leave of absence request has been submitted. You will recieve an email confirming your details. There is no further action required on your part.
On the ADmin page:
Strict Standards: Non-static method LoAData::GetAllRequests() should not be called statically, assuming $this from incompatible context in /var/www/vhosts/…com.com/admin/modules/LoA/LoA.php on line 35
I just installed this module, i got following issues :
Admin Panel :
Strict Standards : Non-static method LoAData::GetAllRequests() should not be called statically, assuming $this from incompatible context in /home/vaemirat/public_html/admin/modules/LoA/LoA.php on line 35
On the site, where it should show up :
Notice : The template file “/home/vaemirat/public_html/core/templates/loa/loa_index.php” doesn’t exist in /home/vaemirat/public_html/core/classes/TemplateSet.class.php on line 231
Also everything to go with that connect is deprecated as well.
mysql_num_rows() is now mysqli_num_rows()
Same thing with the connection error. Etc etc. Basically this module needs help. The code it runs on was deprecated. “This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used.” php Manual
I’m working on it but I suck at this stuff. I fixed this issue once on another module and not sure how I did it now.
Check this out too
mysqli_query is now used instead of mysql_query. You can also use PDO::query or MySQLi::query. You can see the documentation here
This module has been written a long time ago, and even then it was far from perfect. I believe there is a newer version I did a few months after the initial one and never uploaded it to GitHub. I’ll check and upload if so.
I have been fiddling with this for a couple hours and no such love. I fixed this issue once before in another project I was working on like it was nothing. Now, it is nothing lol as I can not fix it. I am going to loose sleep over it now. I am REAL OCD like that.
I sounded a couple of alarms for help from people I know. Hopefully someone will chime in and help us all out.