(max 1 MB each) ", "tèlècharger
(max 1 MB chacun) ", "upload
(max 1 MB cada uno) "); $label_ll['where'] = array("where (city, country)", "là où (ville, pays)", "donde (ciudad, paìs)"); $label_ll['from'] = array("from", "de", "de"); $label_ll['to'] = array("to", "à", "a"); $label_ll['types'] = array("types *", "types *", "tipos *"); $label_ll['select'] = array("select:", "choisi:", "selecto:"); $label_ll['mandatory'] = array("Mandatory field", "Champ obligatoire", "Campo obligatorio"); $label_ll['submit'] = array("submit", "soumettre", "someter"); $label_ll['news'] = array("news", "nouvelles", "noticias"); $label_ll['event'] = array("event", "événement", "acontecimiento"); $label_ll['language'] = array("language", "langue", "lengua"); $label_ll['default'] = array("default", "défaut", "defecto"); $label_ll['english'] = array("english", "anglais", "inglés"); $label_ll['french'] = array("french", "français", "francés"); $label_ll['spanish'] = array("spanish", "espagnol", "espagnol"); $label_ll['draft'] = array("draft", "ébauche", "bosquejo"); $label_ll['rejected'] = array("reviewed & rejected", "passé en revue et a rejeté", "repasado y rechazado"); $label_ll['published'] = array("reviewed & published", "passé en revue et a édité", "repasado y publicado"); $content = ""; // $this->tslib_pibase(); $language_mode = ($GLOBALS['TSFE']->config['config']['sys_language_uid'])?$GLOBALS['TSFE']->config['config']['sys_language_uid']:0; // $news_class = new tslib_pibase(); $actions['new'] = "25"; $actions['news_type'] = "80"; $actions['intro'] = "738"; $actions['saved_editor']= $GLOBALS["TSFE"]->tmpl->setup['config.']['UID_NEWS_SAVED'];; $actions['saved_other']= $GLOBALS["TSFE"]->tmpl->setup['config.']['UID_NEWS_SAVED']; if($_GET['fromType']<2){ $actions['back'] = $GLOBALS["TSFE"]->tmpl->setup['config.']['PID_NEWS_EDIT_BACK']; } else { $actions['back'] = $GLOBALS["TSFE"]->tmpl->setup['config.']['PID_NEWS_EDIT_BACK']; } $FE_Group_Editor = $GLOBALS["TSFE"]->tmpl->setup['config.']['UID_GRP_EDITORS']; $FE_Group_Registered = $GLOBALS["TSFE"]->tmpl->setup['config.']['UID_GRP_REGISTERED']; $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 = 0; } /* $query = "SELECT * FROM my_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 = " "; } */ $content_status = " "; // load type list $query = "SELECT * FROM tt_content WHERE deleted=0 and hidden=0 and pid=".$actions['news_type']." and sys_language_uid=".$language_mode." ORDER BY header"; // $news_class->pi_loadLL(); // $this->initLanguages(); //*********************************************************************************************************** // print($news_class->pi_getLL('archiveHeader')); $res = mysql(TYPO3_db, $query); if (mysql_error()){ echo mysql_errno() . ": select type " . mysql_error() . "\n"; } // t3lib_div::debug($my_type); $content_types = ""; $content_types .= ""; 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($my_type,$label_ll,$language_mode); // print($language_mode); if(@$_POST['title']){ $time = time(); $cruser_id = '8'; // fixed user id (max) $pid = $GLOBALS["TSFE"]->tmpl->setup['config.']['PID_NEWS_LIST']; // news list page if($_POST['my_type']==1){ $is_event = '1'; }else{ $is_event = '0'; } 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']."'"; // 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($aIntTo); $image_dir = PATH_site . "/uploads/pics/"; $i = 0; // $filelist = ""; $allimages = array(); foreach ($_FILES['myimages']['name'] as $value) { if($value){ array_push($allimages,$value); $newimage = $image_dir.$_FILES['myimages']['name'][$i]; move_uploaded_file($_FILES['myimages']['tmp_name'][$i], $newimage); $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):""; $imagelist = sizeof($allimages)>0?implode(",",$allimages):""; $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 = $_POST['bodytext']; if(strlen($short)>140) $short = substr($short,0,140); // t3lib_div::debug($_POST); $fields .= ",bodytext='".$_POST['bodytext']."'"; $fields .= ",short='".$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."'"; $fields .= isset($_POST['themes'])?",my_theme='".$_POST['themes']."'":""; $fields .= ",tx_mblnewsevent_isevent=".$is_event; $fields .= ",tx_mblnewsevent_where=".$where; $fields .= ",tx_mblnewsevent_from=".$date_from; $fields .= ",tx_mblnewsevent_to=".$date_to; $fields .= ",sys_language_uid=".$_POST['language']; if($imagelist){ $fields .= ",image='".$imagelist."'"; } $name_author=$_POST['author']; if($_POST['my_uid']){ $query = "UPDATE tt_news SET ".$fields." WHERE uid=".$_POST['my_uid']; }else{ $query = "INSERT INTO tt_news SET ".$fields; mail("Charlotte.Masiello@fao.org", "News and Events","Someone has inserted a new document in News/Events, the title of the document is :".$_POST['title']." (now is just a test)", "From:info@e-agriculture.org"); mail("Roberto.DiCarlo@fao.org", "News and Events","Someone has inserted a new document in News/Events, the title of the document is :".$_POST['title']." (now is just a test)", "From:info@e-agriculture.org"); } $res = mysql(TYPO3_db, $query); if (mysql_error()) echo mysql_errno() . ": insert news " . mysql_error() . "\n"; // t3lib_div::debug($query); $javascript_load = ""; if(in_array($FE_Group_Editor, $FE_group)){ $content .= LoadContent($actions['saved_editor'],$language_mode); // $content .= "

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

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

