/**
 * Launch a Sitepage-MAster
 * @param integer SPM_ID to launch
 * @param integer ID of the level to launch to.
 * @param integer ID of the variation to launch. 
 * @returns integer Translated ID after launch
 */
function launchSitepageMaster($in, $level, $variation)
{
    global $db;
    $out = translateState($in, $level, false);
    $sql = "SELECT * FROM sitepage_master WHERE SPM_ID = {$in}";
    $query = new query($db, $sql);
    $query->getrow();
    $clt = $query->field("CLT_ID");
    $type = $query->field("SPMTYPE_ID");
    $name = addslashes($query->field("NAME"));
    $desc = addslashes($query->field("DESCRIPTION"));
    $path = addslashes($query->field("TEMPLATE_PATH"));
    $cltTrans = launchClusterTemplate($clt, $level, $variation);
    $sql = "DELETE FROM sitepage_master WHERE SPM_ID = {$out}";
    $query = new query($db, $sql);
    $sql = "INSERT INTO sitepage_master (SPM_ID, NAME, DESCRIPTION, TEMPLATE_PATH, CLT_ID, SPMTYPE_ID, DELETED, VERSION) VALUES ";
    $sql .= "({$out}, '{$name}', '{$desc}', '{$path}', {$cltTrans}, {$type}, 0, {$level})";
    $query = new query($db, $sql);
    $query->free();
    // copy template physically.
    global $c;
    if (file_exists($c["devpath"] . $path)) {
        nxDelete($c["livepath"], $path);
        nxCopy($c["devpath"] . $path, $c["livepath"], $path);
    }
    launchSPMVariations($in, $level);
    return $out;
}
/**
 * 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('', '');
}
		/**
		   * 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 $cds, $db;
			$label = getDBCell("pgn_config_store", "TEXT1", "CLTI_ID=".$this->fkid);
			echo "<br><h2>$label</h2>";
			$label = getDBCell("pgn_config_store", "TEXT3", "CLTI_ID=".$this->fkid);
			echo $label;
			br(); br();
			// draw the linklist...
			$sql = "Select * FROM pgn_linkexchange WHERE APPROVED=1 AND SOURCEID=".$cds->pageId. " ORDER BY INSERTTIMESTAMP DESC";
			$query = new query($db, $sql);
			$counter = 0;
			while ($query->getrow()) {			  			  
			  $title = $query->field("TITLE");
			  $description = $query->field("DESCRIPTION");
			  $url = $query->field("URL");
			  echo '<b><a href="'.$url.'" target="_blank">'.$title.'</a></b><br>';
			  echo $description;
			  br();
			  echo '<a style="font-size:11px;text-decoration:none;" href="'.$url.'" target="blank"><span style="color:#008000;">'.$url.'</span></a>';
			  br();
			  br();
			}
			
			
			
				echo '<script language="javascript" type="text/javascript">
	<!--
	var win=null;
	
	function NewWindow2(mypage,myname,w,h,scroll,pos){
		if(pos=="random")
			{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
			TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
		if(pos=="center")
			{LeftPosition=(screen.width)?(screen.width-w)/2:100;
			TopPosition=(screen.height)?(screen.height-h)/2:100;}
	
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings=\'width=\'+w+\',height=\'+h+\',top=\'+TopPosition+\',left=\'+LeftPosition+\',scrollbars=\'+scroll+\',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes\';
	win=window.open(mypage,myname,settings);}
	// -->
	</script>';
		$label = getDBCell("pgn_config_store", "TEXT2", "CLTI_ID=".$this->fkid);
		
	 	echo '<a class="breadcrumb" href="#" onclick="NewWindow'."('".$cds->docroot."sys/linkexchange/addurl.php?id=".$cds->pageId."','addurl','600','450','no','center');return false".'" onfocus="this.blur()">'.$label.'</a>&nbsp;&nbsp;';	
		
			
		}	
Exemplo n.º 4
0
		/**
		   * 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;
		}
Exemplo n.º 5
0
/**
 * 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;
}
Exemplo n.º 6
0
/**
 * syncronize variations with entered data to the database.
 * The configuration for this function must be set manually.
 * I.E. there must be the $oid-Variable set and there must(!)
 * be also the global vars content_variations_VARIATION_ID_XX
 * and content_MODULE_ID
 * set which are automatically set by the SelectMultiple2Input.
 */
