/**
 * 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;
}
<?php

require_once "nxheader.inc.php";
include $cds->path . "inc/header.php";
// Start of individual template
echo '<h1>User Login</h1>';
echo '<center>';
$menu = new Menu(null, $cds->pageId, $cds->variation, $cds->level);
$action = $menu->getLink();
$le = value("le", "NOSPACES", "");
$mail = value("mail", "", "");
if ($le == 'unknown') {
    echo '<span style="color:#cc0000;">Error: The username is unknown.</span>';
} else {
    if ($le == "pwd") {
        echo '<span style="color:#cc0000;">Error: Incorrect password.</span>';
    } else {
        if ($le == "confirm") {
            echo '<span style="color:#cc0000;">Error: You did not confirm your account yet.</span><br>Request E-Mail-Confirmation';
        }
    }
}
echo '<form method="post" action="' . $action . '">';
echo '<input type="hidden" name="page" value="' . $cds->pageId . '">';
echo '<input type="hidden" name="v" value="' . $cds->variation . '">';
echo '<table width="400" border="0" cellpadding="0" cellspacing="0">';
echo '<tr>';
echo '<td width="180" align="left">E-Mail-Address:</td>';
echo '<td width="220" align="right"><input type="text" name="email" style="width:200px;" value="' . $mail . '"></td>';
echo '</tr>';
echo '<tr>';
Exemple #3
0
 function getChildList(&$menu, $page_id, $treat_title = false)
 {
     if (CURRENT_SITE == 'admin') {
         $checkactive = false;
         $checkvisible = false;
     } else {
         $checkactive = true;
         $checkvisible = true;
     }
     $children = $menu->getChildren($page_id, $checkactive, $checkvisible);
     $html = '';
     $submenu = array();
     foreach ($children as $child) {
         $html .= "\t<li>";
         $info = $menu->getInfo($child['id']);
         if (isset($GLOBALS['page_id']) && $GLOBALS['page_id'] == $info['id']) {
             $html .= '<b>';
         }
         $html .= Menu::getLink($info, $treat_title);
         if (isset($GLOBALS['page_id']) && $GLOBALS['page_id'] == $info['id']) {
             $html .= '</b>';
         }
         if ($menu->isBranch($child['id'], $checkactive, $checkactive)) {
             $html .= Menu::getChildList($menu, $child['id'], $treat_title);
         }
         $html .= "</li>\n";
     }
     if ($html) {
         $html = "<ul>\n" . $html . "</ul>\n\n";
     }
     return $html;
 }
		/**
		 * Draw the most wanted links alphabetically sorted with the top links biggest.
		 * @param integer $topCount  Number of pages that will be returned
		 * @param integer $itemsPerRow   Number of items in one row
		 * @param integer $minsize Minumum font size in pixel
     * @param integer $maxsize Maximum font size in pixel
     */
		function drawBand($topCount=30, $itemsPerRow=10, $minsize=11,$maxsize=48) {
			global $cds;
			global $db;
			$max=0;
			$min=10000000000;
			$data = array();			
			$sql = "SELECT count( a.document_id ) AS nmu, d.String, n.NAME FROM pot_documents d, pot_accesslog a, sitepage p, sitepage_names n WHERE a.document_id = d.data_id AND d.string = p.SPID AND p.DELETED=0 AND p.VERSION=10 AND p.SPID=n.SPID AND n.VARIATION_ID=$cds->variation GROUP BY d.String, n.NAME ORDER BY n.NAME ASC LIMIT 0,".$topCount;					
			$query = new query($db, $sql);
			while ($query->getrow()) {
			   $menu = new Menu(null, $query->field("String"), $cds->variation, $cds->level );			   
			   $page = array($menu->getLink(), $query->field("nmu"), $query->field("NAME"));
			   $max = max($max, $query->field("nmu"));
			   $min = min($min, $query->field("nmu"));
			   $data[] = $page;	
			}
			$query->free();
			$out = "";
			
			for ($i=0; $i < count($data); $i++) {
				$size = round((($data[$i][1] - $min) / (($max-$min)+0.1)) * ($maxsize-$minsize) + $minsize);
				if ($size > $maxsize) $size = $maxsize;
				if ($size < $minsize) $size = $minsize;
				if (($i % $itemsPerRow) == 0) $out.= '<br/>';				
				$out.='<a href="'.$data[$i][0].'" style="font-size:'.$size.'px;">'.$data[$i][2].'</a>&nbsp;&nbsp;';
			}			
			return $out;			
		}
			/**
		 * To be used in header.inc.php to determine the URI of the startpage.
		 * to use.
		 * @param integer ID of the variation the Startpage should be find in.
		 * @returns	integer		Sitepage-ID of the first sitepage to use.
		 */		
		function getStartPageURI($variation=0, $level=10) {
			global $c;
			
			$uri=0;
			$pageId = 0;
			
			if ($variation == 0)
			  $variation = $c["stdvariation"];
			$zeroTrans = getDBCell("state_translation", "OUT_ID", "IN_ID=0 AND LEVEL=10");
			
			if ($level < 10) {
				$menues = createDBCArray("sitemap", "MENU_ID", "IS_DISPLAYED=1 AND PARENT_ID=0 ORDER BY POSITION ASC");
			} else {
				$menues = createDBCArray("sitemap", "MENU_ID", "IS_DISPLAYED=1 AND PARENT_ID=$zeroTrans ORDER BY POSITION ASC");
			}

			for ($i = 0; $i < count($menues); $i++) {
				$spids = createDBCArray("sitepage", "SPID", "MENU_ID = " . $menues[$i] . " ORDER BY POSITION");
				for ($j = 0; $j < count($spids); $j++) {
					if (!isSPExpired($spids[$j], $variation, $level)) {
						$pageId =  $spids[$j];
			 			$menu =	new Menu(null, $pageId, $variation, $level);
		  			return $c["host"].$menu->getLink();			
					}
				}
			}		  		 			
		}