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;
 }
 /**
  *  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;
 }
	/**********************************************************************
	 *@module Application
	 **********************************************************************/
	if (! $aclf->hasAccess($auth->userId))
	  header("Location: ". $c["docroot"]."modules/common/noaccess.php?sid=$sid&guid=$pnode");
	
	 // process object actions.
	$linkset = value("linkset", "NOSPACES");
	$sname = value("sname", "NOSPACES");
	$filter = value("filter", "NOSPACES");
	
	if ($action != "0") {
	
		/** Create a new object **/
		if ($action == "launch" && $aclf->checkAccessToFunction("OBJECT_LAUNCH")) {
			launchContent($oid, 10, $variation);
			if ($errors == "") {
				$topText = $lang->get("objlaunch_success", "The object was successfully launched.");
			}	
		}
		
		if ($action == $lang->get("new_content") && $aclf->checkAccessToFunction("NEW_OBJECT")) {
			$handled = true;

			if (!isset($go) || $go == "0")
				$go = "insert";

			if ($go == "insert")
				$page_action = "INSERT";
			$form = new stdEDForm($lang->get("o_new"), "i_edit.gif");
			$cond = $form->setPK("content", "CID");
/** 
 * Launch a Cluster-Template-Item
 * @param integer ID to launch
 * @param integer ID of the corresponding Cluster-Template
 * @param integer ID of the level to launch to
 * @param integer ID of the variation to launch.
 * @returns integer Translated ID after launch
 */
function launchClusterTemplateItem($in, $clt, $level, $variation)
{
    global $db;
    if (!checkACL($in)) {
        $out = translateState($in, $level);
        $sql = "SELECT NAME, POSITION, MINCARD, MAXCARD, FKID, CLTITYPE_ID FROM cluster_template_items WHERE CLTI_ID = {$in}";
        $query = new query($db, $sql);
        $query->getrow();
        $name = addslashes($query->field("NAME"));
        $position = $query->field("POSITION");
        $type = $query->field("CLTITYPE_ID");
        $mincard = $query->field("MINCARD");
        $maxcard = $query->field("MAXCARD");
        $fkid = $query->field("FKID");
        $foreign = $fkid;
        // launch static content or cluster-instance.
        if ($type == 1) {
            $foreign = launchContent($fkid, $level, $variation);
        }
        if ($type == 2) {
            launchPgnConfigStore($in);
        }
        if ($type == 3) {
            $foreign = launchCluster($fkid, $level, $variation);
        }
        if ($type == 7) {
            $foreign = translateState($fkid, $level, false);
        }
        $sql = "DELETE FROM cluster_template_items WHERE CLTI_ID = {$out}";
        $query = new query($db, $sql);
        $sql = "INSERT INTO cluster_template_items (CLTI_ID, CLT_ID, NAME, POSITION, MINCARD, MAXCARD, FKID, CLTITYPE_ID, DELETED, VERSION) ";
        $sql .= "VALUES ({$out}, {$clt}, '{$name}', {$position}, {$mincard}, {$maxcard}, {$foreign}, {$type}, 0, {$level})";
        $query = new query($db, $sql);
        $query->free();
        return $out;
    } else {
        return translateState($in, $level);
    }
}
Example #5
0
/**
* Launch a Cluster-Content-Item
* @param integer CLCID to launch
* @param integer ID of the level to launch to.
* @param integer ID of the variation to launch.
* @return integer Translated ID after launch
*/
function launchClusterContent($in, $level, $variation)
{
    global $db;
    if (!checkACL($in)) {
        $out = translateState($in, $level);
        $sql = "SELECT * FROM cluster_content WHERE CLCID = {$in} AND DELETED=0";
        $query = new query($db, $sql);
        $query->getrow();
        $clid = $query->field("CLID");
        $clti = $query->field("CLTI_ID");
        $posi = $query->field("POSITION");
        $title = addslashes($query->field("TITLE"));
        $fkid = $query->field("FKID");
        $delme = $query->field("DELETED");
        // get type from clti...
        $sql = "SELECT CLTITYPE_ID, FKID FROM cluster_template_items WHERE CLTI_ID = {$clti}";
        $query = new query($db, $sql);
        $query->getrow();
        $type = $query->field("CLTITYPE_ID");
        $clfktype = $query->field("FKID");
        $fkTrans = 0;
        if ($fkid != 0 && ($type == 4 || $type == 6)) {
            $fkTrans = launchCluster($fkid, $level, $variation);
        }
        if ($type == 2) {
            launchPlugin($in, $clfktype, $level, $clti);
        }
        if ($fkid != 0 && $type == 5) {
            $fkTrans = launchContent($fkid, $level, $variation);
        }
        if ($type == 8) {
            $fkTrans = launchCenterstage($in, $level);
        }
        // translate ids
        $clid = translateState($clid, $level, false);
        $clti = translateState($clti, $level, false);
        $sql = "DELETE FROM cluster_content WHERE CLCID = {$out}";
        $query = new query($db, $sql);
        $sql = "INSERT INTO cluster_content (CLCID, CLID, CLTI_ID, POSITION, TITLE, FKID, DELETED) VALUES ";
        $sql .= "({$out}, {$clid}, {$clti}, {$posi}, '{$title}', {$fkTrans}, {$delme})";
        $query = new query($db, $sql);
        $query->free();
        return $out;
    } else {
        return translateState($in, $level);
    }
}