tslib_pibase(); $actions['MY_TYPE_LIST'] = explode(",",$GLOBALS["TSFE"]->tmpl->setup['config.']['MY_TYPE_LIST']); // t3lib_div::debug($actions['MY_TYPE_LIST']); $actions['back'] = "233"; $actions['new'] = "216"; $actions['intro']= "738"; $actions['saved_editor']= "457"; $actions['saved_other']= "458"; $actions['themesFolderId']= "237"; if($_GET['fromType']<2){ $actions['back'] = "233"; } else { $actions['back'] = "235"; } $FE_Group_Editor = 10; $FE_Group_Registered = 8; $numoffile = 5; // 3 = editor // 5 = registered $FE_user = $GLOBALS["TSFE"]->fe_user->user["uid"]; $FE_group = $GLOBALS["TSFE"]->fe_user->groupData['uid']; // is editor ??? $def_author = $GLOBALS["TSFE"]->fe_user->user['name']; // t3lib_div::debug($GLOBALS["TSFE"]->fe_user); $my_uid = ""; $my_oldfiles = ""; $checkisevent = ""; if($_GET['duid']){ $query = "UPDATE tt_news SET deleted=1 WHERE uid=".$_GET['duid']; $res = mysql(TYPO3_db, $query); header("location: index.php?id=".$actions['back']); } if($_GET['uid']){ $my_uid = $_GET['uid']; $query = "SELECT * FROM tt_news WHERE uid = ".$_GET['uid'] ; $res = mysql(TYPO3_db, $query); $data = mysql_fetch_array($res, MYSQL_ASSOC); //t3lib_div::debug($data); $my_type = $data['my_type']; $my_oldfiles = $data['news_files']; }else{ $data['tx_mblnewsevent_from'] = time(); $data['tx_mblnewsevent_to'] = ""; $data['author'] = $def_author; $data['my_status'] = "0"; $my_type = 2; } $query = "SELECT * FROM tx_documentum_status WHERE deleted=0 and hidden=0 ORDER BY uid"; $res = mysql(TYPO3_db, $query); if (mysql_error()){ echo mysql_errno() . ": select status " . mysql_error() . "\n"; }else{ $content_status = " "; } $query = "SELECT * FROM tx_documentum_themes WHERE pid=".$actions['themesFolderId']." and deleted=0 and hidden=0 ORDER BY title"; $res = mysql(TYPO3_db, $query); if (mysql_error()){ echo mysql_errno() . ": select themes " . mysql_error() . "\n"; } $content_themes = ""; $data_list_themes = explode(",",$data['tx_documentum_theme']); while($resRow = mysql_fetch_assoc($res)) { $themes[$resRow['uid']] = $themes[$resRow['title']]; $checked = in_array($resRow['uid'],$data_list_themes)?"checked":""; $content_themes .= " " .$resRow['title']."
"; } if($my_oldfiles != ""){ $table_files = ""; $listfiles = explode(",",$data['news_files']); $table_files .= ""; foreach($listfiles as $value){ $table_files .= ""; } $table_files .= "
file/sremove
".$value."
"; } // $intro = LoadContent($actions['intro']); // t3lib_div::debug($my_type); $radio_type = LoadRadio($actions,$my_type); if(@$_POST['title']){ $time = time(); $cruser_id = '8'; // fixed user id (max) $pid = '261'; // news list page if($_POST['my_type']==1){ $is_event = '1'; if(empty($_POST['from'])){ $date_from = $time; }else{ $aFrom = explode("/",$_POST['from']); $aIntFrom['day'] = intval($aFrom[0]); $aIntFrom['month'] = intval($aFrom[1]); $aIntFrom['year'] = intval($aFrom[2]); $date_from = mktime(0,0,0,$aIntFrom['month'],$aIntFrom['day'],$aIntFrom['year']); } if(empty($_POST['to'])){ $date_to = $time; }else{ $aTo = explode("/",$_POST['to']); $aIntTo['day'] = intval($aTo[0]); $aIntTo['month'] = intval($aTo[1]); $aIntTo['year'] = intval($aTo[2]); $date_to = mktime(0,0,0,$aIntTo['month'],$aIntTo['day'],$aIntTo['year']); } $where = "'".$_POST['where']."'"; }else{ $is_event = '0'; $date_from = $time; $date_to = '0'; $where = "''"; } // t3lib_div::debug($aIntTo); $file_dir = PATH_site . "/uploads/media/"; $i = 0; $filelist = ""; $allfiles = array(); foreach ($_FILES['myfiles']['name'] as $value) { if($value){ array_push($allfiles,$value); $newfile = $file_dir.$_FILES['myfiles']['name'][$i]; move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile); $i++; } } // t3lib_div::debug($allfiles); if(!empty($_POST['my_oldfiles'])){ foreach(explode(",",$_POST['my_oldfiles']) as $value){ if(!in_array($value,$allfiles)) array_push($allfiles,$value); } } // t3lib_div::debug($allfiles); if($_POST['del_files']){ foreach($_POST['del_files'] as $delvalue){ foreach($allfiles as $key=>$newvalue){ if($delvalue==$newvalue) unset($allfiles[$key]); } } } // t3lib_div::debug($_POST); $filelist = sizeof($allfiles)>0?implode(",",$allfiles):""; $fields = "title='".$_POST['title']."'"; if(isset($_POST['my_status'])){ $fields .= ",my_status=".$_POST['my_status']; }else{ $fields .= ",my_status=0"; } if(isset($_POST['my_type'])){ $fields .= ",my_type=".$_POST['my_type']; }else{ $fields .= ",my_type=0"; } // $short = WordsLimit($_POST['bodytext'],$GLOBALS["TSFE"]->tmpl->setup['config.']['MY_NEWS_WORDS_LIMIT']); //if(strlen($short)>50) // $short = substr($short,0,90)."..."; //t3lib_div::debug($short); $fields .= ",bodytext='".$_POST['bodytext']."'"; $fields .= ",short='".$_POST['short']."'"; $fields .= ",author='".$_POST['author']."'"; $fields .= ",pid=".intval($pid); $fields .= ",crdate=".$time; $fields .= ",cruser_id=".intval($cruser_id); $fields .= ",tstamp=".$time; $fields .= ",ext_url='".$_POST['ext_url']."'"; $fields .= ",news_files='".$filelist."'"; if($_POST['themes']){ $fields .= ",tx_documentum_theme='".implode(",",$_POST['themes'])."'"; } else { $fields .= ",tx_documentum_theme=''"; } $fields .= ",tx_mblnewsevent_isevent=".$is_event; $fields .= ",tx_mblnewsevent_where=".$where; if($_POST['actualizeDate'] or $_POST['my_type']==1 or ($_POST['my_type']!=1 and !$_POST['my_uid'])){ $fields .= ",tx_mblnewsevent_from=".$date_from; } $fields .= ",tx_mblnewsevent_to=".$date_to; if($_POST['my_uid']){ $query = "UPDATE tt_news SET ".$fields." WHERE uid=".$_POST['my_uid']; }else{ $query = "INSERT INTO tt_news SET ".$fields; } $res = mysql(TYPO3_db, $query); if (mysql_error()) echo mysql_errno() . ": insert news " . mysql_error() . "\n"; // t3lib_div::debug($query); if(in_array($FE_Group_Editor, $FE_group)){ $content .= LoadContent($actions['saved_editor']); // $content .= "