function syncVariations()
{
    global $db, $oid, $content_MODULE_ID;
    $module = value("content_MODULE_ID", "NUMERIC");
    if ($module == "0") {
        $module = $content_MODULE_ID;
    }
    includePGNSource($module);
    //delete all variations first.
    $del = "UPDATE content_variations SET DELETED=1 WHERE CID = {$oid}";
    $query = new query($db, $del);
    // get list of variations
    $variations = createNameValueArray("variations", "NAME", "VARIATION_ID", "DELETED=0");
    for ($i = 0; $i < count($variations); $i++) {
        $id = $variations[$i][1];
        if (value("content_variations_VARIATION_ID_" . $id) != "0") {
            // create or restore variation
            // check, if variations already exists and is set to deleted.
            $sql = "SELECT COUNT(CID) AS ANZ FROM content_variations WHERE CID = {$oid} AND VARIATION_ID = {$id}";
            $query = new query($db, $sql);
            $query->getrow();
            $amount = $query->field("ANZ");
            if ($amount > 0) {
                $sql = "UPDATE content_variations SET DELETED=0 WHERE CID = {$oid} AND VARIATION_ID = {$id}";
            } else {
                $fk = nextGUID();
                $sql = "INSERT INTO content_variations (CID, VARIATION_ID, FK_ID, DELETED) VALUES ( {$oid}, {$id}, {$fk}, 0)";
                $PGNRef = createPGNRef($module, $fk);
                $PGNRef->sync();
            }
            $query = new query($db, $sql);
        }
    }
}
Exemplo n.º 7
0
/**
 * Draw a teaser defined with the teaser plugin
 * @id internal id of the teaser. matched pgn_teaser.fkid.
 */
function drawPGNTeaser($id)
{
    global $cds, $db;
    $result = '';
    $query = new query($db, "Select * FROM pgn_teaser Where FKID=" . $id);
    if ($query->getrow()) {
        $href = $query->field("HREF");
        if (substr($href, 0, 4) == "www.") {
            $href = 'http://' . $href;
        }
        $popup = $href != "";
        $spid = $query->field('SPID');
        if ($spid != "0" && $href == "") {
            $menu = new Menu(null, $spid, $cds->variation, $cds->level);
            $href = $menu->getLink();
        }
        $imageid = $query->field("IMAGEID");
        $aTag = '<a href="' . $href . '"';
        if ($popup) {
            $aTag .= ' target="_blank"';
        }
        $aTag .= '>';
        // image teaser
        if ($query->field("ISIMAGETEASER") == "1") {
            $result = $aTag . $cds->content->getById($imageid) . '</a>';
        } else {
            // usual teaser
            $headline = $query->field("HEADLINE");
            $body = $query->field("BODY");
            $linktext = $query->field("LINKTEXT");
            if ($linktext == "") {
                $linktext = "read more";
            }
            $result = '<div class="teaser">';
            if ($headline != "") {
                $result .= '<b>' . $headline . '</b><br>';
            }
            if ($imageid != "0") {
                $result .= $aTag . $cds->content->getById($imageid) . '</a><br>';
            }
            if ($body != "") {
                $result .= $body;
            }
            if ($query->field("RESOLVECHILDS") != "1" || $spid == "0" && $href == "") {
                $result .= '&nbsp;&nbsp;' . $aTag . $linktext . '</a>';
            } else {
                $childs = $menu->lowerLevel();
                for ($i = 0; $i < count($childs); $i++) {
                    $result .= '<br/>';
                    $result .= $childs[$i]->getTag();
                }
            }
            $result .= '</div>';
        }
    }
    return $result;
}
/**
 * draw an input field for meta-Data
 * @param string Headline for this field.
 * @param string Meta-Template, which is to be used.
 */
