Jump to content

Felipe

Members
  • Posts

    47
  • Joined

  • Last visited

Posts posted by Felipe

  1. On 25/08/2012 at 0:11 PM, Kyle said:

    Manuel,

    I found the bug. ;) (smacks bug with hand!)

    Head to SchedulesData.class.php and go to line 861.

    Look for the function...

     

    
    public static function deleteExpiredBids()
    
     

     

    Inside of the function, replace the whole function with this... my modification.

     

    
    public static function deleteExpiredBids() {
    
        $cache_time = Config::Get('BID_EXPIRE_TIME');
        if ($cache_time == '') {
    	    return;
        }
    
        /* Make sure the schedule bidids */
        $sql = 'SELECT * FROM ' . TABLE_PREFIX . "bids
                   WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()";
    
        $results = DB::get_results($sql);
        if (count($results) > 0) {
    	    foreach ($results as $row) {
    		    $sql = 'UPDATE ' . TABLE_PREFIX . "schedules
                           SET `bidid`=0 WHERE `id`={$row->routeid}";
    
    		    DB::query($sql);
    	    }
        }
    
     

     

    And that issue should not be a pain again. ;)

     

     

    I tried Kyle's suggestion above and still was getting an error.

    So I made some changes on it and now it's working fine. Finally I don't need an extra script on my server just to remove expired bids... 

    Thanks Kyle for the great help! :D

     

    public static function deleteExpiredBids(){
    	$cache_time = Config::Get('BID_EXPIRE_TIME');
    	if($cache_time == ''){ return; }
    	$selectbids = 'SELECT * FROM ' . TABLE_PREFIX . "bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()";
          $results = DB::get_results($selectbids);
          $deletebids = 'DELETE FROM '.TABLE_PREFIX."bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()";
    	if(count($results) > 0){
    		foreach ($results as $row){
    			DB::query($deletebids);
    			$updateschedules = 'UPDATE ' . TABLE_PREFIX . "schedules SET `bidid`=0 WHERE `id`={$row->routeid}";
    			DB::query($updateschedules);
    		}
    	}
    }

     

     

  2. Hi, everybody!

    I'm trying to translate those messages in the Activity Feed, on phpVMS 5.5.x, such as "PILOT_NAME has just joined, welcome aboard!" or "PILOT_NAME has been promoted to NEW_RANK".

    Those kind of messages are inserted on phpvms_activiityfeed table in the database. I've searched the class, the module and the template files to try to find where those messages are coming from, so I can translate them into portuguese, but I just can't find it.

    Could anybody help me with that path?

    Thank you!

    table.jpg

  3. Hello, servetas! This was my first try, but, actually, I realized the are some "" that should be shown to both logged in and not. I guesse the best solution would be working on the layout.tpl, since this part...

    <ul class="nav">
     <?php
      Template::Show('core_navigation.tpl');
     ?>
     </ul>
    

    ... fits for what I want. I just have to have an if() statement in here to check if the request is for the frontpage_main.tpl or any other .tpl.

  4. I wonder if anybody in here would help me, please, solve the following... I'm coding my web site template to have two menus, in accordance to the requested ".tpl" file. Actually, in case the user is requesting the frontpage_main.tpl, it should use one block of html tags, and in case it is any other .tpl file, it should be another block of html tags. So my question is: is there any phpVMS native class + method I can put in the if() statement to check which .tpl file the user is requesting? Id it does not, how could I solve it by simply using php?

  5. Right now, I'm trying to set this altnicao on my schedule module. Since I'm just a newbie in PHP and MySQL, I ask you guys for some help, that might be usefull to our friend Jacubovsky too.

    These are the steps I took up to now:

    1. Added a new column on phpvms_schedules

    ALTER TABLE `phpvms_schedules` ADD column `altnicao` VARCHAR( 4 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;

    2. Set the view inside a table with the other ready data on schedule_briefing.tpl. It is already working, since I tested it manually, filling the altnicao column on the DB. But I'll tell you what my "problem" is in the end.. Keep reading, please. :rolleyes:

    <th class="col-lg-3">Aeroporto de Origem</th>
     <td>
     <?="{$schedule->depname} ($schedule->depicao). ";?><em>Baixar as <a href="https://charts.aero/airport/<?=$schedule->depicao; ?>" target="_blank">cartas aéreas</a>.</em>
     </td>
     </tr>
     <tr>
     <th class="col-lg-3">Aeroporto de Destino</th>
     <td>
     <?="{$schedule->arrname} ($schedule->arricao). ";?><em>Baixar as <a href="https://charts.aero/airport/<?=$schedule->arricao; ?>" target="_blank">cartas aéreas</a>.</em>
     </td>
     </tr>
    <tr>
     <th class="col-lg-3">Aeroporto de Alternativa</th>
     <td>
    <?="{$schedule->altnname} ($schedule->altnicao). ";?><em>Baixar as <a href="https://charts.aero/airport/<?=$schedule->altnicao; ?>" target="_blank">cartas aéreas</a>.</em>
     </td>
     </tr>
    

    3. Then, I began to search in the core/modules/Schedules/Schedules.php which method I should modify. I found it at:

    public function brief($routeid = ''){
    if($routeid == '')
    {
    $this->set('message', 'You must be logged in to access this feature!');
    $this->render('core_error.tpl');
    return;
    }
    
    $schedule = SchedulesData::getScheduleDetailed($routeid);
    $this->set('schedule', $schedule);
    $this->render('schedule_briefing.tpl');
    }
    

    4. So I headed to the "public static function getScheduleDetailed($id)" at core/common/SchedulesData.class.php. Actually, It took me some lines up to this:

    public static function findSchedules($params, $count = '', $start = '')
    {
    $sql = 'SELECT s.*,
    a.id as aircraftid, a.name as aircraft, a.registration,
    a.minrank as aircraft_minrank, a.ranklevel as aircraftlevel,
    dep.name as depname, dep.lat AS deplat, dep.lng AS deplng,
    arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng
    FROM '.TABLE_PREFIX.'schedules AS s
    LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = s.depicao
    LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = s.arricao
    LEFT JOIN '.TABLE_PREFIX.'aircraft AS a ON a.id = s.aircraft ';
    
    /* Build the select "WHERE" based on the columns passed, this is a generic function */
    $sql .= DB::build_where($params);
    
    // Order matters
    if(Config::Get('SCHEDULES_ORDER_BY') != '')
    {
    $sql .= ' ORDER BY '.Config::Get('SCHEDULES_ORDER_BY');
    }
    
    if(strlen($count) != 0)
    {
    $sql .= ' LIMIT '.$count;
    }
    
    if(strlen($start) != 0)
    {
    $sql .= ' OFFSET '. $start;
    }
    
    $ret = DB::get_results($sql);
    return $ret;
    }
    

    So I guess it is in there where my problem is...

    Since I know the "$schedule->altnicao" is already woking fine on schedule_briefing.tpl, I guess that first query on that $sql variable needs some extra instructions, so I can have the "$schedule->altnname" also working on my schedule_briefing.tpl. I guess this altnicao name would come from the phpvms_airports table...

    Since I know almost nothing on inner, left or right join, I ask you guys for the solution for that, please. ;)

    Later I'll try to modified the admin schedules module to add the altnicao through the admin center, instead of directly on the DB. If I get it working, I'll post it in here. Otherwise, I'll come back for help once again.

    Thanks!

  6. I'm having a similar problem... The .htaccess is configured and URL_REWRITE e set to true. I can atually print_r the q= coming from .htaccess, but wherever I click, it only shows the homepage.

    I was having that too. I fixed it by using the CondonRewrite.class.php of David Clark's extended version on Nabeel's full version downloadable here in phpvms.net and this .htaccess. It works 100% for me now.

    # main page of the site

    DirectoryIndex index.php

    # prevent viewing of a specific file

    <FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh|tpl)$">

    Order Allow,Deny

    Deny from all

    </FilesMatch>

    # prevent viewing of index

    Options +FollowSymLinks

    Options All -Indexes

    #Can give without index.php for the modules

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php?q=$1 [L]

  7. Hello,

    I am having a weird issue with phpVMS and it counting PIREPs. It is able to count the hours just fine from the PIREPs submitted however it just sets the PIREPs for all pilots to 0. I also have this from the cron script as an error.

    Notice: A non well formed numeric value encountered in /home/gocanair/public_html/core/common/StatsData.class.php on line 171

    I am guessing that could be causing the issue. Any ideas on a fix for that?

    Thanks,

    Nick

    I'm facing this same problem, since I changed to a new hosting service on last March 9th. I have this on line 171:

    $key_month = date('MY', $start);

    Then, it makes me think it might be the date() function, since I've googled "A non well formed numeric value encountered" and it returned me...

    http://stackoverflow.com/questions/6136430/a-non-well-formed-numeric-value-encountered

    http://forums.phpfreaks.com/topic/160271-solved-a-non-well-formed-numeric-value-encountered/

    So, I've changed line 171 to...

    $key_month = date('i', $start);

    ... and I'm now expecting the cron to run to see if it works. On this new hosting, I'm using PHP 5.3.x. If I get it working again, I'll post here. :)

  8. Hello, Fernando! VAI VA is mine. This registration system I developed with the precisious help of two guys: Icaro Souza and Filipe Leandro. We made a hard php programming inside the registraion tpl. It has three steps. The first one is this that checks online, real time, if the pilot's profile on IVAO or on Vatsim matches our requirements. If so, it lets de pilot go to the second one, which is a theorical exam with 20 questions from a random query on our DB. If the pilot get 75%, then it allows him to field the registration for that comes natively in phpVMS but with some more modifications to match our needs.

    And more.. In case the pilot fails the exam or does not have the requirements it blocks him for 7 days (in case of failing the exam) and for the time needed until he/she gets the requierements on IVAO/Vatsim. That's it, basically.

    All I have to do then is to accept or reject the registration. There is no need to worry if the pilot matches or not the requierements because the system has already done it for me. :)

×
×
  • Create New...