예제 #1
0
reason_include_once('classes/head_items.php');
/**
 * Enforce secure connection and ensure reason user has upgrade privileges.
 */
force_secure_if_available();
$user_netID = reason_require_authentication();
$reason_user_id = get_user_id($user_netID);
$mode = $str = '';
if (empty($reason_user_id)) {
    die('Valid Reason user required.');
}
if (!reason_user_has_privs($reason_user_id, 'upgrade')) {
    die('You must have upgrade privileges to upgrade Reason.');
}
$upgrade_steps = array('4.5_to_4.6' => 'Reason 4.5 to 4.6', '4.4_to_4.5' => 'Reason 4.4 to 4.5', '4.3_to_4.4' => 'Reason 4.3 to 4.4', '4.2_to_4.3' => 'Reason 4.2 to 4.3', '4.1_to_4.2' => 'Reason 4.1 to 4.2', '4.0_to_4.1' => 'Reason 4.0 to 4.1');
$head_items = new HeadItems();
$head_items->add_head_item('title', array(), 'Upgrade Reason', true);
$head_items->add_head_item('meta', array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'));
$head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/reason_setupgrade/reason_setupgrade.css');
if (!empty($_GET['upgrade_step']) && isset($upgrade_steps[$_GET['upgrade_step']])) {
    $step = $_GET['upgrade_step'];
    $requested_upgrader = !empty($_GET['upgrader']) ? $_GET['upgrader'] : NULL;
    $rua = new reasonUpgradeAssistant();
    $active_upgraders = $rua->get_active_upgraders($step, $requested_upgrader);
    $str = '<h2>' . htmlspecialchars($upgrade_steps[$step]) . '</h2>' . "\n";
    if (!empty($active_upgraders)) {
        $str .= $rua->get_upgrader_output($active_upgraders, $reason_user_id, $head_items);
        $standalone_upgraders = $rua->get_standalone_upgraders($step);
        if (!empty($standalone_upgraders) && count($active_upgraders) > 1) {
            $str .= '<h4>Note: There are upgrades that must be run by themselves. Please test and run these separately.</h4>' . "\n";
            $str .= '<ul>' . "\n";
     * Returns a cache id according to the type_id, search_term, and type fields
     */
    function _get_cache_id()
    {
        $type_id = $this->get_type_id();
        $search_term = $this->get_search_term();
        $type_fields = $this->get_type_fields();
        if ($type_id && $search_term && $type_fields) {
            $type_fields_str = implode("-", $type_fields);
            $cache_id = md5($type_id . '_' . $search_term . '_' . $type_fields_str);
        }
        return isset($cache_id) ? $cache_id : false;
    }
}
// instantiate relevant classes
$head_items = new HeadItems();
$frwh = new FindReplaceWizardHelper();
// add needed head items
$head_items->add_head_item('meta', array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'));
$head_items->add_head_item('title', array(), 'Find / Replace Wizard', true);
$head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/forms/form_data.css');
$html = '<!DOCTYPE html>' . "\n";
$html .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' . "\n";
$html .= '<head>' . "\n";
$html .= $head_items->get_head_item_markup();
$html .= '</head>' . "\n";
$html .= '<body>' . "\n";
reason_require_authentication();
if (!reason_check_privs('db_maintenance')) {
    $html .= '<h3>Unauthorized</h3><p>You must have database maintenance privileges to use this tool.</p>';
} else {
 function get_head_markup()
 {
     $head_items = new HeadItems();
     // add needed head items
     $head_items->add_head_item('title', array(), 'Publication Migration Wizard', true);
     $head_items->add_stylesheet('//' . REASON_HOST . REASON_HTTP_BASE_PATH . 'css/publication_migrator/publication_migrator.css');
     $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
     $html .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' . "\n";
     $html .= '<head>' . "\n";
     $html .= $head_items->get_head_item_markup();
     $html .= '</head>' . "\n";
     $html .= '<body>' . "\n";
     return $html;
 }