admin_page_users_post($a);
break;
case 'plugins':
- if ($a->argc > 2 &&
+ if ($a->argc > 2 &&
is_file("addon/".$a->argv[2]."/".$a->argv[2].".php")){
@include_once("addon/".$a->argv[2]."/".$a->argv[2].".php");
if(function_exists($a->argv[2].'_plugin_admin_post')) {
$t = get_markup_template("admin_aside.tpl");
$a->page['aside'] .= replace_macros( $t, array(
- '$admin' => $aside,
+ '$admin' => $aside,
'$admtxt' => t('Admin'),
'$plugadmtxt' => t('Plugin Features'),
'$logtxt' => t('Logs'),
}
if(is_ajax()) {
- echo $o;
+ echo $o;
killme();
return '';
} else {
return $o;
}
-}
+}
/**
if (x($_POST,'relocate') && x($_POST,'relocate_url') && $_POST['relocate_url']!=""){
$new_url = $_POST['relocate_url'];
$new_url = rtrim($new_url,"/");
-
+
$parsed = @parse_url($new_url);
if (!$parsed || (!x($parsed,'host') || !x($parsed,'scheme'))) {
notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
goaway($a->get_baseurl(true) . '/admin/site' );
}
-
+
/* steps:
* replace all "baseurl" to "new_url" in config, profile, term, items and contacts
* send relocate for every local user
* */
-
+
$old_url = $a->get_baseurl(true);
-
+
function update_table($table_name, $fields, $old_url, $new_url) {
global $db, $a;
-
+
$dbold = dbesc($old_url);
$dbnew = dbesc($new_url);
-
+
$upd = array();
foreach ($fields as $f) {
$upd[] = "`$f` = REPLACE(`$f`, '$dbold', '$dbnew')";
}
-
+
$upds = implode(", ", $upd);
-
-
-
+
+
+
$q = sprintf("UPDATE %s SET %s;", $table_name, $upds);
$r = q($q);
if (!$r) {
goaway($a->get_baseurl(true) . '/admin/site' );
}
}
-
+
// update tables
update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
update_table("term", array('url'), $old_url, $new_url);
update_table("contact", array('photo','thumb','micro','url','nurl','request','notify','poll','confirm','poco'), $old_url, $new_url);
+ update_table("unique_contacts", array('url'), $old_url, $new_url);
update_table("item", array('owner-link','owner-avatar','author-name','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
// update config
$a->set_baseurl($new_url);
set_config('system','url',$new_url);
-
+
// send relocate
$users = q("SELECT uid FROM user WHERE account_removed = 0 AND account_expired = 0");
-
+
foreach ($users as $user) {
proc_run('php', 'include/notifier.php', 'relocate', $user['uid']);
}
info("Relocation started. Could take a while to complete.");
-
+
goaway($a->get_baseurl(true) . '/admin/site' );
}
// end relocate
-
+
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
$banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
$info = ((x($_POST,'info')) ? trim($_POST['info']) : false);
$use_fulltext_engine = ((x($_POST,'use_fulltext_engine')) ? True : False);
$itemcache = ((x($_POST,'itemcache')) ? notags(trim($_POST['itemcache'])) : '');
$itemcache_duration = ((x($_POST,'itemcache_duration')) ? intval($_POST['itemcache_duration']) : 0);
+ $max_comments = ((x($_POST,'max_comments')) ? intval($_POST['max_comments']) : 0);
$lockpath = ((x($_POST,'lockpath')) ? notags(trim($_POST['lockpath'])) : '');
$temppath = ((x($_POST,'temppath')) ? notags(trim($_POST['temppath'])) : '');
$basepath = ((x($_POST,'basepath')) ? notags(trim($_POST['basepath'])) : '');
$singleuser = ((x($_POST,'singleuser')) ? notags(trim($_POST['singleuser'])) : '');
+ $proxy_disabled = ((x($_POST,'proxy_disabled')) ? True : False);
+ $enable_noscrape = ((x($_POST,'enable_noscrape')) ? true : false);
if($ssl_policy != intval(get_config('system','ssl_policy'))) {
if($ssl_policy == SSL_POLICY_FULL) {
- q("update `contact` set
+ q("update `contact` set
`url` = replace(`url` , 'http:' , 'https:'),
`photo` = replace(`photo` , 'http:' , 'https:'),
`thumb` = replace(`thumb` , 'http:' , 'https:'),
`poco` = replace(`poco` , 'http:' , 'https:')
where `self` = 1"
);
- q("update `profile` set
+ q("update `profile` set
`photo` = replace(`photo` , 'http:' , 'https:'),
`thumb` = replace(`thumb` , 'http:' , 'https:')
where 1 "
);
}
elseif($ssl_policy == SSL_POLICY_SELFSIGN) {
- q("update `contact` set
+ q("update `contact` set
`url` = replace(`url` , 'https:' , 'http:'),
`photo` = replace(`photo` , 'https:' , 'http:'),
`thumb` = replace(`thumb` , 'https:' , 'http:'),
`poco` = replace(`poco` , 'https:' , 'http:')
where `self` = 1"
);
- q("update `profile` set
+ q("update `profile` set
`photo` = replace(`photo` , 'https:' , 'http:'),
`thumb` = replace(`thumb` , 'https:' , 'http:')
where 1 "
set_config('system','use_fulltext_engine', $use_fulltext_engine);
set_config('system','itemcache', $itemcache);
set_config('system','itemcache_duration', $itemcache_duration);
+ set_config('system','max_comments', $max_comments);
set_config('system','lockpath', $lockpath);
set_config('system','temppath', $temppath);
set_config('system','basepath', $basepath);
+ set_config('system','proxy_disabled', $proxy_disabled);
+ set_config('system','enable_noscrape', $enable_noscrape);
info( t('Site settings updated.') . EOL);
goaway($a->get_baseurl(true) . '/admin/site' );
/* Banner */
$banner = get_config('system','banner');
- if($banner == false)
+ if($banner == false)
$banner = '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
$banner = htmlspecialchars($banner);
$info = get_config('config','info');
$info = htmlspecialchars($info);
+ // Automatically create temporary paths
+ get_temppath();
+ get_lockpath();
+ get_itemcachepath();
+
//echo "<pre>"; var_dump($lang_choices); die("</pre>");
/* Register policy */
REGISTER_CLOSED => t("Closed"),
REGISTER_APPROVE => t("Requires approval"),
REGISTER_OPEN => t("Open")
- );
+ );
$ssl_choices = array(
SSL_POLICY_NONE => t("No SSL policy, links will track page SSL state"),
'$use_fulltext_engine' => array('use_fulltext_engine', t("Use MySQL full text engine"), get_config('system','use_fulltext_engine'), t("Activates the full text engine. Speeds up search - but can only search for four and more characters.")),
'$suppress_language' => array('suppress_language', t("Suppress Language"), get_config('system','suppress_language'), t("Suppress language information in meta information about a posting.")),
'$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), "The item caches buffers generated bbcode and external images."),
- '$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day).")),
+ '$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.")),
+ '$max_comments' => array('max_comments', t("Maximum numbers of comments per post"), get_config('system','max_comments'), t("How much comments should be shown for each post? Default value is 100.")),
'$lockpath' => array('lockpath', t("Path for lock file"), get_config('system','lockpath'), "The lock file is used to avoid multiple pollers at one time. Only define a folder here."),
'$temppath' => array('temppath', t("Temp path"), get_config('system','temppath'), "If you have a restricted system where the webserver can't access the system temp path, enter another path here."),
'$basepath' => array('basepath', t("Base path to installation"), get_config('system','basepath'), "If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."),
-
+ '$proxy_disabled' => array('proxy_disabled', t("Disable picture proxy"), get_config('system','proxy_disabled'), t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwith.")),
+
'$relocate_url' => array('relocate_url', t("New base url"), $a->get_baseurl(), "Change base url for this server. Sends relocate message to all DFRN contacts of all users."),
- '$form_security_token' => get_form_security_token("admin_site"),
+ '$enable_noscrape'=> array('enable_noscrape', t("Enable noscrape"), get_config('system','enable_noscrape'), t("The noscrape feature speeds up directory submissions by using JSON data instead of HTML scraping.")),
+ '$form_security_token' => get_form_security_token("admin_site")
));
if(function_exists($func)) {
$retval = $func();
if($retval === UPDATE_FAILED) {
- $o .= sprintf( t('Executing %s failed. Check system logs.'), $func);
+ $o .= sprintf( t('Executing %s failed. Check system logs.'), $func);
}
elseif($retval === UPDATE_SUCCESS) {
$o .= sprintf( t('Update %s was successfully applied.', $func));
'$delete' => t('Delete'),
'$block' => t('Block'),
'$unblock' => t('Unblock'),
- '$siteadmin' => t('Site admin'),
- '$accountexpired' => t('Account expired'),
-
+ '$siteadmin' => t('Site admin'),
+ '$accountexpired' => t('Account expired'),
+
'$h_users' => t('Users'),
'$h_newuser' => t('New User'),
'$th_deleted' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since') ),
'$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
'$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),
- '$form_security_token' => get_form_security_token("admin_users"),
+ '$form_security_token' => get_form_security_token("admin_users"),
// values //
'$baseurl' => $a->get_baseurl(true),
'$pending' => $pending,
'deleted' => $deleted,
'$users' => $users,
- '$newusername' => array('new_user_name', t("Name"), '', t("Name of the new user.")),
- '$newusernickname' => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")),
- '$newuseremail' => array('new_user_email', t("Email"), '', t("Email address of the new user.")),
+ '$newusername' => array('new_user_name', t("Name"), '', t("Name of the new user.")),
+ '$newusernickname' => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")),
+ '$newuseremail' => array('new_user_email', t("Email"), '', t("Email address of the new user.")),
));
$o .= paginate($a);
return $o;
*
* @param App $a
*/
-
+
function admin_page_logs_post(&$a) {
if (x($_POST,"page_logs")) {
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');