Wednesday, March 25, 2009

How to set “Show Flash Inline” property by default in the “ah_newsext” extension.

PROBLEM: “Show Flash Inline” by default is unchecked and to view the preview of the video in the frontend is required that this property is checked.

SOLUTION: We added and set the “default” property to 1 inside the “config” array located in the ”tx_ahnewsext_flash_inline” array in the “ext_tables.php” file:

"tx_ahnewsext_flash_inline" => Array ( ## WOP:[fields][1][fields][5][fieldname]
"exclude" => 1, ## WOP:[fields][1][fields][5][excludeField]
"label" => "LLL:EXT:ah_newsext/locallang_db.xml:tt_news.tx_ahnewsext_flash_inline", ## WOP:[fields][1][fields][5][title]
"config" => Array (
"type" => "check",
##"checkbox" => "1",
"default" => 1
)
),

Then, in order to simplify the backend interface, we removed “Show flash Inline” option changing the “ext_tables.php”:

t3lib_extMgm::addToAllTCAtypes("tt_news","tx_ahnewsext_flash_file;;;;1-1-1, tx_ahnewsext_flash_inline, tx_ahnewsext_flash_width, tx_ahnewsext_flash_height"); ##tx_ahnewsext_prev_file, tx_ahnewsext_prev_width, tx_ahnewsext_prev_height, tx_ahnewsext_flash_wo_player, tx_ahnewsext_flash_downloadlink, x_ahnewsext_flash_downloadfile, tx_ahnewsext_flash_access, tx_ahnewsext_flash_about_text

with this line of code:

t3lib_extMgm::addToAllTCAtypes("tt_news","tx_ahnewsext_flash_file;;;;1-1-1, tx_ahnewsext_flash_width, tx_ahnewsext_flash_height"); ## tx_ahnewsext_flash_inline , tx_ahnewsext_prev_file, tx_ahnewsext_prev_width, tx_ahnewsext_prev_height, tx_ahnewsext_flash_wo_player, tx_ahnewsext_flash_downloadlink, x_ahnewsext_flash_downloadfile, tx_ahnewsext_flash_access, tx_ahnewsext_flash_about_text

Monday, March 23, 2009

How to add a TAB in a backend form (for example: tt_news)

PROBLEM: How to add a TAB in tt_news backend form?
SOLUTION: in tables.php, replace the t3lib_extMgm::addToAllTCAtypes with

t3lib_extMgm::addToAllTCAtypes("tt_news","--div--;NAME_OF_MY_TAB,NAME_OF_THE_CLASS;;;;1-1-1");

Friday, March 20, 2009

Mysql function for stripping tags

PROBLEM: How to clean a query of our publications extension from HTML tags?

SOLUTION: We used this stored procedure in mysql database http://forums.mysql.com/read.php?52,177343,177985#msg-177985


SET GLOBAL log_bin_trust_function_creators=1;
DROP FUNCTION IF EXISTS fnStripTags;
DELIMITER |
CREATE FUNCTION fnStripTags( Dirty varchar(4000) )
RETURNS varchar(4000)
DETERMINISTIC
BEGIN
DECLARE iStart, iEnd, iLength int;
WHILE Locate( '<', Dirty ) > 0 And Locate( '>', Dirty, Locate( '<', Dirty )) > 0 DO
BEGIN
SET iStart = Locate( '<', Dirty ), iEnd = Locate( '>', Dirty, Locate('<', Dirty )); SET iLength = ( iEnd - iStart) + 1; IF iLength > 0 THEN
BEGIN
SET Dirty = Insert( Dirty, iStart, iLength, '');
END;
END IF;
END;
END WHILE;
RETURN Dirty;
END;
|
DELIMITER ;

Example: SELECT fnStripTags('this is a test, nothing more');

Wednesday, March 18, 2009

mediatag configuration in DAM and RTE

PROBLEM: We found that once saved a text in the RTE with a link to a file of the DAM repository, the link was changed to:

<media_xxxx>...</media>

SOLUTION:

In the Media(DAM) extension, make sure the "media tag [mediatag]" is unchecked because

this property adds the tag to RTE content processing and frontend rendering.

Tuesday, March 17, 2009

Youtube video in News (ttnews_youtube)

In order to embed YouTube videos in tt_news, we installed the extension " ttnews_youtube ". To better use this new functionalities, we did these changes:

- We modified tt_news templates in tt_news extension /pi/ folder and in our DAM folder to embed the marker ###YOUTUBEVIDEO### closed to ###NEWS_IMAGE### like:

###NEWS_IMAGE###
###FLASHINNEWS_FLASH###
###YOUTUBEVIDEO###

- in “class.tx_ttnewsyoutube.php” file the Youtube video URL must be "http://www.youtube.com/v/" instead of “http://www.youtube.com/watch?v=“ for "$video" variable file and added the query string "&hl=en&fs=1&color1=0x234900&color2=0x4e9e00&showinfo=0" to customize the video player. This is the complete changes result:

...
$content = '
<object width="'.$width.'" height="'.$height.'">
<param name="movie" value="'.str_replace("watch?v=", "v/", ($row['tx_ttnewsyoutube_youtubevideo'])).'"></param>
<param name="allowFullScreen" value="true"></param>
<param name="wmode" value="transparent"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="'.str_replace("watch?v=", "v/", ($row['tx_ttnewsyoutube_youtubevideo'])).'&hl=en&fs=1&color1=0x234900&color2=0x4e9e00&showinfo=0" type="application/x-shockwave-flash" allowfullscreen="true"
allowscriptaccess="always" wmode="transparent" width="'.$width.'" height="'.$height.'"></embed>
</object>';
...

Youtube videos in tt_content (itaw_youtoubeembed)

In order to embed YouTube videos in tt_content, we installed the extension "itaw_youtoubeembed".

We replaced the URL of the Youtube video: “http://www.youtube.com/watch?v=“ and inserted the query string to customize the player of the video in the "pi1/class.tx_itawyoutoubeembed_pi1.php" file

...

$content='
<object width="'.$video_width.'" height="'.$video_height.'">
<param name="movie" value="http://www.youtube.com/v/'.$video.'"> </param>
<embed src="http://www.youtube.com/v/'.$video.'" type="application/x-shockwave-flash" width="'.$video_width.'" height="'.$video_height.'"> </embed>
</object>
';

...

with “http://www.youtube.com/v/“ and the query string "&hl=en&fs=1&color1=0x234900&color2=0x4e9e00&showinfo=0" in these lines of code:

...

$content='
<object width="'.$video_width.'" height="'.$video_height.'">
<param name="movie" value="'.$video.'"> </param>
<embed src="'.str_replace("watch?v=", "v/", $video).'&hl=en&fs=1&color1=0x234900&color2=0x4e9e00&showinfo=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'.$video_width.'" height="'.$video_height.'"> </embed>
</object>
';

...

Monday, March 16, 2009

How to debug Typo3 files - How to set up Typo3 with Xdebug, Xampp and phpDesigner2008

PROBLEM: how can we debug php files of typo3 installations? How can we debug the extensions we are working on to fix bugs?

SOLUTION: We used Xdebug, phpDesigner 2008 as IDE, SVN. Have a look at this tutorial!


In this tutorial we are going to set up debugging of Typo3 with a php editor like phpDesigner 2008 in Windows XP environment.

Pre-requisites:
  • A local copy of the typo3 installation (located into the apache web root; in Xampp we have it under the htdocs folder)
  • Xampp
  • PhpDesigner 2008.
Steps for installing and configuring Apache, Xampp and Xdebug:

  1. Download XAMPP at http://www.apachefriends.org/en/xampp-windows.html
    Click on the saved file and an icon will ask where to extract the files; extract them to c:\Program Files.
  2. The system will save the files into the C:\Program Files\xampp.
    Open the folder and click the setup_xampp.bat; this will configure all files to work correctly in your system like the php.ini needed by apache web server.
  3. Download the Xdebug dll located in http://www.xdebug.org/download.php; the version you have to install is the 5.2 VC6 that will work fine with the latetest release of Xampp (In this guide we refer to Xampp Windows version 1.7.0)
    Save the dll file into the folder C:\Program Files\xampp\php\ext\
  4. Go into the C:\Program Files\xampp\php folder
    We need to modify here the php.ini in this way:
    - In the [Zend] section comment all the lines putting a ; at the line beginning
    - In the [Xdebug] section you must have this lines:
    zend_extension_ts="C:\Program Files\xampp\php\ext\php_xdebug-2.0.4-5.2.8.dll"
    xdebug.remote_enable=true
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp
    xdebug.profiler_enable=1
    xdebug.profiler_output_dir="C:\Program Files\xampp\tmp"

  5. Copy and paste the C:\Program Files\xampp\php\php.ini into C:\Program Files\xampp\apache\bin (overwriting the existing php.ini)

  6. Open the C:\Program Files\xampp\xampp-control.exe and a tray icon will appear by which we can control xampp services like mysql and apache. To verify Xampp is working fine open a browser like Firefox and type http://localhost/xampp/; if installation goes fine you should see the xampp welcome page.
  7. Go in C:\Program Files\xampp\htdocs and move all existing files in another folder: you can perform this creating a new temporary folder under htdocs named /temp and cut and paste the files under /htdocs into /htdocs/temp.

  8. Copy online Typo3 installation into C:\Program Files\xampp\htdocs. If you use SVN or a CVS, perform a checkout of the typo3 repository.

