<? $po = WGParseFile($APPL['file']['path']); if (!$po['F']) return; $st=@file_get_contents($po['f']); $st=json_decode($st,true); if (!is_array($st)) FatalError("Invalid stream info file"); $t=str_replace(array(".youtube\n","\n"),'',$APPL['file']['filename']."\n"); if (isset($st['t'])) $t=$st['t']; Window($t,"/bin/mime/ico/youtube.png",580,360); ?><div style="width: 561px; height: 316px; margin: auto; padding-top: 4px;"> <iframe width="560" height="315" src="https://www.youtube.com/embed/<?php echo htmlspecialchars($st['v'], ENT_QUOTES); ?> " frameborder="0" allowfullscreen></iframe> </div> <? endWin(); ?>
function execApp($ex,$action=AJ_SHELL) { global $CMD; global $OUTJSON; global $APPL; global $DBH; global $JSON; global $WEBGUI; global $WGData; if (!is_array($ex)) $ex = WGParseFile($ex); if ($ex===false) FatalError("Invalid file"); if (!$ex['D']) FatalError("E5 Invalid application"); $lang=$_SESSION['WGLang'] ? $_SESSION['WGLang'] : '_D_'; $rvar = array( 'FILE' => $ex['w'], 'PATH' => pathinfo($ex['w'],PATHINFO_DIRNAME), 'URL' => @$JSON['url']) ; if ($ex['D']) $rvar['APPPATH']=rtrim($ex['w'],'/').'/'; else $rvar['APPPATH']=rtrim($rvar['PATH'],'/').'/'; $mf = json_decode( @file_get_contents($ex['f'].'/manifest.json') , true); if (!is_array($mf)) FatalError("Invalid Manifest"); $x = $ex['f'].'/lang'; if (file_exists($x) and is_dir($x)) { list($y)=explode('-',$lang,2); foreach(array($lang,$y,'_D_') as $kf) { $y = $x . '/'. $kf.'.json'; if (file_exists($y)) { $x = @file_get_contents($y); $x = json_decode($x,true); if (!is_array($x)) FatalError("Can't load lang `$kf`"); $rvar=array_merge($rvar,$x); $x=null; break; } } } $WEBGUI['rvar']=$rvar; $x = $ex['f'].'/'.$mf['ico']; if (file_exists($x)) $x=$ex['w'].'/'.$mf['ico']; else $x=null; //--form endWin(); Window( $mf['title'], $x, $mf['w'] ? $mf['w'] : 320 , $mf['h'] ? $mf['h'] : 240 ) ; if (@$mf['autoResize']) WGAutoResizeWin(); if (isset($mf['winType'])) { if (is_numeric($mf['winType'])) $WEBGUI['win']['winType']=$mf['winType']; else { if ($mf['winType']=='nosize') $WEBGUI['win']['winType'] = WIN_NOSIZE; if ($mf['winType']=='dialog') $WEBGUI['win']['winType'] = WIN_DIALOG; if ($mf['winType']=='normal') $WEBGUI['win']['winType'] = WIN_NORMAL; if ($mf['winType']=='popup') $WEBGUI['win']['winType'] = WIN_POPUP; } } if (isset($mf['pox'])) { if (!is_numeric($mf['pox'])) { if ($mf['pox']=='center') $mf['pox']=POX_CENTER; else if ($mf['pox']=='rev') $mf['pox']=POX_RB; else $mf['pox']=POX_NORMAL; } setWindowPox( $mf['pox'], isset($mf['x']) ? $mf['x'] : false, isset($mf['y']) ? $mf['y'] : false) ; } if ($action == AJ_SHELL or $action == AJ_DIALOG) { $hdc=WGSNew($ex['w'], isset($mf['name']) ? $mf['name'] : false); $APPL['hdc']=$hdc; $APPL['asNew']=true; $APPL['url']=$ex['w']; } else $hdc=$APPL['hdc']; setWindowContext($hdc,$mf['name'] ? $mf['name'] : false,$ex['w']); $WEBGUI['win']['data'] = WGSLoad($hdc,$ex['w'],isset($mf['name']) ? $mf['name'] : false); if (is_array($rvar) and ($action==AJ_SHELL or $action==AJ_DIALOG)) { if (isset($rvar['win']) and is_array($rvar['win'])) $WEBGUI['win']['winLang'] = $rvar['win']; if (file_exists($ex['f'].'/style.css')) WGWinCss($ex['w'].'/style.css',$rvar); if (isset($rvar['_title'])) $WEBGUI['win']['title'] = $rvar['_title']; } $f = $ex['f'].'/event.php'; if (file_exists($f)) { WGRequirePHP($f,$rvar); $fn=false; if ($action==AJ_POST) { $fn='form_'.@$JSON['frm'].'_post'; if (!function_exists($fn)) $fn='form_'.$APPL['act'].'_post'; $WEBGUI['win']['data'][$APPL['act']]=$JSON['par']; } if ($action==AJ_WINAJAX) $fn='ajax_'.$APPL['api']; if ($action==AJ_EVENT) $fn='event_'.$APPL['api']; if (($action==AJ_SHELL || $action==AJ_DIALOG) && $APPL['act']!='') $fn='load_'.$APPL['act']; if (($action==AJ_SHELL || $action==AJ_DIALOG) && $APPL['act']=='') $fn='winMain'; if ($fn and function_exists($fn)) { if (isset($WEBGUI['form']) and isset($JSON['frm']) and $JSON['frm']!='') { if (!isset($WEBGUI['form'][ $JSON['frm'] ])) FatalError("Unknown form `".$JSON['frm']."`"); $formData=$JSON['par']; $err = WGFormCheck($WEBGUI['form'][ $JSON['frm'] ], $formData); if ($err) { foreach($WEBGUI['form'][ $JSON['frm']]['obj'] as $t0) { if ($t0['n']==$err) { FatalError( isset($t0['par']['err']) ? $t0['par']['err'] : "Invalid value for `".$t0['c']."`"); } } FatalError("Invalid value for `$err`"); } WGDestroyCaptcha($WEBGUI['form'][ $JSON['frm'] ]); } else { $formData=@$JSON['par']; } $pr=$fn(@$JSON['par'],$formData); if ($action==AJ_POST and $pr) $OUTJSON['postReply']=$pr; if ($action==AJ_WINAJAX and $pr) $OUTJSON['ajaxReturn'] = $pr; } } $formFile=$ex['f'].'/form.conf'; if (file_exists($formFile)) { $X = @file_get_contents($formFile); if ($X===false) FatalError("Can't read form.conf"); $X = WGReplacer($X,$rvar); $WEBGUI['form'] = WGFormParser($X,$action); $X=null; $formFile=true; } else $formFile=false; if ($action == AJ_SHELL || $action == AJ_DIALOG) { $f = $ex['f'].'/app.js'; if (file_exists($f)) winJS( @file_get_contents($f) ); $f = $ex['f'].'/data.json'; if (file_exists($f)) { $WEBGUI['win']['data'] = json_decode(@file_get_contents($f),true); if (!is_array($WEBGUI['win']['data'])) FatalError("Invalid `data.json` structure/syntax"); } $f = $ex['f'].'/layout.php'; if (file_exists($f)) WGRequirePHP($f,$rvar); if (isset($WEBGUI['form'])) { foreach($WEBGUI['form'] as $X) WGFormActivity($X); $X=null; } $f = $ex['f'].'/app.ejs'; if (file_exists($f)) { $f = @file_get_contents($f); if ($f===false) FatalError("Can't load EJS"); $f = WGReplacer($f,$rvar); $f=explode("\n",$f); WGParseEJSTag($f); } else { $f = $ex['f'].'/event.json'; if (file_exists($f)) { $js=@file_get_contents($f); $js=json_decode($js,true); if (!is_array($js)) FatalError("Can't load application.\nBad JSON sctructure in event.json"); $WEBGUI['win']['event']=$js; $js=null; } } if (function_exists('layout_create')) layout_create(); } endWin(); }
WGRequirePHP($f['f']); } if ($APPL['executor']) { $f = WGParseFile($APPL['executor'],true); if (!$f) FatalError("Invalid executor file name"); if (!$f['F'] and !$f['D']) FatalError("Executor not found `".print_r($APPL['executor'],true)."`"); $APPL['bin'] = $f; if ($f['F']) { if ($f['extension']=='php') { WGRequirePHP($f['f']); } else if ($f['extension']=='json') { $js=@file_get_contents($f); $js=json_decode($f,true); if (!is_array($js)) FatalError("Invalid executor json `".$APPL['executor']."`"); Window($f['filename']); $WEBGUI['win']=array_merge($WEBGUI['win'],$js); $js=null; unset($js['hdc']); endWin(); } else FatalError("Unknown executor type `".$APPL['executor']."`"); } else if ($f['D']) execApp($f['w'],$JSON['t']); } if (is_array($ini['db']) && !$DBH) dbclose($DBH); retGUI(); } /// GET $startFile=false;
<? Window($APPL['file']['filename'],'/img/form.gif','630','400'); $po = WGParseFile($APPL['file']['path']); if (!$po['F']) return; include $po['f']; endWin(); ?>
<? Window($APPL['file']['filename'],'/bin/mime/ico/txt.gif','565','300'); $po = WGParseFile($APPL['file']['path']); if (!$po['F']) return; $txt = @file_get_contents($po['f']); $txt = mb_convert_encoding($txt,'UTF-8','UTF-8,ISO-8859-1'); $txt=explode("\n",$txt); foreach($txt as &$li) $li=rtrim($li,"\t\r "); $txt=implode("\n",$txt); $txt = str_replace("\r\n","\n",$txt); $txt = wordwrap($txt,80,"\n",false); $txt = explode("\n",$txt); foreach($txt as &$li) $li=rtrim($li,"\t\r "); $txt=implode("\n",$txt); $txt = htmlspecialchars($txt,ENT_QUOTES); ?><div style="height: 100%; overflow-x: hidden; overflow-y: scrollbar;"> <pre style="font-size: 11px; margin: auto;"><?php echo $txt; ?> </pre> </div> <? endWin(); ?>
<? Window( str_replace( array(".audio\n","\n"),'',$APPL['file']['filename']."\n"), '/img/form.gif','320','100' ) ; $WEBGUI['win']['app'] = 'WGMediaPlayer'; $x = pathinfo($APPL['file']['path'] ,PATHINFO_EXTENSION); $ct=false; if ($x=='radio') { $po = WGParseFile($APPL['file']['path']); if (!$po['F']) return; $st=@file_get_contents($po['f']); $st=json_decode($st,true); if (!is_array($st)) FatalError("Invalid stream info file"); $APPL['file']['path']=$st['url']; $x=$st['type']; if(isset($st['title'])) $WEBGUI['win']['title']=$st['title']; } if ($x=='mp3') $ct='audio/mpeg'; if ($x=='ogg') $ct='audio/ogg'; if ($ct===false) { ?><div style="text-align: center;"> <audio controls autoplay style="width: 94%; margin: 16px auto;"> <source src="<?php
<? Window($APPL['file']['filename'],'/img/form.gif','150','150'); $javaScript=' var im = WGWin.getByID("load"); im.style.display="none"; im = WGWin.getByID("img"); var w = im.naturalWidth; var h = im.naturalHeight; if (!w || !h) return; var mw = Math.ceil(WGScrWidth()*0.80); var mh = Math.ceil(WGScrHeight()*0.80); if (w<mw && h<mh) { w+=32; h+=48; if (w<150) w=150; if (h<150) h=150; WGWin.setSize(w,h); } else { var r = h/w; if (w>h) { w = mw-32; h = Math.ceil(w*r); } else { h = mh - 48; w = Math.ceil(h/r); } if (w>mw || h>mh) {