You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.4 KiB
78 lines
2.4 KiB
<?php
|
|
function CreateGroup($Title,$Description,$URL,$ParentID=0){
|
|
global $DATABASE;
|
|
$ET=mysqli_escape_string($Title);
|
|
$EU=mysqli_escape_string($URL);
|
|
$ED=mysqli_escape_string($Description);
|
|
if($ParentID){
|
|
$QS="INSERT INTO groups SET name='{$ET}', url='{$EU}', description='{$ED}', parent={$ParentID}";
|
|
} else {
|
|
$QS="INSERT INTO groups SET name='{$ET}', url='{$EU}', description='{$ED}'";
|
|
};
|
|
$DATABASE->Query($QS, false);
|
|
return mysql_insert_id($DATABASE->DBLink);
|
|
}
|
|
|
|
function CheckItemsURL($URL){
|
|
global $DATABASE;
|
|
$EU=mysqli_escape_string($URL);
|
|
$QS="SELECT id FROM items WHERE url='{$EU}'";
|
|
$result=$DATABASE->Query($QS, false);
|
|
return count($result)==0;
|
|
};
|
|
function SetKeywords($KWA,$GID){
|
|
global $DATABASE;
|
|
foreach ($KWA as $KW){
|
|
if (strlen($KW)>32)$KW=substr($KW,1,32);
|
|
$EKW=mysqli_escape_string($KW);
|
|
$QS="INSERT INTO keywords SET keyword='{$EKW}' ON DUPLICATE KEY UPDATE keyword='{$EKW}'";
|
|
$DATABASE->Query($QS);
|
|
$id=mysql_insert_id($DATABASE->DBLink);
|
|
$QS="INSERT INTO keywordgroups SET group_id={$GID}, keyword_id={$id} ON DUPLICATE KEY UPDATE keyword_id={$id}";
|
|
$DATABASE->Query($QS, false);
|
|
};
|
|
};
|
|
|
|
function SetImageSize($ItemID,$W,$H){
|
|
global $DATABASE;
|
|
$QS="UPDATE items SET size_w={$W}, size_h={$H} WHERE id={$ItemID}";
|
|
$DATABASE->Query($QS, false);
|
|
}
|
|
|
|
function CreateItem($GID,$FN,$URL,$TURL,$REF,$MD5,$Rem = false){
|
|
global $DATABASE;
|
|
$ER=mysqli_escape_string($REF);
|
|
$EU=mysqli_escape_string($URL);
|
|
$EF=mysqli_escape_string($FN);
|
|
$ET=mysqli_escape_string($TURL);
|
|
if($Rem){
|
|
$QS="INSERT INTO items SET md5='{$MD5}', group_id={$GID}, remote='available', referer='{$ER}', url='{$EU}', thumbnail_url='{$ET}', fs_path='{$EF}'";
|
|
} else {
|
|
$QS="INSERT INTO items SET md5='{$MD5}', group_id={$GID}, referer='{$ER}', url='{$EU}', thumbnail_url='{$ET}', fs_path='{$EF}'";
|
|
};
|
|
|
|
$DATABASE->Query($QS, false);
|
|
return mysql_insert_id($DATABASE->DBLink);
|
|
};
|
|
function ItemNotExist($MD5){
|
|
global $DATABASE;
|
|
$QS="SELECT id FROM items WHERE MD5='{$MD5}'";
|
|
$result=$DATABASE->Query($QS, false);
|
|
return count($result)==0;
|
|
};
|
|
function NotScanned($URL){
|
|
global $DATABASE;
|
|
$EU=mysqli_escape_string($URL);
|
|
$QS="SELECT id FROM scanned WHERE url='{$EU}'";
|
|
$result=$DATABASE->Query($QS, false);
|
|
return count($result)==0;
|
|
};
|
|
function Scanned($URL){
|
|
global $DATABASE;
|
|
$EU=mysqli_escape_string($URL);
|
|
$QS="INSERT INTO scanned SET url='{$EU}'";
|
|
$DATABASE->Query($QS, false);
|
|
};
|
|
|
|
|
|
?>
|