function checkSensorWert() { $lastSensorVal = getDbValue("homecontrol_sensor", "lastValue", "id=" . $this->TERM_ROW->getNamedAttribute("sensor_id")); $checkSensorVal = $this->TERM_ROW->getNamedAttribute("value"); $comperator = $this->TERM_ROW->getNamedAttribute("termcondition"); return $this->isCompare($lastSensorVal, $checkSensorVal, $comperator); }
/** * Admin Warnings Block * * @since ImpressCMS 1.2 * @author Gustavo Pilla (aka nekro) <*****@*****.**> * @return array * @todo This code is the copy of the one wich was in the admin.php, it should be improved. */ function b_system_admin_warnings_show() { $block = array(); $block['msg'] = array(); // ###### Output warn messages for security ###### if (is_dir(ICMS_ROOT_PATH . '/install/')) { array_push($block['msg'], icms_core_Message::error(sprintf(_WARNINSTALL2, ICMS_ROOT_PATH . '/install/'), '', FALSE)); } /** @todo make this dynamic, so the value is updated automatically */ if (getDbValue(icms::$xoopsDB, 'modules', 'version', 'version="120" AND mid="1"') !== FALSE) { array_push($block['msg'], icms_core_Message::error('<a href="' . ICMS_MODULES_URL . '/system/admin.php?fct=modulesadmin&op=update&module=system">' . _WARNINGUPDATESYSTEM . '</a>')); } if (is_writable(ICMS_ROOT_PATH . '/mainfile.php')) { array_push($block['msg'], icms_core_Message::error(sprintf(_WARNINWRITEABLE, ICMS_ROOT_PATH . '/mainfile.php'), '', FALSE)); } if (is_dir(ICMS_ROOT_PATH . '/upgrade/')) { array_push($block['msg'], icms_core_Message::error(sprintf(_WARNINSTALL2, ICMS_ROOT_PATH . '/upgrade/'), '', FALSE)); } if (!is_dir(XOOPS_TRUST_PATH)) { array_push($block['msg'], icms_core_Message::error(_TRUST_PATH_HELP)); } $sql1 = "SELECT conf_modid FROM `" . icms::$xoopsDB->prefix('config') . "` WHERE conf_name = 'dos_skipmodules'"; if ($result1 = icms::$xoopsDB->query($sql1)) { list($modid) = icms::$xoopsDB->FetchRow($result1); $protector_is_active = '0'; if (NULL !== $modid) { $sql2 = "SELECT isactive FROM `" . icms::$xoopsDB->prefix('modules') . "` WHERE mid =" . $modid; $result2 = icms::$xoopsDB->query($sql2); list($protector_is_active) = icms::$xoopsDB->FetchRow($result2); } } if (file_exists(ICMS_PLUGINS_PATH . '/csstidy/css_optimiser.php')) { array_push($block['msg'], icms_core_Message::error(sprintf(_CSSTIDY_VULN, ICMS_PLUGINS_PATH . '/csstidy/css_optimiser.php'), FALSE)); } if ($protector_is_active == 0) { array_push($block['msg'], icms_core_Message::error(_PROTECTOR_NOT_FOUND, '', FALSE)); echo '<br />'; } // ###### Output warn messages for correct functionality ###### if (!is_writable(ICMS_CACHE_PATH)) { array_push($block['msg'], icms_core_Message::warning(sprintf(_WARNINNOTWRITEABLE, ICMS_CACHE_PATH)), '', FALSE); } if (!is_writable(ICMS_UPLOAD_PATH)) { array_push($block['msg'], icms_core_Message::warning(sprintf(_WARNINNOTWRITEABLE, ICMS_UPLOAD_PATH)), '', FALSE); } if (!is_writable(ICMS_COMPILE_PATH)) { array_push($block['msg'], icms_core_Message::warning(sprintf(_WARNINNOTWRITEABLE, ICMS_COMPILE_PATH)), '', FALSE); } if (count($block['msg']) > 0) { return $block; } }
/** * @return bool */ public function apply_auth_db() { $db = $GLOBALS['xoopsDB']; // Insert config values $table = $db->prefix('config'); $data = array('ldap_use_TLS' => "'_MD_AM_LDAP_USETLS', '0', '_MD_AM_LDAP_USETLS_DESC', 'yesno', 'int', 21"); foreach ($data as $name => $values) { if (!getDbValue($db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='{$name}'")) { $this->query("INSERT INTO `{$table}` (conf_modid,conf_catid,conf_name,conf_title,conf_value,conf_desc,conf_formtype,conf_valuetype,conf_order) " . "VALUES ( 0,7,'{$name}',{$values})"); } } return true; }
function updateFlugbuch(array $params, $datum) { // Modul für DB-Zugriff einbinden require_once 'konfiguration.php'; // Verbindung zur Datenbank herstellen // am System mit Host, Benutzernamen und Password anmelden @mysql_connect(MYSQL_HOST, MYSQL_BENUTZER, MYSQL_KENNWORT) or die('Could not connect to mysql server.'); @mysql_select_db(MYSQL_DATENBANK) or die('Could not select database.'); // prüfen um welches Jahr es sich handelt um entsprechend den SQL-Befehl anzupassen if ($params['jahr'] < 2014) { // die Flugzeit vom Format MM in das Format HH:MM bringen $params['flugzeit'] = minutesToTime($params['flugzeit']); // SQL-Befehl zurechtfuddeln, // Befehl zum Speichern einer Veränderung eines Fluges $sql = sprintf(' UPDATE `hauptflugbuch` SET `typ` = %s, `kennzeichen` = %s, `pilot` = %s, `pilotname` = %s, `begleiter` = %s, `begleitername` = %s, `startart` = %s, `loc_startort` = (SELECT `icao_id` FROM `flugplaetze` WHERE `ameavia` = %s), `startort` = %s, `loc_landeort` = (SELECT `icao_id` FROM `flugplaetze` WHERE `ameavia` = %s), `landeort` = %s, `startzeit` = %s, `landezeit` = %s, `flugzeit` = %s, `motorstart` = %s, `motorende` = %s, `einheiten` = %s, `landungen` = %s, `strecke` = %s, `bemerkungen` = %s WHERE `id` = %s ', getDbValue($params['typ'], T_STR), getDbValue($params['kennzeichen'], T_STR), getDbValue($params['pilot'], T_NUMERIC), getDbValue($params['pilotname'], T_STR), getDbValue($params['begleiter'], T_NUMERIC), getDbValue($params['begleitername'], T_STR), getDbValue($params['startart'], T_STR), getDbValue($params['startort'], T_STR), getDbValue($params['startflugplatz'], T_STR), getDbValue($params['landeort'], T_STR), getDbValue($params['landeflugplatz'], T_STR), getDbValue($params['startzeit'], T_TIME), getDbValue($params['landezeit'], T_TIME), getDbValue($params['flugzeit'], T_TIME), getDbValue($params['motorstart'], T_FLOAT), getDbValue($params['motorende'], T_FLOAT), getDbValue($params['einheiten'], T_FLOAT), getDbValue($params['landungen'], T_NUMERIC), getDbValue($params['strecke'], T_NUMERIC), getDbValue($params['bemerkungen'], T_STR), getDbValue($params['lfd_nr'], T_NUMERIC)); } else { // SQL-Befehl zurechtfuddeln, // Befehl zum Speichern einer Veränderung eines Fluges $sql = sprintf(' UPDATE `flugbuch` SET `startzeit` = %s, `landezeit` = %s, `flugzeit` = %s, `motorstart` = %s, `motorende` = %s, `einheiten` = %s, `luftfahrzeug` = %s, `besatzung1` = %s, `besatzung2` = %s, `startort` = %s, `landeort` = %s, `startart` = %s, `landungen` = %s, `strecke` = %s, `bemerkungen` = %s WHERE `id` = %s ', getDbValue($params['startzeit'], T_TIME), getDbValue($params['landezeit'], T_TIME), getDbValue($params['flugzeit'], T_NUMERIC), getDbValue($params['motorstart'], T_FLOAT), getDbValue($params['motorstart'], T_FLOAT), getDbValue($params['einheiten'], T_FLOAT), getDbValue($params['kennzeichen'], T_STR), getDbValue($params['besatzung1'], T_STR), getDbValue($params['besatzung2'], T_STR), getDbValue($params['startort'], T_STR), getDbValue($params['landeort'], T_STR), getDbValue($params['startart'], T_NUMERIC), getDbValue($params['landungen'], T_NUMERIC), getDbValue($params['strecke'], T_NUMERIC), getDbValue($params['bemerkungen'], T_STR), getDbValue($params['lfd_nr'], T_NUMERIC)); } // zuvor definierte SQL-Anweisung ausführen mysql_query($sql); }
function updateMitglied(array $params) { // Modul für DB-Zugriff einbinden require_once 'konfiguration.php'; // Verbindung zur Datenbank herstellen // am System mit Host, Benutzernamen und Password anmelden @mysql_connect(MYSQL_HOST, MYSQL_BENUTZER, MYSQL_KENNWORT) or die('Could not connect to mysql server.'); @mysql_select_db(MYSQL_DATENBANK) or die('Could not select database.'); // Austritts-Merkmal prüfen if (getDbValue($params['in_abrechn'], T_BOOL) == '"J"') { // Austrittsmerkmal ist gesetzt, Mitglied wird einfernt $in_abrechn = '"N"'; $rundmail = '"N"'; $status = '"X"'; } else { // Austrittsmerkmal nicht gesetzt, Mitglied bleibt vorhanden $in_abrechn = '"J"'; $rundmail = '"J"'; $status = getDbValue($params['status'], T_STR); } // SQL-Befehl zurechtfuddeln, // Befehl zum Speichern einer Veränderung eines Mitglieds $sql = sprintf(' UPDATE `mitglieder` SET `status` = %s, `sort` = %s, `anrede` = %s, `titel` = %s, `ameavia` = %s, `vorname` = %s, `nachname` = %s, `geburtsdatum` = %s, `strasse` = %s, `land` = %s, `plz` = %s, `ort` = %s, `telefon1` = %s, `telefon2` = %s, `mobil1` = %s, `mobil2` = %s, `email` = %s, `www` = %s, `bank` = %s, `blz` = %s, `kto` = %s, `ktoinhaber` = %s, `eintritt` = %s, `austritt` = %s, `datenschutz` = %s, `rundmail` = %s, `fl_dienst_absprache` = %s, `fl_dienst_wochentags` = %s, `funktion` = %s, `ppladat` = %s, `pplbdat` = %s, `pplcdat` = %s, `uldat` = %s, `medical` = %s, `jar_tmg` = %s, `jar_sep` = %s, `hlbnr` = %s, `taetigkeiten` = %s, `fachausweise` = %s, `in_abrechn` = %s WHERE `id` = %d ', $status, getDbValue($params['sort'], T_NUMERIC), getDbValue($params['anrede'], T_STR), getDbValue($params['titel'], T_STR), getDbValue($params['ameavia'], T_STR), getDbValue($params['vorname'], T_STR), getDbValue($params['nachname'], T_STR), getDbValue($params['geburtsdatum'], T_DATE), getDbValue($params['strasse'], T_STR), getDbValue($params['land'], T_STR), getDbValue($params['plz'], T_STR), getDbValue($params['ort'], T_STR), getDbValue($params['telefon1'], T_STR), getDbValue($params['telefon2'], T_STR), getDbValue($params['mobil1'], T_STR), getDbValue($params['mobil2'], T_STR), getDbValue($params['email'], T_STR), getDbValue($params['www'], T_STR), getDbValue($params['bank'], T_STR), getDbValue($params['blz'], T_STR), getDbValue($params['kto'], T_STR), getDbValue($params['ktoinhaber'], T_STR), getDbValue($params['eintritt'], T_DATE), getDbValue($params['austritt'], T_DATE), getDbValue($params['datenschutz'], T_BOOL), $rundmail, getDbValue($params['fl_dienst_absprache'], T_BOOL), getDbValue($params['fl_dienst_wochentags'], T_BOOL), getDbValue($params['funktion'], T_STR), getDbValue($params['ppladat'], T_DATE), getDbValue($params['pplbdat'], T_DATE), getDbValue($params['pplcdat'], T_DATE), getDbValue($params['uldat'], T_DATE), getDbValue($params['medical'], T_DATE), getDbValue($params['jar_tmg'], T_BOOL), getDbValue($params['jar_sep'], T_BOOL), getDbValue($params['hlbnr'], T_STR), getTaetigkeiten($params), getFachausweise($params), $in_abrechn, getDbValue($params['acb_nr'], T_NUMERIC)); // zuvor definierte SQL-Anweisung ausführen mysql_query($sql); }
function apply_templates() { $db = $GLOBALS['xoopsDB']; $table = $db->prefix('tplfile'); $table1 = $db->prefix('tplsource'); $tpl_files = array( 'system_error.html'=>'Template for handling HTTP errors', 'system_privpolicy.html'=>'Template for displaying site Privacy Policy' ); foreach ($tpl_files as $tpl_file=>$desc) { if (!getDbValue($db,'tplfile','tpl_id',' tpl_file="'.$tpl_file.'"')) { if ($fp = fopen('../modules/system/templates/'.$tpl_file, 'r')) { $new_tpl_source = fread($fp, filesize('../modules/system/templates/'.$tpl_file)); fclose($fp); $this->query(" INSERT INTO " . $table . " VALUES ('', 1, 'system', 'default', '".$tpl_file."', '".$desc."', ".time().", 0, 'module')"); $new_tplfile_id = $db->getInsertId(); $this->query(" INSERT INTO " . $table1 . " VALUES (" . $new_tplfile_id . ", '" . addslashes($new_tpl_source) . "');"); } } } return true; }
<?php // allgemeine Funktionen einbinden include_once './functions.php'; // Modul für DB-Zugriff einbinden require_once 'konfiguration.php'; // Verbindung zur Datenbank herstellen // am System mit Host, Benutzernamen und Password anmelden @mysql_connect(MYSQL_HOST, MYSQL_BENUTZER, MYSQL_KENNWORT) or die('Could not connect to mysql server.'); @mysql_select_db(MYSQL_DATENBANK) or die('Could not select database.'); // SQL-Befehl zurechtfuddeln, // eine bestehende Wartung wird aktualisiert anhand der übergebenen ID $sql = sprintf(' UPDATE `wartungsplan` SET `wartung` = %s, `datum` = %s, `flugstunden` = %s, `landungen` = %s, `technik` = %s, `bemerkungen` = %s WHERE `id` = %d ', getDbValue($_POST['wartung'], T_NUMERIC), getDbValue($_POST['datum'], T_DATE), getDbValue($_POST['flugstunden'], T_NUMERIC), getDbValue($_POST['landungen'], T_NUMERIC), getDbValue($_POST['technik'], T_NUMERIC), utf8_decode(getDbValue($_POST['bemerkungen'], T_STR)), $_POST['id']); // zuvor definierte SQL-Anweisung ausführen mysql_query($sql); // Skript beenden die;
function refreshSensorValue($con, $sensorId, $sensorWert) { $SHORTCUTS_URL_COMMAND = ""; $lastVal = getDbValue("homecontrol_sensor", "lastValue", "id=" . $sensorId); if ($lastVal == $sensorWert) { return; } // MySQL UPDATE $sql = "UPDATE homecontrol_sensor SET lastValue=" . $sensorWert . ", lastSignal=" . time() . " WHERE id=" . $sensorId; $result = $con->executeQuery($sql); $sql = "INSERT INTO homecontrol_sensor_log(sensor_id, value, update_time) values (" . $sensorId . "," . $sensorWert . "," . time() . ")"; $result = $con->executeQuery($sql); try { $myfile = fopen("signalIn.log", "a+"); fwrite($myfile, "" . date("d.M.Y H:i:s") . ": " . "Sensor " . $sensorId . " aktualisiert von: " . $lastVal . " nach " . $sensorWert . "\n"); fclose($myfile); } catch (Exception $e) { } // URL-Aufruf ermitteln // Wenn keine Schaltvorgaenge notwendig sind (nur Status-Update) // wird ein Leerstring zurueckgeliefert $SENSOR_URL_COMMAND = prepareSensorSwitchLink($sensorId); // HTML-Daten an Browser senden, // bevor Schaltvorgaenge ausgeloest werden. ob_implicit_flush(); ob_end_flush(); flush(); // Wenn auszufuehrendes Kommando gefunden wurde, ausfuehren if (strlen($SENSOR_URL_COMMAND) > 0) { switchShortcut("", $SENSOR_URL_COMMAND, $con); try { $myfile = fopen("signalIn.log", "a+"); fwrite($myfile, "SCHALTUNG -> " . $SENSOR_URL_COMMAND . "\n"); fclose($myfile); } catch (Exception $e) { } } }
} if (getDbValue(icms::$xoopsDB, 'newblocks', 'show_func', 'show_func="b_content_show"') == FALSE) { $sql = "SELECT bid FROM `" . icms::$xoopsDB->prefix('newblocks') . "` WHERE show_func='b_content_show'"; $result = icms::$xoopsDB->query($sql); list($new_block_id) = icms::$xoopsDB->FetchRow($result); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("block_module_link") . " VALUES (" . $new_block_id . ", 0, 0);"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 3, " . $new_block_id . ", 1, 'block_read');"); } if (getDbValue(icms::$xoopsDB, 'newblocks', 'show_func', 'show_func="b_content_menu_show"') == FALSE) { $sql = "SELECT bid FROM `" . icms::$xoopsDB->prefix('newblocks') . "` WHERE show_func='b_content_menu_show'"; $result = icms::$xoopsDB->query($sql); list($new_block_id) = icms::$xoopsDB->FetchRow($result); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("block_module_link") . " VALUES (" . $new_block_id . ", 0, 0);"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 3, " . $new_block_id . ", 1, 'block_read');"); } if (getDbValue(icms::$xoopsDB, 'newblocks', 'show_func', 'show_func="b_content_relmenu_show"') == FALSE) { $sql = "SELECT bid FROM `" . icms::$xoopsDB->prefix('newblocks') . "` WHERE show_func='b_content_relmenu_show'"; $result = icms::$xoopsDB->query($sql); list($new_block_id) = icms::$xoopsDB->FetchRow($result); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("block_module_link") . " VALUES (" . $new_block_id . ", 0, 0);"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 3, " . $new_block_id . ", 1, 'block_read');"); } icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 1, 16, 1, 'system_admin');"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 1, 17, 1, 'system_admin');"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 1, 18, 1, 'system_admin');"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 1, 19, 1, 'system_admin');"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 1, 20, 1, 'system_admin');"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 1, 1, 1, 'content_admin');"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 1, 2, 1, 'group_manager');"); icms::$xoopsDB->queryF(" INSERT INTO " . icms::$xoopsDB->prefix("group_permission") . " VALUES ('', 1, 3, 1, 'group_manager');"); $icmsDatabaseUpdater->updateModuleDBVersion($newDbVersion, 'system');
function apply_auth_db() { $xoops = Xoops::getInstance(); $db = $xoops->db(); $cat = getDbValue($db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'"); if ($cat !== false && $cat != XOOPS_CONF_AUTH) { // 2.2 downgrade bug: LDAP cat is here but has a catid of 0 $db->queryF("DELETE FROM " . $db->prefix('configcategory') . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' "); $db->queryF("DELETE FROM " . $db->prefix('config') . " WHERE `conf_modid`=0 AND `conf_catid` = {$cat}"); $cat = false; } if (empty($cat)) { // Insert config category ( always XOOPS_CONF_AUTH = 7 ) $db->queryF("INSERT INTO " . $db->prefix("configcategory") . " (confcat_id,confcat_name) VALUES (7,'_MD_AM_AUTHENTICATION')"); } // Insert config values $table = $db->prefix('config'); $data = array('auth_method' => "'_MD_AM_AUTHMETHOD', 'xoops', '_MD_AM_AUTHMETHODDESC', 'select', 'text', 1", 'ldap_port' => "'_MD_AM_LDAP_PORT', '389', '_MD_AM_LDAP_PORT', 'textbox', 'int', 2 ", 'ldap_server' => "'_MD_AM_LDAP_SERVER', 'your directory server', '_MD_AM_LDAP_SERVER_DESC', 'textbox', 'text', 3 ", 'ldap_manager_dn' => "'_MD_AM_LDAP_MANAGER_DN', 'manager_dn', '_MD_AM_LDAP_MANAGER_DN_DESC', 'textbox', 'text', 5", 'ldap_manager_pass' => "'_MD_AM_LDAP_MANAGER_PASS', 'manager_pass', '_MD_AM_LDAP_MANAGER_PASS_DESC', 'textbox', 'text', 6", 'ldap_version' => "'_MD_AM_LDAP_VERSION', '3', '_MD_AM_LDAP_VERSION_DESC', 'textbox', 'text', 7", 'ldap_users_bypass' => "'_MD_AM_LDAP_USERS_BYPASS', '" . serialize(array('admin')) . "', '_MD_AM_LDAP_USERS_BYPASS_DESC', 'textarea', 'array', 8", 'ldap_loginname_asdn' => "'_MD_AM_LDAP_LOGINNAME_ASDN', 'uid_asdn', '_MD_AM_LDAP_LOGINNAME_ASDN_D', 'yesno', 'int', 9", 'ldap_loginldap_attr' => "'_MD_AM_LDAP_LOGINLDAP_ATTR', 'uid', '_MD_AM_LDAP_LOGINLDAP_ATTR_D', 'textbox', 'text', 10", 'ldap_filter_person' => "'_MD_AM_LDAP_FILTER_PERSON', '', '_MD_AM_LDAP_FILTER_PERSON_DESC', 'textbox', 'text', 11", 'ldap_domain_name' => "'_MD_AM_LDAP_DOMAIN_NAME', 'mydomain', '_MD_AM_LDAP_DOMAIN_NAME_DESC', 'textbox', 'text', 12", 'ldap_provisionning' => "'_MD_AM_LDAP_PROVIS', '0', '_MD_AM_LDAP_PROVIS_DESC', 'yesno', 'int', 13", 'ldap_provisionning_group' => "'_MD_AM_LDAP_PROVIS_GROUP', 'a:1:{i:0;s:1:\"2\";}', '_MD_AM_LDAP_PROVIS_GROUP_DSC', 'group_multi', 'array', 14", 'ldap_mail_attr' => "'_MD_AM_LDAP_MAIL_ATTR', 'mail', '_MD_AM_LDAP_MAIL_ATTR_DESC', 'textbox', 'text', 15", 'ldap_givenname_attr' => "'_MD_AM_LDAP_GIVENNAME_ATTR', 'givenname', '_MD_AM_LDAP_GIVENNAME_ATTR_DSC', 'textbox', 'text', 16", 'ldap_surname_attr' => "'_MD_AM_LDAP_SURNAME_ATTR', 'sn', '_MD_AM_LDAP_SURNAME_ATTR_DESC', 'textbox', 'text', 17"); foreach ($data as $name => $values) { if (!getDbValue($db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='{$name}'")) { $this->query("INSERT INTO `{$table}` (conf_modid,conf_catid,conf_name,conf_title,conf_value,conf_desc,conf_formtype,conf_valuetype,conf_order) " . "VALUES ( 0,7,'{$name}',{$values})"); } } // Insert auth_method config options $id = getDbValue($db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='auth_method'"); $table = $db->prefix('configoption'); $data = array('_MD_AM_AUTH_CONFOPTION_XOOPS' => 'xoops', '_MD_AM_AUTH_CONFOPTION_LDAP' => 'ldap', '_MD_AM_AUTH_CONFOPTION_AD' => 'ad'); $this->query("DELETE FROM `{$table}` WHERE `conf_id`={$id}"); foreach ($data as $name => $value) { $this->query("INSERT INTO `{$table}` (confop_name, confop_value, conf_id) VALUES ('{$name}', '{$value}', {$id})"); } return true; }
private function apply_conf() { $db = $GLOBALS['xoopsDB']; if (getDbValue($db, 'configcategory', 'confcat_id', ' confcat_name="_MD_AM_CONTMANAGER"') != 0){return true;} $db->queryF(" INSERT INTO " . $db->prefix("configcategory") . " (confcat_id, confcat_name) VALUES ('9', '_MD_AM_CONTMANAGER')"); if (getDbValue($db, 'configcategory', 'confcat_id', ' confcat_name="_MD_AM_PERSON"') != 0){return true;} $db->queryF(" INSERT INTO " . $db->prefix("configcategory") . " (confcat_id, confcat_name) VALUES ('10', '_MD_AM_PERSON')"); $db->queryF("UPDATE ". $db->prefix('config') . " SET conf_formtype = 'textsarea' WHERE conf_name IN ('meta_keywords', 'meta_description')"); $passwordmeter_installed = false; $sql = "SELECT COUNT(*) FROM `" . $GLOBALS['xoopsDB']->prefix('config') . "` WHERE `conf_name` = 'pass_level'"; if ($result = $GLOBALS['xoopsDB']->queryF($sql)) { list($count) = $GLOBALS['xoopsDB']->fetchRow($result); if ($count == 1) { $passwordmeter_installed = true; } } if (!$passwordmeter_installed) { $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix('config') . " (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) " . " VALUES " . " (NULL, 0, 2, 'pass_level', '_MD_AM_PASSLEVEL', '1', '_MD_AM_PASSLEVEL_DESC', 'yesno', 'int', 2)"; if (!$GLOBALS['xoopsDB']->queryF($sql)) { return false; } } $db = $GLOBALS['xoopsDB']; $db->queryF("DELETE FROM `" . $db->prefix('configoption') . "` WHERE confop_name='_MD_AM_USERACTV'"); $db->queryF("DELETE FROM `" . $db->prefix('configoption') . "` WHERE confop_name='_MD_AM_AUTOACTV'"); $db->queryF("DELETE FROM `" . $db->prefix('configoption') . "` WHERE confop_name='_MD_AM_ADMINACTV'"); $db->queryF("DELETE FROM `" . $db->prefix('config') . "` WHERE conf_name = 'activation_type'"); // Now let's re-insert data $registration_type = false; $sql = "SELECT COUNT(*) FROM `" . $GLOBALS['xoopsDB']->prefix('config') . "` WHERE `conf_name` = 'activation_type'"; if ($result = $GLOBALS['xoopsDB']->queryF($sql)) { list($count) = $GLOBALS['xoopsDB']->fetchRow($result); if ($count == 1) { $registration_type = true; } } if (!$registration_type) { $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix('config') . " (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) " . " VALUES " . " (NULL, 0, 2, 'activation_type', '_MD_AM_ACTVTYPE', '0', '_MD_AM_ACTVTYPEDSC', 'select', 'int', 9)"; if (!$GLOBALS['xoopsDB']->queryF($sql)) { return false; } $config_id = $GLOBALS['xoopsDB']->getInsertId(); $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix('configoption') . " (confop_id, confop_name, confop_value, conf_id)" . " VALUES" . " (NULL, '_MD_AM_USERACTV', '0', {$config_id}), " . " (NULL, '_MD_AM_AUTOACTV', '1', {$config_id}), " . " (NULL, '_MD_AM_ADMINACTV', '2', {$config_id}), " . " (NULL, '_MD_AM_REGINVITE', '3', {$config_id})"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { return false; } } $table = new IcmsDatabasetable('users'); $sql = "ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('users') . " MODIFY pass VARCHAR(255) NOT NULL"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } $sql = "ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('users') . " MODIFY user_sig text NOT NULL"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } $sql = "ALTER TABLE `" . $GLOBALS['xoopsDB']->prefix('users') . "` ADD language varchar(100) NOT NULL default ''"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } if (!$table->fieldExists('openid')) { $sql = "ALTER TABLE `" . $GLOBALS['xoopsDB']->prefix('users') . "` ADD openid varchar(255) NOT NULL default ''"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } } if (!$table->fieldExists('salt')) { $sql = "ALTER TABLE `" . $GLOBALS['xoopsDB']->prefix('users') . "` ADD salt varchar(255) NOT NULL default ''"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } } if (!$table->fieldExists('user_viewoid')) { $sql = "ALTER TABLE `" . $GLOBALS['xoopsDB']->prefix('users') . "` ADD user_viewoid tinyint(1) unsigned NOT NULL default '0'"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } } if (!$table->fieldExists('pass_expired')) { $sql = "ALTER TABLE `" . $GLOBALS['xoopsDB']->prefix('users') . "` ADD pass_expired tinyint(1) NOT NULL default '0'"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } } if (!$table->fieldExists('enc_type')) { $sql = "ALTER TABLE `" . $GLOBALS['xoopsDB']->prefix('users') . "` ADD enc_type tinyint(2) unsigned NOT NULL default '0'"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } } $sql = 'SHOW INDEX FROM `' . $GLOBALS['xoopsDB']->prefix('users') . '`'; $result = $GLOBALS['xoopsDB']->queryF($sql); $indexes = $GLOBALS ['xoopsDB']->fetchArray($result); if (in_array('unamepass', $indexes)) { $sql = "ALTER TABLE `" . $GLOBALS['xoopsDB']->prefix('users') . "` DROP INDEX unamepass, ADD INDEX unamepass (uname (10), pass (10))"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { icms_debug('An error occurred while executing "' . $sql . '" - ' . $GLOBALS['xoopsDB']->error()); return false; } } $pw_salt_installed = false; $sql = "SELECT COUNT(*) FROM `" . $GLOBALS ['xoopsDB']->prefix('config') . "` WHERE `conf_name` = 'enc_type'"; if ($result = $GLOBALS ['xoopsDB']->queryF($sql)) { list($count) = $GLOBALS ['xoopsDB']->fetchRow($result); if ($count == 1) { $pw_salt_installed = true; } } if (!$pw_salt_installed) { $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix('config') . " (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) " . " VALUES " . " (NULL, 0, 2, 'enc_type', '_MD_AM_ENC_TYPE', '0', '_MD_AM_ENC_TYPEDSC', 'select', 'int', 50)"; if (!$GLOBALS['xoopsDB']->queryF($sql)) { return false; } $config_id = $GLOBALS['xoopsDB']->getInsertId(); $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix('configoption') . " (confop_id, confop_name, confop_value, conf_id)" . " VALUES" . " (NULL, '_MD_AM_ENC_MD5', '0', {$config_id}), " . " (NULL, '_MD_AM_ENC_SHA256', '1', {$config_id}), " . " (NULL, '_MD_AM_ENC_SHA384', '2', {$config_id}), " . " (NULL, '_MD_AM_ENC_SHA512', '3', {$config_id}), " . " (NULL, '_MD_AM_ENC_RIPEMD128', '4', {$config_id}), " . " (NULL, '_MD_AM_ENC_RIPEMD160', '5', {$config_id}), " . " (NULL, '_MD_AM_ENC_WHIRLPOOL', '6', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL1284', '7', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL1604', '8', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL1924', '9', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL2244', '10', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL2564', '11', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL1285', '12', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL1605', '13', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL1925', '14', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL2245', '15', {$config_id}), " . " (NULL, '_MD_AM_ENC_HAVAL2565', '16', {$config_id})"; if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { return false; } } return $result; }
function getIconTooltip() { $ttt = "<table cellspacing='10'><tr><td>" . $this->getSensorArtIconSrc(false, 80) . "</td><td><center><b>" . $this->NAME . "</b></center><hr></br>"; if (strlen($this->ID) > 0) { $ttt .= "<b>ID:</b> " . $this->ID . "</br></br>"; } if (strlen($this->ZIMMER) > 0) { $ttt .= "<b>Zimmer:</b> " . getDbValue("homecontrol_zimmer", "name", "id=" . $this->ZIMMER) . "</br></br>"; } if (strlen($this->ETAGE) > 0) { $ttt .= "<b>Etage:</b> " . getDbValue("homecontrol_etagen", "name", "id=" . $this->ETAGE) . "</br>"; } $ttt .= "</br>" . $this->DESCRPT . "</td></tr>"; $ttt .= "<tr><td>Zu letzt gemeldeter Wert: " . $this->LASTVALUE . "</td><td align='right'>gemeldet am: " . date("d.m.Y h:i:s", $this->LASTSIGNAL) . "</td></tr>"; $ttt .= "<tr><td colspan=2 height='1px'> </td></tr>"; $ttt .= "</table>"; return $ttt; }
function updateFlugzeug(array $params) { // Modul für DB-Zugriff einbinden require_once 'konfiguration.php'; // Verbindung zur Datenbank herstellen // am System mit Host, Benutzernamen und Password anmelden @mysql_connect(MYSQL_HOST, MYSQL_BENUTZER, MYSQL_KENNWORT) or die('Could not connect to mysql server.'); @mysql_select_db(MYSQL_DATENBANK) or die('Could not select database.'); // Ausscheidungs-Merkmal prüfen if (getDbValue($params['in_abrechn'], T_BOOL) == '"J"') { // Ausscheidungsmerkmal ist gesetzt, Flugzeug wird einfernt $in_abrechn = '"N"'; } else { // Ausscheidungsmerkmal nicht gesetzt, Flugzeug bleibt vorhanden $in_abrechn = '"J"'; } // SQL-Befehl zurechtfuddeln, // Befehl zum Speichern einer Veränderung eines Flugzeuges $sql = sprintf(' UPDATE `flugzeuge` SET `flugzeugtyp` = %s, `halter` = %s, `standort` = %s, `fluggebuehr` = %s, `motorgebuehr` = %s, `startgebuehr` = %s, `landegebuehr` = %s, `nvfr` = %s, `cvfr` = %s, `vereinsflugzeug` = %s, `w_kennz` = %s, `typ` = %s, `gastgebuehr` = %s, `typ1` = %s, `startart` = %s, `status` = %s, `bemerkungen` = %s, `zelle_stunden` = %s, `restzeit_motor` = %s, `restzeit_prop` = %s, `stand_wartung` = %s, `naechste_wartung` = %s, `naechste_wartung_stunden` = %s, `naechste_wartung_datum` = %s, `in_abrechn` = %s, `sort` = %s WHERE `kennzeichen` = %s ', getDbValue($params['flugzeugtyp'], T_STR), getDbValue($params['halter'], T_STR), getDbValue($params['standort'], T_STR), getDbValue($params['fluggebuehr'], T_FLOAT), getDbValue($params['motorgebuehr'], T_FLOAT), getDbValue($params['startgebuehr'], T_FLOAT), getDbValue($params['landegebuehr'], T_FLOAT), getDbValue($params['nvfr'], T_BOOL), getDbValue($params['cvfr'], T_BOOL), getDbValue($params['vereinsflugzeug'], T_BOOL), getDbValue($params['w_kennz'], T_STR), getDbValue($params['typ'], T_STR), getDbValue($params['gastgebuehr'], T_FLOAT), getDbValue($params['typ1'], T_STR), getStartarten($params), getDbValue($params['status'], T_NUMERIC), getDbValue($params['bemerkungen'], T_STR), getDbValue($params['zelle_stunden'], T_NUMERIC), getDbValue($params['restzeit_motor'], T_NUMERIC), getDbValue($params['restzeit_prop'], T_NUMERIC), getDbValue($params['stand_wartung'], T_DATE), getDbValue($params['naechste_wartung'], T_NUMERIC), getDbValue($params['naechste_wartung_stunden'], T_NUMERIC), getDbValue($params['naechste_wartung_datum'], T_DATE), $in_abrechn, getDbValue($params['sort'], T_STR), getDbValue($params['kennzeichen'], T_STR)); // zuvor definierte SQL-Anweisung ausführen mysql_query($sql); }
* blocks added during a module update default to block_type 'M', which * is not correct for the system module, adding todo in modulesadmin */ if ($dbVersion < $newDbVersion) { $result = icms::$xoopsDB->query('SELECT title, side, weight, visible, bcachetime, bid' . ' FROM `' . icms::$xoopsDB->prefix('newblocks') . '` WHERE `show_func`="b_system_waiting_show" AND `func_file`="system_blocks.php"'); list($title, $side, $weight, $visible, $bcachetime, $bid) = icms::$xoopsDB->fetchRow($result); icms::$xoopsDB->queryF('UPDATE `' . icms::$xoopsDB->prefix('newblocks') . '` SET `title`="' . $title . '", `side`=' . $side . ', `weight`=' . $weight . ', `visible`=' . $visible . ', `bcachetime`=' . $bcachetime . ' WHERE `show_func`="b_system_waiting_show" AND `func_file`="system_waiting.php"'); icms::$xoopsDB->queryF('DELETE FROM `' . icms::$xoopsDB->prefix('newblocks') . '` WHERE `bid`=' . $bid); icms::$xoopsDB->queryF('DELETE FROM `' . icms::$xoopsDB->prefix('block_module_link') . '` WHERE `block_id`=' . $bid); icms::$xoopsDB->queryF('UPDATE `' . icms::$xoopsDB->prefix('newblocks') . '` SET `block_type`="S"' . ' WHERE `dirname`="system" AND `block_type`="M"'); /* Change the field type of welcome_msg_content to textsarea */ $sql_welcome_msg_content = 'UPDATE ' . icms::$xoopsDB->prefix('config') . ' SET `conf_formtype` = "textsarea"' . ' WHERE `conf_name`="welcome_msg_content"'; $icmsDatabaseUpdater->runQuery($sql_welcome_msg_content, 'Welcome message form type successfully updated', 'Unable to update the welcome message form type', true); /* Set the start page for each group, so they don't default to Admin Control Panel */ $groups = icms::handler('icms_member_group')->getObjects(NULL, true); $start_page = getDbValue(icms::$xoopsDB, 'config', 'conf_value', 'conf_name="startpage"'); foreach ($groups as $groupid => $group) { $start_pages[$groupid] = $start_page; } icms::$xoopsDB->queryF('UPDATE `' . icms::$xoopsDB->prefix('config') . '`' . ' SET `conf_value`="' . addslashes(serialize($start_pages)) . '"' . ' WHERE `conf_name`="startpage"'); /* Check for HTMLPurifier cache path and create, if needed */ $purifier_path = icms_core_Filesystem::mkdir(ICMS_TRUST_PATH . '/cache/htmlpurifier'); /* Removing the option for multilogin text, as we're using a constant for it */ icms::$xoopsDB->queryF("DELETE FROM `" . icms::$xoopsDB->prefix('config') . "` WHERE conf_name='multi_login_msg'"); icms::$xoopsDB->queryF("DELETE FROM `" . icms::$xoopsDB->prefix('config') . "` WHERE conf_name='use_hidden'"); $icmsDatabaseUpdater->updateModuleDBVersion($newDbVersion, 'system'); echo sprintf(_DATABASEUPDATER_UPDATE_OK, icms_conv_nr2local($newDbVersion)) . '<br />'; } /* 1.2 RC1 released */ if (!$abortUpdate) { $newDbVersion = 36;
function updateLogbuch(array $params, $datum) { // Modul für DB-Zugriff einbinden require_once 'konfiguration.php'; // Verbindung zur Datenbank herstellen // am System mit Host, Benutzernamen und Password anmelden @mysql_connect(MYSQL_HOST, MYSQL_BENUTZER, MYSQL_KENNWORT) or die('Could not connect to mysql server.'); @mysql_select_db(MYSQL_DATENBANK) or die('Could not select database.'); // SQL-Befehl zurechtfuddeln, // Befehl zum Speichern einer Veränderung eines Logbuches $sql = sprintf(' UPDATE `logbuch` SET `startrichtung` = %s, `windrichtung` = %s, `windstaerke` = %s, `bewoelkung` = %s, `temperatur` = %s, `luftdruck` = %s, `bemerkungen` = %s, `wetter` = %s WHERE `datum` = %s ', getDbValue($params['startrichtung'], T_STR), getDbValue($params['windrichtung'], T_NUMERIC), getDbValue($params['windstaerke'], T_NUMERIC), getDbValue($params['bewoelkung'], T_STR), getDbValue($params['temperatur'], T_NUMERIC), getDbValue($params['luftdruck'], T_NUMERIC), getDbValue($params['bemerkungen'], T_STR), getDbValue($params['wetter'], T_STR), getDbValue($params['datum'], T_DATE)); // zuvor definierte SQL-Anweisung ausführen mysql_query($sql); }
$tblEtagen = new Table(array("Name", "Raumplan", "hochladen", "entfernen")); $tblEtagen->setHeadEnabled(true); $tblEtagen->setVAlign("middle"); $tblEtagen->setAlignments(array("left", "center", "center", "right")); $tblEtagen->setBackgroundColorChange(true); foreach ($scDbTable->ROWS as $etagenRow) { $rowId = $etagenRow->getNamedAttribute("rowid"); $txfName = new Textfield("name" . $rowId, $etagenRow->getNamedAttribute("name")); $btnRaumplan = new Button("uploadImage" . $rowId, "Raumplan hochladen"); $btnDelete = new Button("delete" . $rowId . "homecontrol_etagen", "entfernen"); $imgRaumplan = ""; if (isset($_REQUEST["uploadImage" . $rowId]) && $_REQUEST["uploadImage" . $rowId] == "Raumplan hochladen") { $hdnImg = new Hiddenfield("uploadImage" . $rowId, $_REQUEST["uploadImage" . $rowId]); $imgUploader = new ImageUploader("/pics/raumplan", "RP_", "homecontrol_etagen", "pic", $rowId, $hdnImg, $rowId . ".jpg"); $imgUploader->show(); $imgRaumplan = new Image(getDbValue("homecontrol_etagen", "pic", "id=" . $rowId)); } else { $imgRaumplan = new Image(getEtagenImagePath($rowId)); } $imgRaumplan->setGenerated(false); $imgRaumplan->setWidth(140); $cBtnRaumplan = new Container(); $cBtnRaumplan->add($btnRaumplan); $cBtnRaumplan->add(new Text("<br>JPG Datei mit den Maßen: 600x340", 1, false, false, false, false)); $r = $tblEtagen->createRow(); $r->setStyle("padding", "10px 5px"); $r->setVAlign("middle"); $r->setAttribute(0, $txfName); $r->setAttribute(1, $imgRaumplan); $r->setAttribute(2, $cBtnRaumplan); $r->setAttribute(3, $btnDelete);
function handleEtage() { if (!isset($_SESSION['aktEtage']) || strlen($_SESSION['aktEtage']) == 0) { if (isset($_REQUEST['aktEtage'])) { $_SESSION['aktEtage'] = $_REQUEST['aktEtage']; } else { $minId = getDbValue("homecontrol_etagen", "min(id)", "id>0"); $_SESSION['aktEtage'] = strlen($minId) == 0 ? "" : $minId; } } else { if (isset($_REQUEST['aktEtage'])) { $_SESSION['aktEtage'] = $_REQUEST['aktEtage']; } } }