Exemplo n.º 1
0
function check_module($type)
{
    $return = array();
    switch ($type) {
        case "php":
            $v = phpversion();
            $req = '5.2.1';
            if ($v < $req) {
                $return['err'] = sprintf(_("Found PHP %s but required is PHP %s "), $v, $req);
            } else {
                $return['msg'] = sprintf(_("Found PHP %s "), $v);
            }
            break;
        case "ffmpeg":
            $ffmpeg_path = exec("which ffmpeg");
            $ffmpeg_version = shell_output("{$ffmpeg_path} -version");
            $version = false;
            preg_match("/SVN-r([0-9]+)/i", $ffmpeg_version, $matches);
            if (@$matches[1]) {
                $version = 'r' . $matches[1];
            }
            preg_match("/version ([0-9.]+)/i", $ffmpeg_version, $matches);
            if (@$matches[1]) {
                $version = $matches[1];
            }
            if (!$version) {
                $return['err'] = _("Unable to find ffmpeg");
            } else {
                $return['msg'] = sprintf(_("Found FFMPEG %s : %s"), $version, ${$ffmpeg_path});
            }
            break;
        case "flvtool2":
            $flvtool2_path = exec("which flvtool2");
            $flvtool2_version = shell_output("{$flvtool2_path} -version");
            $version = false;
            preg_match("/flvtool2 ([0-9.]+)/i", $flvtool2_version, $matches);
            if (@$matches[1]) {
                $version = $matches[1];
            }
            if (!$version) {
                $return['err'] = _("Unable to find flvtool2");
            } else {
                $return['msg'] = sprintf(_("Found flvtool2 %s : %s"), $version, $flvtool2_path);
            }
            break;
        case "mp4box":
            $mp4boxpath = exec("which MP4Box");
            $mp4box_version = shell_output("{$mp4boxpath} -version");
            $version = false;
            preg_match("/GPAC version ([0-9.]+)/i", $mp4box_version, $matches);
            if (@$matches[1]) {
                $version = $matches[1];
            }
            if (!$version) {
                $return['err'] = _("Unable to find MP4Box");
            } else {
                $return['msg'] = sprintf(_("Found MP4Box %s : %s"), $version, $mp4boxpath);
            }
            break;
        case "curl":
            $version = false;
            if (function_exists('curl_version')) {
                $version = @curl_version();
            }
            if (!$version) {
                $return['err'] = _("curl library is not neabled");
            } else {
                $return['msg'] = sprintf(_("curl %s found"), $version['version']);
            }
            break;
        case "phpshield":
            if (!function_exists('phpshield_load')) {
                $return['err'] = _("PHPShield loaders are not installed (optional)");
            } else {
                $return['msg'] = _("PHPShield loaders are working (optional)");
            }
            break;
        case "imagick":
            if (!extension_loaded('imagick')) {
                $return['err'] = _("Imagick ectension is not enabled");
            } else {
                $return['msg'] = _("Imagick extension is enabled");
            }
            break;
    }
    return $return;
}
Exemplo n.º 2
0
 /**
  * Prepare file to be converted
  * this will first get info of the file
  * and enter its info into database
  */
 function prepare($file = NULL)
 {
     global $db;
     if ($file) {
         $this->input_file = $file;
     }
     if (file_exists($this->input_file)) {
         $this->input_file = $this->input_file;
     } else {
         $this->input_file = TEMP_DIR . '/' . $this->input_file;
     }
     //Checking File Exists
     if (!file_exists($this->input_file)) {
         $this->log('File Exists', 'No');
     } else {
         $this->log('File Exists', 'Yes');
     }
     //Get File info
     $this->input_details = $this->get_file_info();
     //Loging File Details
     $this->log .= "\nPreparing file...\n";
     $this->log_file_info();
     //Insert Info into database
     //$this->insert_data();
     //Gett FFMPEG version
     $result = shell_output(FFMPEG_BINARY . " -version");
     $version = parse_version('ffmpeg', $result);
     $this->vconfigs['map_meta_data'] = 'map_meta_data';
     if (strstr($version, 'Git')) {
         $this->vconfigs['map_meta_data'] = 'map_metadata';
     }
 }
Exemplo n.º 3
0
            $vidDetails = $ffmpeg->output_details;
            if (!$vidDetails) {
                if ($victimDetails['audio_codec'] == 'aac' || $victimDetails['audio_codec'] == 'ac3') {
                    $err[] = "<div class=\"expErr\">A possible reason is beacuse videos with \n\t\t\t\tAAC Audio does not encode without 'libfaac', set audio codec as libfaac and then try again</div>";
                }
                if (!file_exists($victimFile) && $victim) {
                    $err[] = "<div class=\"expErr\">No output file...your ffmpeg is not compatible</div>";
                } else {
                    $err[] = "<div class=\"expErr\">No output file...hmm post the log to dev team</div>";
                }
                if (@filesize($victimOutput) > 0 && file_exists($victimFile)) {
                    $err[] = "<br>" . nl2br(shell_output($Cbucket->configs['ffmpegpath'] . ' -i ' . $victimOutput));
                }
                theEnd();
            } else {
                $msg[] = "<br>" . nl2br(shell_output($Cbucket->configs['ffmpegpath'] . ' -i ' . $victimOutput));
                $msg[] = "<div class=\"expOK\">Video file is converted =D..</div>";
            }
            theEnd();
    }
}
function theEnd($status = false)
{
    global $msg, $err;
    if ($err) {
        $errors = implode('', $err);
    }
    if ($msg) {
        $messgs = implode('', $msg);
    }
    echo json_encode(array('err' => $errors, 'msg' => $messgs, 'status' => $status));
Exemplo n.º 4
0
/**
 * Function used to cheack weather MODULE is INSTALLED or NOT
 */
function check_module_path($params)
{
    $rPath = $path = $params['path'];
    if ($path['get_path']) {
        $path = get_binaries($path);
    }
    $array = array();
    $result = shell_output($path . " -version");
    if ($result) {
        if (strstr($result, 'error') || strstr($result, 'No such file or directory')) {
            $error['error'] = $result;
            if ($params['assign']) {
                assign($params['assign'], $error);
            }
            return false;
        }
        if ($params['assign']) {
            $array['status'] = 'ok';
            $array['version'] = parse_version($params['path'], $result);
            assign($params['assign'], $array);
        } else {
            return $result;
        }
    } else {
        if ($params['assign']) {
            assign($params['assign']['error'], "error");
        } else {
            return false;
        }
    }
}
Exemplo n.º 5
0
function check_mp4box($path)
{
    $path = get_binaries($path);
    $matches = array();
    $result = shell_output($path . " -version");
    if ($result) {
        preg_match("/(?:version\\s)(\\d\\.\\d\\.(?:\\d|[\\w]+))/i", strtolower($result), $matches);
        if (count($matches) > 0) {
            $version = array_pop($matches);
            return $version;
        }
        return false;
    } elseif (preg_match("/GPAC version/i", $result)) {
        preg_match('@^(?:GPAC version)?([^-]+)@i', $result, $matches);
        $host = $matches[1];
        // get last two segments of host name
        preg_match('/[^.]+\\.[^.]+$/', $host, $matches);
        //echo "{$matches[0]}\n";
        $version = "{$matches[0]}";
        return $version;
    } else {
        return false;
    }
}