6 require_once("include/remoteupdate.php");
8 function admin_post(&$a){
14 if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
21 admin_page_site_post($a);
24 admin_page_users_post($a);
28 is_file("addon/".$a->argv[2]."/".$a->argv[2].".php")){
29 @include_once("addon/".$a->argv[2]."/".$a->argv[2].".php");
30 if(function_exists($a->argv[2].'_plugin_admin_post')) {
31 $func = $a->argv[2].'_plugin_admin_post';
35 goaway($a->get_baseurl() . '/admin/plugins/' . $a->argv[2] );
39 admin_page_logs_post($a);
42 admin_page_remoteupdate_post($a);
47 goaway($a->get_baseurl() . '/admin' );
51 function admin_content(&$a) {
53 if(!is_site_admin()) {
57 if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
64 // array( url, name, extra css classes )
66 'site' => Array($a->get_baseurl()."/admin/site/", t("Site") , "site"),
67 'users' => Array($a->get_baseurl()."/admin/users/", t("Users") , "users"),
68 'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins"),
69 'update' => Array($a->get_baseurl()."/admin/update/", t("Update") , "update")
72 /* get plugins admin page */
74 $r = q("SELECT * FROM `addon` WHERE `plugin_admin`=1");
75 $aside['plugins_admin']=Array();
78 $aside['plugins_admin'][] = Array($a->get_baseurl()."/admin/plugins/".$plugin, $plugin, "plugin");
79 // temp plugins with admin
80 $a->plugins_admin[] = $plugin;
83 $aside['logs'] = Array($a->get_baseurl()."/admin/logs/", t("Logs"), "logs");
85 $t = get_markup_template("admin_aside.tpl");
86 $a->page['aside'] = replace_macros( $t, array(
88 '$h_pending' => t('User registrations waiting for confirmation'),
89 '$admurl'=> $a->get_baseurl()."/admin/"
101 switch ($a->argv[1]){
103 $o = admin_page_site($a);
106 $o = admin_page_users($a);
109 $o = admin_page_plugins($a);
112 $o = admin_page_logs($a);
115 $o = admin_page_remoteupdate($a);
118 notice( t("Item not found.") );
121 $o = admin_page_summary($a);
130 function admin_page_summary(&$a) {
131 $r = q("SELECT `page-flags`, COUNT(uid) as `count` FROM `user` GROUP BY `page-flags`");
133 Array( t('Normal Account'), 0),
134 Array( t('Soapbox Account'), 0),
135 Array( t('Community/Celebrity Account'), 0),
136 Array( t('Automatic Friend Account'), 0)
139 foreach ($r as $u){ $accounts[$u['page-flags']][1] = $u['count']; $users+=$u['count']; }
142 $r = q("SELECT COUNT(id) as `count` FROM `register`");
143 $pending = $r[0]['count'];
149 $t = get_markup_template("admin_summary.tpl");
150 return replace_macros($t, array(
151 '$title' => t('Administration'),
152 '$page' => t('Summary'),
153 '$users' => Array( t('Registered users'), $users),
154 '$accounts' => $accounts,
155 '$pending' => Array( t('Pending registrations'), $pending),
156 '$version' => Array( t('Version'), FRIENDICA_VERSION),
157 '$build' => get_config('system','build'),
158 '$plugins' => Array( t('Active plugins'), $a->plugins )
166 function admin_page_site_post(&$a){
167 if (!x($_POST,"page_site")){
172 $sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
173 $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
174 $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
175 $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
176 $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
179 $register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
180 $abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
182 $register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
184 $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
185 $allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
186 $block_public = ((x($_POST,'block_public')) ? True : False);
187 $force_publish = ((x($_POST,'publish_all')) ? True : False);
188 $global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
189 $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
190 $no_openid = !((x($_POST,'no_openid')) ? True : False);
191 $no_gravatar = !((x($_POST,'no_gravatar')) ? True : False);
192 $no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
193 $no_utf = !((x($_POST,'no_utf')) ? True : False);
194 $no_community_page = !((x($_POST,'no_community_page')) ? True : False);
196 $verifyssl = ((x($_POST,'verifyssl')) ? True : False);
197 $proxyuser = ((x($_POST,'proxyuser')) ? notags(trim($_POST['proxyuser'])) : '');
198 $proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['proxy'])) : '');
199 $timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
200 $dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
201 $ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
202 $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
205 set_config('config','sitename',$sitename);
207 // don't know why, but del_config doesn't work...
208 q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
213 set_config('system','banner', $banner);
215 set_config('system','language', $language);
216 set_config('system','theme', $theme);
217 set_config('system','maximagesize', $maximagesize);
219 set_config('config','register_policy', $register_policy);
220 set_config('system','account_abandon_days', $abandon_days);
221 set_config('config','register_text', $register_text);
222 set_config('system','allowed_sites', $allowed_sites);
223 set_config('system','allowed_email', $allowed_email);
224 set_config('system','block_public', $block_public);
225 set_config('system','publish_all', $force_publish);
226 if ($global_directory==""){
227 // don't know why, but del_config doesn't work...
228 q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
230 dbesc("directory_submit_url")
233 set_config('system','directory_submit_url', $global_directory);
235 set_config('system','directory_search_url', $global_search_url);
236 set_config('system','block_extended_register', $no_multi_reg);
237 set_config('system','no_openid', $no_openid);
238 set_config('system','no_gravatar', $no_gravatar);
239 set_config('system','no_regfullname', $no_regfullname);
240 set_config('system','no_community_page', $no_community_page);
241 set_config('system','no_utf', $no_utf);
242 set_config('system','verifyssl', $verifyssl);
243 set_config('system','proxyuser', $proxyuser);
244 set_config('system','proxy', $proxy);
245 set_config('system','curl_timeout', $timeout);
246 set_config('system','dfrn_only', $dfrn_only);
247 set_config('system','ostatus_disabled', $ostatus_disabled);
248 set_config('system','diaspora_enabled', $diaspora_enabled);
250 info( t('Site settings updated.') . EOL);
251 goaway($a->get_baseurl() . '/admin/site' );
252 return; // NOTREACHED
256 function admin_page_site(&$a) {
258 /* Installed langs */
259 $lang_choices = array();
260 $langs = glob('view/*/strings.php');
262 if(is_array($langs) && count($langs)) {
263 if(! in_array('view/en/strings.php',$langs))
264 $langs[] = 'view/en/';
266 foreach($langs as $l) {
267 $t = explode("/",$l);
268 $lang_choices[$t[1]] = $t[1];
272 /* Installed themes */
273 $theme_choices = array();
274 $files = glob('view/theme/*');
276 foreach($files as $file) {
277 $f = basename($file);
278 $theme_name = ((file_exists($file . '/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
279 $theme_choices[$f] = $theme_name;
285 $banner = get_config('system','banner');
287 $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>';
288 $banner = htmlspecialchars($banner);
290 //echo "<pre>"; var_dump($lang_choices); die("</pre>");
292 /* Register policy */
293 $register_choices = Array(
294 REGISTER_CLOSED => t("Closed"),
295 REGISTER_APPROVE => t("Requires approval"),
296 REGISTER_OPEN => t("Open")
299 $t = get_markup_template("admin_site.tpl");
300 return replace_macros($t, array(
301 '$title' => t('Administration'),
302 '$page' => t('Site'),
303 '$submit' => t('Submit'),
304 '$registration' => t('Registration'),
305 '$upload' => t('File upload'),
306 '$corporate' => t('Policies'),
307 '$advanced' => t('Advanced'),
309 '$baseurl' => $a->get_baseurl(),
310 // name, label, value, help string, extra data...
311 '$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""),
312 '$banner' => array('banner', t("Banner/Logo"), $banner, ""),
313 '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
314 '$theme' => array('theme', t("System theme"), get_config('system','theme'), "Default system theme (which may be over-ridden by user profiles)", $theme_choices),
316 '$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."),
318 '$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices),
319 '$register_text' => array('register_text', t("Register text"), htmlentities($a->config['register_text'], ENT_QUOTES), "Will be displayed prominently on the registration page."),
320 '$abandon_days' => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')),
321 '$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"),
322 '$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"),
323 '$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."),
324 '$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."),
325 '$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."),
327 '$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."),
328 '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), "OpenID support for registration and logins."),
329 '$no_gravatar' => array('no_gravatar', t("Gravatar support"), !get_config('system','no_gravatar'), "Search new user's photo on Gravatar."),
330 '$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), "Force users to register with a space between firstname and lastname in Full name, as an antispam measure"),
331 '$no_utf' => array('no_utf', t("UTF-8 Regular expressions"), !get_config('system','no_utf'), "Use PHP UTF8 regular expressions"),
332 '$no_community_page' => array('no_community_page', t("Show Community Page"), !get_config('system','no_community_page'), "Display a Community page showing all recent public postings on this site."),
333 '$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disable'), "Provide built-in OStatus \x28identi.ca, status.net, etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed."),
334 '$diaspora_enabled' => array('diaspora_enabled', t("Enable Diaspora support"), get_config('system','diaspora_enabled'), "Provide built-in Diaspora network compatibility."),
335 '$dfrn_only' => array('dfrn_only', t('Only allow Friendica contacts'), get_config('system','dfrn_only'), "All contacts must use Friendica protocols. All other built-in communication protocols disabled."),
336 '$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."),
337 '$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
338 '$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
339 '$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)."),
350 function admin_page_users_post(&$a){
351 $pending = ( x($_POST, 'pending') ? $_POST['pending'] : Array() );
352 $users = ( x($_POST, 'user') ? $_POST['user'] : Array() );
354 if (x($_POST,'page_users_block')){
355 foreach($users as $uid){
356 q("UPDATE `user` SET `blocked`=1-`blocked` WHERE `uid`=%s",
360 notice( sprintf( tt("%s user blocked", "%s users blocked/unblocked", count($users)), count($users)) );
362 if (x($_POST,'page_users_delete')){
363 require_once("include/Contact.php");
364 foreach($users as $uid){
367 notice( sprintf( tt("%s user deleted", "%s users deleted", count($users)), count($users)) );
370 if (x($_POST,'page_users_approve')){
371 require_once("mod/regmod.php");
372 foreach($pending as $hash){
376 if (x($_POST,'page_users_deny')){
377 require_once("mod/regmod.php");
378 foreach($pending as $hash){
382 goaway($a->get_baseurl() . '/admin/users' );
383 return; // NOTREACHED
386 function admin_page_users(&$a){
389 $user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid));
390 if (count($user)==0){
391 notice( 'User not found' . EOL);
392 goaway($a->get_baseurl() . '/admin/users' );
393 return; // NOTREACHED
398 require_once("include/Contact.php");
401 notice( sprintf(t("User '%s' deleted"), $user[0]['username']) . EOL);
404 q("UPDATE `user` SET `blocked`=%d WHERE `uid`=%s",
405 intval( 1-$user[0]['blocked'] ),
408 notice( sprintf( ($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']) . EOL);
411 goaway($a->get_baseurl() . '/admin/users' );
412 return; // NOTREACHED
417 $pending = q("SELECT `register`.*, `contact`.`name`, `user`.`email`
419 LEFT JOIN `contact` ON `register`.`uid` = `contact`.`uid`
420 LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;");
424 $total = q("SELECT count(*) as total FROM `user` where 1");
426 $a->set_pager_total($total[0]['total']);
427 $a->set_pager_itemspage(100);
430 $users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`
432 (SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
434 WHERE `item`.`type` = 'wall'
435 GROUP BY `item`.`uid`) AS `lastitem`
436 RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`,
439 `user`.`uid` = `contact`.`uid`
440 AND `user`.`verified` =1
441 AND `contact`.`self` =1
442 ORDER BY `contact`.`name` LIMIT %d, %d
444 intval($a->pager['start']),
445 intval($a->pager['itemspage'])
448 function _setup_users($e){
451 t('Soapbox Account'),
452 t('Community/Celebrity Account'),
453 t('Automatic Friend Account')
455 $e['page-flags'] = $accounts[$e['page-flags']];
456 $e['register_date'] = relative_date($e['register_date']);
457 $e['login_date'] = relative_date($e['login_date']);
458 $e['lastitem_date'] = relative_date($e['lastitem_date']);
461 $users = array_map("_setup_users", $users);
463 $t = get_markup_template("admin_users.tpl");
464 $o = replace_macros($t, array(
466 '$title' => t('Administration'),
467 '$page' => t('Users'),
468 '$submit' => t('Submit'),
469 '$select_all' => t('select all'),
470 '$h_pending' => t('User registrations waiting for confirm'),
471 '$th_pending' => array( t('Request date'), t('Name'), t('Email') ),
472 '$no_pending' => t('No registrations.'),
473 '$approve' => t('Approve'),
474 '$deny' => t('Deny'),
475 '$delete' => t('Delete'),
476 '$block' => t('Block'),
477 '$unblock' => t('Unblock'),
479 '$h_users' => t('Users'),
480 '$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account') ),
482 '$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?'),
483 '$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?'),
487 '$baseurl' => $a->get_baseurl(),
489 '$pending' => $pending,
501 function admin_page_plugins(&$a){
507 $plugin = $a->argv[2];
508 if (!is_file("addon/$plugin/$plugin.php")){
509 notice( t("Item not found.") );
513 if (x($_GET,"a") && $_GET['a']=="t"){
514 // Toggle plugin status
515 $idx = array_search($plugin, $a->plugins);
517 unset($a->plugins[$idx]);
518 uninstall_plugin($plugin);
519 info( sprintf( t("Plugin %s disabled."), $plugin ) );
521 $a->plugins[] = $plugin;
522 install_plugin($plugin);
523 info( sprintf( t("Plugin %s enabled."), $plugin ) );
525 set_config("system","addon", implode(", ",$a->plugins));
526 goaway($a->get_baseurl() . '/admin/plugins' );
527 return; // NOTREACHED
529 // display plugin details
530 require_once('library/markdown.php');
532 if (in_array($plugin, $a->plugins)){
533 $status="on"; $action= t("Disable");
535 $status="off"; $action= t("Enable");
539 if (is_file("addon/$plugin/README.md")){
540 $readme = file_get_contents("addon/$plugin/README.md");
541 $readme = Markdown($readme);
542 } else if (is_file("addon/$plugin/README")){
543 $readme = "<pre>". file_get_contents("addon/$plugin/README") ."</pre>";
547 if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)){
548 @require_once("addon/$plugin/$plugin.php");
549 $func = $plugin.'_plugin_admin';
550 $func($a, $admin_form);
553 $t = get_markup_template("admin_plugins_details.tpl");
554 return replace_macros($t, array(
555 '$title' => t('Administration'),
556 '$page' => t('Plugins'),
557 '$toggle' => t('Toggle'),
558 '$settings' => t('Settings'),
559 '$baseurl' => $a->get_baseurl(),
561 '$plugin' => $plugin,
562 '$status' => $status,
563 '$action' => $action,
564 '$info' => get_plugin_info($plugin),
566 '$admin_form' => $admin_form,
579 $files = glob("addon/*/");
581 foreach($files as $file) {
583 list($tmp, $id)=array_map("trim", explode("/",$file));
584 $info = get_plugin_info($id);
585 $plugins[] = array( $id, (in_array($id, $a->plugins)?"on":"off") , $info);
590 $t = get_markup_template("admin_plugins.tpl");
591 return replace_macros($t, array(
592 '$title' => t('Administration'),
593 '$page' => t('Plugins'),
594 '$submit' => t('Submit'),
595 '$baseurl' => $a->get_baseurl(),
597 '$plugins' => $plugins
606 function admin_page_logs_post(&$a) {
607 if (x($_POST,"page_logs")) {
609 $logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
610 $debugging = ((x($_POST,'debugging')) ? true : false);
611 $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
613 set_config('system','logfile', $logfile);
614 set_config('system','debugging', $debugging);
615 set_config('system','loglevel', $loglevel);
620 info( t("Log settings updated.") );
621 goaway($a->get_baseurl() . '/admin/logs' );
622 return; // NOTREACHED
625 function admin_page_logs(&$a){
627 $log_choices = Array(
628 LOGGER_NORMAL => 'Normal',
629 LOGGER_TRACE => 'Trace',
630 LOGGER_DEBUG => 'Debug',
631 LOGGER_DATA => 'Data',
635 $t = get_markup_template("admin_logs.tpl");
637 $f = get_config('system','logfile');
641 if(!file_exists($f)) {
642 $data = t("Error trying to open <strong>$f</strong> log file.\r\n<br/>Check to see if file $f exist and is
646 $fp = fopen($f, 'r');
648 $data = t("Couldn't open <strong>$f</strong> log file.\r\n<br/>Check to see if file $f is readable.");
652 $size = $fstat['size'];
655 if($size > 5000000 || $size < 0)
657 $seek = fseek($fp,0-$size,SEEK_END);
659 fgets($fp); // throw away the first partial line
660 $data = escape_tags(fread($fp,$size));
662 $data .= escape_tags(fread($fp,4096));
669 return replace_macros($t, array(
670 '$title' => t('Administration'),
671 '$page' => t('Logs'),
672 '$submit' => t('Submit'),
673 '$clear' => t('Clear'),
675 '$baseurl' => $a->get_baseurl(),
676 '$logname' => get_config('system','logfile'),
678 // name, label, value, help string, extra data...
679 '$debugging' => array('debugging', t("Debugging"),get_config('system','debugging'), ""),
680 '$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
681 '$loglevel' => array('loglevel', t("Log level"), get_config('system','loglevel'), "", $log_choices),
685 function admin_page_remoteupdate_post(&$a) {
686 // this function should be called via ajax post
687 if(!is_site_admin()) {
692 if (x($_POST,'remotefile') && $_POST['remotefile']!=""){
693 $remotefile = $_POST['remotefile'];
694 $ftpdata = (x($_POST['ftphost'])?$_POST:false);
695 doUpdate($remotefile, $ftpdata);
697 echo "No remote file to download. Abort!";
703 function admin_page_remoteupdate(&$a) {
704 if(!is_site_admin()) {
708 $canwrite = canWeWrite();
709 $canftp = function_exists('ftp_connect');
715 $u = array('','','');
718 $tpl = get_markup_template("admin_remoteupdate.tpl");
719 return replace_macros($tpl, array(
720 '$baseurl' => $a->get_baseurl(),
721 '$submit' => t("Update now"),
722 '$close' => t("Close"),
723 '$localversion' => FRIENDICA_VERSION,
724 '$remoteversion' => $u[1],
725 '$needupdate' => $needupdate,
726 '$canwrite' => $canwrite,
727 '$canftp' => $canftp,
728 '$ftphost' => array('ftphost', t("FTP Host"), '',''),
729 '$ftppath' => array('ftppath', t("FTP Path"), '/',''),
730 '$ftpuser' => array('ftpuser', t("FTP User"), '',''),
731 '$ftppwd' => array('ftppwd', t("FTP Password"), '',''),
732 '$remotefile'=>array('remotefile','', $u['2'],'')