mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 20:21:37 +00:00
Empty commit
This commit is contained in:
parent
55300ee9e9
commit
a7298a44cd
@ -5,7 +5,7 @@
|
|||||||
"sfv","md5","accurip","ffp","pdf");
|
"sfv","md5","accurip","ffp","pdf");
|
||||||
|
|
||||||
$ebooks_extensions = array("pdf", "nfo", "sfv", "mobi", "epub", "txt", "htm", "html", "lit",
|
$ebooks_extensions = array("pdf", "nfo", "sfv", "mobi", "epub", "txt", "htm", "html", "lit",
|
||||||
"chm", "rtf", "doc", "jpg","jpeg","png","gif");
|
"chm", "rtf", "doc", "djv", "djvu", "jpg","jpeg","png","gif");
|
||||||
|
|
||||||
$comics_extensions = array("cbr", "cbz", "pdf", "jpg","jpeg","png","gif");
|
$comics_extensions = array("cbr", "cbz", "pdf", "jpg","jpeg","png","gif");
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ function check_imagehost($url) {
|
|||||||
global $blacklist;
|
global $blacklist;
|
||||||
|
|
||||||
foreach ($blacklist as &$value) {
|
foreach ($blacklist as &$value) {
|
||||||
if(contains(strtolower($url), $value)) {
|
if(strpos(strtolower($url), $value)) {
|
||||||
$parsed_url = parse_url($url);
|
$parsed_url = parse_url($url);
|
||||||
error($parsed_url['host'] . " is not an allowed imagehost. Please use a different imagehost.");
|
error($parsed_url['host'] . " is not an allowed imagehost. Please use a different imagehost.");
|
||||||
break;
|
break;
|
||||||
|
@ -1127,11 +1127,27 @@ function display_array($Array, $Escape = array()) {
|
|||||||
function sanitize_tag($str) {
|
function sanitize_tag($str) {
|
||||||
$str = strtolower($str);
|
$str = strtolower($str);
|
||||||
$str = preg_replace('/[^a-z0-9.]/', '', $str);
|
$str = preg_replace('/[^a-z0-9.]/', '', $str);
|
||||||
|
$str = preg_replace('/(^[.,]*)|([.,]*$)/','',$str);
|
||||||
$str = htmlspecialchars($str);
|
$str = htmlspecialchars($str);
|
||||||
$str = db_string(trim($str));
|
$str = db_string(trim($str));
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the alias of the tag, if there is no alias silently returns the original tag.
|
||||||
|
* @return the tag
|
||||||
|
*/
|
||||||
|
function get_alias_tag($str) {
|
||||||
|
global $DB;
|
||||||
|
$DB->query("SELECT AliasTag FROM tag_aliases WHERE BadTag = '". $str ."' LIMIT 1");
|
||||||
|
if($DB->record_count() > 0) {
|
||||||
|
list($AliasTag) = $DB->next_record();
|
||||||
|
return $AliasTag;
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
// Generate a random string
|
// Generate a random string
|
||||||
function make_secret($Length = 32) {
|
function make_secret($Length = 32) {
|
||||||
$Secret = '';
|
$Secret = '';
|
||||||
|
15
gazelle.sql
15
gazelle.sql
@ -801,6 +801,21 @@ CREATE TABLE `stylesheets` (
|
|||||||
PRIMARY KEY (`ID`)
|
PRIMARY KEY (`ID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
|
CREATE TABLE `subscribed_users` (
|
||||||
|
`UserID` int(10) NOT NULL,
|
||||||
|
`SubscriberID` int(10) NOT NULL,
|
||||||
|
PRIMARY KEY (`UserID`,`SubscriberID`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
|
CREATE TABLE `tag_aliases` (
|
||||||
|
`ID` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`BadTag` varchar(22) COLLATE utf8_bin NOT NULL,
|
||||||
|
`AliasTag` varchar(22) COLLATE utf8_bin NOT NULL,
|
||||||
|
PRIMARY KEY (`ID`),
|
||||||
|
KEY `BadTag` (`BadTag`),
|
||||||
|
KEY `AliasTag` (`AliasTag`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
CREATE TABLE `tags` (
|
CREATE TABLE `tags` (
|
||||||
`ID` int(10) NOT NULL AUTO_INCREMENT,
|
`ID` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
`Name` varchar(100) COLLATE utf8_bin DEFAULT NULL,
|
`Name` varchar(100) COLLATE utf8_bin DEFAULT NULL,
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
if(empty($_POST['image'])) {
|
if(empty($_POST['image'])) {
|
||||||
$Image = "";
|
$Image = "";
|
||||||
} else {
|
} else {
|
||||||
check_imagehost($Image);
|
check_imagehost($_POST['image']);
|
||||||
if(preg_match("/".IMAGE_REGEX."/", trim($_POST['image'])) > 0) {
|
if(preg_match("/".IMAGE_REGEX."/", trim($_POST['image'])) > 0) {
|
||||||
$Image = trim($_POST['image']);
|
$Image = trim($_POST['image']);
|
||||||
} else {
|
} else {
|
||||||
|
@ -158,7 +158,10 @@
|
|||||||
include('managers/official_tags.php');
|
include('managers/official_tags.php');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'permissions':
|
case 'tag_aliases':
|
||||||
|
include('managers/tag_aliases.php');
|
||||||
|
break;
|
||||||
|
case 'permissions':
|
||||||
if (!check_perms('admin_manage_permissions')) { error(403); }
|
if (!check_perms('admin_manage_permissions')) { error(403); }
|
||||||
|
|
||||||
if (!empty($_REQUEST['id'])) {
|
if (!empty($_REQUEST['id'])) {
|
||||||
|
82
sections/tools/managers/tag_aliases.php
Normal file
82
sections/tools/managers/tag_aliases.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
if (!check_perms('users_mod')) { error(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
show_header('Tag Aliases');
|
||||||
|
|
||||||
|
$orderby = ($_GET['order']) == "badtags" ? "BadTag" : "AliasTag";
|
||||||
|
|
||||||
|
if (isset($_POST['newalias'])) {
|
||||||
|
$badtag = mysql_escape_string($_POST['badtag']);
|
||||||
|
$aliastag = mysql_escape_string($_POST['aliastag']);
|
||||||
|
|
||||||
|
$DB -> query("INSERT INTO tag_aliases (BadTag, AliasTag) VALUES ('$badtag', '$aliastag')");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['changealias'])) {
|
||||||
|
$aliasid = $_POST['aliasid'];
|
||||||
|
$badtag = mysql_escape_string($_POST['badtag']);
|
||||||
|
$aliastag = mysql_escape_string($_POST['aliastag']);
|
||||||
|
|
||||||
|
if ($_POST['save']) {
|
||||||
|
$DB -> query("UPDATE tag_aliases SET BadTag = '$badtag', AliasTag = '$aliastag' WHERE ID = '$aliasid' ");
|
||||||
|
}
|
||||||
|
if ($_POST['delete']) {
|
||||||
|
$DB -> query("DELETE FROM tag_aliases WHERE ID = '$aliasid'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="linkbox">
|
||||||
|
[<a href="tools.php?action=tag_aliases&order=goodtags">Sort by Good Tags</a>]
|
||||||
|
[<a href="tools.php?action=tag_aliases&order=badtags">Sort by Bad Tags</a>]
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2>Tag Aliases</h2>
|
||||||
|
<table width="100%">
|
||||||
|
<tr class="colhead">
|
||||||
|
<td>Tag</td>
|
||||||
|
<td>Renamed From</td>
|
||||||
|
<td>Submit</td>
|
||||||
|
</tr>
|
||||||
|
<tr/>
|
||||||
|
<tr>
|
||||||
|
<form method="post">
|
||||||
|
<input type="hidden" name="newalias" value="1" />
|
||||||
|
<td>
|
||||||
|
<input type="text" name="aliastag"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="badtag"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="submit" value="Add Alias"/>
|
||||||
|
</td>
|
||||||
|
</form>
|
||||||
|
</tr>
|
||||||
|
<?
|
||||||
|
$DB->query("SELECT ID,BadTag,AliasTag FROM tag_aliases ORDER BY " . $orderby);
|
||||||
|
while (list($ID, $BadTag, $AliasTag) = $DB -> next_record()) {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<form method="post">
|
||||||
|
<input type="hidden" name="changealias" value="1" />
|
||||||
|
<input type="hidden" name="aliasid" value="<?=$ID?>" />
|
||||||
|
<td>
|
||||||
|
<input type="text" name="aliastag" value="<?=$AliasTag?>"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="badtag" value="<?=$BadTag?>"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="submit" name="save" value="Save Alias"/>
|
||||||
|
<input type="submit" name="delete" value="Delete Alias"/>
|
||||||
|
</td>
|
||||||
|
</form>
|
||||||
|
</tr>
|
||||||
|
<? }?>
|
||||||
|
</table>
|
||||||
|
<?
|
||||||
|
show_footer();
|
||||||
|
?>
|
@ -29,6 +29,8 @@
|
|||||||
<tr><td><a href="tools.php?action=email_blacklist">Email Blacklist</a></td></tr>
|
<tr><td><a href="tools.php?action=email_blacklist">Email Blacklist</a></td></tr>
|
||||||
<tr><td><a href="tools.php?action=tokens">Manage freeleech tokens</a></td></tr>
|
<tr><td><a href="tools.php?action=tokens">Manage freeleech tokens</a></td></tr>
|
||||||
<tr><td><a href="tools.php?action=official_tags">Official Tags Manager</a></td></tr>
|
<tr><td><a href="tools.php?action=official_tags">Official Tags Manager</a></td></tr>
|
||||||
|
<tr><td><a href="tools.php?action=tag_aliases">Tag Aliases</a></td></tr>
|
||||||
|
|
||||||
|
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</table>
|
</table>
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
$Tags = explode(',', $_POST['tagname']);
|
$Tags = explode(',', $_POST['tagname']);
|
||||||
foreach($Tags as $TagName) {
|
foreach($Tags as $TagName) {
|
||||||
$TagName = sanitize_tag($TagName);
|
$TagName = sanitize_tag($TagName);
|
||||||
|
|
||||||
if(!empty($TagName)) {
|
if(!empty($TagName)) {
|
||||||
|
$TagName = get_alias_tag($TagName);
|
||||||
// Check DB for tag matching name
|
// Check DB for tag matching name
|
||||||
$DB->query("SELECT t.ID FROM tags AS t WHERE t.Name LIKE '".$TagName."'");
|
$DB->query("SELECT t.ID FROM tags AS t WHERE t.Name LIKE '".$TagName."'");
|
||||||
list($TagID) = $DB->next_record();
|
list($TagID) = $DB->next_record();
|
||||||
|
@ -599,6 +599,7 @@
|
|||||||
foreach($Tags as $Tag) {
|
foreach($Tags as $Tag) {
|
||||||
$Tag = sanitize_tag($Tag);
|
$Tag = sanitize_tag($Tag);
|
||||||
if(!empty($Tag)) {
|
if(!empty($Tag)) {
|
||||||
|
$Tag = get_alias_tag($Tag);
|
||||||
$DB->query("INSERT INTO tags
|
$DB->query("INSERT INTO tags
|
||||||
(Name, UserID) VALUES
|
(Name, UserID) VALUES
|
||||||
('".$Tag."', $LoggedUser[ID])
|
('".$Tag."', $LoggedUser[ID])
|
||||||
|
Loading…
Reference in New Issue
Block a user