mirror of
https://gitlab.com/CodeSolutionsProject/CodeShare.git
synced 2026-02-18 19:11:33 +01:00
#5 Finished
This commit is contained in:
@@ -173,9 +173,9 @@ class DB
|
||||
*
|
||||
* @return int the last code identifier
|
||||
*/
|
||||
public function getLastIDC()
|
||||
public function getLastIDC($name)
|
||||
{
|
||||
$query = "SELECT MAX(IDC) FROM Codes";
|
||||
$query = "SELECT MAX(IDC) FROM Codes WHERE name='$name'";
|
||||
return $this->getQuery($query)[0];
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ class DB
|
||||
* @param $IDU user identifier
|
||||
* @param null $extlib external library
|
||||
* @param null $extlibver external library version
|
||||
* @return int the snippet's version
|
||||
* @return int the snippet's version or IDC
|
||||
*/
|
||||
public function addOrModifyCodes($IDC, $name, $description, $input, $output, $lang, $code, $IDU, $extlib = null, $extlibver = null)
|
||||
{
|
||||
@@ -319,9 +319,10 @@ class DB
|
||||
$query = "INSERT INTO Codes (`UserCreator`,`Name`,`Description`,`Input`,`Output`) VALUES ('$IDU','$name','$description','$in','$out') ";
|
||||
//echo $query.';';
|
||||
//die();
|
||||
|
||||
dbw_query($this->conn, $query);
|
||||
$this->addSource($this->getLastIDC(), $lang, $_code, $IDU, $extlib, $extlibver);
|
||||
$myID = $this->getLastIDC($name);
|
||||
$this->addSource($myID, $lang, $_code, $IDU, $extlib, $extlibver);
|
||||
return $myID;
|
||||
} else {
|
||||
$arr = $this->loadAll($IDC, $lang, $this->getLastVersion($IDC, $lang));
|
||||
$codewrite = $arr["Code"];
|
||||
|
||||
Reference in New Issue
Block a user