protected function populateThemeQuery($where, $args) { $db = Loader::db(); $row = $db->GetRow("select ptID, ptHandle, ptDescription, pkgID, ptName from PageThemes where {$where}", $args); if ($row['ptID']) { $pl = new PageTheme; $pl->setPropertiesFromArray($row); $pkgHandle = $pl->getPackageHandle(); if ($row['pkgID'] > 0) { if (is_dir(DIR_PACKAGES . '/' . $pkgHandle)) { $pl->ptDirectory = DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_THEMES . '/' . $row['ptHandle']; $url = BASE_URL . DIR_REL; } else { $pl->ptDirectory = DIR_PACKAGES_CORE . '/' . $pkgHandle . '/' . DIRNAME_THEMES . '/' . $row['ptHandle']; $url = ASSETS_URL; } $pl->ptURL = $url . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_THEMES . '/' . $row['ptHandle']; } else if (is_dir(DIR_FILES_THEMES . '/' . $row['ptHandle'])) { $pl->ptDirectory = DIR_FILES_THEMES . '/' . $row['ptHandle']; $pl->ptURL = BASE_URL . DIR_REL . '/' . DIRNAME_THEMES . '/' . $row['ptHandle']; } else { $pl->ptDirectory = DIR_FILES_THEMES_CORE . '/' . $row['ptHandle']; $pl->ptURL = ASSETS_URL . '/' . DIRNAME_THEMES . '/' . $row['ptHandle']; } return $pl; } }