]> git.mxchange.org Git - friendica.git/commitdiff
put in config framework for auto-update ability, plugins, etc.
authorMike Macgirvin <mike@macgirvin.com>
Sun, 15 Aug 2010 01:11:36 +0000 (18:11 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Sun, 15 Aug 2010 01:11:36 +0000 (18:11 -0700)
boot.php
database.sql
index.php

index c99024d0093324552268bdba1ead6cbd9141712e..95c0351f8d689e22635c888a31371eafb863f5c2 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2,11 +2,13 @@
 
 set_time_limit(0);
 
-define('EOL', "<br />\r\n");
+define ( 'BUILD_ID' , 1000 );
 
-define('REGISTER_CLOSED',  0);
-define('REGISTER_APPROVE', 1);
-define('REGISTER_OPEN',    2);
+define ( 'EOL', "<br />\r\n");
+
+define ( 'REGISTER_CLOSED',  0);
+define ( 'REGISTER_APPROVE', 1);
+define ( 'REGISTER_OPEN',    2);
 
 define ( 'DIRECTION_ANY',  0);
 define ( 'DIRECTION_IN',   1);
@@ -162,6 +164,25 @@ function system_unavailable() {
        killme();
 }}
 
+
+if(! function_exists('check_config')) {
+function check_config(&$a) {
+       $r = q("SELECT * FROM `config` WHERE `cat` = 'system' AND `k` IN ('url','build')");
+       if(! count($r)) {
+               q("INSERT INTO `config` (`cat`,`k`,`v`) VALUES ( 'system', 'url', '%s' )",
+                       dbesc($a->get_baseurl())
+               );
+               q("INSERT INTO `config` (`cat`,`k`,`v`) VALUES ( 'system', 'build', '%s' )",
+                       dbesc(BUILD_ID)
+               );
+       }
+
+
+
+}}
+
+
+
 if(! function_exists('replace_macros')) {  
 function replace_macros($s,$r) {
 
index f0cb98c7a186125786392515af1cceb93c54fd2f..a359cc8424cf4f5fc1b6e953787dbd34cfae291b 100644 (file)
@@ -32,6 +32,17 @@ CREATE TABLE IF NOT EXISTS `challenge` (
 
 -- --------------------------------------------------------
 
+CREATE TABLE IF NOT EXISTS `config` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `cat` char(255) NOT NULL,
+  `k` char(255) NOT NULL,
+  `v` text NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MYISAM DEFAULT CHARSET=utf8;
+
+
+
+
 --
 -- Table structure for table `contact`
 --
index 2353355f0cb0717c16eafd2c181d934bcbd89ede..ba08a9103a364f12fb647717a5482905cd575105 100644 (file)
--- a/index.php
+++ b/index.php
@@ -29,6 +29,8 @@ if((x($_SESSION,'authenticated')) || (x($_POST['auth-params'])))
 
 if($install)
        $a->module = 'install';
+else
+       check_config($a);
 
 if(strlen($a->module)) {
        if(file_exists("mod/{$a->module}.php")) {