public function getSettings() { $query = Settings::find()->orderBy('id')->all(); foreach ($query as $row) { $result[$row['field']] = $row['value']; } return $result; }
public function destroy($id) { $admin = Settings::find($id); $query = $admin->delete(); if ($query) { flash()->success('操作成功'); } else { flash()->error('操作失败'); } return redirect()->route('dashboard.setting.index'); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Settings::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'value', $this->value]); return $dataProvider; }
public function save() { foreach ($this->attributes as $key => $value) { $setting = Settings::find()->where(['key' => $key])->one(); if ($setting == null) { $setting = new Setting(); $setting->key = $key; } $setting->value = $value; if (!$setting->save(false)) { return false; } } return true; }
public function savesettings() { /* Get Post */ $rules = array(); if (Input::has('ldapon')) { $rules = array('ldapserver' => 'required', 'ldapdomain' => 'required', 'ldapuser' => 'required', 'ldappassword' => 'required', 'ldapbasedn' => 'required'); } // Check Validation $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { //failed to validate //let's go back to that form with errors, input $messages = $validation->messages(); $html = '<div class="response"><div class="alert alert-error">'; foreach ($messages->all() as $message) { $html .= ' ' . $message . '<br>'; } $html .= '</div></div>'; Former::withErrors($validation); echo json_encode(array('html' => $html)); } else { $settings = Settings::find(1); if ($settings === null) { $settings = new Settings(); } $settings->id = '1'; $settings->ldapon = "0"; $settings->ldapserver = ""; $settings->ldapdomain = ""; $settings->ldapuser = ""; $settings->ldappassword = ""; $settings->servername = Input::get('servername', ''); $settings->adminemail = Input::get('adminemail', ''); $settings->confdir = Input::get('confdir', ''); if (Input::has('ldapon')) { $settings->ldapon = Input::get('ldapon'); $settings->ldapserver = Input::get('ldapserver', ''); $settings->ldapdomain = Input::get('ldapdomain', ''); $settings->ldapuser = Input::get('ldapuser', ''); $settings->ldappassword = Input::get('ldappassword', ''); $settings->ldapbasedn = Input::get('ldapbasedn', ''); $settings->ldapport = Input::get('ldapport', ''); } $settings->save(); /* Check if Conf Dir is writables */ echo json_encode(array('html' => '<div class="response"><div class="alert alert-success"> Settings Sucessufull Updated </div><div class="response"></div>')); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Settings::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'option_name', $this->option_name])->andFilterWhere(['like', 'option_value', $this->option_value]); return $dataProvider; }
public function run() { $model = new Settings(); $dataProvider = new ActiveDataProvider(['query' => Settings::find(), 'pagination' => false]); if (Yii::$app->request->post()) { foreach (Yii::$app->request->post('Settings') as $k => $opt) { $obj = Settings::findOne($opt["id"]); //var_dump($obj); die; $obj->option_value = $opt["option_value"]; $obj->save(); } Yii::$app->session->setFlash('success', 'Site settings updated Successfully.'); } //var_dump(Yii::$app->request->post()); die(); $models = Settings::find()->all(); return $this->controller->render('settings', ['model' => $models, 'dataProvider' => $dataProvider]); }
/** * Login action * @return Redirect */ public function postLogin() { // Check if it Has Ldap Activated $settings = Settings::find(1); if ($settings != null && $settings->ldapon == '1') { try { $adldap = new adLDAP(array('base_dn' => $settings->ldapbasedn, 'account_suffix' => $settings->ldapdomain, 'admin_username' => $settings->ldapuser, 'admin_password' => $settings->ldappassword, 'domain_controllers' => array($settings->ldapserver), 'ad_port' => $settings->ldapport)); // Try Ldap Login $valid_login = $adldap->user()->authenticate(Input::get('username'), Input::get('password')); if ($valid_login == true) { $user = $adldap->user()->infoCollection(Input::get('username')); $user = Sentry::findUserByLogin($user->mail); Sentry::login($user, false); echo json_encode(array('location' => 'dashboard/day')); } else { echo json_encode(array('html' => '<div class="alert alert-error"> User was not found </div> ')); } } catch (Exception $e) { echo json_encode(array('html' => '<div class="alert alert-error">' . $e->getMessage() . ' </div> ')); } } else { try { $user = Sentry::authenticate(array('email' => Input::get('username'), 'password' => Input::get('password')), false); if ($user) { echo json_encode(array('location' => 'dashboard/day')); } } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { echo json_encode(array('html' => '<div class="alert alert-error"> Login field is required </div> ')); } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { echo json_encode(array('html' => '<div class="alert alert-error"> Password field is required </div> ')); } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) { echo json_encode(array('html' => '<div class="alert alert-error"> Wrong password, try again </div> ')); } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { echo json_encode(array('html' => '<div class="alert alert-error"> User was not found </div> ')); } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { echo json_encode(array('html' => '<div class="alert alert-error"> User is not activated </div> ')); } catch (\Exception $e) { // Log::info( $e->getMessage() ); echo json_encode(array('html' => '<div class="alert alert-error">' . $e->getMessage() . ' </div> ')); } } }
public function actionAdmin() { /* used in the refnum selection */ if (isset($_POST['Settings'])) { if (isset($_POST['ajax'])) { $model = new Settings(); return $model->Tmvalidate($_POST['Settings']); } //$this->performAjaxValidation($_POST['Settings']); foreach ($_POST['Settings'] as $key => $value) { $model = Settings::findOne($key); $model->value = $value['value']; //will stop $model->save(); } //$comp = Company::findOne($this->company); //$comp->loadSettings(); \Yii::$app->getSession()->setFlash('success', Yii::t("app", "Saved")); } $models = Settings::find()->where(array("hidden" => "0"))->all(); //->addOrderBy(['priority'=>'desc']) return $this->render('view', array('models' => $models)); }
public function actionSettings() { $request = Yii::$app->request; if (isset($_POST['db-button'])) { foreach (Settings::find()->where(['like', 'field', 'db_'])->all() as $row) { $field = Settings::findOne(['field' => $row['field']]); $field->value = $request->post($row['field'], ''); $field->save(); } } if (isset($_POST['db-check'])) { $db = new \yii\db\Connection(['dsn' => 'mysql:host=' . $request->post('db_host', '') . ';dbname=' . $request->post('db_name', ''), 'username' => $request->post('db_user', ''), 'password' => $request->post('db_password', ''), 'emulatePrepare' => true, 'charset' => 'utf8']); try { $db->open(); Yii::$app->session->setFlash('success', 'Соединение успешно'); } catch (\Exception $e) { Yii::$app->session->setFlash('error', 'Ошибка подключения: ' . $e->getMessage()); } } // if (isset($_POST['ts-button'])) //сохранить типы отправлений // { // $field = Settings::findOne([ // 'field' => 'shipping_type', // ]); // $field->value = serialize($request->post('types', '')); // $field->save(); // } if (isset($_POST['os-button-mail'])) { $field = Settings::findOne(['field' => 'order_status_mail']); $field->value = serialize($request->post('statuses_mail', '')); $field->save(); } if (isset($_POST['os-button-sms'])) { $field = Settings::findOne(['field' => 'order_status_sms']); $field->value = serialize($request->post('statuses_sms', '')); $field->save(); } if (isset($_POST['app-button'])) { foreach (Settings::find()->where(['like', 'field', 'app_'])->all() as $row) { $field = Settings::findOne(['field' => $row['field']]); $field->value = $request->post($row['field'], ''); $field->save(); } } if (isset($_POST['mail-button'])) { $field = Settings::findOne(['field' => 'mails']); $field->value = serialize(array_filter($request->post('mails', ''))); $field->save(); foreach (Settings::find()->where(['like', 'field', 'mail_'])->all() as $row) { $field = Settings::findOne(['field' => $row['field']]); $field->value = $request->post($row['field'], ''); $field->save(); } } if (isset($_POST['sms-button'])) { foreach (Settings::find()->where(['like', 'field', 'sms_'])->all() as $row) { $field = Settings::findOne(['field' => $row['field']]); $field->value = $request->post($row['field'], ''); $field->save(); } } $settings = Settings::getSettings(); return $this->render('settings', ['settings' => $settings, 'types' => $types, 'statuses_mail' => $statuses_mail, 'statuses_sms' => $statuses_sms]); }
public function dashboard() { if ($this->request->query['json'] == true) { $this->_render['type'] = 'json'; } $user = Session::read('default'); $id = $user['_id']; if ($user == "") { return $this->redirect('/login'); exit; } $details = Details::find('first', array('conditions' => array('user_id' => $id))); $trades = Trades::find('all'); $YourOrders = array(); foreach ($trades as $t) { $YourOrders['Buy'] = $this->YourOrders($id, 'Buy', substr($t['trade'], 0, 3), substr($t['trade'], 4, 3)); $YourOrders['Sell'] = $this->YourOrders($id, 'Sell', substr($t['trade'], 0, 3), substr($t['trade'], 4, 3)); $YourCompleteOrders['Buy'] = $this->YourCompleteOrders($id, 'Buy', substr($t['trade'], 0, 3), substr($t['trade'], 4, 3)); $YourCompleteOrders['Sell'] = $this->YourCompleteOrders($id, 'Sell', substr($t['trade'], 0, 3), substr($t['trade'], 4, 3)); } $Commissions = $this->TotalCommissions($id); $CompletedCommissions = $this->CompletedTotalCommissions($id); $RequestFriends = $this->RequestFriend($id); $UsersRegistered = Details::count(); $functions = new Functions(); $OnlineUsers = $functions->OnlineUsers(); foreach ($trades as $t) { $TotalOrders['Buy'] = $this->TotalOrders($id, 'Buy', substr($t['trade'], 0, 3), substr($t['trade'], 4, 3)); $TotalOrders['Sell'] = $this->TotalOrders($id, 'Sell', substr($t['trade'], 0, 3), substr($t['trade'], 4, 3)); $TotalCompleteOrders['Buy'] = $this->TotalCompleteOrders($id, 'Buy', substr($t['trade'], 0, 3), substr($t['trade'], 4, 3)); $TotalCompleteOrders['Sell'] = $this->TotalCompleteOrders($id, 'Sell', substr($t['trade'], 0, 3), substr($t['trade'], 4, 3)); } $title = "Dashboard"; $keywords = "Dashboard, trading platform, bitcoin exchange, we trust, United Kingdom, UK"; $description = "Dashboard for trading platform for bitcoin exchange in United Kingdom, UK"; $settings = Settings::find('first'); return compact('title', 'details', 'YourOrders', 'Commissions', 'CompletedCommissions', 'YourCompleteOrders', 'RequestFriends', 'UsersRegistered', 'OnlineUsers', 'TotalOrders', 'TotalCompleteOrders', 'keywords', 'description', 'settings'); }
public function Approval() { if ($this->__init() == false) { $this->redirect('ex::dashboard'); } if ($this->request->data) { $UserApproval = $this->request->data['UserApproval']; $EmailSearch = $this->request->data['EmailSearch']; $UserSearch = $this->request->data['UserSearch']; $usernames = array(); if ($EmailSearch != "" || $UserSearch != "") { $user = Users::find('all', array('conditions' => array('username' => array('$regex' => $UserSearch), 'email' => array('$regex' => $EmailSearch)))); foreach ($user as $u) { array_push($usernames, $u['username']); } } else { $user = Users::find('all', array('limit' => 1000)); foreach ($user as $u) { array_push($usernames, $u['username']); } } switch ($UserApproval) { case "All": $details = Details::find('all', array('conditions' => array('username' => array('$in' => $usernames)))); // print_r($usernames); break; case "VEmail": $details = Details::find('all', array('conditions' => array('email.verified' => 'Yes', 'username' => array('$in' => $usernames)))); break; case "VPhone": $details = Details::find('all', array('conditions' => array('phone.verified' => 'Yes', 'username' => array('$in' => $usernames)))); break; case "VBank": $details = Details::find('all', array('conditions' => array('bank.verified' => 'Yes', 'username' => array('$in' => $usernames)))); break; case "VGovernment": $details = Details::find('all', array('conditions' => array('government.verified' => 'Yes', 'username' => array('$in' => $usernames)))); break; case "VUtility": $details = Details::find('all', array('conditions' => array('utility.verified' => 'Yes', 'username' => array('$in' => $usernames)))); break; case "NVEmail": $details = Details::find('all', array('conditions' => array('email.verify' => 'Yes', 'username' => array('$in' => $usernames)))); break; case "NVPhone": $details = Details::find('all', array('conditions' => array('phone.verified' => array('$exists' => false), 'username' => array('$in' => $usernames)))); break; case "NVBank": $details = Details::find('all', array('conditions' => array('bank.verified' => array('$exists' => false), 'username' => array('$in' => $usernames)))); break; case "NVGovernment": $details = Details::find('all', array('conditions' => array('government.verified' => array('$exists' => false), 'username' => array('$in' => $usernames)))); break; case "NVUtility": $details = Details::find('all', array('conditions' => array('utility.verified' => array('$exists' => false), 'username' => array('$in' => $usernames)))); break; case "WVEmail": $details = Details::find('all', array('conditions' => array('email.verified' => array('$exists' => false), 'username' => array('$in' => $usernames)))); break; case "WVPhone": $details = Details::find('all', array('conditions' => array('phone.verified' => 'No', 'phone.error' => 0, 'username' => array('$in' => $usernames)))); break; case "WVBank": $details = Details::find('all', array('conditions' => array('bank.verified' => 'No', 'username' => array('$in' => $usernames)))); break; case "WVGovernment": $details = Details::find('all', array('conditions' => array('government.verified' => 'No', 'government.error' => 0, 'username' => array('$in' => $usernames)))); break; case "WVUtility": $details = Details::find('all', array('conditions' => array('utility.verified' => 'No', 'utility.error' => 0, 'username' => array('$in' => $usernames)))); break; } } else { $details = Details::find('all', array('conditions' => array('$or' => array(array('utility.verified' => 'No'), array('government.verified' => 'No'), array('bank.verified' => 'No'), array('utility.verified' => ''), array('government.verified' => ''), array('bank.verified' => ''))))); } // print_r(count($details)); $title = "Admin Approval"; $keywords = "Admin, Approval"; $description = "Admin panel for approval"; $settings = Settings::find('first'); return compact('UserApproval', 'details', 'title', 'keywords', 'description', 'settings'); }
public function funding_fiat($currency = null) { $title = "Funding Fiat"; $user = Session::read('default'); if ($user == "") { return $this->redirect('/login'); } $id = $user['_id']; $details = Details::find('first', array('conditions' => array('user_id' => (string) $id))); $transactions = Transactions::find('all', array('conditions' => array('username' => $user['username'], 'Added' => false, 'Approved' => 'No'))); $settings = Settings::find('first'); return compact('details', 'title', 'transactions', 'user', 'settings', 'currency'); }
/** * Read Bacula Configuration Files * @return View */ public function readbacula() { // Delete All Database Rows CfgCatalog::truncate(); CfgClient::truncate(); CfgDirector::truncate(); CfgFileset::truncate(); CfgJob::truncate(); CfgPool::truncate(); CfgSchedule::truncate(); CfgSchedulerun::truncate(); CfgStorage::truncate(); cfgfilesetinclude::truncate(); Cfgfilesetincludeoptions::truncate(); cfgFileSetExclude::truncate(); cfgFileSetExcludeOptions::truncate(); CfgConsole::truncate(); CfgMessage::truncate(); // path to directory to scan $confdir = Settings::find(1); $path = $confdir->confdir; /* Delete Test Bacula Configuration Teste*/ File::cleanDirectory($path . '/reportulateste'); // Read All Files all Directorys $files = File::allFiles($path); foreach ($files as $file) { if (File::extension($file) == 'conf') { $conffiles[] = $file; } } $nfiles = count($conffiles); foreach ($conffiles as $file) { $config = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $filename = $file->getFilename(); // strip all comments early, so we needn't be bothered with them later... foreach ($config as $linenum => $line) { $line = preg_replace("/#.*\$/", "", $line); } // also, lets convert semicolons to newlines, as they are kinda weird too. $newconfig = array(); foreach ($config as $linenum => $line) { if (preg_match("/;/", $line)) { $newlines = preg_split("/;/", $line); foreach ($newlines as $num => $newline) { array_push($newconfig, $newline); } } else { array_push($newconfig, $line); } } $config = $newconfig; if ($filename != 'bacula-fd.conf' && $filename != 'bacula-sd.conf' && $filename != 'mtx-changer.conf') { $i = 0; $Consolecfg = new CfgConsole(); $Console = array(); foreach ($config as $key => $value) { if (trim($value) == 'Console {') { $i = $key; do { $i++; $result = preg_split('[=]', $config[$i]); if (substr(trim($result[0]), 0, 1) != '#') { $Console[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } } while (trim($config[$i + 1]) != "}"); $Consoletest = CfgConsole::where('Name', '=', $Console['Name']); if ($Consoletest->count() == 0) { CfgConsole::create($Console); } } } $Messagescfg = new CfgMessage(); $Messages = array(); foreach ($config as $key => $value) { if (trim($value) == 'Messages {') { $i = $key; do { $i++; $result = preg_split('[=]', $config[$i]); if (count($result) >= 3) { $option = array_shift($result); $value = implode("=", $result); $result[0] = $option; $result[1] = $value; } if (substr(trim($result[0]), 0, 1) != '#') { $Messages[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } } while (trim($config[$i + 1]) != "}"); $Messagestest = CfgMessage::where('Name', '=', $Messages['Name']); if ($Messagestest->count() == 0) { CfgMessage::create($Messages); } } } $schedulecfg = new CfgSchedule(); $schedule = array(); $k = 0; foreach ($config as $key => $value) { if (trim($value) == 'Schedule {') { $i = $key; do { $i++; $result = preg_split('[=]', $config[$i]); if (substr(trim($result[0]), 0, 1) != '#') { if (trim($result[0]) != "Run") { $schedule[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } else { $schedulerun[$k]['Run'] = preg_replace('/(\'|")/', '', trim($result[1])); $k++; } } } while (trim($config[$i + 1]) != "}"); $scheduletest = CfgSchedule::where('Name', '=', $schedule['Name']); if ($scheduletest->count() == 0) { $scheduleid = CfgSchedule::create($schedule); // Insert Run Options Schedules foreach ($schedulerun as $valor) { $result = array_merge($valor, array("idschedule" => $scheduleid->id)); CfgSchedulerun::create($result); } } } } $poolcfg = new CfgPool(); $pool = array(); foreach ($config as $key => $value) { if (trim($value) == 'Pool {') { $i = $key; do { $i++; $result = preg_split('[ = ]', $config[$i]); $pool[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } while (trim($config[$i + 1]) != "}"); $pooltest = CfgPool::where('Name', '=', $pool['Name']); if ($pooltest->count() == 0) { $poolcfg = CfgPool::create($pool); } } } if ($filename != 'bacula-sd.conf' && $filename != 'tray-monitor.conf') { $storagecfg = new CfgStorage(); $storage = array(); foreach ($config as $key => $value) { if (trim($value) == 'Storage {') { $i = $key; do { $i++; $result = preg_split('[ = ]', $config[$i]); if (array_key_exists(1, $result)) { $storage[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } } while (trim($config[$i + 1]) != "}"); $storagetest = Cfgstorage::where('Name', '=', $storage['Name']); if ($storagetest->count() == 0) { $storagecfg = Cfgstorage::create($storage); } } } } $catalogcfg = new CfgCatalog(); $catalog = array(); /* foreach ($config as $key => $value) { if (trim($value)=='Catalog {') { //echo "<pre>"; //print_r($value); $i=$key; do { $i++; $result = preg_split ('[ = ]', $config[$i]); } while (trim($config[$i+1]) != "}"); $catalogtest = Cfgcatalog::where('Name', '=', $catalog['Name']); if ($catalogtest->count()==0) { $catalogcfg = CfgCatalog::create($catalog); }; } } */ if ($filename != 'bconsole.conf' && $filename == 'bacula-dir.conf') { $directorcfg = new CfgDirector(); $director = array(); foreach ($config as $key => $value) { if (trim($value) == 'Director {') { $i = $key; do { $i++; $result = preg_split('[ = ]', $config[$i]); $director[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } while (trim($config[$i + 1]) != "}"); $directortest = CfgDirector::where('Name', '=', $director['Name']); if ($directortest->count() == 0) { $directorcfg = CfgDirector::create($director); } } } } if ($filename != 'tray-monitor.conf') { $clientcfg = new CfgClient(); $client = array(); foreach ($config as $key => $value) { if (trim($value) == 'Client {') { $i = $key; do { $i++; $result = preg_split('[=]', $config[$i]); $client[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } while (trim($config[$i + 1]) != "}"); $clienttest = CfgClient::where('Name', '=', $client['Name']); if ($clienttest->count() == 0) { $clientcfg = Cfgclient::create($client); } //log::info($filename,$client); } } } $jobcfg = new CfgJob(); $job = array(); foreach ($config as $key => $value) { if (trim($value) == 'Job {' || trim($value) == 'JobDefs {') { $i = $key; do { $i++; $result = preg_split('[=]', $config[$i]); if (array_key_exists(1, $result)) { //if (substr(trim($result[0]), 0, 1) != '#') $job[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } } while (trim($config[$i + 1]) != "}"); $jobtest = CfgJob::where('Name', '=', $job['Name']); if ($jobtest->count() == 0) { $jobcfg = CfgJob::create($job); } } } $filesetcfg = new CfgFileset(); $fileset = array(); $oinc = array(); $oexc = array(); $finc = array(); $fexc = array(); foreach ($config as $key => $value) { if (trim($value) == 'FileSet {') { $key++; while (trim($config[$key]) != "}") { if (trim($config[$key]) == 'Include {') { $key++; $z = 0; while (trim($config[$key]) != '}') { if (trim($config[$key]) == 'Options {') { $k = 0; $key++; while (trim($config[$key]) != '}') { $options = preg_split('[=]', $config[$key]); if (substr(trim($options[0]), 0, 1) != '#') { $oinc[$k]['option'] = preg_replace('/\\s*/m', '', $options[0]); $oinc[$k]['value'] = preg_replace('/(\'|")/', '', trim($options[1])); $k++; } $key++; } $key++; } $include = preg_split('[=]', $config[$key]); if (substr(trim($include[0]), 0, 1) != '#') { if (array_key_exists(1, $result)) { $finc[$z][preg_replace('/\\s*/m', '', $include[0])] = preg_replace('/(\'|")/', '', trim($include[1])); $z++; } } $key++; } $key++; } if (trim($config[$key]) == '}') { break; } /* Fileset Exclude */ if (trim($config[$key]) == 'Exclude {') { $key++; $h = 0; while (trim($config[$key]) != '}') { if (trim($config[$key]) == 'Options {') { $b = 0; $key++; while (trim($config[$key]) != "}") { $options = preg_split('[=]', $config[$key]); if (substr(trim($options[0]), 0, 1) != '#') { $oexc[$b]['option'] = preg_replace('/\\s*/m', '', $options[0]); $oexc[$b]['value'] = preg_replace('/(\'|")/', '', trim($options[1])); $k++; } $key++; } $key++; } $exclude = preg_split('[=]', $config[$key]); if (substr(trim($exclude[0]), 0, 1) != '#') { if (array_key_exists(1, $result)) { $fexc[$h][preg_replace('/\\s*/m', '', $exclude[0])] = preg_replace('/(\'|")/', '', trim($exclude[1])); $h++; } $key++; } } } $result = preg_split('[=]', $config[$key]); if (substr(trim($result[0]), 0, 1) != '#' && substr(trim($result[0]), 0, 1) != '}') { if (array_key_exists(1, $result)) { $fileset[preg_replace('/\\s*/m', '', $result[0])] = preg_replace('/(\'|")/', '', trim($result[1])); } } $key++; if (!array_key_exists($key, $config)) { break; } } $filesettest = CfgFileset::where('Name', '=', $fileset['Name']); if ($filesettest->count() == 0) { $filesetcfg = CfgFileset::create($fileset); $filesetid = $filesetcfg->id; } else { $filesetid = $filesettest->first()->id; } // Insert File Includes foreach ($finc as $valor) { $result = array_merge($valor, array("idfileset" => $filesetid)); $filesetcfg = Cfgfilesetinclude::create($result); } // Insert File Excludes foreach ($fexc as $valor) { $result = array_merge($valor, array("idfileset" => $filesetid)); $filesetcfg = Cfgfilesetexclude::create($result); } // Insert File Options Include foreach ($oinc as $valor) { $result = array_merge($valor, array("idfileset" => $filesetid)); $filesetcfg = Cfgfilesetincludeoptions::create($result); } // Insert File Options Excludes foreach ($oexc as $valor) { $result = array_merge($valor, array("idfileset" => $filesetid)); $filesetcfg = Cfgfilesetexcludeoptions::create($result); } } } } } return Response::json(array('html' => '<div class="alert alert-success"> ' . $nfiles . ' Configuration Files Readed! </div>')); }