public function getIndex() { $database_structure = $this->_db_messages(); $search_data = PageSearchData::orderBy('updated_at', 'asc')->first(); if (!empty($search_data)) { $last_indexed_search = DateTimeHelper::display($search_data->updated_at); } else { $last_indexed_search = false; } $update = Auth::action('system.update'); if ($update) { $settings = Setting::where('hidden', '=', '0')->orWhere('editable', '=', 1)->get(); } else { $settings = Setting::where('hidden', '=', '0')->get(); } foreach ($settings as $k => $setting) { if (!$update) { $settings[$k]->editable = 0; } $note = ''; switch ($setting->name) { case 'frontend.language': $custom = new \stdClass(); $custom->selected = $setting->value; $custom->options = Language::selectArray(); break; case 'frontend.theme': $custom = new \stdClass(); $custom->selected = $setting->value; $custom->options = Theme::selectArray(); break; case 'admin.default_template': $custom = new \stdClass(); $custom->selected = $setting->value; $custom->options = Theme::get_template_list($setting->value); break; case 'frontend.language_fallback': case 'frontend.strong_tags': case 'admin.advanced_permissions': case 'admin.publishing': $custom = new \stdClass(); $custom->selected = $setting->value; $custom->options = [1 => 'On', 0 => 'Off']; break; case 'admin.title_block': $custom = new \stdClass(); $custom->selected = $setting->value; $custom->options = Block::nameToNameArray(); break; case 'site.pages': $total_pages = Page::get_total(); $note = 'set to 0 for no limit - currently ' . $total_pages . ' normal pages in use'; break; case 'site.groups': $total_pages = Page::get_total(true); $note = 'set to 0 for no limit on group pages - currently ' . $total_pages . ' pages in use'; break; case 'site.secure_folders': $note = 'list of comma separated folders, will copy files to secure folders and vice versa on update'; break; default: $custom = null; } if (empty($custom)) { $settings[$k]->value = $setting->value; } else { $settings[$k]->value = $custom; } $settings[$k]->note = !empty($note) ? $note : null; $settings[$k]->name = str_replace('.', $this->dot_replace, $setting->name); } $upgrade = new \stdClass(); $upgrade->from = config('coaster::site.version'); $upgrade->to = Setting::latestTag(); $upgrade->required = version_compare(config('coaster::site.version'), Setting::latestTag(), '<'); $this->layoutData['content'] = View::make('coaster::pages.system', array('database_structure' => $database_structure, 'last_indexed_search' => $last_indexed_search, 'site_details' => $settings, 'can_index_search' => Auth::action('system.search'), 'can_validate' => Auth::action('system.validate-db'), 'can_upgrade' => Auth::action('system.upgrade'), 'upgrade' => $upgrade)); }
public static function activate($themeName) { $theme = self::where('theme', '=', $themeName)->first(); if (!empty($theme)) { Setting::where('name', '=', 'frontend.theme')->update(['value' => $theme->id]); self::templateIdUpdate($theme->id); return 1; } return 0; }
public function installTheme() { $details = Request::all(); $error = false; if (!empty($details['theme'])) { if (!($error = Theme::unzip($details['theme'] . '.zip', false))) { $withPageData = !empty($details['page-data']) ? 1 : 0; $result = Theme::install($details['theme'], ['withPageData' => $withPageData]); if ($result['error']) { $error = $result['response']; } if (($usedThemeSetting = Setting::where('name', '=', 'frontend.theme')->first()) && ($theme = Theme::where('theme', '=', $details['theme'])->first())) { $usedThemeSetting->value = $theme->id; $usedThemeSetting->save(); } } } if ($error) { FormMessage::add('theme', $error); $this->setupTheme(); } else { include __DIR__ . '/../../Http/routes/admin.php'; Install::setInstallState('complete-welcome'); $this->layoutData['title'] = 'Install Complete'; $this->layoutData['content'] = View::make('coaster::pages.install', ['stage' => 'complete']); } }