docs/links & news/events saved."; $javascript_load = ""; }else{ $content .= LoadContent($actions['saved_other']); // $content .= "

Your news/events has been uploaded and it will be published after being reviewed by a coordinator.

Thank you."; $javascript_load = ""; } }else{ ?> "; $content .= "
"; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= "
"; $content .= ""; $content .= ""; $content .= " "; $content .= " "; $content .= ""; if(in_array($FE_Group_Editor, $FE_group)){ $content .= ""; $content .= ""; $content .= ""; $content .= ""; } $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; if($my_uid){ $content .= ""; $content .= ""; $content .= ""; } $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= "
".$radio_type."
status
" . $content_status ."
title *
abstract (max 200 chars)
description
Actualize date 
submitted by
external URL
upload (max 2 MB each) 
" . uploader() ."
".$table_files."
themes

" . $content_themes ."

"; $content .= "
"; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= "
where (city, country)
from"; $content .= ""; $content .= "
to"; $content .= ""; $content .= "

  * Mandatory field

"; $content .= ""; $content .= ""; $content .= "
"; $javascript_load = "hideDiv();"; } function transformDate($valore){ $ritorno = ""; if($valore>0){ $ritorno = date('d/m/Y',$valore); } return $ritorno; } function uploader(){ $numoffile = 5; $ret = ""; for($i=0;$i<$numoffile;$i++) { $ret .= "
"; } return $ret; } echo $content; ?> "; foreach($actions['MY_TYPE_LIST'] as $value){ $item = explode(":",$value); $rt .= ""; $rt .= " ".$item[0]; $rt .= ""; } $rt .= ""; return $rt; } function LoadContent($uid){ $query = "SELECT * FROM tt_content WHERE deleted=0 and hidden=0 and uid=".$uid; $res = mysql(TYPO3_db, $query); if (mysql_error()){ return ""; }else{ $resRow = mysql_fetch_assoc($res); return $resRow['bodytext']; } return ""; } // short abstract by max (2007-07-24) function WordsLimit($string,$nwords=10){ $wordslist = explode(" ",strip_tags($string)); // t3lib_div::debug(count($wordslist)); if(count($wordslist)>$nwords){ $nmax = $nwords; }else{ $nmax = count($wordslist); } $retstring = ""; for($i=0;$i<$nmax;$i++){ $retstring .= $wordslist[$i]." "; } // t3lib_div::debug($wordslist); return $retstring; } ?>