Steps for setting up Firefox:
  1. Download Firefox add-on located in https://addons.mozilla.org/en-US/firefox/addon/3960
  2. Once the installation is finished, in Firefox go to the menu Tools -> Add-ons and select the Options button under Xdebug Helper addon to access the setup page.
  3. In the first text box of the add-on be sure these lines are present:
    zend_extension_ts=php_xdebug.dll
    xdebug.remote_enable=1
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.idekey=default

  4. In the second text box insert phpDesigner2008. This key represents the Xdebug idekey value that allows firefox understanding which integrated development environment (IDE) we will use to start the debug mode (users can install also Eclipse, Netbeans, etc.)

  5. The extension will insert an icon in the status bar: clicking on it the linkage with Xdebug will be active or disabled.
    If the icon is green firefox will run pages in debug mode.

Steps to configure the IDE phpDesigner2008:

  1. Create the project selecting the folder C:\Program Files\xampp\htdocs; phpDesigner will import all files located under the htdocs folder.

  2. Open the menu Tools -> Preferences

  3. Select Debugger and in the PHP panel insert C:\Program Files\xampp\php\php-cgi.exe, under the Configuration panel insert C:\Program Files\xampp\php\php.ini
  4. Select Run (under debugger) and under the php panel write C:\Program Files\xampp\php\php-cgi.exe and under configuration panel insert C:\Program Files\xampp\php\php.ini

  5. Select localhost (under debugger) and under Server path write http://localhost while in Local Server Path write C:\Program Files\xampp\htdocs; the port must be the 80.

If all settings are written correctly when you open a page from Firefox like http://localhost/index.php with the "debug mode" activated (see Xdebug helper icon), Firefox will interact with your IDE. In the IDE you can insert breakpoints and Firefox will allow your debugginh the php files of your typo3 installation.

LDAP Typo3 - How to modify eu_ldap

PROBLEM: We installed a great extension for connecting our Active Directory with Typo3 but we were not satisfied of how this extension works by default.
For example usergroup did not work well with our installation and this blocked the update of existing users linked to internal groups so we changed it as follows:

File: mod1/index.php

<?php

/***************************************************************

* Copyright notice

*

* (c) 2003 Norman Seibert (seibert@entios.de)

* All rights reserved

*

* This script is part of the Typo3 project. The Typo3 project is

* free software; you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation; either version 2 of the License, or

* (at your option) any later version.

*

* The GNU General Public License can be found at

* http://www.gnu.org/copyleft/gpl.html.

*

* This script is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General Public License for more details.

*

* This copyright notice MUST APPEAR in all copies of the script!

***************************************************************/

/**

* Module 'LDAP Integration' for the 'eu_ldap' extension.

*

* @author Norman Seibert <seibert@entios.de>

*/







// DEFAULT initialization of a module [BEGIN]

unset($MCONF);

require ('conf.php');

require_once ('class.tx_euldap_div.php');

require ($BACK_PATH.'init.php');

require ($BACK_PATH.'template.php');

include ('locallang.php');

require_once (PATH_t3lib.'class.t3lib_scbase.php');

$BE_USER->modAccess($MCONF, 1);

// This checks permissions and exits if the users has no permission for entry.

// DEFAULT initialization of a module [END]



class tx_euldap_module1 extends t3lib_SCbase {

var $pageinfo;



/**

* @return [type] ...

*/

function init() {

global $AB, $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $HTTP_GET_VARS,
$HTTP_POST_VARS, $CLIENT, $TYPO3_CONF_VARS;



parent::init();



/*

if (t3lib_div::GPvar('clear_all_cache')) {

$this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';

}

*/

}



/**

* Adds items to the->MOD_MENU array. Used for the function menu selector.

*

* @return [type] ...

*/

function menuConfig() {

global $LANG;

$this->MOD_MENU = Array (

'function' => Array (

'1' => $LANG->getLL('function1'),

'2' => $LANG->getLL('function2'),

'3' => $LANG->getLL('function3'),

'4' => $LANG->getLL('function4'),

'5' => $LANG->getLL('function5'),

'6' => $LANG->getLL('function6'),

'7' => $LANG->getLL('function7'),

)

);

parent::menuConfig();

}



// If you chose "web" as main module, you will need to consider the $this->id
parameter which will contain the uid-number of the page clicked in the page tree

/**

* Main function of the module. Write the content to $this->content

*

* @return [type] ...

*/

function main() {

global $AB, $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $HTTP_GET_VARS,
$HTTP_POST_VARS, $CLIENT, $TYPO3_CONF_VARS;



// Access check!

// The page will show only if there is a valid page and if this page may be
viewed by the user

$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);

$access = is_array($this->pageinfo) ? 1 :

0;



if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id)) {



// Draw the header.

$this->doc = t3lib_div::makeInstance('mediumDoc');

$this->doc->backPath = $BACK_PATH;

$this->doc->form = '<form action="" method="POST">';



// JavaScript

$this->doc->JScode = '

<script language="javascript">

script_ended = 0;

function jumpToUrl(URL) {

document.location = URL;

}

</script>

';

$this->doc->postCode = '

<script language="javascript">

script_ended = 1;

if (top.theMenu) top.theMenu.recentuid = '.intval($this->id).';

</script>

';



$headerSection = $this->doc->getHeader('pages', $this->pageinfo,
$this->pageinfo['_thePath']).'<br>'.$LANG->php3Lang['labels']['path'].':
'.t3lib_div::fixed_lgd_pre($this->pageinfo['_thePath'], 50);



$this->content .= $this->doc->startPage($LANG->getLL('title'));

$this->content .= $this->doc->header($LANG->getLL('title'));

$this->content .= $this->doc->spacer(5);

$this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection,
t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]',
$this->MOD_SETTINGS['function'], $this->MOD_MENU['function'])));

$this->content .= $this->doc->divider(5);





// Render content:

$this->moduleContent();





// ShortCut

if ($BE_USER->mayMakeShortcut()) {

$this->content .= $this->doc->spacer(20).$this->doc->section('',
$this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)),
$this->MCONF['name']));

}



$this->content .= $this->doc->spacer(10);

} else {

// If no access or if ID == zero



$this->doc = t3lib_div::makeInstance('mediumDoc');

$this->doc->backPath = $BACK_PATH;



$this->content .= $this->doc->startPage($LANG->getLL('title'));

$this->content .= $this->doc->header($LANG->getLL('title'));

$this->content .= $this->doc->spacer(5);

$this->content .= $this->doc->spacer(10);

}

}



/**

* Prints out the module HTML

*

* @return [type] ...

*/

function printContent() {

global $SOBE;



$this->content .= $this->doc->middle();

$this->content .= $this->doc->endPage();

echo $this->content;

}



/**

* [Describe function...]

*

* @return [type] ...

*/

function moduleContent() {

global $LANG, $HTTP_POST_VARS;

// debug($GLOBALS['HTTP_GET_VARS']);

// debug($GLOBALS['HTTP_POST_VARS']);



tx_euldap_div::initChar('');



$doCommand = false;



$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'count(*) as cnt',

'tx_euldap_server',

'pid IN ('.$this->id.')'

);

$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres);

if ($row['cnt']) {

if ($HTTP_POST_VARS['submit']) {

$doCommand = true;

} else {

$this->content .= '<input type="submit" name="submit"
value="'.$LANG->getLL('submit').'" />';

}

} else {

$this->content .= $LANG->getLL('no_servers');

}



if ($doCommand && $this->id) {

switch((string)$this->MOD_SETTINGS['function']) {

case 1: //summary

// Frontend-Users

$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'count(*)',

'fe_users',

'NOT deleted AND pid = '.$this->id

);

if ($dbres) $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($dbres);

$content = '<div>'.$row[0].' '.$LANG->getLL('users').'</div>';

$this->content .= $this->doc->section('Frontend:', $content, 0, 1);

// Backend-Users

$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'count(*)',

'be_users',

'NOT deleted'

);

if ($dbres) $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($dbres);

$content = '<div>'.$row[0].' '.$LANG->getLL('users').'</div>';

$this->content .= $this->doc->section('Backend:', $content, 0, 1);

// LDAP

$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'*',

'tx_euldap_server',

'pid IN ('.$this->id.')'

);

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {

$ldapserver = $row['server'];

$ldapres = tx_euldap_div::search_ldap($row, '*');

$content = '<div>'.$ldapres['count'].' '.$LANG->getLL('users').'</div>';

$this->content .= $this->doc->section($ldapserver.":", $content, 0, 1);

}

break;

case 2: //update FE-users

$content = $this->index_update_users('fe', $this->id);

$this->content .= $this->doc->section($LANG->getLL('users').":", $content, 0,
1);

break;

case 5: //update BE-users

