Пример #1
0
/**
 *  Creates the new sitemap.xml
 */
function updateSitemap()
{
    global $c;
    // Create sitemap
    $map = new GoogleSiteMap();
    // Get the startnode of the live website;
    $startNode = translateState(0, 10);
    // Is there a live-website?
    if (strlen($startNode) > 0) {
        addWebsite($startNode, $map);
        $map->CloseMap();
        $map->WriteFlux($c["livepath"] . "sitemap.xml");
    }
}
Пример #2
0
 function image($attr = null)
 {
     if (is_numeric($attr["ID"])) {
         $newid = translateState($attr["ID"], 10, false);
         $output = '{NX:IMAGE ID="' . $newid . '"';
         $manualattribs = array("ID", "SRC", "VARIATION");
         foreach ($attr as $key => $value) {
             if (!in_array(strtoupper($key), $manualattribs)) {
                 $output .= " " . strtoupper($key) . "=\"" . $value . "\"";
             }
         }
         $output .= '}';
         launchContent($attr["ID"], 10, $attr["VARIATION"]);
     }
     return $output;
 }
 /**
  * draw the object.
  */
 function draw()
 {
     /** Create the value array **/
     global $db;
     $folders = null;
     $folders[0][0] = ">";
     $folders[0][1] = 0;
     if ($this->livepages) {
         $this->createFolders($folders, ">", translateState(0, 10, false));
     } else {
         $this->createFolders($folders, ">", 0);
     }
     // set the values
     $this->v_wuiobject->value = $folders;
     // draw the object
     DBO::draw();
     return 2;
 }
Пример #4
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;
}
Пример #5
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();			
		}		
	}
Пример #6
0
	/** 
	* Launch a Content-Variation
	* @param integer CID to launch
	* @param integer ID of the plugin the content is of 
	* @param integer ID of the level to launch to.
	* @param integer ID of the variation to launch.
	* @returns integer Translated ID after launch
	*/
	function launchContentVariation($in, $plugin, $level, $variation) {
		global $db;

		$out = translateState($in, $level);
		$sql = "SELECT FK_ID, DELETED FROM content_variations WHERE CID = $in AND VARIATION_ID = $variation";
		$query = new query($db, $sql);
		$query->getrow();
		$fkid = $query->field("FK_ID");
		$delme = $query->field("DELETED");

		if ($fkid == "" && $variation != 1) {
			$sql = "SELECT FK_ID, DELETED FROM content_variations WHERE CID = $in AND VARIATION_ID = 1";

			$query = new query($db, $sql);
			$query->getrow();
			$fkid = $query->field("FK_ID");
			$variation = 1;
			$delme = $query->field("DELETED");
		}

		if ($fkid != "") {
			$fkidTrans = launchPlugin($fkid, $plugin, $level);

			$sql = "DELETE FROM content_variations WHERE CID = $out AND VARIATION_ID = $variation";
			$query = new query($db, $sql);
			$sql = "INSERT INTO content_variations (CID, FK_ID, DELETED, VARIATION_ID) VALUES ($out, $fkidTrans, $delme, $variation)";
			$query = new query($db, $sql);
		}

		$query->free();
		return $out;
	}
Пример #7
0
		/**
		   * 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 * FROM $this->management_table WHERE $this->pk_name = $this->fkid";
			$query = new query($db, $querySQL);
			$query->getrow();
			$label = addslashes($query->field("LABEL"));
			$href = $query->field("HREF");
			$spid = $query->field("SPID");
			$spidTrans = translateState($spid, 10, false);
			$target = $query->field("TARGET");
			$query->free();
			$sql = "INSERT INTO $this->management_table ($this->pk_name, LABEL, HREF, SPID, TARGET) VALUES ($newid, '$label', '$href', $spidTrans,'$target')";
			return $sql;
		}
Пример #8
0
		/** 
		  * Used, for painting a preview of the content in the cms. Note, that the data
		  * is to be drawn in a table cell. Therefore you may design any html output, but
		  * you must return it as return value!
		  */
		function preview() {
			global $lang;						
			$out= ' Impressions: '.getDBCell("hits", "HIT", "ID=".translateState($this->fkid, 10, false));			
			return $out;
		}
