]> git.mxchange.org Git - friendica.git/blob - include/directory.php
Break out list of acceptable protocols in "src" attribute into separate variable...
[friendica.git] / include / directory.php
1 <?php
2 require_once("boot.php");
3
4 use \Friendica\Core\Config;
5
6 function directory_run(&$argv, &$argc){
7         global $a, $db;
8
9         if(is_null($a)) {
10                 $a = new App;
11         }
12
13         if(is_null($db)) {
14                 @include(".htconfig.php");
15                 require_once("include/dba.php");
16                 $db = new dba($db_host, $db_user, $db_pass, $db_data);
17                                 unset($db_host, $db_user, $db_pass, $db_data);
18         };
19
20         Config::load();
21
22         if($argc != 2)
23                 return;
24
25         load_hooks();
26
27
28         $a->set_baseurl(get_config('system','url'));
29
30         $dir = get_config('system','directory');
31
32         if(! strlen($dir))
33                 return;
34
35         $dir .= "/submit";
36
37         $arr = array('url' => $argv[1]);
38
39         call_hooks('globaldir_update', $arr);
40
41         logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
42         if(strlen($arr['url']))
43                 fetch_url($dir . '?url=' . bin2hex($arr['url']));
44
45         return;
46 }
47
48 if (array_search(__file__,get_included_files())===0){
49   directory_run($_SERVER["argv"],$_SERVER["argc"]);
50   killme();
51 }