function draw_metaInput($headline, $mt_id)
{
    global $db, $specialID, $metaPanel, $clnid;
    //checking, if there are any items in the template.
    $sql = "SELECT COUNT(MTI_ID) AS ANZ FROM meta_template_items WHERE MT_ID = {$mt_id}";
    $query = new query($db, $sql);
    $query->getrow();
    $amount = $query->field("ANZ");
    if ($amount > 0) {
        $sql = "SELECT m.MID AS D1, t.MTYPE_ID AS D2, t.NAME AS D3 FROM meta_template_items t, meta m WHERE m.MTI_ID = t.MTI_ID AND m.CID = " . $clnid . " AND m.DELETED=0 AND t.MT_ID = {$mt_id} ORDER BY t.POSITION ASC";
        $query = new query($db, $sql);
        $mlist = null;
        $counter = 0;
        while ($query->getrow()) {
            // save the list, so that it will not go lost.
            $mlist[$counter][0] = $query->field("D1");
            $mlist[$counter][1] = $query->field("D2");
            $mlist[$counter][2] = $query->field("D3");
            $counter++;
        }
        // add the metainput fields.
        for ($i = 0; $i < $counter; $i++) {
            $specialID = $mlist[$i][0];
            // dispatch type.
            switch ($mlist[$i][1]) {
                case 1:
                    $obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:text,size:64,width:300");
                    break;
                case 2:
                    $obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:textarea,size:3,width:300");
                    break;
                case 3:
                    $obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:color,param:form1");
                    break;
            }
            if (isset($obj[$i])) {
                $metaPanel->add($obj[$i]);
            }
        }
        $specialID = "";
    }
}
Exemplo n.º 9
0
	function syncClids() {
	   global $db, $form;
	   $counter = 0;
	   $sql = "SELECT cv.CLID FROM cluster_variations cv, cluster_node cn WHERE cv.DELETED=0 AND cv.CLNID=cn.CLNID AND cn.VERSION=0";	
	   $query = new query($db, $sql);
	   while ($query->getrow()) {
	     syncCluster($query->field("CLID"));	
	     $counter++;
	   }	
	   //$form->addToTopText("<br/>".$lang->get("num_cl_sync", "Number of cluster who were synchronized").": ".$counter);
	}
Exemplo n.º 10
0
	/**
	 * initialized is automatically called by the form when doing the add-command
	 */
	function initialize() {
	  global $db, $auth, $aclf, $clusterEditState;
			
		// switch wrappers to Editmode
		$clusterEditState = true;
		
		// disable acls
		//if (!isset($aclf)) $aclf = $auth;	
	  // GET CONTENT OF THE CLUSTER		  
	  $plugins = null;
	  $types = null;   
	  // get the structure of the content.
	  $sql = "SELECT CLTI_ID, CLTITYPE_ID FROM cluster_template_items WHERE CLT_ID = $this->cltid AND FKID<>0 ORDER BY POSITION ASC";	
	  $query = new query($db, $sql);
  	while ($query->getrow()) {	  	
	  	$plugins[] = $query->field("CLTI_ID");
		  $types[] = $query->field("CLTITYPE_ID");  		
	  }
	  $query->free();
       
	  // draw plugin preview.
	  $len = count($plugins);
	  for ($i = 0; $i < $len; $i++) {
  		if ($types[$i] == 2)
	  		$this->parentForm->add(new ContentEnvelope($plugins[$i], $this->clid, true, true));

		  if ($types[$i] == 4)
			  $this->parentForm->add(new ClusterEnvelope($plugins[$i], $this->clid, true, true));

		  if ($types[$i] == 5)
			  $this->parentForm->add(new LibraryEnvelope($plugins[$i], $this->clid, true, true));

		  if ($types[$i] == 6)
			  $this->parentForm->add(new CompoundClusterEnvelope($plugins[$i], $this->clid, true, true));

      if ($types[$i] == 8)
         $this->parentForm->add(new ChannelEnvelope($plugins[$i], $this->clid, true, true));
	  }	  
	}
