public function testGet_elemDefault() { Solar_Config::set('__TEST__', null, $this->_store); $expect = '*default*'; $actual = Solar_Config::get('__TEST__', 'no-such-elem', $expect); $this->assertSame($actual, $expect); }
/** * * Generates a link to the TypeKey login site. * * @param string $text The text to display for the link. * * @param array $attribs Attributes for the anchor. * * @return string * */ public function typekeyLink($text = null, $attribs = null) { // get a URI processor; defaults to the current URI. $uri = Solar::factory('Solar_Uri'); // do not retain the GET 'process' value on the current URI. // this prevents double-processing of actions submitted via GET. $key = $this->_config['process_key']; if (!empty($uri->query[$key])) { unset($uri->query[$key]); } // save the current URI as the return location after typekey. $return = $uri->get(true); // now reset the URI to point to the typekey service $uri->set($this->_config['href']); // add the typekey token if (empty($this->_config['token'])) { $uri->query['t'] = Solar_Config::get('Solar_Auth_Adapter_Typekey', 'token'); } else { $uri->query['t'] = $this->_config['token']; } // convert need_email from true/false to 1/0 and add $uri->query['need_email'] = (int) $this->_config['need_email']; // add the return location $uri->query['_return'] = $return; if (empty($text)) { // Preserve behavior of returning only the link if no text is passed. return $uri->get(true); } // done! return $this->_view->anchor($uri->get(true), $text, $attribs); }
/** * isValidUser * Given credentionals, is this a valid user. (Login) * * @param $values * @return bool */ public function isValidUser($values = array()) { if (!array_key_exists('username', $values) || !array_key_exists('password', $values)) { return false; } $salt = Solar_Config::get('Solar_Auth_Adapter_Sql', 'salt'); $username = $values['username']; $password = md5($salt . $values['password']); $where = array('username = ?' => $username, 'password = ?' => $password); $result = $this->fetchAllAsArray(array('cache' => false, 'where' => $where)); if (is_array($result) && count($result) > 0) { return true; } return false; }
/** * * Post-construction tasks to complete object construction. * * @return void * */ protected function _postConstruct() { if (!self::$_session) { self::$_session = Solar::factory('Solar_Session', array('class' => 'Solar_Csrf')); } if (!self::$_request) { self::$_request = Solar_Registry::get('request'); } // ignore construct-time configuration for the key, but honor // it from the config file. we want the key name to be the // same everywhere all the time. $key = Solar_Config::get('Solar_Csrf', 'key'); if ($key) { self::$_key = $key; } }
protected function _preRender() { parent::_preRender(); if (Solar_Config::get('Foresmo', 'dev')) { xdebug_stop_trace(); $trace_file = explode("\n", file_get_contents('/var/www/foresmo/tmp/trace.xt')); $trace_file_count = count($trace_file); $trace_dump = array(); $defined_funcs = get_defined_functions(); foreach ($trace_file as $line => $value) { if ($line == 0 || $line >= $trace_file_count - 4 || strstr($value, 'include(') || strstr($value, 'require(')) { continue; } $tl = explode('-> ', $value); $tl = explode(' ', $tl[1]); if (!in_array(str_replace('()', '', $tl[0]), $defined_funcs['internal']) && strstr($tl[0], 'Foresmo') && !in_array($tl[0], $trace_dump)) { $trace_dump[] = $tl[0]; } } $tests = array(); // Lets organize our trace dump calls to that we can easily check/run tests foreach ($trace_dump as $call) { if (strstr($call, '->')) { $class_method = explode('->', $call); } else { $class_method = explode('::', $call); } if (!isset($tests[$class_method[0]])) { $tests[$class_method[0]] = array($class_method[1]); } else { $tests[$class_method[0]][] = $class_method[1]; } } var_dump($trace_dump); var_dump($tests); die; } }
/** * * Stops Solar: runs stop scripts and cleans up the Solar environment. * * @return void * */ public static function stop() { // run any 'stop' hook methods $hooks = Solar_Config::get('Solar', 'stop', array()); Solar::callbacks($hooks); // unregister autoloader spl_autoload_unregister(array('Solar_Class', 'autoload')); // reset the status flag, and we're done. Solar::$_status = false; }
/** * _setup * * Set variables used throughout the app here. */ protected function _setup() { parent::_setup(); $this->web_root = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : Solar::$system . '/docroot/'; $this->web_root = Solar_Dir::fix($this->web_root); if (!isset($this->session)) { $this->session = Solar::factory('Solar_Session', array('class' => 'Foresmo_App')); } // Set CSRF Token $this->_setToken(); $this->csrf_token = $this->_getToken(); $this->installed = (bool) Solar_Config::get('Foresmo', 'installed'); if (!$this->installed && $this->_controller != 'install' && $this->_controller != 'ajax') { $this->_redirect('/install'); } elseif (!$this->installed) { return; } $adapter_type = Solar_Config::get('Solar_Sql', 'adapter'); $adapter = Solar::factory($adapter_type); try { $adapter->connect(); } catch (Exception $e) { // Display No DB Connection view and exit. $this->connect = false; $view = Solar::factory('Solar_View', array('template_path' => dirname(__FILE__) . '/Base/View/')); $view->assign('adapter_config', Solar_Config::get($adapter_type)); echo $view->fetch('nodb'); exit; } $this->_adapter = $adapter; $this->_model = Solar_Registry::get('model_catalog'); // Set Cache $cache_settings = Solar_Config::get('Foresmo', 'cache'); if (isset($cache_settings['adapter'])) { $this->_model->_config['cache'] = $cache_settings; $this->_cache = Solar::factory('Solar_Cache', $cache_settings); } $this->_setBlogOptions(); $this->page_title = $this->blog_title; $time_info = Foresmo::getTimeInfo(); Foresmo::$date_format = $time_info['blog_date_format']; Foresmo::$timezone = $time_info['blog_timezone']; $this->_model->posts->published_posts_count = $this->_model->posts->fetchPublishedPostsCount(); $this->_setPagesCount($this->_model->posts->posts_per_page, $this->_model->posts->published_posts_count); //$this->_layout_default = $this->blog_theme; // Load Themes $this->_themes = Solar::factory('Foresmo_Themes', array('model' => $this->_model)); // Load Modules $this->_modules = Solar::factory('Foresmo_Modules', array('model' => $this->_model)); $this->_modules->registerModuleHooks(); $this->enabled_modules = $this->_modules->getEnabledModulesData(); }
/** * * Sets the config values for a class and key. * * @param string $class The name of the class. * * @param string $key The name of the key for the class; if empty, will * apply the changes to the entire class array. * * @param mixed $val The value to set for the class and key. * * @return void * */ public static function set($class, $key, $val) { if (!$key) { Solar_Config::$_store[$class] = $val; } else { Solar_Config::$_store[$class][$key] = $val; } // Invalidate the build cache; this can make set a rather expensive method to call Solar_Config::$_build = array(); }
/** * * Builds and returns the default config for a class, including all * configs inherited from its parents. * * @param string $class The class to get the config build for. * * @return array The config build for the class. * */ protected function _buildConfig($class) { if (!$class) { return array(); } $config = Solar_Config::getBuild($class); if ($config === null) { $var = "_{$class}"; $prop = empty($this->{$var}) ? array() : (array) $this->{$var}; $parent = get_parent_class($class); $config = array_merge($this->_buildConfig($parent), $prop, Solar_Config::get($class, null, array())); // cache for future reference Solar_Config::setBuild($class, $config); } return $config; }
/** * ajax_blog_install * This ajax action handles blog installation * * @param $post_data * @return string */ public function ajax_blog_install($post_data) { if ($this->installed) { return 'Blog is already installed!'; } if (!empty($post_data['db_type'])) { $db_type = ucfirst($post_data['db_type']); $adapter = 'Solar_Sql_Adapter_' . $db_type; } else { return 'DB Type cannot be blank!'; } Solar_Config::set('Solar_Sql', 'adapter', $adapter); Solar_Config::set($adapter, 'host', $post_data['db_host']); Solar_Config::set($adapter, 'user', $post_data['db_username']); Solar_Config::set($adapter, 'pass', $post_data['db_password']); Solar_Config::set($adapter, 'name', $post_data['db_name']); Solar_Config::set($adapter, 'prefix', $post_data['db_prefix']); $adapter = Solar::factory($adapter); try { $adapter->connect(); } catch (Exception $e) { return 'Cannot connect to database! Please ensure valid DB info.'; } $this->random_str = Foresmo::randomString(18); $config_file = Solar::$system . '/config/Solar.config.php'; $config_content = $this->_getConfigContent($post_data); if (($handle = @fopen($config_file, 'w')) !== false) { if (@fwrite($handle, $config_content) === false) { fclose($handle); return "Cannot write to: {$config_file}. Please set the permissions to 777 for this file."; } else { fclose($handle); } } else { return "Could not open {$config_file}, please ensure that this file exists and is writable."; } $schema = Solar::$system . '/source/foresmo/Foresmo/Schemas/' . $db_type . '.php'; $schema_sql = Solar_File::load($schema); $schema_sql = str_replace('[prefix]', $post_data['db_prefix'], $schema_sql); try { $adapter->query($schema_sql); } catch (Exception $e) { // tables already exist? } $errors = array(); $matches = array(); $ret_str = ''; $post_data['blog_user'] = trim($post_data['blog_user']); if (empty($post_data['blog_password']) == true || empty($post_data['blog_password2']) == true || empty($post_data['blog_user']) == true || empty($post_data['blog_title']) == true || empty($post_data['blog_email']) == true) { $errors[] = 'No fields should be left blank!'; } preg_match('/^([.0-9a-z_-]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,4})$/i', $post_data['blog_email'], $matches); if (count($matches) == 0) { $errors[] = 'Not a valid email address.'; } if (strlen($post_data['blog_password']) < 7) { $errors[] = 'The user password must be seven characters or more'; } if ($post_data['blog_password'] !== $post_data['blog_password2']) { $errors[] = 'The user password fields did not match!'; } if (count($errors) > 0) { $ret_str .= '<p class="error"><b>Validation Errors:</b></p>'; foreach ($errors as $error) { $ret_str .= '<span class="error">' . $error . '</span><br />'; } return $ret_str; } $username = $post_data['blog_user']; $password = $post_data['blog_password']; $password = md5($this->random_str . $password); $email = trim($post_data['blog_email']); $table = $post_data['db_prefix'] . 'groups'; $data = array('name' => 'Admin'); $adapter->insert($table, $data); $last_insert_id = $adapter->lastInsertId($table, 'id'); $permissions = array(); $table = $post_data['db_prefix'] . 'permissions'; $data = array('name' => 'create_post'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'edit_post'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'delete_post'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'create_page'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'edit_page'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'delete_page'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $table = $post_data['db_prefix'] . 'groups_permissions'; foreach ($permissions as $permission) { $data = array('group_id' => $last_insert_id, 'permission_id' => (int) $permission); $adapter->insert($table, $data); } $table = $post_data['db_prefix'] . 'users'; $data = array('group_id' => $last_insert_id, 'username' => $username, 'password' => $password, 'email' => strtolower($email)); $adapter->insert($table, $data); $table = $post_data['db_prefix'] . 'options'; $data = array('name' => 'blog_installed', 'type' => 1, 'value' => time()); $adapter->insert($table, $data); $data = array('name' => 'blog_theme', 'type' => 0, 'value' => 'default'); $adapter->insert($table, $data); $data = array('name' => 'blog_title', 'type' => 0, 'value' => $post_data['blog_title']); $adapter->insert($table, $data); $data = array('name' => 'blog_date_format', 'type' => 0, 'value' => 'F j, Y, g:ia'); $adapter->insert($table, $data); $data = array('name' => 'blog_timezone', 'type' => 0, 'value' => '-4:00'); $adapter->insert($table, $data); $data = array('name' => 'blog_posts_per_page', 'type' => 0, 'value' => 10); $adapter->insert($table, $data); $data = array('name' => 'blog_comment_link_limit', 'type' => 0, 'value' => 3); $adapter->insert($table, $data); $table = $post_data['db_prefix'] . 'posts'; $data = array('slug' => 'my-first-post', 'content_type' => 1, 'title' => 'My first post!', 'content' => "Welcome to {$post_data['blog_title']}. Look forward to new blog posts soon!", 'user_id' => 1, 'status' => 1, 'pubdate' => time(), 'modified' => time()); $adapter->insert($table, $data); $table = $post_data['db_prefix'] . 'comments'; $data = array('post_id' => 1, 'name' => 'Foresmo', 'email' => '*****@*****.**', 'url' => 'http://foresmo.com', 'ip' => sprintf("%u", ip2long('192.168.0.1')), 'content' => 'Congratulations!', 'status' => 1, 'date' => time(), 'type' => 0); $adapter->insert($table, $data); $table = $post_data['db_prefix'] . 'tags'; $data = array('tag' => 'Foresmo', 'tag_slug' => 'foresmo'); $adapter->insert($table, $data); $table = $post_data['db_prefix'] . 'posts_tags'; $data = array('post_id' => 1, 'tag_id' => 1); $adapter->insert($table, $data); $table = $post_data['db_prefix'] . 'modules'; $data = array('name' => 'Pages', 'enabled' => 1); $adapter->insert($table, $data); $data = array('name' => 'Search', 'enabled' => 1); $adapter->insert($table, $data); $data = array('name' => 'Calendar', 'enabled' => 1); $adapter->insert($table, $data); $data = array('name' => 'Tags', 'enabled' => 1); $adapter->insert($table, $data); $data = array('name' => 'Links', 'enabled' => 1); $adapter->insert($table, $data); $data = array('name' => 'Archives', 'enabled' => 1); $adapter->insert($table, $data); $data = array('name' => 'Flickr', 'enabled' => 0); $adapter->insert($table, $data); $data = array('name' => 'Twitter', 'enabled' => 0); $adapter->insert($table, $data); $data = array('name' => 'Sections', 'enabled' => 0); $adapter->insert($table, $data); $table = $post_data['db_prefix'] . 'module_info'; $data = array('module_id' => 3, 'name' => 'start_of_week', 'type' => 0, 'value' => 0); $adapter->insert($table, $data); if ($db_type == 'Mysql') { $data = array('module_id' => 2, 'name' => 'search_adapter', 'type' => 0, 'value' => 'mysql'); } else { $data = array('module_id' => 2, 'name' => 'search_adapter', 'type' => 0, 'value' => 'default'); } $adapter->insert($table, $data); $data = array('module_id' => 2, 'name' => 'search_adapter_settings', 'type' => 0, 'value' => 'a:5:{s:7:"Default";a:0:{}s:6:"Google";a:0:{}s:5:"Mysql";a:0:{}s:6:"Lucene";a:0:{}s:5:"Sphinx";a:0:{}}'); $adapter->insert($table, $data); return 'Foresmo installed! Click <a href="/">here</a> to check it out! Also, don\'t forget to change the permissions of the config back to read only.'; }
/** * _setup * * Set variables used throughout the app here. */ protected function _setup() { if (Solar_Config::get('Foresmo', 'dev')) { xdebug_start_trace('/var/www/foresmo/tmp/trace'); } if (!isset($this->session)) { $this->session = Solar::factory('Solar_Session', array('class' => 'Foresmo_App')); } $adapter = Solar_Config::get('Solar_Sql', 'adapter'); $adapter = Solar::factory($adapter); try { $adapter->connect(); } catch (Exception $e) { $this->connect = false; // should display an error page and die. } if ($this->connect) { $this->_adapter = $adapter; $this->installed = (bool) Solar_Config::get('Foresmo', 'installed'); if (!$this->installed && $this->_controller != 'install') { $this->_redirect('/install'); } $this->web_root = Solar::$system . '/content/'; $this->_model = Solar_Registry::get('model_catalog'); $cache_settings = Solar_Config::get('Foresmo', 'cache'); if (isset($cache_settings['adapter'])) { $this->_model->_config['cache'] = $cache_settings; $this->_cache = Solar::factory('Solar_Cache', $cache_settings); } $results = $this->_model->options->fetchBlogOptions(); foreach ($results as $result) { switch ($result['name']) { case 'blog_theme': $this->blog_theme = $result['value']; break; case 'blog_admin_theme': $this->blog_admin_theme = $result['value']; break; case 'blog_theme_options': $this->blog_theme_options = unserialize($result['value']); break; case 'blog_admin_theme_options': $this->blog_admin_theme_options = unserialize($result['value']); break; case 'blog_title': $this->blog_title = $result['value']; break; case 'blog_posts_per_page': $this->_model->posts->posts_per_page = (int) $result['value']; break; case 'blog_comment_link_limit': $this->_model->comments->link_count_limit = (int) $result['value']; break; } } $this->page_title = $this->blog_title; $time_info = Foresmo::getTimeInfo(); Foresmo::$date_format = $time_info['blog_date_format']; Foresmo::$timezone = $time_info['blog_timezone']; $this->_model->posts->published_posts_count = $this->_model->posts->fetchPublishedPostsCount(); $this->_setPagesCount(); $this->_layout_default = $this->blog_theme; $this->_setToken(); $this->_modules = Solar::factory('Foresmo_Modules', array('model' => $this->_model)); $this->enabled_modules_data = $this->_modules->getEnabledModulesData(); $this->_registerModuleHooks(); } }
/** * _install * Install a new blog */ public function _install() { $this->_post = $this->_request->post(); if ($this->installed) { $this->error = 'Blog is already installed'; $this->message = 'Blog is already installed'; $this->success = false; return; } if (!empty($this->_post['db_type'])) { $db_type = ucfirst($this->_post['db_type']); $adapter = 'Solar_Sql_Adapter_' . $db_type; } else { $this->error = 'DB Type cannot be blank'; $this->message = 'DB Type cannot be blank'; $this->success = false; return; } Solar_Config::set('Solar_Sql', 'adapter', $adapter); Solar_Config::set($adapter, 'host', $this->_post['db_host']); Solar_Config::set($adapter, 'user', $this->_post['db_username']); Solar_Config::set($adapter, 'pass', $this->_post['db_password']); Solar_Config::set($adapter, 'name', $this->_post['db_name']); Solar_Config::set($adapter, 'prefix', $this->_post['db_prefix']); $adapter = Solar::factory($adapter); try { $adapter->connect(); } catch (Exception $e) { $this->error = $e->getMessage(); $this->message = 'Cannot connect to database! Please ensure valid DB info.'; $this->success = false; return; } $config_file = Solar::$system . '/source/foresmo/config/default.php'; $config_content = $this->_getConfigContent(); if (($handle = @fopen($config_file, 'w')) !== false) { if (@fwrite($handle, $config_content) === false) { fclose($handle); $this->error = "Cannot write to: {$config_file}. Please set the permissions to 777 for this file."; $this->message = "Cannot write to: {$config_file}. Please set the permissions to 777 for this file."; $this->success = false; return; } else { fclose($handle); } } else { $this->error = "Could not open {$config_file}, please ensure that this file exists and is writable by the server."; $this->message = "Could not open {$config_file}, please ensure that this file exists and is writable by the server."; $this->success = false; return; } $schema = Solar::$system . '/source/foresmo/Foresmo/Schemas/' . $db_type . '.php'; $schema_sql = Solar_File::load($schema); $schema_sql = str_replace('[prefix]', $this->_post['db_prefix'], $schema_sql); try { $adapter->query($schema_sql); } catch (Exception $e) { // tables already exist? $this->error = $e->getMessage(); $this->message = 'Error creating database tables, do they already exist?'; $this->success = false; return; } $errors = array(); $matches = array(); $ret_str = ''; $this->_post['blog_user'] = trim($this->_post['blog_user']); if (empty($this->_post['blog_password']) == true || empty($this->_post['blog_password2']) == true || empty($this->_post['blog_user']) == true || empty($this->_post['blog_title']) == true || empty($this->_post['blog_email']) == true) { $errors[] = 'No fields should be left blank!'; } preg_match('/^([.0-9a-z_-]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,4})$/i', $this->_post['blog_email'], $matches); if (count($matches) == 0) { $errors[] = 'Not a valid email address.'; } if (strlen($this->_post['blog_password']) < 7) { $errors[] = 'The user password must be seven characters or more'; } if ($this->_post['blog_password'] !== $this->_post['blog_password2']) { $errors[] = 'The user password fields did not match!'; } if (count($errors) > 0) { $ret_str .= '<p class="error"><b>Validation Errors:</b></p>'; foreach ($errors as $error) { $ret_str .= '<span class="error">' . $error . '</span><br />'; } $this->error = $ret_str; $this->message = $ret_str; $this->success = false; return; } $username = $this->_post['blog_user']; $password = $this->_post['blog_password']; $hasher = new Foresmo_Hashing(8, false); $pwhash = $hasher->hashPassword($password); $email = trim($this->_post['blog_email']); $table = $this->_post['db_prefix'] . 'groups'; $data = array('name' => 'Admin'); $adapter->insert($table, $data); $last_insert_id = $adapter->lastInsertId($table, 'id'); $permissions = array(); $table = $this->_post['db_prefix'] . 'permissions'; $data = array('name' => 'create_post'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'edit_post'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'delete_post'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'create_page'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'edit_page'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'delete_page'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'manage_modules'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'blog_settings'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $data = array('name' => 'manage_themes'); $adapter->insert($table, $data); $permissions[] = $adapter->lastInsertId($table, 'id'); $table = $this->_post['db_prefix'] . 'groups_permissions'; foreach ($permissions as $permission) { $data = array('group_id' => $last_insert_id, 'permission_id' => (int) $permission); $adapter->insert($table, $data); } $table = $this->_post['db_prefix'] . 'users'; $data = array('group_id' => $last_insert_id, 'username' => $username, 'password' => $pwhash, 'email' => strtolower($email)); $adapter->insert($table, $data); $table = $this->_post['db_prefix'] . 'options'; $data = array('name' => 'blog_installed', 'type' => 1, 'value' => time()); $adapter->insert($table, $data); $data = array('name' => 'blog_theme', 'type' => 0, 'value' => 'default'); $adapter->insert($table, $data); $data = array('name' => 'blog_admin_theme', 'type' => 0, 'value' => 'default'); $adapter->insert($table, $data); $data = array('name' => 'blog_admin_theme_options', 'type' => 0, 'value' => serialize(array())); $adapter->insert($table, $data); $data = array('name' => 'blog_theme_options', 'type' => 0, 'value' => serialize(array())); $adapter->insert($table, $data); $data = array('name' => 'blog_title', 'type' => 0, 'value' => $this->_post['blog_title']); $adapter->insert($table, $data); $data = array('name' => 'blog_date_format', 'type' => 0, 'value' => 'F j, Y, g:ia'); $adapter->insert($table, $data); $data = array('name' => 'blog_timezone', 'type' => 0, 'value' => 'America/New_York'); $adapter->insert($table, $data); $data = array('name' => 'blog_posts_per_page', 'type' => 0, 'value' => 10); $adapter->insert($table, $data); $data = array('name' => 'blog_uid', 'type' => 0, 'value' => sha1($_SERVER['HTTP_HOST'] . substr(md5(uniqid(mt_rand(), TRUE)), 0, 12))); $adapter->insert($table, $data); $data = array('name' => 'blog_comment_link_limit', 'type' => 0, 'value' => 3); $adapter->insert($table, $data); $data = array('name' => 'blog_comment_default_status', 'type' => 0, 'value' => 3); $adapter->insert($table, $data); $table = $this->_post['db_prefix'] . 'posts'; $data = array('slug' => 'my-first-post', 'content_type' => 1, 'title' => 'My first post!', 'content' => "Welcome to {$this->_post['blog_title']}. Look forward to new blog posts soon!", 'excerpt' => "Welcome to {$this->_post['blog_title']}. Look forward to new blog posts soon!", 'user_id' => 1, 'status' => 1, 'pubdate' => time(), 'modified' => time()); $adapter->insert($table, $data); $table = $this->_post['db_prefix'] . 'comments'; $data = array('post_id' => 1, 'name' => 'Foresmo', 'email' => '*****@*****.**', 'url' => 'http://foresmo.com', 'ip' => sprintf("%u", ip2long('192.168.0.1')), 'content' => 'Congratulations!', 'status' => 1, 'date' => time(), 'type' => 0); $adapter->insert($table, $data); $table = $this->_post['db_prefix'] . 'tags'; $data = array('tag' => 'Foresmo', 'tag_slug' => 'foresmo'); $adapter->insert($table, $data); $table = $this->_post['db_prefix'] . 'posts_tags'; $data = array('post_id' => 1, 'tag_id' => 1); $adapter->insert($table, $data); $this->success = true; $this->message = 'Foresmo installed! Click <a href="/">here</a> to check it out! Also, don\'t forget to change the permissions of the config back to read only.'; }