]> git.mxchange.org Git - friendica.git/blob - include/directory.php
Merge pull request #2471 from annando/1604-diaspora-always-on
[friendica.git] / include / directory.php
1 <?php
2 require_once("boot.php");
3
4 function directory_run(&$argv, &$argc){
5         global $a, $db;
6
7         if(is_null($a)) {
8                 $a = new App;
9         }
10
11         if(is_null($db)) {
12                 @include(".htconfig.php");
13                 require_once("include/dba.php");
14                 $db = new dba($db_host, $db_user, $db_pass, $db_data);
15                                 unset($db_host, $db_user, $db_pass, $db_data);
16         };
17
18         load_config('config');
19         load_config('system');
20
21
22         if($argc != 2)
23                 return;
24
25         load_config('system');
26
27         load_hooks();
28
29
30         $a->set_baseurl(get_config('system','url'));
31
32         $dir = get_config('system','directory');
33
34         if(! strlen($dir))
35                 return;
36
37         $dir .= "/submit";
38
39         $arr = array('url' => $argv[1]);
40
41         call_hooks('globaldir_update', $arr);
42
43         logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
44         if(strlen($arr['url']))
45                 fetch_url($dir . '?url=' . bin2hex($arr['url']));
46
47         return;
48 }
49
50 if (array_search(__file__,get_included_files())===0){
51   directory_run($_SERVER["argv"],$_SERVER["argc"]);
52   killme();
53 }