if (!isset($_SESSION['ccuserid'])) { $_SESSION['ccuserid'] = 7; } if (!$_SESSION['ccuserid']) { echo getJSONError(array(1, "Not logged in")); } else { $arGroups = FTPFileGroupDB::retrieveForUserId($_SESSION["ccuserid"]); if ($arGroups != null) { $groupId = $arGroups[0]->getGroupId(); } if (!groupId) { echo getJSONError(array(3, "Group Id required")); } else { $arPathRecords = FTPPathDB::retrieveForGroupId($groupId); $arOut = array(); if ($arPathRecords != null) { foreach ($arPathRecords as $pathRecord) { $paths = explode(chr(13), $pathRecord->getPath()); foreach ($paths as $path) { $parts = explode(":", $path, 2); $name = preg_replace('/^.+\\/([^\\/]+)$/', '$1', $parts[1]); if (strlen($parts[1]) > 0) { array_push($arOut, array( "ftp_site_id" => $pathRecord->getFtpSiteId() ,"name" => $name ,"type" => $parts[0] ,"path" => $parts[1] ));