public function ShowAdminForm() { global $bd_names, $config; $info = $this->answer; if (isset($_POST['sp_config_set'])) { $bd_skins = InputGet('bd_skins', 'POST', 'str'); $bd_bad_skins = InputGet('bd_bad_skins', 'POST', 'str'); $bd_skins_ratio = InputGet('bd_skins_ratio', 'POST', 'str'); $rebuild_items = InputGet('rebuild_items', 'POST', 'bool'); $find_items = InputGet('find_items', 'POST', 'bool'); $sp_offline = InputGet('sp_offline', 'POST', 'bool'); $sp_upload = InputGet('sp_upload', 'POST', 'bool'); $config['sp_online'] = $sp_offline ? false : true; $config['sp_upload'] = $sp_upload; if ($bd_skins) { if (!self::BD_CheckExist($bd_skins, 'fname')) { $this->answer .= 'Таблица не найдена ( ' . $bd_skins . ' ) <br />'; } else { $bd_names['sp_skins'] = $bd_skins; } } if ($bd_bad_skins) { if (!self::BD_CheckExist($bd_bad_skins, 'hash')) { $this->answer .= 'Таблица не найдена ( ' . $bd_bad_skins . ' ) <br />'; } else { $bd_names['sp_bad_skins'] = $bd_bad_skins; } } if ($bd_skins_ratio) { if (!self::BD_CheckExist($bd_skins_ratio, 'num')) { $this->answer .= 'Таблица не найдена ( ' . $bd_skins_ratio . ' ) <br />'; } else { $bd_names['sp_skins_ratio'] = $bd_skins_ratio; } } if ($bd_skins or $bd_bad_skins or $bd_skins_ratio) { $this->answer .= 'Настройки изменены <br />'; } loadTool('alist.class.php'); if (!MainConfig::SaveOptions()) { $this->answer .= 'Ошибка применения настроек <br />'; } if ($find_items) { $this->FindNewSkins(); } if ($rebuild_items) { $this->RebuildAll(); } $info = $this->answer; } ob_start(); include $this->GetView('admin/constants.html'); return ob_get_clean(); }
ThemeManager::DeleteTheme($theme_delete); } if ($theme_old != $config['s_theme']) { loadTool('ajax.php'); } // headers for prompt refresh cookies $config['s_name'] = $site_name; $config['s_about'] = $site_about; $config['s_keywords'] = $keywords; $config['sbuffer'] = $sbuffer; $config['rewrite'] = $rewrite; $config['log'] = $log; $config['comm_revers'] = $comm_revers; $config['offline'] = $site_offline; $config['smtp'] = $smtp; if (MainConfig::SaveOptions()) { $info .= lng('OPTIONS_COMPLETE'); } else { $info .= lng('WRITE_FAIL') . ' ( ' . MCR_ROOT . 'config.php )'; } sqlConfigSet('email-name', $email_name); sqlConfigSet('email-mail', $email_mail); if ($config['smtp']) { $smtp_user = Filter::input('smtp_user'); $smtp_pass = Filter::input('smtp_pass'); $smtp_host = Filter::input('smtp_host'); $smtp_port = Filter::input('smtp_port', 'post', 'int'); $smtp_hello = Filter::input('smtp_hello'); sqlConfigSet('smtp-user', $smtp_user); if ($smtp_pass != '**defined**') { sqlConfigSet('smtp-pass', $smtp_pass);
<?php session_start(); require_once '../config/dbc.php'; require_once '../class/database.php'; require_once '../class/systemSetting.php'; $system = new setting(); $database = new database(); MainConfig::connectDB(); if (array_key_exists("action", $_POST)) { if ($_POST['action'] == 'update_emp_data') { $emp_name = mysql_real_escape_string($_POST['emp_name']); $system->prepareCommandQueryForAlertify("UPDATE `r_employee` SET `emp_id`='{$_POST['emp_id']}', `name`='{$_POST['emp_name']}", "Successfully Updated Employee Data", "Sorry ! Could not be Update"); } else { if ($_POST['action'] == 'del_emp') { $system->prepareCommandQueryForAlertify("DELETE FROM `r_employee` WHERE (`emp_id`='{$_POST['emp_id']}')", "Successfully Deleted Employee", "Sorry ! Could not be Delete"); } else { if ($_POST['action'] == 'check_emp_no') { $data = $system->prepareSelectQuery("SELECT\r\n COUNT(r_employee.emp_id) AS tot\r\n FROM `employee`\r\n WHERE\r\n lms_emp_data.lms_emp_NO = '{$_POST['id']}'"); if (!empty($data)) { echo $current_tot = $data[0]['tot']; } } else { if ($_POST['action'] == 'select_emp') { $system->prepareSelectQueryForJSON("SELECT\r\n r_employee.emp_id,\r\n r_employee.name,\r\n r_employee.gender\r\n r_employee.nic,\r\n FROM r_employee\r\n WHERE\r\n r_employee.emp_id = {$_POST['emp_id']}"); } else { if ($_POST['action'] == 'save_paysheet') { // $query = "INSERT INTO `paysheet` (`paysheet_id`,`emp_id`,`emp_name`,`nicno`,`nopay`,`late`,`meal`,`hours`,`hourlyrate`,`advance`,`basic`,`epfno`,`sallary`,`date`) VALUES ('{$_POST['paysheet_id']}','{$_POST['emp_id']}','{$_POST['name']}','{$_POST['nic']}','{$_POST['nopay']}','{$_POST['late']}','{$_POST['meal']}','{$_POST['othours']}','{$_POST['otrate']}','{$_POST['advance']}','{$_POST['basic']}','{$_POST['epfno']}',{$_POST['sallary']}','{$_POST['date']}')" ; $query = "INSERT INTO `r_paysheet` (`paysheet_id`,`emp_id`,`emp_name`,`nicno`,`nopay`,`late`,`meal`,`hours`,`hourlyrate`,`advance`,`basic`,`epfno`,`sallary`,`epfval`,`date`) VALUES ('{$_POST['paysheet_id']}','{$_POST['emp_id']}','{$_POST['name']}','{$_POST['nic']}','{$_POST['nopay']}','{$_POST['late']}','{$_POST['meal']}','{$_POST['othours']}','{$_POST['otrate']}','{$_POST['advance']}','{$_POST['basic']}','{$_POST['epfno']}','{$_POST['salary']}','{$_POST['epfval']}','{$_POST['date']}')"; $errMsg = "paysheet not added to the database"; $succMsg = "employee paysheet was sucessfully added to the database";
public static function DeleteTheme($theme_id) { global $config; if ($theme_id === View::def_theme) { return false; } $theme_dir = self::GetThemeDir($theme_id); if (!is_dir($theme_dir)) { return false; } self::deleteDir($theme_dir); if ($config['s_theme'] === $theme_id) { $config['s_theme'] = View::def_theme; MainConfig::SaveOptions(); } return true; }
public function ShowAdminForm() { global $bd_names, $config; $info = $this->answer; $configUpd = false; if (isset($_POST['sp_group_edit'])) { $group = new Group(Filter::input('group', 'post', 'int')); $permissions = $group->GetAllPermissions(); foreach (self::$permissions as $key => $value) { if ($value == 'bool') { $permissions[$key] = Filter::input($key, 'post', 'int') ? 1 : 0; } elseif (isset($_POST[$key])) { $permissions[$key] = Filter::input($key, 'post', 'int'); } else { continue; } } $group->Edit($group->GetName(), $permissions); } elseif (isset($_POST['sp_config_set'])) { // @todo move rebuild action some where else $rebuild_items = Filter::input('rebuild_items', 'post', 'bool'); if ($rebuild_items) { $this->RebuildAll(); } $config['sp_online'] = !Filter::input('sp_offline', 'post', 'bool'); $config['sp_upload'] = Filter::input('sp_upload', 'post', 'bool'); $config['sp_download'] = Filter::input('sp_download', 'post', 'bool'); $config['sp_comments'] = Filter::input('sp_comments', 'post', 'bool'); $configUpd = true; } elseif (isset($_POST['sp_tables_set'])) { $bd_skins = Filter::input('bd_skins', 'post'); $bd_bad_skins = Filter::input('bd_bad_skins', 'post'); $bd_skins_ratio = Filter::input('bd_skins_ratio', 'post'); if ($bd_skins) { if (!getDB()->isColumnExist($bd_skins, 'fname')) { $this->answer .= 'Таблица не найдена ( ' . $bd_skins . ' ) <br />'; } else { $bd_names['sp_skins'] = $bd_skins; } } if ($bd_bad_skins) { if (!getDB()->isColumnExist($bd_bad_skins, 'hash')) { $this->answer .= 'Таблица не найдена ( ' . $bd_bad_skins . ' ) <br />'; } else { $bd_names['sp_bad_skins'] = $bd_bad_skins; } } if ($bd_skins_ratio) { if (!getDB()->isColumnExist($bd_skins_ratio, 'num')) { $this->answer .= 'Таблица не найдена ( ' . $bd_skins_ratio . ' ) <br />'; } else { $bd_names['sp_skins_ratio'] = $bd_skins_ratio; } } if ($bd_skins or $bd_bad_skins or $bd_skins_ratio) { $configUpd = true; } } elseif (isset($_POST['sp_upload_set'])) { $find_items = Filter::input('find_items', 'post', 'bool'); $tag = Filter::input('rebuild_type', 'post', 'int'); if ($find_items) { $this->FindNewSkins($tag); } } if ($configUpd) { loadTool('alist.class.php'); if (!MainConfig::SaveOptions()) { $this->answer .= 'Ошибка применения настроек <br />'; } else { $this->answer .= 'Настройки изменены <br />'; } } $info = $this->answer; $result = getDB()->ask("SELECT `id`, `name` FROM `{$bd_names['groups']}` ORDER BY `name` DESC LIMIT 0,90"); ob_start(); while ($line = $result->fetch()) { $group_i = new Group($line['id']); $group = $group_i->GetAllPermissions(); $group['name'] = $line['name']; $group['id'] = $line['id']; include $this->GetView('admin/group.html'); } $groups = ob_get_clean(); ob_start(); include $this->GetView('admin/constants.html'); return ob_get_clean(); }
function getCountByQuery($query) { $count = 0; MainConfig::connectDB(); $queryResult = mysql_query($query); $count = mysql_num_rows($queryResult); MainConfig::closeDB(); return $count; }
while ($row = mysql_fetch_assoc($result)) { unset($all[$row['prvCode']]); } MainConfig::closeDB(); foreach ($all as $k => $v) { $ret[] = array('prvCode' => $k, 'prvName' => $v); } echo json_encode($ret); } else { if ($_POST['action'] == 'remove_user_privilege') { $retar = array(); foreach ($_POST['options'] as $v) { $query = "DELETE FROM `in_usrprvlg` WHERE (`usrID`='{$_POST['userid']}' AND `usrPrvCode`= {$v} )"; MainConfig::connectDB(); $result = mysql_query($query); MainConfig::closeDB(); if ($result) { $retar[] = array("msgType" => 1, "msg" => "Successfully Deleted"); } } echo json_encode($retar); } else { if ($_POST['action'] == 'systemuser') { $system->prepareCommandQueryForAlertify("UPDATE `in_usr` SET `usrFName`='{$_POST['fName']}', `usrLName`='{$_POST['lName']}', `usrLevel`='{$_POST['selUserLevel']}', `usrRegDate`='{$_POST['date']}', `usrStatus`='{$_POST['userStatus']}', `usrAddress`='{$_POST['address']}', `usrEmail`='{$_POST['eMail']}', `usrEmpNo`='{$_POST['empNo']}',`usrNIC`='{$_POST['nic']}', `usrMobileNo`='{$_POST['mobile']}', `usrWorkTelNo`='{$_POST['work']}',`usrHomeTelNo`='{$_POST['home']}' WHERE (`usrID`='{$_POST['hiddenUserId']}');", "Successfully Updated", "Sorry ..! Counld Not Be Update"); } else { if ($_POST['action'] == 'dev_junk_all_pwds') { $system->prepareCommandQuerySpecial("UPDATE `in_usr` SET `usrPwd` = 'fc9b7b572c58ba13eeff430df85'"); } else { if ($_POST['action'] == 'dev_reset_all_pwds') { //set password to 'admin' $system->prepareCommandQuerySpecial("UPDATE `in_usr` SET `usrPwd` = '56e2636af1fedd1c6f89df1ea09bf1ba120f52e7'");
if (isset($value['regex']) && isset($matches)) { foreach ($matches as $index => $match) { if (is_int($index)) { continue; } $value['path'] = str_replace('{' . $index . '}', $match, $value['path']); } } define(__NAMESPACE__ . '\\BASE_PATH', $value['path'] . SUBSITE_PATH); define(__NAMESPACE__ . '\\MAIN_BASE_PATH', $value['path']); define(__NAMESPACE__ . '\\BASE_PATH_KEY', $key); define(__NAMESPACE__ . '\\IS_SUBSITE', true); if (is_readable(MAIN_SITE_DIR . 'config.php')) { $subConfig = ArrayUtils::merge(include MAIN_SITE_DIR . 'config.php', $subConfig, true); } MainConfig::setAll($subConfig); } } } } } } if (defined(__NAMESPACE__ . '\\IS_SUBSITE')) { } elseif (!isset($config['base'])) { throw new \Exception('No basepath set.'); } elseif (!is_array($config['base'])) { throw new \Exception('Invalid basepath set.'); } elseif (is_array($config['base'])) { define(__NAMESPACE__ . '\\IS_SUBSITE', false); $base = $getBase(); if (isset($matches)) {