Exemplo n.º 11
0
	/**
	 * Sorts the Rows in a table ascending
	 *
	 * @param string $table Name of the table to sort
	 * @param string $indexColumn Name of the Primary Key of the table
	 * @param string $sortColumn Name of the Column to perform the sort about
	 * @param string $cond Where-Clause, to select only some rows.
	 */
	function sortTableRows($table, $indexColumn, $sortColumn, $cond = "1") {
		global $db;

		$sql = "SELECT $indexColumn, $sortColumn FROM $table WHERE $cond ORDER BY $sortColumn";
		$query = new query($db, $sql);

		while ($query->getrow()) {
			$values[$query->field($indexColumn)] = $query->field($sortColumn);
		}
        $query->free();
        if ($values != null)
			asort ($values);	
		
		$position = 1;
		
		if (is_array($values) && ($copy != $values)) {
			while (list($key, $val) = each($values)) {
				$sql = "UPDATE $table SET $sortColumn = $position WHERE $indexColumn = $key AND $cond";
				$query = new query($db, $sql);
				$query->free();
				$position++;
			}
		}
	}
Exemplo n.º 12
0
	/**
	 * retrieves the value of a variable from the variable stack.
	 * @param string name of the variable
	 */
	function getVar($name) {
		$back = "";

		global $auth, $db;
		$userId = $auth->userId;
		$sql = "SELECT VALUE FROM temp_vars WHERE USER_ID=$userId and NAME='$name'";
		$query = new query($db, $sql);

		if ($query->getrow()) {
			$back = $query->field("VALUE");
		} else {
			$back = "";
		}

		$query->free();

		return $back;
	}
Exemplo n.º 13
0
 /**
  *  Parses the placeholders [xxx] and launches the coresponding contents.
  *
  * @param string $text text to parse;
  * @param integer $variation Variation which is to be launched.
  */
 function launch($text, $variation)
 {
     global $db;
     if (preg_match_all('/\\[(.+?)\\]/is', $text, $matches)) {
         $tags = $matches[1];
         foreach ($tags as $tag) {
             $sql = 'SELECT c.CID FROM content c, state_translation t Where c.CID<>t.OUT_ID AND UPPER(c.ACCESSKEY)="' . strtoupper($tag) . '"';
             $query = new query($db, $sql);
             if ($query->getrow()) {
                 $id = $query->field('CID');
             }
             if ($id != "") {
                 launchContent($id, 10, $variation);
             }
         }
     }
     return $text;
 }
/**
 * 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('', '');
}
Exemplo n.º 15
0
/**
 * 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;
}
Exemplo n.º 16
0
 /**
  * Used to create a directory tree of the sitepages in a page
  * 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
  * @param string prefix, which to write in front of all foldernames. Leave blank, is internally used.
  * @param integer node where to start indexing
  */
 function createFolders(&$folder, $prefix, $node)
 {
     global $db, $oid, $c;
     $isFolder = true;
     $sql = "SELECT MENU_ID, NAME from sitemap WHERE DELETED = 0 AND PARENT_ID={$node} ORDER BY POSITION ASC";
     $query = new query($db, $sql);
     while ($query->getrow()) {
         $name = $query->field("NAME");
         $id = $query->field("MENU_ID");
         $nprefix = $prefix . "&nbsp;" . $name . "&nbsp;&gt;";
         $sql = "SELECT SPID FROM sitepage WHERE MENU_ID = {$id} ORDER BY POSITION";
         $subquery = new query($db, $sql);
         if ($subquery->getrow()) {
             $nextId = count($folder);
             $spid = $subquery->field("SPID");
             $folder[$nextId][0] = $nprefix;
             $folder[$nextId][1] = $spid;
         }
         $this->createFolders($folder, $nprefix, $id);
     }
     $query->free();
 }
						$form->add( new LibraryViewer($content[$i], 2, $linkset, "image"));
					 }
					 if (count($content) == 0) {
					   $form->add(new Label("lbl", "<center>".$lang->get("no_contents", "No Contents available in this folder.")."</center>", "standard", 2));	
					 }
			*/
			// $content = createDBCArray("
			if ( $clnid == 0) {
												
				$titles = array($lang->get("name", "Name"));
				$rows = array();
				
				$sql = "SELECT NAME, CLNID FROM cluster_node WHERE CLT_ID = $clt AND DELETED = 0 AND VERSION = 0 ORDER BY NAME";
				$query = new query($db, $sql);
				
				while ($query->getrow()) {
					array_push($rows, array($query->field("CLNID"), $query->field("NAME")));
				}
				if (count($rows)>0) {
					$form->add(new EmbeddedMenu($titles, $rows, $c["docroot"]."modules/cluster/clusterbrowser.php?sid=$sid&view=1&oid="));
				} else {
					$form->add(new Label("lbl", "<center>" . $lang->get("no_cluster", "There are no clusters."). "</center>", "standard", 2));	
				}		
			}

			$form->add(new Hidden("action", ""));
			$form->add(new Hidden("pnode", $pnode));
			$page->add($form);

	}