//$content = $this->index_update_users('be', 0, $this->id);

$content = $this->index_update_users('be', 0);

$this->content .= $this->doc->section($LANG->getLL('users').":", $content, 0,
1);

break;

case 3: //import FE-users

$content = $this->index_import_users('fe', $this->id);

$this->content .= $this->doc->section($LANG->getLL('new').'
'.$LANG->getLL('users').":", $content, 0, 1);

break;

case 6: //import BE-users

$content = $this->index_import_users('be', 0);

$this->content .= $this->doc->section($LANG->getLL('new').'
'.$LANG->getLL('users').":", $content, 0, 1);

break;

case 4: //delete FE-users

$content = $this->index_delete_users('fe_users', $this->id);

$this->content .= $this->doc->section($LANG->getLL('deleted').'
'.$LANG->getLL('users').":", $content, 0, 1);

break;

case 7: //delete BE-users

$content = $this->index_delete_users('be_users', 0);

$this->content .= $this->doc->section($LANG->getLL('deleted').'
'.$LANG->getLL('users').":", $content, 0, 1);

break;

}

}

}



/**

* [Describe function...]

*

* @param [type] $user_prefix: ...

* @param [type] $pid: ...

* @return [type] ...

*/

function index_update_users($user_prefix, $pid) {

global $LANG;



tx_euldap_div::initChar('');



$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'uid, title',

$user_prefix.'_groups',

sprintf('deleted = 0 AND hidden = 0 %s', ($this->checkPid?' AND pid =
'.$this->checkPid_value:''))

);

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {

$arrGroups[] = $row;

}

// load users

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'*',

$user_prefix.'_users',

'NOT deleted AND pid = '.$pid

);



// LDAP

$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'*',

'tx_euldap_server',

($this->id?'pid IN ('.$this->id.') AND ':'')

.'authenticate_be IN
('.($user_prefix=='fe'?'0,':'').($user_prefix=='be'?'1,':'').'2)'

);



while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {

$arrServers[] = $row;

}

unset($dbres);



$content = $LANG->getLL('rownumber_limit').'<table cellpadding=0 cellspacing=0
border=0>

<tr>

<td nowrap><b>'.$LANG->getLL('account').'</b></td>

<td>&nbsp;&nbsp;</td>

<td nowrap><b>'.$LANG->getLL('name').'</b></td>

<td>&nbsp;&nbsp;</td>

<td nowrap><b>'.$LANG->getLL('group').'</b></td>

<td>&nbsp;&nbsp;</td>

<td nowrap><b>'.$LANG->getLL('email').'</b></td>

<td>&nbsp;&nbsp;</td>

<td nowrap><b>'.$LANG->getLL('ldap').'</b></td>

</tr>';

$i = 0;

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {

//t3lib_div::debug($row['username']);

$arrDisplay = tx_euldap_div::update_user($arrServers, $arrGroups,
$row['username'], $user_prefix.'_users', $this->id);



if ($arrDisplay && ($i < 100000)) {

$i++;

$content .= '<tr>

<td nowrap>'.$row['username'].'</td>

<td></td>

<td nowrap>'.$arrDisplay['name'].'</td>

<td></td>

<td nowrap>'.$arrDisplay['gname'].'</td>

<td></td>

<td nowrap>'.$arrDisplay['email'].'</td>

<td></td>

<td nowrap>'.$arrDisplay['ldapserver'].'</td>

</tr>';

}

}

$content .= '</table>';



return $content;

}



/**

* [Describe function...]

*

* @param [type] $user_prefix: ...

* @param [type] $pid: ...

* @return [type] ...

*/

function index_import_users($user_prefix, $pid) {

global $LANG;



tx_euldap_div::initChar('');



srand((double)microtime() * 1000000);

//load groups

$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'uid, title',

$user_prefix.'_groups',

sprintf('deleted = 0 AND hidden = 0 %s', ($this->checkPid?' AND pid =
'.$this->checkPid_value:''))

);

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {

$arrGroups[] = $row;

}

// LDAP

$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'*',

'tx_euldap_server',

($this->id?'pid IN ('.$this->id.') AND ':'')

.'authenticate_be IN
('.($user_prefix=='fe'?'0,':'').($user_prefix=='be'?'1,':'').'2)'

);

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {

$arrServers[] = $row;

}

$content = '<table cellpadding=0 cellspacing=0 border=0>

<tr>

<td><b>'.$LANG->getLL('account').'</b></td>

<td>&nbsp;&nbsp;</td>

<td><b>'.$LANG->getLL('name').'</b></td>

<td>&nbsp;&nbsp;</td>

<td><b>'.$LANG->getLL('group').'</b></td>

<td>&nbsp;&nbsp;</td>

<td><b>'.$LANG->getLL('email').'</b></td>

<td>&nbsp;&nbsp;</td>

<td><b>'.$LANG->getLL('ldap').'</b></td>

</tr>';

$i = 0;

while ($i < count($arrServers)) {

$content .= tx_euldap_div::import_users($pid, $arrServers[$i], $arrGroups,
$user_prefix.'_users');

$i++;

}

$content .= '</table>';

return $content;

}



/**

* [Describe function...]

*

* @param [type] $user_table: ...

* @param [type] $pid: ...

* @return [type] ...

*/

function index_delete_users($user_table, $pid) {

global $LANG;



tx_euldap_div::initChar('');



// load users

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'*',

$user_table,

'pid = '.$pid.' AND deleted = 0'

);

// LDAP

$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'*',

'tx_euldap_server',

($this->id?'pid IN ('.$this->id.') AND ':'')

.'authenticate_be IN
('.($user_table=='fe_users'?'0,':'').($user_table=='be_users'?'1,':'').'2)'

);

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {

$arrServers[] = $row;

}

$content = '<table cellpadding=0 cellspacing=0 border=0>

<tr>

<td><b>'.$LANG->getLL('account').'</b></td>

<td>&nbsp;&nbsp;</td>

<td><b>'.$LANG->getLL('email').'</b></td>

</tr>';

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {

$display = tx_euldap_div::delete_user($arrServers, $row, $user_table);

if ($display) {

$content .= '<tr>

<td nowrap>'.$row['username'].'</td>

<td></td>

<td nowrap>'.$row['email'].'</td>

</tr>';

}

}

$content .= '</table>';

return $content;

}

}







if (defined('TYPO3_MODE') &&
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/eu_ldap/mod1/index.php']) {

include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/eu_ldap/mod1/index.php']);

}









// Make instance:

$SOBE = t3lib_div::makeInstance('tx_euldap_module1');

$SOBE->init();



// Include files?

reset($SOBE->include_once);

while (list(, $INC_FILE) = each($SOBE->include_once)) {

include_once($INC_FILE);

}



$SOBE->main();

$SOBE->printContent();



?>

 








File mod1/class.tx_euldap_div.php :

<?php

/***************************************************************

* Copyright notice

*

* (c) 2003 Norman Seibert (seibert@entios.de)

* All rights reserved

*

* This script is part of the Typo3 project. The Typo3 project is

* free software; you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation; either version 2 of the License, or

* (at your option) any later version.

*

* The GNU General Public License can be found at

* http://www.gnu.org/copyleft/gpl.html.

*

* This script is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General Public License for more details.

*

* This copyright notice MUST APPEAR in all copies of the script!

***************************************************************/

/**

* Class for searching ldap-tree, import, update and authentificate

* users and groups.

*

* @author Norman Seibert <seibert@entios.de>

*/

/**

* [CLASS/FUNCTION INDEX of SCRIPT]

*

*

*

* 60: class tx_euldap_div

* 69: function search_ldap($server_info,$findname)

* 108: function additional_fields($map_additional_fields,$ldapres)

* 130: function use_memberof($servertype)

* 156: function is_in_onlygroups($onlygroup, $groupnamelist)

* 190: function assign_groups($Server, $arrGroups, $ldapres, &$gid, &$gname,
$table, $pid)

* 341: function insert_newgrps($table, $grps, $match, $pid)

* 390: function update_user($arrServers, $arrGroups, $username, $user_table,
$pid)

* 437: function update_singleuser($Server, $arrGroups, $user, $user_table, $pid)

* 515: function import_users($pid, $arrServer, $arrGroups, $user_table)

* 534: function import_singleuser($arrGroups, $user, $Server, $pid, $user_table,
$return=false)

* 647: function delete_user($arrServers, $row, $user_table, $delete=true)

* 690: function checkNTUser ($server_info,$username,$password)

*

* TOTAL FUNCTIONS: 13

* (This index is automatically created/updated by the extension "extdeveval")

*

*/

/**

* Class for searching ldap-tree, import, update and authentificate

* users and groups.

*

* @author Norman Seibert <seibert@entios.de>

*/

