head	1.1;
access;
symbols;
locks
	root:1.1; strict;
comment	@# @;


1.1
date	2024.10.01.13.02.02;	author root;	state Exp;
branches;
next	;


desc
@as i found it. works - but changing from "cating" start.html to CGI.pm code within index.cgi.
-bert
@


1.1
log
@Initial revision
@
text
@#!/usr/bin/perl

use lib qw (/var/www/www.rcflightpath.com/lib);
use POSIX qw(strftime);
use CGI qw(:standard :html3 :all *table *Tr *td unescape);
use CGI::Cookie;

use Templates::Navbar;
use Templates::Header;
use Templates::Footer;

$topic = param('topic');
$user_agent = user_agent();

$keywords = 'RC Helicopter, PID Tuning, Blackbox Analysis, Rotorflight, Betaflight, PID Traces, Blackbox Explorer, Flight Controller Tuning, RC Heli Setup, RC Helicopter PID Settings, RC Flight Tuning, RC Helicopter Optimization, Betaflight Blackbox, Rotorflight PID Tuning, PID Toolbox, Joshua Bardwell, JevFPV, RC Helicopter Trace Identification';

if ($topic eq 'start') {
  $page_desc = 'RC Helicopter, PID Tuning, Blackbox Analysis, Rotorflight, Betaflight, Blackbox Explorer, Flight Controller Tuning, RC Heli Setup, Blackbox Diagnostics, RC Helicopter PID Settings, RC Flight Tuning, Blackbox Diagnostics, RC Helicopter Optimization, Betaflight Blackbox, Rotorflight PID Tuning, PID Toolbox, Joshua Bardwell, JevFPV, RC Helicopter Trace Identification';
  $title1 = '<i><font color=007cc7>ROTOR</font><font color=white>FLIGHT</font></i> - Blackbox PID Tuning';
  $title2 = 'RC Helicopter Tuning Guide - Rotorflight Blackbox Blackbox Trace Identification';
} elsif ($topic eq 'guide') {
  $page_desc = 'learn how to analyze blackbox logs, understand rc helicopter pid tuning, how to blackbox tune rotorflight, how to pid tune rc helicopters, PID Traces, D-Term Tuning, P-Term Tuning, I-Term Tuning, blackbox tuning rotorflight flybarless systems, pid tuning flybarless flight controls, how to pid tune using blackbox explorer';
  $title1 = '<i><font color=007cc7>ROTOR</font><font color=white>FLIGHT</font></i> - Guide to Blackbox PID Trace Analysis';
  $title2 = 'RC Helicopter Rotorflight Blackbox Tuning Guide';
} elsif ($topic eq 'math') {
  $page_desc = 'Mathematical equations for PID tuning, PID equations, math for control theory, calculating PID Error, calculating PID sum, math for PID rate of change, equation for P-term, equation for I-term, equation for D-term, calculating Feed Forward in PID systems';
  $title1 = '<i><font color=007cc7>ROTOR</font><font color=white>FLIGHT</font></i> - Equations for PID Tuning';
  $title2 = 'RC Helicopter RotorFlight - PID Tuning Equations for Blackbox Data';
} elsif ($topic eq 'model') {
  $page_desc = 'Oxy 5 Stretched PID tuning, Oxy RC helicopter tuning, Goblin helicopter pid tuning, vbar pid tuning, ikon pid tuning, RotorFlight PID tuning guide for Oxy RC Helicopters, Blackbox trace analysis for Oxy 5, High-performance Oxy 5 Meg RC helicopter tuning, Oxy 5 Meg RC helicopter PID tuning, Helicopter PID tuning with RotorFlight for Oxy 5, Oxy 5 stability and response tuning guide, Best servo tuning for RC helicopters, RC helicopter flight controller setup';
  $title1 = '<i><font color=007cc7>ROTOR</font><font color=white>FLIGHT</font></i> - Blackbox PID Tuning the Oxy 5 Meg';
  $title2 = 'RC Helicopter ROTORFLIGHT - Guide to analyze Blackbox Trace Identification for Oxy 5 RC Helicopters';
} elsif ($topic eq 'links') {
  $page_desc = 'links to help analyze blackbox traces, Useful PID tuning Links, PID Tuning examples on youtube, videos to learn PID tuning, videos for learning blackbox explorer tuning, learn more pid tuning';
  $title1 = '<i><font color=007cc7>ROTOR</font><font color=white>FLIGHT</font></i> - Blackbox PID Tuning - Useful Links';
  $title2 = 'RC Helicopter ROTORFLIGHT - Guide to analyze Blackbox Trace Identification for Oxy 5 RC Helicopters';
} elsif ($topic eq 'hz2rpm') {
  $page_desc = 'Rotorflight filters and vibrations, rotorflight tuning filters, rc helicopter understanding vibrations and how to fix them, rotorflight vibration and filters';
  $keywords = 'Rotorflight blackbox PID tuning, RC Helicopter blackbox tuning, RC Helicopter PID tuning, RC Helicopter feed forward tuning, RC Helicopter P-term tuning, RC Helicopter I-term tuning, RC Helicopter D-term tuning';
  $title1 = '<i><font color=007cc7>ROTOR</font><font color=white>FLIGHT</font></i> - Blackbox PID Tuning - Hertz to RPM';
  $title2 = 'RC Helicopter ROTORFLIGHT - Hertz to RPM reference table to track vibrations';
} elsif ($topic =~ /(gov)/) {
  $page_desc = 'Rotorflight Blackbox PID Tuning Guide for Rotorflight governor, oscillations in governor PID controls';
  $title1 = '<i><font color=007cc7>ROTOR</font><font color=white>FLIGHT</font></i> - Blackbox PID Trace Tuning your Governor';
  $title2 = 'RC Helicopter ROTORFLIGHT - Guide To Tuning Governors using Blackbox Trace Identification';
} else {
  $page_desc = 'Flydragon F722 v2 blackbox tuning, FlyWing Heli 405 blackbox tuning, Matek G474-HELI blackbox tuning, Radiomaster Nexus blackbox tuning';
  $title1 = '<i><font color=007cc7>ROTOR</font><font color=white>FLIGHT</font></i> - Guide to Blackbox PID Trace Analysis';
  $title2 = 'RC Helicopter ROTORFLIGHT - Guide for Blackbox Trace Identification';
}


