define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1328' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1140 );
+define ( 'DB_UPDATE_VERSION', 1141 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
return false;
}
+function zrl_init(&$a) {
+ proc_run('php','include/gprobe.php',bin2hex(get_my_url()));
+ $arr = array('zrl' => get_my_url(), 'url' => $a->cmd);
+ call_hooks('zrl_init',$arr);
+}
+
function zrl($s,$force = false) {
if(! strlen($s))
return $s;
`name` char(255) NOT NULL,
`version` char(255) NOT NULL,
`installed` tinyint(1) NOT NULL DEFAULT '0',
+ `hidden` tinyint(1) NOT NULL DEFAULT '0',
`timestamp` bigint(20) NOT NULL DEFAULT '0',
`plugin_admin` tinyint(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ KEY `hidden` (`hidden`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--- /dev/null
+<?php
+
+require_once("boot.php");
+require_once('include/Scrape.php');
+
+function gprobe_run($argv, $argc){
+ global $a, $db;
+
+ if(is_null($a)) {
+ $a = new App;
+ }
+
+ if(is_null($db)) {
+ @include(".htconfig.php");
+ require_once("dba.php");
+ $db = new dba($db_host, $db_user, $db_pass, $db_data);
+ unset($db_host, $db_user, $db_pass, $db_data);
+ };
+
+ require_once('include/session.php');
+ require_once('include/datetime.php');
+
+ load_config('config');
+ load_config('system');
+
+ $a->set_baseurl(get_config('system','url'));
+
+ load_hooks();
+
+ if($argc != 2)
+ return;
+
+ $url = hex2bin($argv[1]);
+
+ $r = q("select * from gcontact where nurl = '%s' limit 1",
+ dbesc(normalise_link($url))
+ );
+
+ if(count($r))
+ return;
+
+ $arr = probe_url($url);
+
+ if(count($arr) && x($arr,'network') && $arr['network'] === NETWORK_DFRN) {
+ q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`)
+ values ( '%s', '%s', '%s', '%s') ",
+ dbesc($arr['name']),
+ dbesc($arr['url']),
+ dbesc(normalise_link($arr['url'])),
+ dbesc($arr['photo'])
+ );
+ }
+
+ return;
+}
+
+if (array_search(__file__,get_included_files())===0){
+ gprobe_run($argv,$argc);
+ killme();
+}
if (! function_exists('uninstall_plugin')){
function uninstall_plugin($plugin){
logger("Addons: uninstalling " . $plugin);
- q("DELETE FROM `addon` WHERE `name` = '%s' LIMIT 1",
+ q("DELETE FROM `addon` WHERE `name` = '%s' ",
dbesc($plugin)
);
intval($t),
$plugin_admin
);
+
+ // we can add the following with the previous SQL
+ // once most site tables have been updated.
+ // This way the system won't fall over dead during the update.
+
+ if(file_exists('addon/' . $plugin . '/.hidden')) {
+ q("update addon set hidden = 1 where name = '%s' limit 1",
+ dbesc($plugin)
+ );
+ }
return true;
}
else {
load_translation_table($lang);
}
-if(x($_GET,'zrl')) {
+if((x($_GET,'zrl')) && (! $install)) {
$_SESSION['my_url'] = $_GET['zrl'];
$a->query_string = preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is','',$a->query_string);
- if(! $install) {
- $arr = array('zrl' => $_SESSION['my_url'], 'url' => $a->cmd);
- call_hooks('zrl_init',$arr);
- }
+ zrl_init($a);
}
/**
$admin = false;
}
+ $visible_plugins = array();
+ if(is_array($a->plugins) && count($a->plugins)) {
+ $r = q("select * from addon where hidden = 0");
+ if(count($r))
+ foreach($r as $rr)
+ $visible_plugins[] = $rr['name'];
+ }
+
$data = Array(
'version' => FRIENDICA_VERSION,
'url' => z_root(),
- 'plugins' => $a->plugins,
+ 'plugins' => $visible_plugins,
'register_policy' => $register_policy[$a->config['register_policy']],
'admin' => $admin,
'site_name' => $a->config['sitename'],
$o .= '<p></p>';
- if(count($a->plugins)) {
+ $visible_plugins = array();
+ if(is_array($a->plugins) && count($a->plugins)) {
+ $r = q("select * from addon where hidden = 0");
+ if(count($r))
+ foreach($r as $rr)
+ $visible_plugins[] = $rr['name'];
+ }
+
+
+ if(count($visible_plugins)) {
$o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
- $sorted = $a->plugins;
+ $sorted = $visible_plugins;
$s = '';
sort($sorted);
foreach($sorted as $p) {
<?php
-define( 'UPDATE_VERSION' , 1140 );
+define( 'UPDATE_VERSION' , 1141 );
/**
*
return UPDATE_FAILED ;
return UPDATE_SUCCESS ;
}
+
+function update_1140() {
+ $r = q("alter table addon add hidden tinyint(1) not null default '0' after installed, add index(hidden) ");
+ if(! $r)
+ return UPDATE_FAILED ;
+ return UPDATE_SUCCESS ;
+}
\ No newline at end of file