installer changes, pe sync
This commit is contained in:
parent
7294a3aab1
commit
35e29e10e6
2
boot.php
2
boot.php
|
@ -43,10 +43,10 @@ class App {
|
||||||
public $module;
|
public $module;
|
||||||
public $pager;
|
public $pager;
|
||||||
public $strings;
|
public $strings;
|
||||||
|
public $path;
|
||||||
|
|
||||||
private $scheme;
|
private $scheme;
|
||||||
private $hostname;
|
private $hostname;
|
||||||
private $path;
|
|
||||||
private $baseurl;
|
private $baseurl;
|
||||||
private $db;
|
private $db;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ if((x($_SESSION,'authenticated')) && (! ($_POST['auth-params'] == 'login'))) {
|
||||||
unset($_SESSION['is_visitor']);
|
unset($_SESSION['is_visitor']);
|
||||||
unset($_SESSION['administrator']);
|
unset($_SESSION['administrator']);
|
||||||
unset($_SESSION['cid']);
|
unset($_SESSION['cid']);
|
||||||
$_SESSION['sysmsg'] = t("Logged out.") . EOL;
|
notice( t('Logged out.') . EOL);
|
||||||
goaway($a->get_baseurl());
|
goaway($a->get_baseurl());
|
||||||
}
|
}
|
||||||
if(x($_SESSION,'uid')) {
|
if(x($_SESSION,'uid')) {
|
||||||
|
@ -50,7 +50,7 @@ else {
|
||||||
dbesc(trim($_POST['login-name'])),
|
dbesc(trim($_POST['login-name'])),
|
||||||
dbesc($encrypted));
|
dbesc($encrypted));
|
||||||
if(($r === false) || (! count($r))) {
|
if(($r === false) || (! count($r))) {
|
||||||
$_SESSION['sysmsg'] = t('Login failed.') . EOL ;
|
notice( t('Login failed.') . EOL );
|
||||||
goaway($a->get_baseurl());
|
goaway($a->get_baseurl());
|
||||||
}
|
}
|
||||||
$_SESSION['uid'] = $r[0]['uid'];
|
$_SESSION['uid'] = $r[0]['uid'];
|
||||||
|
@ -58,7 +58,7 @@ else {
|
||||||
$_SESSION['authenticated'] = 1;
|
$_SESSION['authenticated'] = 1;
|
||||||
$_SESSION['my_url'] = $a->get_baseurl() . '/profile/' . $r[0]['nickname'];
|
$_SESSION['my_url'] = $a->get_baseurl() . '/profile/' . $r[0]['nickname'];
|
||||||
|
|
||||||
$_SESSION['sysmsg'] = t("Welcome back ") . $r[0]['username'] . EOL;
|
notice( t("Welcome back ") . $r[0]['username'] . EOL);
|
||||||
$a->user = $r[0];
|
$a->user = $r[0];
|
||||||
if(strlen($a->user['timezone']))
|
if(strlen($a->user['timezone']))
|
||||||
date_default_timezone_set($a->user['timezone']);
|
date_default_timezone_set($a->user['timezone']);
|
||||||
|
|
|
@ -8,8 +8,8 @@ function timezone_cmp($a, $b) {
|
||||||
}
|
}
|
||||||
if(strstr($a,'/')) return -1;
|
if(strstr($a,'/')) return -1;
|
||||||
if(strstr($b,'/')) return 1;
|
if(strstr($b,'/')) return 1;
|
||||||
if ($a == $b) return 0;
|
if ( t($a) == t($b)) return 0;
|
||||||
return ($a < $b) ? -1 : 1;
|
return ( t($a) < t($b)) ? -1 : 1;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ function select_timezone($current = 'America/Los_Angeles') {
|
||||||
if($continent != '')
|
if($continent != '')
|
||||||
$o .= '</optgroup>';
|
$o .= '</optgroup>';
|
||||||
$continent = $ex[0];
|
$continent = $ex[0];
|
||||||
$o .= "<optgroup label=\"$continent\">";
|
$o .= '<optgroup label="' . t($continent) . '">';
|
||||||
}
|
}
|
||||||
if(count($ex) > 2)
|
if(count($ex) > 2)
|
||||||
$city = substr($value,strpos($value,'/')+1);
|
$city = substr($value,strpos($value,'/')+1);
|
||||||
|
@ -41,10 +41,10 @@ function select_timezone($current = 'America/Los_Angeles') {
|
||||||
if($continent != 'Miscellaneous') {
|
if($continent != 'Miscellaneous') {
|
||||||
$o .= '</optgroup>';
|
$o .= '</optgroup>';
|
||||||
$continent = 'Miscellaneous';
|
$continent = 'Miscellaneous';
|
||||||
$o .= "<optgroup label=\"$continent\">";
|
$o .= '<optgroup label="' . t($continent) . '">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$city = str_replace('_', ' ', $city);
|
$city = str_replace('_', ' ', t($city));
|
||||||
$selected = (($value == $current) ? " selected=\"selected\" " : "");
|
$selected = (($value == $current) ? " selected=\"selected\" " : "");
|
||||||
$o .= "<option value=\"$value\" $selected >$city</option>";
|
$o .= "<option value=\"$value\" $selected >$city</option>";
|
||||||
}
|
}
|
||||||
|
@ -101,56 +101,36 @@ function datesel($pre,$ymin,$ymax,$allow_blank,$y,$m,$d) {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
// TODO rewrite this buggy sucker
|
if(! function_exists('relative_date')) {
|
||||||
function relative_date($posted_date) {
|
function relative_date($posted_date) {
|
||||||
|
|
||||||
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
|
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
|
||||||
|
|
||||||
$in_seconds = strtotime($localtime);
|
$abs = strtotime($localtime);
|
||||||
|
$etime = time() - $abs;
|
||||||
|
|
||||||
$diff = time() - $in_seconds;
|
if ($etime < 1) {
|
||||||
|
return t('less than a second ago');
|
||||||
|
}
|
||||||
|
|
||||||
$months = floor($diff/2592000);
|
$a = array( 12 * 30 * 24 * 60 * 60 => array( t('year'), t('years')),
|
||||||
$diff -= $months*2419200;
|
30 * 24 * 60 * 60 => array( t('month'), t('months')),
|
||||||
$weeks = floor($diff/604800);
|
7 * 24 * 60 * 60 => array( t('week'), t('weeks')),
|
||||||
$diff -= $weeks*604800;
|
24 * 60 * 60 => array( t('day'), t('days')),
|
||||||
$days = floor($diff/86400);
|
60 * 60 => array( t('hour'), t('hours')),
|
||||||
$diff -= $days*86400;
|
60 => array( t('minute'), t('minutes')),
|
||||||
$hours = floor($diff/3600);
|
1 => array( t('second'), t('seconds'))
|
||||||
$diff -= $hours*3600;
|
);
|
||||||
$minutes = floor($diff/60);
|
|
||||||
$diff -= $minutes*60;
|
|
||||||
$seconds = $diff;
|
|
||||||
|
|
||||||
if($months > 2)
|
foreach ($a as $secs => $str) {
|
||||||
return(datetime_convert('UTC',date_default_timezone_get(),$posted_date,'\o\n Y-m-d \a\t H:i:s'));
|
$d = $etime / $secs;
|
||||||
if ($months>0) {
|
if ($d >= 1) {
|
||||||
// over a month old,
|
$r = round($d);
|
||||||
return 'over a month ago';
|
return $r . ' ' . (($r == 1) ? $str[0] : $str[1]) . t(' ago');
|
||||||
} else {
|
|
||||||
if ($weeks>0) {
|
|
||||||
// weeks and days
|
|
||||||
$relative_date .= ($relative_date?', ':'').$weeks.' week'.($weeks!=1 ?'s':'');
|
|
||||||
|
|
||||||
} elseif ($days>0) {
|
|
||||||
// days and hours
|
|
||||||
$relative_date .= ($relative_date?', ':'').$days.' day'.($days!=1?'s':'');
|
|
||||||
|
|
||||||
} elseif ($hours>0) {
|
|
||||||
// hours and minutes
|
|
||||||
$relative_date .= ($relative_date?', ':'').$hours.' hour'.($hours!=1?'s':'');
|
|
||||||
|
|
||||||
} elseif ($minutes>0) {
|
|
||||||
// minutes only
|
|
||||||
$relative_date .= ($relative_date?', ':'').$minutes.' minute'.($minutes!=1?'s':'');
|
|
||||||
} else {
|
|
||||||
// seconds only
|
|
||||||
$relative_date .= ($relative_date?', ':'').$seconds.' second'.($seconds!=1?'s':'');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// show relative date and add proper verbiage
|
}}
|
||||||
return $relative_date.' ago';
|
|
||||||
}
|
|
||||||
|
|
||||||
function age($dob,$owner_tz = '',$viewer_tz = '') {
|
function age($dob,$owner_tz = '',$viewer_tz = '') {
|
||||||
if(! intval($dob))
|
if(! intval($dob))
|
||||||
|
|
|
@ -20,6 +20,10 @@ class dba {
|
||||||
system_unavailable();
|
system_unavailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getdb() {
|
||||||
|
return $this->db;
|
||||||
|
}
|
||||||
|
|
||||||
public function q($sql) {
|
public function q($sql) {
|
||||||
global $debug_text;
|
global $debug_text;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,9 @@ require_once("dba.php");
|
||||||
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
|
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
|
|
||||||
|
if(! $install)
|
||||||
require_once("session.php");
|
require_once("session.php");
|
||||||
|
|
||||||
require_once("datetime.php");
|
require_once("datetime.php");
|
||||||
|
|
||||||
date_default_timezone_set(($default_timezone) ? $default_timezone : 'UTC');
|
date_default_timezone_set(($default_timezone) ? $default_timezone : 'UTC');
|
||||||
|
@ -101,6 +103,7 @@ $a->page['content'] .= $debug_text;
|
||||||
// build page
|
// build page
|
||||||
|
|
||||||
// Navigation (menu) template
|
// Navigation (menu) template
|
||||||
|
if($a->module != 'install')
|
||||||
require_once("nav.php");
|
require_once("nav.php");
|
||||||
|
|
||||||
$page = $a->page;
|
$page = $a->page;
|
||||||
|
|
|
@ -170,8 +170,9 @@ function dfrn_notify_post(&$a) {
|
||||||
);
|
);
|
||||||
|
|
||||||
$url = $a->get_baseurl();
|
$url = $a->get_baseurl();
|
||||||
|
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
|
|
||||||
proc_close(proc_open("php include/notifier.php $url comment-import $posted_id > remote-notify.log &",
|
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$url\" \"comment-import\" \"$posted_id\" &",
|
||||||
array(),$foo));
|
array(),$foo));
|
||||||
|
|
||||||
if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
|
if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ function dfrn_poll_init(&$a) {
|
||||||
if((int) $xml->status == 1) {
|
if((int) $xml->status == 1) {
|
||||||
$_SESSION['authenticated'] = 1;
|
$_SESSION['authenticated'] = 1;
|
||||||
$_SESSION['visitor_id'] = $r[0]['id'];
|
$_SESSION['visitor_id'] = $r[0]['id'];
|
||||||
$_SESSION['sysmsg'] .= "Hi {$r[0]['name']}" . EOL;
|
notice( t('Hi ') . $r[0]['name'] . EOL);
|
||||||
// Visitors get 1 day session.
|
// Visitors get 1 day session.
|
||||||
$session_id = session_id();
|
$session_id = session_id();
|
||||||
$expire = time() + 86400;
|
$expire = time() + 86400;
|
||||||
|
|
153
mod/install.php
Normal file
153
mod/install.php
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
function install_post(&$a) {
|
||||||
|
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$dbhost = notags(trim($_POST['dbhost']));
|
||||||
|
$dbuser = notags(trim($_POST['dbuser']));
|
||||||
|
$dbpass = notags(trim($_POST['dbpass']));
|
||||||
|
$dbdata = notags(trim($_POST['dbdata']));
|
||||||
|
$timezone = notags(trim($_POST['timezone']));
|
||||||
|
$phpath = notags(trim($_POST['phpath']));
|
||||||
|
|
||||||
|
require_once("dba.php");
|
||||||
|
|
||||||
|
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true);
|
||||||
|
|
||||||
|
if(! $db->getdb()) {
|
||||||
|
notice( t('Could not connect to database.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
notice( t('Connected to database.') . EOL);
|
||||||
|
|
||||||
|
$tpl = file_get_contents('view/htconfig.tpl');
|
||||||
|
$txt = replace_macros($tpl,array(
|
||||||
|
'$dbhost' => $dbhost,
|
||||||
|
'$dbuser' => $dbuser,
|
||||||
|
'$dbpass' => $dbpass,
|
||||||
|
'$dbdata' => $dbdata,
|
||||||
|
'$timezone' => $timezone,
|
||||||
|
'$phpath' => $phpath
|
||||||
|
));
|
||||||
|
$result = file_put_contents('.htconfig.php', $txt);
|
||||||
|
if(! $result) {
|
||||||
|
$a->data = $txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
$errors = load_database($db);
|
||||||
|
if(! $errors) {
|
||||||
|
// Our sessions normally are stored in the database. But as we have only managed
|
||||||
|
// to get it bootstrapped milliseconds ago, we have to apply a bit of trickery so
|
||||||
|
// that you'll see the following important notice (which is stored in the session).
|
||||||
|
|
||||||
|
session_write_close();
|
||||||
|
require_once('session.php');
|
||||||
|
session_start();
|
||||||
|
$_SESSION['sysmsg'] = '';
|
||||||
|
|
||||||
|
notice( t('Database import succeeded.') . EOL
|
||||||
|
. t('IMPORTANT: You will need to (manually) setup a scheduled task for the poller.') . EOL
|
||||||
|
. t('Please see the file INSTALL.') . EOL );
|
||||||
|
goaway($a->get_baseurl());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$db = null; // start fresh
|
||||||
|
notice( t('Database import failed.') . EOL
|
||||||
|
. t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL
|
||||||
|
. t('Please see the file INSTALL.') . EOL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function install_content(&$a) {
|
||||||
|
|
||||||
|
notice( t('Welcome to the Mistpark Social Network.') . EOL);
|
||||||
|
|
||||||
|
$o .= check_htconfig();
|
||||||
|
if(strlen($o))
|
||||||
|
return $o;
|
||||||
|
|
||||||
|
if(strlen($a->data)) {
|
||||||
|
$o .= manual_config($a);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$o .= check_php($phpath);
|
||||||
|
|
||||||
|
require_once('datetime.php');
|
||||||
|
|
||||||
|
$tpl = file_get_contents('view/install_db.tpl');
|
||||||
|
$o .= replace_macros($tpl, array(
|
||||||
|
'$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()),
|
||||||
|
'$submit' => t('Submit'),
|
||||||
|
'$dbhost' => ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost'),
|
||||||
|
'$dbuser' => notags(trim($_POST['dbuser'])),
|
||||||
|
'$dbpass' => notags(trim($_POST['dbpass'])),
|
||||||
|
'$dbdata' => notags(trim($_POST['dbdata'])),
|
||||||
|
'$phpath' => $phpath
|
||||||
|
));
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_php(&$phpath) {
|
||||||
|
$phpath = trim(shell_exec('which php'));
|
||||||
|
if(! strlen($phpath)) {
|
||||||
|
$o .= <<< EOT
|
||||||
|
Could not find a command line version of PHP in the web server PATH. This is required. Please adjust the configuration file .htconfig.php accordingly.
|
||||||
|
|
||||||
|
EOT;
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_htconfig() {
|
||||||
|
|
||||||
|
if(((file_exists('.htconfig.php')) && (! is_writable('.htconfig.php')))
|
||||||
|
|| (! is_writable('.'))) {
|
||||||
|
|
||||||
|
$o .= <<< EOT
|
||||||
|
|
||||||
|
The web installer needs to be able to create a file called ".htconfig.php" in the top folder of
|
||||||
|
your web server. It is unable to do so. This is most often a permission setting, as the web server
|
||||||
|
may not be able to write files in your folder (even if you can).
|
||||||
|
|
||||||
|
Please check with your site documentation or support people to see if this situation can be corrected.
|
||||||
|
If not, you may be required to perform a manual installation. Please see the file "INSTALL" for instructions.
|
||||||
|
|
||||||
|
EOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function manual_config(&$a) {
|
||||||
|
$o .= <<< EOT
|
||||||
|
The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.
|
||||||
|
|
||||||
|
<textarea rows="24" cols="80" >{$a->data}</textarea>
|
||||||
|
EOT;
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function load_database($db) {
|
||||||
|
|
||||||
|
$str = file_get_contents('database.sql');
|
||||||
|
$arr = explode(';',$str);
|
||||||
|
$errors = 0;
|
||||||
|
foreach($arr as $a) {
|
||||||
|
if(strlen(trim($a))) {
|
||||||
|
$r = @$db->q(trim($a));
|
||||||
|
if(! $r) {
|
||||||
|
notice( t('Errors encountered creating database tables.') . $a . EOL);
|
||||||
|
$errors ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $errors;
|
||||||
|
}
|
|
@ -239,8 +239,9 @@ function item_post(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$url = $a->get_baseurl();
|
$url = $a->get_baseurl();
|
||||||
|
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
|
|
||||||
proc_close(proc_open("php include/notifier.php \"$url\" \"$notify_type\" \"$post_id\" > notify.log &",
|
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$url\" \"$notify_type\" \"$post_id\" &",
|
||||||
array(),$foo));
|
array(),$foo));
|
||||||
|
|
||||||
goaway($a->get_baseurl() . "/" . $_POST['return'] );
|
goaway($a->get_baseurl() . "/" . $_POST['return'] );
|
||||||
|
@ -308,10 +309,11 @@ function item_content(&$a) {
|
||||||
|
|
||||||
$url = $a->get_baseurl();
|
$url = $a->get_baseurl();
|
||||||
$drop_id = intval($item['id']);
|
$drop_id = intval($item['id']);
|
||||||
|
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
|
|
||||||
// send the notification upstream/downstream as the case may be
|
// send the notification upstream/downstream as the case may be
|
||||||
|
|
||||||
proc_close(proc_open("php include/notifier.php \"$url\" \"drop\" \"$drop_id\" > notify.log &",
|
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$url\" \"drop\" \"$drop_id\" &",
|
||||||
array(),$foo));
|
array(),$foo));
|
||||||
|
|
||||||
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
|
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
|
||||||
|
|
|
@ -68,9 +68,10 @@ function message_post(&$a) {
|
||||||
$post_id = $r[0]['id'];
|
$post_id = $r[0]['id'];
|
||||||
|
|
||||||
$url = $a->get_baseurl();
|
$url = $a->get_baseurl();
|
||||||
|
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
|
|
||||||
if($post_id) {
|
if($post_id) {
|
||||||
proc_close(proc_open("php include/notifier.php \"$url\" \"mail\" \"$post_id\" > mail.log &",
|
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$url\" \"mail\" \"$post_id\" &",
|
||||||
array(),$foo));
|
array(),$foo));
|
||||||
notice( t('Message sent.') . EOL );
|
notice( t('Message sent.') . EOL );
|
||||||
}
|
}
|
||||||
|
@ -135,7 +136,9 @@ function message_content(&$a) {
|
||||||
if(($a->argc > 2) && ($a->argv[1] == 'redeliver') && intval($a->argv[2])) {
|
if(($a->argc > 2) && ($a->argv[1] == 'redeliver') && intval($a->argv[2])) {
|
||||||
$url = $a->get_baseurl();
|
$url = $a->get_baseurl();
|
||||||
$post_id = intval($a->argv[2]);
|
$post_id = intval($a->argv[2]);
|
||||||
proc_close(proc_open("php include/notifier.php \"$url\" \"mail\" \"$post_id\" > mail.log &",
|
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
|
|
||||||
|
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$url\" \"mail\" \"$post_id\" &",
|
||||||
array(),$foo));
|
array(),$foo));
|
||||||
goaway($a->get_baseurl() . '/message' );
|
goaway($a->get_baseurl() . '/message' );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
function notifications_post(&$a) {
|
function notifications_post(&$a) {
|
||||||
|
|
||||||
if((! x($_SESSION,'authenticated')) || (! (x($_SESSION,'uid')))) {
|
if(! local_user()) {
|
||||||
goaway($a->get_baseurl());
|
goaway($a->get_baseurl());
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_id = (($a->argc > 1) ? $a->argv[0] : 0);
|
$request_id = (($a->argc > 1) ? $a->argv[1] : 0);
|
||||||
|
|
||||||
if($request_id == "all")
|
if($request_id == "all")
|
||||||
return;
|
return;
|
||||||
|
@ -24,17 +24,17 @@ function notifications_post(&$a) {
|
||||||
$intro_id = $r[0]['id'];
|
$intro_id = $r[0]['id'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$_SESSION['sysmsg'] .= "Invalid request identifier." . EOL;
|
notice( t('Invalid request identifier.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if($_POST['submit'] == 'Discard') {
|
if($_POST['submit'] == t('Discard'() {
|
||||||
$r = q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1", intval($intro_id));
|
$r = q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1", intval($intro_id));
|
||||||
$r = q("DELETE `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$r = q("DELETE `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($request_id),
|
intval($request_id),
|
||||||
intval($_SESSION['uid']));
|
intval($_SESSION['uid']));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if($_POST['submit'] == 'Ignore') {
|
if($_POST['submit'] == t('Ignore')) {
|
||||||
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1",
|
||||||
intval($intro_id));
|
intval($intro_id));
|
||||||
return;
|
return;
|
||||||
|
@ -48,12 +48,13 @@ function notifications_post(&$a) {
|
||||||
|
|
||||||
function notifications_content(&$a) {
|
function notifications_content(&$a) {
|
||||||
|
|
||||||
$o = '';
|
if(! local_user()) {
|
||||||
|
notice( t('Permission denied.') . EOL);
|
||||||
if((! x($_SESSION,'authenticated')) || (! (x($_SESSION,'uid')))) {
|
|
||||||
goaway($a->get_baseurl());
|
goaway($a->get_baseurl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
|
||||||
if(($a->argc > 1) && ($a->argv[1] == 'all'))
|
if(($a->argc > 1) && ($a->argv[1] == 'all'))
|
||||||
$sql_extra = '';
|
$sql_extra = '';
|
||||||
else
|
else
|
||||||
|
@ -63,7 +64,7 @@ function notifications_content(&$a) {
|
||||||
$tpl = file_get_contents('view/intros-top.tpl');
|
$tpl = file_get_contents('view/intros-top.tpl');
|
||||||
$o .= replace_macros($tpl,array(
|
$o .= replace_macros($tpl,array(
|
||||||
'$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ),
|
'$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ),
|
||||||
'$hide_text' => ((strlen($sql_extra)) ? 'Show Ignored Requests' : 'Hide Ignored Requests')
|
'$hide_text' => ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests'))
|
||||||
));
|
));
|
||||||
|
|
||||||
$r = q("SELECT `intro`.`id` AS `intro-id`, `intro`.*, `contact`.*
|
$r = q("SELECT `intro`.`id` AS `intro-id`, `intro`.*, `contact`.*
|
||||||
|
@ -85,14 +86,14 @@ function notifications_content(&$a) {
|
||||||
'$contact-id' => $rr['contact-id'],
|
'$contact-id' => $rr['contact-id'],
|
||||||
'$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
|
'$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
|
||||||
'$fullname' => $rr['name'],
|
'$fullname' => $rr['name'],
|
||||||
'$knowyou' => (($rr['knowyou']) ? 'yes' : 'no'),
|
'$knowyou' => (($rr['knowyou']) ? t('yes') : t('no')),
|
||||||
'$url' => $rr['url'],
|
'$url' => $rr['url'],
|
||||||
'$note' => $rr['note']
|
'$note' => $rr['note']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$_SESSION['sysmsg'] .= "No notifications." . EOL;
|
notice( t('No notifications.') . EOL);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
|
@ -124,11 +124,12 @@ function photos_post(&$a) {
|
||||||
|
|
||||||
$url = $a->get_baseurl();
|
$url = $a->get_baseurl();
|
||||||
$drop_id = intval($rr['id']);
|
$drop_id = intval($rr['id']);
|
||||||
|
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
|
|
||||||
// send the notification upstream/downstream as the case may be
|
// send the notification upstream/downstream as the case may be
|
||||||
|
|
||||||
if($rr['visible'])
|
if($rr['visible'])
|
||||||
proc_close(proc_open("php include/notifier.php \"$url\" \"drop\" \"$drop_id\" & ",
|
proc_close(proc_open("\"php_path\" \"include/notifier.php\" \"$url\" \"drop\" \"$drop_id\" & ",
|
||||||
array(),$foo));
|
array(),$foo));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,11 +161,12 @@ function photos_post(&$a) {
|
||||||
|
|
||||||
$url = $a->get_baseurl();
|
$url = $a->get_baseurl();
|
||||||
$drop_id = intval($i[0]['id']);
|
$drop_id = intval($i[0]['id']);
|
||||||
|
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
|
|
||||||
// send the notification upstream/downstream as the case may be
|
// send the notification upstream/downstream as the case may be
|
||||||
|
|
||||||
if($i[0]['visible'])
|
if($i[0]['visible'])
|
||||||
proc_close(proc_open("php include/notifier.php \"$url\" \"drop\" \"$drop_id\" & ",
|
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$url\" \"drop\" \"$drop_id\" & ",
|
||||||
array(),$foo));
|
array(),$foo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
44
view/htconfig.tpl
Normal file
44
view/htconfig.tpl
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Set the following for your MySQL installation
|
||||||
|
// Copy or rename this file to .htconfig.php
|
||||||
|
|
||||||
|
$db_host = '$dbhost';
|
||||||
|
$db_user = '$dbuser';
|
||||||
|
$db_pass = '$dbpass';
|
||||||
|
$db_data = '$dbdata';
|
||||||
|
|
||||||
|
// If you are using a subdirectory of your domain you will need to put the
|
||||||
|
// relative path (from the root of your domain) here.
|
||||||
|
// For instance if your URL is 'http://example.com/directory/subdirectory',
|
||||||
|
// set $a->path to 'directory/subdirectory'.
|
||||||
|
|
||||||
|
$a->path = '';
|
||||||
|
|
||||||
|
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
||||||
|
// It can be changed later and only applies to timestamps for anonymous viewers.
|
||||||
|
|
||||||
|
$default_timezone = '$timezone';
|
||||||
|
|
||||||
|
// What is your site name?
|
||||||
|
|
||||||
|
$a->config['sitename'] = "My Friend Network";
|
||||||
|
|
||||||
|
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||||
|
// Be certain to create your own personal account before setting
|
||||||
|
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
||||||
|
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
||||||
|
// to the email address of an already registered person who can authorise
|
||||||
|
// and/or approve/deny the request.
|
||||||
|
|
||||||
|
$a->config['register_policy'] = REGISTER_OPEN;
|
||||||
|
$a->config['register_text'] = '';
|
||||||
|
$a->config['admin_email'] = '';
|
||||||
|
|
||||||
|
// Maximum size of an imported message, 0 is unlimited (but our database 'text' element is limited to 65535).
|
||||||
|
|
||||||
|
$a->config['max_import_size'] = 65535;
|
||||||
|
|
||||||
|
// Location of PHP command line processor
|
||||||
|
|
||||||
|
$a->config['php_path'] = '$phpath';
|
40
view/install_db.tpl
Normal file
40
view/install_db.tpl
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
<h3>Mistpark Personal Edition</h3>
|
||||||
|
<h3>Installation</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
In order to install Mistpark we need to know how to contact your database. Please contact your hosting provider or site administrator if you have questions about these settings. The database you specify below must already exist. If it does not, please create it before continuing.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<form id="install-form" action="install" method="post">
|
||||||
|
|
||||||
|
<input type="hidden" name="phpath" value="$phpath" />
|
||||||
|
|
||||||
|
<label for="install-dbhost" id="install-dbhost-label">Database Server Name</label>
|
||||||
|
<input type="text" name="dbhost" id="install-dbhost" value="$dbhost" />
|
||||||
|
<div id="install-dbhost-end"></div>
|
||||||
|
|
||||||
|
<label for="install-dbuser" id="install-dbuser-label">Database Login Name</label>
|
||||||
|
<input type="text" name="dbuser" id="install-dbuser" value="$dbuser" />
|
||||||
|
<div id="install-dbuser-end"></div>
|
||||||
|
|
||||||
|
<label for="install-dbpass" id="install-dbpass-label">Database Login Password</label>
|
||||||
|
<input type="password" name="dbpass" id="install-dbpass" value="$dbpass" />
|
||||||
|
<div id="install-dbpass-end"></div>
|
||||||
|
|
||||||
|
<label for="install-dbdata" id="install-dbdata-label">Database Name</label>
|
||||||
|
<input type="text" name="dbdata" id="install-dbdata" value="$dbdata" />
|
||||||
|
<div id="install-dbdata-end"></div>
|
||||||
|
|
||||||
|
<div id="install-tz-desc">
|
||||||
|
Please select a default timezone for your website
|
||||||
|
</div>
|
||||||
|
|
||||||
|
$tzselect
|
||||||
|
|
||||||
|
<div id="install-tz-end" ></div>
|
||||||
|
<input id="install-submit" type="submit" name="submit" value="$submit" />
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<div id="install-end" ></div>
|
||||||
|
|
|
@ -1458,3 +1458,38 @@ input#dfrn-url {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 50px;
|
margin-right: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#install-dbhost-label,
|
||||||
|
#install-dbuser-label,
|
||||||
|
#install-dbpass-label,
|
||||||
|
#install-dbdata-label,
|
||||||
|
#install-tz-desc {
|
||||||
|
float: left;
|
||||||
|
width: 250px;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#install-dbhost,
|
||||||
|
#install-dbuser,
|
||||||
|
#install-dbpass,
|
||||||
|
#install-dbdata {
|
||||||
|
float: left;
|
||||||
|
width: 200px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#install-dbhost-end,
|
||||||
|
#install-dbuser-end,
|
||||||
|
#install-dbpass-end,
|
||||||
|
#install-dbdata-end,
|
||||||
|
#install-tz-end {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
#install-form select#timezone_select {
|
||||||
|
float: left;
|
||||||
|
margin-top: 18px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue