(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['typo_1'] = array("typo_1", "typo_1_fr", "typo_1_es");
$label_ll['typo_2'] = array("typo_2", "typo_2_fr", "typo_2_es");
$label_ll['typo_3'] = array("typo_3", "typo_3_fr", "typo_3_es");
$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");
$label_ll['country'] = array("Countries", "Countries fr", "Countries fr");
$label_ll['africa'] = array("Africa (RAF) ", "Africa (RAF) fr", "Africa (RAF) es");
$label_ll['asia'] = array("Asia and the Pacific (RAP)", "Asia and the Pacific (RAP) fr", "Asia and the Pacific (RAP) es");
$label_ll['europe'] = array("Europe (REU)", "Europe (REU) fr", "Europe (REU) es");
$label_ll['latin_america'] = array("Latin America and the Caribbean (RLC)", "Latin America and the Caribbean (RLC) fr", "Latin America and the Caribbean (RLC) es");
$label_ll['near_east'] = array("Near East (RNE)", "Near East (RNE) fr", "Near East (RNE) es");
$label_ll['topics'] = array("Topics", "Topics fr", "tema");
$label_ll['topics_msg'] = array("select a topic", "select a topic fr", "select a topic es");
$label_ll['country_msg'] = array("select a country", "select a country fr", "select a country es");
$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();
// data statistic
$pidtheme1 = 238;
//Programs Projects
$pidtheme2 = 247;
//documents report
$pidtheme3 = 248;
// how to
$pidtheme4 = 249;
// multimedia
$pidtheme5 = 250;
// website
$pidtheme6 = 251;
$actions['new'] = "206";
$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 ???
$username = $GLOBALS["TSFE"]->fe_user->user['username'];
// 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'] = $username;
$data['my_status'] = "0";
//$my_type = 2;
}
/*
$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 = "
";
}
*/
$query = "SELECT uid,header FROM tt_content WHERE pid=".$pidtheme1." and deleted=0 and hidden=0 ORDER BY header";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select themes " . mysql_error() . "\n";
}
$content_themes1 = "";
$data_list_themes = explode(",",$data['tx_documentum_theme']);
while($resRow = mysql_fetch_assoc($res)) {
$themes[$resRow['uid']] = $themes[$resRow['header']];
$checked = in_array($resRow['uid'],$data_list_themes)?"checked":"";
$content_themes1 .= " " .$resRow['header']."
";
}
$query = "SELECT uid,header FROM tt_content WHERE pid=".$pidtheme2." and deleted=0 and hidden=0 ORDER BY header";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select themes " . mysql_error() . "\n";
}
$content_themes2 = "";
$data_list_themes = explode(",",$data['tx_documentum_theme']);
while($resRow = mysql_fetch_assoc($res)) {
$themes[$resRow['uid']] = $themes[$resRow['header']];
$checked = in_array($resRow['uid'],$data_list_themes)?"checked":"";
$content_themes2 .= " " .$resRow['header']."
";
}
$query = "SELECT uid,header FROM tt_content WHERE pid=".$pidtheme3." and deleted=0 and hidden=0 ORDER BY header";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select themes " . mysql_error() . "\n";
}
$content_themes3 = "";
$data_list_themes = explode(",",$data['tx_documentum_theme']);
while($resRow = mysql_fetch_assoc($res)) {
$themes[$resRow['uid']] = $themes[$resRow['header']];
$checked = in_array($resRow['uid'],$data_list_themes)?"checked":"";
$content_themes3 .= " " .$resRow['header']."
";
}
$query = "SELECT uid,header FROM tt_content WHERE pid=".$pidtheme4." and deleted=0 and hidden=0 ORDER BY header";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select themes " . mysql_error() . "\n";
}
$content_themes4 = "";
$data_list_themes = explode(",",$data['tx_documentum_theme']);
while($resRow = mysql_fetch_assoc($res)) {
$themes[$resRow['uid']] = $themes[$resRow['header']];
$checked = in_array($resRow['uid'],$data_list_themes)?"checked":"";
$content_themes4 .= " " .$resRow['header']."
";
}
$query = "SELECT uid,header FROM tt_content WHERE pid=".$pidtheme5." and deleted=0 and hidden=0 ORDER BY header";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select themes " . mysql_error() . "\n";
}
$content_themes5 = "";
$data_list_themes = explode(",",$data['tx_documentum_theme']);
while($resRow = mysql_fetch_assoc($res)) {
$themes[$resRow['uid']] = $themes[$resRow['header']];
$checked = in_array($resRow['uid'],$data_list_themes)?"checked":"";
$content_themes5 .= " " .$resRow['header']."
";
}
$query = "SELECT uid,header FROM tt_content WHERE pid=".$pidtheme6." and deleted=0 and hidden=0 ORDER BY header";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select themes " . mysql_error() . "\n";
}
$content_themes6 = "";
$data_list_themes = explode(",",$data['tx_documentum_theme']);
while($resRow = mysql_fetch_assoc($res)) {
$themes[$resRow['uid']] = $themes[$resRow['header']];
$checked = in_array($resRow['uid'],$data_list_themes)?"checked":"";
$content_themes6 .= " " .$resRow['header']."
";
}
$query = "SELECT uid,header FROM tt_content WHERE pid=272 and deleted=0 and hidden=0 ORDER BY header";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select topics " . mysql_error() . "\n";
}else{
$topics_types = "";
$topics_types .= "";
}
/*-------t8 start---------*/
//TYPE############
//$query = "SELECT uid,header,pid FROM tt_content WHERE pid in(238,248,249,250) and deleted=0 and hidden=0 ORDER BY pid";
$query = "SELECT uid,header,pid,t3_origuid FROM tt_content WHERE pid in(238,248,249,250) and deleted=0 and hidden=0 and sys_language_uid=".$language_mode." ORDER BY pid";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select topics " . mysql_error() . "\n";
}else{
$themes_types = "";
$themes_types .= "";
}
//TOPIC###########
//$query = "SELECT uid,header,pid FROM tt_content WHERE pid in(326,327,328,329,330,331) and deleted=0 and hidden=0 ORDER BY pid";
$query = "SELECT uid,header,pid FROM tt_content WHERE pid in(326,327,328,329,330,331) and deleted=0 and hidden=0 and sys_language_uid=".$language_mode." ORDER BY pid";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select topics " . mysql_error() . "\n";
}else{
$topics_types = "";
$topics_types .= "";
}
/*-------t8 end---------*/
$query = "SELECT uid,cn_short_en FROM static_countries ORDER BY cn_short_en";
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
echo mysql_errno() . ": select country " . mysql_error() . "\n";
}else{
$country = "";
$country .= "";
}
/*
$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 = "
";
}
// $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();
$date_from = $time;
$date_to = '0';
$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';
}*/
//($_POST['themes']==787,778,803,804)
//$themes_array= (explode(" ",$_POST['themes']));
//$themes_array = array("787", "NT", "Irix", "Linux");
//$themes_array = array(implode(" ",$_POST['themes']));
//$themes_array = $_POST['themes'];
//print_r($themes_array);
//$themes_array1 = array(implode(" ",$_POST['themes']));
$if_theme = 0;
$if_topic = 0;
if ($_POST['themes']!='') {
$if_theme = 1;
}
if ($_POST['topics']!='') {
$if_topic = 1;
$topics = implode(",",$_POST['topics']);
} else {
$topics = 0;
}
/*if (in_array(808, $themes_array) || in_array(809, $themes_array) || in_array(810, $themes_array)||in_array(811, $themes_array) || in_array(812, $themes_array) || in_array(813, $themes_array) || in_array(814, $themes_array) || in_array(815, $themes_array)) {
$my_doc_3 = 1;
}
if (in_array(818, $themes_array) || in_array(817, $themes_array) || in_array(816, $themes_array)) {
$my_doc_4 = 1;
}
if (in_array(821, $themes_array) || in_array(820, $themes_array) || in_array(819, $themes_array)) {
$my_doc_5 = 1;
}
if (in_array(822, $themes_array)) {
$my_doc_6 = 1;
}
*/
//---------------------------------------------------------------------------------------------------buono end
/*$themes_array = $_POST['themes'];
$pos = strrpos($themes_array,787);
if ($pos === true) {
$my_doc_1 = 1;
}*/
//if (in_array("778", $themes_array)) {
// $my_doc_1 = 1;
//}
/* if(((implode(",",$_POST['themes']))==787)||((implode(",",$_POST['themes']))==778)||((implode(",",$_POST['themes']))==803)||((implode(",",$_POST['themes']))==804)){
$my_doc_1 = 1;
}
if(((implode(",",$_POST['themes']))==807)||((implode(",",$_POST['themes']))==806)||((implode(",",$_POST['themes']))==805)){
$my_doc_2 = 1;
}
if(((implode(",",$_POST['themes']))==787)||((implode(",",$_POST['themes']))==778)||((implode(",",$_POST['themes']))==803)||((implode(",",$_POST['themes']))==804)){
$my_doc_1 = 1;
}
else {
$my_doc_1 = '';
}
if(((implode(",",$_POST['themes']))==807)||((implode(",",$_POST['themes']))==806)||((implode(",",$_POST['themes']))==805)){
$my_doc_2 = 1;
}
else {
$my_doc_2 = '';
}*/
/* if (($_POST['themes']==808)||($_POST['themes']==809)||($_POST['themes']==810)||($_POST['themes']==811)||($_POST['themes']==812)||($_POST['themes']==813)||($_POST['themes']==815)||($_POST['themes']==814)){
$my_type = 4;
}
if (($_POST['themes']==818)||($_POST['themes']==817)||($_POST['themes']==816)){
$my_type = 5;
}
if (($_POST['themes']==821)||($_POST['themes']==820)||($_POST['themes']==819)){
$my_type = 6;
}
if ($_POST['themes']==822){
$my_type = 7;
}*/
/*
}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=2";
}*/
// t3lib_div::debug($_POST)
//begin themes & types
/*if(empty($_POST['themes'])){
$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']);
}*/
//end
$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=0";
}
if ($_POST['topics']) {
$fields .= ",topics='".implode(",",$_POST['topics'])."'";
}else{
$fields .= ",topics=0";
}
//$fields .= ",topics='".implode(",",$_POST['topics'])."'";
//$fields .= ",topics='".$_POST['topics']."'";
$fields .= ",my_type=9";
$fields .= ",if_theme=".$if_theme; //'".$_POST['my_type']."'
$fields .= ",if_topic=".$if_topic; //'".$_POST['my_type']."'
//$fields .= ",my_doc_3=".$my_doc_3; //'".$_POST['my_type']."'
//$fields .= ",my_doc_4=".$my_doc_4; //'".$_POST['my_type']."'
//$fields .= ",my_doc_5=".$my_doc_5; //'".$_POST['my_type']."'
//$fields .= ",my_doc_6=".$my_doc_6; //'".$_POST['my_type']."'
$fields .= ",tx_mblnewsevent_where='".$_POST['where']."'";
$fields .= ",tx_mblnewsevent_from=".$date_from;
$fields .= ",tx_mblnewsevent_to=".$date_to;
$fields .= ",sys_language_uid=".$_POST['language'];
//if($imagelist){
//$fields .= ",image='".$imagelist."'";
//}
// print_r($_POST);
$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("Roberto.DiCarlo@fao.org", "Documents Repository", $name_author." has inserted a new document in Docs Rep the title of the document is :".$_POST['title']." (now is just a test)", "From:info@e-agriculture.org");
mail("Charlotte.Masiello@fao.org", "Documents Repository", $name_author." has inserted a new document in Docs Rep the title of the document is :".$_POST['title']." (now is just a test)", "From:info@e-agriculture.org");
mail("Nathaniel.Heller@fao.org", "Documents Repository", $name_author." has inserted a new document in Docs Rep 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']);
// $content .= "
docs/links & news/events saved.";
}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.";
}
}else{
$content .= "";
//$prova = $data['themes[]'];
//echo $prova;
$content .= "";
$javascript_load = "hideDiv();";
}
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 = "";
return $rt;
}
*/
function LoadPageTitle($uid,$lang){
if($lang>0){
$query = "SELECT title FROM pages_language_overlay WHERE pid=".$uid." AND sys_language_uid=".$lang;
}else{
$query = "SELECT title FROM pages WHERE uid=".$uid;
}
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
return "";
}else{
$resRow = mysql_fetch_assoc($res);
$resRow = str_replace("Topic ","",$resRow);
$resRow = str_replace("Topics ","",$resRow);
return $resRow['title'];
}
}
function LoadPageTitleTwo($uid,$lang){
if($lang>0){
$query = "SELECT title FROM pages_language_overlay WHERE pid=".$uid." AND sys_language_uid=".$lang;
}else{
$query = "SELECT title FROM pages WHERE uid=".$uid;
}
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
return "";
}else{
$resRow = mysql_fetch_assoc($res);
$resRow = str_replace("Themes ","",$resRow);
$resRow = str_replace("Theme ","",$resRow);
return $resRow['title'];
}
}
function LoadContent($uid){
// $query = "SELECT * FROM tt_content WHERE deleted=0 and hidden=0 and uid=".$uid;
$query = "SELECT * FROM tt_content WHERE uid=".$uid;
$res = mysql(TYPO3_db, $query);
if (mysql_error()){
return "";
}else{
$resRow = mysql_fetch_assoc($res);
return $resRow['bodytext'];
}
return "";
}
?>