Пример #9
0
		/**
		 * Sets an item to be live.
		 * @param integer specifies the id of the launched version of the item.
		 */
		function launch() {
			$launchedid = translateState($this->id, 10, false);

			$launchtime = time();
			addUpdate("journal", "LAUNCHED", $launchtime, "ITEM_ID = $this->id", "NUMBER");
			addUpdate("journal", "LAUNCHED_BY", $this->userId, "ITEM_ID = $this->id", "NUMBER");
			addUpdate("journal", "LAUNCHED_ID", $launchedid, "ITEM_ID = $this->id", "NUMBER");
			$this->itemStatus["launched"]["time"] = $launchtime;
			$this->itemStatus["launched"]["by"] = $this->userId;
		// echo "Journal entry launched";
		}
Пример #10
0
/**
 * Expire an article
 * @param integer ID of the article to expire
 * @param integer ID of the level that will be expired
 * @param integer ID of the variation to expire
 */
function expireArticle($articleId, $level, $variation)
{
    global $db;
    $articleIdTrans = translateState($articleId, $level, false);
    clearArticleURL($articleIdTrans, $variation);
    deleteRow("channel_articles", "ARTICLE_ID = {$articleIdTrans}");
    expireCluster($articleId, $variation);
}
/**
 * Delete a meta-template-figure
 * @param integer GUID of the figure
 */
function deleteClusterTemplateFigure($id)
{
    deleteRow("cluster_template_items", "CLTI_ID = {$id}");
    $id = translateState($id, 10, false);
    deleteRow("cluster_template_items", "CLTI_ID = {$id}");
}
Пример #12
0
/** 
 * Launch a Meta-Template-Item
 * @param integer ID to launch
 * @param integer ID of the corresponding Meta-TEmplate.
 * @param integer ID of the level to launch to
 * @returns integer Translated ID after launch
 */
function launchMetaTemplateItem($in, $mt, $level)
{
    global $db;
    if (!checkACL($in)) {
        $out = translateState($in, $level);
        $sql = "SELECT NAME, POSITION, MTYPE_ID FROM meta_template_items WHERE MTI_ID = {$in}";
        $query = new query($db, $sql);
        $query->getrow();
        $name = addslashes($query->field("NAME"));
        $position = $query->field("POSITION");
        $type = $query->field("MTYPE_ID");
        $sql = "DELETE FROM meta_template_items WHERE MTI_ID = {$out}";
        $query = new query($db, $sql);
        $sql = "INSERT INTO meta_template_items (MTI_ID, MT_ID, NAME, POSITION, MTYPE_ID, VERSION) VALUES ({$out}, {$mt}, '{$name}', {$position}, {$type}, {$level})";
        $query = new query($db, $sql);
        $query->free();
        return $out;
    } else {
        return translateState($in, $level);
    }
}
Пример #13
0
/**
 * Expire a cluster-instance
 * @param integer clnid to expire
 * @param integer variation to expire
 */
function expireCluster($clnid, $variation)
{
    global $db;
    $clid = translateState(getDBCell("cluster_variations", "CLID", "CLNID = {$clnid} AND VARIATION_ID = {$variation}"), 10, false);
    $sql = "UPDATE state_translation SET EXPIRED = 1 WHERE OUT_ID = {$clid}";
    $query = new query($db, $sql);
    $query->free();
}
/**
* Launch available Sitepage-Variations. 
* @param integer SPM_ID to launch 
* @param integer Level, you want to launch to. 
*/
function launchSPMVariations($spm, $level)
{
    global $db;
    $out = translateState($spm, $level, false);
    $vars = createDBCArray("sitepage_variations", "VARIATION_ID", "SPM_ID = {$spm}");
    $sql = "DELETE FROM sitepage_variations WHERE SPM_ID = {$out}";
    $query = new query($db, $sql);
    for ($i = 0; $i < count($vars); $i++) {
        $sql = "INSERT INTO sitepage_variations (SPM_ID, VARIATION_ID) VALUES ( {$out}, " . $vars[$i] . ")";
        $query = new query($db, $sql);
    }
    $query->free();
}