Initial import: Carteasy Shop (Dev-Stand)
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
class URI {
|
||||
|
||||
public static function fetch_structure($uri) {
|
||||
$db = Registry::get('base')->db;
|
||||
|
||||
$uri = trim($uri);
|
||||
|
||||
if ($uri == '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
structure
|
||||
WHERE
|
||||
short_uri = '" . $db->real_escape_string($uri) . "'
|
||||
AND
|
||||
active = '1'
|
||||
OR
|
||||
active = '2'
|
||||
";
|
||||
|
||||
$result = $db->query($sql);
|
||||
echo $sql;
|
||||
if ($result->num_rows > 0) {
|
||||
return $result->fetch_object()->id;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// short_uri can't be used multiple times
|
||||
public static function fetch_item($uri) {
|
||||
$db = Registry::get('base')->db;
|
||||
|
||||
$uri = trim($uri);
|
||||
|
||||
if ($uri == '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
items
|
||||
WHERE
|
||||
short_uri = '" . $db->real_escape_string($uri) . "'
|
||||
AND
|
||||
active = '1'
|
||||
LIMIT 1
|
||||
";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
return $result->fetch_object()->id;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user