if ($topic) {
  if (-e "$topic.html") {
    $filepath = "$topic.html";
  } elsif (-e $topic) {
    $filepath = $topic;
  } else {
    $filepath = 'File not found';
  }
} else {
  $filepath = '/var/www/www.rcflightpath.com/articles/pid-tuning/rotorflight/index.cgi';
}

charset('UTF-8');

if (-e 'style.css') {
  $style = 'style.css';
} elsif (-e '../style.css') {
  $style = '../style.css';
} else {
  $style = '/style.css';
}

print  start_html(
         -title=> $title2,
         -style=> {'src' => $style},
         -meta=>  {'viewport'=>'width=device-width, initial-scale=1.0','description'=>$page_desc,'keywords'=>$keywords}
       ),"\n";

print start_table({-border=>0,-margin=>0,-topmargin=>0,-cellpadding=>0,-cellspacing=>0,-width=>900}),"<!-- START MAIN TABLE -->\n",
       start_Tr,"<!-- START HEADER -->\n",
        start_td({-colspan=>2}),"\n";
         Header::print_titlebar($title1,$filepath,'FFFFFF');
print   end_td,"\n",
       end_Tr,"<!-- END HEADER -->\n",
       start_Tr,"<!-- START NAVBAR -->\n",
        start_td({-valign=>'top',-rowspan=>3}),"\n";
         Navbar::default('rf');
print   end_td,"<!-- END NAVBAR -->\n",
        start_td({-valign=>'top'}),div({-id=>'main'}),"<!-- START CONTENT -->\n";
         &print_content;
print   end_td,"\n",
       end_Tr,"<!-- END CONTENT -->\n",
       start_Tr,"<!-- START FOOTER -->\n",
        start_td({-align=>'center'}),"\n";
         Footer::print_footer;
print   end_td,"\n",
       end_Tr,"<!-- END FOOTER -->\n",
      end_table,"<!-- END MAIN TABLE -->\n",
     end_html;

sub print_content {
  if ((-e $filepath)&&($filepath !~ /(index\.cgi)$/)) {
    open (FILE,$filepath);
    while(<FILE>) {
      print;
    }
    close FILE;
  } else {
    open (FILE,"start.html");
    while(<FILE>) {
      chomp;
      print;
    }
    close FILE;
  }
}


@
