| @@ 1610-1629 (lines=20) @@ | ||
| 1607 | * @param SqlParser $sqlParser |
|
| 1608 | * @return int |
|
| 1609 | */ |
|
| 1610 | function getCreateDbCategory($category, $sqlParser) { |
|
| 1611 | $dbase = $sqlParser->dbname; |
|
| 1612 | $dbase = '`' . trim($dbase,'`') . '`'; |
|
| 1613 | $table_prefix = $sqlParser->prefix; |
|
| 1614 | $category_id = 0; |
|
| 1615 | if(!empty($category)) { |
|
| 1616 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
|
| 1617 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
|
| 1618 | if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
| 1619 | $category_id = $row['id']; |
|
| 1620 | } else { |
|
| 1621 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
|
| 1622 | $rs = mysqli_query($sqlParser->conn, $q); |
|
| 1623 | if($rs) { |
|
| 1624 | $category_id = mysqli_insert_id($sqlParser->conn); |
|
| 1625 | } |
|
| 1626 | } |
|
| 1627 | } |
|
| 1628 | return $category_id; |
|
| 1629 | } |
|
| 1630 | ||
| 1631 | /** |
|
| 1632 | * Remove installer Docblock only from components using plugin FileSource / fileBinding |
|
| @@ 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 |
|