DIR : /home/kozerus/public_html/ko/tl.php
/home/kozerus/public_html/ko
<?php
# tl.php 20221213_0900 tlgif
# tl.php 20221213_0700 html_bluehost html_parallels
# tl.php 20221212_0030 save=savfil
# tl.php 20221212_0000 timeaddition
# tl.php 20221211_2040
# tl.php 20221211_1222
# exit();
# phpinfo();
$progid="tl";
$dttm=date("Ymd_His");
$timezone_identifier="US/Central";
date_default_timezone_set( $timezone_identifier );
# $db3="files.db3";
# $db3="/fb/usps/usps.db3";
# $db3="usps.db3";
# $db3_default="tl/db3/tl.db3";
# $db3_default="tl.db3";
## $db3_default="/tl/db3/tl.db3"; err
## $db3_default="tl2.db3"; err
$db3_default="../tl/db3/tl.db3";
$db3_default="tl1.db3";
$db3_default="tl.db3";
$tbl_default="fb";
# $db3=$db3_default;
# $tbl=$tbl_default;
$tlid_default="tlid";
$limit=100;
$sql="";
# $sql = "";
# $sql .= "select ";
# $sql .= " startdate, enddate, headline, text, ";
# $sql .= " media, credit, caption ";
# $sql .= " from $db3 ";
# $sql .= " limit $limit ";
$nl="\n";
# $tbl="mp4";
# $tbl="files";
# $tbl="jpg";
# $tbl="tl";
# $tbl="usps";
$url=""; $request_uri=""; $query_string="";
if( isset($_SERVER['REQUEST_URI'])) { $url=$_SERVER['REQUEST_URI']; }
$php_self=$_SERVER['PHP_SELF'];
if( isset($_SERVER['REQUEST_URI'])) { $request_uri=$_SERVER['REQUEST_URI']; }
if( isset($_SERVER['QUERY_STRING'])){ $query_string=$_SERVER['QUERY_STRING']; }
$parts=parse_url($url);
$params = [];
$get_tlid = "get_tlid";
parse_str($query_string, $params);
$tlid=$tlid_default;
$tlid="";
$pf="";
$p="";
$f="";
$d1="";
$d2="";
$limit="";
$limit_default=100;
$rowid="0";
$fmt="";
$save=""; $savefile="";
$help="";
if( isset($params['db3'] )) { $db3=$params['db3']; } else { $db3=$db3_default; }
if( isset($params['tbl'] )) { $tbl=$params['tbl']; } else { $tbl=$tbl_default; }
if( isset($params['tlid'] )) { $tlid=$params['tlid']; }
if( isset($params['pf'] )) { $pf=$params['pf']; }
if( isset($params['p'] )) { $p=$params['p']; }
if( isset($params['f'] )) { $f=$params['f']; }
if( isset($params['d1'] )) { $d1=$params['d1']; }
if( isset($params['d2'] )) { $d2=$params['d2']; }
if( isset($params['limit'] )) { $limit=$params['limit']; }
if( isset($params['rowid'] )) { $rowid=$params['rowid']; }
if( isset($params['fmt'] )) { $fmt=$params['fmt']; }
if( isset($params['save'] )) {
$save=$params['save'];
if( $save == "" ) { $savefile="tl_$dttm.json"; }
else { $savefile = $save; }
}
if( isset($_GET['tlid'])) { $get_tlid=$_GET['tlid']; }
# $sql .= sprintf( "select * from %s order by dttm desc limit %s", $db3tbl, $limit );
# $sql .= sprintf( "select * from %s where tlid = '$tlid' order by dttm desc limit %s", $db3tbl, $limit );
# printf( "<h2>BUGS_80 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h2>\n" );
# exit();
$sql = ""; $perc='%';
$sql .= sprintf( "select * from %s ",$tbl );
# if( $tlid != "" ) { $sql .= sprintf( " where tlid='%s'", $tlid ); }
if( $tlid != "" ) { $sql .= sprintf( " where tlid like '%s'", $tlid ); }
else { $sql .= sprintf( " where tlid != '' " ); }
if( $pf != "" ) { $sql .= sprintf( " and pathfile like '%s%s%s'", $perc,$pf,$perc ); }
if( $p != "" ) { $sql .= sprintf( " and path like '%s%s%s'", $perc,$p,$perc ); }
if( $f != "" ) { $sql .= sprintf( " and base like '%s%s%s'", $perc,$f,$perc ); }
if( $d1 != "" ) { $sql .= sprintf( " and startdate >= '%s'", $d1 ); }
if( $d2 != "" ) { $sql .= sprintf( " and enddate <= '%s'", $d2 ); }
if( $rowid > 0 ) { $sql .= sprintf( " and rowid == %s", $rowid ); }
else { $sql .= sprintf( " and rowid>%s ",$rowid ); }
$sql .= sprintf( " and status is NULL" );
$sql .= sprintf( " order by startdate,starttime desc " );
if( $tlid == '' ) {
$sql .= sprintf( " limit %s",$limit_default );
}
else {
if( $limit > 0 ) { $sql .= sprintf( " limit %s",$limit ); }
}
$sql .= ";\n";
if( isset($params['help'] )) {
$html_help = html_help($db3,$tbl,$tlid,$pf,$p,$f,$d1,$d2,$limit,$fmt);
echo "$html_help";
exit();
}
# echo "BUGS_51 tlid=$tlid<br>\n";
if( $savefile != "" ) {
if(file_exists($savefile)) {
printf( "<h1>ERR_109 EXISTS savefile=$savefile</h1>\n" );
exit();
}
printf( "<h1>MSG_110 savefile=$savefile</h1>\n" );
$json = db3_json($db3, $tbl, $tlid, $sql );
$myfile = fopen($savefile,"w") or die( "ERR_111 savefile=$savefile" ) ;
fwrite($myfile,$json);
fclose($myfile);
}
# printf( "<h1>BUGS_110 db3=$db3 tbl=$tbl tlid=$tlid fmt=$fmt sql=$sql </h1>\n" );
if(preg_match("/json/", $fmt)) {
$json = db3_json($db3, $tbl, $tlid, $sql );
header('Content-Type: application/json; charset=utf-8');
echo $json;
exit();
}
# printf( "<h1>BUGS_125 db3=$db3 tbl=$tbl tlid=$tlid fmt=$fmt sql=$sql</h1>\n" );
if(( $fmt == "" ) || ( $fmt == "html" )) {
$html = html($db3,$tbl,$tlid,$sql);
echo "$html";
exit();
}
if( $tlid == "" ) {
$html .= html_menus($db3,$tbl,$tlid,$sql);
echo "$html";
exit();
}
echo "BUGS_100 UNSUPPORTED fmt=$fmt<br>\n";
exit();
# $json = ajaks_0($db3, $sql );
# $json = ajaks_tl($db3, $sql );
# printf( $json );
exit();
function html_menus($db3,$tbl) {
$dttm=date("Ymd_His");
$sql = "select tlid, count(*) cnt from $tbl group by tlid";
# printf( "BUGS_150 db3=$db3 tbl=$tbl sql=$sql<br>\n" );
$html = "";
$html .= "<hr color=black>\n";
$html .= "<hr color=white>\n";
$html .= "<div id=div_menus>\n";
$html .= " <h2>menus</h2>\n";
$html .= " <h2>db3=$db3 tbl=$tbl</h3>\n";
$html .= "<hr color=black>\n";
$html .= "<hr color=white>\n";
$html .= html_menu_tlid($db3,$tbl);
$html .= "<hr color=black>\n";
$html .= "<hr color=white>\n";
$html .= html_menu_tbl($db3);
$html .= "<hr color=white>\n";
$html .= "<hr color=black>\n";
$html .= html_menu_db3();
$html .= "<hr color=white>\n";
$html .= "<hr color=black>\n";
$html .= html_menu_json();
$html .= "<hr color=white>\n";
$html .= "<hr color=black>\n";
$html .= " </div id=div_menus_end>\n";
$html .= "<hr color=white>\n";
$html .= "<hr color=black>\n";
$html .= html_coffee('RoyalOne');
$html .= "       ";
$html .= html_bluehost('/track/konet');
$html .= "       ";
$html .= html_parallels('?partner=konet');
$html .= " </div>\n";
# $html .= " </body>\n";
# $html .= " </html>\n";
return($html);
}
function html_menu_db3() {
$html = "";
$j=0;
$html .= "<img src=/imgs/btn/koeye.png id=img_menu_db3 ";
$html .= " onclick=\"toggle('div_menu_db3');return false;\" height=20>menu_db3";
$html .= "<div id=div_menu_db3>\n";
$html .= " <h1>menu_db3</h1>\n";
$html .= " <table id=table_db3>\n";
$html .= " <tr><td width=50>num</td><td width=400>link</td></tr>\n";
$syscmd='find tl -name "*.db3"';
$j=0; $html_menu_db3=""; $tbl="";
# $db3s=system($syscmd);
$db3list=shell_exec($syscmd);
$db3s = preg_split("/\n/", $db3list, -1, PREG_SPLIT_NO_EMPTY);
foreach ( $db3s as $db3 ) {
$j=$j+1;
$url = "$j <a href=/tl.php?db3=$db3>$db3</a><br>";
$html .= "<tr><td>$j</td><td>$url</td></tr>\n";
}
$html .= " </table id=table_db3_end>\n";
$html .= " </div id=div_menu_db3_end>\n";
return($html);
}
function html_menu_tlid($db3, $tbl) {
if( $db3 == "" ) { return(""); }
$sql="select tlid,count(*) cnt from $tbl group by tlid";
$db = new SQLite3($db3);
$result = $db->query($sql); //->fetchArray(SQLITE3_ASSOC);
$html = "";
$j=0;
$tlid="";
$cnt="";
$nl="\n";
$html .= "<img src=/imgs/btn/koeye.png id=img_menu_tlid ";
$html .= " onclick=\"toggle('div_menu_tlid');return false;\" height=20>menu_tlid";
$html .= "<div id=div_menu_tlid>\n";
$html .= " <h1>menu_tlid</h1>\n";
$html .= " <table id=table_tlid>\n";
$html .= " <tr><td width=50>num</td><td width=400>link</td><td width=50>cnt</td></tr>\n";
while($row = $result->fetchArray(SQLITE3_ASSOC)){
$tlid=""; $cnt="";
if(isset($row['tlid'])) { $tlid=$row['tlid']; }
if(isset($row['cnt'])) { $cnt=$row['cnt']; }
if( $tlid == "." ) { continue; }
$j=$j+1;
$url="<a href=/tl.php?db3=$db3&tbl=$tbl&tlid=$tlid >$tlid</a>\n";
$html .= "<tr><td>$j</td><td>$url</td><td>$cnt</td></tr>\n";
}
$html .= " </table id=table_tlid>\n";
$html .= " </div id=div_menu_tlid_end>\n";
return($html);
}
function html_menu_tbl($db3) {
$sql="select * from sqlite_master where sql like '%tlid%'";
$sql="select * from sqlite_master";
if( $db3 == "" ) { return(""); }
# printf( "<h1>BUGS_230 db3=$db3 sql=$sql</h1>\n" );
$db = new SQLite3($db3);
$result = $db->query($sql); //->fetchArray(SQLITE3_ASSOC);
$html = "";
$j=0;
$tbl="";
$nl="\n";
$html .= "<img src=/imgs/btn/koeye.png id=img_menu_tbl ";
$html .= " onclick=\"toggle('div_menu_tbl');return false;\" height=20>menu_tbl";
$html .= "<div id=div_menu_tbl>\n";
$html .= " <h1>menu_tbl</h1>\n";
$html .= " <h2>$db3=$db3 sql=$sql</h2>\n";
$html .= " <table id=table_tbl>\n";
$html .= " <tr><td width=50>num</td><td width=400>link</td></tr>\n";
while($row = $result->fetchArray(SQLITE3_ASSOC)){
if(isset($row['tbl_name'])) { $tbl=$row['tbl_name']; } else { $tbl="-"; }
if(isset($row['sql'])) { $sql=$row['sql']; } else { $sql="-"; }
$j=$j+1;
# if(! preg_match("/*tlid*/", $sql)) { continue; }
$url="<a href=/tl.php?db3=$db3&tbl=$tbl >$tbl</a>\n";
$html .= "<tr><td>$j</td><td>$url</td></tr>\n";
}
$html .= " </table id=table_tbl>\n";
$html .= " </div id=div_menu_tbl_end>\n";
return($html);
}
function html_menu_json() {
$j=0;
$html = "";
$html .= "<img src=/imgs/btn/koeye.png id=img_menu_json ";
$html .= " onclick=\"toggle('div_menu_json');return false;\" height=20>menu_json";
$html .= "<div id=div_menu_json>\n";
$html .= " <h1>menu_json</h1>\n";
$html .= " <table id=table_json>\n";
$html .= " <tr><td width=50>num</td><td width=400>link</td></tr>\n";
$syscmd='find tl -name "*.json"';
# printf( "<h1>BUGS_210 syscmd=$syscmd</h1>\n" );
# $jsons_list=system($syscmd);
$jsonlist=shell_exec($syscmd);
$jsons = preg_split("/\n/", $jsonlist, -1, PREG_SPLIT_NO_EMPTY);
foreach ( $jsons as $json ) {
$j=$j+1;
# printf( "<h1>BUGS_270 j=$j json=$json</h1>\n" );
# $url="<a href=/tl.html?tlid=$json target=_blank>$json</a>";
$url="<a href=/tl.php?tlid=$json target=_blank>$json</a>";
$html .= "<tr><td>$j</td><td>$url</td></tr>\n";
}
$html .= " </table id=table_json_end>\n";
$html .= " </div id=div_json_end>\n";
return($html);
}
function html_help($db3,$tbl,$tlid,$pf,$p,$f,$d1,$d2,$limit,$fmt) {
$dttm=date("Ymd_His");
$html = "";
$html .= "<html>\n";
$html .= "<head>\n";
$html .= " <title>tl.php help $dttm</title>\n";
$html .= html_scripts_konet();
$html .= " </head>\n";
$html .= "<body bgcolor=linen>\n";
$html .= " <hr color=black>\n";
$html .= " <hr color=white>\n";
$html .= " <div id=div_help>\n";
$html .= " <h1>help</h1>\n";
$html .= " db3=$db3<br>\n";
$html .= " tbl=$tbl<br>\n";
$html .= " tlid=$tlid<br>\n";
$html .= " pf=$pf<br>\n";
$html .= " p=$p<br>\n";
$html .= " f=$f<br>\n";
$html .= " d1=$d1<br>\n";
$html .= " d2=$d2<br>\n";
$html .= " limit=$limit<br>\n";
$html .= " rowid=$db3<br>\n";
$html .= " fmt=$fmt|html|json<br>\n";
$html .= " save=savefile.json|tl_20221212_0231.json\n";
$html .= " </div>\n";
$html .= " <hr color=white>\n";
$html .= " <hr color=black>\n";
$html .= html_coffee('RoyalOnd');
$html .= "       ";
$html .= html_bluehost('/track/konet');
$html .= "       ";
$html .= html_parallels('partner=konet');
$html .= " </body>\n";
$html .= " </html>\n";
return($html);
}
function html($db3,$tbl,$tlid,$sql) {
$dttm=date("Ymd_His");
# printf( "<h1>BUGS_350 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h1>\n" );
# exit;
$html = "";
$html .= "<html>\n";
$html .= "<head>\n";
$html .= " <title>tl.php html $dttm</title>\n";
# $html .= " <script src=\"/js/jquery-1.8.3.js\" ></script>\n";
# $html .= " <script src=\"/js/jquery-ui-1.9.2.custom.js\" ></script>\n";
$html .= " <script src=\"/tl/lib/js/storyjs-embed.js\" ></script>\n";
$html .= " <script src=\"/tl/lib/js/jquery-min.js\" ></script>\n";
$html .= html_scripts_konet('');
$html .= " <script id=\"script_tl\" >\n";
# $html .= " tl_source='$json';\n";
# $html .= " tl_source='tl.json',\n";
# $html .= 'tl_source=\'{ "timeline": {';
# $html .= '"headline":"jtfdc_20210917_1627_mail_speedy_notime2talk.mp4",';
# $html .= '"type":"default",';
# $html .= '"text":"<a href=\'/fb/usps/mp4/jtfdc_20210917_1627_mail_speedy_notime2talk.mp4\' target=_blank><img src=\'/imgs/btn/btn_mp4.png\' height=200></a>",';
# $html .= '"startDate":"1900,1,1",';
# $html .= '"endDate":"1900,1,1",';
# $html .= '"date": [ ';
# $html .= '{';
# $html .= '"startDate":"1900,1,1",';
# $html .= '"endDate":"1900,1,1",';
# $html .= ' "headline":"jtfdc_20210917_1627_mail_speedy_notime2talk.mp4",';
# $html .= '"text":"<a href=\'/fb/usps/mp4/jtfdc_20210917_1627_mail_speedy_notime2talk.mp4\' target=_blank><img src=\'/imgs/btn/btn_mp4.png\' height=200></a>",';
# $html .= '"asset": {';
# $html .= ' "media":"/fb/usps/mp4/jtfdc_20210917_1627_mail_speedy_notime2talk.mp4",';
# $html .= ' "credit":" credit 4",';
# $html .= ' "caption":"caption"';
# $html .= ' } } ] } }';
# $html .= '\';';
$html .= " \$(document).ready(function () {\n";
$html .= " createStoryJS({\n";
$html .= " type: 'timeline',\n";
$html .= " width: '1400',\n";
$html .= " height: '800',\n";
if(preg_match("/.json/", $tlid)) {
$html .= " source: '$tlid',\n";
}
else {
# printf( "<h1>BUGS_400 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h1>\n" );
# exit();
$json=db3_json($db3,$tbl,$tlid, $sql);
# printf( "<h1>BUGS_410 json=$json</h1>\n" );
# printf( "<h1>BUGS_411 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h1>\n" );
# exit();
$html .= " source: $json,\n";
}
$html .= " embed_id: 'my-timeline',\n";
$html .= " debug: true\n";
$html .= " });\n";
$html .= " });\n";
$html .= " </script>\n";
$html .= " </head>\n";
$html .= "<body bgcolor=linen>\n";
$html .= "<a href=/tl.php><img src=/imgs/btn/ko.png height=20></a>\n";
$html .= "<br>\n";
$html .= "<hr color=black>\n";
$html .= "<hr color=white>\n";
$html .= "<div id=div_tl>\n";
$html .= " <h1>ko_timeline: db3=$db3 tbl=$tbl tlid=$tlid</h1>\n";
$html .= " <h2>$dttm</h2>\n";
$html .= " <h3>$sql</h3>\n";
$html .= "<hr color=black>\n";
$html .= "<hr color=white>\n";
$html .= " <div id=\"my-timeline\"></div>\n";
$html .= " </div>\n";
$html .= "<hr color=white>\n";
$html .= "<hr color=black>\n";
$html .= html_coffee('RoyalOnd');
$html .= "       ";
$html .= html_bluehost('/track/konet');
$html .= "       ";
$html .= html_parallels('?partner=konet');
$html .= "<hr color=black>\n";
$html .= "<hr color=white>\n";
$html .= html_menus($db3,$tbl,$tlid,$sql);
$html .= "<hr color=white>\n";
$html .= "<hr color=black>\n";
$html .= " </body>\n";
$html .= " </html>\n";
return($html);
}
function ajaks_0($db3, $sql ) {
$db = new SQLite3($db3);
$data= array();
$row = array();
if( $sql == "" ) {
$sql = 'select f_name as file from mp4 where file like "%byrd%"';
}
$result = $db->query($sql);
while ($res= $result->fetchArray(1)) {
array_push($data, $res);
}
return( json_encode($data));
exit();
}
function ajaks_1($db3, $sql) {
}
function db3_json($db3, $tbl, $tlid, $sql ) {
# printf( "<h1>BUGS_460 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h1>\n" );
# exit();
if ( $db3 == "" ) { return(""); }
if ( $tbl == "" ) { return(""); }
if( $sql == "" ) {
if( $tlid == "" ) {
$sql= "select * from $tbl where tlid like '$tlid'";
}
else {
$sql= "select * from $tbl";
}
}
# $sql = 'select pathfile as file from avg where pathfile like "%byrd%"';
# if( $sql == "" ) {
# $sql = 'select startdate,enddate,headline,text,media,credit,caption from files ';
# echo "BUGS_105 default_sql: sql=$sql";
# }
# printf( "<h1>BUGS_430 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql<br>\n" );
#
$db = new SQLite3($db3);
$result = $db->query($sql); //->fetchArray(SQLITE3_ASSOC);
# $timeline = array();
# $row = array();
# $asset = array();
$i = 0;
$firsttime="yes";
$nl="\n";
$tl_json_body = "";
$j=0;
while($row = $result->fetchArray(SQLITE3_ASSOC)){
$j=$j+1;
if(!isset($row['startdate'])) continue;
# print_r($row);
# printf( "<h1>BUGS_500 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h1>\n" );
# exit();
if(!isset($row['headline'])) { $headline=""; }
if(!isset($row['text'])) { $text=""; }
if(!isset($row['startdate'])) { $startdate=""; }
if(!isset($row['enddate'])) { $enddate=""; }
if(!isset($row['media'])) { $media=""; }
else { $media=$row['media']; }
if(!isset($row['credit'])) { $credit=""; }
if(!isset($row['caption'])) { $caption=""; }
# if( isset($row['startdate'])) {
if( $media != "" ) {
# printf( "<h1>BUGS_510 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h1>\n" );
# printf( "<h1>BUGS_511 media=$media</h1>\n" );
$headline=$row['headline'];
$text=$row['text'];
$startdate=$row['startdate'];
$enddate=$row['enddate'];
$media=$row['media'];
$credit=$row['credit'];
$caption=$row['caption'];
$tlid=$row['tlid'];
$tn=$row['tn'];
# print( "<h1>BUGS_530 tlid=$tlid media=$media text=$text tn=$tn</h1>\n" );
# $text="";
# $tn=$media;
# if(( $text == "" ) || ( $text == "text" )) {
if( $text == "" ) {
if( $tn != "" ) {
$text="<a href='$media' target=_blank><img src='$tn' height=200></a>";
}
else {
$text="<a href='$media' target=_blank><img src='$media' height=200></a>";
}
}
# echo "BUGS_540 MEDIA<br> tlid=$tlid media=$media caption=$caption<br><hr> ";
if(str_contains($media,"pdf")) {
$tn="/imgs/btn/btn_pdf.png";
if(( $text == "" ) || ( $text == "text" )) {
$text="<a href='/pdf/web/viewer.html?file=$media' target=_blank><img src='$tn' height=200></a>";
}
# echo "BUGS_535 PDF text=$text";
}
if(str_contains($media,"mp3")) {
$tn="/imgs/btn/btn_mp3.png";
$text="<a href='$media' target=_blank><img src='$tn' height=200></a>";
# echo "<h1>BUGS_540 MP3 text=$text<\h1>";
}
if(str_contains($media,"mp4")) {
$tn="/imgs/btn/btn_mp4.png";
$text="<a href='$media' target=_blank><img src='$tn' height=200></a>";
# echo "<h1>BUGS_545 MP4 text=$text</h1>";
}
# sqlite3 SELECT GROUP_CONCAT(tlid,"|") FROM tbl
if( $firsttime == "yes" ) {
$headline="ko_timeline</h2>";
# $tlgif=tlgif('','');
$tlgiftn=tlgif('','tn');
$tlgif=str_replace("tn/tn_","",$tlgiftn);
# printf( "<h1>BUGS_580 tlgif=$tlgif tlgiftn=$tlgiftn</h1>\n");
$text="<a href=$tlgif target=_blank><img src=$tlgiftn width=800></a>";
$text .= "<h1>tlid=$tlid</h1>";
$text .= "<h2>tbl=$tbl db3=$db3</h2>";
$startdate="2013,01,01"; $starttime="00:00:01";
$enddate=date('now'); $enddate="23:59:59";
$tl_json_head = '';
$tl_json_head .= sprintf('{ "timeline": {%s',$nl);
$tl_json_head .= sprintf('"headline":"%s",%s',$headline, $nl);
$tl_json_head .= sprintf('"type":"default",%s',$nl);
$tl_json_head .= sprintf('"text":"%s",%s',$text, $nl);
$tl_json_head .= sprintf('"startDate":"%s",%s',$startdate, $nl);
$tl_json_head .= sprintf('"endDate":"%s",%s',$enddate, $nl);
$tl_json_head .= sprintf('"date": [ %s', $nl);
$firsttime="no";
# echo "<h1>BUGS_560 HEAD</h1>";
}
else {
# echo "<h1>BUGS_175 BODYLOOP</h1>";
# $tl_json_body = "";
$tl_json_body .= sprintf(' {%s',$nl);
$tl_json_body .= sprintf(' "startDate":"%s",%s', $startdate,$nl);
$tl_json_body .= sprintf(' "endDate":"%s",%s', $enddate,$nl);
$tl_json_body .= sprintf(' "headline":"%s",%s', $headline,$nl);
$tl_json_body .= sprintf(' "text":"%s",%s', $text,$nl);
$tl_json_body .= sprintf(' "asset": {%s',$nl );
$tl_json_body .= sprintf(' "media":"%s",%s', $media,$nl);
$tl_json_body .= sprintf(' "credit":"%s",%s', $credit,$nl);
$tl_json_body .= sprintf(' "caption":"%s"%s', $caption,$nl);
$tl_json_body .= sprintf(" } },%s",$nl);
# print( "<h1>BUGS_570 tlid=$tlid media=$media text=$text tn=$tn</h1>\n" );
# exit();
}
# print( "<h1>BUGS_590 tlid=$tlid startdate=$startdate text=$text</hr>\n" );
# exit();
$i++;
}
}
# printf( "<h1>BUGS_580 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h1>\n" );
# exit();
$tl_json_tail = "";
if(!isset($startdate)) { $startdate=""; }
if(!isset($enddate)) { $enddate=""; }
if(!isset($headline)) { $headline=""; }
if(!isset($text)) { $text=""; }
if(!isset($media)) { $media=""; }
if(!isset($caption)) { $caption=""; }
if(!isset($credit)) { $credit=""; }
if(!isset($tl_json_head)) { $tl_json_head=""; }
$tl_json_tail .= sprintf(' {%s',$nl);
$tl_json_tail .= sprintf(' "startDate":"%s",%s', $startdate,$nl);
$tl_json_tail .= sprintf(' "endDate":"%s",%s', $enddate,$nl);
$tl_json_tail .= sprintf(' "headline":"%s",%s', $headline,$nl);
$tl_json_tail .= sprintf(' "text":"%s",%s', $text,$nl);
$tl_json_tail .= sprintf(' "asset": {%s',$nl );
$tl_json_tail .= sprintf(' "media":"%s",%s', $media,$nl);
$tl_json_tail .= sprintf(' "credit":"%s",%s', $credit,$nl);
$tl_json_tail .= sprintf(' "caption":"%s"%s', $caption,$nl);
$tl_json_tail .= sprintf(" } } ] } }%s",$nl);
# printf( "<h1>BUGS_600 db3=$db3 tbl=$tbl tlid=$tlid sql=$sql</h1>\n" );
# exit();
# print_r($row);
if( $i == 0 ) {
$tl_json_head = '';
$tl_json_head .= sprintf('{ "timeline": {%s',$nl);
$tl_json_head .= sprintf('"headline": "NOTFOUND %s",%s',$headline, $nl);
$tl_json_head .= sprintf('"type":"default",%s',$nl);
$tl_json_head .= sprintf('"text":"%s",%s',$text, $nl);
$tl_json_head .= sprintf('"startDate":"%s",%s',$startdate, $nl);
$tl_json_head .= sprintf('"endDate":"%s",%s',$enddate, $nl);
$tl_json_head .= sprintf('"date": [ %s', $nl);
$firsttime="no";
# echo "BUGS_170 HEAD";
}
$json = "";
$json .= $tl_json_head;
$json .= $tl_json_body;
$json .= $tl_json_tail;
return( $json );
}
function ajaks2($db3, $sql) {
// Open a new sqlite3 DB
// $db3="avg.db3";
$db = new SQLite3($db3);
$firsttime="yes";
$nl="\n";
if ( $sql == "" ) {
$sql = 'select * from mp4 where file like "%/kt/%"';
}
$results= $db->query($sql);
$data= array();
while ($res= $results->fetchArray(1)) {
array_push($data, $res);
}
# echo json_encode($data);
return( json_encode($data));
}
# [
# {"id":1,"algorithm":"GA"},
# {"id":2,"algorithm":"PSO"},
# {"id":3,"algorithm":"IWO"},
# {"id":4,"algorithm":"OIWO"}
# ]
# $a = 'How are you?';
# $search = 'are y';
# if(preg_match("/{$search}/i", $a)) {
# echo 'true';
# }
function tl_json_text($db3, $sql ) {
$dttm=date('Ymd_His');
$yyyy=date("Y"); $m=date("m"); $d=date("d");
$nl="\n";
$tl_headline=sprintf("jtfdcr: Defford Court Report %s-%s dttm=%s", $yyyy,$m, $dttm, $nl );
$tl_text=sprintf("jtfdc_timeline: timejak dttm=%s",$dttm );
$tl_startdate=sprintf("%s,%s,%s",$yyyy,$m,$d);;
$tl_enddate=sprintf("%s",date('Y,m,d'));
$tl_json_head = <<<TL_JSON_HEAD
{ "timeline": {
"headline":"$tl_headline",
"type":"default",
"text":"$tl_text",
"startDate":"$tl_startdate",
"endDate":"$tl_enddate",
"date": [
TL_JSON_HEAD;
$tl_json_head = '';
$tl_json_head .= sprintf('{ "timeline": {%s',$nl);
$tl_json_head .= sprintf('"headline":"%s",%s',$tl_headline, $nl);
$tl_json_head .= sprintf('"type":"default",%s',$nl);
$tl_json_head .= sprintf('"text":"%s",%s',$tl_text, $nl);
$tl_json_head .= sprintf('"startDate":"%s",%s',$tl_startdate, $nl);
$tl_json_head .= sprintf('"endDate":"%s",%s',$tl_enddate, $nl);
$tl_json_head .= sprintf('"date": [ %s', $nl);
$dttm=date("Ymd_His");
$startdate=date("Y,m,d");
$enddate=date("Y,m,d");
$headline = sprintf( "headline_%s", $dttm );
$text = sprintf( "text_%s", $dttm );
$media = sprintf( "%s", "/index0.mp4" );
$credit = sprintf( "credit_%s", $dttm );
$caption = sprintf( "caption_%s", $dttm );
$tl_json_body = <<<TL_JSON_BODY
{
"startDate":"$startdate",
"endDate":"$enddate",
"headline":"$headline",
"text":"$text",
"asset": {
"media":"$media",
"credit":"$credit",
"caption":"$caption"
} },
TL_JSON_BODY;
$tl_json_body = "";
$tl_json_body .= sprintf(' {%s',$nl);
$tl_json_body .= sprintf(' "startDate":"%s",%s', $startdate,$nl);
$tl_json_body .= sprintf(' "endDate":"%s",%s', $enddate,$nl);
$tl_json_body .= sprintf(' "headline":"%s",%s', $headline,$nl);
$tl_json_body .= sprintf(' "text":"%s",%s', $text,$nl);
$tl_json_body .= sprintf(' "asset": {%s',$nl );
$tl_json_body .= sprintf(' "media":"%s",%s', $media,$nl);
$tl_json_body .= sprintf(' "credit":"%s",%s', $credit,$nl);
$tl_json_body .= sprintf(' "caption":"%s"%s', $caption,$nl);
$tl_json_body .= sprintf(" } },%s",$nl);
$dttm=date("Ymd_His");
$startdate="2019,8,6";
$enddate=date("Y,m,d");
$headline=sprintf("headline_tail_%s",$dttm );
$text=sprintf("text_tail_%s",$dttm );
$media=sprintf("%s","index0.mp4" );
$credit=sprintf("credit_tail_%s",$dttm );
$caption=sprintf("caption_tail_%s",$dttm );
$tl_json_tail = <<<TL_JSON_TAIL
{
"startDate":"$startdate",
"endDate":"$enddate",
"headline":"$headline",
"text":"$text",
"asset": {
"media":"$media",
"credit":"$credit",
"caption":"$caption"
} } ] } }
TL_JSON_TAIL;
$tl_json_tail = "";
$tl_json_tail .= sprintf(' {%s',$nl);
$tl_json_tail .= sprintf(' "startDate":"%s",%s', $startdate,$nl);
$tl_json_tail .= sprintf(' "endDate":"%s",%s', $enddate,$nl);
$tl_json_tail .= sprintf(' "headline":"%s",%s', $headline,$nl);
$tl_json_tail .= sprintf(' "text":"%s",%s', $text,$nl);
$tl_json_tail .= sprintf(' "asset": {%s',$nl );
$tl_json_tail .= sprintf(' "media":"%s",%s', $media,$nl);
$tl_json_tail .= sprintf(' "credit":"%s",%s', $credit,$nl);
$tl_json_tail .= sprintf(' "caption":"%s"%s', $caption,$nl);
$tl_json_tail .= sprintf(" } } ] } }%s",$nl);
$json = "";
$json .= $tl_json_head;
$json .= $tl_json_body;
$json .= $tl_json_tail;
echo( $json );
# echo json_encode($json);
return($json);
}
function tlgif($gifnum,$tn) {
$tlgif_list=<<<TLGIF_LIST
/imgs/gif/time/giph_time_ticktocky.gif
/imgs/gif/time/giphy_recordtime.gif
/imgs/gif/time/giphy_time1.gif
/imgs/gif/time/giphy_time_1213.gif
/imgs/gif/time/giphy_time_clockrays.gif
/imgs/gif/time/giphy_time_clocks.gif
/imgs/gif/time/giphy_time_cubist.gif
/imgs/gif/time/giphy_time_cycle.gif
/imgs/gif/time/giphy_time_flywheel.gif
/imgs/gif/time/giphy_time_gears.gif
/imgs/gif/time/giphy_time_goo.gif
/imgs/gif/time/giphy_time_hotsand.gif
/imgs/gif/time/giphy_time_numbers.gif
/imgs/gif/time/giphy_time_running.gif
/imgs/gif/time/giphy_time_silouette.gif
/imgs/gif/time/giphy_time_spinn.gif
/imgs/gif/time/giphy_time_spiral.gif
/imgs/gif/time/giphy_time_spiral_up.gif
/imgs/gif/time/giphy_time_strobe.gif
/imgs/gif/time/giphy_time_swingers.gif
/imgs/gif/time/giphy_time_toons.gif
/imgs/gif/time/giphy_time_up.gif
/imgs/gif/time/giphy_timebench.gif
/imgs/gif/time/giphy_timeferro.gif
/imgs/gif/time/giphy_timegirls.gif
/imgs/gif/time/giphy_timeguy.gif
/imgs/gif/time/giphy_timegym.gif
/imgs/gif/time/giphy_timeinky.gif
/imgs/gif/time/giphy_timerunning.gif
/imgs/gif/time/giphy_timespiral_gold.gif
TLGIF_LIST;
$tlgiftn_list=<<<TLGIFTN_LIST
/imgs/gif/time/tn/tn_giph_time_ticktocky.gif
/imgs/gif/time/tn/tn_giph_time_ticktocky.gif
/imgs/gif/time/tn/tn_giphy_recordtime.gif
/imgs/gif/time/tn/tn_giphy_time1.gif
/imgs/gif/time/tn/tn_giphy_time_1213.gif
/imgs/gif/time/tn/tn_giphy_time_clockrays.gif
/imgs/gif/time/tn/tn_giphy_time_clocks.gif
/imgs/gif/time/tn/tn_giphy_time_cubist.gif
/imgs/gif/time/tn/tn_giphy_time_cycle.gif
/imgs/gif/time/tn/tn_giphy_time_flywheel.gif
/imgs/gif/time/tn/tn_giphy_time_gears.gif
/imgs/gif/time/tn/tn_giphy_time_goo.gif
/imgs/gif/time/tn/tn_giphy_time_hotsand.gif
/imgs/gif/time/tn/tn_giphy_time_numbers.gif
/imgs/gif/time/tn/tn_giphy_time_running.gif
/imgs/gif/time/tn/tn_giphy_time_schedule.gif
/imgs/gif/time/tn/tn_giphy_time_silouette.gif
/imgs/gif/time/tn/tn_giphy_time_spinn.gif
/imgs/gif/time/tn/tn_giphy_time_spiral.gif
/imgs/gif/time/tn/tn_giphy_time_spiral_up.gif
/imgs/gif/time/tn/tn_giphy_time_strobe.gif
/imgs/gif/time/tn/tn_giphy_time_swingers.gif
/imgs/gif/time/tn/tn_giphy_time_toons.gif
/imgs/gif/time/tn/tn_giphy_time_up.gif
/imgs/gif/time/tn/tn_giphy_timebench.gif
/imgs/gif/time/tn/tn_giphy_timeferro.gif
/imgs/gif/time/tn/tn_giphy_timegirls.gif
/imgs/gif/time/tn/tn_giphy_timeguy.gif
/imgs/gif/time/tn/tn_giphy_timegym.gif
/imgs/gif/time/tn/tn_giphy_timeinky.gif
/imgs/gif/time/tn/tn_giphy_timerunning.gif
/imgs/gif/time/tn/tn_giphy_timespiral_gold.gif
/imgs/gif/time/tn/tn_giphy_timespiral_gold.gif
TLGIFTN_LIST;
if( $tn == "" ) {
$tlgifs=explode("\n",$tlgif_list);
$min=1; $max=count($tlgifs)-1;
if( $gifnum == "" ) { $gifnum=rand($max,$min); }
if( $gifnum > $max ) { $gifnum=rand($max,$min); }
$gif=$tlgifs[$gifnum];
}
else {
$tlgiftns=explode("\n",$tlgiftn_list);
$min=1; $max=count($tlgiftns)-1;
if( $gifnum == "" ) { $gifnum=rand($max,$min); }
if( $gifnum > $max ) { $gifnum=ran($max,$min); }
$gif=$tlgiftns[$gifnum];
}
return($gif);
}
function html_bluehost($bluehost_id) {
# $hostname=$gethostbyaddr("10.5.50.111");
$hostname=gethostname();
# $hostname="ka1";
$html = "";
$html .= "<a href=https://bluehost.com/$bluehost_id/$hostname target=_blank>";
$html .= "<img src=/imgs/btn/logo_bluehost.png height=20>";
# $html .= "<img src=/imgs/kogrids/kob_grid.png height=20>";
$html .= "</a>\n";
return($html);
}
function html_coffee($coffee_id) {
$html = "";
$html .= "<a href=https://buymeacoffee.com/$coffee_id target=_blank>";
$html .= "<img src=/imgs/btn/logo_buymeacoffee.png height=20>";
$html .= "</a>\n";
return($html);
}
function html_parallels($parallels_id) {
$html = "";
$html .= "<a href=https://parallels.com/$parallels_id target=_blank>";
$html .= "<img src=/imgs/btn/logo_parallels.png height=20>";
$html .= "</a>\n";
return($html);
}
function html_scripts_konet0($args) {
# $html = "";
# $html .= "<script id=script_toggle>\n";
# $html .= " function toggle(divid) {\n";
# $html .= " }\n";
# $html .= " </script>\n";
$html = <<<HTML_SCRIPTS
<script id=script_toggle>
function toggle(divid) {
var imgid=divid.replace("div_","img_" );
if(! document.getElementById(divid)) { return; }
var imgid=divid.replace("div_","img_" );
style_display=document.getElementById(divid).style.display;
if( style_display == "none" ) {
img="<img src=/imgs/btn/koeyew.png id="+imgid+" height=50 onclick=\"toggle('"+divid+"'); return false;\" >";
document.getElementById(divid).style.display="inline";
document.getElementById(imgid).innerHTML=img;
document.getElementById(imgid).src="/imgs/btn/koeyew.png";
}
else {
img="<img src=/imgs/btn/koeyeb.png id="+imgid+" height=50 onclick=\"toggle('"+divid+"'); return false;\" >";
document.getElementById(divid).style.display="none";
document.getElementById(imgid).innerHTML=img;
document.getElementById(imgid).src="/imgs/btn/koeyeb.png";
}
}
</script>
<script id="script_random_int" >
function random_int(max,min) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
</script>
<script id=script_odd_or_even >
function odd_or_even(x) {return ( x & 1 ) ? "odd" : "even";}
</script>
HTML_SCRIPTS;
$perc="";
$html .= " <script id=script_isodd >\n";
$html .= " function isodd(num) { return num $perc 2; }\n";
$html .= " </script>\n";
return($html);
}
function html_scripts_konet($args) {
$html_scripts_konet=<<<HTML_SCRIPTS_KONET
<script id=script_toggle>
function toggle(divid) {
var imgid=divid.replace("div_","img_" );
if(! document.getElementById(divid)) { return; }
var imgid=divid.replace("div_","img_" );
style_display=document.getElementById(divid).style.display;
if( style_display == "none" ) {
img="<img src=/imgs/btn/koeyew.png id="+imgid+" height=50 onclick=\"toggle('"+divid+"'); return false;\" >";
document.getElementById(divid).style.display="inline";
document.getElementById(imgid).innerHTML=img;
document.getElementById(imgid).src="/imgs/btn/koeyew.png";
}
else {
img="<img src=/imgs/btn/koeyeb.png id="+imgid+" height=50 onclick=\"toggle('"+divid+"'); return false;\" >";
document.getElementById(divid).style.display="none";
document.getElementById(imgid).innerHTML=img;
document.getElementById(imgid).src="/imgs/btn/koeyeb.png";
}
}
</script>
<script id="script_random_int" >
function random_int(max,min) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
</script>
<script id=script_isodd >
function isOdd(num) { return num 2;}
function oddOrEven(x) {return ( x & 1 ) ? "odd" : "even";}
</script>
HTML_SCRIPTS_KONET;
return($html_scripts_konet);
}
function time2sec($time) {
list($h, $m, $s) = explode (":", $time);
$seconds = 0;
$seconds += (intval($h) * 3600);
$seconds += (intval($m) * 60);
$seconds += (intval($s));
return $seconds;
}
function sec2time($sec) {
return sprintf('%02d:%02d:%02d', floor($sec / 3600), floor($sec / 60 % 60), floor($sec % 60));
}
function dateadd($date0,$interval) {
$date=date_create($date0);
date_add($date,date_interval_create_from_date_string($interval));
return date_format($date,"Y-m-d");
}
# $newdate = date('Y-m-d', strtotime($date0. ' + 10 days'));
# $time1 = time_to_sec("00:02:00");
# $time2 = time_to_sec("00:15:00");
# $time3 = time_to_sec("00:08:00");
# $total = $time1 + $time2 + $time3;
# var_dump(sec_to_time($total));
# $date0="2022-12-11";
# $interval="40 days";
# $interval="1 days";
# $newdate=dateadd($date0,$interval);
# printf( "<h1>BUGS_10 newdate=$newdate date0=$date0 interval=$interval</h1>\n" );
# $time0 = "23:59:59";
# $time1 = "23:59:59";
# printf( "<h1>BUGS_11 time0=$time0 time1=$time1</h1>\n");
# $secs0 = time2sec($time0);
# $secs1 = time2sec($time1);
# $secs = $secs0 + $secs1;
# printf( "<h1>BUGS_12 secs=$secs secs0=$secs0 secs1=$secs1</h1>\n");
# $time = sec2time($secs);
# printf( "<h1>BUGS_13 time=$time</h1>\n" );
function sql3_upd($db3,$sql) {
$db=new SQLite3($db3) or die( "<h1>ERR_890 db3=$db3</h1>\n" );
$db->exec($sql);
}
//
koh5_pano
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer