function getFolderDatasByPath($fid) { $fidarr = getTopFid($fid); $folderarr = array(); foreach ($fidarr as $fid) { $folderarr[$fid] = C::t('folder')->fetch_by_fid($fid); } return $folderarr; }
function getTopFid($fid, $i = 0, $arr = array()) { $arr[] = $fid; if ($i > 100) { return $arr; } else { $i++; } if ($pfid = DB::result_first("select pfid from " . DB::table('folder') . " where fid='{$fid}'")) { if ($pfid != $fid) { $arr = getTopFid($pfid, $i, $arr); } } return $arr; }