diff --git a/t3lib/class.t3lib_div.php b/t3lib/class.t3lib_div.php index bcfcb504a2428ec36d33968417c942868ec87337..200bec44c5dc4281ce4edc3630ea40cbf75f8bf2 100755 --- a/t3lib/class.t3lib_div.php +++ b/t3lib/class.t3lib_div.php @@ -1510,6 +1510,24 @@ class t3lib_div { return implode(' ',$list); } } + + /** + * Wraps JavaScript code XHTML ready with <script>-tags + * + * @param string JavaScript code + * @return string The wrapped JS code, ready to put into a XHTML page + * @author Ingmar Schlecht <ingmars@web.de> + */ + function wrapJS($JSCode) { + return ' +<script type="text/javascript"> + /*<![CDATA[*/ +'.$JSCode.' + /*]]>*/ +</script> +'; + } + /** * Parses XML input into a PHP array with associative keys diff --git a/t3lib/class.t3lib_positionmap.php b/t3lib/class.t3lib_positionmap.php index 5b3cd6cb3d903ab8babd59f1f2ce777f067259fc..53beca6b22720a8a940cb8f252ea00478d2e4fcc 100755 --- a/t3lib/class.t3lib_positionmap.php +++ b/t3lib/class.t3lib_positionmap.php @@ -29,29 +29,82 @@ * @package TYPO3 * @subpackage t3lib */ - +/** + * [CLASS/FUNCTION INDEX of SCRIPT] + * + * + * + * 76: class t3lib_positionMap + * 95: function positionTree($id,$pageinfo,$perms_clause,$R_URI) + * 178: function JSimgFunc($prefix='') + * 187: function changeImg(name,d) + * 207: function boldTitle($t_code,$dat,$id) + * 218: function onClickEvent($pid) + * 226: function insertlabel() + * 236: function linkPageTitle($str,$rec) + * 244: function checkNewPageInPid($pid) + * 258: function insertQuadLines($codes,$allBlank=0) + * 288: function printContentElementColumns($pid,$moveUid,$colPosList,$showHidden,$R_URI) + * 318: function printRecordMap($lines,$colPosArray) + * 338: function wrapColumnHeader($str,$vv) + * 350: function insertPositionIcon($row,$vv,$kk,$moveUid,$pid) + * 363: function onClickInsertRecord($row,$vv,$moveUid,$pid,$sys_lang=0) + * 381: function wrapRecordHeader($str,$row) + * 389: function getRecordHeader($row) + * 400: function wrapRecordTitle($str,$row) + * + * TOTAL FUNCTIONS: 17 + * (This index is automatically created/updated by the extension "extdeveval") + * + */ + + + + + + + + + +/** + * Position map class. + * + * @author Kasper Skårhøj <kasper@typo3.com> + * @package TYPO3 + * @subpackage t3lib + */ class t3lib_positionMap { + var $getModConfigCache=array(); var $checkNewPageCache=Array(); - var $R_URI=""; - var $elUid=""; - var $moveUid=""; - var $moveOrCopy="move"; - var $l_insertNewPageHere = "insertNewPageHere"; - var $l_insertNewRecordHere = "insertNewRecordHere"; + + var $R_URI=''; + var $elUid=''; + var $moveUid=''; + var $moveOrCopy='move'; + var $l_insertNewPageHere = 'insertNewPageHere'; + var $l_insertNewRecordHere = 'insertNewRecordHere'; var $dontPrintPageInsertIcons=0; - var $backPath=""; + var $backPath=''; + var $modConfigStr='mod.web_list.newPageWiz'; var $cur_sys_language; + /** + * @param [type] $id: ... + * @param [type] $pageinfo: ... + * @param [type] $perms_clause: ... + * @param [type] $R_URI: ... + * @return [type] ... + */ function positionTree($id,$pageinfo,$perms_clause,$R_URI) { global $LANG; - $t3lib_pageTree = t3lib_div::makeInstance("localPageTree"); - $t3lib_pageTree->init(" AND ".$perms_clause); - $t3lib_pageTree->addField("pid"); + $t3lib_pageTree = t3lib_div::makeInstance('localPageTree'); + $t3lib_pageTree->init(' AND '.$perms_clause); + $t3lib_pageTree->addField('pid'); $this->R_URI = $R_URI; $this->elUid = $id; $depth=2; - $t3lib_pageTree->getTree($pageinfo["pid"], $depth); + $t3lib_pageTree->getTree($pageinfo['pid'], $depth); if (!$this->dontPrintPageInsertIcons) $code.=$this->JSimgFunc(); reset($t3lib_pageTree->tree); @@ -61,66 +114,71 @@ class t3lib_positionMap { while(list($cc,$dat)=each($t3lib_pageTree->tree)) { // Make link + parameters. - $latestInvDepth=$dat["invertedDepth"]; + $latestInvDepth=$dat['invertedDepth']; $saveLatestUid[$latestInvDepth]=$dat; if (isset($t3lib_pageTree->tree[$cc-1])) { $prev_dat = $t3lib_pageTree->tree[$cc-1]; // If current page, subpage? - if ($prev_dat["row"]["uid"]==$id) { - if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id) && !($prev_dat["invertedDepth"]>$t3lib_pageTree->tree[$cc]["invertedDepth"])) { // 1) It must be allowed to create a new page and 2) If there are subpages there is no need to render a subpage icon here - it'll be done over the subpages... + if ($prev_dat['row']['uid']==$id) { + if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id) && !($prev_dat['invertedDepth']>$t3lib_pageTree->tree[$cc]['invertedDepth'])) { // 1) It must be allowed to create a new page and 2) If there are subpages there is no need to render a subpage icon here - it'll be done over the subpages... // $params='&edit[pages]['.$id.']=new&returnNewPageId=1'; - $code.='<nobr>'.$this->insertQuadLines($dat["blankLineCode"]).'<img src=clear.gif width=18 height=8 align=top><a href="#" onClick="'.$this->onClickEvent($id).'" onmouseover="changeImg(\'mImgSubpage'.$cc.'\',0);" onmouseout="changeImg(\'mImgSubpage'.$cc.'\',1);"><img name="mImgSubpage'.$cc.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; + $code.='<nobr>'.$this->insertQuadLines($dat['blankLineCode']).'<img src=clear.gif width=18 height=8 align=top><a href="#" onClick="'.$this->onClickEvent($id,$id,1).'" onmouseover="changeImg(\'mImgSubpage'.$cc.'\',0);" onmouseout="changeImg(\'mImgSubpage'.$cc.'\',1);"><img name="mImgSubpage'.$cc.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; } } - if ($prev_dat["invertedDepth"]>$t3lib_pageTree->tree[$cc]["invertedDepth"]) { // If going down - $prevPid = $t3lib_pageTree->tree[$cc]["row"]["pid"]; - } elseif ($prev_dat["invertedDepth"]<$t3lib_pageTree->tree[$cc]["invertedDepth"]) { // If going up + if ($prev_dat['invertedDepth']>$t3lib_pageTree->tree[$cc]['invertedDepth']) { // If going down + $prevPid = $t3lib_pageTree->tree[$cc]['row']['pid']; + } elseif ($prev_dat['invertedDepth']<$t3lib_pageTree->tree[$cc]['invertedDepth']) { // If going up // First of all the previous level should have an icon: - if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($prev_dat["row"]["pid"])) { - $prevPid = (-$prev_dat["row"]["uid"]); + if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($prev_dat['row']['pid'])) { + $prevPid = (-$prev_dat['row']['uid']); // $params='&edit[pages]['.$prevPid.']=new&returnNewPageId=1'; - $code.='<nobr>'.$this->insertQuadLines($dat["blankLineCode"]).'<img src=clear.gif width=18 height=1 align=top><a href="#" onClick="'.$this->onClickEvent($prevPid).'" onmouseover="changeImg(\'mImgAfter'.$cc.'\',0);" onmouseout="changeImg(\'mImgAfter'.$cc.'\',1);"><img name="mImgAfter'.$cc.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; + $code.='<nobr>'.$this->insertQuadLines($dat['blankLineCode']).'<img src=clear.gif width=18 height=1 align=top><a href="#" onClick="'.$this->onClickEvent($prevPid,$prev_dat['row']['pid'],2).'" onmouseover="changeImg(\'mImgAfter'.$cc.'\',0);" onmouseout="changeImg(\'mImgAfter'.$cc.'\',1);"><img name="mImgAfter'.$cc.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; } // Then set the current prevPid - $prevPid = -$prev_dat["row"]["pid"]; + $prevPid = -$prev_dat['row']['pid']; } else { - $prevPid = -$prev_dat["row"]["uid"]; // In on the same level + $prevPid = -$prev_dat['row']['uid']; // In on the same level } } else { - $prevPid = $dat["row"]["pid"]; // First in the tree + $prevPid = $dat['row']['pid']; // First in the tree } - if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat["row"]["pid"])) { + if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) { // $params='&edit[pages]['.$prevPid.']=new&returnNewPageId=1'; - $code.='<nobr>'.$this->insertQuadLines($dat["blankLineCode"]).'<a href="#" onClick="'.$this->onClickEvent($prevPid).'" onmouseover="changeImg(\'mImg'.$cc.'\',0);" onmouseout="changeImg(\'mImg'.$cc.'\',1);"><img name="mImg'.$cc.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; + $code.='<nobr>'.$this->insertQuadLines($dat['blankLineCode']).'<a href="#" onClick="'.$this->onClickEvent($prevPid,$dat['row']['pid'],3).'" onmouseover="changeImg(\'mImg'.$cc.'\',0);" onmouseout="changeImg(\'mImg'.$cc.'\',1);"><img name="mImg'.$cc.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; } // The line with the icon and title: - $t_code='<nobr>'.$dat["HTML"].$this->linkPageTitle($this->boldTitle(htmlspecialchars(t3lib_div::fixed_lgd($dat["row"]["title"],$BE_USER->uc["titleLen"])),$dat,$id),$dat["row"])."<nobr><BR>"; + $t_code='<nobr>'.$dat['HTML'].$this->linkPageTitle($this->boldTitle(htmlspecialchars(t3lib_div::fixed_lgd($dat['row']['title'],$BE_USER->uc['titleLen'])),$dat,$id),$dat['row']).'<nobr><BR>'; $code.=$t_code; } // If the current page was the last in the tree: $prev_dat = end($t3lib_pageTree->tree); - if ($prev_dat["row"]["uid"]==$id) { + if ($prev_dat['row']['uid']==$id) { if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id)) { // $params='&edit[pages]['.$id.']=new&returnNewPageId=1'; - $code.='<nobr>'.$this->insertQuadLines($saveLatestUid[$latestInvDepth]["blankLineCode"],1).'<img src=clear.gif width=18 height=8 align=top><a href="#" onClick="'.$this->onClickEvent($id).'" onmouseover="changeImg(\'mImgSubpage'.$cc.'\',0);" onmouseout="changeImg(\'mImgSubpage'.$cc.'\',1);"><img name="mImgSubpage'.$cc.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; + $code.='<nobr>'.$this->insertQuadLines($saveLatestUid[$latestInvDepth]['blankLineCode'],1).'<img src=clear.gif width=18 height=8 align=top><a href="#" onClick="'.$this->onClickEvent($id,$id,4).'" onmouseover="changeImg(\'mImgSubpage'.$cc.'\',0);" onmouseout="changeImg(\'mImgSubpage'.$cc.'\',1);"><img name="mImgSubpage'.$cc.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; } } for ($a=$latestInvDepth;$a<=$depth;$a++) { $dat = $saveLatestUid[$a]; - $prevPid = (-$dat["row"]["uid"]); - if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat["row"]["pid"])) { - $code.='<nobr>'.$this->insertQuadLines($dat["blankLineCode"],1).'<a href="#" onClick="'.$this->onClickEvent($prevPid).'" onmouseover="changeImg(\'mImgEnd'.$a.'\',0);" onmouseout="changeImg(\'mImgEnd'.$a.'\',1);"><img name="mImgEnd'.$a.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; + $prevPid = (-$dat['row']['uid']); + if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) { + $code.='<nobr>'.$this->insertQuadLines($dat['blankLineCode'],1).'<a href="#" onClick="'.$this->onClickEvent($prevPid,$dat['row']['pid'],5).'" onmouseover="changeImg(\'mImgEnd'.$a.'\',0);" onmouseout="changeImg(\'mImgEnd'.$a.'\',1);"><img name="mImgEnd'.$a.'" src="gfx/newrecord_marker_d.gif" width="281" height="8" border="0" title="'.$this->insertlabel().'" align=top></a><nobr><BR>'; } } return $code; } - function JSimgFunc($prefix="") { + + /** + * @param [type] $prefix: ... + * @return [type] ... + */ + function JSimgFunc($prefix='') { $code.=' <script language="javascript" type="text/javascript"> var img_newrecord_marker=new Image(); @@ -142,69 +200,134 @@ class t3lib_positionMap { '; return $code; } + + /** + * @param [type] $t_code: ... + * @param [type] $dat: ... + * @param [type] $id: ... + * @return [type] ... + */ function boldTitle($t_code,$dat,$id) { - if ($dat["row"]["uid"]==$id) { + if ($dat['row']['uid']==$id) { $t_code='<strong>'.$t_code.'</strong>'; } return $t_code; } - function onClickEvent($pid) { + + /** + * @param [type] $pid: ... + + * @return [type] ... + */ + function onClickEvent($pid,$newPagePID) { + $TSconfigProp = $this->getModConfig($newPagePID); + + if ($TSconfigProp['useTemplaVoila']) { + if (t3lib_extMgm::isLoaded('templavoila')) { + $onclick = "document.location='".t3lib_extMgm::extRelPath('templavoila')."mod1/index.php?cmd=crPage&positionPid=".$pid."';"; + return $onclick; + } + } + $params='&edit[pages]['.$pid.']=new&returnNewPageId=1'; - return t3lib_BEfunc::editOnClick($params,"",$this->R_URI); + return t3lib_BEfunc::editOnClick($params,'',$this->R_URI); } + + /** + * @return [type] ... + */ function insertlabel() { global $LANG; return $LANG->getLL($this->l_insertNewPageHere); } + + /** + * @param [type] $str: ... + * @param [type] $rec: ... + * @return [type] ... + */ function linkPageTitle($str,$rec) { return $str; } + + /** + * @param [type] $pid: ... + * @return [type] ... + */ function checkNewPageInPid($pid) { global $BE_USER; if (!isset($this->checkNewPageCache[$pid])) { - $pidInfo = t3lib_BEfunc::getRecord("pages",$pid); + $pidInfo = t3lib_BEfunc::getRecord('pages',$pid); $this->checkNewPageCache[$pid] = ($BE_USER->isAdmin() || $BE_USER->doesUserHaveAccess($pidInfo,8)); } return $this->checkNewPageCache[$pid]; } - function insertQuadLines($codes,$allBlank=0) { - $codeA = t3lib_div::trimExplode(",",$codes.",line",1); - + + /** + * @param [type] $pid: ... + * @return [type] ... + */ + function getModConfig($pid) { + global $BE_USER; + if (!isset($this->getModConfigCache[$pid])) { + // Acquiring TSconfig for this PID: + $this->getModConfigCache[$pid] = t3lib_BEfunc::getModTSconfig($pid,$this->modConfigStr); + } + return $this->getModConfigCache[$pid]['properties']; + } + + /** + * @param [type] $codes: ... + * @param [type] $allBlank: ... + * @return [type] ... + */ + function insertQuadLines($codes,$allBlank=0) { + $codeA = t3lib_div::trimExplode(',',$codes.",line",1); + $lines=array(); while(list(,$code)=each($codeA)) { if ($code=="blank" || $allBlank) { $lines[]='<img src="clear.gif" width="18" height="8" align=top>'; } else { - $lines[]='<img src="gfx/ol/halfline.gif" width="18" height="8" align=top>'; + $lines[]='<img src="gfx/ol/halfline.gif" width="18" height="8" align="top">'; } } - return implode("",$lines); + return implode('',$lines); } - - + + + + /** + * @param [type] $pid: ... + * @param [type] $moveUid: ... + * @param [type] $colPosList: ... + * @param [type] $showHidden: ... + * @param [type] $R_URI: ... + * @return [type] ... + */ function printContentElementColumns($pid,$moveUid,$colPosList,$showHidden,$R_URI) { $this->R_URI = $R_URI; $this->moveUid = $moveUid; - $colPosArray = t3lib_div::trimExplode(",",$colPosList,1); + $colPosArray = t3lib_div::trimExplode(',',$colPosList,1); $lines=array(); while(list($kk,$vv)=each($colPosArray)) { - $query = "SELECT * FROM tt_content WHERE pid=".intval($pid). - ($showHidden ? "" : t3lib_BEfunc::BEenableFields("tt_content")). - " AND colPos=".$vv. - (strcmp($this->cur_sys_language,"") ? " AND sys_language_uid=".intval($this->cur_sys_language) : ""). - t3lib_BEfunc::deleteClause("tt_content"). - " ORDER BY sorting"; + $query = 'SELECT * FROM tt_content WHERE pid='.intval($pid). + ($showHidden ? "" : t3lib_BEfunc::BEenableFields('tt_content')). + ' AND colPos='.$vv. + (strcmp($this->cur_sys_language,'') ? " AND sys_language_uid=".intval($this->cur_sys_language) : ""). + t3lib_BEfunc::deleteClause('tt_content'). + ' ORDER BY sorting'; $res = mysql(TYPO3_db,$query); $lines[$kk]=array(); - $lines[$kk][]=$this->insertPositionIcon("",$vv,$kk,$moveUid,$pid); + $lines[$kk][]=$this->insertPositionIcon('',$vv,$kk,$moveUid,$pid); while($row=mysql_fetch_assoc($res)) { $lines[$kk][]=$this->wrapRecordHeader($this->getRecordHeader($row),$row); $lines[$kk][]=$this->insertPositionIcon($row,$vv,$kk,$moveUid,$pid); @@ -212,53 +335,100 @@ class t3lib_positionMap { } return $this->printRecordMap($lines,$colPosArray); } + + /** + * @param [type] $lines: ... + * @param [type] $colPosArray: ... + * @return [type] ... + */ function printRecordMap($lines,$colPosArray) { - $row1=""; - $row2=""; + $row1=''; + $row2=''; reset($colPosArray); while(list($kk,$vv)=each($colPosArray)) { - $row1.='<td align=center width="'.round(100/count($colPosArray)).'%"><strong>'.$this->wrapColumnHeader(t3lib_div::danish_strtoupper($GLOBALS["LANG"]->sL(t3lib_BEfunc::getLabelFromItemlist("tt_content","colPos",$vv))),$vv).'</strong></td>'; + $row1.='<td align=center width="'.round(100/count($colPosArray)).'%"><strong>'.$this->wrapColumnHeader(t3lib_div::danish_strtoupper($GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','colPos',$vv))),$vv).'</strong></td>'; $row2.='<td valign=top nowrap>'.implode('<BR>',$lines[$kk]).'</td>'; } $table = '<table border=0 cellpadding=0 cellspacing=1> - <tr bgColor="'.$GLOBALS["SOBE"]->doc->bgColor5.'">'.$row1.'</tr> + <tr bgColor="'.$GLOBALS['SOBE']->doc->bgColor5.'">'.$row1.'</tr> <tr>'.$row2.'</tr> </table>'; - return $this->JSimgFunc("2").$table; + return $this->JSimgFunc('2').$table; } + + /** + * @param [type] $str: ... + * @param [type] $vv: ... + * @return [type] ... + */ function wrapColumnHeader($str,$vv) { return $str; } + + /** + * @param [type] $row: ... + * @param [type] $vv: ... + * @param [type] $kk: ... + * @param [type] $moveUid: ... + * @param [type] $pid: ... + * @return [type] ... + */ function insertPositionIcon($row,$vv,$kk,$moveUid,$pid) { - $cc = hexdec(substr(md5($row["uid"]."-".$vv."-".$kk),0,4)); - return '<a href="#" onClick="'.$this->onClickInsertRecord($row,$vv,$moveUid,$pid,$this->cur_sys_language).'" onmouseover="changeImg(\'mImg'.$cc.'\',0);" onmouseout="changeImg(\'mImg'.$cc.'\',1);"><img name="mImg'.$cc.'" src="gfx/newrecord2_marker_d.gif" width="100" height="8" border="0" title="'.$GLOBALS["LANG"]->getLL($this->l_insertNewRecordHere).'" align=top></a>'; + $cc = hexdec(substr(md5($row['uid'].'-'.$vv.'-'.$kk),0,4)); + return '<a href="#" onClick="'.$this->onClickInsertRecord($row,$vv,$moveUid,$pid,$this->cur_sys_language).'" onmouseover="changeImg(\'mImg'.$cc.'\',0);" onmouseout="changeImg(\'mImg'.$cc.'\',1);"><img name="mImg'.$cc.'" src="gfx/newrecord2_marker_d.gif" width="100" height="8" border="0" title="'.$GLOBALS['LANG']->getLL($this->l_insertNewRecordHere).'" align=top></a>'; } + + /** + * @param [type] $row: ... + * @param [type] $vv: ... + * @param [type] $moveUid: ... + * @param [type] $pid: ... + * @param [type] $sys_lang: ... + * @return [type] ... + */ function onClickInsertRecord($row,$vv,$moveUid,$pid,$sys_lang=0) { - $table="tt_content"; + $table='tt_content'; if (is_array($row)) { - $location="tce_db.php?cmd[".$table."][".$moveUid."][".$this->moveOrCopy."]=-".$row["uid"].'&prErr=1&uPT=1&vC='.$GLOBALS["BE_USER"]->veriCode(); + $location='tce_db.php?cmd['.$table.']['.$moveUid.']['.$this->moveOrCopy.']=-'.$row['uid'].'&prErr=1&uPT=1&vC='.$GLOBALS['BE_USER']->veriCode(); } else { - $location="tce_db.php?cmd[".$table."][".$moveUid."][".$this->moveOrCopy."]=".$pid."&data[".$table."][".$moveUid."][colPos]=".$vv.'&prErr=1&vC='.$GLOBALS["BE_USER"]->veriCode(); + $location='tce_db.php?cmd['.$table.']['.$moveUid.']['.$this->moveOrCopy.']='.$pid.'&data['.$table.']['.$moveUid.'][colPos]='.$vv.'&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode(); } // $location.='&redirect='.rawurlencode($this->R_URI); // returns to prev. page - $location.='&uPT=1&redirect='.rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI")); // This redraws screen - + $location.='&uPT=1&redirect='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')); // This redraws screen + return 'document.location=\''.$location.'\';return false;'; } + + /** + * @param [type] $str: ... + * @param [type] $row: ... + * @return [type] ... + */ function wrapRecordHeader($str,$row) { return $str; } + + /** + * @param [type] $row: ... + * @return [type] ... + */ function getRecordHeader($row) { - $line = t3lib_iconWorks::getIconImage("tt_content",$row,$this->backPath,t3lib_BEfunc::titleAttrib(t3lib_BEfunc::getRecordIconAltText($row,"tt_content"),1).' align=top'); - $line.= t3lib_BEfunc::getRecordTitle("tt_content",$row,1); + $line = t3lib_iconWorks::getIconImage('tt_content',$row,$this->backPath,t3lib_BEfunc::titleAttrib(t3lib_BEfunc::getRecordIconAltText($row,'tt_content'),1).' align=top'); + $line.= t3lib_BEfunc::getRecordTitle('tt_content',$row,1); return $this->wrapRecordTitle($line,$row); } + + /** + * @param [type] $str: ... + * @param [type] $row: ... + * @return [type] ... + */ function wrapRecordTitle($str,$row) { - return '<a href="'.t3lib_div::linkThisScript(array("uid"=>intval($row["uid"]),"moveUid"=>"")).'">'.$str.'</a>'; + return '<a href="'.t3lib_div::linkThisScript(array('uid'=>intval($row['uid']),'moveUid'=>'')).'">'.$str.'</a>'; } } -if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["t3lib/class.t3lib_positionmap.php"]) { - include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["t3lib/class.t3lib_positionmap.php"]); +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_positionmap.php']) { + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_positionmap.php']); } -?> \ No newline at end of file +?> diff --git a/typo3/alt_clickmenu.php b/typo3/alt_clickmenu.php index 2ab193f7b412f27b21e89cee4f0977ce19b7ff7f..ac276488fbb926eca0e1e8cca2a3847728167e27 100755 --- a/typo3/alt_clickmenu.php +++ b/typo3/alt_clickmenu.php @@ -1164,6 +1164,12 @@ class SC_alt_clickmenu { $clickMenu->clipObj = $clipObj; $clickMenu->extClassArray = $this->extClassArray; $clickMenu->dontDisplayTopFrameCM = $this->dontDisplayTopFrameCM; + + // Takes the backPath as a parameter BUT since we are worried about someone forging a backPath (XSS security hole) we will check with sent md5 hash: + $inputBP = explode('|',t3lib_div::GPvar('backPath')); + if (count($inputBP)==2 && $inputBP[1]==md5($inputBP[0].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { + $clickMenu->backPath = $inputBP[0]; + } // Start page $this->content.=$this->doc->startPage('Context Sensitive Menu'); diff --git a/typo3/db_new.php b/typo3/db_new.php index e47131249d6d85d517408cade80677c05acead12..7e21f49c052ee3a0fde3e037fdb072bdf8f670ad 100755 --- a/typo3/db_new.php +++ b/typo3/db_new.php @@ -24,19 +24,43 @@ * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -/** +/** * New database item menu * - * This script lets users choose a new database element to create. + * This script lets users choose a new database element to create. * Includes a wizard mode for visually pointing out the position of new pages * * @author Kasper Skårhøj <kasper@typo3.com> - * @package TYPO3 - * @subpackage core * * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj * XHTML compliant (not with pages wizard yet... position map and other classes needs cleaning) */ +/** + * [CLASS/FUNCTION INDEX of SCRIPT] + * + * + * + * 92: class localPageTree extends t3lib_pageTree + * 101: function wrapIcon($icon,$row) + * 112: function expandNext($id) + * + * + * 125: class SC_db_new + * 151: function init() + * 208: function main() + * 265: function pagesOnly() + * 281: function regularNew() + * 414: function printContent() + * 431: function linkWrap($code,$table,$pid,$addContentTable=0) + * 451: function isTableAllowedForThisPage($pid_row, $checkTable) + * 481: function showNewRecLink($table,$allowedNewTables='') + * + * TOTAL FUNCTIONS: 10 + * (This index is automatically created/updated by the extension "extdeveval") + * + */ + + $BACK_PATH=''; @@ -60,11 +84,19 @@ require_once (PATH_t3lib.'class.t3lib_pagetree.php'); /** * Extension for the tree class that generates the tree of pages in the page-wizard mode + * + * @author Kasper Skårhøj <kasper@typo3.com> + * @package TYPO3 + * @subpackage core */ class localPageTree extends t3lib_pageTree { /** * Inserting uid-information in title-text for an icon + * + * @param [type] $icon: ... + * @param [type] $row: ... + * @return [type] ... */ function wrapIcon($icon,$row) { return substr($icon,0,-1).' title="id='.htmlspecialchars($row['uid']).'">'; @@ -73,6 +105,9 @@ class localPageTree extends t3lib_pageTree { /** * Determines whether to expand a branch or not. * Here the branch is expanded if the current id matches the global id for the listing/new + * + * @param [type] $id: ... + * @return [type] ... */ function expandNext($id) { return $id==$GLOBALS['SOBE']->id ? 1 : 0; @@ -81,7 +116,11 @@ class localPageTree extends t3lib_pageTree { /** - * Script class for 'dn_new' + * Script class for 'db_new' + * + * @author Kasper Skårhøj <kasper@typo3.com> + * @package TYPO3 + * @subpackage core */ class SC_db_new { var $pageinfo; @@ -106,6 +145,8 @@ class SC_db_new { /** * Constructor + * + * @return [type] ... */ function init() { global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA; @@ -161,6 +202,8 @@ class SC_db_new { /** * Main processing + * + * @return [type] ... */ function main() { global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA; @@ -216,6 +259,8 @@ class SC_db_new { /** * Creates the position map for pages wizard + * + * @return [type] ... */ function pagesOnly() { global $LANG; @@ -230,6 +275,8 @@ class SC_db_new { /** * Create a regular new element (pages and records) + * + * @return [type] ... */ function regularNew() { global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA; @@ -361,6 +408,8 @@ class SC_db_new { /** * Ending page output and echo'ing content to browser. + * + * @return [type] ... */ function printContent() { global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA; @@ -372,6 +421,12 @@ class SC_db_new { /** * Links the string $code to a create-new form for a record in $table created on page $pid * If $addContentTable is set, then a new contentTable record is created together with pages + * + * @param [type] $code: ... + * @param [type] $table: ... + * @param [type] $pid: ... + * @param [type] $addContentTable: ... + * @return [type] ... */ function linkWrap($code,$table,$pid,$addContentTable=0) { $params = '&edit['.$table.']['.$pid.']=new'. @@ -388,54 +443,59 @@ class SC_db_new { /** * Returns true if the tablename $checkTable is allowed to be created on the page with record $pid_row + * + * @param [type] $pid_row: ... + * @param [type] $checkTable: ... + * @return [type] ... */ function isTableAllowedForThisPage($pid_row, $checkTable) { global $TCA, $PAGES_TYPES; if (!is_array($pid_row)) { - if ($GLOBALS["BE_USER"]->user["admin"]) { + if ($GLOBALS['BE_USER']->user['admin']) { return true; } else { return false; } } // be_users and be_groups may not be created anywhere but in the root. - if ($checkTable=="be_users" || $checkTable=="be_groups") { + if ($checkTable=='be_users' || $checkTable=='be_groups') { return false; } // Checking doktype: - $doktype = intval($pid_row["doktype"]); - if (!$allowedTableList = $PAGES_TYPES[$doktype]["allowedTables"]) { - $allowedTableList = $PAGES_TYPES["default"]["allowedTables"]; + $doktype = intval($pid_row['doktype']); + if (!$allowedTableList = $PAGES_TYPES[$doktype]['allowedTables']) { + $allowedTableList = $PAGES_TYPES['default']['allowedTables']; } - if (strstr($allowedTableList,"*") || t3lib_div::inList($allowedTableList,$checkTable)) { // If all tables or the table is listed as a allowed type, return true + if (strstr($allowedTableList,'*') || t3lib_div::inList($allowedTableList,$checkTable)) { // If all tables or the table is listed as a allowed type, return true return true; } } /** * Returns true if the $table tablename is found in $allowedNewTables (or if $allowedNewTables is empty) + * + * @param [type] $table: ... + * @param [type] $allowedNewTables: ... + * @return [type] ... */ - function showNewRecLink($table,$allowedNewTables="") { + function showNewRecLink($table,$allowedNewTables='') { $allowedNewTables = is_array($allowedNewTables) ? $allowedNewTables : $this->allowedNewTables; return !count($allowedNewTables) || in_array($table,$allowedNewTables); } } // Include extension? -if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/db_new.php"]) { - include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/db_new.php"]); +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/db_new.php']) { + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/db_new.php']); } - - // Make instance: -$SOBE = t3lib_div::makeInstance("SC_db_new"); +$SOBE = t3lib_div::makeInstance('SC_db_new'); $SOBE->init(); $SOBE->main(); $SOBE->printContent(); - -?> \ No newline at end of file +?> diff --git a/typo3/template.php b/typo3/template.php index 0b95d63cc2480e4245cd599a5287904a0c1397c3..923b6f28e23d46f6cea5fd79fd9c3a41be93c9eb 100755 --- a/typo3/template.php +++ b/typo3/template.php @@ -251,7 +251,7 @@ class template { /** * Makes click menu link (context sensitive menu) - * Returns $str (possibly an <img> tag/icon) wrapped in a link which will activate the context sensitive menu for the record ($table/$uid) or file ($table = file) + * Returns $str (possibly an <|img> tag/icon) wrapped in a link which will activate the context sensitive menu for the record ($table/$uid) or file ($table = file) * The link will load the top frame with the parameter "&item" which is the table,uid and listFr arguments imploded by "|": rawurlencode($table.'|'.$uid.'|'.$listFr) * * @param string String to be wrapped in link, typ. image tag. @@ -261,7 +261,7 @@ class template { * @return string The link-wrapped input string. */ function wrapClickMenuOnIcon($str,$table,$uid='',$listFr=1) { - $onClick = 'top.loadTopMenu(\''.$this->backPath.'alt_clickmenu.php?item='.rawurlencode($table.'|'.$uid.'|'.$listFr).'\');'.$this->thisBlur().'return false;'; + $onClick = 'top.loadTopMenu(\''.$this->backPath.'alt_clickmenu.php?item='.rawurlencode($table.'|'.$uid.'|'.$listFr).($this->backPath?'&backPath='.rawurlencode($this->backPath.'|'.md5($this->backPath.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])):'').'\');'.$this->thisBlur().'return false;'; return '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.$str.'</a>'; }