aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-07-15 01:29:46 -0700
committerFriendika <info@friendika.com>2011-07-15 01:29:46 -0700
commitf35a61761a9868c09f2b7f26102c176dd9b8de34 (patch)
tree822dc362266f53d1bc309f4167f4630ba25a574e /mod
parent2efb59e4396c711c52996296d6717ab05144d8cb (diff)
parent34ab2aa9594d1bd86464720a839c4df6517761fe (diff)
downloadvolse-hubzilla-f35a61761a9868c09f2b7f26102c176dd9b8de34.tar.gz
volse-hubzilla-f35a61761a9868c09f2b7f26102c176dd9b8de34.tar.bz2
volse-hubzilla-f35a61761a9868c09f2b7f26102c176dd9b8de34.zip
Merge pull request #139 from fabrixxm/update
Experiment with on-line update
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php66
1 files changed, 62 insertions, 4 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 203d4873f..f7dde7bcb 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -3,7 +3,7 @@
/**
* Friendika admin
*/
-
+require_once("include/remoteupdate.php");
function admin_init(&$a) {
if(!is_site_admin()) {
@@ -36,11 +36,14 @@ function admin_post(&$a){
}
}
goaway($a->get_baseurl() . '/admin/plugins/' . $a->argv[2] );
- return; // NOTREACHED
+ return; // NOTREACHED
break;
case 'logs':
admin_page_logs_post($a);
break;
+ case 'update':
+ admin_page_remoteupdate_post($a);
+ break;
}
}
@@ -62,7 +65,8 @@ function admin_content(&$a) {
$aside = Array(
'site' => Array($a->get_baseurl()."/admin/site/", t("Site") , "site"),
'users' => Array($a->get_baseurl()."/admin/users/", t("Users") , "users"),
- 'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins")
+ 'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins"),
+ 'update' => Array($a->get_baseurl()."/admin/update/", t("Update") , "update")
);
/* get plugins admin page */
@@ -106,7 +110,10 @@ function admin_content(&$a) {
break;
case 'logs':
$o = admin_page_logs($a);
- break;
+ break;
+ case 'update':
+ $o = admin_page_remoteupdate($a);
+ break;
default:
notice( t("Item not found.") );
}
@@ -655,3 +662,54 @@ function admin_page_logs(&$a){
));
}
+function admin_page_remoteupdate_post(&$a) {
+ // this function should be called via ajax post
+ if(!is_site_admin()) {
+ return login(false);
+ }
+
+
+ if (x($_POST,'remotefile') && $_POST['remotefile']!=""){
+ $remotefile = $_POST['remotefile'];
+ $ftpdata = (x($_POST['ftphost'])?$_POST:false);
+ doUpdate($remotefile, $ftpdata);
+ } else {
+ echo "No remote file to download. Abort!";
+ }
+
+ killme();
+}
+
+function admin_page_remoteupdate(&$a) {
+ if(!is_site_admin()) {
+ return login(false);
+ }
+
+ $canwrite = canWeWrite();
+ $canftp = function_exists('ftp_connect');
+
+ $needupdate = true;
+ $u = checkUpdate();
+ if (!is_array($u)){
+ $needupdate = false;
+ $u = array('','','');
+ }
+
+ $tpl = get_markup_template("admin_remoteupdate.tpl");
+ return replace_macros($tpl, array(
+ '$baseurl' => $a->get_baseurl(),
+ '$submit' => t("Update now"),
+ '$close' => t("Close"),
+ '$localversion' => FRIENDIKA_VERSION,
+ '$remoteversion' => $u[1],
+ '$needupdate' => $needupdate,
+ '$canwrite' => $canwrite,
+ '$canftp' => $canftp,
+ '$ftphost' => array('ftphost', t("FTP Host"), '',''),
+ '$ftppath' => array('ftppath', t("FTP Path"), '/',''),
+ '$ftpuser' => array('ftpuser', t("FTP User"), '',''),
+ '$ftppwd' => array('ftppwd', t("FTP Password"), '',''),
+ '$remotefile'=>array('remotefile','', $u['2'],'')
+ ));
+
+}