/** * check_install * This checks folders + permissions, .php files and settings. */ function check_install() { global $config, $install_errors; // Error friendly messages $requirements_error = array('There is a problem regarding server requirements. This means that Chevereto can\'t run because of the following:', 'Please notice that this issue is because your server setup. If you want to run Chevereto please contact your hosting company or system admin regarding this report.'); $folder_error = array('There is a problem regarding folders. This means that Chevereto can\'t run because one or more folders required doesn\'t exists. The missing folders are:', 'Please double-check your current setup for the missing files.'); $admin_folder_error = array('There is a problem regarding the admin folder and Chevereto won\'t run because the admin folder doesn\'t exists.', 'Please double-check <code>$config[\'admin_folder\']</code> in the <code>includes/config.php</code> file.'); $htaccess = 'In some operating systems this files are hidden, therefore you can\'t upload them. You need to <a href="http://www.google.com/search?q=show+hidden+htaccess" target="_blank">show this file</a> and then upload it.'; $htaccess_error = array('Some <code>.htaccess</code> file(s) doesn\'t exists and the system can\'t create this files.', $htaccess); $root_htaccess_error = array('The <code>.htaccess</code> file doesn\'t exists in the Chevereto root directory. This file must be uploaded to run Chevereto.', $htaccess); $file_error = array(str_replace('folders', 'files', $folder_error[0]), str_replace('folders', 'files', $folder_error[1])); $permission_error = array('There is a problem regarding permissions. This means that Chevereto can\'t upload files because of the following:', 'Chevereto needs a way to write in this folders. You can do this by doing <a href="http://www.google.com/search?q=chmod+777" target="_blank">chmod 0777</a> on the above folders or use <a href="http://www.suphp.org/" target="_blank">suPHP</a> or <a href="http://httpd.apache.org/docs/current/suexec.html" target="_blank">suEXEC</a> on your server setup.'); $config_error = array('There is a problem regarding your config setup. This means that Chevereto won\'t run because the config is not valid:', 'Please double-check your settings in the <code>includes/config.php</code> file.'); $definitions_error = array('Please take note that you must edit the <code>definitions.php</code> file the first time that you install Chevereto.', 'Please double-check your definitions in the <code>includes/definitions.php</code> file.'); $theme_error = array('There is a problem regarding your current theme. This means that Chevereto won\'t run because <code>' . $config['theme'] . '</code> theme has missing files:', 'Please double-check the theme hierarchy.'); $theme_data_error = array('There is a problem regarding your current theme data. This means that Chevereto won\'t run because <code>' . $config['theme'] . '</code> theme has not valid theme data in <code>style.css</code> header comments:', 'Please double-check the <code>style.css</code> header comments and refer to the <a href="http://chevereto.com/docs#themes">theme documentation</a> page.'); $virtual_folder_error = array('There is a problem regarding your virtual folders setup:', 'Either you set different values for virtual folders in <code>includes/config.php</code> or you delete this directories.'); // Check for the server requirements if (!check_requirements()) { chevereto_die($install_errors, 'System error', $requirements_error); } // Check for the image folders $image_folders = array(__CHV_PATH_IMAGES__); if (!check_files_folders($image_folders, 'Directory')) { chevereto_die($install_errors, 'Folder error', $folder_error); } if (!check_permissions($image_folders)) { chevereto_die($install_errors, 'Permissions error', $permission_error); } // Check for virtual folders $virtual_folders = array(sanitize_path($config['virtual_folder_image']), sanitize_path($config['virtual_folder_uploaded'])); foreach ($virtual_folders as $folder) { if (file_exists(__CHV_ROOT_DIR__ . $folder)) { $install_errors[] = 'The directory <code>' . __CHV_RELATIVE_ROOT__ . $folder . '</code> must not exists'; } } if (count($install_errors) > 0) { chevereto_die($install_errors, 'Virtual folders error', $virtual_folder_error); } // Check for upload.php if (!file_exists(__CHV_ROOT_DIR__ . 'upload.php')) { chevereto_die('Can\'t find <code>upload.php</code>', 'Missing upload.php', $file_error); } // Check for the root .htaccess file if (!file_exists(__CHV_ROOT_DIR__ . '.htaccess')) { chevereto_die('', '.htaccess error', $root_htaccess_error); } // Admin folder if (!check_value($config["admin_folder"])) { $config["admin_folder"] = "admin"; } if (!file_exists(__CHV_PATH_ADMIN__)) { chevereto_die('', 'Admin folder doesn\'t exists', $admin_folder_error); } // Check for the other .htaccess files $htaccess_files = array(__CHV_PATH_IMAGES__, __CHV_PATH_INCLUDES__, __CHV_PATH_ADMIN_INCLUDES__); foreach ($htaccess_files as $dir) { if (!file_exists($dir . '.htaccess')) { switch ($dir) { case __CHV_PATH_IMAGES__: $rules = 'static'; break; case __CHV_PATH_INCLUDES__: case __CHV_PATH_ADMIN_INCLUDES__: $rules = 'deny'; break; } if (!htaccess($rules, $dir)) { $install_errors[] = 'Can\'t create <code>' . $dir . '.htaccess</code> file. Please upload the <code>.htaccess</code> file to the target dir'; } } } if (count($install_errors) > 0) { chevereto_die($install_errors, '.htaccess error', $htaccess_error); } // Files check $include_files = array('chevereto.php', 'uploader.php', 'shorturl.php', 'definitions.php', 'template.functions.php'); $classes_files = array('class.handler.php', 'class.db.php', 'class.upload.php', 'class.filelist.php', 'class.imageresize.php', 'class.imageconvert.php', 'class.minify.php', 'class.shorturl.php'); $system_files = array('login.php', 'error.php', 'style.css', 'img/chevereto.png', 'img/logo.png', 'img/ico-warn.png', 'img/background.png', 'img/bkg-content.png'); $system_files_minify = array('style.css'); $system_files = array_merge_minified($system_files, $system_files_minify); $system_js_files = array('uploadify.swf', 'ZeroClipboard.swf', 'pref.php'); $system_js_files_minify = array('jquery.js', 'chevereto.js', 'functions.js', 'jquery.uploadify-3.1_chevereto.js'); $system_js_files = array_merge_minified($system_js_files, $system_js_files_minify); // Admin files $admin_classes_files = array('class.adminhandler.php', 'class.manage.php'); $admin_system_files = array('header.php', 'filemanager.php'); $admin_system_files_minify = array('style.css', 'js/admin.js'); $admin_system_files = array_merge_minified($admin_system_files, $admin_system_files_minify); foreach ($include_files as $key => $value) { $include_files[$key] = __CHV_PATH_INCLUDES__ . $value; } foreach ($classes_files as $key => $value) { $classes_files[$key] = __CHV_PATH_CLASSES__ . $value; } foreach ($system_files as $key => $value) { $system_files[$key] = __CHV_PATH_SYSTEM__ . $value; } foreach ($system_js_files as $key => $value) { $system_js_files[$key] = __CHV_PATH_SYSTEM_JS__ . $value; } foreach ($admin_classes_files as $key => $value) { $admin_classes_files[$key] = __CHV_PATH_ADMIN_CLASSES__ . $value; } foreach ($admin_system_files as $key => $value) { $admin_system_files[$key] = __CHV_PATH_ADMIN_SYSTEM__ . $value; } /*** The complete file check array ***/ $check_files = array('Includes' => $include_files, 'Classes' => $classes_files, 'System Files' => array_merge($system_files, $system_js_files), 'Admin .htaccess' => array(__CHV_PATH_ADMIN_INCLUDES__ . '.htaccess'), 'Admin Classes' => $admin_classes_files, 'Admin System' => $admin_system_files); foreach ($check_files as $key => $value) { check_files_folders($value, 'File'); } if (count($install_errors) > 0) { chevereto_die($install_errors, 'Setup error', $file_error); } if (!check_config()) { chevereto_die($install_errors, 'Config error', $config_error); } if (!check_definitions()) { chevereto_die($install_errors, 'Please change definitions.php', $definitions_error); } if (!check_theme()) { chevereto_die($install_errors, 'Theme error', $theme_error); } if (!check_theme_data()) { chevereto_die($install_errors, 'Theme data error', $theme_data_error); } }
<?php die('access denied'); // $Header: /cvsroot/html2ps/html2ps.php,v 1.153 2006/04/12 15:17:21 Konstantin Exp $ // Works only with safe mode off; in safe mode it generates a warning message error_reporting(E_ALL); ini_set("display_errors", "1"); @set_time_limit(900); require_once 'pipeline.factory.class.php'; ini_set("user_agent", DEFAULT_USER_AGENT); check_requirements(); $g_baseurl = trim($_REQUEST['URL']); if ($g_baseurl === "") { die("Please specify URL to process!"); } // Add HTTP protocol if none specified if (!preg_match("/^https?:/", $g_baseurl)) { $g_baseurl = 'http://' . $g_baseurl; } $g_css_index = 0; // Title of styleshee to use (empty if no preferences are set) $g_stylesheet_title = ""; $g_config = array('cssmedia' => isset($_REQUEST['cssmedia']) ? $_REQUEST['cssmedia'] : "screen", 'media' => isset($_REQUEST['media']) ? $_REQUEST['media'] : "A4", 'scalepoints' => isset($_REQUEST['scalepoints']), 'renderimages' => isset($_REQUEST['renderimages']), 'renderfields' => isset($_REQUEST['renderfields']), 'renderforms' => isset($_REQUEST['renderforms']), 'pslevel' => isset($_REQUEST['pslevel']) ? $_REQUEST['pslevel'] : 3, 'renderlinks' => isset($_REQUEST['renderlinks']), 'pagewidth' => isset($_REQUEST['pixels']) ? (int) $_REQUEST['pixels'] : 800, 'landscape' => isset($_REQUEST['landscape']), 'method' => isset($_REQUEST['method']) ? $_REQUEST['method'] : "fpdf", 'margins' => array('left' => isset($_REQUEST['leftmargin']) ? (int) $_REQUEST['leftmargin'] : 0, 'right' => isset($_REQUEST['rightmargin']) ? (int) $_REQUEST['rightmargin'] : 0, 'top' => isset($_REQUEST['topmargin']) ? (int) $_REQUEST['topmargin'] : 0, 'bottom' => isset($_REQUEST['bottommargin']) ? (int) $_REQUEST['bottommargin'] : 0), 'encoding' => isset($_REQUEST['encoding']) ? $_REQUEST['encoding'] : "", 'ps2pdf' => isset($_REQUEST['ps2pdf']), 'compress' => isset($_REQUEST['compress']), 'output' => isset($_REQUEST['output']) ? $_REQUEST['output'] : 0, 'pdfversion' => isset($_REQUEST['pdfversion']) ? $_REQUEST['pdfversion'] : "1.2", 'transparency_workaround' => isset($_REQUEST['transparency_workaround']), 'imagequality_workaround' => isset($_REQUEST['imagequality_workaround']), 'draw_page_border' => isset($_REQUEST['pageborder']), 'debugbox' => isset($_REQUEST['debugbox']), 'html2xhtml' => !isset($_REQUEST['html2xhtml']), 'mode' => 'html'); // ========== Entry point parse_config_file('./html2ps.config'); // validate input data if ($g_config['pagewidth'] == 0) { die("Please specify non-zero value for the pixel width!"); } // begin processing $g_media = Media::predefined($g_config['media']);
function install($options) { $check = check_requirements(); if ($check[0]) { setup_db($options); write_config_files($options); dir_permissions(); } else { echo 'FAILED! Pre-installation check failed: ' . $check[1] . "\n\n"; exit(1); } }
require_once LIB_PATH . 'osclass/helpers/hPreference.php'; require_once LIB_PATH . 'osclass/helpers/hDatabaseInfo.php'; require_once LIB_PATH . 'osclass/helpers/hErrors.php'; require_once LIB_PATH . 'osclass/core/Session.php'; require_once LIB_PATH . 'osclass/helpers/hDefines.php'; require_once LIB_PATH . 'osclass/helpers/hLocale.php'; require_once LIB_PATH . 'osclass/install-functions.php'; isset($_REQUEST['step']) ? $step = (int) $_REQUEST['step'] : ($step = '1'); if (is_osclass_installed()) { $message = 'You appear to have already installed OSClass. To reinstall please clear your old database tables first.'; osc_die('OSClass » Error', $message); } switch ($step) { case 1: $requirements = get_requirements(); $error = check_requirements($requirements); break; case 2: if (isset($_REQUEST['save_stats'])) { setcookie('osclass_save_stats', 1); header('Location: ' . get_absolute_url() . 'oc-includes/osclass/install.php?step=2'); } break; case 3: if (isset($_POST['dbname'])) { $error = oc_install(); } break; case 5: break; default:
$inDB->importFromFile($sql_file); $d_cfg = $inConf->getDefaultConfig(); $_CFG = array_merge($d_cfg, $_CFG); $inConf->saveToFile($_CFG); $sql = "UPDATE cms_users SET password = md5('{$admin_password}'), login = '******' WHERE id = 1"; $inDB->query($sql); $sql = "UPDATE cms_users SET password = md5('{$admin_password}') WHERE id > 1"; $inDB->query($sql); $installed = true; cmsCore::getInstance(); $inUser = cmsUser::getInstance(); $inUser->update(); $inUser->signInUser($admin_login, $admin_password, true); } // =================================================================================================== // $info = check_requirements(); $permissions = check_permissions(); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $_LANG['INS_HEADER'] . ' ' . CORE_VERSION; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src='/includes/jquery/jquery.js' type='text/javascript'></script> <script src='/install/js/jquery.wizard.js' type='text/javascript'></script> <script src='/install/js/install.js' type='text/javascript'></script> <link type='text/css' href='/install/css/styles.css' rel='stylesheet' media='screen' /> </head>
platform_initialize(); setup_default_config(); read_config_file(); if ($config_values['Settings']['Sanitize Hidelist'] != 1) { include 'update_hidelist.php'; $config_values['Settings']['Sanitize Hidelist'] = 1; _debug("Updated Hidelist\n"); write_config_file(); } //authenticate(); $config_values['Global']['HTMLOutput'] = 1; $html_out = ""; $debug_output = "Torrentwatch Debug:"; $verbosity = 0; parse_options(); if (check_requirements()) { return; } check_files(); echo $html_out; $html_out = ""; flush(); // Feeds load_feeds($config_values['Feeds']); feeds_perform_matching($config_values['Feeds']); get_client(); close_html(); $footer = "<div id=\"footer\">TorrentWatch-X version {$tw_version['0']}"; if (isset($tw_version[1])) { $footer .= " - {$tw_version['1']}"; }
function step($is_submit) { $info = check_requirements(); $result = array('html' => render('step_php', array('info' => $info))); return $result; }
$reqs['Clone Objects check'] = array("impact" => MUSTHAVE, "evaluate" => "!ini_get('zend.ze1_compatibility_mode');", "tip" => "set zend.ze1_compatibility_mode to Off"); $reqs['Magic quotes check'] = array("impact" => MUSTHAVE, "evaluate" => "!ini_get('magic_quotes_runtime');", "tip" => "set magic_quotes_runtime to Off"); ?> <html> <head></head> <body> <pre> <?php echo APPLICATION_NAME; ?> REQUIREMENTS CHECKER $Revision: 1.3 $ $Date: 2005/06/18 12:27:06 $ -------------------------------------------------------------- <?php show_results(check_requirements($reqs)); ?> -------------------------------------------------------------- * Fix all the <b>blocking</b> requirements. * Fix all the <b>musthave</b> requirements. * Try to fix all the <b>shouldhave</b> requirements. Finished! </pre> </body> </html> <?php /** Base functions **/ /** * Checks requirements by evaluating an expression. If the result is true,
function do_install($form) { $form = array_map('stripslashes', $form); $form = array_map('trim', $form); // First check the requirements $errors = check_requirements(); if (sizeof($errors) > 0) { echo "\t" . '<p class="errors">' . plog_tr('Plogger cannot be installed until the following problems are resolved') . ':</p>'; echo "\n\n\t\t" . '<ul class="info">'; foreach ($errors as $error) { echo "\n\t\t\t" . '<li class="margin-5">' . $error . '</li>'; } echo "\n\t\t" . '</ul>'; echo "\n\n\t" . '<form method="get" action="' . $_SERVER['REQUEST_URI'] . '"> <p><input class="submit" type="submit" value="' . plog_tr('Try again') . '" /></p> </form>' . "\n"; return false; } $ok = false; $errors = array(); // If we've already defined the database information, pass the values and skip them on the form if (defined('PLOGGER_DB_HOST')) { $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME); if (!empty($mysql)) { $mysql_fail = true; } else { unset($_SESSION['plogger_config']); } // Set the form values equal to config values if already set if (empty($form['db_host'])) { $form['db_host'] = PLOGGER_DB_HOST; } if (empty($form['db_user'])) { $form['db_user'] = PLOGGER_DB_USER; } if (empty($form['db_pass'])) { $form['db_pass'] = PLOGGER_DB_PW; } if (empty($form['db_name'])) { $form['db_name'] = PLOGGER_DB_NAME; } } if (isset($form['action']) && $form['action'] == 'install') { if (!defined('PLOGGER_DB_HOST') || isset($mysql_fail)) { $mysql_form_check = check_mysql_form($form); if (!empty($mysql_form_check)) { $errors = array_merge($errors, $mysql_form_check); } } if (empty($form['gallery_name'])) { $errors[] = plog_tr('Please enter the name for your gallery.'); } if (empty($form['admin_email'])) { $errors[] = plog_tr('Please enter your email address.'); } if (empty($form['admin_username'])) { $errors[] = plog_tr('Please enter a username.'); } if (empty($form['admin_password'])) { $errors[] = plog_tr('Please enter a password.'); } if ($form['admin_password'] != $form['admin_password_confirm']) { $errors[] = plog_tr('Your passwords do not match. Please try again.'); } if (is_safe_mode()) { // If safe_mode enabled, check the FTP information form inputs $ftp_form_check = check_ftp_form($form); $form = $ftp_form_check['form']; if (!empty($ftp_form_check['form']['errors'])) { $errors = array_merge($errors, $ftp_form_check['form']['errors']); } } if (empty($errors)) { $mysql_errors = check_mysql($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']); if (is_safe_mode()) { $ftp_errors = check_ftp($form['ftp_host'], $form['ftp_user'], $form['ftp_pass'], $form['ftp_path']); } else { $ftp_errors = array(); } $errors = array_merge($mysql_errors, $ftp_errors); $ok = empty($errors); } if (!$ok) { echo '<ul class="errors" style="background-image: none;">' . "\n\t" . '<li class="margin-5">'; echo join("</li>\n\t<li class=\"margin-5\">", $errors); echo "</li>\n</ul>\n\n"; } else { $_SESSION['install_values'] = array('gallery_name' => $form['gallery_name'], 'admin_email' => $form['admin_email'], 'admin_password' => $form['admin_password'], 'admin_username' => $form['admin_username']); if (is_safe_mode()) { $_SESSION['ftp_values'] = array('ftp_host' => $form['ftp_host'], 'ftp_user' => $form['ftp_user'], 'ftp_pass' => $form['ftp_pass'], 'ftp_path' => $form['ftp_path']); } if (!defined('PLOGGER_DB_HOST') || isset($mysql_fail)) { // Serve the config file and ask user to upload it to webhost $_SESSION['plogger_config'] = create_config_file($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']); } return true; } } include PLOGGER_DIR . 'plog-admin/includes/install-form-setup.php'; return false; }
SmartyValidate::register_validator('v_language', 'language', 'dummyValid', false, false, 'trim', 'install'); } else { SmartyValidate::connect($tpl); if (SmartyValidate::is_valid($_POST, 'install')) { $_SESSION['language'] = !empty($_POST['language']) ? $_POST['language'] : 'en'; SmartyValidate::disconnect(); $step++; @header('Location: index.php?step=' . $step); @exit; } else { $tpl->assign($_POST); } } break; case 2: $tpl->assign('req', check_requirements()); $tpl->assign('btn_next', 1); $tpl->assign('btn_back', 1); $tpl->assign('title', _L('Welcome')); if (!empty($_POST['submit']) && $_POST['submit'] == 'next') { SmartyValidate::disconnect(); $step++; @header('Location: index.php?step=' . $step); @exit; } elseif (!empty($_POST['submit']) && $_POST['submit'] == 'back') { SmartyValidate::disconnect(); $step--; @header('Location: index.php?step=' . $step); @exit; } break;
?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Upgrade Plogger</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/admin.css" /> </head> <body> <div><img src="images/plogger.gif" alt="Plogger" /></div> <?php // Check the requirements $errors = check_requirements(); if (sizeof($errors) > 0) { echo "\n\t" . '<p class="errors">' . plog_tr('Plogger cannot be upgraded until the following problems are resolved') . ':</p>'; echo "\n\n\t\t" . '<ul class="info">'; foreach ($errors as $error) { echo "\n\t\t\t" . '<li class="margin-5">' . $error . '</li>'; } echo "\n\t\t" . '</ul>'; echo "\n\n\t\t" . '<form method="get" action="' . $_SERVER['REQUEST_URI'] . '"> <p><input class="submit" type="submit" value="' . plog_tr('Try again') . '" /></p> </form>' . "\n"; } else { // End of requirement check $errors = ""; echo "\n" . '<h1>' . plog_tr('Upgrading Plogger') . '</h1>'; switch ($step) {
function generate($config) { global $fpdf_charwidths; global $g_baseurl; global $g_border; global $g_box_uid; global $g_boxes; global $g_colors; global $g_config; global $g_css; global $g_css_defaults_obj; global $g_css_handlers; global $g_css_index; global $g_css_obj; global $g_font_family; global $g_font_resolver; global $g_font_resolver_pdf; global $g_font_size; global $g_frame_level; global $g_html_entities; global $g_image_cache; global $g_last_assigned_font_id; global $g_list_item_nums; global $g_manager_encodings; global $g_media; global $g_predefined_media; global $g_pt_scale; global $g_px_scale; global $g_stylesheet_title; global $g_table_border; global $g_tag_attrs; global $g_unicode_glyphs; global $g_utf8_converters; global $g_utf8_to_encodings_mapping_pdf; global $g_valign; global $psdata; global $g_font_style; global $g_font_family; global $g_font_weight; global $g_font_size; global $g_line_height; // global $base_font_size; $context = pobject::getContext(); $me = $context["arCurrentObject"]; require_once HTML2PS_LOCATION . 'pipeline.factory.class.php'; set_time_limit(600); check_requirements(); $g_baseurl = trim($config['URL']); if ($g_baseurl === "") { $me->error = "Please specify URL to process!"; return false; } // Add HTTP protocol if none specified if (!preg_match("/^https?:/", $g_baseurl)) { $g_baseurl = 'http://' . $g_baseurl; } $g_css_index = 0; // Title of styleshee to use (empty if no preferences are set) $g_stylesheet_title = ""; $g_config = array('cssmedia' => isset($config['cssmedia']) ? $config['cssmedia'] : "screen", 'convert' => isset($config['convert']), 'media' => isset($config['media']) ? $config['media'] : "A4", 'scalepoints' => isset($config['scalepoints']), 'renderimages' => isset($config['renderimages']), 'renderfields' => isset($config['renderfields']), 'renderforms' => isset($config['renderforms']), 'pslevel' => isset($config['pslevel']) ? $config['pslevel'] : 2, 'renderlinks' => isset($config['renderlinks']), 'pagewidth' => isset($config['pixels']) ? (int) $config['pixels'] : 800, 'landscape' => isset($config['landscape']), 'method' => isset($config['method']) ? $config['method'] : "fpdf", 'margins' => array('left' => isset($config['leftmargin']) ? (int) $config['leftmargin'] : 0, 'right' => isset($config['rightmargin']) ? (int) $config['rightmargin'] : 0, 'top' => isset($config['topmargin']) ? (int) $config['topmargin'] : 0, 'bottom' => isset($config['bottommargin']) ? (int) $config['bottommargin'] : 0), 'encoding' => isset($config['encoding']) ? $config['encoding'] : "", 'ps2pdf' => isset($config['ps2pdf']) ? $config['ps2pdf'] : 0, 'compress' => isset($config['compress']) ? $config['compress'] : 0, 'output' => isset($config['output']) ? $config['output'] : 0, 'pdfversion' => isset($config['pdfversion']) ? $config['pdfversion'] : "1.2", 'transparency_workaround' => isset($config['transparency_workaround']), 'imagequality_workaround' => isset($config['imagequality_workaround']), 'draw_page_border' => isset($config['pageborder']), 'debugbox' => isset($config['debugbox']), 'watermarkhtml' => isset($config['watermarkhtml']), 'smartpagebreak' => isset($config['smartpagebreak']), 'html2xhtml' => !isset($config['html2xhtml']), 'mode' => 'html'); // ========== Entry point parse_config_file(HTML2PS_LOCATION . './.html2ps.config'); // validate input data if ($g_config['pagewidth'] == 0) { $me->error = "Please specify non-zero value for the pixel width!"; return false; } // begin processing $g_media = Media::predefined($g_config['media']); $g_media->set_landscape($g_config['landscape']); $g_media->set_margins($g_config['margins']); $g_media->set_pixels($g_config['pagewidth']); $g_px_scale = mm2pt($g_media->width() - $g_media->margins['left'] - $g_media->margins['right']) / $g_media->pixels; if ($g_config['scalepoints']) { $g_pt_scale = $g_px_scale * 1.43; // This is a magic number, just don't touch it, or everything will explode! } else { $g_pt_scale = 1.0; } // Initialize the coversion pipeline $pipeline = new Pipeline(); // Configure the fetchers $pipeline->fetchers[] = new FetcherURL(); // Configure the data filters $pipeline->data_filters[] = new DataFilterDoctype(); $pipeline->data_filters[] = new DataFilterUTF8($g_config['encoding']); if ($g_config['html2xhtml']) { $pipeline->data_filters[] = new DataFilterHTML2XHTML(); } else { $pipeline->data_filters[] = new DataFilterXHTML2XHTML(); } $pipeline->parser = new ParserXHTML(); $pipeline->pre_tree_filters = array(); if ($g_config['renderfields']) { $pipeline->pre_tree_filters[] = new PreTreeFilterHTML2PSFields("", "", ""); } if ($g_config['method'] === 'ps') { $pipeline->layout_engine = new LayoutEnginePS(); } else { $pipeline->layout_engine = new LayoutEngineDefault(); } $pipeline->post_tree_filters = array(); // Configure the output format if ($g_config['pslevel'] == 3) { $image_encoder = new PSL3ImageEncoderStream(); } else { $image_encoder = new PSL2ImageEncoderStream(); } switch ($g_config['method']) { case 'ps': $pipeline->output_driver = new OutputDriverPS($g_config['scalepoints'], $g_config['transparency_workaround'], $g_config['imagequality_workaround'], $image_encoder); break; case 'fastps': $pipeline->output_driver = new OutputDriverFastPS($image_encoder); break; case 'pdflib': $pipeline->output_driver = new OutputDriverPDFLIB($g_config['pdfversion']); break; case 'fpdf': $pipeline->output_driver = new OutputDriverFPDF(); break; default: $me->error = "Unknown output method"; return false; } if ($g_config['debugbox']) { $pipeline->output_driver->set_debug_boxes(true); } if ($g_config['draw_page_border']) { $pipeline->output_driver->set_show_page_border(true); } if ($g_config['ps2pdf']) { $pipeline->output_filters[] = new OutputFilterPS2PDF($g_config['pdfversion']); } if ($g_config['compress']) { $pipeline->output_filters[] = new OutputFilterGZip(); } $pipeline->destination = new DestinationBrowser($g_baseurl); $dest_filename = $pipeline->destination->filename_escape($pipeline->destination->get_filename()); ldSetContent("application/pdf"); if (!$me->cached("html2ps_" . md5($dest_filename))) { // Start the conversion $status = $pipeline->process($g_baseurl, $g_media); if ($status == null) { ldSetContent("text/html"); $me->error = "Error in conversion pipeline: " . $pipeline->error_message(); $me->savecache(0); return false; } else { $me->savecache(999); } } return true; }
define('BASE_RELATIVE', '.'); } else { define('BASE_RELATIVE', str_replace(DOCUMENT_ROOT, '', BASE)); } // for debugging uncomment these lines: //print 'BASE = "'.BASE.'"<br>'; //print 'DOCUMENT_ROOT = "'.DOCUMENT_ROOT.'"<br>'; //print 'BASE_RELATIVE = "'.BASE_RELATIVE.'"<br>'; //print 'DIRECTORY_SEPARATOR = "'.DIRECTORY_SEPARATOR.'"<br>'; //exit; /******************************************************************************** * * make some checks * *********************************************************************************/ $messages = check_requirements(); if (count($messages) > 0) { print_messages_without_template('Part-DB', 'Mindestanforderungen von Part-DB nicht erfüllt!', '<font color="red"><strong>•' . implode('<br>•', $messages) . '</strong></font><br><br>' . 'Nähere Informationen gibt es in der <a target="_blank" href="' . BASE_RELATIVE . '/documentation/dokuwiki/doku.php?id=anforderungen">Dokumentation</a>.'); exit; } $messages = check_file_permissions(); if (count($messages) > 0) { $message = '<strong><font color="red">'; foreach ($messages as $msg) { $message .= '•' . $msg . '<br>'; } $message .= '</font></strong><br><br>'; $message .= 'Nähere Informationen zu den Dateirechten gibt es in der <a target="_blank" href="' . BASE_RELATIVE . '/documentation/dokuwiki/doku.php?id=installation">Dokumentation</a>.<br><br>'; $message .= '<form action="" method="post"><input type="submit" value="Seite neu laden"></form>'; print_messages_without_template('Part-DB', 'Anpassung der Rechte von Verzeichnissen und Dateien', $message); exit;
function do_install($form) { $form = array_map('stripslashes', $form); $form = array_map('trim', $form); $errors = check_requirements(); if (sizeof($errors) > 0) { print '<p>Plogger wont work until the following problems are resolved</p>'; print '<ul>'; foreach ($errors as $error) { print '<li>' . $error . '</li>'; } print '</ul>'; print '<form method="GET" action="_install.php"><input type="submit" value="Try again"/></form>'; return false; } if (defined('PLOGGER_DB_HOST')) { $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME); // looks like we are already configured if (empty($mysql)) { print '<p>Plogger is already installed!</p>'; return false; } } $ok = false; $errors = array(); if (!empty($form['action']) && 'install' == $form['action']) { if (empty($form['db_host'])) { $errors[] = 'Please enter the name of your MySQL host.'; } if (empty($form['db_user'])) { $errors[] = 'Please enter the MySQL username.'; } if (empty($form['db_pass'])) { $errors[] = 'Please enter the MySQL password.'; } if (empty($form['db_name'])) { $errors[] = 'Please enter the MySQL database name.'; } if (empty($form['gallery_name'])) { $errors[] = 'Please enter the name for your gallery.'; } if (empty($form['admin_email'])) { $errors[] = 'Please enter your e-mail address.'; } if (empty($errors)) { $errors = check_mysql($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']); $ok = empty($errors); } if (!$ok) { print '<ul><li>'; print join("</li>\n<li>", $errors); print '</li></ul>'; } else { $password = generate_password(); $_SESSION["install_values"] = array("gallery_name" => $form["gallery_name"], "admin_email" => $form["admin_email"], "admin_password" => $password, "admin_username" => "admin"); $conf = create_config_file($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']); // if configuration file is writable, then set the values // otherwise serve the config file to user and ask her to // upload it to webhost if (config_writable()) { write_config($conf); } else { $_SESSION["plogger_config"] = $conf; } require PLOGGER_DIR . 'lib/plogger/form_setup_complete.php'; return true; } } // most of the time it's probably running on localhost if (empty($form['db_host'])) { $form['db_host'] = 'localhost'; } $init_vars = array('db_user', 'db_pass', 'db_name', 'gallery_name', 'admin_email'); foreach ($init_vars as $var) { if (empty($form[$var])) { $form[$var] = ""; } } require PLOGGER_DIR . 'lib/plogger/form_setup.php'; }