public function getInstallForm(Application $app, Request $request) { $warnings = []; $requirementsCollection = $this->getRequirementsCollection(); foreach ($requirementsCollection as $requirements) { foreach ($requirements->getRequirements() as $requirement) { if (!$requirement->isFulfilled() && !$requirement->isOptional()) { $warnings[] = $requirement->getTestMessage(); } } } if ($request->getScheme() == 'http') { $warnings[] = $app->trans('It is not recommended to install Phraseanet without HTTPS support'); } return $app['twig']->render('/setup/step2.html.twig', ['locale' => $app['locale'], 'available_locales' => Application::getAvailableLanguages(), 'available_templates' => ['en', 'fr'], 'warnings' => $warnings, 'error' => $request->query->get('error'), 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/', 'discovered_binaries' => \setup::discover_binaries(), 'rootpath' => realpath(__DIR__ . '/../../../../')]); }
function checkMainFolderPermissions() { global $config; global $HTTP_POST_VARS; if (!is_writable($config['fileDir'])) { require "setup/setup.php"; if ($HTTP_POST_VARS['doFtpChanges']) { $tryUsingFtp = new setup(); $tryUsingFtp->writeHtmlHeader(); $tryUsingFtp->writeUsingFtp($HTTP_POST_VARS); } else { $initialSetup = new setup(); $initialSetup->writeHtmlHeader(); $initialSetup->writeAnalysis(); } } }
static function form($folder, $required_fields) { setup::out_exit(' Folder: ' . q(modify::getpathfull($folder)) . '<br> <br> <a href="index.php?export=calc&limit=1&hide_fields=id&folder=' . q($folder) . '&view=details">{t}Download example file{/t} (.xls)</a> <br> {t}Required fields{/t}: ' . q(implode(", ", $required_fields)) . ' <br><br> {t}File{/t} (.xls):<br> <form method="post" action="import.php?" enctype="multipart/form-data"> <input type="hidden" name="token" value="' . modify::get_form_token() . '"> <input type="hidden" name="folder" value="' . q($folder) . '"> <input type="File" name="file[]" value="" multiple="true" required="true"> <input type="submit" value="{t}I m p o r t{/t}" class="submit"> <input type="submit" name="validate_only" value="{t}V a l i d a t e{/t}" class="submit"> </form> <br> <b>{t}Note{/t}:</b> {t}Assets can be imported into multiple folders by adding the "Folder" column.{/t}<br> <b>{t}Note{/t}:</b> {t}Assets can be overwritten by adding the "Id" column.{/t}<br> <br> <div style="border-top: 1px solid black;">Powered by Simple Groupware, Copyright (C) 2002-2012 by Thomas Bley.</div></div> </body> </html> '); }
static function footer() { setup::out("<br><a href='index.php'>{t}C O N T I N U E{/t}</a><finished>"); setup::out('<br><div style="border-top: 1px solid black;">Powered by Simple Groupware, Copyright (C) 2002-2012 by Thomas Bley.</div></div></body></html>'); }
function install() { setup::out(' <html> <head> <title>Simple Groupware & CMS</title> <style> body { width:526px; margin:10px auto; } body, a { color: #666666; font-size: 13px; font-family: Arial, Helvetica, Verdana, sans-serif; } a { color: #0000FF; } </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <div style="border-bottom: 1px solid #666666; letter-spacing: 2px; font-size: 18px; font-weight: bold;">Simple Groupware ' . CORE_VERSION_STRING . '</div> '); $_SESSION["groups"] = array(); $_SESSION["username"] = "******"; $_SESSION["password"] = ""; $_SESSION["permission_sql"] = "1=1"; $_SESSION["permission_sql_read"] = "1=1"; $_SESSION["permission_sql_write"] = "1=1"; define("SETUP_DB_TYPE", $_REQUEST["db_type"]); $update = sgsml_parser::table_column_exists("simple_sys_tree", "id"); setup::out('<img src="http://www.simple-groupware.de/cms/logo.php/' . CORE_VERSION . '/' . SETUP_DB_TYPE . '/' . PHP_VERSION . '/' . (int) $update . '" style="width:1px; height:1px;">', false); setup::out(t("{t}Processing %s ...{/t}", "schema updates")); setup_update::change_database_pre(); if (SETUP_DB_TYPE == "sqlite") { sql_query("begin"); admin::rebuild_schema(false); sql_query("commit"); } else { admin::rebuild_schema(false); } setup_update::change_database_post(); setup::out(t("{t}Processing %s ...{/t}", "sessions")); db_delete("simple_sys_session", array(), array()); setup::out(t("{t}Processing %s ...{/t}", "default groups")); $groups = array("admin_calendar", "admin_news", "admin_projects", "admin_bookmarks", "admin_contacts", "admin_inventory", "admin_helpdesk", "admin_organisation", "admin_files", "admin_payroll", "admin_surveys", "admin_hr", "admin_intranet", "users_self_registration"); foreach ($groups as $group) { trigger::creategroup($group); } setup_update::database_triggers(); setup::out(t("{t}Processing %s ...{/t}", "folder structure")); $count = db_select_value("simple_sys_tree", "id", array()); if (empty($count)) { $folders = "modules/core/folders.xml"; if (!empty($_REQUEST["folders"]) and file_exists(sys_custom($_REQUEST["folders"]))) { $folders = $_REQUEST["folders"]; } if (SETUP_DB_TYPE == "sqlite") { sql_query("begin"); folders::create_default_folders($folders, 0, true); sql_query("commit"); } else { folders::create_default_folders($folders, 0, true); } } setup_update::database_folders(); setup::out(t("{t}Processing %s ...{/t}", "css")); admin::build_css(); setup::out(t("{t}Processing %s ...{/t}", "js")); admin::build_js(); setup::out(t("{t}Processing %s ...{/t}", "icons")); admin::build_icons(); setup::out(t("{t}Processing %s ...{/t}", "config.php")); $vars = array("SETUP_DB_TYPE" => "'" . $_REQUEST["db_type"] . "'", "SETUP_DB_HOST" => "'" . $_REQUEST["db_host"] . "'", "SETUP_DB_NAME" => "'" . $_REQUEST["db_name"] . "'", "SETUP_DB_USER" => "'" . $_REQUEST["db_user"] . "'", "SETUP_DB_PW" => "'" . sys_encrypt($_REQUEST["db_pw"], sha1($_REQUEST["admin_user"])) . "'", "SETUP_ADMIN_USER" => "'" . $_REQUEST["admin_user"] . "'", "SETUP_ADMIN_PW" => "'" . (isset($_REQUEST["auto_update"]) ? $_REQUEST["admin_pw"] : sha1($_REQUEST["admin_pw"])) . "'"); setup::save_config($vars); setup::install_footer(); db_optimize_tables(); }
public function actionDeactivate() { Yii::app()->end(); $setup = new setup(); $setup->down(); }
<?php include "setup_classes.php"; if (($infile = fopen("20162501-setup.csv", "r")) == TRUE) { $mysetups = setup::new_setup_from_file($infile); print_r($mysetups); } else { echo "Cannot open file\n"; } if (setup::compare($mysetups[102], $mysetups[103])) { echo "match!\n"; } else { echo "no match\n"; } /* if (($inputfile = fopen($file_name, "r")) !== FALSE) { $data = fgetcsv($inputfile); for ($i = 0; $i <= count($data); ++$i) { echo $i . ":\t" . $data[$i] . "\n"; } $event_num = substr($data[21], 1, 5); $event_name = substr($data[21], 7); echo "number: ".$event_num."\tname: ".$event_name; echo "\nNum: ".is_numeric($event_num); echo "\nName: ".is_numeric($even_name); preg_match('/(?<=Room ).+/s', $data[16], $room); echo "\n".$room[0]; //string pattern, string subject [, array &matches [, int flags [, int offset]]]) }
public function save_config() { $this->template->page_title = __('Saving Database Configuration File'); $data = Session::instance()->get('database_data'); if ($data !== NULL) { if (setup::create_database_config($data)) { url::redirect('install/complete'); } $error = __('Unable to write database.php config file'); } $this->template->content = View::factory('install/save_config'); $this->template->content->error = isset($error) ? $error : ''; }
static function show_lang() { setup::out(' <html> <head> <title>Simple Groupware & CMS</title> <style> body { width:526px; margin:10px auto; } body, a { color: #666666; font-size: 13px; font-family: Arial, Helvetica, Verdana, sans-serif; } a { color: #0000FF; } #logo_table { color:#FFFFFF; background-image:url(ext/images/sgs_logo_bg.jpg); width:512px; height:208px; border-radius:4px; -moz-transition:opacity 3s; -webkit-transition:opacity 3s; opacity:0; } .logo { border-radius:8px; border:1px solid #AAAAAA; width:526px; height:222px; margin-bottom:10px; } .tab { width:84%; margin:auto; } .font { text-shadow: -1px -1px 0px #101010, 1px 1px 0px #505050; font-family: Coustard, serif; } @font-face { font-family:"Coustard"; src:local("Coustard"), url("ext/images/coustard.woff") format("woff"); } </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body onload="document.getElementById(\'logo_table\').style.opacity=1;"> <table class="logo"> <tr><td align="center" valign="middle"> <table id="logo_table"> <tr style="height:45px;"><td align="center" valign="top" class="font" style="font-size:80%"><b>Simple Groupware Solutions</b></td></tr> <tr><td align="center" class="font" style="font-size:170%;"><b>Simple Groupware<br>' . CORE_VERSION_STRING . '</b></td></tr> <tr style="height:50px;"><td valign="bottom" style="font-size:70%">Photo from<br>Axel Kristinsson</td></tr> </table> </td></tr> </table> ', false); self::out("<table class='tab'><tr><td>", false); $i = 0; $langs = select::languages(); foreach ($langs as $lang => $lang_str) { $i++; self::out("<a href='index.php?lang=" . $lang . "'>" . $lang_str . "</a><br>"); if ($i == ceil(count($langs) / 2)) { self::out("</td><td valign='top' align='right'>", false); } } self::out("</td></tr></table>", false); self::out('<div style="border-top: 1px solid #666666;">Powered by Simple Groupware, Copyright (C) 2002-2012 by Thomas Bley.</div></body></html>', true, true); }
<?php include_once 'adb.php'; class setup extends adb { function setup() { } function createTable($name, $query) { $str_query = "create table if not exists " . $name . "(" . $query . ")"; return $this->query($str_query); } } $obj = new setup(); $obj->createTable('webPro_department', 'department_id INT AUTO_INCREMENT PRIMARY KEY,' . 'department_name VARCHAR(30)'); $obj->createTable('webPro_nurses', 'nurse_id INT AUTO_INCREMENT PRIMARY KEY,' . 'nurse_fname VARCHAR(50),' . 'nurse_sname VARCHAR(50),' . 'gender CHAR,' . 'department INT,' . 'FOREIGN KEY (department) REFERENCES webPro_department(department_id)'); $obj->createTable('webPro_administrators', 'admin_id INT AUTO_INCREMENT PRIMARY KEY,' . 'admin_fname VARCHAR(50),' . 'admin_sname VARCHAR(50),' . 'gender CHAR,' . 'department INT,' . 'position VARCHAR(20),' . 'FOREIGN KEY (department) REFERENCES webPro_department(department_id)'); $obj->createTable('webPro_tasks', 'task_id INT AUTO_INCREMENT PRIMARY KEY,' . 'description VARCHAR(100),' . 'nurse INT,' . 'date DATE,' . 'due_date DATE,' . 'date_started DATE,' . 'date_finished DATE,' . 'assigned_by INT,' . 'task_status VARCHAR(15) DEFAULT "not started",' . 'isadmin TINYINT(1),' . 'time TIME,' . 'FOREIGN KEY (nurse) REFERENCES webPro_nurses(nurse_id)'); $obj->createTable('webPro_users', 'user VARCHAR(50),' . 'password VARCHAR(20),' . 'admin BOOLEAN,' . 'id INT'); include_once 'administrator.php'; include_once 'users.php'; $fname = 'admin'; $sname = ''; $gender = 'M'; $department = 1; $username = '******'; $password = '******'; $obj = new administrator(); $user = new users(); $admin = 1;
} $folder = $_REQUEST["folder"]; sys_check_auth(); import::header(); if (isset($_FILES["file"]) and is_array($_FILES["file"])) { $files = import::process_files(); if (!empty($files)) { if (!sys_validate_token()) { sys_die(t("{t}Invalid security token{/t}")); } $folder = folder_from_path($folder); $validate_only = isset($_REQUEST["validate_only"]); foreach ($files as $file) { $message = $validate_only ? t("{t}Validating %s ...{/t}") : t("{t}Processing %s ...{/t}"); setup::out(sprintf("<b>" . $message . "</b>", q(modify::basename($file)))); ajax::file_import($folder, $file, array("setup", "out"), $validate_only); setup::out("<hr>"); } } } $sgsml = new sgsml($folder, "new"); $view = $sgsml->view; $required_fields = array(); foreach ($sgsml->current_fields as $name => $field) { if (empty($field["REQUIRED"])) { continue; } $required_fields[$name] = !empty($field["DISPLAYNAME"]) ? $field["DISPLAYNAME"] : $name; } import::form($folder, $required_fields); // TODO use URL for upload
@set_time_limit(1800); if (!sys_is_super_admin($_SESSION["username"])) { sys_die(t("{t}Not allowed. Please log in as super administrator.{/t}")); } updater::header(); $mirror_id = "sourceforge"; if (!empty($_REQUEST["mirror"]) and in_array($_REQUEST["mirror"], array_keys(updater::$mirrors))) { $mirror_id = $_REQUEST["mirror"]; } $mirror = updater::$mirrors[$mirror_id]; $move_folders = array("build/", "core/", "docs/", "ext/", "import/", "lang/", "lib/", "templates/", "tools/", "modules/"); sys_mkdir(SIMPLE_STORE . "/old/"); $folders = array_merge(array("./", SIMPLE_STORE . "/old/"), $move_folders); foreach ($folders as $folder) { if (is_dir($folder) and !is_writable($folder)) { setup::out_exit(t("{t}Please give write access to %s{/t}", $folder)); } } if (empty($_REQUEST["release"]) and empty($_REQUEST["cfile"]) or !sys_validate_token()) { updater::show_list($mirror_id); } else { if (!empty($_REQUEST["cfile"])) { $source = $_REQUEST["cfile"]; if (!file_exists($source) or filesize($source) < 3 * 1048576) { sys_die(t("{t}Error{/t}") . ": file-check [0] " . $source); } } else { $release = $_REQUEST["release"]; if ($release == "latest" or !is_numeric($release)) { $data = @file_get_contents($mirror["url"]); $match = array();
} } } } return $output; } /** * Add ending slash to url or path * * @return string input with ending slash */ function add_ending_slash($path_value) { if (substr($path_value, -1) != '/') { $path_value = $path_value . '/'; } return $path_value; } } // define the new constants since PHP version 5.3.0 for older PHP installations if (version_compare(PHP_VERSION, '5.3.0', '<') === true) { define('E_DEPRECATED', 8192); define('E_USER_DEPRECATED', 16384); } error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); if (ini_get('magic_quotes_runtime') === FALSE || ini_get('magic_quotes_runtime') != 0) { ini_set('magic_quotes_runtime', 0); } $con_setup = new setup(); $data = $con_setup->make_setup(); echo $data;
static function database_triggers() { // 0.664 if (!file_exists(SIMPLE_STORE . "/setup_emails")) { setup::out(sprintf("{t}Processing %s ...{/t}", "emails message")); $rows = db_select("simple_emails", "*", array("message_html='' and message!=''"), "", ""); if (is_array($rows) and count($rows) > 0) { foreach ($rows as $row) { trigger::createemail($row["id"], $row); } } touch(SIMPLE_STORE . "/setup_emails"); } // 0.704 if (!file_exists(SIMPLE_STORE . "/setup_notify")) { $notifications = array("simple_tasks" => "closed='0'", "simple_contacts" => "birthday!=''", "simple_contactactivities" => "finished='0'", "simple_sys_users" => "activated='1'"); foreach ($notifications as $table => $where) { setup::out(sprintf("{t}Processing %s ...{/t}", $table)); $rows = db_select($table, "*", array($where, "notification!=''"), "", ""); if (!is_array($rows) or count($rows) == 0) { continue; } foreach ($rows as $row) { trigger::notify($row["id"], $row, array(), $table); } } touch(SIMPLE_STORE . "/setup_notify"); } if (!file_exists(SIMPLE_STORE . "/setup_duration")) { setup::out(sprintf("{t}Processing %s ...{/t}", "tasks duration")); $rows = db_select("simple_tasks", "*", array(), "", ""); if (is_array($rows) and count($rows) > 0) { foreach ($rows as $row) { trigger::duration($row["id"], $row, false, "simple_tasks"); } } setup::out(sprintf("{t}Processing %s ...{/t}", "projects duration")); $rows = db_select("simple_projects", "*", array(), "", ""); if (is_array($rows) and count($rows) > 0) { foreach ($rows as $row) { trigger::createeditproject($row["id"], $row); } } touch(SIMPLE_STORE . "/setup_duration"); } setup::out(sprintf("{t}Processing %s ...{/t}", "appointments")); $rows = db_select("simple_calendar", "*", array(), "", ""); if (is_array($rows) and count($rows) > 0) { foreach ($rows as $row) { trigger::calcappointment($row["id"], $row, null, "simple_calendar"); } } }