Exemplo n.º 1
0
function run_script_update($script_name, $script_php, $poll_version, $context, $php_format = 1, $sub_folder = "")
{
    $php_file = get_update_script($script_php, $poll_version, $context);
    if (empty($php_file) == TRUE) {
        return ' - <strong>No Update Available</strong>...<br><br>';
    } else {
        // File exist, is the download valid?
        $sha_check = check_update_script($script_name, $script_php, $php_file, $poll_version, $context);
        if ($sha_check == FALSE) {
            return ' - <strong>ERROR: Unable to Download File Properly</strong>...<br><br>';
        } else {
            $update_status .= $sha_check;
            if ($php_format == 1) {
                // PHP Files are downloaded as text, then renamed to the .php extension
                $update_status .= install_update_script($script_php . '.php', $php_file);
            } else {
                if (empty($sub_folder) == FALSE) {
                    // This file is installed to a sub-folder
                    $update_status .= install_update_script("{$sub_folder}/" . $script_php, $php_file);
                } else {
                    $update_status .= install_update_script($script_php, $php_file);
                }
            }
            return $update_status;
        }
    }
}
Exemplo n.º 2
0
function run_script_update($script_name, $script_php, $poll_version, $context, $css_update = 0, $image_update = 0)
{
    $php_file = get_update_script($script_php, $poll_version, $context);
    if (empty($php_file) == TRUE) {
        return ' - <strong>No Update Available</strong>...</br></br>';
    } else {
        // File exist, is the download valid?
        $sha_check = check_update_script($script_name, $script_php, $php_file, $poll_version, $context);
        if ($sha_check == FALSE) {
            return ' - <strong>ERROR: Unable to Download File Properly</strong>...</br></br>';
        } else {
            $update_status .= $sha_check;
            if ($css_update == 1) {
                $update_status .= install_update_script('css/' . $script_php, $php_file);
            } else {
                if ($image_update == 1) {
                    $update_status .= install_update_script('img/' . $script_php, $php_file);
                } else {
                    $update_status .= install_update_script($script_php . '.php', $php_file);
                }
            }
            return $update_status;
        }
    }
}