$errorReportingLevel = E_ALL & ~E_STRICT; } elseif ($prefs['error_reporting_level'] == 2039) { $errorReportingLevel = E_ALL & ~E_NOTICE; } elseif ($prefs['error_reporting_level'] == -1) { $errorReportingLevel = E_ALL | E_STRICT; // Play safe, as E_ALL did not include E_STRICT before PHP 5.4... } elseif ($prefs['error_reporting_level'] == 1) { $errorReportingLevel = error_reporting(); } else { $errorReportingLevel = $prefs['error_reporting_level']; } // Handle Smarty Notices if (!empty($prefs['smarty_notice_reporting']) and $prefs['smarty_notice_reporting'] === 'y') { $errorHandlerReportingLevel = $errorReportingLevel | E_NOTICE | E_USER_NOTICE; } else { $errorHandlerReportingLevel = $errorReportingLevel | E_USER_NOTICE; } set_error_handler('tiki_error_handling', $errorHandlerReportingLevel); error_reporting($errorReportingLevel); if ($prefs['log_sql'] == 'y' && $api_tiki == 'adodb') { $dbTiki->LogSQL(); global $ADODB_PERF_MIN; $ADODB_PERF_MIN = $prefs['log_sql_perf_min']; } $tikifeedback = array(); // TODO: check this only once per session or only if a feature ask for it TikiSetup::check($tikidomain); if (!isset($phpErrors)) { $phpErrors = array(); } $smarty->assign_by_ref('phpErrors', $phpErrors);
$prefs['helpurl'] = "http://doc.tikiwiki.org/"; $prefs['layout_section'] = 'n'; $prefs['limitedGoGroupHome'] = 'n'; $prefs['minical_reminders'] = 0; $prefs['modallgroups'] = 'n'; $prefs['modseparateanon'] = 'n'; $prefs['php_docroot'] = 'http://php.net/'; $prefs['proxy_host'] = ''; $prefs['proxy_port'] = ''; $prefs['sender_email'] = ''; $prefs['feature_site_report_email'] = ''; $prefs['session_db'] = 'n'; $prefs['session_lifetime'] = 0; $prefs['shoutbox_autolink'] = 'n'; $prefs['show_comzone'] = 'n'; $prefs['system_os'] = TikiSetup::os(); $prefs['tikiIndex'] = 'tiki-index.php'; $prefs['urlIndex'] = ''; $prefs['useGroupHome'] = 'n'; $prefs['useUrlIndex'] = 'n'; $prefs['use_proxy'] = 'n'; $prefs['user_list_order'] = 'score_desc'; $prefs['webserverauth'] = 'n'; $prefs['feature_purifier'] = 'n'; $prefs['feature_lightbox'] = 'n'; $prefs['feature_shadowbox'] = 'n'; $prefs['log_sql'] = 'n'; $prefs['log_mail'] = 'n'; $prefs['case_patched'] = 'n'; $prefs['site_closed'] = 'n'; $prefs['site_closed_msg'] = 'Site is closed for maintenance; please come back later.';
function check($tikidomain = '') { static $checked; if ($checked) { return; } $checked = true; $errors = ''; if (strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') == TRUE) { if (array_key_exists('PATH_TRANSLATED', $_SERVER)) { $docroot = dirname($_SERVER['PATH_TRANSLATED']); } else { $docroot = getcwd(); } } else { $docroot = getcwd(); } if (ini_get('session.save_handler') == 'files') { $save_path = ini_get('session.save_path'); // check if we can check it. The session.save_path can be outside // the open_basedir paths. $open_basedir = ini_get('open_basedir'); if (empty($open_basedir)) { if (!is_dir($save_path)) { $errors .= "The directory '{$save_path}' does not exist or PHP is not allowed to access it (check open_basedir entry in php.ini).\n"; } else { if (!is_writeable($save_path)) { $errors .= "The directory '{$save_path}' is not writeable.\n"; } } } if ($errors) { $save_path = TikiSetup::tempdir(); if (is_dir($save_path) && is_writeable($save_path)) { session_save_path($save_path); $errors = ''; } } } $wwwuser = ''; $wwwgroup = ''; if (TikiSetup::isWindows()) { $wwwuser = '******'; $wwwgroup = 'SYSTEM'; } if (function_exists('posix_getuid')) { $user = @posix_getpwuid(@posix_getuid()); $group = @posix_getpwuid(@posix_getgid()); $wwwuser = $user ? $user['name'] : false; $wwwgroup = $group ? $group['name'] : false; } if (!$wwwuser) { $wwwuser = '******'; } if (!$wwwgroup) { $wwwgroup = 'nobody (or the group account the web server is running under)'; } static $dirs = array('backups', 'dump', 'img/wiki', 'img/wiki_up', 'modules/cache', 'temp', 'templates_c'); foreach ($dirs as $dir) { if (!is_dir("{$docroot}/{$dir}/{$tikidomain}")) { $errors .= "The directory '{$docroot}/{$dir}/{$tikidomain}' does not exist.\n"; } else { if (!is_writeable("{$docroot}/{$dir}/{$tikidomain}")) { $errors .= "The directory '{$docroot}/{$dir}/{$tikidomain}' is not writeable by {$wwwuser}.\n"; } } } if ($errors) { $PHP_CONFIG_FILE_PATH = PHP_CONFIG_FILE_PATH; ob_start(); phpinfo(INFO_MODULES); $httpd_conf = 'httpd.conf'; if (preg_match('/Server Root<\\/b><\\/td><td\\s+align="left">([^<]*)</', ob_get_contents(), $m)) { $httpd_conf = $m[1] . '/' . $httpd_conf; } ob_end_clean(); print "\n<html><body>\n<h2><font color='red'>Tikiwiki is not properly set up:</font></h1>\n<pre>\n{$errors}\n"; if ($tikidomain) { $install_link = '?multi=' . urlencode($tikidomain); } if (!TikiSetup::isWindows()) { print "Your options:\n\n\n\t1- With FTP access:\n\t\ta) Change the permissions (chmod) of the directories to 777.\n\t\tb) Create any missing directories\n\t\tc) <a href='tiki-install.php{$install_link}'>Execute the Tiki installer again</a> (Once you have executed these commands, this message will disappear!)\n\n\tor\n\n\t2- With shell (SSH) access, you can run the command below.\n\n\t\ta) Run setup.sh and follow the instructions:\n\t\t\t\$ bash\n\t\t\t\$ cd {$docroot}\n\t\t\t\$ sh setup.sh\n\n\t\tThe script will offer you options depending on your server configuration.\n\n\t\tb) <a href='tiki-install.php{$install_link}'>Execute the Tiki installer again</a> (Once you have executed these commands, this message will disappear!)\n\n\n<hr>\nIf you have problems accessing a directory, check the open_basedir entry in\n{$PHP_CONFIG_FILE_PATH}/php.ini or {$httpd_conf}.\n\n<hr>\n\n<a href='http://doc.tikiwiki.org/Installation' target='_blank'>Consult the tikiwiki.org installation guide</a> if you need more help or <a href='http://tikiwiki.org/tiki-forums.php' target='_blank'>visit the forums</a>\n\n</pre></body></html>"; } exit; } }
} $pref_byref_values = array("display_field_order", "display_timezone", "server_timezone", "long_date_format", "long_time_format", "short_date_format", "short_time_format", "siteTitle", "tikiIndex"); foreach ($pref_byref_values as $britem) { byref_set_value($britem); } $tikilib->set_preference("display_timezone", $tikilib->get_preference("server_timezone")); // Special handling for tied fields: tikiIndex, urlIndex and useUrlIndex if (!empty($_REQUEST["urlIndex"]) && isset($_REQUEST["useUrlIndex"]) && $_REQUEST["useUrlIndex"] == 'on') { $_REQUEST["tikiIndex"] = $_REQUEST["urlIndex"]; $tikilib->set_preference("tikiIndex", $_REQUEST["tikiIndex"]); } // Special handling for tmpDir, which has a default value if (isset($_REQUEST["tmpDir"])) { $tikilib->set_preference("tmpDir", $_REQUEST["tmpDir"]); } else { $tdir = TikiSetup::tempdir(); $tikilib->set_preference("tmpDir", $tdir); } // not needed anymore? -- gongo //$smarty->assign('pagetop_msg', tra("Your settings have been updated. <a href='tiki-admin.php?page=general'>Click here</a> or come back later see the changes. That is a known bug that will be fixed in the next release.")); $smarty->assign('pagetop_msg', ""); } elseif (isset($_REQUEST["newadminpass"])) { check_ticket('admin-inc-general'); if ($_REQUEST["adminpass"] != $_REQUEST["again"]) { $msg = tra("The passwords do not match"); $access->display_error(basename(__FILE__), $msg); } // Dont allow blank passwords here if (strlen($_REQUEST["adminpass"]) == 0) { $smarty->assign("msg", tra("You cannot have a blank password")); $smarty->display("error.tpl");
$smarty->assign('isIE', $isIE); $showIeMsg = false; if ($isIE) { if (!isset($_COOKIE['ieMsgSeen']) || !$_COOKIE['ieMsgSeen']) { $showIeMsg = true; setcookie('ieMsgSeen', 1, time() + 60 * 60 * 24 * 7); } } global $style; $style = $prefs['style']; $smarty->assign('style', $style); $smarty->assign('showIeMsg', $showIeMsg); $smarty->assign('showTeste', preg_match('/teste\\.estudioli.re\\.org/', $ownurl)); //TODO descobrir pq precisa dessa bosta aqui pra traducao funcionar tra(''); TikiSetup::prependIncludePath('lib/elgal/model'); // TODO: Fazer ieGIF2PNG q substitui o {if $isIE}gif{else}png{/if} $styleDir = str_replace('.css', '', $prefs['style']); $smarty->assign('styleDir', $styleDir); $headerlib->add_cssfile("styles/{$styleDir}/css/tooltip.css"); $headerlib->add_cssfile("styles/{$styleDir}/css/lightbox.css"); if ($isIE) { $headerlib->add_cssfile("styles/{$styleDir}/css/ie.css"); } $headerlib->add_jsfile('lib/ajax/tiki-ajax.js'); $headerlib->add_jsfile('lib/js/general.js'); $headerlib->add_jsfile('lib/js/toggleImage.js'); $headerlib->add_jsfile('lib/js/tooltip.js'); $headerlib->add_jsfile('lib/elgal/player/cortado.js'); $headerlib->add_jsfile('lib/js/lightbox.js'); $headerlib->add_jsfile('lib/js/busca.js');
function check($tikidomain = '') { static $checked; if ($checked) { return; } $checked = true; $errors = ''; if (strpos($_SERVER["SERVER_SOFTWARE"], "IIS") == TRUE) { if (array_key_exists('PATH_TRANSLATED', $_SERVER)) { $docroot = dirname($_SERVER['PATH_TRANSLATED']); } else { $docroot = getcwd(); } } else { $docroot = getcwd(); } if (ini_get('session.save_handler') == 'files') { $save_path = ini_get('session.save_path'); // check if we can check it. The session.save_path can be outside // the open_basedir paths. $open_basedir = ini_get('open_basedir'); if (empty($open_basedir)) { if (!is_dir($save_path)) { $errors .= "The directory '{$save_path}' does not exist or PHP is not allowed to access it (check open_basedir entry in php.ini).\n"; } else { if (!is_writeable($save_path)) { $errors .= "The directory '{$save_path}' is not writeable.\n"; } } } if ($errors) { $save_path = TikiSetup::tempdir(); if (is_dir($save_path) && is_writeable($save_path)) { ini_set('session.save_path', $save_path); $errors = ''; } } } $wwwuser = ''; $wwwgroup = ''; if (TikiSetup::isWindows()) { $wwwuser = '******'; $wwwgroup = 'SYSTEM'; } if (function_exists('posix_getuid')) { $user = @posix_getpwuid(@posix_getuid()); $group = @posix_getpwuid(@posix_getgid()); $wwwuser = $user ? $user['name'] : false; $wwwgroup = $group ? $group['name'] : false; } if (!$wwwuser) { $wwwuser = '******'; } if (!$wwwgroup) { $wwwgroup = 'nobody (or the group account the web server is running under)'; } static $dirs = array('backups', 'dump', 'img/wiki', 'img/wiki_up', 'modules/cache', 'temp', 'templates_c'); foreach ($dirs as $dir) { if (!is_dir("{$docroot}/{$dir}/{$tikidomain}")) { $errors .= "The directory '{$docroot}/{$dir}/{$tikidomain}' does not exist.\n"; } else { if (!is_writeable("{$docroot}/{$dir}/{$tikidomain}")) { $errors .= "The directory '{$docroot}/{$dir}/{$tikidomain}' is not writeable by {$wwwuser}.\n"; } } } if ($errors) { $PHP_CONFIG_FILE_PATH = PHP_CONFIG_FILE_PATH; ob_start(); phpinfo(INFO_MODULES); $httpd_conf = 'httpd.conf'; if (preg_match('/Server Root<\\/b><\\/td><td\\s+align="left">([^<]*)</', ob_get_contents(), $m)) { $httpd_conf = $m[1] . '/' . $httpd_conf; } ob_end_clean(); print "\n<html><body>\n<h2><font color='red'>TikiWiki is not properly set up:</font></h1>\n<pre>\n{$errors}\n"; if ($tikidomain) { $install_link = '?multi=' . urlencode($tikidomain); } if (!TikiSetup::isWindows()) { print "You may either chmod the directories above manually to 777, or run one of the sets of commands below.\n<b><a href='tiki-install.php{$install_link}'>Proceed to the Tiki installer</a></b> after you run the commands below.\n\nIf you cannot become root, and are NOT part of the group {$wwwgroup}:\n \$ bash\n \$ cd {$docroot}\n \$ chmod +x setup.sh\n \$ ./setup.sh yourlogin yourgroup 02777\n Tip: You can find your group using the command 'id'.\n\nIf you cannot become root, but are a member of the group {$wwwgroup}:\n \$ bash\n \$ cd {$docroot}\n \$ chmod +x setup.sh\n \$ ./setup.sh mylogin {$wwwgroup}</i>\n\nIf you can become root:\n \$ bash\n \$ cd {$docroot}\n \$ chmod +x setup.sh\n \$ su -c './setup.sh {$wwwuser}'\n\nIf you have problems accessing a directory, check the open_basedir entry in\n{$PHP_CONFIG_FILE_PATH}/php.ini or {$httpd_conf}.\n\nOnce you have executed these commands, this message will disappear!\n\nNote: If you cannot become root, you will not be able to delete certain\nfiles created by apache, and will need to ask your system administrator\nto delete them for you if needed.\n\n<a href='http://tikiwiki.org/InstallTiki' target='_blank'>Consult the tikiwiki.org installation guide</a> if you need more help.\n\n<b><a href='tiki-install.php'>Proceed to the Tiki installer</a></b> if you've completed the steps above.\n</pre></body></html>"; } exit; } }
$tikiroot .= '/'; } if (substr($tikipath, -1, 1) != '/') { $tikipath .= '/'; } require_once 'lib/init/initlib.php'; ///if ( ! isset($_SESSION['votes']) ) $_SESSION['votes'] = array(); $num_queries = 0; $elapsed_in_db = 0.0; $server_load = ''; $area = 'tiki'; $crumbs = array(); require_once 'lib/setup/tikisetup.class.php'; TikiSetup::prependIncludePath($tikipath); TikiSetup::prependIncludePath('lib'); TikiSetup::prependIncludePath('lib/pear'); require_once 'lib/setup/timer.class.php'; $tiki_timer = new timer(); $tiki_timer->start(); require_once 'tiki-setup_base.php'; require_once 'lib/setup/compatibility.php'; require_once 'lib/setup/prefs.php'; // TikiTests are PHP5 only if ($prefs['feature_tikitests'] == 'y' and version_compare(PHP_VERSION, '5.0.0', '>=')) { require_once 'tiki_tests/tikitestslib.php'; } $crumbs[] = new Breadcrumb($prefs['siteTitle'], '', $prefs['tikiIndex']); if ($prefs['site_closed'] == 'y') { require_once 'lib/setup/site_closed.php'; } require_once 'lib/setup/error_reporting.php';