예제 #1
0
function getIblockProps($value, $propData, $arSize = array("WIDTH" => 90, "HEIGHT" => 90), $orderId = 0)
{
    $res = array();
    if ($propData["MULTIPLE"] == "Y") {
        $arVal = array();
        if (!is_array($value)) {
            if (strpos($value, ",") !== false) {
                $arVal = explode(",", $value);
            } else {
                $arVal[] = $value;
            }
        } else {
            $arVal = $value;
        }
        if (count($arVal) > 0) {
            foreach ($arVal as $key => $val) {
                if ($propData["PROPERTY_TYPE"] == "F") {
                    $res[] = getFileData(trim($val), $orderId, $arSize);
                } else {
                    $res[] = array("type" => "value", "value" => $val);
                }
            }
        }
    } else {
        if ($propData["PROPERTY_TYPE"] == "F") {
            $res[] = getFileData($value, $orderId, $arSize);
        } else {
            $res[] = array("type" => "value", "value" => $value);
        }
    }
    return $res;
}
예제 #2
0
// 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);
    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
예제 #3
0
$_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 !!! ***
function insertBookLoansData()
{
    include 'config.php';
    $fileContent = getFileData('data/book_loans_data_F14.csv');
    $tableData = explode(chr(10), $fileContent);
    for ($i = 1; $i < sizeof($tableData); $i++) {
        $tableData1 = explode(chr(9), $tableData[$i]);
        if ($tableData1[0] != "") {
            $query = "INSERT INTO BOOK_LOANS(Loan_id, Book_id, Branch_id, Card_no, Date_out, Due_date, Date_in) VALUES (" . "\"" . $tableData1[0] . "\",\"" . $tableData1[1] . "\",\"" . $tableData1[2] . "\",\"" . $tableData1[3] . "\",\"" . $tableData1[4] . "\",\"" . $tableData1[5] . "\",\"" . $tableData1[6] . "\")";
            if (!mysqli_query($con, $query)) {
                echo "Error inserting data(" . $query . ")" . mysqli_error($con);
            }
        }
    }
}
예제 #5
0
        echo "Valid";
    }
    exit;
}
//Functions
function storeFile()
{
    move_uploaded_file($_FILES["file"]["name"], "uploads");
    echo "<script type='text/javascript'>alert('Uploading: " . $_FILES['file']['name'] . "');</script><br />";
    //Check that it is in the uploads folder
    if (file_exists($uploadPath . $_FILES["file"]["name"])) {
        echo $_FILES["file"]["name"];
        echo "<script type='text/javascript'>alert('" . $_FILES['file']['name'] . " was uploaded');</script><br />";
    } else {
        echo "<script type='text/javascript'>alert('ERROR');</script><br />";
    }
}
function getFileData($filename)
{
    $chosenFile = $_FILES['file']['name'];
    $fileContent = file_get_contents($chosenFile);
    $jsonString = json_encode($fileContent);
    echo $jsonString;
}
//Run Upon Submit
if (array_key_exists('file', $_GET) && array_key_exists('chartType', $_GET)) {
    $fileName = escape_html($_GET['file']);
    $chartType = escape_html($_GET['chartType']);
    storeFile();
    getFileData($fileName);
}
예제 #6
0
 public function insert()
 {
     try {
         $qry = "INSERT INTO " . $this->table . " (";
         $first = true;
         foreach ($this->columns as $col) {
             if ($col['bind']) {
                 if ($first) {
                     $first = false;
                 } else {
                     $qry = $qry . ", ";
                 }
                 $qry = $qry . $col['name'];
             }
         }
         $qry = $qry . ", metacreateddate, metacreateduserid, metamodifieddate, metamodifieduserid) VALUES (";
         $first = true;
         foreach ($this->columns as $col) {
             if ($col['bind']) {
                 if ($first) {
                     $first = false;
                 } else {
                     $qry = $qry . ", ";
                 }
                 if ($col['type'] == "IMAGE") {
                     $qry = $qry . "'" . getImageData($col['name']) . "'";
                 } else {
                     if ($col['type'] == "FILE") {
                         $qry = $qry . "'" . getFileData($col['name']) . "'";
                     } else {
                         if ($col['type'] == "PASSWORD") {
                             $qry = $qry . "'" . md5($_POST[$col['name']]) . "'";
                         } else {
                             if ($col['type'] == "CHECKBOX") {
                                 $qry = $qry . (isset($_POST[$col['name']]) ? $_POST[$col['name']] == "on" ? 1 : 0 : 0);
                             } else {
                                 if (isset($_POST[$col['name']])) {
                                     if ($col['datatype'] == "timestamp" || $col['datatype'] == "") {
                                         $mysql_date = convertStringToDate($_POST[$col['name']]);
                                         $mysql_time = $_POST[$col['name'] . "_time"];
                                         $qry = $qry . "'" . mysql_escape_string($mysql_date) . " {$mysql_time}'";
                                     } else {
                                         if ($col['datatype'] == "date") {
                                             $mysql_date = convertStringToDate($_POST[$col['name']]);
                                             $qry = $qry . "'" . mysql_escape_string($mysql_date) . "'";
                                         } else {
                                             $qry = $qry . "'" . mysql_escape_string($_POST[$col['name']]) . "'";
                                         }
                                     }
                                 } else {
                                     if ($col['default'] == "TODAY") {
                                         $qry = $qry . "NOW()";
                                     } else {
                                         if ($col['default'] == "USER") {
                                             $qry = $qry . getLoggedOnMemberID();
                                         } else {
                                             $qry = $qry . "'" . mysql_escape_string($col['default']) . "'";
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $memberid = getLoggedOnMemberID();
         $qry = $qry . ", NOW(), {$memberid}, NOW(), {$memberid})";
         $result = mysql_query($qry);
         if (!$result) {
             logError($qry . " = " . mysql_error());
         }
         $this->postInsertEvent();
     } catch (Exception $e) {
         $this->errorDescriptions[] = $e->getMessage();
     }
 }
예제 #7
0
    /**
     * 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);
	}
    if ($current['id'] == $productTypePrintAreaId) {
        $printArea = $current;
    }
}
// calculate pixel to mm using print type dpi
$dpi = doubleval($printType->dpi);
$designWidth = doubleval($design->size->width) * 25.4 / $dpi;
$designHeight = doubleval($design->size->height) * 25.4 / $dpi;
$scaleFactor = 1.0;
if ($designWidth > $printArea->boundary->size->width) {
    $scaleFactor = $printArea->boundary->size->width / $designWidth;
}
$designWidth = $designWidth * $scaleFactor;
$designHeight = $designHeight * $scaleFactor;
echo $scaleFactor . ' ' . $designWidth . ' ' . $designHeight;
$product = new SimpleXMLElement(getFileData("product.xml"));
$product->productType['id'] = $productTypeId;
$product->appearance['id'] = $productTypeAppearanceId;
$configuration = $product->configurations->configuration;
$configuration->printArea['id'] = $productTypePrintAreaId;
$configuration->printType['id'] = $printTypeId;
$configuration->offset->x = (doubleval($printArea->boundary->size->width) - doubleval($designWidth)) / 2;
$configuration->offset->y = (doubleval($printArea->boundary->size->height) - doubleval($designHeight)) / 4;
$image = $product->configurations->configuration->content->svg->image;
$image['width'] = $designWidth;
$image['height'] = $designHeight;
$image['designId'] = 'u' . $design['id'];
$image['printColorIds'] = $printColorIds;
// 9. Create product
$attributes = $shop->products->attributes($namespaces['xlink']);
$productsUrl = $attributes->href;
예제 #9
0
	function actionFinish(&$system, $args)
	{
		global $abspath, $db_prefix, $root_id, $anonymous_id;
		$db_prefix = $this->db['prefix'];
		
		if (empty($args['theme']))
		{
			$system->addAlert("You must enter select a theme");
			return;
		}
		
		if (empty($args['imgsize']))
		{
			$system->addAlert("You must enter a imagesize");
			return;
		}
		
		if (empty($args['thumbsize']))
		{
			$system->addAlert("You must enter a thumbnailsize");
			return;
		}
		
		if (empty($args['default_lang']))
		{
			$system->addAlert("You must enter a default language");
			return;
		}
		
		if (empty($args['default_path']))
		{
			$system->addAlert("You must enter a default path");
			return;
		}
		
		if (empty($args['password']))
		{
			$system->addAlert("You must enter a password");
			return;
		}
		
		unset($args['action']);
		$this->config = $args;
		
		
		$logtext = "";
			
		if (!$db_conn = mysql_pconnect($this->db['adress'], $this->db['username'], $this->db['password']))
		{
			$system->addAlert("Error connecting to MySQL: " . mysql_errno() . " " . mysql_error());
			return;
		}
			
		if (!mysql_select_db($this->db['name']))
		{
			if (mysql_query("CREATE DATABASE `".$this->db['name']."`"))
				$logtext .= "Database ".$this->db['name']." created.<br/>";
			else
			{
				$system->addAlert("Failed to create database ".$this->db['name'].". Error: " . mysql_errno() . " " . mysql_error());
				return;
			}
		}

		mysql_select_db($this->db['name']);
		
		$files = GetSubfiles("$abspath/scripts/install/db");
		foreach ($files as $file)
		{
			$query = "DROP TABLE IF EXISTS `".$this->db['prefix'].basename($file, ".sql")."`";
			mysql_query($query);
		
			$query = str_replace("%PREFIX%", $this->db['prefix'], implode("", file("$abspath/scripts/install/db/$file")));
			
			if (mysql_query($query))
				$logtext .= "Imported $file successfully.<br/>";
			else
			{
				$system->addAlert("Failed to import $file. Error: " . mysql_errno() . " " . mysql_error()."\n$query");
				return;
			}
		}
		
		$xml = new mXml();
		
		$files = GetSubfiles("$abspath/scripts/install/classes");
		foreach ($files as $file)
		{
			$filedata = getFileData($file, "$abspath/scripts/install/classes/$file");
			$msgid = $xml->parseXML(array("node_id" => 0, "data" => $filedata));
			
			$logtext .= mMsg::getText($msgid);
			
			if (mMsg::isError($msgid))
			{
				$system->addAlert(mMsg::getError($msgid));
				return;
			}
			else
				$logtext .= "Imported $file successfully.<br/>";
		}

		$files = GetSubfiles("$abspath/scripts/install/objects");
		foreach ($files as $file)
		{
			$filedata = getFileData($file, "$abspath/scripts/install/objects/$file");
			$msgid = $xml->parseXML(array("node_id" => 0, "data" => $filedata));
			
			$logtext .= mMsg::getText($msgid);
			
			if (mMsg::isError($msgid))
			{
				$system->addAlert(mMsg::getError($msgid));
				return;
			}
			else
				$logtext .= "Imported $file successfully.<br/>";
		}
		
		$root_id = 1;
		
		$admin_group_id = createGroup("admins", "Administrators group", true);
		$anon_group_id = createGroup("anonymous", "Anonymous group", false);
		
		$anon_user_id = createUserSimple("Anonymous", "anonymous", "", "", "anonymous", false);
		$anonymous_id = $anon_user_id;
		$admin_user_id = createUserSimple("Administrator", "admin", $this->config['password'], "", "admins", true);
		
		
		$files = GetSubfiles("$abspath/cache");
		foreach ($files as $file)
			unlink("$abspath/cache/$file");
			
		$files = GetSubfiles("$abspath/files");
		foreach ($files as $file)
			unlink("$abspath/files/$file");
			
		$files = GetSubfiles("$abspath/thumbnails");
		foreach ($files as $file)
			unlink("$abspath/thumbnails/$file");
		
		// Insert initial objects
/*
		$root_obj = new mObject();
		$root_obj->setClassName("folder");
		$root_obj->loadVars();
		$root_obj->setLanguage("eng");
		$root_obj->setName("root");
		$root_obj->setIcon("murrix");
		$root_obj->setRights("all=r");
		
		$root_obj->setVarValue("description", "This is the root node");

		if ($root_obj->save())
		{
			$root_obj->setMeta("initial_rights", "admins=rwc");
			$logtext .= "Created ".$root_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$root_obj->getName().".<br/>";
			$logtext .= $root_obj->error;
			$this->done = false;
		}

		$home_obj = new mObject();
		$home_obj->setClassName("folder");
		$home_obj->loadVars();
		$home_obj->setLanguage("eng");
		$home_obj->setName("home");
		$home_obj->setIcon("home");
		$home_obj->setRights("all=r");

		$home_obj->setVarValue("description", "This folder contain home folders");
		
		if ($home_obj->save())
		{
			$home_obj->linkWithNode($root_obj->getNodeId());
			$logtext .= "Created ".$home_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$home_obj->getName().".<br/>";
			$logtext .= $home_obj->error;
			$this->done = false;
		}
		
		$users_home_obj = new mObject();
		$users_home_obj->setClassName("folder");
		$users_home_obj->loadVars();
		$users_home_obj->setLanguage("eng");
		$users_home_obj->setName("users");
		$users_home_obj->setIcon("user");
		$users_home_obj->setRights("all=r");

		$users_home_obj->setVarValue("description", "This folder contain home folders");
		
		if ($users_home_obj->save())
		{
			$users_home_obj->linkWithNode($home_obj->getNodeId());
			$logtext .= "Created ".$users_home_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$users_home_obj->getName().".<br/>";
			$logtext .= $users_home_obj->error;
			$this->done = false;
		}
		
		$group_home_obj = new mObject();
		$group_home_obj->setClassName("folder");
		$group_home_obj->loadVars();
		$group_home_obj->setLanguage("eng");
		$group_home_obj->setName("groups");
		$group_home_obj->setIcon("group2");
		$group_home_obj->setRights("all=r");

		$users_home_obj->setVarValue("description", "This folder contain group folders");
		
		if ($group_home_obj->save())
		{
			$group_home_obj->linkWithNode($home_obj->getNodeId());
			$logtext .= "Created ".$group_home_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$group_home_obj->getName().".<br/>";
			$logtext .= $group_home_obj->error;
			$this->done = false;
		}
		
		$adminhome_obj = new mObject();
		$adminhome_obj->setClassName("folder");
		$adminhome_obj->loadVars();
		$adminhome_obj->setLanguage("eng");
		$adminhome_obj->setName($this->admin_username);
		$adminhome_obj->setRights("admins=rwc");

		$adminhome_obj->setVarValue("description", "This is the home for ".$this->admin_username);
		
		if ($adminhome_obj->save())
		{
			$adminhome_obj->linkWithNode($users_home_obj->getNodeId());
			$logtext .= "Created ".$adminhome_obj->getName().".<br/>";
			
			$administrator->home_id = $adminhome_obj->getNodeId();
			$administrator->save();
		}
		else
		{
			$logtext .= "Failed to create ".$adminhome_obj->getName().".<br/>";
			$logtext .= $adminhome_obj->error;
			$this->done = false;
		}
		
		$adminshome_obj = new mObject();
		$adminshome_obj->setClassName("folder");
		$adminshome_obj->loadVars();
		$adminshome_obj->setLanguage("eng");
		$adminshome_obj->setName("admins");
		$adminshome_obj->setRights("admins=rwc");

		$adminshome_obj->setVarValue("description", "This is the home for admins");
		
		if ($adminshome_obj->save())
		{
			$adminshome_obj->linkWithNode($group_home_obj->getNodeId());
			$logtext .= "Created ".$adminshome_obj->getName().".<br/>";
			
			$administrator_group->home_id = $adminshome_obj->getNodeId();
			$administrator_group->save();
		}
		else
		{
			$logtext .= "Failed to create ".$adminshome_obj->getName().".<br/>";
			$logtext .= $adminshome_obj->error;
			$this->done = false;
		}
		
		$public_obj = new mObject();
		$public_obj->setClassName("folder");
		$public_obj->loadVars();
		$public_obj->setLanguage("eng");
		$public_obj->setName("public");
		$public_obj->setRights("all=r");

		$public_obj->setVarValue("description", "This folder is readable by anyone");
		
		if ($public_obj->save())
		{
			$public_obj->linkWithNode($root_obj->getNodeId());
			$logtext .= "Created ".$public_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$public_obj->getName().".<br/>";
			$logtext .= $public_obj->error;
			$this->done = false;
		}
		*/
		
		
		
		setSetting("ROOT_NODE_ID",	1,				"any");
		setSetting("ANONYMOUS_ID",	$anonymous->id,			"any");
		setSetting("TRANSPORT",		$this->config['transport'],	"any");
		setSetting("DEFAULT_THEME",	$this->config['theme'],		"any");
		
		setSetting("IMGSIZE",		$this->config['imgsize'],	$this->config['theme']);
		setSetting("THUMBSIZE",		$this->config['thumbsize'],	$this->config['theme']);
		setSetting("INSTANTTHUMBS",	$this->config['instantthumbs'],	$this->config['theme']);
		setSetting("DEFAULT_PATH",	$this->config['default_path'],	$this->config['theme']);
		setSetting("DEFAULT_LANG",	$this->config['default_lang'],	$this->config['theme']);

		$confdata = "<?\n";
		$confdata .= "\$mysql_address = \"".$this->db['adress']."\";\n";
		$confdata .= "\$mysql_user = \"".$this->db['username']."\";\n";
		$confdata .= "\$mysql_pass = \"".$this->db['password']."\";\n";
		$confdata .= "\$mysql_db = \"".$this->db['name']."\";\n";
		$confdata .= "\$db_prefix = \"".$this->db['prefix']."\";\n";
		$confdata .= "?>";

		if (is_writable($abspath))
		{
			$conffile = fopen("$abspath/config.inc.php", "w");
			fwrite($conffile, $confdata);
			fclose($conffile);
			chmod("$abspath/config.inc.php", 0600);
			$logtext .= "Wrote config, $abspath/config.inc.php.<br/>";
		}
		else
		{
			$logtext .= "Unable to write config file.<br/>";
			$logtext .= "Please put the folowing into \"config.inc.php\" and place it in MURRiXs rootpath:<br/>";
			$logtext .= "<br/>";
			$logtext .= nl2br(htmlentities($confdata));
			$logtext .= "<br/>";
		}
		
		$logtext .= "Installation complete!<br/>";
		
		
		$data = compiletpl("finish", array("logtext"=>$logtext));
		$system->setZoneData($this->zone, utf8e($data));
		
		$data = compiletpl("menu", array("action"=>"finish"));
		$system->setZoneData("zone_menu", utf8e($data));
	}
예제 #10
0
$dataUrl = parseHttpHeaders($result, "Location");
echo "Design URL: " . $dataUrl . "\n";
// 2. Fetch design data to retrieve upload url
$ch = curl_init($dataUrl);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$result = curl_exec($ch);
// Close the handle
curl_close($ch);
$start = strpos($result, "resource xlink:href=\"") + 21;
$end = strpos($result, "\"", $start);
$imageUrl = substr($result, $start, $end - $start);
echo "Image URL: " . $imageUrl . "\n";
// 3. Upload design data via image API
$imageData = getFileData("design.png");
$header = array();
$header[] = createSprdAuthHeader("PUT", $imageUrl);
$header[] = "Content-Type: image/png";
$ch = curl_init($imageUrl . "?method=PUT");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $imageData);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
function createSprdAuthHeader($method, $url)
{
    $apiKey = "...";
예제 #11
0
	function actionImport_xml(&$system, $args)
	{
		$object = new mObject($this->getNodeId($args));

		if ($object->getNodeId() == 0 || !$object->hasRight("write"))
		{
			$system->addAlert(ucf(i18n("you do not have enough rights")));
			return;
		}
	
		if (empty($args['file']))
		{
			$system->addAlert(ucf(i18n("you must upload a file to import")));
			return;
		}
		
		list($filename, $full_filename) = explode(":", $args['file']);
		$filedata = getFileData($filename, $full_filename);
		
		
		$logtext = "<strong>Beginning import from xml file</strong> - ".date("Y-m-d H:i:s")."<hr/>";
		
		$xml = new mXml();
		
		$msgid = $xml->parseXML(array("node_id" => $object->getNodeId(), "data" => $filedata));
		
		$logtext .= mMsg::getText($msgid);
		
		$logtext .= "<hr/><strong>Finished import</strong> - ".date("Y-m-d H:i:s")."<br/><br/>";
		
		$system->paddZoneData("zone_import_log", utf8e($logtext));
	}
예제 #12
0
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&eacute;j&agrave';
                    $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&eacute;s a bien &eacute;t&eacute; rajout&eacute;";
                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 &eacute;t&eacute; mis &agrave; 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 &eacute;t&eacute; &eacute;t&eacute; supprim&eacute;";
            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 &eacute;t&eacute; supprim&eacute;";
            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 &eacute;t&eacute supprim&eacute";
            }
            /*=============*/
            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 &eacute;t&eacute; rajout&eacute;";
            $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 &eacute;t&eacute; modifi&eacute;";
            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 &eacute;t&eacute; rajout&eacute;";
                }
            }
            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 &eacute;t&eacute; modifi&eacute;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;
    }
}
예제 #13
0
        }
        ?>

                <div class="project-details">
                    <?php 
        the_content();
        ?>
                </div>

            </section>

            <section class="entry-content row cf">

                <ul class="project-images cf">
                    <?php 
        if (!empty($projectId) && ($projectData = getFileData('project_' . $projectId . '.json'))) {
            ?>
                        <?php 
            foreach ($projectData as $project) {
                ?>
                            <li class="fourcol">
                                <a class="project-images-thumb" href="<?php 
                echo $project->images->hidpi;
                ?>
" title="<?php 
                echo $project->title;
                ?>
">
                                    <img class="hippify" src="<?php 
                echo $project->images->normal;
                ?>