// Array of 'FileInfo' objects read from the $_XML_DATA array $_FILE_DATA_TABLE = ''; // String used to store file info results nested between <tr> tags $_FILE_DATA_EMAIL = ''; // String used to store file info results $xml_parser = new XML_Parser(); // XML parser $xml_parser->setXMLFile($TEMP_DIR, $_GET['upload_id']); // Set upload_id.redirect file $xml_parser->setXMLFileDelete($_INI['delete_redirect_file']); // Delete upload_id.redirect file when finished parsing $xml_parser->parseFeed(); // Parse upload_id.redirect file // Display message if the XML parser encountered an error if ($xml_parser->getError()) { kak($xml_parser->getErrorMsg(), 1, __LINE__, $_INI['path_to_css_file']); } $_XML_DATA = $xml_parser->getXMLData(); // Get xml data from the xml parser $_CONFIG_DATA = getConfigData($_XML_DATA); // Get config data from the xml data $_POST_DATA = getPostData($_XML_DATA); // Get post data from the xml data $_FILE_DATA = getFileData($_XML_DATA); // Get file data from the xml data // Output XML DATA, CONFIG DATA, POST DATA, FILE DATA to screen and exit if DEBUG_ENABLED. if ($_INI['debug_finished']) { debug("<br><u>XML DATA</u>", $_XML_DATA); debug("<u>CONFIG DATA</u>", $_CONFIG_DATA); debug("<u>POST DATA</u>", $_POST_DATA); debug("<u>FILE DATA</u>", $_FILE_DATA);
/** * Outputs frontpage HTML * * @return Nothing */ function uploadConfirmPerl() { global $database, $my, $acl, $mosConfig_absolute_path, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); // get server configuration data require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'serverconfig.hwdvideoshare.php'); $s = hwd_vs_SConfig::get_instance(); //****************************************************************************************************** // ATTENTION: THIS FILE HEADER MUST REMAIN INTACT. DO NOT DELETE OR MODIFY THIS FILE HEADER. // // Name: ubr_finished.php // Revision: 1.3 // Date: 2/18/2008 5:36:57 PM // Link: http://uber-uploader.sourceforge.net // Initial Developer: Peter Schmandra http://www.webdice.org // Description: Show successful file uploads. // // Licence: // The contents of this file are subject to the Mozilla Public // License Version 1.1 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy of // the License at http://www.mozilla.org/MPL/ // // Software distributed under the License is distributed on an "AS // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or // implied. See the License for the specific language governing // rights and limitations under the License. // //*************************************************************************************************************** //*************************************************************************************************************** // The following possible query string formats are assumed // // 1. ?upload_id=upload_id // 2. ?about=1 //**************************************************************************************************************** $THIS_VERSION = "1.3"; // Version of this file $UPLOAD_ID = ''; // Initialize upload id require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_ini.php'); require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_lib.php'); require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_finished_lib.php'); if($PHP_ERROR_REPORTING){ error_reporting(E_ALL); } header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.date('r')); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', FALSE); header('Pragma: no-cache'); if(preg_match("/^[a-zA-Z0-9]{32}$/", $_GET['upload_id'])){ $UPLOAD_ID = $_GET['upload_id']; } elseif(isset($_GET['about']) && $_GET['about'] == 1){ kak("<u><b>UBER UPLOADER FINISHED PAGE</b></u><br>UBER UPLOADER VERSION = <b>" . $UBER_VERSION . "</b><br>UBR_FINISHED = <b>" . $THIS_VERSION . "<b><br>\n", 1 , __LINE__); } else{ kak("<font color='red'>ERROR</font>: Invalid parameters passed<br>", 1, __LINE__); } //Declare local values $_XML_DATA = array(); // Array of xml data read from the upload_id.redirect file $_CONFIG_DATA = array(); // Array of config data read from the $_XML_DATA array $_POST_DATA = array(); // Array of posted data read from the $_XML_DATA array $_FILE_DATA = array(); // Array of 'FileInfo' objects read from the $_XML_DATA array $_FILE_DATA_TABLE = ''; // String used to store file info results nested between <tr> tags $_FILE_DATA_EMAIL = ''; // String used to store file info results $xml_parser = new XML_Parser; // XML parser $xml_parser->setXMLFile($TEMP_DIR, $_REQUEST['upload_id']); // Set upload_id.redirect file $xml_parser->setXMLFileDelete($DELETE_REDIRECT_FILE); // Delete upload_id.redirect file when finished parsing $xml_parser->parseFeed(); // Parse upload_id.redirect file // Display message if the XML parser encountered an error if($xml_parser->getError()){ kak($xml_parser->getErrorMsg(), 1, __LINE__); } $_XML_DATA = $xml_parser->getXMLData(); // Get xml data from the xml parser $_CONFIG_DATA = getConfigData($_XML_DATA); // Get config data from the xml data $_POST_DATA = getPostData($_XML_DATA); // Get post data from the xml data $_FILE_DATA = getFileData($_XML_DATA); // Get file data from the xml data // Output XML DATA, CONFIG DATA, POST DATA, FILE DATA to screen and exit if DEBUG_ENABLED. if($DEBUG_FINISHED){ debug("<br><u>XML DATA</u>", $_XML_DATA); debug("<u>CONFIG DATA</u>", $_CONFIG_DATA); debug("<u>POST DATA</u>", $_POST_DATA); debug("<u>FILE DATA</u><br>", $_FILE_DATA); exit; } ///////////////////////////////////////////////////////////////////////////////////////////////// // // *** ATTENTION: ENTER YOUR CODE HERE !!! *** // // This is a good place to put your post upload code. Like saving the // uploaded file information to your DB or doing some image // manipulation. etc. Everything you need is in the // $XML DATA, $_CONFIG_DATA, $_POST_DATA and $_FILE_DATA arrays. // ///////////////////////////////////////////////////////////////////////////////////////////////// // NOTE: You can now access all XML values below this comment. eg. // $_XML_DATA['upload_dir']; or $_XML_DATA['link_to_upload'] etc ///////////////////////////////////////////////////////////////////////////////////////////////// // NOTE: You can now access all config values below this comment. eg. // $_CONFIG_DATA['upload_dir']; or $_CONFIG_DATA['link_to_upload'] etc ///////////////////////////////////////////////////////////////////////////////////////////////// // NOTE: You can now access all post values below this comment. eg. // $_POST_DATA['client_id']; or $_POST_DATA['check_box_1_'] etc ///////////////////////////////////////////////////////////////////////////////////////////////// // NOTE: You can now access all file (slot, name, size, type) info below this comment. eg. // $_FILE_DATA[0]->name or $_FILE_DATA[0]->getFileInfo('name') ///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Create thumnail example (must uncomment line 34) // if( $_FILE_DATA[0]->type == 'image/jpeg'){ $success = createThumbFile($_CONFIG_DATA['upload_dir'], $_FILE_DATA[0]->name, $_CONFIG_DATA['upload_dir'], 120, 100); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Create file upload table $_FILE_DATA_TABLE = getFileDataTable($_FILE_DATA, $_CONFIG_DATA); // Create and send email if($_CONFIG_DATA['send_email_on_upload']){ emailUploadResults($_FILE_DATA, $_CONFIG_DATA, $_POST_DATA); } $file_name = $_FILE_DATA[0]->name; $file_ext = substr($file_name, strrpos($file_name, '.') + 1); $file_ext = strtolower($file_ext); $file_video_name = $file_name; $file_video_id = substr($file_name, 0, -(strlen($file_ext)+1)); $title = hwd_vs_tools::generatePostTitle($_POST_DATA['title']); $description = hwd_vs_tools::generatePostDescription($_POST_DATA['description']); $tags = hwd_vs_tools::generatePostTags($_POST_DATA['tags']); $category_id = intval ($_POST_DATA['category_id']); $public_private = $_POST_DATA['public_private']; $allow_comments = intval ($_POST_DATA['allow_comments']); $allow_embedding = intval ($_POST_DATA['allow_embedding']); $allow_ratings = intval ($_POST_DATA['allow_ratings']); $checkform = hwd_vs_tools::checkFormComplete($title, $description, $category_id, $tags, $public_private, $allow_comments, $allow_embedding, $allow_ratings); if (!$checkform) { return; } // initialise database $row = new hwdvids_video($db); if ($file_ext == "swf") { $_POST['video_type'] = "swf"; } else if ($file_ext == "mp4") { $_POST['video_type'] = "mp4"; } else { $_POST['video_type'] = "local"; } $password = $_POST_DATA['hwdvspassword']; if (!empty($password)) { $_POST['password'] = $password; } $_POST['title'] = $title; $_POST['description'] = $description; $_POST['category_id'] = $category_id; $_POST['tags'] = $tags; $_POST['public_private'] = $public_private; $_POST['allow_comments'] = $allow_comments; $_POST['allow_embedding'] = $allow_embedding; $_POST['allow_ratings'] = $allow_ratings; $_POST['date_uploaded'] = date('Y-m-d H:i:s'); $_POST['user_id'] = $my->id; $_POST['published'] = 1; if ($c->requiredins == 1) { $_POST['video_id'] = $file_video_name; // check if we are reprocessing if ($c->reconvertflv == 0) { if ($file_ext == "flv") { $_POST['approved'] = "queuedforthumbnail"; } else if ($file_ext == "swf") { $_POST['approved'] = "queuedforswf"; } else if ($file_ext == "mp4") { $_POST['approved'] = "queuedformp4"; } else { $_POST['approved'] = "queuedforconversion"; } } else { if ($file_ext == "swf") { $_POST['approved'] = "queuedforswf"; } else if ($file_ext == "mp4") { $_POST['approved'] = "queuedformp4"; } else { $_POST['approved'] = "queuedforconversion"; } } } else if ($c->requiredins == 0) { $originals_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'uploads'.DS.'originals'.DS; $base_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'uploads'.DS; if ($file_ext !== "flv" && $file_ext !== "mp4" && $file_ext !== "swf") { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR04, "exclamation.png", 0); return; } if (!copy($originals_Dir.$file_name, $base_Dir.$file_video_id.".".strtolower($file_ext))) { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0); return; } else { if ($c->deleteoriginal == 1) { if (file_exists($base_Dir.$file_name)) { @unlink($originals_Dir.$file_name); } } if ($c->aav == 1) { $_POST['approved'] = "yes"; } else { $_POST['approved'] = "pending"; } } $_POST['video_id'] = $file_video_id; } //check if already exists $db->SetQuery( 'SELECT count(*)' . ' FROM #__hwdvidsvideos' . ' WHERE video_id = "'.$file_video_id.'"' ); $duplicatecount = $db->loadResult(); if ($duplicatecount > 0) { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0); return; } if(empty($_POST['video_id'])) { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0); return; } // bind it to the table if (!$row->bind($_POST)) { echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n"; exit(); } // store it in the db if (!$row->store()) { echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n"; exit(); } include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'events.php'); $params->title = $title; $params->id = $row->id; $params->category_id = $row->category_id; $params->type = $row->video_type; $params->user_id = $row->user_id; hwdvsEvent::onAfterVideoUpload($params); hwd_vs_html::uploadConfirm($title, $row); }
//Declare local values $_XML_DATA = array(); // Array of xml data read from the upload_id.redirect file $_CONFIG_DATA = array(); // Array of config data read from the $_XML_DATA array $_POST_DATA = array(); // Array of posted data read from the $_XML_DATA array $_FILE_DATA = array(); // Array of 'FileInfo' objects read from the $_XML_DATA array $_FILE_DATA_TABLE = ''; // String used to store file info results nested between <tr> tags $_FILE_DATA_EMAIL = ''; // String used to store file info results $xml_parser = new XML_Parser; // XML parser $xml_parser->setXMLFile($TEMP_DIR, $_REQUEST['upload_id']); // Set upload_id.redirect file $xml_parser->setXMLFileDelete($DELETE_REDIRECT_FILE); // Delete upload_id.redirect file when finished parsing $xml_parser->parseFeed(); // Parse upload_id.redirect file // Display message if the XML parser encountered an error if($xml_parser->getError()){ kak($xml_parser->getErrorMsg(), 1, __LINE__); } $_XML_DATA = $xml_parser->getXMLData(); // Get xml data from the xml parser $_CONFIG_DATA = getConfigData($_XML_DATA); // Get config data from the xml data $_POST_DATA = getPostData($_XML_DATA); // Get post data from the xml data $_FILE_DATA = getFileData($_XML_DATA); // Get file data from the xml data // Output XML DATA, CONFIG DATA, POST DATA, FILE DATA to screen and exit if DEBUG_ENABLED. if($DEBUG_FINISHED){ debug("<br><u>XML DATA</u>", $_XML_DATA); debug("<u>CONFIG DATA</u>", $_CONFIG_DATA); debug("<u>POST DATA</u>", $_POST_DATA); debug("<u>FILE DATA</u><br>", $_FILE_DATA); exit; }
function ExecActions($action) { /*=============*/ Lib_myLog("action: ", $action); // On recupere la configuration issue de conf.php global $lang, $MSG, $secure; // On recupere tous les objet contenant les donnees global $data_in, $data_out, $data_srv, $session; // Initialization des variables global $message; switch ($action) { case "Admin_Utilisateurs": /*=============*/ Lib_myLog("Recuperation de la liste des utilisateurs de la base"); $data_out['tab_groupes'] = Groupes_chercher('*'); $data_out['liste_utilisateurs'] = Utilisateurs_chercher('*'); // On renseigne l'indicateur "code" pour piloter l'affichage du menu javascript $data_out['code'] = 'acces_client'; $data_out['page'] = 'acces.php'; break; case "Utilisateurs_ADD": $F5 = Lib_checkF5($session, $data_in['timestamp']); $continue = $F5 ? false : true; // On intialise une pseudo-transaction qui nous permettre de stocker tous les objets rajoutés à la base // pour pouvoir les supprimer si nécessaire $transaction = new Collection(); if ($continue) { $utilisateur = Utilisateur_recuperer($data_in['nom_utilisateur']); if ($continue && $utilisateur->id_utilisateur) { /*=============*/ Lib_myLog("Le code d'utilisateur existe deja"); $data_out['message_ko'] = 'Ce code utilisateur existe déjà'; $continue = false; } if ($continue) { /*=============*/ Lib_myLog("Creation nouvel objet Utilisateur"); $utilisateur = new Utilisateur(); $utilisateur->societe = $data_in['societe']; $utilisateur->nom_personne = $data_in['nom_personne']; $utilisateur->prenom_personne = $data_in['prenom_personne']; $utilisateur->email = $data_in['email']; $utilisateur->nom_utilisateur = $data_in['nom_utilisateur']; $utilisateur->nom_groupe = 'utilisateur'; $utilisateur->password = $data_in['password']; $utilisateur->nb_connect = 10; $utilisateur->etat = 'actif'; $id_utilisateur = $utilisateur->ADD(); /*=============*/ Lib_myLog("Creation d'un repertoire pour l'utilisateur"); mkdir("../../documents/{$id_utilisateur}"); chmod("../../documents/{$id_utilisateur}", 0705); // On créé un fichier d'index pour que personne ne puisse voir directement le contenu du répertoire $file = "../../documents/{$id_utilisateur}/index.php"; $index = fopen($file, "w"); fputs($index, "<?"); fputs($index, "header('HTTP/1.0 404 Not Found');"); fputs($index, "?>"); fclose($index); } } if ($continue) { $data_out['message_ok'] = "L'accés a bien été rajouté"; ExecActions('Admin_Utilisateurs'); } else { if ($F5) { /*=============*/ Lib_myLog("Tentative de F5!"); $data_out['message_ko'] = $MSG[$lang]['%%Erreur_Revalidation%%']; ExecActions('Admin_Utilisateurs'); } else { /*=============*/ Lib_myLog("Annulation de l'ajout suite a une erreur"); if (!isset($data_out['message_ko'])) { $data_out['message_ko'] = $MSG[$lang]['%%Erreur_Mysql%%']; } // On ré-affiche les données dans la page de saisie... $data_out = array_merge($data_out, $data_in); ExecActions('Admin_Utilisateurs'); } } break; case "Utilisateurs_UPD": /*=============*/ Lib_myLog("Mise a jour de l'utilisateur"); $utilisateur = Utilisateur_recuperer($data_in['id_utilisateur']); $utilisateur->societe = $data_in['societe']; $utilisateur->nom_personne = $data_in['nom_personne']; $utilisateur->prenom_personne = $data_in['prenom_personne']; $utilisateur->email = $data_in['email']; $utilisateur->nom_utilisateur = $data_in['nom_utilisateur']; $utilisateur->password = $data_in['password']; $utilisateur->UPD(); $data_out['message_ok'] = "L'utilisateur a bien été mis à jour"; ExecActions("Admin_Utilisateurs"); break; case "Utilisateurs_DEL": /*=============*/ Lib_myLog("Suppression de l'utilisateur avec l'identifiant " . $data_in['id_utilisateur'] . " de la base"); $utilisateur = Utilisateur_recuperer($data_in['id_utilisateur']); $utilisateur->DEL(); /*=============*/ Lib_myLog("Suppression du repertoire de l'utilisateur"); deldir("../../documents/" . $utilisateur->id_utilisateur); $data_out['message_ok'] = "L'utilisateur a bien été été supprimé"; ExecActions("Admin_Utilisateurs"); break; case "POPUP_Utilisateur_UPD": // Action utilisée pour la saisie semi-automatique et appelée par la fonction AJAX /*=============*/ Lib_myLog("Recuperation de l'utilisateur"); $data_out = Utilisateurs_chercher('', $data_in['id_utilisateur']); $data_out['tab_groupes'] = Groupes_chercher('*'); $data_out['page'] = 'acces_popup_utilisateur_upd.php'; break; case "Documents_Accueil": /*=============*/ Lib_myLog("Recuperation de l'arborescence"); $data_out['liste_fils'] = Docs_construire($data_in['id_utilisateur']); $utilisateur = Utilisateur_recuperer($data_in['id_utilisateur']); $data_out['nom_personne'] = $utilisateur->nom_personne; $data_out['prenom_personne'] = $utilisateur->prenom_personne; $data_out['id_utilisateur'] = $data_in['id_utilisateur']; // On positionne par défaut les id_pere et les id_grand_pere $data_out['id_pere'] = 0; $data_out['id_fils'] = 0; if (isset($data_in['id_doc'])) { /*=============*/ Lib_myLog("Recuperation de l'ascendance"); $doc = Doc_recuperer($data_in['id_doc']); /*=============*/ Lib_myLog("Famille: " . $doc->famille); $tab_famille = explode('-', $doc->famille); /*=============*/ Lib_myLog("Nb elements: " . count($tab_famille)); if (count($tab_famille) == 2) { $data_out['id_pere'] = $tab_famille[0]; } if (count($tab_famille) == 3) { $data_out['id_pere'] = $tab_famille[0]; $data_out['id_fils'] = $tab_famille[1]; } } // On renseigne l'indicateur "code" pour piloter l'affichage du menu javascript $data_out['code'] = 'acces_client'; $data_out['page'] = 'documents.php'; break; case "Element_Bouger": $tab_positions = explode("|", $data_in['tab_list']); $i = 1; foreach ($tab_positions as $position) { $projet = Doc_recuperer($position); $projet->ordre = $i; $projet->UPD(); $i++; } $data_out['message_ok'] = $MSG['fr']['%%arbo_UPD%%']; ExecActions('Documents_Accueil'); break; case "Element_DEL": /*=============*/ Lib_myLog("Recuperation de l'element"); $obj_element_initial = Doc_recuperer($data_in['id_doc']); $id_utilisateur = $obj_element_initial->id_utilisateur; $data_out['message_ok'] = "Le dossier a bien été supprimé"; if ($obj_element_initial->type_pere == 'document') { $url = $obj_element_initial->intitule_canonize; /*=============*/ Lib_myLog("Suppression physique du document"); unlink("../../documents/{$id_utilisateur}/{$url}"); $data_out['message_ok'] = "Le document a bien été supprimé"; } /*=============*/ Lib_myLog("Retablissement de l'ordre sans coupure"); $args_elements['famille'] = $obj_element_initial->famille; $args_elements['sup_ordre'] = $obj_element_initial->ordre; $args_elements['id_utilisateur'] = $obj_element_initial->id_utilisateur; $elements = Docs_chercher($args_elements); foreach ($elements as $element) { $obj_element = Doc_recuperer($element['id_doc']); $obj_element->ordre--; $obj_element->UPD(); } $obj_element_initial->DEL(); $data_in['id_utilisateur'] = $id_utilisateur; ExecActions('Documents_Accueil'); break; case "Categorie_ADD": $args_arbos['famille'] = ''; if ($data_in['id_pere'] != '') { /*=============*/ Lib_myLog("Il s'agit d'un ajout de sous-element !"); $arbo_pere = Doc_recuperer($data_in['id_pere']); $args_arbos['famille'] = $arbo_pere->famille . $arbo_pere->id_pere . '-'; } /*=============*/ Lib_myLog("On determine le nouvel ordre a attribuer au nouvel element"); $arbos = Docs_chercher($args_arbos); $ordre = count($arbos); $ordre++; /*=============*/ Lib_myLog("Rajout d'un nouvel element"); $arbo = new Doc(); $arbo->id_utilisateur = $data_in['id_utilisateur']; if ($data_in['id_pere'] != '') { $arbo->famille .= $arbo_pere->famille . $arbo_pere->id_pere . '-'; } $arbo->type_pere = 'arbo'; $arbo->ordre = $ordre; $arbo->etat = 'actif'; $arbo->intitule = $data_in['intitule']; $id_doc = $arbo->ADD(); // On positionne dans le "data_in" "id_doc" pour piloter l'affichage dans "Documents_Accueil" $data_in['id_doc'] = $id_doc; $data_out['message_ok'] = "Le dossier a bien été rajouté"; $arbo->id_pere = $id_doc; $arbo->UPD(); ExecActions('Documents_Accueil'); break; case "Categorie_UPD": /*=============*/ Lib_myLog("Modification de l'intitule d'un element"); $arbo = Doc_recuperer($data_in['id_doc']); $arbo->intitule = $data_in['intitule']; $arbo->UPD(); $data_out['message_ok'] = "Le nom du dossier a bien été modifié"; ExecActions('Documents_Accueil'); break; case "AJAX_RechercherSousCategories": $data_out['liste_sous_categories'] = array(); /*=============*/ Lib_myLog("Recuperation du pere"); $arbo_pere = Doc_recuperer($data_in['id_pere']); $args_sous['type_pere'] = 'arbo'; $args_sous['famille'] = $arbo_pere->famille . $arbo_pere->id_pere . '-'; $data_out['liste_sous_categories'] = Docs_chercher($args_sous); $cle = 'ordre'; $val = usort($data_out['liste_sous_categories'], "Lib_compareUp"); $data_out['page'] = 'ajax_sous_categories.php'; break; case "Fichier_ADD": // DEBUT UBR // Je déclare en global les variables suivante intialisées lors du chargement des bibliothèques UBR global $TEMP_DIR, $_INI; //Declare local values $_XML_DATA = array(); // Array of xml data read from the upload_id.redirect file $_CONFIG_DATA = array(); // Array of config data read from the $_XML_DATA array $_POST_DATA = array(); // Array of posted data read from the $_XML_DATA array $_FILE_DATA = array(); // Array of 'FileInfo' objects read from the $_XML_DATA array $_FILE_DATA_TABLE = ''; // String used to store file info results nested between <tr> tags $_FILE_DATA_EMAIL = ''; // String used to store file info results $xml_parser = new XML_Parser(); // XML parser $xml_parser->setXMLFile($TEMP_DIR, $_GET['upload_id']); // Set upload_id.redirect file $xml_parser->setXMLFileDelete($_INI['delete_redirect_file']); // Delete upload_id.redirect file when finished parsing $xml_parser->parseFeed(); // Parse upload_id.redirect file // Display message if the XML parser encountered an error if ($xml_parser->getError()) { kak($xml_parser->getErrorMsg(), 1, __LINE__, $_INI['path_to_css_file']); } $_XML_DATA = $xml_parser->getXMLData(); // Get xml data from the xml parser $_CONFIG_DATA = getConfigData($_XML_DATA); // Get config data from the xml data $_POST_DATA = getPostData($_XML_DATA); // Get post data from the xml data $_FILE_DATA = getFileData($_XML_DATA); // Get file data from the xml data /*=============*/ Lib_myLog("UBR POST DATA :", $_POST_DATA); // On remet dans data_in les valeurs transmises par UBR foreach ($_POST_DATA as $key => $value) { $data_in[$key] = $value; } // On récupère les fichiers téléchargés for ($i = 0; $i < count($_FILE_DATA); $i++) { $file_slot = $_FILE_DATA[$i]->getFileInfo('slot'); $file_name = $_FILE_DATA[$i]->getFileInfo('name'); $file_size = $_FILE_DATA[$i]->getFileInfo('size'); $file_type = $_FILE_DATA[$i]->getFileInfo('type'); $file_status = $_FILE_DATA[$i]->getFileInfo('status'); $file_status_desc = $_FILE_DATA[$i]->getFileInfo('status_desc'); /*=============*/ Lib_myLog("UBR Fichier telecharge : file_slot: {$file_slot}, file_name: {$file_name}, file_size: {$file_size}, file_type: {$file_type}, file_status: {$file_status}, file_status_desc: {$file_status_desc}"); } // FIN UBR $F5 = Lib_checkF5($session, $data_in['timestamp']); $continue = $F5 ? false : true; if ($continue) { $args_arbos['famille'] = ''; if ($data_in['id_pere'] != 0) { $arbo = Doc_recuperer($data_in['id_pere']); $args_arbos['famille'] = $arbo->famille . $arbo->id_pere . '-'; $args_arbo['id_doc'] = $data_in['id_pere']; $id_categorie = $data_in['id_pere']; } // Si l'id_fils est positionné, il "surclasse" l'id_pere! if (isset($data_in['id_fils']) && $data_in['id_fils'] != 0) { $arbo = Doc_recuperer($data_in['id_fils']); $args_arbos['famille'] = $arbo->famille . $arbo->id_pere . '-'; $args_arbo['id_doc'] = $data_in['id_fils']; } /*=============*/ Lib_myLog("On determine le nouvel ordre a attribuer au nouvel element dans l'arbo"); $arbos = Docs_chercher($args_arbos); $ordre = count($arbos); $ordre++; /*=============*/ Lib_myLog("On recupere le dossier dont va dependre le document"); $arbo = Docs_chercher($args_arbo); if ($continue && $file_name != '') { /*=============*/ Lib_myLog("Recuperation du fichier"); $nom_fichier = Lib_nettoie($file_name); /*=============*/ Lib_myLog("Nom du fichier : {$nom_fichier}"); // On rajoute le document à ce niveau pour disposer de l'id_doc et le mettre dans le nom du document /*=============*/ Lib_myLog("Rajout du document dans l'arbo"); $new_arbo = new Doc(); $new_arbo->id_utilisateur = $data_in['id_utilisateur']; $new_arbo->famille .= $arbo['famille'] . $arbo['id_pere'] . '-'; $new_arbo->type_pere = 'document'; $new_arbo->ordre = $ordre; $new_arbo->etat = 'actif'; $new_arbo->intitule = $data_in['intitule']; $new_arbo->intitule_canonize = $nom_fichier; $id_doc = $new_arbo->ADD(); $data_in['id_doc'] = $id_doc; $nom_fichier = $id_doc . '_' . $nom_fichier; $doc = Doc_recuperer($id_doc); $doc->intitule_canonize = $nom_fichier; $doc->UPD(); // On met le fichier récupéré avec UBR au bon endroit rename("../ubr/ubr_uploads/{$file_name}", "../../documents/{$data_in['id_utilisateur']}/{$nom_fichier}"); $data_out['message_ok'] = "Le document a bien été rajouté"; } } if ($continue) { ExecActions('Documents_Accueil'); } else { if ($F5) { /*=============*/ Lib_myLog("Tentative de F5!"); $data_out['message_ko'] = $MSG[$lang]['%%Erreur_Revalidation%%']; ExecActions('Documents_Accueil'); } else { ExecActions('Documents_Accueil'); } } break; case "Fichier_UPD": /*=============*/ Lib_myLog("Modification de l'intitule du fichier"); $arbo = Doc_recuperer($data_in['id_doc']); $arbo->intitule = $data_in['intitule']; $arbo->UPD(); $data_out['message_ok'] = "La description du document a bien été modifiée"; ExecActions('Documents_Accueil'); break; case "Fichier_Download": $doc = Doc_recuperer($data_in['id_doc']); $nom_fichier = $doc->intitule_canonize; $file = "../../documents/" . $doc->id_utilisateur . "/" . $doc->intitule_canonize; $size = filesize($file); header("Content-Type: application/octet-stream"); header("Content-Length: {$size}"); header("Content-Disposition: attachment; filename={$nom_fichier}"); header("Content-Transfer-Encoding: binary"); $fh = fopen("{$file}", "r"); fpassthru($fh); break; default: ExecActions('Admin_Utilisateurs'); break; } }