| @@ 886-905 (lines=20) @@ | ||
| 883 | * @param SqlParser $sqlParser |
|
| 884 | * @return int |
|
| 885 | */ |
|
| 886 | function getCreateDbCategory($category, $sqlParser) { |
|
| 887 | $dbase = $sqlParser->dbname; |
|
| 888 | $dbase = '`' . trim($dbase,'`') . '`'; |
|
| 889 | $table_prefix = $sqlParser->prefix; |
|
| 890 | $category_id = 0; |
|
| 891 | if(!empty($category)) { |
|
| 892 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
|
| 893 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
|
| 894 | if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
| 895 | $category_id = $row['id']; |
|
| 896 | } else { |
|
| 897 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
|
| 898 | $rs = mysqli_query($sqlParser->conn, $q); |
|
| 899 | if($rs) { |
|
| 900 | $category_id = mysqli_insert_id($sqlParser->conn); |
|
| 901 | } |
|
| 902 | } |
|
| 903 | } |
|
| 904 | return $category_id; |
|
| 905 | } |
|
| 906 | ||
| 907 | /** |
|
| 908 | * Remove installer Docblock only from components using plugin FileSource / fileBinding |
|
| @@ 1662-1681 (lines=20) @@ | ||
| 1659 | * @param SqlParser $sqlParser |
|
| 1660 | * @return int |
|
| 1661 | */ |
|
| 1662 | function getCreateDbCategory($category, $sqlParser) { |
|
| 1663 | $dbase = $sqlParser->dbname; |
|
| 1664 | $dbase = '`' . trim($dbase,'`') . '`'; |
|
| 1665 | $table_prefix = $sqlParser->prefix; |
|
| 1666 | $category_id = 0; |
|
| 1667 | if(!empty($category)) { |
|
| 1668 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
|
| 1669 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
|
| 1670 | if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
| 1671 | $category_id = $row['id']; |
|
| 1672 | } else { |
|
| 1673 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
|
| 1674 | $rs = mysqli_query($sqlParser->conn, $q); |
|
| 1675 | if($rs) { |
|
| 1676 | $category_id = mysqli_insert_id($sqlParser->conn); |
|
| 1677 | } |
|
| 1678 | } |
|
| 1679 | } |
|
| 1680 | return $category_id; |
|
| 1681 | } |
|
| 1682 | ||
| 1683 | /** |
|
| 1684 | * Remove installer Docblock only from components using plugin FileSource / fileBinding |
|