本文整理汇总了PHP中mw_is_installed函数的典型用法代码示例。如果您正苦于以下问题:PHP mw_is_installed函数的具体用法?PHP mw_is_installed怎么用?PHP mw_is_installed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mw_is_installed函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$is_installed = mw_is_installed();
if (!$is_installed) {
if (!$is_installed) {
$installer = new InstallController();
return $installer->index();
}
} else {
if (defined('MW_VERSION')) {
$config_version = Config::get('microweber.version');
if ($config_version != MW_VERSION) {
$this->app->update->post_update(MW_VERSION);
}
}
}
if (!defined('MW_BACKEND')) {
define('MW_BACKEND', true);
}
//create_mw_default_options();
mw()->content_manager->define_constants();
if (defined('TEMPLATE_DIR')) {
$load_template_functions = TEMPLATE_DIR . 'functions.php';
if (is_file($load_template_functions)) {
include_once $load_template_functions;
}
}
event_trigger('mw.admin');
event_trigger('mw_backend');
$view = modules_path() . 'admin/';
$hasNoAdmin = User::where('is_admin', 1)->limit(1)->count();
if (!$hasNoAdmin) {
$this->hasNoAdmin();
}
$view .= (!$hasNoAdmin ? 'create' : 'index') . '.php';
$layout = new View($view);
$layout = $layout->__toString();
$layout = mw()->parser->process($layout);
event_trigger('on_load');
$layout = execute_document_ready($layout);
event_trigger('mw.admin.header');
$apijs_loaded = mw()->template->get_apijs_url();
$apijs_settings_loaded = mw()->template->get_apijs_settings_url();
$default_css = '<link rel="stylesheet" href="' . mw_includes_url() . 'default.css" type="text/css" />';
if (!stristr($layout, $apijs_loaded)) {
$rep = 0;
$default_css = $default_css . "\r\n" . '<script src="' . $apijs_settings_loaded . '"></script>' . "\r\n";
$default_css = $default_css . "\r\n" . '<script src="' . $apijs_loaded . '"></script>' . "\r\n";
$layout = str_ireplace('<head>', '<head>' . $default_css, $layout, $rep);
}
$template_headers_src = mw()->template->admin_head(true);
if ($template_headers_src != false and $template_headers_src != '') {
$layout = str_ireplace('</head>', $template_headers_src . '</head>', $layout, $one);
}
return $layout;
}
示例2: load_all_functions_files_for_modules
function load_all_functions_files_for_modules($options = false)
{
$is_installed = mw_is_installed();
if (!$is_installed) {
return;
}
$modules = mw()->modules->get('ui=any&installed=1&limit=99999');
$files = array();
if (!empty($modules)) {
foreach ($modules as $module) {
if (isset($module['module'])) {
$is_function = normalize_path(modules_path() . $module['module'] . DS . 'functions.php', false);
if (is_file($is_function)) {
include_once $is_function;
$files[] = $is_function;
}
}
}
return $files;
}
}
示例3: createApplication
public function createApplication()
{
$config_folder = __DIR__ . '/../../../config/testing/';
$mw_file = $config_folder . 'microweber.php';
if (!is_dir($config_folder)) {
mkdir($config_folder);
}
file_put_contents($mw_file, "<?php return array (\n 'is_installed' => 0,\n );");
$unitTesting = true;
$testEnvironment = 'testing';
$app = (require __DIR__ . '/../../../bootstrap/app.php');
$app->make('Illuminate\\Contracts\\Console\\Kernel')->bootstrap();
$this->assertEquals(true, is_dir($config_folder));
$this->sqlite_file = storage_path() . '/phpunit.sqlite';
// make fresh install
$install_params = array('username' => 'test', 'password' => 'test', 'email' => 'test@example.com', 'db_driver' => 'sqlite', 'db_host' => '', 'db_user' => '', 'db_pass' => '', 'db_name' => $this->sqlite_file, '--env' => 'testing');
$is_installed = mw_is_installed();
if (!$is_installed) {
$install = \Artisan::call('microweber:install', $install_params);
$this->assertEquals(0, $install);
}
\Mail::pretend(true);
return $app;
}
示例4: editor_tools
public function editor_tools()
{
if (!defined('IN_ADMIN') and is_admin()) {
define('IN_ADMIN', true);
}
if (!defined('IN_EDITOR_TOOLS')) {
define('IN_EDITOR_TOOLS', true);
}
if (mw_is_installed() == true) {
//event_trigger('mw_db_init');
// event_trigger('mw_cron');
}
$tool = $this->app->url_manager->segment(1);
if ($tool) {
} else {
$tool = 'index';
}
$page = false;
if (isset($_REQUEST['content_id'])) {
if (intval($_REQUEST['content_id']) == 0) {
$this->create_new_page = true;
$custom_content_data_req = $_REQUEST;
$custom_content_data = array();
if (isset($custom_content_data_req['content_type'])) {
// $custom_content_data['content_type'] = $custom_content_data_req['content_type'];
}
if (isset($custom_content_data_req['content_type'])) {
$custom_content_data['content_type'] = $custom_content_data_req['content_type'];
}
if (isset($custom_content_data_req['subtype'])) {
$custom_content_data['subtype'] = $custom_content_data_req['subtype'];
}
if (isset($custom_content_data_req['parent_page']) and is_numeric($custom_content_data_req['parent_page'])) {
$custom_content_data['parent'] = intval($custom_content_data_req['parent_page']);
}
if (isset($custom_content_data_req['preview_layout'])) {
// $custom_content_data['preview_layout'] =($custom_content_data_req['preview_layout']);
}
if (!empty($custom_content_data)) {
$custom_content_data['id'] = 0;
$this->content_data = $custom_content_data;
}
$this->return_data = 1;
$page = $this->frontend();
} else {
$page = $this->app->content_manager->get_by_id($_REQUEST['content_id']);
}
} elseif (isset($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER['HTTP_REFERER'];
$url = explode('?', $url);
$url = $url[0];
if (trim($url) == '' or trim($url) == $this->app->url_manager->site()) {
//$page = $this->app->content_manager->get_by_url($url);
$page = $this->app->content_manager->homepage();
} else {
$page = $this->app->content_manager->get_by_url($url);
}
} else {
$url = $this->app->url_manager->string();
}
if (!isset($page['active_site_template'])) {
$page['active_site_template'] = 'default';
}
if (isset($_GET['preview_template'])) {
$page['active_site_template'] = $_GET['preview_template'];
}
if (isset($_GET['content_type'])) {
$page['content_type'] = $_GET['content_type'];
}
if (isset($_GET['preview_layout']) and $_GET['preview_layout'] != 'inherit') {
$page['layout_file'] = $_GET['preview_layout'];
}
$this->app->content_manager->define_constants($page);
$page['render_file'] = $this->app->template->get_layout($page);
if (defined('TEMPLATE_DIR')) {
$load_template_functions = TEMPLATE_DIR . 'functions.php';
if (is_file($load_template_functions)) {
include_once $load_template_functions;
}
}
$params = $_REQUEST;
$tool = str_replace('..', '', $tool);
$p_index = mw_includes_path() . 'toolbar/editor_tools/index.php';
$p_index = normalize_path($p_index, false);
$standalone_edit = true;
$p = mw_includes_path() . 'toolbar/editor_tools/' . $tool . '/index.php';
$standalone_edit = false;
if ($tool == 'plupload') {
$standalone_edit = true;
}
if ($tool == 'plupload') {
$standalone_edit = true;
}
if ($tool == 'imageeditor') {
$standalone_edit = true;
}
if ($tool == 'rte_image_editor') {
$standalone_edit = true;
}
if ($tool == 'editor_toolbar') {
//.........这里部分代码省略.........
示例5: log_action
function log_action($back_log_action)
{
if (mw_is_installed() == true) {
if ($back_log_action == false) {
$this->app->log_manager->delete("is_system=y&rel_type=export&user_ip=" . USER_IP);
} else {
$check = $this->app->log_manager->get("order_by=created_at desc&one=true&is_system=y&created_at=[mt]30 min ago&field=action&rel_type=export&user_ip=" . USER_IP);
if (is_array($check) and isset($check['id'])) {
$this->app->log_manager->save("is_system=y&field=action&rel_type=export&value=" . $back_log_action . "&user_ip=" . USER_IP . "&id=" . $check['id']);
} else {
$this->app->log_manager->save("is_system=y&field=action&rel_type=export&value=" . $back_log_action . "&user_ip=" . USER_IP);
}
}
}
}
示例6: get_all_functions_files_for_modules
function get_all_functions_files_for_modules($options = false)
{
if (mw_is_installed() == false) {
return false;
}
$args = func_get_args();
$function_cache_id = '';
$function_cache_id = serialize($options);
$cache_id = $function_cache_id = __FUNCTION__ . crc32($function_cache_id);
$cache_group = 'modules/global';
$cache_content = mw()->cache_manager->get($cache_id, $cache_group);
if ($cache_content != false) {
return $cache_content;
}
if (isset($options['glob'])) {
$glob_patern = $options['glob'];
} else {
$glob_patern = '*functions.php';
}
if (isset($options['dir_name'])) {
$dir_name = $options['dir_name'];
} else {
$dir_name = normalize_path(modules_path());
}
$installed = mw()->modules->get('ui=any&installed=1');
$configs = false;
if (is_array($installed) and !empty($installed)) {
$configs = array();
foreach ($installed as $module) {
if (isset($module['module'])) {
$file = normalize_path($dir_name . $module['module'] . DS . 'functions.php', false);
if (is_file($file)) {
$configs[] = $file;
}
}
}
}
mw()->cache_manager->save($configs, $function_cache_id, $cache_group);
return $configs;
}
示例7: boot
public function boot(Request $request)
{
parent::boot();
// public = /
App::instance('path.public', base_path());
Cache::extend('file', function ($app) {
return new Utils\Adapters\Cache\CacheStore();
});
// If installed load module functions and set locale
if (mw_is_installed()) {
$modules = load_all_functions_files_for_modules();
$this->commands('Microweber\\Commands\\OptionCommand');
$language = get_option('language', 'website');
if ($language != false) {
set_current_lang($language);
}
if ($this->app->runningInConsole()) {
$this->commands('Microweber\\Commands\\UpdateCommand');
}
} else {
// Otherwise register the install command
$this->commands('Microweber\\Commands\\InstallCommand');
}
// Register routes
$this->registerRoutes();
}
示例8: save
public function save($params)
{
$force = false;
if (defined('MW_FORCE_USER_SAVE')) {
$force = MW_FORCE_USER_SAVE;
} elseif ($this->force_save) {
$force = $this->force_save;
} elseif (mw_var('force_save_user')) {
$force = mw_var('force_save_user');
}
if (!$force) {
if (defined("MW_API_CALL") and mw_is_installed() == true) {
if (isset($params['is_admin']) and $this->is_admin() == false and !is_null(User::first())) {
unset($params['is_admin']);
}
}
}
if ($force == false) {
if (isset($params['id']) and $params['id'] != 0) {
$adm = $this->is_admin();
if ($adm == false) {
$is_logged = user_id();
if ($is_logged == false or $is_logged == 0) {
return array('error' => 'You must be logged to save user');
} elseif (intval($is_logged) == intval($params['id']) and intval($params['id']) != 0) {
// the user is editing their own profile
} else {
return array('error' => 'You must be logged to as admin save this user');
}
}
} else {
if (defined('MW_API_CALL') and mw_is_installed() == true) {
$adm = $this->is_admin();
if ($adm == false) {
$params['id'] = $this->id();
$is_logged = user_id();
if (intval($params['id']) != 0 and $is_logged != $params['id']) {
return array('error' => 'You must be logged save your settings');
}
} else {
if (!isset($params['id'])) {
$params['id'] = $this->id();
}
}
}
}
}
$data_to_save = $params;
if (isset($data_to_save['id']) and $data_to_save['id'] != 0 and isset($data_to_save['email']) and $data_to_save['email'] != false) {
$old_user_data = $this->get_by_id($data_to_save['id']);
if (isset($old_user_data['email']) and $old_user_data['email'] != false) {
if ($data_to_save['email'] != $old_user_data['email']) {
if (isset($old_user_data['password_reset_hash']) and $old_user_data['password_reset_hash'] != false) {
$hash_cache_id = md5(serialize($old_user_data)) . uniqid() . rand();
$data_to_save['password_reset_hash'] = $hash_cache_id;
}
}
}
}
if (isset($data_to_save['email']) and isset($data_to_save['id'])) {
$email = trim($data_to_save['email']);
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$check_existing = array();
$check_existing['email'] = $email;
$check_existing['single'] = 1;
$check_existing = $this->get_all($check_existing);
if (isset($check_existing['id']) and $check_existing['id'] != $data_to_save['id']) {
return array('error' => 'User with this email already exists! Try different email address!');
}
}
}
if (isset($data_to_save['username']) and $data_to_save['username'] != false and isset($data_to_save['id']) and $data_to_save['id'] != false) {
$check_existing = array();
$check_existing['username'] = $data_to_save['username'];
$check_existing['single'] = 1;
$check_existing = $this->get_all($check_existing);
if (isset($check_existing['id']) and $check_existing['id'] != $data_to_save['id']) {
return array('error' => 'User with this username already exists! Try different username!');
}
}
if (isset($params['id']) and intval($params['id']) != 0) {
$user = User::find($params['id']);
} else {
$user = new User();
}
$id_to_return = false;
$data_to_save = $this->app->format->clean_xss($data_to_save);
if ($user->validateAndFill($data_to_save)) {
$save = $user->save();
if (isset($user->id)) {
$data_to_save['id'] = $params['id'] = $user->id;
}
if (isset($params['attributes']) or isset($params['data_fields'])) {
$params['extended_save'] = true;
}
if (isset($params['extended_save'])) {
if (isset($data_to_save['password'])) {
unset($data_to_save['password']);
}
if (isset($data_to_save['id'])) {
//.........这里部分代码省略.........
示例9: get_items_per_page
public function get_items_per_page($group = 'website')
{
if (!isset($this->options_memory['items_per_page'])) {
$this->options_memory = array();
}
if (isset($this->options_memory['items_per_page'][$group])) {
return $this->options_memory['items_per_page'][$group];
}
if (mw_is_installed() == true) {
$table = $this->tables['options'];
$ttl = '99999';
$cache_key = $table . '_items_per_page_' . $group;
$items_per_page = Cache::tags($table)->remember($cache_key, $ttl, function () use($table, $group) {
$items_per_page = DB::table($table)->where('option_key', 'items_per_page')->where('option_group', $group)->first();
return $items_per_page;
});
if (!empty($items_per_page)) {
$items_per_page = (array) $items_per_page;
if (isset($items_per_page['option_value'])) {
$result = $items_per_page['option_value'];
$this->options_memory['items_per_page'][$group] = $result;
return $result;
}
}
}
}
示例10: index
public function index($input = null)
{
if (!is_array($input) || empty($input)) {
$input = Input::all();
}
$allowed_configs = array('database', 'microweber');
$is_installed = mw_is_installed();
if ($is_installed) {
return 'Microweber is already installed!';
}
$view = MW_PATH . 'Views/install.php';
$connection = Config::get('database.connections');
$this->install_log("Preparing to install");
if (isset($input['make_install'])) {
if (!isset($input['db_pass'])) {
$input['db_pass'] = '';
}
if (!isset($input['table_prefix'])) {
$input['table_prefix'] = '';
}
$errors = array();
if (!isset($input['db_host'])) {
$errors[] = 'Parameter "db_host" is required';
} else {
$input['db_host'] = trim($input['db_host']);
}
if (!isset($input['db_name'])) {
$errors[] = 'Parameter "db_name" is required';
} else {
$input['db_name'] = trim($input['db_name']);
}
if (!isset($input['db_user'])) {
$errors[] = 'Parameter "db_user" is required';
}
if (!isset($input['admin_email'])) {
$errors[] = 'Parameter "admin_email" is required';
}
if (!isset($input['admin_password'])) {
$errors[] = 'Parameter "admin_password" is required';
}
if (!isset($input['admin_username'])) {
$errors[] = 'Parameter "admin_username" is required';
}
if (!empty($errors)) {
return implode("\n", $errors);
}
if (isset($input['db_driver'])) {
$dbDriver = $input['db_driver'];
} else {
$dbDriver = 'mysql';
}
Config::set("database.default", $dbDriver);
if ($dbDriver == 'sqlite') {
if (isset($input['db_name_sqlite'])) {
$input['db_name'] = $input['db_name_sqlite'];
}
Config::set("database.connections.{$dbDriver}.database", $input['db_name']);
if (!file_exists($input['db_name'])) {
touch($input['db_name']);
}
}
Config::set("database.connections.{$dbDriver}.host", $input['db_host']);
Config::set("database.connections.{$dbDriver}.username", $input['db_user']);
Config::set("database.connections.{$dbDriver}.password", $input['db_pass']);
Config::set("database.connections.{$dbDriver}.database", $input['db_name']);
Config::set("database.connections.{$dbDriver}.prefix", $input['table_prefix']);
if (isset($input['default_template']) and $input['default_template'] != false) {
Config::set('microweber.install_default_template', $input['default_template']);
}
if (isset($input['with_default_content']) and $input['with_default_content'] != false) {
Config::set('microweber.install_default_template_content', 1);
}
if (Config::get('app.key') == 'YourSecretKey!!!') {
if (!$this->app->runningInConsole()) {
$_SERVER['argv'] = array();
}
Artisan::call('key:generate');
}
$this->install_log("Saving config");
Config::save($allowed_configs);
Cache::flush();
$install_finished = false;
try {
DB::connection($dbDriver)->getDatabaseName();
} catch (\PDOException $e) {
return 'Error: ' . $e->getMessage() . "\n";
} catch (\Exception $e) {
return 'Error: ' . $e->getMessage() . "\n";
}
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
$this->install_log("Setting up database");
$installer = new Install\DbInstaller();
$installer->run();
$installer = new Install\WebserverInstaller();
$installer->run();
$this->install_log("Setting up template");
$installer = new Install\TemplateInstaller();
$installer->run();
//.........这里部分代码省略.........
示例11: __mw_install_log
__mw_install_log('Creating default database tables');
mw()->cache_manager->clear('db');
event_trigger('mw_db_init_default');
event_trigger('mw_db_init');
mw()->content_manager->db_init();
__mw_install_log('Creating log database tables');
mw()->notifications_manager->db_init();
__mw_install_log('Creating online shop database tables');
mw()->shop_manager->db_init();
mw()->shop_manager->create_mw_shop_default_options();
__mw_install_log('Creating modules database tables');
mw()->modules->db_init();
if (!defined('MW_FORCE_SAVE_EXTENDED')) {
define('MW_FORCE_SAVE_EXTENDED', 1);
}
if (mw_is_installed() != true) {
if (isset($to_save['admin_username']) and isset($to_save['admin_password']) and $to_save['admin_username'] != '') {
if ($to_save['admin_username'] != '{admin_username}') {
__mw_install_log('Adding admin user');
$new_admin = array();
$new_admin['username'] = $to_save['admin_username'];
$new_admin['password'] = $to_save['admin_password'];
if (isset($to_save['admin_email']) and $to_save['admin_email'] != '') {
$new_admin['email'] = $to_save['admin_email'];
}
$new_admin['is_active'] = 1;
$new_admin['is_admin'] = 'y';
mw_var('FORCE_SAVE', get_table_prefix() . 'users');
save_user($new_admin);
}
}