Thank you."; } }else{ $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 .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; /* $content .= ""; $content .= ""; */ $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; // onClick='FieldCheck(document.edit_news)' $content .= ""; $content .= "
"; $content .= "
".$radio_type."
".$label_ll['language'][$language_mode].""; $content .= ""; $content .= "
".$label_ll['status'][$language_mode]."" . $content_status ."
".$label_ll['title'][$language_mode]."
".$label_ll['description'][$language_mode]."
".$label_ll['submitted'][$language_mode]."
".$label_ll['image'][$language_mode]."
".$label_ll['url'][$language_mode]."
".$label_ll['maxsize'][$language_mode]."" . uploaderFiles() ."
".$table_files."
"; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= "
where (city, country)
from"; $content .= ""; $content .= "
to"; $content .= ""; $content .= "
".$label_ll['where'][$language_mode]."
"; $content .= "
"; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= "
".$label_ll['from'][$language_mode].""; $content .= ""; $content .= "
".$label_ll['to'][$language_mode]."
"; $content .= "
"; $content .= ""; $content .= ""; $content .= "
".$label_ll['types'][$language_mode]."

" . $content_types ."

* ".$label_ll['mandatory'][$language_mode]."      
"; $content .= ""; $content .= ""; $content .= "
"; $javascript_load = "hideDiv();"; } function transformDate($valore){ $ritorno = ""; if($valore>0){ $ritorno = date('d/m/Y',$valore); } return $ritorno; } function uploaderFiles(){ $numoffile = 5; $ret = ""; for($i=0;$i<$numoffile;$i++) { $ret .= "
"; } return $ret; } echo $content; function LoadRadio($my_type,$label_ll,$language_mode){ $rt = ""; //$rt .= ""; $rt .= ""; $rt .= "
"; //$rt .= " docs & links"; //$rt .= ""; $rt .= " ".$label_ll['news'][$language_mode]; $rt .= ""; $rt .= " ".$label_ll['event'][$language_mode]; $rt .= "
"; return $rt; } function LoadContent($uid,$lang){ // $query = "SELECT * FROM tt_content WHERE deleted=0 and hidden=0 and uid=".$uid; $query = "SELECT * FROM tt_content WHERE pid=".$uid." and sys_language_uid=".$lang; $res = mysql(TYPO3_db, $query); if (mysql_error()){ return ""; }else{ $resRow = mysql_fetch_assoc($res); return $resRow['bodytext']; } return ""; } ?>