function video_html($f) { if (strpos($f, '.mp4')) { $xt = 'mp4'; } else { $xt = substr(xt($f), 1); } return '<video controls width="100%"><source src="' . $f . '" type="video/' . $xt . '"></video> '; }
function save_img() { $qb = $_SESSION['qb']; $read = $_SESSION['read']; $fich = $_FILES['fichier']['name']; $fich_tmp = $_FILES['fichier']['tmp_name']; $xt = xt($fich); $fich = normalize($fich); $fich = str_replace("-", "", $fich); if ($fich == "") { $exp_out .= "no file uploaded "; } else { $goodxt = ".mp4.m4a.mov.mpg.mp3.wav.wmv.asf.rmv.ram.rm.swf.flv.jpg.png.gif.pdf.txt.rar.zip.tar.gz"; $goodxt .= $_SESSION['prmb'][23]; $goodext = str_replace(array(".php", ".js"), "", $goodxt); if (stristr($goodxt, $xt) === false) { $exp_out .= $xt . '=forbidden ; authorized=' . $goodxt . br(); } $poids = $_FILES['fichier']['size'] / 1024; $uplimit = prms('uplimit') * 1000; if ($poids >= $uplimit || $poids == 0) { $exp_out .= "{$poids} > 250Mo "; } if ($xt == ".rm") { $fich .= "v"; } $rep = 'img/'; if (stristr(".m4a.mpg.mp4.asf.rmv.wmv.flv", $xt) !== false) { $rep = 'video/'; } elseif (stristr(".rar.swf.txt.pdf", $xt) !== false) { $rep = 'docs/'; } elseif (stristr(".mp3", $xt) !== false) { $rep = 'mp3/'; } if (stristr(".txt.mp3.pdf.swf", $xt) !== false) { $rep = 'users/' . $qb . '/' . $rep; } elseif (stristr(".jpg.png.gif", $xt) === false) { $rep = 'users/' . $qb . '/' . $rep; } if (stristr(".jpg.png.gif.mp3.mp4.pmg.swf.wmv.flv.pdf", $xt) === false) { $w = ':w'; } if (stristr(".txt", $xt) !== false) { $w = ':scrut'; } if ($_GET['mode'] == "banim") { $mg = 'ban_' . $qb . '.jpg'; } elseif ($_GET['avnim'] == "ok") { $mg = 'avatar_' . $_SESSION['USE'] . '.gif'; $rep = 'imgb/'; } elseif ($_GET['edit_css']) { $mg = 'css_' . $qb . '_' . $fich; $rep = 'imgb/'; } elseif ($_GET['bkgim'] == "ok") { $mg = 'bkg_' . $qb . '.jpg'; $rep = 'imgb/'; } elseif ($_GET["mode"] == "disk") { $rep = 'users/' . ajx($_GET['opdir'], 1) . '/'; $mg = $fich; if ($_GET['opdir'] != $qb) { mkdir_r($rep); } } else { $mg = $qb . '_' . $read . '_' . $fich; } if (!is_dir($rep)) { mkdir($rep, 0777); } if (is_uploaded_file($fich_tmp) && !$exp_out) { if (!move_uploaded_file($fich_tmp, $rep . $mg)) { $exp_out .= " not saved"; } if ($xt == '.tar' or $xt == '.gz') { unpack_gz($rep . $mg, $rep); } if ($read && !$_GET["mode"]) { add_im_img($mg); if (!$_POST["imnot"]) { add_im_msg("", $rep . $mg . $w); } } } else { $exp_out .= "upload refused: {$rep}{$mg}"; } } //end_no_file if ($exp_out) { alert($exp_out); } return $rep . $mg; }
function detect_plugs() { $dr = 'plug/'; $r = msql_read('system', 'program_plugs', '', 1); //p($r); $rec = explore($dr, files, 1); //p($rec); foreach ($rec as $k => $v) { $f = $dr . $v; $vb = strdeb($v, '.'); $xt = xt($v); $rc = $r[$vb]; $bo = detect_plugable($f, $vb); $iface = $rc[4]; //?$rc[4]:detect_interface($f,$vb); $pb = substr($v, 0, 1) == '_' ? '1' : ''; if (is_file($f) && $v && $vb && $xt == '.php') { if (!$rc) { $na++; } $rb[$vb] = array($rc[0], $rc[1], $bo ? $bo : '0', $rc[3], $iface, $rc[5], $pb); } //$vr, if (is_file($f) && $v && $vb) { $rd[$vb] = array($rc[0]); } } //$rb=msq_reorder($rb);//p($rb); ksort($rb); //p($rf); $rh = array('usage', 'dir', 'loadable', 'callable', 'interface', 'state', 'private'); //'vars', msql_save('system', 'program_plugs', $rb, $rh); //,'input','output' ///?msql=lang/eng/program_plugs&update== update_table_lang($rd, 'program_plugs', 'fr', array('usage')); update_table_lang($rd, 'program_plugs', 'eng', array('usage')); return 'program_plugs: added:' . ($na ? $na : 0) . ', deleted:' . (count($r) - count($rb)) . br(); }
function apps_files($cnd, $p, $o) { if (!$p) { $p = 'local|real'; } $rb = explode('|', $p); if ($o) { $o = str_replace('|', '/', $o); } if ($rb[0] == 'global') { $r = msql_read('server', 'shared_files', '', 1); } elseif ($rb[1] == 'real') { $r = apps_files_dir($o); } else { $r = msql_read('users', $_SESSION['qb'] . '_shared', '', 1); } if ($r) { foreach ($r as $k => $v) { if (!$o or substr($v[0], 0, strlen($o)) == $o) { list($dir, $nm) = split_one('/', $v[0], 1); if ($rb[1] == 'virtual') { $dir = $v[1]; } else { $dir = strchr_b($dir, '/'); } $rc[] = array($nm, 'file', '', $v[0], $cnd, '', $dir, mimes_types(xt($nm))); } } } return $rc; }
function is_image($d) { $xt = xt($d); //if($xt=='.JPG')echo $d.br(); if (strpos($d, '.jpg') or $xt == '.jpg' or $xt == '.png' or $xt == '.gif' or $xt == '.jpeg') { return true; } }