Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

643 lines
20 KiB

  1. <?php
  2. /**
  3. * Friendika admin
  4. */
  5. function admin_init(&$a) {
  6. if(!is_site_admin()) {
  7. notice( t('Permission denied.') . EOL);
  8. return;
  9. }
  10. }
  11. function admin_post(&$a){
  12. if(!is_site_admin()) {
  13. return login(false);
  14. }
  15. // urls
  16. if ($a->argc > 1){
  17. switch ($a->argv[1]){
  18. case 'site':
  19. admin_page_site_post($a);
  20. break;
  21. case 'users':
  22. admin_page_users_post($a);
  23. break;
  24. case 'plugins':
  25. if ($a->argc > 2 &&
  26. is_file("addon/".$a->argv[2]."/".$a->argv[2].".php")){
  27. @include_once("addon/".$a->argv[2]."/".$a->argv[2].".php");
  28. if(function_exists($a->argv[2].'_plugin_admin_post')) {
  29. $func = $a->argv[2].'_plugin_admin_post';
  30. $func($a);
  31. }
  32. }
  33. goaway($a->get_baseurl() . '/admin/plugins/' . $a->argv[2] );
  34. return; // NOTREACHED
  35. break;
  36. case 'logs':
  37. admin_page_logs_post($a);
  38. break;
  39. }
  40. }
  41. goaway($a->get_baseurl() . '/admin' );
  42. return; // NOTREACHED
  43. }
  44. function admin_content(&$a) {
  45. if(!is_site_admin()) {
  46. return login(false);
  47. }
  48. /**
  49. * Side bar links
  50. */
  51. // array( url, name, extra css classes )
  52. $aside = Array(
  53. 'site' => Array($a->get_baseurl()."/admin/site/", t("Site") , "site"),
  54. 'users' => Array($a->get_baseurl()."/admin/users/", t("Users") , "users"),
  55. 'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins")
  56. );
  57. /* get plugins admin page */
  58. $r = q("SELECT * FROM `addon` WHERE `plugin_admin`=1");
  59. $aside['plugins_admin']=Array();
  60. foreach ($r as $h){
  61. $plugin =$h['name'];
  62. $aside['plugins_admin'][] = Array($a->get_baseurl()."/admin/plugins/".$plugin, $plugin, "plugin");
  63. // temp plugins with admin
  64. $a->plugins_admin[] = $plugin;
  65. }
  66. $aside['logs'] = Array($a->get_baseurl()."/admin/logs/", t("Logs"), "logs");
  67. $t = get_markup_template("admin_aside.tpl");
  68. $a->page['aside'] = replace_macros( $t, array(
  69. '$admin' => $aside,
  70. '$h_pending' => t('User registrations waiting for confirm'),
  71. '$admurl'=> $a->get_baseurl()."/admin/"
  72. ));
  73. /**
  74. * Page content
  75. */
  76. $o = '';
  77. // urls
  78. if ($a->argc > 1){
  79. switch ($a->argv[1]){
  80. case 'site':
  81. $o = admin_page_site($a);
  82. break;
  83. case 'users':
  84. $o = admin_page_users($a);
  85. break;
  86. case 'plugins':
  87. $o = admin_page_plugins($a);
  88. break;
  89. case 'logs':
  90. $o = admin_page_logs($a);
  91. break;
  92. default:
  93. notice( t("Item not found.") );
  94. }
  95. } else {
  96. $o = admin_page_summary($a);
  97. }
  98. return $o;
  99. }
  100. /**
  101. * Admin Summary Page
  102. */
  103. function admin_page_summary(&$a) {
  104. $r = q("SELECT `page-flags`, COUNT(uid) as `count` FROM `user` GROUP BY `page-flags`");
  105. $accounts = Array(
  106. Array( t('Normal Account'), 0),
  107. Array( t('Soapbox Account'), 0),
  108. Array( t('Community/Celebrity Account'), 0),
  109. Array( t('Automatic Friend Account'), 0)
  110. );
  111. $users=0;
  112. foreach ($r as $u){ $accounts[$u['page-flags']][1] = $u['count']; $users+=$u['count']; }
  113. $r = q("SELECT COUNT(id) as `count` FROM `register`");
  114. $pending = $r[0]['count'];
  115. $t = get_markup_template("admin_summary.tpl");
  116. return replace_macros($t, array(
  117. '$title' => t('Administration'),
  118. '$page' => t('Summary'),
  119. '$users' => Array( t('Registered users'), $users),
  120. '$accounts' => $accounts,
  121. '$pending' => Array( t('Pending registrations'), $pending),
  122. '$version' => Array( t('Version'), FRIENDIKA_VERSION),
  123. '$build' => get_config('system','build'),
  124. '$plugins' => Array( t('Active plugins'), $a->plugins )
  125. ));
  126. }
  127. /**
  128. * Admin Site Page
  129. */
  130. function admin_page_site_post(&$a){
  131. if (!x($_POST,"page_site")){
  132. return;
  133. }
  134. $sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
  135. $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
  136. $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
  137. $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
  138. $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
  139. $register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
  140. $register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
  141. $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
  142. $allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
  143. $block_public = ((x($_POST,'block_public')) ? True : False);
  144. $force_publish = ((x($_POST,'publish_all')) ? True : False);
  145. $global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
  146. $global_search_url = ((x($_POST,'directory_search_url'))? notags(trim($_POST['directory_search_url'])) : '');
  147. $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
  148. $no_openid = !((x($_POST,'no_openid')) ? True : False);
  149. $no_gravatar = !((x($_POST,'no_gravatar')) ? True : False);
  150. $no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
  151. $no_utf = !((x($_POST,'no_utf')) ? True : False);
  152. $verifyssl = ((x($_POST,'verifyssl')) ? True : False);
  153. $proxyuser = ((x($_POST,'proxyuser')) ? notags(trim($_POST['global_search_url'])) : '');
  154. $proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['global_search_url'])) : '');
  155. $timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
  156. set_config('config','sitename',$sitename);
  157. if ($banner==""){
  158. // don't know why, but del_config doesn't work...
  159. q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
  160. dbesc("system"),
  161. dbesc("banner")
  162. );
  163. } else {
  164. set_config('system','banner', $banner);
  165. }
  166. set_config('system','language', $language);
  167. set_config('system','theme', $theme);
  168. set_config('system','maximagesize', $maximagesize);
  169. set_config('config','register_policy', $register_policy);
  170. set_config('config','register_text', $register_text);
  171. set_config('system','allowed_sites', $allowed_sites);
  172. set_config('system','allowed_email', $allowed_email);
  173. set_config('system','block_public', $block_public);
  174. set_config('system','publish_all', $force_publish);
  175. if ($global_directory==""){
  176. // don't know why, but del_config doesn't work...
  177. q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
  178. dbesc("system"),
  179. dbesc("directory_submit_url")
  180. );
  181. } else {
  182. set_config('system','directory_submit_url', $global_directory);
  183. }
  184. set_config('system','directory_search_url', $global_search_url);
  185. set_config('system','block_extended_register', $no_multi_reg);
  186. set_config('system','no_openid', $no_openid);
  187. set_config('system','no_gravatar', $no_gravatar);
  188. set_config('system','no_regfullname', $no_regfullname);
  189. set_config('system','proxy', $no_utf);
  190. set_config('system','verifyssl', $verifyssl);
  191. set_config('system','proxyuser', $proxyuser);
  192. set_config('system','proxy', $proxy);
  193. set_config('system','curl_timeout', $timeout);
  194. info( t('Site settings updated.') . EOL);
  195. goaway($a->get_baseurl() . '/admin/site' );
  196. return; // NOTREACHED
  197. }
  198. function admin_page_site(&$a) {
  199. /* Installed langs */
  200. $lang_choices = array();
  201. $langs = glob('view/*/strings.php');
  202. if(is_array($langs) && count($langs)) {
  203. if(! in_array('view/en/strings.php',$langs))
  204. $langs[] = 'view/en/';
  205. asort($langs);
  206. foreach($langs as $l) {
  207. $t = explode("/",$l);
  208. $lang_choices[$t[1]] = $t[1];
  209. }
  210. }
  211. /* Installed themes */
  212. $theme_choices = array();
  213. $files = glob('view/theme/*');
  214. if($files) {
  215. foreach($files as $file) {
  216. $f = basename($file);
  217. $theme_name = ((file_exists($file . '/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
  218. $theme_choices[$f] = $theme_name;
  219. }
  220. }
  221. /* Banner */
  222. $banner = get_config('system','banner');
  223. if($banner == false)
  224. $banner = htmlspecialchars('<a href="http://project.friendika.com"><img id="logo-img" src="images/friendika-32.png" alt="logo" /></a><span id="logo-text"><a href="http://project.friendika.com">Friendika</a></span>');
  225. //echo "<pre>"; var_dump($lang_choices); die("</pre>");
  226. /* Register policy */
  227. $register_choices = Array(
  228. REGISTER_CLOSED => t("Closed"),
  229. REGISTER_APPROVE => t("Need approvation"),
  230. REGISTER_OPEN => t("Open")
  231. );
  232. $t = get_markup_template("admin_site.tpl");
  233. return replace_macros($t, array(
  234. '$title' => t('Administration'),
  235. '$page' => t('Site'),
  236. '$submit' => t('Submit'),
  237. '$registration' => t('Registration'),
  238. '$upload' => t('File upload'),
  239. '$corporate' => t('Corporate/Edu'),
  240. '$advanced' => t('Advanced'),
  241. '$baseurl' => $a->get_baseurl(),
  242. // name, label, value, help string, extra data...
  243. '$sitename' => array('sitename', t("Site name"), $a->config['sitename'], ""),
  244. '$banner' => array('banner', t("Banner/Logo"), $banner, ""),
  245. '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
  246. '$theme' => array('theme', t("System theme"), get_config('system','theme'), "Default system theme (which may be over-ridden by user profiles)", $theme_choices),
  247. '$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), "Maximum size in bytes of uploaded images. Default is 0, which means no limits."),
  248. '$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices),
  249. '$register_text' => array('register_text', t("Register text"), $a->config['register_text'], "Will be displayed prominently on the registration page."),
  250. '$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), "Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains"),
  251. '$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), "Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains"),
  252. '$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), "Check to block public access to all otherwise public personal pages on this site unless you are currently logged in."),
  253. '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), "Check to force all profiles on this site to be listed in the site directory."),
  254. '$global_directory' => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), "URL to update the global directory. If this is not set, the global directory is completely unavailable to the application."),
  255. '$global_search_url'=> array('directory_search_url', t("Global directory search URL"), get_config('system','directory_search_url'), ""),
  256. '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), "Disallow users to register additional accounts for use as pages."),
  257. '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), "OpenID support for registration and logins."),
  258. '$no_gravatar' => array('no_gravatar', t("Gravatar support"), !get_config('system','no_gravatar'), "Search new user's photo on Gravatar."),
  259. '$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), "Force users to registrate with a space between his firsname and lastname in Full name, as an antispam measure"),
  260. '$no_utf' => array('no_utf', t("UTF-8 Regular expressions"), !get_config('system','proxy'), "Use PHP UTF8 regular expressions"),
  261. '$verifyssl' => array('verifyssl', t("Verify SSL"), get_config('system','verifyssl'), "If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites."),
  262. '$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
  263. '$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
  264. '$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), "Value is in seconds. Set to 0 for unlimited (not recommended)."),
  265. ));
  266. }
  267. /**
  268. * Users admin page
  269. */
  270. function admin_page_users_post(&$a){
  271. $pending = ( x(£_POST, 'pending') ? $_POST['pending'] : Array() );
  272. $users = ( x($_POST, 'user') ? $_POST['user'] : Array() );
  273. if (x($_POST,'page_users_block')){
  274. foreach($users as $uid){
  275. q("UPDATE `user` SET `blocked`=1-`blocked` WHERE `uid`=%s",
  276. intval( $uid )
  277. );
  278. }
  279. notice( sprintf( tt("%s user blocked", "%s users blocked/unblocked", count($users)), count($users)) );
  280. }
  281. if (x($_POST,'page_users_delete')){
  282. require_once("include/Contact.php");
  283. foreach($users as $uid){
  284. user_remove($uid);
  285. }
  286. notice( sprintf( tt("%s user deleted", "%s users deleted", count($users)), count($users)) );
  287. }
  288. if (x($_POST,'page_users_approve')){
  289. require_once("mod/regmod.php");
  290. foreach($pending as $hash){
  291. user_allow($hash);
  292. }
  293. }
  294. if (x($_POST,'page_users_deny')){
  295. require_once("mod/regmod.php");
  296. foreach($pending as $hash){
  297. user_deny($hash);
  298. }
  299. }
  300. goaway($a->get_baseurl() . '/admin/users' );
  301. return; // NOTREACHED
  302. }
  303. function admin_page_users(&$a){
  304. if ($a->argc>2) {
  305. $uid = $a->argv[3];
  306. $user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid));
  307. if (count($user)==0){
  308. notice( 'User not found' . EOL);
  309. goaway($a->get_baseurl() . '/admin/users' );
  310. return; // NOTREACHED
  311. }
  312. switch($a->argv[2]){
  313. case "delete":{
  314. // delete user
  315. require_once("include/Contact.php");
  316. user_remove($uid);
  317. notice( sprintf(t("User '%s' deleted"), $user[0]['username']) . EOL);
  318. }; break;
  319. case "block":{
  320. q("UPDATE `user` SET `blocked`=%d WHERE `uid`=%s",
  321. intval( 1-$user[0]['blocked'] ),
  322. intval( $uid )
  323. );
  324. notice( sprintf( ($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']) . EOL);
  325. }; break;
  326. }
  327. goaway($a->get_baseurl() . '/admin/users' );
  328. return; // NOTREACHED
  329. }
  330. /* get pending */
  331. $pending = q("SELECT `register`.*, `contact`.`name`, `user`.`email`
  332. FROM `register`
  333. LEFT JOIN `contact` ON `register`.`uid` = `contact`.`uid`
  334. LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;");
  335. /* get users */
  336. $total = q("SELECT count(*) as total FROM `user` where 1");
  337. if(count($total)) {
  338. $a->set_pager_total($total[0]['total']);
  339. $a->set_pager_itemspage(100);
  340. }
  341. $users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`
  342. FROM `user`
  343. LEFT JOIN `contact` ON `user`.`uid` = `contact`.`uid`
  344. WHERE `user`.`verified` =1
  345. AND `contact`.`self` =1
  346. ORDER BY `contact`.`name` LIMIT %d, %d
  347. ",
  348. intval($a->pager['start']),
  349. intval($a->pager['itemspage'])
  350. );
  351. function _setup_users($e){
  352. $accounts = Array(
  353. t('Normal Account'),
  354. t('Soapbox Account'),
  355. t('Community/Celebrity Account'),
  356. t('Automatic Friend Account')
  357. );
  358. $e['page-flags'] = $accounts[$e['page-flags']];
  359. $e['register_date'] = relative_date($e['register_date']);
  360. $e['login_date'] = relative_date($e['login_date']);
  361. return $e;
  362. }
  363. $users = array_map("_setup_users", $users);
  364. $t = get_markup_template("admin_users.tpl");
  365. $o = replace_macros($t, array(
  366. // strings //
  367. '$title' => t('Administration'),
  368. '$page' => t('Users'),
  369. '$submit' => t('Submit'),
  370. '$select_all' => t('select all'),
  371. '$h_pending' => t('User registrations waiting for confirm'),
  372. '$th_pending' => array( t('Request date'), t('Name'), t('Email') ),
  373. '$no_pending' => t('No registrations.'),
  374. '$approve' => t('Approve'),
  375. '$deny' => t('Deny'),
  376. '$delete' => t('Delete'),
  377. '$block' => t('Block'),
  378. '$unblock' => t('Unblock'),
  379. '$h_users' => t('Users'),
  380. '$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Account') ),
  381. '$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?'),
  382. '$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?'),
  383. // values //
  384. '$baseurl' => $a->get_baseurl(),
  385. '$pending' => $pending,
  386. '$users' => $users,
  387. ));
  388. $o .= paginate($a);
  389. return $o;
  390. }
  391. /*
  392. * Plugins admin page
  393. */
  394. function admin_page_plugins(&$a){
  395. /**
  396. * Single plugin
  397. */
  398. if ($a->argc == 3){
  399. $plugin = $a->argv[2];
  400. if (!is_file("addon/$plugin/$plugin.php")){
  401. notice( t("Item not found.") );
  402. return;
  403. }
  404. if (x($_GET,"a") && $_GET['a']=="t"){
  405. // Toggle plugin status
  406. $idx = array_search($plugin, $a->plugins);
  407. if ($idx){
  408. unset($a->plugins[$idx]);
  409. uninstall_plugin($plugin);
  410. info( sprintf( t("Plugin %s disabled."), $plugin ) );
  411. } else {
  412. $a->plugins[] = $plugin;
  413. install_plugin($plugin);
  414. info( sprintf( t("Plugin %s enabled."), $plugin ) );
  415. }
  416. set_config("system","addon", implode(", ",$a->plugins));
  417. goaway($a->get_baseurl() . '/admin/plugins' );
  418. return; // NOTREACHED
  419. }
  420. // display plugin details
  421. require_once('library/markdown.php');
  422. if (in_array($plugin, $a->plugins)){
  423. $status="on"; $action= t("Disable");
  424. } else {
  425. $status="off"; $action= t("Enable");
  426. }
  427. $readme=Null;
  428. if (is_file("addon/$plugin/README.md")){
  429. $readme = file_get_contents("addon/$plugin/README.md");
  430. $readme = Markdown($readme);
  431. } else if (is_file("addon/$plugin/README")){
  432. $readme = "<pre>". file_get_contents("addon/$plugin/README") ."</pre>";
  433. }
  434. $admin_form="";
  435. if (in_array($plugin, $a->plugins_admin)){
  436. @require_once("addon/$plugin/$plugin.php");
  437. $func = $plugin.'_plugin_admin';
  438. $func($a, $admin_form);
  439. }
  440. $t = get_markup_template("admin_plugins_details.tpl");
  441. return replace_macros($t, array(
  442. '$title' => t('Administration'),
  443. '$page' => t('Plugins'),
  444. '$toggle' => t('Toggle'),
  445. '$settings' => t('Settings'),
  446. '$baseurl' => $a->get_baseurl(),
  447. '$plugin' => $plugin,
  448. '$status' => $status,
  449. '$action' => $action,
  450. '$info' => get_plugin_info($plugin),
  451. '$admin_form' => $admin_form,
  452. '$readme' => $readme
  453. ));
  454. }
  455. /**
  456. * List plugins
  457. */
  458. $plugins = array();
  459. $files = glob("addon/*/");
  460. if($files) {
  461. foreach($files as $file) {
  462. if (is_dir($file)){
  463. list($tmp, $id)=array_map("trim", explode("/",$file));
  464. $info = get_plugin_info($id);
  465. $plugins[] = array( $id, (in_array($id, $a->plugins)?"on":"off") , $info);
  466. }
  467. }
  468. }
  469. $t = get_markup_template("admin_plugins.tpl");
  470. return replace_macros($t, array(
  471. '$title' => t('Administration'),
  472. '$page' => t('Plugins'),
  473. '$submit' => t('Submit'),
  474. '$baseurl' => $a->get_baseurl(),
  475. '$plugins' => $plugins
  476. ));
  477. }
  478. /**
  479. * Logs admin page
  480. */
  481. function admin_page_logs_post(&$a) {
  482. if (x($_POST,"page_logs")) {
  483. $logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
  484. $debugging = ((x($_POST,'debugging')) ? true : false);
  485. $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
  486. set_config('system','logfile', $logfile);
  487. set_config('system','debugging', $debugging);
  488. set_config('system','loglevel', $loglevel);
  489. }
  490. info( t("Log settings updated.") );
  491. goaway($a->get_baseurl() . '/admin/logs' );
  492. return; // NOTREACHED
  493. }
  494. function admin_page_logs(&$a){
  495. $log_choices = Array(
  496. LOGGER_NORMAL => 'Normal',
  497. LOGGER_TRACE => 'Trace',
  498. LOGGER_DEBUG => 'Debug',
  499. LOGGER_DATA => 'Data',
  500. LOGGER_ALL => 'All'
  501. );
  502. $t = get_markup_template("admin_logs.tpl");
  503. $f = get_config('system','logfile');
  504. $size = filesize($f);
  505. if($size > 5000000)
  506. $size = 5000000;
  507. $data = '';
  508. $fp = fopen($f,'r');
  509. if($fp) {
  510. $seek = fseek($fp,0-$size,SEEK_END);
  511. if($seek === 0) {
  512. fgets($fp); // throw away the first partial line
  513. $data = escape_tags(fread($fp,$size));
  514. while(! feof($fp))
  515. $data .= escape_tags(fread($fp,4096));
  516. }
  517. fclose($fp);
  518. }
  519. return replace_macros($t, array(
  520. '$title' => t('Administration'),
  521. '$page' => t('Logs'),
  522. '$submit' => t('Submit'),
  523. '$clear' => t('Clear'),
  524. '$data' => $data,
  525. '$baseurl' => $a->get_baseurl(),
  526. '$logname' => get_config('system','logfile'),
  527. // name, label, value, help string, extra data...
  528. '$debugging' => array('debugging', t("Debugging"),get_config('system','debugging'), ""),
  529. '$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your Friendika index.php.")),
  530. '$loglevel' => array('loglevel', t("Log level"), get_config('system','loglevel'), "", $log_choices),
  531. ));
  532. }