Example #1
0
function CreateXmlHeader($command, $resourceType, $currentFolder)
{
    // Create the XML document header.
    echo '<?xml version="1.0" encoding="utf-8" ?>';
    // Create the main "Connector" node.
    echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">';
    // Add the current folder node.
    echo '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute(GetUrlFromPath($resourceType, $currentFolder)) . '" />';
}
Example #2
0
function CreateXmlHeader($command, $resourceType, $currentFolder)
{
    global $Config;
    SetXmlHeaders();
    // Create the XML document header.
    echo '<?xml version="1.0" encoding="utf-8" ?>';
    // Create the main "Connector" node.
    echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">';
    // Add the current folder node.
    $url = GetUrlFromPath($resourceType, $currentFolder, $command);
    $absurl = $Config['k_append_url'] . $url;
    echo '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute($url) . '" absurl="' . ConvertToXmlAttribute($absurl) . '" />';
    $GLOBALS['HeaderSent'] = true;
}
Example #3
0
function GetFoldersAndFiles($resourceType, $currentFolder)
{
    // Map the virtual path to the local server path.
    $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
    // Arrays that will hold the folders and files names.
    $aFolders = array();
    $aFiles = array();
    $oCurrentFolder = @opendir($sServerDir);
    if ($oCurrentFolder !== false) {
        while ($sFile = readdir($oCurrentFolder)) {
            if ($sFile != '.' && $sFile != '..') {
                if (is_dir($sServerDir . $sFile)) {
                    $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />';
                } else {
                    if (!preg_match("/.*(-\\d{1,}x\\d{1,})\\..*/", $sFile)) {
                        // skip thumbnails
                        $iFileSize = @filesize($sServerDir . $sFile);
                        if (!$iFileSize) {
                            $iFileSize = 0;
                        }
                        if ($iFileSize > 0) {
                            $iFileSize = round($iFileSize / 1024);
                            if ($iFileSize < 1) {
                                $iFileSize = 1;
                            }
                        }
                        $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
                    }
                }
            }
        }
        closedir($oCurrentFolder);
    }
    // Send the folders
    natcasesort($aFolders);
    echo '<Folders>';
    foreach ($aFolders as $sFolder) {
        echo $sFolder;
    }
    echo '</Folders>';
    // Send the files
    natcasesort($aFiles);
    echo '<Files>';
    foreach ($aFiles as $sFiles) {
        echo $sFiles;
    }
    echo '</Files>';
}
Example #4
0
function GetFoldersAndFiles($resourceType, $currentFolder)
{
    $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
    $aFolders = array();
    $aFiles = array();
    $oCurrentFolder = @opendir($sServerDir);
    if ($oCurrentFolder !== false) {
        while ($sFile = readdir($oCurrentFolder)) {
            if ($sFile != '.' && $sFile != '..') {
                if (is_dir($sServerDir . $sFile)) {
                    $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />';
                } else {
                    $iFileSize = @filesize($sServerDir . $sFile);
                    if (!$iFileSize) {
                        $iFileSize = 0;
                    }
                    if ($iFileSize > 0) {
                        $iFileSize = round($iFileSize / 1024);
                        if ($iFileSize < 1) {
                            $iFileSize = 1;
                        }
                    }
                    $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
                }
            }
        }
        closedir($oCurrentFolder);
    }
    natcasesort($aFolders);
    echo '<Folders>';
    foreach ($aFolders as $sFolder) {
        echo $sFolder;
    }
    echo '</Folders>';
    natcasesort($aFiles);
    echo '<Files>';
    foreach ($aFiles as $sFiles) {
        echo $sFiles;
    }
    echo '</Files>';
}
Example #5
0
function CreateFolder($resourceType, $currentFolder)
{
    $sErrorNumber = '0';
    $sErrorMsg = '';
    if (isset($_GET['NewFolderName'])) {
        $sNewFolderName = $_GET['NewFolderName'];
        // Map the virtual path to the local server path of the current folder.
        $sServerDir = ServerMapFolder($resourceType, $currentFolder);
        if (is_writable($sServerDir)) {
            $sServerDir .= $sNewFolderName;
            $sErrorMsg = CreateServerFolder($sServerDir);
            switch ($sErrorMsg) {
                case '':
                    $sErrorNumber = '0';
                    break;
                case 'Invalid argument':
                case 'No such file or directory':
                    $sErrorNumber = '102';
                    // Path too long.
                    break;
                default:
                    $sErrorNumber = '110';
                    break;
            }
        } else {
            $sErrorNumber = '103';
        }
    } else {
        $sErrorNumber = '102';
    }
    // Create the "Error" node.
    echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute($sErrorMsg) . '" />';
}
function CreateXmlHeader($command, $currentFolder)
{
    SetXmlHeaders();
    // Create the XML document header.
    echo '<?xml version="1.0" encoding="utf-8" ?>';
    // Create the main "Connector" node.
    echo '<Connector command="' . $command . '" resourceType="Image">';
    // Add the current folder node.
    echo '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute(FCK_UPLOAD_URL . $currentFolder) . '" />';
}
Example #7
0
function GetFoldersAndFiles($resourceType, $currentFolder)
{
    if (!isset($_GET)) {
        global $_GET;
    }
    global $Config;
    $isInternalLink = isset($_GET['DWFCK_Browser']) && $_GET['DWFCK_Browser'] == 'local' ? true : false;
    global $_FolderClass;
    global $Config;
    $currentFolder = encode_dir($currentFolder);
    $sess_id = session_id();
    if (!isset($sess_id) || $sess_id != $_COOKIE['FCK_NmSp_acl']) {
        session_id($_COOKIE['FCK_NmSp_acl']);
        session_start();
    }
    $acl_del = isset($_SESSION['dwfck_del']) ? $_SESSION['dwfck_del'] : 0;
    // Map the virtual path to the local server path.
    $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
    if ($Config['osWindows']) {
        $sServerDir = normalizeWIN($sServerDir);
    }
    mkdir_rek($sServerDir);
    // Arrays that will hold the folders and files names.
    $aFolders = array();
    $aFiles = array();
    $sFile = '__AAAAAAAA__.AAA';
    $temp_folder = $currentFolder;
    $temp_folder = dwiki_encodeFN(trim($temp_folder, '/'));
    has_permission($temp_folder, $resourceType);
    if ($isInternalLink && $_FolderClass < 16) {
        $sfclass = 'r';
    } else {
        if ($acl_del) {
            $sfclass = $_FolderClass >= 16 ? 'u' : 'r';
        } else {
            $sfclass = $_FolderClass >= 8 || has_open_access() ? 'u' : 'r';
        }
        can_delete($sfclass);
    }
    if (!$_FolderClass) {
        return;
    }
    $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" class="' . $sfclass . '" />';
    $sErrorNumber = 0;
    $sFolderPath = GetResourceTypeDirectory($resourceType, 'GetFoldersAndFiles');
    $absolute_path = $Config['UserFilesAbsolutePath'];
    $oCurrentFolder = @opendir($sServerDir);
    if ($oCurrentFolder !== false) {
        while ($sFile = readdir($oCurrentFolder)) {
            if ($sFile != '.' && $sFile != '..') {
                if (is_dir($sServerDir . $sFile)) {
                    if (has_permission(dwiki_encodeFN($currentFolder) . $sFile, $resourceType) || has_open_access()) {
                        if ($isInternalLink && $_FolderClass < 255) {
                            $class = 'r';
                        } else {
                            $class = $_FolderClass < 8 ? 'r' : 'u';
                            can_delete($class);
                        }
                        if ($_FolderClass) {
                            $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" class="' . $class . '" />';
                        }
                    }
                } else {
                    $iFileSize = @filesize($sServerDir . $sFile);
                    if (!$iFileSize) {
                        $iFileSize = 0;
                    }
                    if ($iFileSize > 0) {
                        $iFileSize = round($iFileSize / 1024);
                        if ($iFileSize < 1) {
                            $iFileSize = 1;
                        }
                    }
                    if ($isInternalLink) {
                        if (!preg_match('/\\.txt$/', $sFile)) {
                            continue;
                        }
                        if (has_permission(dwiki_encodeFN($currentFolder) . $sFile, $resourceType, false)) {
                            $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
                        }
                    } else {
                        if ($resourceType == 'Image') {
                            list($width, $height, $type, $attr) = getimagesize($sServerDir . $sFile);
                            if (isset($width) && isset($height)) {
                                $iFileSize .= ";;{$width};;{$height}";
                            }
                        }
                        $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
                    }
                }
            }
        }
        closedir($oCurrentFolder);
    }
    // Send the folders
    natcasesort($aFolders);
    echo '<Folders>';
    foreach ($aFolders as $sFolder) {
        echo $sFolder;
    }
    echo '</Folders>';
    // Send the files
    natcasesort($aFiles);
    echo '<Files>';
    foreach ($aFiles as $sFiles) {
        echo $sFiles;
    }
    echo '</Files>';
}
Example #8
0
function GetFoldersAndFiles($resourceType, $currentFolder)
{
    // Map the virtual path to the local server path.
    $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
    // Arrays that will hold the folders and files names.
    $aFolders = array();
    $aFiles = array();
    $oCurrentFolder = @opendir($sServerDir);
    $in_group = api_is_in_group();
    if ($currentFolder == '/shared_folder/' || $currentFolder == '/shared_folder_session_' . api_get_session_id() . '/') {
        $in_shared_folder = true;
    } else {
        $in_shared_folder = false;
    }
    $user_id = api_get_user_id();
    if ($oCurrentFolder !== false) {
        while ($sFile = readdir($oCurrentFolder)) {
            $is_dir = @is_dir($sServerDir . $sFile);
            if ($sFile != '.' && $sFile != '..' && strpos($sFile, '_DELETED_') === false && strpos($sFile, 'chat_files') === false && strpos($sFile, 'HotPotatoes_files') === false && ($in_group || !$in_group && strpos($sFile, '_groupdocs') === false) && (!$in_shared_folder || $in_shared_folder && (!$is_dir || $is_dir && $sFile == $user_id)) && $sFile != '.thumbs' && strpos($sFile, '.editor_') === false && $sFile != '.svn') {
                if ($is_dir) {
                    $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />';
                } else {
                    $iFileSize = @filesize($sServerDir . $sFile);
                    if (!$iFileSize) {
                        $iFileSize = 0;
                    }
                    if ($iFileSize > 0) {
                        $iFileSize = round($iFileSize / 1024);
                        if ($iFileSize < 1) {
                            $iFileSize = 1;
                        }
                    }
                    $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
                }
            }
        }
        closedir($oCurrentFolder);
    }
    // Send the folders
    natcasesort($aFolders);
    echo '<Folders>';
    foreach ($aFolders as $sFolder) {
        echo $sFolder;
    }
    echo '</Folders>';
    // Send the files
    natcasesort($aFiles);
    echo '<Files>';
    foreach ($aFiles as $sFiles) {
        echo $sFiles;
    }
    echo '</Files>';
}
Example #9
0
function GetFoldersAndFiles($resourceType, $currentFolder, $pagesize = '5')
{
    // Map the virtual path to the local server path.
    $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
    // Arrays that will hold the folders and files names.
    $aFolders = array();
    $aFiles = array();
    $oCurrentFolder = opendir($sServerDir);
    while ($sFile = readdir($oCurrentFolder)) {
        if ($sFile != '.' && $sFile != '..' && $sFile != 'Thumbs.db') {
            if (is_dir($sServerDir . $sFile)) {
                $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />';
            } else {
                $iFileSize = @filesize($sServerDir . $sFile);
                $iFileMtime = @filemtime($sServerDir . $sFile);
                if (!$iFileSize) {
                    $iFileSize = 0;
                }
                if ($iFileSize > 0) {
                    $iFileSize = round($iFileSize / 1024);
                    if ($iFileSize < 1) {
                        $iFileSize = 1;
                    }
                }
                $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
            }
        }
    }
    $p = $_GET['p'];
    if ($p < 1) {
        $p = 1;
    }
    // Send the folders
    natcasesort($aFolders);
    echo '<Folders>';
    foreach ($aFolders as $sFolder) {
        echo $sFolder;
    }
    echo '</Folders>';
    // Send the files
    natcasesort($aFiles);
    $an = count($aFiles);
    foreach ($aFiles as $key => $val) {
        $aFiles[$an - $key - 1] = $val;
    }
    echo '<Files>';
    //foreach ( $aFiles as $sFiles )
    //echo $sFiles ;
    for ($i = ($p - 1) * $pagesize; $i < $pagesize * $p; $i++) {
        echo $aFiles[$i];
    }
    echo '</Files>';
    echo '<npage>';
    echo $p;
    echo '</npage>';
    echo '<page>';
    echo ceil(count($aFiles) / $pagesize);
    echo '</page>';
    unset($aFolders);
    unset($aFiles);
}
Example #10
0
function GetFoldersAndFiles($resourceType, $currentFolder)
{
    dbConn();
    //$email = $_GET['e'];
    // Map the virtual path to the local server path.
    $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
    $f = fopen("log2.txt", "a");
    fwrite($f, "\r\nemail = {$currentFolder}\r\n");
    // Arrays that will hold the folders and files names.
    $aFolders = array();
    $aFiles = array();
    /*
    	$oCurrentFolder = @opendir( $sServerDir ) ;
    
    if($sFile = readdir( $oCurrentFolder ))
    {
        if ( is_dir( $sServerDir . $sFile ) )
        $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
        
    	}
    closedir( $oCurrentFolder );
    */
    // Arrays that will hold the folders and files names.
    $aFolders = array();
    $aFiles = array();
    $email = getEmailFCK();
    if ($email != "") {
        //$f = fopen("c*k.txt", "w");
        //fprintf($f, "$email");
    }
    $email = "*****@*****.**";
    $email = $_SESSION['em'];
    $email = $_GET['email'];
    //import_request_variables("c", "c_");
    $email = $c_conlivefck_cookie;
    $f = fopen("c*k.txt", "w");
    fprintf($f, "{$email}");
    $album_id = getAlbumId($email);
    $r = selectData("select * from user_imgs where user_email = '{$email}' and stat = 1 and album_id = {$album_id} ");
    foreach ($r as $file) {
        $fs = $file['file_size'];
        if ($fs > 1) {
            $fs = round($fs);
        } else {
            $fs = 1;
        }
        $aFiles[] = '<File name="' . ConvertToXmlAttribute($file['id']) . '" size="' . $fs . '" />';
    }
    // Send the folders
    natcasesort($aFolders);
    echo '<Folders>';
    foreach ($aFolders as $sFolder) {
        echo $sFolder;
    }
    echo '</Folders>';
    // Send the files
    natcasesort($aFiles);
    echo '<Files>';
    foreach ($aFiles as $sFiles) {
        echo $sFiles;
    }
    echo '</Files>';
}