/** * Find clusters, in which a plugin-entry is used. * @param integer ID of the plugin-Key */ function findContentUsageClusterNodes($oid) { global $db; // Initializing Array $clusters = array(); // Determine cluster_templates using the object as static content... $sql = "SELECT CLT_ID FROM cluster_template_items WHERE FKID = {$oid}"; $query = new query($db, $sql); while ($query->getrow()) { // Determine clusters using this template $sql = "SELECT CLNID FROM cluster_node WHERE CLT_ID = " . $query->field("CLT_ID"); $subquery = new query($db, $sql); while ($subquery->getrow()) { array_push($clusters, $subquery->field("CLNID")); } $subquery->free(); } $query->free(); // determine clusters using this content as library link... $sql = "SELECT CLID FROM cluster_content WHERE FKID = {$oid} OR CLCID = {$oid}"; $query = new query($db, $sql); while ($query->getrow()) { // Determine clusters using this template $sql = "SELECT CLNID FROM cluster_variations WHERE CLID=" . $query->field("CLID"); $subquery = new query($db, $sql); while ($subquery->getrow()) { array_push($clusters, $subquery->field("CLNID")); } $subquery->free(); } $query->free(); $clusters = array_unique($clusters); return $clusters; }
/** * save the changes... */ function process() { global $errors, $selected, $create, $sitepage_CLNID, $cluster_node_NAME, $db, $oid, $sid, $clt; $this->check(); if ($selected != "0" && $sitepage_CLNID != "0" && $sitepage_CLNID != "") { $mid = getVar("mid"); $sql = "UPDATE sitepage SET CLNID = {$sitepage_CLNID} WHERE SPID = {$oid}"; $query = new query($db, $sql); $query->free(); // reload page, now in editing mode... global $db; $db->close(); header("Location: sitepagebrowser.php?sid={$sid}&mid={$mid}&action=editobject&go=update&oid={$oid}"); exit; } else { if ($create != "0" && $errors == "") { $mid = getVar("mid"); $nextId = nextGUID(); $sql = "INSERT INTO cluster_node (CLNID, CLT_ID, NAME, DELETED) VALUES({$nextId}, {$clt}, '{$cluster_node_NAME}', 0)"; $query = new query($db, $sql); $sql = "UPDATE sitepage SET CLNID = {$nextId} WHERE SPID = {$oid}"; $query = new query($db, $sql); $query->free(); $backup = $oid; $oid = $nextId; syncClusterVariations(); $oid = $backup; global $db; $db->close(); header("Location: sitepagebrowser.php?sid={$sid}&mid={$mid}&action=editobject&go=update&oid={$oid}"); exit; } } }
/** * Create a image from a file. Do not add the file to the object library * @param string Path to the source file * @param string Description Text for ALT-Tag * @param string Copright text for the image * @param string Variation-ID of the image */ function createImageFromFile($sourceFile, $alt = "", $copyright = "", $variation = 1, $categoryId = 1) { global $c, $db; $id = nextGUID(); $info = pathinfo($sourceFile); $extension = $info["extension"]; $extension2 = strtoupper($extension); $name = parseSQL($info["basename"]); if ($extension2 == "JPG" || $extension2 == "GIF" || $extension2 == "PNG") { $size = getimagesize($sourceFile); $width = $size[0]; $height = $size[1]; copy($sourceFile, $c["devfilespath"] . $id . "." . $extension); $thumb = new Img2Thumb($c["devfilespath"] . $id . "." . $extension, 120, 120, $c["devfilespath"] . "t" . $id); $sql = "INSERT INTO pgn_image (FKID, FILENAME, ALT, COPYRIGHT, WIDTH, HEIGHT) VALUES "; $sql .= "({$id}, '{$id}.{$extension}', '{$alt}', '{$copyright}', {$width}, {$height})"; $query = new query($db, $sql); $query->free(); // Create Library Entry for this image $cid = nextGUID(); $imageModule = getDBCell("modules", "MODULE_ID", "MODULE_NAME='Image'"); $sql = "INSERT INTO content (CID, MODULE_ID, NAME, CATEGORY_ID, MT_ID) VALUES "; $sql .= "({$cid}, {$imageModule}, '{$name}', {$categoryId}, 0)"; $query = new query($db, $sql); $query->free(); $sql = "INSERT INTO content_variations (CID, VARIATION_ID, FK_ID) VALUES "; $sql .= "({$cid}, {$variation}, {$id})"; $query = new query($db, $sql); $query->free(); return $cid; } else { return null; } }
/** * Return the XML-Code for a Sitepage-Master * @param integer GUID of the sitepage-master */ function XmlExportSitepageMaster($spm) { global $db, $xmlExchange, $c; $xmlOptions = array(XML_OPTION_CASE_FOLDING => TRUE, XML_OPTION_SKIP_WHITE => TRUE); $xml =& new XPath(FALSE, $xmlOptions); $sql = "SELECT * FROM sitepage_master WHERE SPM_ID = {$spm}"; $query = new query($db, $sql); if ($query->getrow()) { $name = urlencode($query->field("NAME")); $description = urlencode($query->field("DESCRIPTION")); $templatePath = $query->field("TEMPLATE_PATH"); $clt = $query->field("CLT_ID"); $type = $query->field("SPMTYPE_ID"); $template = ""; $fp = @fopen($c["devpath"] . $templatePath, "r"); if ($fp != "") { while (!feof($fp)) { $template .= fgets($fp, 128); } @fclose($fp); } $template = urlencode($template); $templatePath = urlencode($templatePath); $xml->appendChild('', '<NX:SITEPAGEMASTER ID="' . $spm . '" NAME="' . $name . '" DESCRIPTION="' . $description . '" TYPE="' . $type . '" FILENAME="' . $templatePath . '" CLUSTERTEMPLATE="' . $clt . '">' . $template . '</NX:SITEPAGEMASTER>'); $query->free(); $xmlExchange[] = array("clt" => $clt); } return $xml->exportAsXml('', ''); }
/** * Deletes a variable from the variable stack * @param string name of the variable */ function delVar($name) { $back = ""; global $auth, $db; $userId = $auth->userId; $sql = "DELETE FROM temp_vars WHERE USER_ID=$userId and NAME='$name'"; $query = new query($db, $sql); $query->free(); }
/** * Store a vote * @param integer Vote of user (1-8) * @param string comment of user */ function saveData($vote, $comment = "", $sourceId) { if ($vote > 0 && $vote < 10) { global $db; $sql = "INSERT INTO pgn_rating (VOTE, COMMENT, SOURCEID) VALUES({$vote}, '" . addslashes($comment) . "', {$sourceId})"; $query = new query($db, $sql); $query->free(); return true; } return false; }
/** * Return the XML-Code for a Cluster-Template * @param integer ID of the Cluster-Template * @param mixed data to export also as array. [][type] = "meta", [][guid] = ..... */ function XmlExportClusterTemplate($clt) { global $db, $xmlExchange; $xmlOptions = array(XML_OPTION_CASE_FOLDING => TRUE, XML_OPTION_SKIP_WHITE => TRUE); $xml =& new XPath(FALSE, $xmlOptions); $sql = "SELECT * FROM cluster_templates WHERE CLT_ID = {$clt}"; $query = new query($db, $sql); if ($query->getrow()) { $name = urlencode($query->field("NAME")); $description = urlencode($query->field("DESCRIPTION")); $layout = urlencode($query->field("TEMPLATE")); $xmlExchange[] = array("mt" => $query->field("MT_ID")); $xml->appendChild('', "<nx:clustertemplate id=\"{$clt}\" name=\"{$name}\" description=\"{$description}\" metaTemplate=\"" . $query->field("MT_ID") . "\" />"); $xml->appendChild('/nx:clustertemplate[@id="' . $clt . '"]', "<nx:layout>{$layout}</nx:layout>"); $query->free(); } $requiredPlugins = array(); $sql = "SELECT * FROM cluster_template_items WHERE CLT_ID = {$clt}"; $query = new query($db, $sql); while ($query->getrow()) { $name = urlencode($query->field("NAME")); $position = $query->field("POSITION"); $type = $query->field("CLTITYPE_ID"); $mincard = $query->field("MINCARD"); $maxcard = $query->field("MAXCARD"); $fkid = $query->field("FKID"); $config = ""; if ($type == 2 || $type == 5) { //dynamic content or library. $config = strtoupper(getDBCell("modules", "MODULE_NAME", "MODULE_ID = {$fkid}")); if (!in_array($config, $requiredPlugins)) { $requiredPlugins[] = $config; } } else { if ($type == 4) { $config = $fkid; $xmlExchange[] = array("clt" => $fkid); } } $xml->appendChild('/nx:clustertemplate[@id="' . $clt . '"]', "<nx:clustertemplateitem name=\"{$name}\" position=\"{$position}\" type=\"{$type}\" mincard=\"{$mincard}\" maxcard=\"{$maxcard}\" configuration=\"{$config}\"/>"); } for ($i = 0; $i < count($requiredPlugins); $i++) { if (!in_array($requiredPlugins[$i], $xmlExchange["PLUGINS"])) { array_push($xmlExchange["PLUGINS"], $requiredPlugins[$i]); } } return $xml->exportAsXml('', ''); }
/** * Launch a plugin. * @param integer FKID of the plugin to launch. * @param integer Module-ID of the plugin. * @param integer ID of the level to launch to * @param integer ID of the Cluster-Content-Item * @returns integer Translated ID after launch. */ function launchPlugin($in, $plugin, $level, $clti = 0) { global $db; $out = translateState($in, $level); // reference the Plugin. $sql = "SELECT CLASS FROM modules WHERE MODULE_ID = {$plugin}"; $query = new query($db, $sql); $query->getrow(); $classname = $query->field("CLASS"); $ref = new $classname($in, $clti); $delSQL = "DELETE FROM {$ref->management_table} WHERE {$ref->pk_name} = {$out}"; $query = new query($db, $delSQL); // *old* note: when versioning is being implemented, createVersion must be called with parameter $applyProperties=false if the original version level is higher than 0 !!! // *old* this is to make sure automatic modifications are only applied when first increasing the version level of a content. // note: the new concept is to apply automatic modifications immediately when uploading new plugin data while the original uploaded data will remain as an unchanged version. // this way the automatic changes can be updated if changed later on by issuing a corresponding command on the singleConfig page $sql = $ref->createVersion($out); $query = new query($db, $sql); $query->free(); unset($ref); return $out; }
/** * Return the XML-Code for a Meta-Template * @param integer ID of the Meta-Template */ function XmlExportMetaTemplate($mtId) { global $db; $xmlOptions = array(XML_OPTION_CASE_FOLDING => TRUE, XML_OPTION_SKIP_WHITE => TRUE); $xml =& new XPath(FALSE, $xmlOptions); $sql = "SELECT * FROM meta_templates WHERE MT_ID = {$mtId}"; $query = new query($db, $sql); if ($query->getrow()) { $name = urlencode($query->field("NAME")); $description = urlencode($query->field("DESCRIPTION")); $xml->appendChild('', "<nx:metatemplate id=\"{$mtId}\" name=\"{$name}\" description=\"{$description}\"/>"); $query->free(); } $sql = "SELECT * FROM meta_template_items WHERE MT_ID = {$mtId}"; $query = new query($db, $sql); while ($query->getrow()) { $name = urlencode($query->field("NAME")); $position = $query->field("POSITION"); $type = $query->field("MTYPE_ID"); $xml->appendChild('/nx:metatemplate[@id="' . $mtId . '"]', "<nx:metatemplateitem name=\"{$name}\" position=\"{$position}\" type=\"{$type}\"/>"); } return $xml->exportAsXml('', ''); }
/** * Translate an old into a new GUID * @param integer old GUID * @param boolean set AntiCycle */ function translateXmlGUID($oldId) { global $db, $provider, $c; if ($oldId < 1000) { // System data. $out = $oldId; } else { if (strtoupper($provider) == strtoupper($c["provider"])) { // own data. $out = $oldId; } else { $provider = strtoupper(parseSQL($provider)); resetDBCache(); $out = getDBCell("syndication", "OUT_ID", "IN_ID = {$oldId} AND PROVIDER = '{$provider}'"); if ($out == "") { $out = nextGUID(); $sql = "INSERT INTO syndication (IN_ID, OUT_ID, PROVIDER) VALUES ({$oldId}, {$out}, '{$provider}')"; $query = new query($db, $sql); $query->free(); } } } return $out; }
/** * Get recordset from pgnImage as associative array. Internally used only. * @param integer id for new recordset. * @returns 2d-array of name-value-pairs. */ function _getColumns($newid) { global $db; $querySQL = "SELECT * FROM $this->management_table WHERE $this->pk_name = $this->fkid"; $query = new query($db, $querySQL); $query->getrow(); $width = addslashes($query->field("WIDTH")); $height = addslashes($query->field("HEIGHT")); $alt = addslashes($query->field("ALT")); $copyright = addslashes($query->field("COPYRIGHT")); $filename = $query->field("FILENAME"); $query->free(); // copy image to new version $fileparts = explode(".", $filename); $suffix = strtolower($fileparts[(count($fileparts) - 1)]); $newfile = $newid . "." . $suffix; return array("newid" => $newid, "suffix" => $suffix, "filename" => $filename, "newfile" => $newfile, "alt" => $alt, "height" => $height, "width" => $width, "copyright" => $copyright); }
/** * This function is used for drawing the html-code out to the templates. * It just returns the code * @param string Optional parameters for the draw-function. There are none supported. * @return string HTML-CODE to be written into the template. */ function draw($param = "") { global $db; $result = null; $sql = "SELECT * FROM pgn_quote ORDER BY RAND() LIMIT 1"; $query = new query($db, $sql); if ($query->getrow()) { $result["QUOTE"] = $query->field("QUOTE"); $result["TITLE"] = $query->field("TITLE"); } $query->free(); return $result; }
/** * Used to create a tree of the CLuster-Templates. * Recursive function. * Create a global variable $isFolder if you are moving folders, because there are special rules then. * @param array array with name-value pairs of the folders */ function createCLT(&$instances) { global $db, $lang; $sql = "SELECT NAME, CLNID FROM cluster_node WHERE CLT_ID = $this->clt AND DELETED=0 AND VERSION=0 ORDER BY NAME ASC"; $instances[0][0] = $lang->get("empty"); $instances[0][1] = 0; $myquery = new query($db, $sql); while ($myquery->getrow()) { $ni = count($instances); $instances[$ni][1] = $myquery->field("CLNID"); $instances[$ni][0] = $myquery->field("NAME"); } $myquery->free(); }
/** * internally used only for creating a array for deleting a folder tree. */ function createDelArray(&$handler, $id) { global $db; $sql = "SELECT CATEGORY_ID FROM categories WHERE PARENT_CATEGORY_ID = $id"; $query = new query($db, $sql); while ($query->getrow()) { $cid = $query->field("CATEGORY_ID"); $dsql = "UPDATE categories SET DELETED = 1 WHERE CATEGORY_ID = $cid"; $handler->addDBAction($dsql); createDelArray($handler, $cid); } $query->free(); $dsql = "UPDATE categories SET DELETED = 1 WHERE CATEGORY_ID = $id"; $handler->addDBAction($dsql); }
$handled = false; if (value('resetfilter', 'NUMERIC', '0') == '1') delVar('linkset'); if ($action != "0" || $view != "0") { //check if cluster exists in this variation if ($clnid != "0") { if ($action == "cr_cluster" && value("decision") == $lang->get("yes")) { $oid = value("oid", "NUMERIC"); $crvar = value("crvar", "NUMERIC"); if ($oid != "0" && $crvar != "0") { if (getDBCell("cluster_variations", "CLID", "CLNID = $oid AND VARIATION_ID = $crvar") != "") { $sql = "UPDATE cluster_variations SET DELETED=0 WHERE CLNID = $oid AND VARIATION_ID = $crvar"; $query = new query($db, $sql); $query->free(); } else { createCluster($oid, $crvar, $auth->userName); } $view = 1; } } else { $clid = getDBCell("cluster_variations", "CLID", "CLNID = $clnid AND VARIATION_ID = $variation AND DELETED=0"); if ($clid == "") { $form2 = new YesNoForm($lang->get("cr_vr", "Create variation"), $lang->get("crclv_mes", "The cluster does not exists in this variation. Do you want to create it?")); $form2->add(new Hidden("action", "cr_cluster")); $form2->add(new Hidden("oid", $oid)); $form2->add(new Hidden("crvar", $variation)); $page->add($form2); $handled = true;
/** * Frees a position for inserting a new dataset. * * @param string $table Name of the table to free a row * @param string $sortColumn Name of the Column where order is stored * @param integer $position Value of the PK of the row to free * @param string $cond Where-Clause, to select only some rows. */ function freeRowPosition($table, $sortColumn, $position, $cond = "1") { global $db; if (getDBCell($table, $sortColumn, "$cond AND $sortColumn = $position") != "") { $sql = "UPDATE $table SET $sortColumn = ($sortColumn + 1) WHERE $cond AND $sortColumn >= $position"; $query = new query($db, $sql); $query->free(); } }
/** * Delete one item out of the list */ function deleteItem() { global $db; $deleted = false; for ($i = 0; $i < count($this->members); $i++) { if ($this->eid == $this->members[$i][1]) { $sql = "DELETE FROM cluster_content WHERE CLCID = $this->eid"; $query = new query($db, $sql); $query->free(); if ($this->membersCount > 1) sortTableRows("cluster_content", "CLCID", "POSITION", "CLTI_ID = $this->clti AND CLID = $this->cl"); $deleted = true; $this->deleteReferencedItem($this->eid); } } if ($deleted) { syncCluster ($this->cl); $this->members = $this->getItemData(); } }
/** * Copy this record and all its data to new id. * @param integer id which is used as PK for new record. */ function copyRecord($newid) { // query for content global $db; $querySQL = "SELECT SNIPLET FROM $this->management_table WHERE $this->pk_name = $this->fkid"; $query = new query($db, $querySQL); $query->getrow(); $content = $query->field("SNIPLET"); $content = addslashes($content); $snt = $query->field("SNIPLETTYPE"); $query->free(); $sql = "INSERT INTO $this->management_table ($this->pk_name, SNIPLET, SNIPLETTYPE) VALUES ($newid, '$content', $snt)"; return $sql; }
/** * Gets the available Variations of a cluster-Node * @param integer Cluster-Node-ID * @returns integer Linear array with all available Variations. */ function getClusterVariations($clnid) { global $db, $splevel; if ($splevel == 10) { // checking for live-variations.... $sql = "SELECT DISTINCT cv.VARIATION_ID FROM cluster_variations cv, cluster_node cn, sitepage sp, sitepage_names sn, sitepage_variations sv RIGHT JOIN state_translation st ON cv.CLID = st.OUT_ID AND st.EXPIRED = 0 WHERE cn.CLNID = $clnid AND cv.CLNID = cn.CLNID AND cv.DELETED = 0 AND cn.CLNID = sp.CLNID AND sp.SPID = sn.SPID AND sn.DELETED = 0 AND sp.SPM_ID = sv.SPM_ID AND sv.VARIATION_ID = cv.VARIATION_ID"; } else { $sql = "SELECT DISTINCT cv.VARIATION_ID FROM cluster_variations cv, cluster_node cn, sitepage sp, sitepage_names sn, sitepage_variations sv WHERE cn.CLNID = $clnid AND cv.CLNID = cn.CLNID AND cv.DELETED = 0 AND cn.CLNID = sp.CLNID AND sp.SPID = sn.SPID AND sn.DELETED = 0 AND sp.SPM_ID = sv.SPM_ID AND sv.VARIATION_ID = cv.VARIATION_ID"; } $query = new query($db, $sql); $returns = array (); while ($query->getrow()) { array_push($returns, $query->field("VARIATION_ID")); } $query->free(); return $returns; }
/** * Checks, whether the cluster already exists and creates it, if not. */ function checkIfCLNExists() { global $db; // Check, if Clusternode exists. if ($this->value == "0" || $this->value == "") { // The Cluster in the variation will be created now. $this->clnid = createClusterNode($this->clustername, $this->cltid); // update the new clnid immediately to the database $sql = "UPDATE $this->table SET $this->column=$this->clnid WHERE $this->row_identifier"; $query = new query($db, $sql); $query->free(); } else { // the cluster node already exists. $this->clnid = $this->value; } // check, if clustervariation exists. $clid = getDBCell("cluster_variations", "CLID", "CLNID=$this->clnid AND VARIATION_ID=$this->variation"); if ($clid == "") { // Cluster-Variation does not exists yet. $this->clid = createCluster($this->clnid, $this->variation); } else { $this->clid = $clid; } // sync the cluster variation syncCluster($this->clid); // ensure correct CLT-ID $this->cltid = getDBCell("cluster_node", "CLT_ID", "CLNID=".$this->clnid); }
/** * Creates an Array from a table with following form: * array[i] = $name * The function queries the table for names that * match the given data_identifier and processes them into Array. * @param string Name of table you are working with * @param string Name of column, you want to take the Names for the Array form. * @param string $data_identifier Statement of your SQL-Where-Clause for selecting one or more records in the table for processing. * @param string $order Name of the column which shall be ordered by. * @param boolean Should the values be filtered for duplicates ("distinct") * @return Array */ function createDBCArray($table, $name, $data_identifier = "1", $order = "", $distinct=true) { global $db; $values = null; $counter = 0; if ($distinct) { $filter = "DISTINCT"; } else { $filter = ""; } $sql = "SELECT $filter $name FROM $table WHERE $data_identifier" . " $order"; $query = new query($db, $sql); while ($query->getrow()) { $values[$counter] = $query->field($name); $counter++; } $query->free(); return $values; }
/** * Create the sql-code for a version of the selected object * @param integer ID of new Version. * @returns string SQL Code for new Version. */ function createVersion($newid) { // query for content global $db; $querySQL = "SELECT NUMBER FROM $this->management_table WHERE $this->pk_name = $this->fkid"; $query = new query($db, $querySQL); $query->getrow(); $content = addslashes($query->field("CONTENT")); $query->free(); $sql = "INSERT INTO $this->management_table ($this->pk_name, NUMBER) VALUES ($newid, $content)"; return $sql; }
/** * Deletes a row with specified parameters * * @param string Name of the table to select the row from * @param string Filter to select rows */ function deleteRow($table, $filter = "") { if ($filter != "1" && $filter != "" & $table != "") { global $db, $debug; $sql = "DELETE FROM $table WHERE $filter"; if ($debug) echo "DELETE: ".$sql."<br>"; $query = new query($db, $sql); $query->free(); } }
/** * Save all back to the database */ function process() { global $db, $oid; deleteRow($this->table, $this->cond); $ids = explode(",", value($this->table."selection", "NOSPACES")); for ($i=0; $i < count($ids); $i++) { $sql = "INSERT INTO $this->table ($this->idcolumn, $this->fkidcolumn, POSITION) VALUES (".$ids[$i].", $oid, ".($i+1).")"; $query = new query($db, $sql); $query->free(); } }
array_push($clusters, $subquery->field("CLNID")); } $subquery->free(); } $query->free(); // determine clusters using this content as library link... $sql = "SELECT CLID FROM cluster_content WHERE FKID = {$oid}"; $query = new query($db, $sql); while ($query->getrow()) { // Determine clusters using this template $sql = "SELECT CLNID FROM cluster_variations WHERE CLID=" . $query->field("CLID"); $subquery = new query($db, $sql); while ($subquery->getrow()) { array_push($clusters, $subquery->field("CLNID")); } $subquery->free(); } $query->free(); $clusters = array_unique($clusters); //echo "USED:".count($usedPageClusters)." UNUSED:".count($unusedPageClusters); //echo " ALL CLUSTERS:".count($clusters); // now find all clusters recursive that contain the unused values... function parentClusters($clArray, $level = 0) { $clnids = array(); if ($level > 5) { return $clnids; } for ($i = 0; $i < count($clArray); $i++) { $cl = $clArray[$i]; // find dynamic clusters....
/** * Create the sql-code for a version of the selected object * @param integer ID of new Version. * @returns string SQL Code for new Version. */ function createVersion($newid, $copy = false) { // query for content global $db, $c; $destinationPath = $c["livefilespath"]; if ($copy) $destinationPath = $c["devfilespath"]; $querySQL = "SELECT * FROM $this->management_table WHERE $this->pk_name = $this->fkid"; $query = new query($db, $querySQL); $query->getrow(); $filename = $query->field("FILENAME"); $description = addslashes($query->field("DESCRIPTION")); $filetype = $query->field("FILETYPE"); $location = $query->field("LOCATION"); $name = $query->field("NAME"); $query->free(); // copy image to new version $fileparts = explode(".", $filename); $suffix = strtolower($fileparts[(count($fileparts) - 1)]); $newfile = $newid . "." . $suffix; if (!$copy) { nxDelete ($destinationPath , $newfile); } if ($suffix != "") { nxCopy($c["devfilespath"] . $filename, $destinationPath , $newfile); } $sql = "INSERT INTO $this->management_table ($this->pk_name, NAME,FILENAME, FILETYPE, LOCATION, DESCRIPTION) VALUES ($newid, '$name', '$newfile', '$filetype', '$location', '$description')"; return $sql; }
public function fields_list($table) { $sql_s = "SELECT * FROM {$table} LIMIT 0"; $select_fields = new query($this->connect, $sql_s, array(), array()); $fields = $select_fields->fields->all; // Free Memory from select fields query resaults $select_fields->free(); return $fields; }
/** * Create the sql-code for a version of the selected object * @param integer ID of new Version. * @returns string SQL Code for new Version. */ function createVersion($newid) { // query for content global $db, $c; $querySQL = "SELECT CONTENT FROM $this->management_table WHERE $this->pk_name = $this->fkid"; $query = new query($db, $querySQL); $query->getrow(); $content = addslashes($query->field("CONTENT")); $query->free(); $this->createImage($c["livefilespath"] . $newid.".png"); $sql = "INSERT INTO $this->management_table ($this->pk_name, CONTENT) VALUES ($newid, '$content')"; return $sql; }
/** * Check the login data of a user and return true if data is correct or false if incorrect. * @param string Username * @param string User's pasword. * @return boolean true if check was successful or false if not. */ function checkLogin($login, $passwd) { global $db, $c; $sql = "SELECT USER_ID FROM users WHERE USER_NAME='{$login}' AND PASSWORD = '******'"; $query = new query($db, $sql); if ($query->count() == 1) { // login successfull $query->getrow(); $this->userId = $query->field("USER_ID"); return true; } else { return false; } $query->free(); }
/** * Deletes the expired-Flag in the state-translations... * @param integer Translated-ID of an item (OUT-ID) */ function delExpired($out) { global $db; $sql = "UPDATE state_translation SET EXPIRED=0 WHERE OUT_ID = $out"; $query = new query($db, $sql); $query->free(); }