diff --git a/cron.php b/cron.php
index c803c98..8de1090 100644
--- a/cron.php
+++ b/cron.php
@@ -1,8 +1,10 @@
getConf('db_name'), $this->getConf('db_user'), $this->getConf('db_pass'));
+ $db = new PDO(
+ $this->getConf('db_name'),
+ $this->getConf('db_user'),
+ $this->getConf('db_pass')
+ );
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
@@ -273,7 +277,9 @@ class helper_plugin_pluginrepo_repository extends Plugin
} else {
[$bundledINsql, $bundledINvalues] = $this->prepareINstmt('bundled', $this->bundled);
- $where_filtered = "'" . $this->obsoleteTag . "' NOT IN(SELECT tag FROM plugin_tags WHERE plugin_tags.plugin = A.plugin)"
+ $where_filtered = "'" . $this->obsoleteTag . "' NOT IN(SELECT tag
+ FROM plugin_tags
+ WHERE plugin_tags.plugin = A.plugin)"
. " AND A.securityissue = ''"
. " AND (A.downloadurl <> '' OR A.plugin " . $bundledINsql . ")";
$values = $bundledINvalues;
@@ -294,48 +300,48 @@ class helper_plugin_pluginrepo_repository extends Plugin
if ($type < 1 || $type > $alltypes) {
$type = $alltypes; //all types
}
- $sql = " SELECT A.*, SUBSTR(A.plugin,10) as simplename
- FROM plugins A
- WHERE A.type = 32 AND $where_filtered
- AND (A.type & :plugin_type)
- AND :plugin_tag IN(SELECT tag FROM plugin_tags WHERE plugin_tags.plugin = A.plugin)
- UNION
- SELECT A.*, A.plugin as simplename
- FROM plugins A
- WHERE A.type <> 32 AND $where_filtered
- AND (A.type & :plugin_type)
- AND :plugin_tag IN(SELECT tag FROM plugin_tags WHERE plugin_tags.plugin = A.plugin)
- $sortsql";
+ $sql = "SELECT A.*, SUBSTR(A.plugin,10) as simplename
+ FROM plugins A
+ WHERE A.type = 32 AND $where_filtered
+ AND (A.type & :plugin_type)
+ AND :plugin_tag IN(SELECT tag FROM plugin_tags WHERE plugin_tags.plugin = A.plugin)
+ UNION
+ SELECT A.*, A.plugin as simplename
+ FROM plugins A
+ WHERE A.type <> 32 AND $where_filtered
+ AND (A.type & :plugin_type)
+ AND :plugin_tag IN(SELECT tag FROM plugin_tags WHERE plugin_tags.plugin = A.plugin)
+ $sortsql";
$values = array_merge(
[':plugin_tag' => $tag, ':plugin_type' => $type],
$values
);
} elseif ($type > 0 && $type <= $alltypes) {
- $sql = " SELECT A.*, SUBSTR(A.plugin,10) as simplename
- FROM plugins A
- WHERE A.type = 32 AND $where_filtered
- AND (A.type & :plugin_type)
- UNION
- SELECT A.*, A.plugin as simplename
- FROM plugins A
- WHERE A.type <> 32 AND $where_filtered
- AND (A.type & :plugin_type)
- $sortsql";
+ $sql = "SELECT A.*, SUBSTR(A.plugin,10) as simplename
+ FROM plugins A
+ WHERE A.type = 32 AND $where_filtered
+ AND (A.type & :plugin_type)
+ UNION
+ SELECT A.*, A.plugin as simplename
+ FROM plugins A
+ WHERE A.type <> 32 AND $where_filtered
+ AND (A.type & :plugin_type)
+ $sortsql";
$values = array_merge(
[':plugin_type' => $type],
$values
);
} else {
- $sql = " SELECT A.*, SUBSTR(A.plugin,10) as simplename
- FROM plugins A
- WHERE A.type = 32 AND $where_filtered
- $where_requested
- UNION
- SELECT A.*, A.plugin as simplename
- FROM plugins A
- WHERE A.type <> 32 AND $where_filtered
- $where_requested
- $sortsql";
+ $sql = "SELECT A.*, SUBSTR(A.plugin,10) as simplename
+ FROM plugins A
+ WHERE A.type = 32 AND $where_filtered
+ $where_requested
+ UNION
+ SELECT A.*, A.plugin as simplename
+ FROM plugins A
+ WHERE A.type <> 32 AND $where_filtered
+ $where_requested
+ $sortsql";
$values = array_merge(
$requestedINvalues,
@@ -563,7 +569,8 @@ class helper_plugin_pluginrepo_repository extends Plugin
$plugins[$i]['thumbnailurl'] = null;
} else {
$plugins[$i]['screenshoturl'] = ml($plugins[$i]['screenshot'], '', true, '&', true);
- $plugins[$i]['thumbnailurl'] = ml($plugins[$i]['screenshot'], ['w' => 120, 'h' => 70], true, '&', true);
+ $size = ['w' => 120, 'h' => 70];
+ $plugins[$i]['thumbnailurl'] = ml($plugins[$i]['screenshot'], $size, true, '&', true);
}
unset($plugins[$i]['screenshot']);
unset($plugins[$i]['email']); // no spam
@@ -728,7 +735,9 @@ class helper_plugin_pluginrepo_repository extends Plugin
if ($filter['showall']) {
$shown = "1";
} else {
- $shown = "'" . $this->obsoleteTag . "' NOT IN(SELECT tag FROM plugin_tags WHERE plugin_tags.plugin = B.plugin)
+ $shown = "'" . $this->obsoleteTag . "' NOT IN(SELECT tag
+ FROM plugin_tags
+ WHERE plugin_tags.plugin = B.plugin)
AND B.securityissue = ''";
}
if ($filter['plugintype'] == 32) {
@@ -814,19 +823,24 @@ class helper_plugin_pluginrepo_repository extends Plugin
}
/** @var PDOStatement $stmt */
- $stmt = $db->prepare('DELETE FROM plugins WHERE plugin = ?');
+ $stmt = $db->prepare('DELETE FROM plugins
+ WHERE plugin = ?');
$stmt->execute([$plugin]);
- $stmt = $db->prepare('DELETE FROM plugin_tags WHERE plugin = ?');
+ $stmt = $db->prepare('DELETE FROM plugin_tags
+ WHERE plugin = ?');
$stmt->execute([$plugin]);
- $stmt = $db->prepare('DELETE FROM plugin_similar WHERE plugin = ? OR other = ?');
+ $stmt = $db->prepare('DELETE FROM plugin_similar
+ WHERE plugin = ? OR other = ?');
$stmt->execute([$plugin, $plugin]);
- $stmt = $db->prepare('DELETE FROM plugin_conflicts WHERE plugin = ? OR other = ?');
+ $stmt = $db->prepare('DELETE FROM plugin_conflicts
+ WHERE plugin = ? OR other = ?');
$stmt->execute([$plugin, $plugin]);
- $stmt = $db->prepare('DELETE FROM plugin_depends WHERE plugin = ? OR other = ?');
+ $stmt = $db->prepare('DELETE FROM plugin_depends
+ WHERE plugin = ? OR other = ?');
$stmt->execute([$plugin, $plugin]);
}
@@ -863,7 +877,7 @@ class helper_plugin_pluginrepo_repository extends Plugin
$releases = array_map('trim', $releases);
$releases = array_filter($releases);
foreach ($releases as $release) {
- [$date, $name] = array_pad(preg_split('/(\s+"\s*|")/', $release),2, '');
+ [$date, $name] = array_pad(preg_split('/(\s+"\s*|")/', $release), 2, '');
$name = strtolower($name);
$rel = [
'date' => $date,
@@ -1074,7 +1088,8 @@ class helper_plugin_pluginrepo_repository extends Plugin
$db->exec('CREATE TABLE plugin_depends (plugin varchar(50) NOT NULL, other varchar(50) NOT NULL);');
$db->exec('CREATE TABLE plugin_similar (plugin varchar(50) NOT NULL, other varchar(50) NOT NULL);');
$db->exec('CREATE TABLE plugin_tags (plugin varchar(50) NOT NULL, tag varchar(255) NOT NULL);');
- $db->exec('CREATE TABLE plugins (plugin varchar(50) PRIMARY KEY NOT NULL, name varchar(255) default NULL,
+ $db->exec('CREATE TABLE plugins (
+ plugin varchar(50) PRIMARY KEY NOT NULL, name varchar(255) default NULL,
description varchar(255) default NULL, author varchar(255) default NULL, email varchar(255) default NULL,
compatible varchar(255) default NULL, lastupdate date default NULL, downloadurl varchar(255) default NULL,
bugtracker varchar(255) default NULL, sourcerepo varchar(255) default NULL,
@@ -1082,8 +1097,7 @@ class helper_plugin_pluginrepo_repository extends Plugin
screenshot varchar(255) default NULL, tags varchar(255) default NULL,
securitywarning varchar(255) default NULL, securityissue varchar(255) NOT NULL,
bestcompatible varchar(50) default NULL, popularity int default 0,
- updatemessage varchar(50) default NULL);'
- );
+ updatemessage varchar(50) default NULL);');
}
/**
diff --git a/popularity.php b/popularity.php
index 740550a..f1e1bfe 100644
--- a/popularity.php
+++ b/popularity.php
@@ -11,18 +11,18 @@
* Parameters:
* - output: rss, pie, line, table(default)
* - key: submitted fields by popularity plugin (required)
- * e.g. page_size, media_size, webserver, php_version, attic_avg, attic_biggest, attic_count, attic_oldest,
- * attic_size, attic_smallest, cache_avg, cache_biggest, cache_count, cache_size, cache_smallest, conf_authtype,
- * conf_template, conf_useacl, edits_per_day, index_avg, index_biggest, index_count, index_size, index_smallest,
- * language, media_avg, media_biggest, media_count, media_nscount, media_nsnest, media_smallest, meta_avg,
- * meta_biggest, meta_count, meta_size, meta_smallest, now, os, page_avg, page_biggest, page_count,
- * page_nscount, page_nsnest, page_oldest, page_smallest, pcre_backtrack, pcre_recursion, pcre_version,
- * php_exectime, php_extension, php_memory, php_sapi, plugin, popauto, popversion, user_count
+ * e.g. page_size, media_size, webserver, php_version, attic_avg, attic_biggest, attic_count, attic_oldest,
+ * attic_size, attic_smallest, cache_avg, cache_biggest, cache_count, cache_size, cache_smallest, conf_authtype,
+ * conf_template, conf_useacl, edits_per_day, index_avg, index_biggest, index_count, index_size, index_smallest,
+ * language, media_avg, media_biggest, media_count, media_nscount, media_nsnest, media_smallest, meta_avg,
+ * meta_biggest, meta_count, meta_size, meta_smallest, now, os, page_avg, page_biggest, page_count,
+ * page_nscount, page_nsnest, page_oldest, page_smallest, pcre_backtrack, pcre_recursion, pcre_version,
+ * php_exectime, php_extension, php_memory, php_sapi, plugin, popauto, popversion, user_count
* - limit: number of results shown, when more the rest is summarized as 'other'. -1 shows all results (default 5)
* - w: image width (only charts, default 450px)
* - h: image height (only charts, default 180px)
* - o: ordered by 'cnt' for counts (default) or 'val' for values ('val' is only default for line chart)
- * - p: if true use percentages(default), otherwise absolute numbers (absolute numbers is only default for line chart)
+ * - p: if true use percentages(default), otherwise absolute numbers (absolute is only default for line chart)
* - s: (optional) start date, show only submits after this date
* - e: (optional) end date, when start date set, show only until this date
* - d: (optional) when no start date set, shows the submits of last d days
@@ -204,7 +204,7 @@ function buildUnencodedURLparams($params, $sep = '&')
$amp = true;
}
return $url;
-};
+}
/**
* Format the number, as percentage or number
diff --git a/repository.php b/repository.php
index 8525774..30eeda1 100644
--- a/repository.php
+++ b/repository.php
@@ -119,7 +119,8 @@ function getRepository()
} else {
$feed .= '
'; - $R->doc .= $this->getLang('t_searchintro_' . noNS($ID)); - $R->doc .= '
'; - - $R->doc .= ''; + $intro = $this->getLang('t_searchintro_' . noNS($ID)); + $url = wl(); + $R->doc .= << + $intro + + + HTML; } /** @@ -262,7 +265,7 @@ class syntax_plugin_pluginrepo_table extends SyntaxPlugin } $min = $tag['cnt']; } - $this->cloud_weight($tags, $min, $max, 5); + $this->cloudWeight($tags, $min, $max, 5); ksort($tags); if (count($tags) > 0) { @@ -284,7 +287,7 @@ class syntax_plugin_pluginrepo_table extends SyntaxPlugin * @param int $max * @param int $levels */ - public function cloud_weight(&$tags, $min, $max, $levels) + public function cloudWeight(&$tags, $min, $max, $levels) { // calculate tresholds $tresholds = [];