本文整理汇总了PHP中query::free方法的典型用法代码示例。如果您正苦于以下问题:PHP query::free方法的具体用法?PHP query::free怎么用?PHP query::free使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类query
的用法示例。
在下文中一共展示了query::free方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findContentUsageClusterNodes
/**
* 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;
}
示例2: process
/**
* 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;
}
}
}
示例3: createImageFromFile
/**
* 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;
}
}
示例4: XmlExportSitepageMaster
/**
* 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('', '');
}
示例5: delVar
/**
* 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();
}
示例6: saveData
/**
* 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;
}
示例7: XmlExportClusterTemplate
/**
* 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('', '');
}
示例8: launchPlugin
/**
* 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;
}
示例9: XmlExportMetaTemplate
/**
* 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('', '');
}
示例10: translateXmlGUID
/**
* 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;
}
示例11: query
/**
* 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);
}
示例12: draw
/**
* 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;
}
示例13: createCLT
/**
* 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();
}
示例14: createDelArray
/**
* 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);
}
示例15: delVar
$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;