| @@ 1795-1824 (lines=30) @@ | ||
| 1792 | } |
|
| 1793 | } |
|
| 1794 | ||
| 1795 | if (!function_exists('getCreateDbCategory')) { |
|
| 1796 | /** |
|
| 1797 | * @param string|int $category |
|
| 1798 | * @param SqlParser $sqlParser |
|
| 1799 | * @return int |
|
| 1800 | */ |
|
| 1801 | function getCreateDbCategory($category, $sqlParser) |
|
| 1802 | { |
|
| 1803 | $dbase = $sqlParser->dbname; |
|
| 1804 | $dbase = '`' . trim($dbase, '`') . '`'; |
|
| 1805 | $table_prefix = $sqlParser->prefix; |
|
| 1806 | $category_id = 0; |
|
| 1807 | if (!empty($category)) { |
|
| 1808 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
|
| 1809 | $rs = mysqli_query($sqlParser->conn, |
|
| 1810 | "SELECT id FROM $dbase.`" . $table_prefix . "categories` WHERE category = '" . $category . "'"); |
|
| 1811 | if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
| 1812 | $category_id = $row['id']; |
|
| 1813 | } else { |
|
| 1814 | $q = "INSERT INTO $dbase.`" . $table_prefix . "categories` (`category`) VALUES ('{$category}');"; |
|
| 1815 | $rs = mysqli_query($sqlParser->conn, $q); |
|
| 1816 | if ($rs) { |
|
| 1817 | $category_id = mysqli_insert_id($sqlParser->conn); |
|
| 1818 | } |
|
| 1819 | } |
|
| 1820 | } |
|
| 1821 | ||
| 1822 | return $category_id; |
|
| 1823 | } |
|
| 1824 | } |
|
| 1825 | ||
| 1826 | if (!function_exists('removeDocblock')) { |
|
| 1827 | /** |
|
| @@ 682-711 (lines=30) @@ | ||
| 679 | } |
|
| 680 | } |
|
| 681 | ||
| 682 | if (!function_exists('getCreateDbCategory')) { |
|
| 683 | /** |
|
| 684 | * @param string|int $category |
|
| 685 | * @param SqlParser $sqlParser |
|
| 686 | * @return int |
|
| 687 | */ |
|
| 688 | function getCreateDbCategory($category, $sqlParser) |
|
| 689 | { |
|
| 690 | $dbase = $sqlParser->dbname; |
|
| 691 | $dbase = '`' . trim($dbase, '`') . '`'; |
|
| 692 | $table_prefix = $sqlParser->prefix; |
|
| 693 | $category_id = 0; |
|
| 694 | if (!empty($category)) { |
|
| 695 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
|
| 696 | $rs = mysqli_query($sqlParser->conn, |
|
| 697 | "SELECT id FROM $dbase.`" . $table_prefix . "categories` WHERE category = '" . $category . "'"); |
|
| 698 | if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
| 699 | $category_id = $row['id']; |
|
| 700 | } else { |
|
| 701 | $q = "INSERT INTO $dbase.`" . $table_prefix . "categories` (`category`) VALUES ('{$category}');"; |
|
| 702 | $rs = mysqli_query($sqlParser->conn, $q); |
|
| 703 | if ($rs) { |
|
| 704 | $category_id = mysqli_insert_id($sqlParser->conn); |
|
| 705 | } |
|
| 706 | } |
|
| 707 | } |
|
| 708 | ||
| 709 | return $category_id; |
|
| 710 | } |
|
| 711 | } |
|
| 712 | ||
| 713 | if (!function_exists('removeDocblock')) { |
|
| 714 | /** |
|