Location: PHPKode > projects > Pindorama > pindorama/active/components/import.php
<?php
/**
*                                                          
* @name    Pindorama Core Configuration                    
* @version 0.1
* @author  Guilherme Capilé <hide@address.com>           
*                                                          
*/


/**
*                                                          
* @name        pin_import_upload_info
* @deprecated  
* @version     0.11
*
* @author      Guilherme Capilé <hide@address.com>
* 
* @global      $c
* @global      $arg
* @global      $param
* @global      $l
* @global      $a
* @global      $types
* @global      $lang
* @global      $mime
*
* @see         pin_make_request()
* @see         pin_output_dav()
* @see         pin_check_out()
* @see         pin_read_dir()
* @see         pin_multi_sort()
*
* @return      
*/
function pin_import_upload_info()
{
    global $c, $arg, $param, $l, $a, $types, $lang, $mime;
    $maxpages = 20;
    $page = 0;
    $user = $param["user"];
    $upload_files = pin_read_dir($c["data_dir"], "name modified");
    if (is_dir($upload_files)) {
        $upload_files = pin_multi_sort($upload_files, "modified");
    }
    $oldparam = $param;
    if (!is_array($upload_files)) {
        return false;
    }
    foreach($upload_files as $tmp) {
        $param = @unserialize(@file_get_contents($c["data_dir"].$tmp["name"]));
        $post = $param["post"];
        $get = array("id"=>$param["id"].".".$param["ref"].".".preg_replace("/[^0-9]/", "", $param["date"])."-".$param["remote-address"],"ref"=>$param["ref"]); 
        $uri = "/edit.dav?id={$get['id']}&ref={$get['ref']}";
        $files = $param["files"];
        $param["script-name"] = "/edit.dav";
        $param["dav-id"] = "ok";
        pin_make_request($uri, $user, $get, $post, $files);
        $xmlref = preg_replace("/[^a-z\_0-9\-\:\.\/]/", "_", $get["id"]);
        pin_output_dav($xmlref);
        pin_check_out($xmlref, $user);
        pin_check_out($xmlref, "");
        if ($param["update"]) {
            @unlink($c["data_dir"].$tmp["name"]);
        }
        $page++;
        if ($page >= $maxpages) {
            return false;
        }
    }
}

/**
*                                                          
* @name        pin_make_request
* @deprecated  
* @version     0.11
*
* @author      Guilherme Capilé <hide@address.com>
* 
* @param       $uri
* @param       $user
* @param       $get  (Default = "")
* @param       $post (Default = "")
* @param       $files (Default = "")
* 
* @global      $c
* @global      $arg
* @global      $param
* @global      $l
* @global      $a
* @global      $types
* @global      $lang
* @global      $mime
*
* @see         pin_xml_array()
* @see         pin_files_array()
*
*/
function pin_make_request($uri, $user, $get = "", $post = "", $files = "")
{
    global $arg, $param, $mime, $c, $a, $types, $lang;
    $self = preg_replace("/\.\.(\/?)/", "\\1", $self);
    $self = preg_replace("/[^a-z\.\:\@\~\^\_\-\+0-9\/]/i", "_", $self);
    $txt = $c["xmlpi"]."\n<request>";
    $txt = $txt."\n<request-uri>".htmlspecialchars($uri)."</request-uri>";
    $txt = $txt."\n<script-name>".$param["script-name"]."</script-name>";
    $txt = $txt."\n<auth-user>".htmlspecialchars($user)."</auth-user>";
    if (count($get) > 0) {
        $txt = $txt."\n<get>".pin_xml_array($get)."</get>";
    }
    if (count($post) > 0) {
        $txt = $txt."\n<post>".pin_xml_array($post, TRUE, TRUE)."</post>";
    }
    if (count($files) > 0) {
        $txt = $txt."\n<files>".pin_files_array($files)."</files>";
    }
    $txt = $txt."\n</request>";
    $arg["request"] = $txt;
    foreach($a as $k=>$v) {
        $arg[$k] = $c["xmlpi"]."<$k>".pin_xml_array($v, FALSE)."</$k>";
    }
    $param["script-name"] = $param["script-name"];
    $param["request-uri"] = $uri;
    $param["read-only"] = $c["read-only"]." ";
    $param["search-dir"] = $c["search_dir"];
    $param["data-dir"] = $c["data_dir"];
    $param["language"] = $c["language"];
    $param["host"] = $c["host"];
    $param["date"] = date("Y-m-d\TH:i:s");
    $param["base"] = $c["base_url"];
}

/**
*                                                          
* @name        pin_multi_sort
* @deprecated  
* @version     0.11
*
* @author      Guilherme Capilé <hide@address.com>
* 
* @param       $data
* @param       $sortby
* 
*
*/
function pin_multi_sort($data, $sortby){
   if(is_array($sortby)){
       $sortby = join(',',$sortby);
   }
   uasort($data, create_function('$a,$b','$skeys = split(\',\',\''.$sortby.'\');
       foreach($skeys as $key){
           if( ($c = strcasecmp($a[$key],$b[$key])) != 0 ){
               return($c);
           }
       }
       return($c); '));
}

?>
Return current item: Pindorama