?>
		/**
		   * 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;
		}
Exemplo n.º 19
0
    $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}";
$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++) {
Exemplo n.º 20
0
	/**
	 * Copies a row an replaces specified values
	 * if translate is specified as value, the given id will be translated to a live id.
	 *
	 * @param string Name of table in which row shall be copied
	 * @param string Filter to apply on table to select record(s)
	 * @param array array[n]["column"]: Column to replace, array[n]["value"]: Value to set, array[n]["datatype"]: type of data (NUMBER|CHAR|DATE)
	 */
	function copyRow($table, $filter, $values) {
		global $db, $c_datatypes, $panic;		
		$sql = "SELECT * FROM $table WHERE $filter";
		$query = new query($db, $sql);

		for ($i = 0; $i < $query->count(); $i++) {
			$row = $query->getrow();

			$newRec = new CreateSet($table);

			$columns = $db->ADODB->MetaColumns($table);
			if (!is_array($columns)) return false;
			foreach ($columns as $name=>$obvalue) {
				$value[$n] = $query->field($name);
				foreach ($values as $vcol => $vval) {
					if ($name == $vcol) {
						if (sameText($vval, "translate")) {
							if (is_numeric($value[$n]) && ($value[$n] != "0"))
							  $value[$n] = translateState($value[$n], 10, false);
						} else {
						  $value[$n] = $vval;
						}
					}
				}
				$column[$n] = $name;
				$newRec->add($column[$n], $value[$n], $c_datatypes[$table][$name]);
			}
			$newRec->execute();			
		}		
	}
Exemplo n.º 21
0
		/**
		 * returns an array of CLNIDs assigned to a CLT_ID
		 * @param integer CLT_ID of the Cluster-Template to retrieve ClusterNodes for
		 * @param string Order by LAST_CHANGED|CREATED_AT|LAUNCHED_AT
		 * @param integer Variation-ID of the Cluster to retrieve
		 * @returns array Array of CLNIDs
		 */
		function getClusterField($clt, $orderBy="LAST_CHANGED",$variationId=null) {
			global $db, $cds;
			if ($variationId == null) $variationId = $cds->variation;
			if (strtoupper($orderBy) == "NAME") {
				$order = "cn.NAME ASC";
			} else {
				$order = "cv.".$orderBy." DESC";
			}
			$sql = "SELECT cn.CLNID FROM cluster_node cn, cluster_variations cv WHERE cn.CLT_ID = $clt AND cn.CLNID = cv.CLNID AND cn.DELETED = '0' AND cv.VARIATION_ID = $variationId ORDER BY ".$order;
			$query = new query($db, $sql);
			$array = array();
			while ($query->getrow()) {
				array_push ($array, $query->field("CLNID"));
			}
			return $array;
		}
Exemplo n.º 22
0
$step->setExplanation($lang->get("wze_articleimport_target", "On the right you need to select the target channel. All imported articles will be stored within this channel."));
////// STEP 2 //////
$step2 = new Step();
$step2->setTitle($lang->get("wzt_articleimport_srctype", "Select source type"));
$step2->setExplanation($lang->get("wze_articleimport_srctype", "Please select the type of source you want to import the articles from."));
$source_types[0][0] = $lang->get("multipage", "Multipage");
$source_types[0][1] = "PAGE";
//$source_types[1][0] = $lang->get("channel");
//$source_types[1][1] = "CHANNEL";
//$source_types[2][0] = $lang->get("cluster");
//$source_types[2][1] = "CLUSTER";
$step2->add(new WZRadio("source_type", $source_types));
////// Step 3 //////
// determine singlepages
$sql = "Select distinct sm.MENU_ID FROM sitemap sm, sitepage_master spm WHERE sm.SPM_ID = spm.SPM_ID and sm.VERSION=0";
$query = new query($db, $sql);
$sourcePages = array();
while ($query->getrow()) {
    $sourcePages[] = array(backTrail($query->field("MENU_ID")), $query->field("MENU_ID"));
}
sort($sourcePages);
$step3 = new Step();
$step3->add(new WZSelect("menuid", $lang->get("wz_imp_selcl", "Zu importierenden Knoten wählen"), $sourcePages));
$stepx = new STImportToChannel();
$wizard->add($step);
$wizard->add($step2);
$wizard->add($step3);
$wizard->add($stepx);
$page->add($wizard);
$page->draw();
echo $errors;
Exemplo n.º 23
0
	/**
	* Get the Cluster-ID (CLID) from a Sitepage-ID and a Variation-ID.
	* @param	integer		Sitepage-ID (given as page)
	* @param	integer		Variation-ID (given as v)
	* @returns integer		Id of the cluster (clid)
	*/
	function getPageCluster($page, $variation) {
		global $db;

		$sql = "SELECT 
	 				cv.CLID 
	 			FROM 
	 				cluster_variations cv,
	 				cluster_node cn, 
	 				sitepage sp 
	 			WHERE
	 				sp.SPID = $page
	 			AND sp.CLNID = cn.CLNID
	 			AND cn.CLNID = cv.CLNID
	 			AND cv.VARIATION_ID = $variation";

		$query = new query($db, $sql);

		if ($query->getrow())
			return $query->field("CLID");
	}
Exemplo n.º 24
0
	/**
* Creates or retrieves a Translation of the object.
* @param integer ID of the object to launch
* @param integer level, which is to be created or retrieved. Level for Live is 10! 
* @param boolean True, if entry in ACL is to be done, false if not.
* @returns integer Translated ID for specified level.
*/
	function translateState($in, $level = 10, $setacl = true) {
		global $db, $acl;

		$out = 0;
		$sql = "SELECT OUT_ID FROM state_translation WHERE IN_ID = $in AND LEVEL = $level";
		$query = new query($db, $sql);

		if ($query->getrow()) {
			$out = $query->field("OUT_ID");

			if ($setacl) {
				$sql = "UPDATE state_translation SET MODIFIED = NOW()";

				$sql .= " , EXPIRED=0";
				$sql .= " WHERE IN_ID = $in";
				$query = new query($db, $sql);
			}

			$query->free();
		} else {
			$out = $db->nextid("GUID");

			$sql = "INSERT INTO state_translation (IN_ID, OUT_ID, LEVEL, MODIFIED, EXPIRED) VALUES ($in, $out, $level, NOW(),0)";
			$query = new query($db, $sql);
			$query->free();
		}

		if ($in != "")
			if ($setacl)
				array_push($acl, $in);

		return $out;
	}
Exemplo n.º 25
0
		/**
		 * 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);
		}
		/**
		 * Retrieve the Items of the Template figure
		 */
		function getItemData() {
			global $db;
			$members = null;
			$sql = "SELECT CLCID, TITLE FROM cluster_content WHERE CLID = $this->cl AND CLTI_ID = $this->clti ORDER BY POSITION";
			$query = new query($db, $sql);
			while ($query->getrow()) {
				$ni = count($members);
				$members[$ni][0] = $query->field("TITLE");
				$members[$ni][1] = $query->field("CLCID");
			}
			$query->free();	
			$this->membersCount = count($members);
            return $members;
		}
		/**
		  * 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();
		}
Exemplo n.º 28
0
<?
	require_once "config.inc.php";

	$sql = "SELECT DECODE(PASSWORD, \"" . $c["dbcode"] . "\") as pw, USER_ID FROM users WHERE 1";
	$query = new query($db, $sql);

	while ($query->getrow()) {
		$pw = md5($query->field("pw"));

		$uid = $query->field("USER_ID");
		$sql = "UPDATE users SET PASSWORD='******' WHERE USER_ID = $uid";
		$q2 = new query($db, $sql);
	}
?>
Exemplo n.º 29
0
 /**
  * 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();
 }
	/**
	 * 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);
	}