if (!defined('P4A_APPLICATION_LIBRARIES_PATH')) { define('P4A_APPLICATION_LIBRARIES_PATH', P4A_APPLICATION_PATH . '/libraries/'); } if (!defined('P4A_APPLICATION_LIBRARIES_DIR')) { define('P4A_APPLICATION_LIBRARIES_DIR', P4A_SERVER_DIR . P4A_APPLICATION_LIBRARIES_PATH); } if (!defined('P4A_APPLICATION_LIBRARIES_URL')) { define('P4A_APPLICATION_LIBRARIES_URL', P4A_SERVER_URL . P4A_APPLICATION_LIBRARIES_PATH); } //Uploads constants if (!defined('P4A_UPLOADS_PATH')) { define('P4A_UPLOADS_PATH', P4A_APPLICATION_PATH . '/uploads'); } if (!defined('P4A_UPLOADS_DIR')) { if (P4A_OS == 'windows') { define('P4A_UPLOADS_DIR', P4A_Strip_Double_Backslashes(P4A_SERVER_DIR . str_replace('/', '\\', P4A_UPLOADS_PATH))); } else { define('P4A_UPLOADS_DIR', P4A_Strip_Double_Slashes(P4A_SERVER_DIR . P4A_UPLOADS_PATH)); } } if (!defined('P4A_UPLOADS_URL')) { define('P4A_UPLOADS_URL', P4A_UPLOADS_PATH); } //Temporary uploads constants define('P4A_UPLOADS_TMP_NAME', 'tmp'); define('P4A_UPLOADS_TMP_PATH', P4A_UPLOADS_PATH . '/' . P4A_UPLOADS_TMP_NAME); define('P4A_UPLOADS_TMP_DIR', P4A_SERVER_DIR . P4A_UPLOADS_TMP_PATH); define('P4A_UPLOADS_TMP_URL', P4A_SERVER_URL . P4A_UPLOADS_TMP_PATH); //Current theme configuration if (!defined('P4A_THEME_NAME')) { define('P4A_THEME_NAME', 'default');
function P4A_Strip_Double_Backslashes($string) { $string = str_replace('\\\\', '\\', $string); if (strpos($string, '\\\\') !== false) { $string = P4A_Strip_Double_Backslashes($string); } return $string; }
private function _getAsString($base_dir) { $return = "<ul class='p4a_dir_navigator'>"; $current = $this->base_dir . _DS_ . $this->current_subdir; foreach (scandir($base_dir) as $dir) { $absolute_dir = $base_dir . _DS_ . $dir; if (!is_dir($absolute_dir) or $absolute_dir == P4A_UPLOADS_TMP_DIR or substr($dir, 0, 1) == '.' or $dir == 'CVS') { continue; } $handler_return = $this->actionHandler('beforeRenderElement', $absolute_dir); if ($handler_return === ABORT) { continue; } if (!is_string($handler_return)) { $handler_return = ""; } if (P4A_OS == "linux") { $actions = $this->composeStringActions(str_replace(P4A_Strip_Double_Slashes("{$this->base_dir}/"), "", P4A_Strip_Double_Slashes($absolute_dir))); } else { $actions = $this->composeStringActions(str_replace(P4A_Strip_Double_Backslashes("{$this->base_dir}\\"), "", P4A_Strip_Double_Backslashes($absolute_dir))); } $description = $this->_trim($dir); if ($absolute_dir == $current) { $selected = "class='active_node {$handler_return}'"; if ($this->enable_selected_element) { $link_prefix = "<a href='#' {$actions}>"; $link_suffix = "</a>"; } else { $link_prefix = "<span>"; $link_suffix = "</span>"; } } else { $selected = "class='{$handler_return}'"; $link_prefix = "<a href='#' {$actions}>"; $link_suffix = "</a>"; } $return .= "<li {$selected}>{$link_prefix}{$description}{$link_suffix}\n"; if (strpos($current, $absolute_dir) !== false) { $return .= $this->_getAsString($absolute_dir); } $return .= "</li>\n"; } $return .= "</ul>"; return $return; }