class tx_euldap_div {



var $csObj;

var $remoteChar;

var $localChar;

var $conf;



function tx_euldap_div() {

global $TYPO3_CONF_VARS;

$this->conf = unserialize($TYPO3_CONF_VARS['EXT']['extConf']['eu_ldap']);

$this->initChar('');

}



/**

* Sets the character sets.

*

*

* @return void

*/

function initChar($charset) {

global $TYPO3_CONF_VARS;

if ((isset($GLOBALS['TSFE'])) && (isset($GLOBALS['TSFE']->csConvObj))) {

$this->csObj = $GLOBALS['TSFE']->csConvObj;

} else {

if(!class_exists('t3lib_cs') && defined('PATH_t3lib')) {

require_once(PATH_t3lib.'class.t3lib_cs.php');

}

$this->csObj = t3lib_div::makeInstance('t3lib_cs');

}

$this->remoteChar = $this->csObj->parse_charset($charset ? $charset : 'utf-8');

$this->localChar =
$this->csObj->parse_charset($TYPO3_CONF_VARS['BE']['forceCharset'] ?
$TYPO3_CONF_VARS['BE']['forceCharset'] : 'iso-8859-1');

}



/**

* Gets object from ldap tree if the given findname can be found.

*

* @param array $server_info: containing all server information + filter to do
the search

* @param string $findname: username to look for

* @return array all ldap entries for user or false

*/

function search_ldap($server_info,$findname) {

//debug($server_info);



if ($findname) {

//

// convert character set local -> remote

$findname = $this->csObj->conv($findname, $this->localChar, $this->remoteChar);



$server = $server_info['server'];

$port = $server_info['port'];

$version = $server_info['version'];

$auth_user = $server_info['user'];

$auth_pass = $server_info['password'];

$base_dn = $server_info['base_dn'];

$strfilter = $server_info['filter'];

$servertype = $server_info['servertype'];

$filter = str_replace('<search>', $findname, $strfilter);



if(!extension_loaded('ldap')) die('Your PHP version seems to lack LDAP support.
Please install.');



if (!($connect = @ldap_connect($server, $port))) die('Could not connect to ldap
server '.$server);

if ($version == 3) {

@ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);

if ($servertype == 1) ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);

}

if (substr(strtolower($server), 0, 8) == 'ldaps://') {

if (!function_exists( 'ldap_start_tls' )) die('Function ldap_start_tls not
available.');

@ldap_start_tls($connect);

}

@ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);

if (!($bind = @ldap_bind($connect, $auth_user, $auth_pass))) die('Unable to bind
to server '.$server);

if (!($search = @ldap_search($connect, $base_dn, $filter))) die('Unable to
search ldap server '.$server);

$info = ldap_get_entries($connect, $search);



// convert character set remote -> local

if (is_array($info)) $info = tx_euldap_div::convertArray($info,
$this->remoteChar, $this->localChar);

//t3lib_div::debug($info);

// t3lib_div::debug($findname);

// if ($findname == "mbozzano" or $findname == "twolday")
{t3lib_div::debug($info);}



return $info;

}

}



/**

* If additional fields should be importet, this function returns the needed
Strings for DB-Insert Operation

*

* @param string $map_additional_fields:
tablefield0=ldapAttr0,tablefield1=ldapAttr1,...

* @param array $ldapres: result of ldapquery (attributes in first dimension!)
($ldapres[attribute])

* @param string $TYP: ["UPDATE"|"INSTERT"] //OBSOLETE!!

* @return array array of field => value

* @todo must return array of field/value to use DBAL

*/

function additional_fields($map_additional_fields,$ldapres) {

if ($map_additional_fields !="") {

$pairs=explode(',',$map_additional_fields);

$insertArray=array(); //initialise array...

foreach ($pairs as $value) {

list($tablekey, $ldapkey)=explode("=",$value);

$ldapkey=strtolower(trim($ldapkey));

$tablekey=strtolower(trim($tablekey));

if (is_array($ldapres[$ldapkey])) {

$insertArray[$tablekey]= str_replace("'", "''", $ldapres[$ldapkey][0]);

}

}

}

return $insertArray;

}



/**

* [Function returns the needed String for the Attribut Memberof. Because it is
diffrent in diffrent LDAP-Servertypes]

*

* @param [type] $servertype: ...

* @return [type] ...

*/

function use_memberof($servertype) {

switch($servertype) {

case 0:

$use_memberOf = 'memberof';

break;

case 1:

$use_memberOf = 'memberof';

break;

case 2:

$use_memberOf = 'groupmembership';

break;

case 3:

$use_memberOf = 'posixGroup';

break;

}



return $use_memberOf;

}



/**

* [Function test if User is in one of the specified groups (only_groups)]

*

* @param [comma seperated string] $onlygroup: ...

* @param [comma seperated string] $groupnamelist: ...

* @return [type] ...

*/

function is_in_onlygroups($onlygroup, $groupnamelist) {

//No Group is selected then all users allowed

if ($onlygroup == "") {

return 1;

}

$onlygrouparray = explode(",",$onlygroup);

$grouparray = explode(",",$groupnamelist);

for ($k=0; $k < count($grouparray); $k++) {

$group = $grouparray[$k];

foreach ($onlygrouparray as $value) {

$value=strtolower(trim($value));

$regExpr = str_replace("?", ".", str_replace("*", ".*", "/^".$value."$/"));

if (preg_match($regExpr, strtolower($group))) return 1;

}

}

return 0;

}





/**

* assigns ldap and typo3 groups. LDAP groups can be imported if flag is set

*

* @param boolean $use_memberOf: use the memberOf attribute

* @param array $arrGroups: array with typo3-groups (fe/be)

* @param array $ldapres: ldap attributes and values

* @param string $ldapbuildgroup: how to match the typo groups

* @param int eger $gid: groupids, output parameter

* @param string $gname:groupnames, output parameter

* @param string $match: import only groups begining with this string

* @param string $addnewgroups: if set groups are imported/created

* @param string $table: fe_users or be_users

* @param integer $pageID for the group

* @return void - uses refvars gid and gname

*/

function assign_groups($Server, $arrGroups, $ldapres, &$gid, &$gname, $table,
$pid) {

$ldapbuildgroup = $Server['build_group'];

$use_memberOf = $Server['memberof'];

$match = $Server['matchgrps'];

$servertype = $Server['servertype'];

$memberOf = tx_euldap_div::use_memberOf($servertype);

$addnewgroups = $Server['doitfe'];

$fe_groups = $Server['fe_group'];

$be_groups = $Server['be_group'];

if (''.$use_memberOf != '0') {



$k = 0;

$gid = '';

$department = '';

$gname = '';



if ($memberOf == 'posixGroup') {

$uid = $ldapres['uid'][0];

/* change the filterstring for searching groups */

// $Server['filter'] = "(&(objectclass=posixGroup)(memberUid=<search>))";

$Server['filter'] =
"(&(objectclass=posixGroup)(|(memberUid=<search>)(gidNumber=" .
$ldapres['gidnumber'][0] . ")))";

$group_info = tx_euldap_div::search_ldap($Server, $uid);

while ($k < $group_info['count']) {

if (is_array($group_info[$k]['cn'])) {

$department = $group_info[$k]['cn'][0];

} else {

$department = $group_info[$k]['cn'];

}

if ($department) {

$j = 0;

$group_found = false;

while (($j < sizeof($arrGroups)) && !($group_found)) {

if (strtolower($arrGroups[$j]['title']) == strtolower($department)) {

$group_found = true;

if (tx_euldap_div::is_in_onlygroups($Server['matchgrps'],
$arrGroups[$j]['title'])) {

$gid .= ','.$arrGroups[$j]['uid'];

$gname .= ','.$arrGroups[$j]['title'];

}

}

$j++;

}

if (!$group_found && tx_euldap_div::is_in_onlygroups($Server['matchgrps'],
$department)) $newgroups[] = $department;

}

$k++;

}

} else {

while ($k < count($ldapres[$memberOf])) {

$department = $ldapres[$memberOf][$k];

$equal = strpos($department, 'cn=');

$comma = strpos($department, ',', $equal);

$department = substr($department, $equal+3, $comma-$equal-3);

if ($department) {

$j = 0;

$group_found = false;

while (($j < sizeof($arrGroups)) && !($group_found)) {

if (strtolower($arrGroups[$j]['title']) == strtolower($department)) {

$group_found = true;

if (tx_euldap_div::is_in_onlygroups($Server['matchgrps'],
$arrGroups[$j]['title'])) {

$gid .= ','.$arrGroups[$j]['uid'];

$gname .= ','.$arrGroups[$j]['title'];

}

}

$j++;

}

if (!$group_found && tx_euldap_div::is_in_onlygroups($Server['matchgrps'],
$department)) $newgroups[] = $department;

}

$k++;

}

}

} else {

$department = $ldapbuildgroup;

while (ereg('<([^>]*)>', $department, $arrMatches)) {

if ((strtolower($arrMatches[1]) != 'ou') &&
(is_array($ldapres[$arrMatches[1]]))) {

$gid = '';

$gname = '';

$jjj=0;

while(($jjj < count($ldapres[$arrMatches[1]])-1)){

$department = $ldapbuildgroup;

$found = $ldapres[$arrMatches[1]][$jjj];

$department = str_replace('<'.$arrMatches[1].'>', $found, $department);

$j = 0;

$group_found = false;

while (($j < sizeof($arrGroups)) && !($group_found)) {

if (strtolower($arrGroups[$j]['title']) == strtolower($department)) {

$group_found = true;

if (tx_euldap_div::is_in_onlygroups($Server['matchgrps'], $gname)) {

$gid.= ','.$arrGroups[$j]['uid'];

$gname.= ','.$arrGroups[$j]['title'];

}

}

$j++;

}

if (!$group_found && tx_euldap_div::is_in_onlygroups($Server['matchgrps'],
$department)) $newgroups[] = $department;

$jjj++;

}

} else {

$gid = '';

$gname = '';

if (is_array($ldapres['dn'])) {

$dn = $ldapres['dn'][0];

} else {

$dn = $ldapres['dn'];

}

$arrDN = explode(",", $dn);

for ($jj=0; $jj < count($arrDN); $jj++) {

$arrKeys = explode("=", $arrDN[$jj]);

if (strtolower($arrKeys[0]) == strtolower($arrMatches[1])) {

$found = $arrKeys[1];

$tmpdepartment = str_replace('<'.$arrMatches[1].'>', $found, $department);

$j = 0;

$group_found = false;

while (($j < count($arrGroups)) && !($group_found)) {

if (strtolower($arrGroups[$j]['title']) == strtolower($tmpdepartment)) {

$group_found = true;

$gid.= ','.$arrGroups[$j]['uid'];

$gname.= ','.$arrGroups[$j]['title'];

}

$j++;

}

(!$group_found)?$newgroups[]=$department:'';



}

}

$department = $tmpdepartment;

}

}

}

if ((is_array($newgroups)) && ($addnewgroups)) {

reset($newgroups);

$newgrouparray = tx_euldap_div::insert_newgrps($table, $newgroups, $match,
$pid);

if (is_array($newgrouparray)) {

reset($newgrouparray);

foreach ($newgrouparray as $newgrpid => $newgrpname) {

if ($newgrpname != '') {

$gid.=','.$newgrpid;

$gname.=','.$newgrpname;

}

}

}

}

if (($table == 'fe_users') && $fe_groups) $gid .= ','.$fe_groups;

if (($table == 'be_users') && $be_groups) $gid .= ','.$be_groups;

// cuts of leading ','

if ($gid) $gid = substr($gid, 1);

if ($gname) $gname = substr($gname, 1);

}



/**

* Insert new groups into the table (fe or be)

*

* @param string $table: be or fe groups table

* @param array $grps: groupnames of unmatched groupes

* @param string $match: matchstring; must match the beginning of string

* @param integer $pid: pageID for group

* @return array key:groupId of new group, value=groupname

*/

function insert_newgrps($table, $grps, $match, $pid) {

if ($table == 'be_users') {

$pid = 0;

$table = 'be_groups';

} else {

$table = 'fe_groups';

}

foreach ($grps as $grp) {

$qry = Array(

'pid' => $pid,

'tstamp' => time(),

'title' => $grp,

'description' => 'Inserted by eu_ldap '.time(),

'eu_ldap' => '1'

);

//match condition at beginning of group

$bolCreate = true;

if ($match) $bolCreate = false;

$onlygrouparray = explode(",", $match);

foreach ($onlygrouparray as $value) {

$value = strtolower(trim($value));

$regExpr = str_replace("?", ".",

str_replace("*", ".*", "/^".$value."$/"));

if (preg_match($regExpr, strtolower($grp))) $bolCreate = true;

}

if ($bolCreate) {

$rslt = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'uid, title',

$table,

"title = '".$grp."' AND hidden = 0 AND deleted = 0"

);

if ($rslt) $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($rslt);



if(!$row) {

$dbres = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $qry);

$rslt = $GLOBALS['TYPO3_DB']->exec_SELECTquery(

'uid, title',

$table,

"title='".$grp."'"

);

if ($rslt) $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($rslt);

}



$return[$row['uid']] = $row['title'];

}

}

return $return;

}



/**

* Updates typo3 users with data from ldap user object

*

* @param array $arrServers: information about ldap servers to query

* @param array $arrGroups: existing typo3 groups (fe/be)

* @param string $username: username of user to update

* @param string $user_table: fe_users or be_users

* @param integer $pid: pageID; necessary for automatic creation of groups

* @return string with information about updated user or FALSE if user does not
exist in ldap

*/

function update_user($arrServers, $arrGroups, $username, $user_table, $pid) {

$i = 0;

$user_found = false;

while (($i < count($arrServers)) && !($user_found)) {



$ldapres = tx_euldap_div::search_ldap($arrServers[$i],$username);



//t3lib_div::debug($ldapres[1]);

//die();



/* if ($ldapres['count'] > 1) {

while (($jj <= $ldapres['count'])) {

// use update_single_user from here..



$arrDisplay =
tx_euldap_div::update_singleuser($arrServers[$i],$arrGroups,$ldapres[$jj],$user_table,$pid);


$jj++;

}

$user_found = true;

return $arrDisplay;

}



*/

if ($ldapres['count'] == 1) {

// use update_single_user from here..

$arrDisplay =
tx_euldap_div::update_singleuser($arrServers[$i],$arrGroups,$ldapres[0],$user_table,$pid);

$user_found = true;

return $arrDisplay;

}

$i++;

}

if (!$user_found) return false;

}



/**

* updates single user (see above)

* does not return anything at all

*

* @param array $Server: row with ldap-server settings

* @param array $arrGroups: array of groups (fe/be)

* @param array $user: user to be updated (ldap attribute array)

* @param string $user_table: fe_users or be_users

* @param integer $pid: pageID; necessary for automatic creation of groups

* @return void nothing at all..

*/

function update_singleuser($Server, $arrGroups, $user, $user_table, $pid) {

$ldapserver = $Server['server'];

$ldapname = $Server['name'];

$ldapusername = $Server['username'];

$ldapmail = $Server['mail'];

$ldapphone = $Server['phone'];

$ldapfax = $Server['fax'];

$ldapaddress = $Server['address'];

$ldapzip = $Server['zip'];

$ldapcity = $Server['city'];

$ldapcountry = $Server['country'];

$ldapwww = $Server['www'];

$ldapbuildgroup = $Server['build_group'];

$use_memberOf = $Server['memberof'];

$map_additional_fields = $Server['map_additional_fields'];

if ($use_memberOf) $use_memberOf =
tx_euldap_div::use_memberof($Server['servertype']);

switch($Server['servertype']) {

case 0:

$username = $user['samaccountname'][0];

break;

case 1:

$username = $user['samaccountname'][0];

break;

case 2:

case 3:

$username = $user[$ldapusername][0];

break;

}



$name = $user[$ldapname][0];

$email = $user[$ldapmail][0];

$GLOBALS['TYPO3_DB']->debugOutput = TRUE;

if ($ldapbuildgroup || $use_memberOf) tx_euldap_div::assign_groups($Server,
$arrGroups, $user, $gid, $gname, $user_table, $pid);

// preserve groups not imported by eu_ldap

$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery ('uid',
($user_table=='fe_users'?'fe_groups':'be_groups'), 'eu_ldap = 0 AND uid IN
(SELECT usergroup FROM '.$user_table." WHERE lower(username) =
'".strtolower($GLOBALS['TYPO3_DB']->quoteStr($username,$user_table))."')");

// t3lib_div::debug($name. " ".$email."<br/>");

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {

$gid .= ', '.$row['uid'];

}

if ($user_table == 'fe_users') {

$map_additional_fields =

'address='.$ldapaddress

.',zip='.$ldapzip

.',city='.$ldapcity

.',country='.$ldapcountry

.',address='.$ldapaddress

.',telephone='.$ldapphone

.',fax='.$ldapfax

.',www='.$ldapwww

.($map_additional_fields?','.$map_additional_fields:'');

$updateArray = array('tstamp' => time(),

'name' => str_replace("'", "''", $name),

'email' => $email

);

// if ($ldapbuildgroup || $use_memberOf) $updateArray['usergroup'] = $gid;

} else {

$updateArray = array('tstamp' => time(),

'email' => $email,

'realname' => str_replace("'", "''", $name)

);

// if ($ldapbuildgroup || $use_memberOf) $updateArray['usergroup'] = $gid;

$updateArray['fileoper_perms'] = '1';

}

$map_additional_fields_up =
tx_euldap_div::additional_fields($map_additional_fields, $user);

if (is_array($map_additional_fields_up) and ($user_table == 'fe_users'))
$updateArray = t3lib_div::array_merge($updateArray, $map_additional_fields_up);

//if
(strtolower($GLOBALS['TYPO3_DB']->quoteStr($username,$user_table))=='mbozzano')
t3lib_div::debug($updateArray);





if ($user_table == 'be_users') {

$pippo=$GLOBALS['TYPO3_DB']->exec_UPDATEquery($user_table,"lower(username) =
'".strtolower($GLOBALS['TYPO3_DB']->quoteStr($username,$user_table))."' AND
pid=0",$updateArray);

t3lib_div::debug(strtolower($GLOBALS['TYPO3_DB']->quoteStr($username,$user_table)).'
'.$pippo);

}

else {

$pippo= $GLOBALS['TYPO3_DB']->exec_UPDATEquery($user_table,"lower(username) =
'".strtolower($GLOBALS['TYPO3_DB']->quoteStr($username,$user_table))."' AND
pid=".$pid,$updateArray);

}



//t3lib_div::debug($map_additional_fields_up);

$arrDisplay['name'] = $name;

$arrDisplay['gname'] = $gname;

$arrDisplay['email'] = $email;

$arrDisplay['ldapserver'] = $ldapserver;

//t3lib_div::debug($arrDisplay);

return $arrDisplay;



}



/**

* imports users from ldap-tree

*

* @param integer $pid: page id where userdata is stored

* @param array $arrServer: array with server information

* @param array $arrGroups: array of typo3 groups

* @param string $user_table: fe_users or be_users

* @return string html content with results

*/

function import_users($pid, $arrServer, $arrGroups, $user_table) {

$ldapres = tx_euldap_div::search_ldap($arrServer, '*');

for ($l=0; $l<$ldapres['count']; $l++) {

$content .=
tx_euldap_div::import_singleuser($arrGroups,$ldapres[$l],$arrServer,$pid,$user_table,1);

}

return $content;

}



/**

* imports a single user into table. Needed for automtic import after successfull
login

*

* @param array $arrGroups: typo groups

* @param array $user: uset to be inserted

* @param array $Server: server information (ldap)

* @param integer $pid: pid of user storage page

* @param string $user_table: fe_users or be_users

* @param boolean $return: should html-output be generated?

* @return string boolean if $return = false or html-table

*/

function import_singleuser($arrGroups, $user, $Server, $pid, $user_table,
$return=false) {

$OK = false;

$ldapserver = $Server['server'];

$ldapname = $Server['name'];

$ldapusername = $Server['username'];

$ldapmail = $Server['mail'];

$ldapphone = $Server['phone'];

$ldapfax = $Server['fax'];

$only_emailusers = $Server['only_emailusers'];

$ldapaddress = $Server['address'];

$ldapzip = $Server['zip'];

$ldapcity = $Server['city'];

$ldapcountry = $Server['country'];

$ldapwww = $Server['www'];

$use_memberOf = $Server['memberof'];

$map_additional_fields = $Server['map_additional_fields'];

if ($use_memberOf) $use_memberOf =
tx_euldap_div::use_memberof($Server['servertype']);

switch($Server['servertype']) {

case '0':

$username = $user['samaccountname'][0];

break;

case '1':

$username = $user['samaccountname'][0];

break;

case '2':

$username = $user[$ldapusername][0];

break;

case '3':

$username = $user[$ldapusername][0];

break;

}

$query = (($pid)?'pid ='.$pid.' AND ':'')."NOT deleted AND lower(username) =
'".$GLOBALS['TYPO3_DB']->quoteStr(strtolower($username),$user_table)."'";

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('email', $user_table, $query);

$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);



if (!is_array($row) && ($username != '')){

$name = $user[$ldapname][0];



$email = $user[$ldapmail][0];

$telephone = $user[$ldapphone][0];

$ldapbuildgroup = $Server['build_group'];



if (($email) || !($only_emailusers)) {

if ($ldapbuildgroup || $use_memberOf) tx_euldap_div::assign_groups($Server,
$arrGroups, $user, $gid, $gname, $user_table, $pid);

$show = false;

if ($Server['matchgrps']) {

if ($gname) $show = true;

} else {

$show = true;

}

if ($show) {

$password = '';

$content.= '<tr>

<td>'.$username.'</td>

<td>&nbsp;&nbsp;</td>

<td>'.$name.'</td>

<td>&nbsp;&nbsp;</td>

<td>'.$gname.'</td>

<td>&nbsp;&nbsp;</td>

<td>'.$email.'</td>

<td>&nbsp;&nbsp;</td>

<td>'.$ldapserver.'</td>

</tr>';

srand ((double)microtime()*1000000);

for ($l=1;$l<11;$l++) {

$rand_num = round(rand(1, 26) + 97, 0);

$password.= chr($rand_num);

}

$insValues=array('crdate' => time(),

'tstamp' => time(),

'pid'=> $pid,

'username' => str_replace("'", "''", $username),

'email' => $email,

'password' => $password

);

if ($ldapbuildgroup || $use_memberOf) $insValues['usergroup'] = $gid;



if ($user_table == 'fe_users') {

$insValues['address'] = str_replace("'", "''", $user[$ldapaddress][0]);

$insValues['zip'] = str_replace("'", "''", $user[$ldapzip][0]);

$insValues['city'] = str_replace("'", "''", $user[$ldapcity][0]);

$insValues['country'] = str_replace("'", "''", $user[$ldapcountry][0]);

$insValues['www'] = str_replace("'", "''", $user[$ldapwww][0]);

$insValues['telephone'] = str_replace("'", "''", $telephone);

$insValues['fax'] = str_replace("'", "''", $user[$ldapfax][0]);

$insValues['name'] = str_replace("'", "''", $name);

} else {

$insValues['options'] = '3';

$insValues['realname'] = str_replace("'", "''", $name);

}

$mapArray = tx_euldap_div::additional_fields($map_additional_fields,$user);

if (is_array($mapArray)) $insValues = t3lib_div::array_merge($insValues,
$mapArray);

$GLOBALS['TYPO3_DB']->exec_INSERTquery($user_table,$insValues);

}

}

} elseif ($username !='') {

tx_euldap_div::update_singleuser($Server, $arrGroups, $user, $user_table, $pid);

}

return ($return)?$content:$OK;

}



/**

* deletes typo user if not found in ldap

*

* @param array $arrServers: all ldap-server information (1-n)

* @param array $row: all user information

* @param string $user_table: fe_users or be_users

* @param [type] $delete: ...

* @return boolean true if successfully deleted

*/

function delete_user($arrServers, $row, $user_table, $delete=true) {

$i = 0;

$user_found = 0;

while ($i < sizeof($arrServers) && !$user_found) {

$ldapres = tx_euldap_div::search_ldap($arrServers[$i], $row['username']);

// HJM 2004-01-16: von == auf >= ge�ndert, da es im NML-Tree mehrere
Userobjecte gibt, die nicht anhand von

// Suchkriterien unterschieden werden k�nnen

$is_onlygroup = 0;

if ($ldapres['count'] >= 1) $user_found = 1;

$i++;

}

if (!$user_found) {

if ($delete) {

$dbres = $GLOBALS['TYPO3_DB']->exec_UPDATEquery(

$user_table,

'uid = '.$row['uid'].' AND deleted = 0',

Array(

'deleted' => '1'

)

);

} else {

$dbres = $GLOBALS['TYPO3_DB']->exec_UPDATEquery(

$user_table,

'uid = '.$row['uid'].' AND deleted = 0',

Array(

'disable' => '1'

)

);

}

return true;

} else {

return false;

}

}



/**

* checks username and password in ldap

*

* @param array $server_info: all ldap-server configuration needed (see table
eu_ldapserver)

* @param string $username: username to be checked in ldap

* @param string $password: password to be checked

* @return array ldap-user attributes, if found and authentificated

*/

function checkNTUser ($server_info, $username, $password) {



// convert character set local -> remote

$username = $this->csObj->conv($username, $this->localChar, $this->remoteChar);

$password = $this->csObj->conv($password, $this->localChar, $this->remoteChar);

$server = $server_info['server'];

$ldapport = $server_info['port'];

$domain = $server_info['domain'];

$base_dn = $server_info['base_dn'];

$cuser = $server_info['user'];

$cpass = $server_info['password'];

$servertype = $server_info['servertype'];

$version = $server_info['version'];



$strfilter = $server_info['filter'];

$filter = str_replace('<search>', $username, $strfilter);



if(!extension_loaded('ldap')) die('Your PHP version seems to lack LDAP support.
Please install.');



$ds = @ldap_connect($server, $ldapport);

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('try to connect:
'.$server.':'.$ldapport, 'eu_ldap', 0);

if ($ds) {

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('connect successful:
'.$server.':'.$ldapport, 'eu_ldap', -1);

if ($version == 3) ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('server type: '.$servertype,
'eu_ldap', 0);

if ($servertype > 1) {

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('try to bind: '.$cuser.' /
'.$cpass, 'eu_ldap', 0);

$r = @ldap_bind($ds, $cuser, $cpass);

if ($r) {

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('bind successful',
'eu_ldap', -1);

$dn = @ldap_search($ds, $base_dn, $filter);

$dn = @ldap_get_entries($ds, $dn);

$username = $dn[0]['dn'];

} else {

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('bind failed', 'eu_ldap',
2);

$username = null;

}

} elseif ($domain) {

if ($servertype == 0) {

$username = $domain."\\".$username;

} else {

$username = $username."@".$domain;

}

}



if ($username && $password) {

@ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('try to bind: '.$username.'
/ '.$password, 'eu_ldap', 0);

$r = @ldap_bind($ds,$username,$password);

if ($r) {

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('bind successful',
'eu_ldap', -1);

$dn = @ldap_search($ds, $base_dn, $filter);

$dn = @ldap_get_entries($ds, $dn);



$user = $dn[0];



// convert character set remote -> local

if (is_array($user)) $user = tx_euldap_div::convertArray($user,
$this->remoteChar, $this->localChar);



return $user;

} else {

if ($this->conf['logLevel'] == 2) t3lib_div::devLog('bind failed', 'eu_ldap',
2);

}

}

}

}



function convertArray($arr, $char1, $char2) {

while (list($k, $val) = each($arr)) {

if (is_array($val)) {

$arr[$k] = tx_euldap_div::convertArray($val, $char1, $char2);

} else {

$arr[$k] = $this->csObj->conv($val, $char1, $char2);

}

}

return $arr;



}

}

?>

 

Tuesday, March 10, 2009

Preview tt_news - Customization of "DISC :: News Preview in Backend (disc_ttnews_preview)"

The disc_ttnews_preview is very good extension for the preview of news within BE interfaceof typo3.
To properly make this extension working, we updated the file "lib/class.tx_discttnewspreview_tcaform.php" to make this interface more user-friendly and compatible with LIVE and custom workspaces.
Please CHANGE the IDs as indicated in the file itself.


<?php



class tx_discttnewspreview_tcaform {



/**



*@desc



*/



function user_preview_form($PA, $fobj){



GLOBAL $TYPO3_CONF_VARS;



$conf = unserialize($TYPO3_CONF_VARS['EXT']['extConf']['disc_ttnews_preview']);



$url =
'http://'.$_SERVER["HTTP_HOST"].'/index.php?id='.$conf['preview_pid'].'&amp;enable_ttnews_preview=1&amp;no_cache=1&amp;tx_ttnews[tt_news]='.intval($PA['row']['uid']);



//http://www.mysite.com/index.php?id=15&amp;ADMCMD_vPrev[tt_news%3A685]=803

// IMPORTANT: index.php?id=15 is the page where the content element tt_news with
view VERSION_PREVIEW is located. We have this content element inside the
repository of news.



if (intval($PA['row']['t3ver_oid'])<>0) {

$url =
'http://'.$_SERVER["HTTP_HOST"].'/index.php?id=15&amp;ADMCMD_vPrev[tt_news%3A'.intval($PA['row']['t3ver_oid']).']='.intval($PA['row']['uid']);

}

else

{

//http://www.mysite.com/index.php?id=21&amp;no_cache=1&amp;tx_ttnews[tt_news]=688

// IMPORTANT: index.php?id=21 is the page where the content element tt_news with
view SINGLE is located. We have this content element inside a section of the web
site.



$url =
'http://'.$_SERVER["HTTP_HOST"].'/index.php?id=21&amp;no_cache=1&amp;tx_ttnews[tt_news]='.intval($PA['row']['uid']);

}



$c .= '<div><img align="middle" src="gfx/icon_note.gif" />The preview shows only
saved news. Please save all changes before previewing this item.</div><br/><div
class="typo3-newRecordLink"><a href="'.$url.'"
onclick="$(\'tx_discttnewspreview\').show(); $(this).hide(); return true;"
class="inlineNewButton" target="tx_discttnewspreview"><img
src="sysext/t3skin/icons/gfx/zoom.gif" width="16" height="16" alt="Click here to
load the preview inside this window. " />Click here to open the preview in a
frame </b>(only unhidden news)</a></div><div class="typo3-newRecordLink"><a
href="'.$url.'" target="_blank"><img src="sysext/t3skin/icons/gfx/zoom.gif"
width="16" height="16" alt="Click here to load preview in a new window" />Click
here to open the preview in a new window </b>(only unhidden news)</a></div>';



$c .= '<iframe style="display: none;" id="tx_discttnewspreview"
name="tx_discttnewspreview" width="1024px" height="600px" xsrc="'.$url.'">Your
browser does not support IFRAME.</iframe>';



return $c;



}



}



?>

Flash in News - How we customized "Different Extensions for tt_news (ah_newsext) "

In order to install videos in tt_news, we installed the extension "ah_newsext"; to better use this new functionalities, we did these changes:


We modified 2 tt_news templates in tt_news extension /pi/ folder and in our DAM folder to embed the marker ###FLASHINNEWS_FLASH### closed to ###NEWS_IMAGE### like:

###NEWS_IMAGE###
###FLASHINNEWS_FLASH###


- Then we changed the width and height of videos in pi1/class.tx_ahnewsext_pi1.php file:

function substituteMarkers() {
...
$fWidth = 300;
$fHeight = 300;

- In order to simplify the backend interface, we removed several options changing the ext_tables.php:

t3lib_extMgm::addToAllTCAtypes("tt_news","tx_ahnewsext_flash_file;;;;1-1-1, tx_ahnewsext_flash_inline, tx_ahnewsext_flash_width, tx_ahnewsext_flash_height"); ##tx_ahnewsext_prev_file, tx_ahnewsext_prev_width, tx_ahnewsext_prev_height, tx_ahnewsext_flash_wo_player, tx_ahnewsext_flash_downloadlink, x_ahnewsext_flash_downloadfile, tx_ahnewsext_flash_access, tx_ahnewsext_flash_about_text

with this line of code:
t3lib_extMgm::addToAllTCAtypes("tt_news","tx_ahnewsext_flash_file;;;;1-1-1, tx_ahnewsext_flash_inline, tx_ahnewsext_flash_width, tx_ahnewsext_flash_height"); ##tx_ahnewsext_prev_file, tx_ahnewsext_prev_width, tx_ahnewsext_prev_height, tx_ahnewsext_flash_wo_player, tx_ahnewsext_flash_downloadlink, x_ahnewsext_flash_downloadfile, tx_ahnewsext_flash_access, tx_ahnewsext_flash_about_text

- in order to apply a style, we added at the template of the news this style:

tt_news VERSION_PREVIEW template

PROBLEM: we installed an extension in typo3 that add new markers to tt_news template. The template of VERSION_PREVIEW page is shown when the preview of the news is requested, in "live" and in custom workspaces. We found the changes on the tt_news template were not shown in this VERSION_PREVIEW page. Where is the VERSION_PREVIEW template?

SOLUTION: In the plugin mask it is possible to select the template path; another option is the customization of the tt_news plug-in in the Template of the web site:

plugin.tt_news.archiveTypoLink.parameter = 57
plugin.tt_news.file.templateFile = fileadmin/bioversity/templates/tt_news_templates/news.html

the above settings are not applied to the VERSION_PREVIEW template, that remains located always in the tt_news extension folder /typo3conf/ext/tt_news/pi/tt_news_v2_template.html.
Once we changed this html file with new markers, the new template was visible also in the draft workspace preview.

Friday, March 6, 2009

Videos in tt_content - Customization of "Sys-Tech Flash Player" (st_flashplayer) extension

PROBLEM: How can I edit the plug-in “SYS_TECH Flash player” fields by default? And how can I hide these fields in the plug-in mask?

SOLUTION: To configure the plug-in st_flashplayer, in the Extension manager, open the the extension st_flashplayer and select Edit; edit the file “ext_typoscript_setup.txt”.
(the extension is located at "/srv/www/htdocs/typo3conf/ext/st_flashplayer/").
We changed the typoscript parameters for the plug in:

plugin.tx_stflashplayer_pi1 {
extra.swf=/typo3conf/ext/st_flashplayer/pi1/flvplayer.swf
extra.float=none

param.wmode=transparent

basic.height=300
basic.width=300
basic.displayheight=
basic.shownavigation=
basic.image=
basic.transition=
basic.file=

color.frontcolor=
color.backcolor= 0x4e9e00
color.lightcolor= 0xffffff
color.screencolor=

appearance.autoscroll=
appearance.displaywidth=
appearance.kenburns=
appearance.largecontrols=
appearance.logo=
appearance.overstretch=
appearance.showdigits=
appearance.showdownload=
appearance.showeq=
appearance.showicons=
appearance.showvolume=
appearance.thumbsinplaylist=

playback.autostart=false
playback.bufferlength=
playback.repeat=
playback.rotatetime=
playback.shuffle=
playback.smoothing=
playback.start=
playback.volume=

interaction.audio=
interaction.bwfile=
interaction.bwstreams=
interaction.callback=
interaction.captions=
interaction.enablejs=
interaction.fsbuttonlink=
interaction.id=
interaction.javascriptid=
interaction.link=
interaction.linkfromdisplay=
interaction.linktarget=
interaction.streamscript=
interaction.type=
interaction.useaudio=
interaction.usecaptions=
interaction.usefullscreen=true
interaction.usekeys=false
}

plugin.tx_stflashplayer_pi1._CSS_DEFAULT_STYLE (

div.st_flashplayer_float_left {
margin:0px 10px 0px 0px;
}
div.st_flashplayer_float_right {
margin:0px 0px 0px 10px;
}
div.st_flashplayer_float_none {
margin:0px 0px 0px 0px;
text-align: center;
}

)


- To hide some fields in the plugin backend interface we changed also flexform_ds.xml file of this extension: commenting xml tags allowed hiding several fields in the BE interface of this plug in.
Example: to hide the "transition" option




New file with changes:

<T3DataStructure>

<meta>

<langDisable>1</langDisable>

</meta>

<sheets>

<basic>

<ROOT>

<TCEforms>

<sheetTitle>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.sheet_main</sheetTitle>

</TCEforms>

<type>array</type>



<el>



<!-- <transition>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.transition</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">bgfade</numIndex>

<numIndex index="1">bgfade</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">blocks</numIndex>

<numIndex index="1">blocks</numIndex>

</numIndex>

<numIndex index="3" type="array">

<numIndex index="0">bubbles</numIndex>

<numIndex index="1">bubbles</numIndex>

</numIndex>

<numIndex index="4" type="array">

<numIndex index="0">circles</numIndex>

<numIndex index="1">circles</numIndex>

</numIndex>

<numIndex index="5" type="array">

<numIndex index="0">fade</numIndex>

<numIndex index="1">fade</numIndex>

</numIndex>

<numIndex index="6" type="array">

<numIndex index="0">flash</numIndex>

<numIndex index="1">flash</numIndex>

</numIndex>

<numIndex index="7" type="array">

<numIndex index="0">fluids</numIndex>

<numIndex index="1">fluids</numIndex>

</numIndex>

<numIndex index="8" type="array">

<numIndex index="0">lines</numIndex>

<numIndex index="1">lines</numIndex>

</numIndex>

<numIndex index="9" type="array">

<numIndex index="0">random</numIndex>

<numIndex index="1">random</numIndex>

</numIndex>

<numIndex index="10" type="array">

<numIndex index="0">slowfade</numIndex>

<numIndex index="1">slowfade</numIndex>

</numIndex>



</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</transition> -->



<!-- <navigation>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.navigation</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</navigation> -->



<!-- <float>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.float</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0">none</numIndex>

<numIndex index="1">none</numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">left</numIndex>

<numIndex index="1">left</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">right</numIndex>

<numIndex index="1">right</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default>none</default>



</config>

</TCEforms>

</float> -->

<name>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.name</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</name>

<width>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.width</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</width>



<height>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.height</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</height>

<!-- <displayheight>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.displayheight</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</displayheight>



<image>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.image</label>

<config>

<type>group</type>

<internal_type>file</internal_type>

<allowed>jpg,png,gif</allowed>

<max_size>100000</max_size>

<uploadfolder>uploads/tx_stflashplayer</uploadfolder>

<maxitems>1</maxitems>



<size>1</size>

<selectedListStyle>width:180px</selectedListStyle>

</config>

</TCEforms>

</image> -->

<file>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.file</label>

<config>

<type>group</type>

<internal_type>file</internal_type>

<allowed>flv</allowed>

<max_size>100000</max_size>

<uploadfolder>uploads/tx_stflashplayer</uploadfolder>

<maxitems>1</maxitems>



<size>1</size>

<selectedListStyle>width:180px</selectedListStyle>

</config>

</TCEforms>

</file>

<!-- <swf>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.swf</label>

<config>

<type>group</type>

<internal_type>file</internal_type>

<allowed>swf</allowed>

<max_size>100000</max_size>

<uploadfolder>uploads/tx_stflashplayer</uploadfolder>

<maxitems>1</maxitems>



<size>1</size>

<selectedListStyle>width:180px</selectedListStyle>

</config>

</TCEforms>

</swf> -->





</el>



</ROOT>

</basic>



<!-- <color>

<ROOT>

<TCEforms>

<sheetTitle>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.color</sheetTitle>

</TCEforms>

<type>array</type>



<el>

<backcolor>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.backcolor</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</backcolor>



<frontcolor>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.frontcolor</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</frontcolor>

<lightcolor>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.lightcolor</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</lightcolor>

<screencolor>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.screencolor</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</screencolor>

</el>

</ROOT>

</color> -->



<!-- <appearance>

<ROOT>

<TCEforms>

<sheetTitle>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.appearance</sheetTitle>

</TCEforms>

<type>array</type>



<el>

<autoscroll>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.autoscroll</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</autoscroll>

<kenburns>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.kenburns</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</kenburns>

<largecontrols>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.largecontrols</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</largecontrols>

<showdownload>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.showdownload</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</showdownload>

<showeq>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.showeq</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</showeq>

<showicons>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.showicons</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</showicons>

<showvolume>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.showvolume</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</showvolume>



<thumbsinplaylist>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.thumbsinplaylist</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</thumbsinplaylist>



<overstretch>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.overstretch</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

<numIndex index="3" type="array">

<numIndex index="0">fit</numIndex>

<numIndex index="1">fit</numIndex>

</numIndex>

<numIndex index="4" type="array">

<numIndex index="0">none</numIndex>

<numIndex index="1">none</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</overstretch>



<showdigits>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.showdigits</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

<numIndex index="3" type="array">

<numIndex index="0">total</numIndex>

<numIndex index="1">total</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</showdigits>





<logo>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.logo</label>

<config>

<type>group</type>

<internal_type>file</internal_type>

<allowed>jpg,png,gif</allowed>

<max_size>100000</max_size>

<uploadfolder>uploads/tx_stflashplayer</uploadfolder>

<maxitems>1</maxitems>



<size>1</size>

<selectedListStyle>width:180px</selectedListStyle>

</config>

</TCEforms>

</logo>

<displaywidth>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.displaywidth</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</displaywidth>

</el>

</ROOT>

</appearance> -->



<!-- <playback>

<ROOT>

<TCEforms>

<sheetTitle>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.playback</sheetTitle>

</TCEforms>

<type>array</type>



<el>

<autostart>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.autostart</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

<numIndex index="3" type="array">

<numIndex index="0">muted</numIndex>

<numIndex index="1">muted</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</autostart>

<repeat>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.repeat</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

<numIndex index="3" type="array">

<numIndex index="0">list</numIndex>

<numIndex index="1">list</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</repeat>

<shuffle>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.shuffle</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</shuffle>

<smoothing>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.smoothing</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</smoothing>

<bufferlength>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.bufferlength</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</bufferlength>

<rotatetime>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.rotatetime</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</rotatetime>

<start>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.start</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</start>

<volume>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.volume</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</volume>

</el>

</ROOT>

</playback>



<interaction>

<ROOT>

<TCEforms>

<sheetTitle>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.interaction</sheetTitle>

</TCEforms>

<type>array</type>



<el>

<enablejs>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.enablejs</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</enablejs>

<linkfromdisplay>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.linkfromdisplay</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</linkfromdisplay>

<useaudio>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.useaudio</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</useaudio>

<usecaptions>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.usecaptions</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</usecaptions>

<usefullscreen>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.usefullscreen</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</usefullscreen>

<usekeys>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.usekeys</label>

<config>

<type>select</type>

<items type="array">

<numIndex index="0" type="array">

<numIndex index="0"></numIndex>

<numIndex index="1"></numIndex>

</numIndex>

<numIndex index="1" type="array">

<numIndex index="0">true</numIndex>

<numIndex index="1">true</numIndex>

</numIndex>

<numIndex index="2" type="array">

<numIndex index="0">false</numIndex>

<numIndex index="1">false</numIndex>

</numIndex>

</items>

<maxitems>1</maxitems>

<size>1</size>

<default></default>



</config>

</TCEforms>

</usekeys>





<audio>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.audio</label>

<config>

<type>group</type>

<internal_type>file</internal_type>

<allowed>mp3</allowed>

<max_size>100000</max_size>

<uploadfolder>uploads/tx_stflashplayer</uploadfolder>

<maxitems>1</maxitems>



<size>1</size>

<selectedListStyle>width:180px</selectedListStyle>

</config>

</TCEforms>

</audio>

<bwfile>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.bwfile</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</bwfile>

<bwstreams>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.bwstreams</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</bwstreams>

<callback>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.callback</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</callback>

<captions>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.captions</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</captions>

<id>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.id</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</id>

<javascriptid>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.javascriptid</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</javascriptid>

<link>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.link</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</link>

<linktarget>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.linktarget</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</linktarget>

<streamscript>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.streamscript</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</streamscript>

<type>

<TCEforms>

<label>LLL:EXT:st_flashplayer/locallang_db.xml:st_flashplayer.pi_flexform.type</label>

<config>

<type>input</type>

<size>30</size>

<default></default>

</config>

</TCEforms>

</type>



</el>

</ROOT>

</interaction> -->



</sheets>

</T3DataStructure>

Wednesday, March 4, 2009

Pages not hidden by default - How to uncheck Hide by default in new Pages

PROBLEM: How to set unhide pages and content elements by default?
SOLUTION: TSConfig offers TCAdefaults.pages.hidden = 1 but it does not work.
In order to force typo3 to accept this value I followed http://typo3.toaster-schwerin.de/typo3_english/2006_08/msg00187.html
and modified "ext_tables.php":

* Overriding $TCA
* The TYPO3 Configuration Array (TCA) is defined by the distributed tables.php and ext_tables.php files.
* If you want to extend and/or modify its content, you can do so with scripts like this.

read more about TCA at http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.2.0/view/4/1/#id4239661