本文整理汇总了PHP中valid_folder函数的典型用法代码示例。如果您正苦于以下问题:PHP valid_folder函数的具体用法?PHP valid_folder怎么用?PHP valid_folder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了valid_folder函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateMenuStructure
private function generateMenuStructure()
{
$export_array[] = "----";
// Search for plugins and make sure they are registered
$raidexport_folder = $this->root_path . 'core/calendarexport/';
if ($dir = opendir($raidexport_folder)) {
while ($d_plugin_code = @readdir($dir)) {
$cwd = $raidexport_folder . $d_plugin_code;
// regenerate the link to the 'plugin'
if (@is_file($cwd) && valid_folder($d_plugin_code)) {
// check if valid
include $cwd;
$export_array[$rpexport_plugin[$d_plugin_code]['function']] = $rpexport_plugin[$d_plugin_code]['name'];
// add to array
}
}
}
// search for game export plugins
$raidexport_game = $this->root_path . 'games/' . $this->game->get_game() . '/raidexport/';
if (is_dir($raidexport_game) && ($dir = opendir($raidexport_game))) {
while ($d_plugin_code = @readdir($dir)) {
$cwd = $raidexport_game . $d_plugin_code;
// regenerate the link to the 'plugin'
if (@is_file($cwd) && valid_folder($d_plugin_code)) {
// check if valid
include $cwd;
$export_array[$rpexport_plugin[$d_plugin_code]['function']] = $rpexport_plugin[$d_plugin_code]['name'];
// add to array
}
}
}
return $export_array;
}
示例2: run
public function run()
{
if ($dir = @opendir($this->pfh->FolderPath('imageupload', 'eqdkp'))) {
while ($file = @readdir($dir)) {
if (is_file($this->pfh->FolderPath('imageupload', 'eqdkp') . $file) && valid_folder($file) && substr($file, 10, 2) == '__') {
$this->pfh->Delete('imageupload/' . $file, 'eqdkp');
}
}
}
}
示例3: scanGlobalHookFolder
private function scanGlobalHookFolder()
{
if ($dir = @opendir($this->root_path . 'core/hooks/')) {
while ($file = @readdir($dir)) {
if (is_file($this->root_path . 'core/hooks/' . $file) && valid_folder($file)) {
$path_parts = pathinfo($file);
$filename = str_replace("_hook", "", $path_parts['filename']);
$filename = str_replace(".class", "", $filename);
$strHook = substr($filename, strrpos($filename, '_') + 1);
$strClassname = str_replace(".class", "", $path_parts['filename']);
$strMethodname = $strHook;
$strClasspath = 'core/hooks';
$this->register($strHook, $strClassname, $strMethodname, $strClasspath);
}
}
}
}
示例4: myScandir
function myScandir(&$parentDir, $actual_dir)
{
global $pfh;
$scanDir = scandir($actual_dir);
for ($i = 0; $i < count($scanDir); $i++) {
if (!valid_folder($scanDir[$i]) || $scanDir[$i] == "thumbs") {
continue;
}
if (is_file($actual_dir . '/' . $scanDir[$i])) {
} elseif (is_dir($actual_dir . '/' . $scanDir[$i])) {
$dir = $scanDir[$i];
$parentDir[$dir] = str_replace($pfh->FolderPath('system', 'files'), "system", "{$actual_dir}*+*+*{$dir}");
myScandir($parentDir, "{$actual_dir}/{$dir}");
}
}
return true;
}
示例5: generateMenuStructure
private function generateMenuStructure()
{
$export_array[] = "----";
// Search for plugins and make sure they are registered
if ($dir = opendir($this->root_path . 'calendar/raidexport/plugins/')) {
while ($d_plugin_code = @readdir($dir)) {
$cwd = $this->root_path . 'calendar/raidexport/plugins/' . $d_plugin_code;
// regenerate the link to the 'plugin'
if (@is_file($cwd) && valid_folder($d_plugin_code)) {
// check if valid
include $cwd;
$export_array[$rpexport_plugin[$d_plugin_code]['function']] = $rpexport_plugin[$d_plugin_code]['name'];
// add to array
}
}
}
return $export_array;
}
示例6: deleteWatermarkImages
private function deleteWatermarkImages()
{
$strThumbfolder = $this->pfh->FolderPath('thumbs', 'mediacenter');
$arrFiles = scandir($strThumbfolder);
foreach ($arrFiles as $strFile) {
if (valid_folder($strFile)) {
if (strpos($strFile, 'wm_') === 0) {
$this->pfh->Delete($strThumbfolder . $strFile);
}
}
}
}
示例7: file_tree
private function file_tree($folder, $first_call = true)
{
if (!is_array($this->value)) {
$this->value = array($this->value);
}
// Get and sort directories/files
$file = scandir($folder);
natcasesort($file);
// Make directories first
$files = $dirs = array();
foreach ($file as $this_file) {
if (is_dir("{$folder}/{$this_file}")) {
$dirs[] = $this_file;
} elseif (!$this->dirsOnly && valid_folder($this_file)) {
$files[] = $this_file;
}
}
$file = array_merge($dirs, $files);
// Filter unwanted extensions
if (!empty($this->extensions)) {
foreach (array_keys($file) as $key) {
if (!is_dir("{$folder}/{$file[$key]}")) {
$ext = substr($file[$key], strrpos($file[$key], ".") + 1);
if (!in_array($ext, $this->extensions)) {
unset($file[$key]);
}
}
}
}
$dd_data = array();
if (count($file) > 2) {
// Use 2 instead of 0 to account for . and .. "directories"
$php_file_tree = "<ul";
//if( $first_call ) { $php_file_tree .= " class=\"file-tree-".$this->name."\""; $first_call = false; }
$php_file_tree .= ">";
foreach ($file as $this_file) {
if ($this_file != "." && $this_file != "..") {
if (is_dir("{$folder}/{$this_file}")) {
// Directory
$php_file_tree .= "<li class=\"pft-directory\"><i class=\"fa fa-lg fa-folder-o\"></i> " . ($this->inputBoxFormat == "checkbox" ? "<input type=\"checkbox\" name=\"" . $this->name . "[]\" value=\"" . str_replace("//", "/", $folder . "/" . $this_file) . "\"> " : '') . "<a href=\"javascript:void(0);\">" . sanitize($this_file) . "</a>";
$php_file_tree .= $this->file_tree("{$folder}/{$this_file}", false);
$php_file_tree .= "</li>";
$dd_data["{$folder}/{$this_file}"] = $this_file;
$bla = $this->file_tree(str_replace("//", "/", $folder . "/" . $this_file), false);
if (is_array($bla)) {
foreach ($bla as $key => $value) {
$dd_data[$key] = ' ' . $value;
}
}
$i++;
} else {
// File
// Get extension (prepend 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-" . substr($this_file, strrpos($this_file, ".") + 1);
$link = str_replace("[link]", "{$folder}/" . urlencode($this_file), $return_link);
$php_file_tree .= "<li class=\"pft-file " . strtolower($ext) . "\">" . ($this->inputBoxFormat == "checkbox" ? '<input type="checkbox" name="' . $this->name . '[]" value="' . str_replace("//", "/", $folder . "/" . $this_file) . '"> ' : '') . (true ? "<input type=\"radio\" name=\"" . $this->name . "\" value=\"" . str_replace("//", "/", $folder . "/" . $this_file) . "\"" . (in_array(str_replace("//", "/", $folder . "/" . $this_file), $this->value) ? ' checked="checked"' : '') . "> " : '') . "<a>" . sanitize($this_file) . "</a></li>";
}
}
}
$php_file_tree .= "</ul>";
}
return $php_file_tree;
}
示例8: get_all_modules
public function get_all_modules()
{
$this->pdh->process_hook_queue();
$modules = $this->pdh->aget('portal', 'path', 0, array($this->pdh->get('portal', 'id_list')));
foreach ($modules as $id => $path) {
if (!$this->get_module($path, $this->pdh->get('portal', 'plugin', array($id)))) {
continue;
}
$this->check_update($id, $path);
}
//EQDKP PORTAL MODULES
// Search for portal-modules and make sure they are registered
if ($dir = @opendir($this->root_path . 'portal/')) {
while ($d_plugin_code = @readdir($dir)) {
$cwd = $this->root_path . 'portal/' . $d_plugin_code;
if (valid_folder($cwd)) {
if (in_array($d_plugin_code, $modules)) {
continue;
} else {
$this->install($d_plugin_code);
}
}
unset($d_plugin_code, $cwd);
}
// readdir
}
// EQDKP PLUGIN PORTAL MODULES
foreach ($this->pm->get_plugins() as $plugin_code) {
$plug_modules = $this->pm->get_plugin($plugin_code)->get_portal_modules();
foreach ($plug_modules as $module_name) {
if (!in_array($module_name, $modules)) {
$this->install($module_name, $plugin_code);
}
}
}
$this->pdh->process_hook_queue();
return $this->objs;
}
示例9: display_form
public function display_form()
{
if ((int) $this->config->get('cmsbridge_active') == 1 && strlen($this->config->get('cmsbridge_reg_url'))) {
redirect($this->config->get('cmsbridge_reg_url'), false, true);
}
//Captcha
if ($this->config->get('enable_captcha') == 1) {
require $this->root_path . 'libraries/recaptcha/recaptcha.class.php';
$captcha = new recaptcha();
$this->tpl->assign_vars(array('CAPTCHA' => $captcha->get_html($this->config->get('lib_recaptcha_okey')), 'S_DISPLAY_CATPCHA' => true));
}
$language_array = array();
if ($dir = @opendir($this->root_path . 'language/')) {
while ($file = @readdir($dir)) {
if (!is_file($this->root_path . 'language/' . $file) && !is_link($this->root_path . 'language/' . $file) && valid_folder($file)) {
$language_array[$file] = ucfirst($file);
}
}
}
//User Profilefields
$arrUserProfileFields = $this->pdh->get('user_profilefields', 'registration_fields');
if (count($arrUserProfileFields)) {
$form = register('form', array('register'));
$form->validate = true;
$form->add_fields($arrUserProfileFields);
$form->output($this->userProfileData);
}
$this->tpl->assign_vars(array('S_CURRENT_PASSWORD' => false, 'S_NEW_PASSWORD' => false, 'S_SETTING_ADMIN' => false, 'S_MU_TABLE' => false, 'S_PROFILEFIELDS' => count($arrUserProfileFields) ? true : false, 'VALID_EMAIL_INFO' => $this->config->get('account_activation') == 1 ? '<br />' . $this->user->lang('valid_email_note') : '', 'AUTH_REGISTER_BUTTON' => ($arrRegisterButtons = $this->user->handle_login_functions('register_button')) ? implode(' ', $arrRegisterButtons) : '', 'REGISTER' => true, 'DD_LANGUAGE' => new hdropdown('user_lang', array('options' => $language_array, 'value' => $this->data['user_lang'])), 'DD_TIMEZONES' => new hdropdown('user_timezone', array('options' => $this->time->timezones, 'value' => $this->data['user_timezone'])), 'HIDDEN_FIELDS' => isset($this->data['auth_account']) ? new hhidden('lmethod', array('value' => $this->in->get('lmethod'))) . new hhidden('auth_account', array('value' => $this->crypt->encrypt($this->data['auth_account']))) : '', 'USERNAME' => $this->data['username'], 'USER_EMAIL' => $this->data['user_email'], 'USER_EMAIL2' => $this->data['user_email2']));
$this->core->set_vars(array('page_title' => $this->user->lang('register_title'), 'template_file' => 'register.html', 'display' => true));
}
示例10: get_available_bridges
public function get_available_bridges()
{
$bridges = array();
// Build auth array
if ($dir = @opendir($this->root_path . 'core/bridges/')) {
while ($file = @readdir($dir)) {
if (is_file($this->root_path . 'core/bridges/' . $file) && valid_folder($file)) {
include_once $this->root_path . 'core/bridges/' . $file;
$name = substr($file, 0, strpos($file, '.'));
$classname = $name . '_bridge';
$class = registry::register($classname);
$bridges[$name] = isset($class->name) ? $class->name : $name;
unset($class);
}
}
}
return $bridges;
}
示例11: display_form
public function display_form()
{
if ((int) $this->config->get('cmsbridge_reg_redirect') == 1 && (int) $this->config->get('cmsbridge_active') == 1) {
if (strlen($this->config->get('cmsbridge_reg_url')) > 1) {
redirect($this->config->get('cmsbridge_reg_url'), false, true);
} else {
redirect('index.php');
}
}
//Captcha
if ($this->config->get('pk_enable_captcha') == 1) {
require $this->root_path . 'libraries/recaptcha/recaptcha.class.php';
$captcha = new recaptcha();
$this->tpl->assign_vars(array('CAPTCHA' => $captcha->recaptcha_get_html($this->config->get('lib_recaptcha_okey')), 'S_DISPLAY_CATPCHA' => true));
}
$language_array = array();
if ($dir = @opendir($this->root_path . 'language/')) {
while ($file = @readdir($dir)) {
if (!is_file($this->root_path . 'language/' . $file) && !is_link($this->root_path . 'language/' . $file) && valid_folder($file)) {
$language_array[$file] = ucfirst($file);
}
}
}
$this->tpl->assign_vars(array('S_CURRENT_PASSWORD' => false, 'S_NEW_PASSWORD' => false, 'S_SETTING_ADMIN' => false, 'S_MU_TABLE' => false, 'VALID_EMAIL_INFO' => $this->config->get('account_activation') == 1 ? '<br />' . $this->user->lang('valid_email_note') : '', 'AUTH_REGISTER_BUTTON' => ($arrRegisterButtons = $this->user->handle_login_functions('register_button')) ? implode(' ', $arrRegisterButtons) : '', 'REGISTER' => true, 'DD_LANGUAGE' => $this->html->DropDown('user_lang', $language_array, $this->data['user_lang']), 'DD_TIMEZONES' => $this->html->DropDown('user_timezone', $this->time->timezones, $this->data['user_timezone']), 'HIDDEN_FIELDS' => isset($this->data['auth_account']) ? $this->html->TextField('lmethod', '', $this->in->get('lmethod'), 'hidden') . $this->html->TextField('auth_account', '', $this->crypt->encrypt($this->data['auth_account']), 'hidden') : '', 'USERNAME' => $this->data['username'], 'USER_EMAIL' => $this->data['user_email'], 'USER_EMAIL2' => $this->data['user_email2']));
$this->core->set_vars(array('page_title' => $this->user->lang('register_title'), 'template_file' => 'register.html', 'display' => true));
}
示例12: scan_backgrounds
public function scan_backgrounds()
{
$arrOut = array();
$strFolder = $this->root_path . 'plugins/siggenerator/includes/backgrounds/';
$arrFiles = scandir($strFolder);
$arrExtensions = array('jpg', 'gif', 'png');
foreach ($arrFiles as $filename) {
if (valid_folder($filename)) {
$strExtension = pathinfo($filename, PATHINFO_EXTENSION);
if (in_array($strExtension, $arrExtensions)) {
$arrOut[str_replace($this->root_path, '', $strFolder . $filename)] = $filename;
}
}
}
$strFolder = $this->pfh->FolderPath('backgrounds', 'signatures');
$arrFiles = scandir($strFolder);
$arrExtensions = array('jpg', 'gif', 'png');
foreach ($arrFiles as $filename) {
if (valid_folder($filename)) {
$strExtension = pathinfo($filename, PATHINFO_EXTENSION);
if (in_array($strExtension, $arrExtensions)) {
$arrOut[str_replace($this->root_path, '', $strFolder . $filename)] = $filename;
}
}
}
return $arrOut;
}
示例13: save
public function save()
{
$strFileFolder = $this->pfh->FolderPath('files', 'mediacenter');
$finfo = new finfo(FILEINFO_MIME_TYPE);
$arrFiles = scandir($strFileFolder);
$arrLocalFilenames = $this->pdh->aget('mediacenter_media', 'localfile', 0, array($this->pdh->get('mediacenter_media', 'id_list', array())));
$intAlbumID = $this->in->get('album');
if (substr($intAlbumID, 0, 1) == 'c') {
$intCategoryID = (int) substr($intAlbumID, 1);
$intAlbumID = 0;
} else {
$intCategoryID = $this->pdh->get('mediacenter_albums', 'category_id', array($intAlbumID));
$intAlbumID = intval($intAlbumID);
}
$arrTypes = $this->pdh->get('mediacenter_categories', 'types', array($intCategoryID));
if (!$intCategoryID || !$arrTypes || count($arrTypes) == 0) {
return false;
}
foreach ($arrFiles as $strFile) {
if (valid_folder($strFile)) {
if (in_array($strFile, $arrLocalFilenames)) {
continue;
}
$strMime = $finfo->file($strFileFolder . $strFile);
$strName = $strFile;
if (strpos($strMime, 'image/') === 0) {
$intType = 2;
} elseif (strpos($strMime, 'video/') === 0) {
$intType = 1;
} else {
$intType = 0;
}
//If Type is not allowed, make type file
if (!in_array($intType, $arrTypes)) {
$intType = 0;
//File
}
//Try to find an image extension
$strExtension = strtolower(pathinfo($strFile, PATHINFO_EXTENSION));
if (!$strExtension || $strExtension == "") {
$strExtension = $this->mimetype_to_extension($strMime);
}
//If type file now allowed: wrong type
if (!in_array($intType, $arrTypes)) {
$arrError[$strFile] = "filetype_not_allowed";
$this->tpl->assign_block_vars('mc_media_row', array('ICON' => $this->core->icon_font('fa-times'), 'NAME' => $strFile, 'STATUS' => "filetype_not_allowed", 'EXTENSION' => $strExtension));
continue;
}
$arrAdditionalData = array();
$strLocalfile = $strFile;
$strFileFolder = $this->pfh->FolderPath('files', 'mediacenter');
if (file_exists($strFileFolder . $strLocalfile)) {
$arrAdditionalData['size'] = filesize($strFileFolder . $strLocalfile);
}
$strLocalPreviewImage = "";
$strThumbfolder = $this->pfh->FolderPath('thumbs', 'mediacenter');
if ($intType == 2 || $oldType == 2) {
//Preview Image
$filename = md5(rand() . unique_id());
$this->pfh->copy($strFileFolder . $strLocalfile, $strThumbfolder . $filename . '.' . $strExtension);
$this->pfh->thumbnail($strThumbfolder . $filename . '.' . $strExtension, $strThumbfolder, $filename . '.64.' . $strExtension, 64);
$this->pfh->thumbnail($strThumbfolder . $filename . '.' . $strExtension, $strThumbfolder, $filename . '.240.' . $strExtension, 240);
$strLocalPreviewImage = $filename . '.' . $strExtension;
}
if ($intType == 2) {
//Exif Data
if ($strExtension == 'jpg') {
$arrExif = $this->exif_data($strFileFolder . $strLocalfile);
if ($arrExif) {
$arrAdditionalData = array_merge($arrAdditionalData, $arrExif);
}
}
}
//Default Publish State
$blnDefaultPublishState = $this->pdh->get('mediacenter_categories', 'default_published_state', array($intCategoryID));
$intPublished = $this->user->check_auth('a_mediacenter_manage', false) ? 1 : $blnDefaultPublishState;
if ($strExtension != "") {
$strFilename = $strFile . '.' . $strExtension;
} else {
$strFilename = $strFile;
}
$arrQuery = array('album_id' => $intAlbumID, 'category_id' => $intCategoryID, 'name' => $strName, 'description' => "", 'type' => $intType, 'tags' => serialize(array()), 'filename' => $strFilename, 'localfile' => $strLocalfile, 'externalfile' => "", 'previewimage' => $strLocalPreviewImage, 'published' => $intPublished, 'additionaldata' => serialize($arrAdditionalData), 'date' => $this->time->time, 'user_id' => $this->user->id);
$objQuery = $this->db->prepare("INSERT INTO __mediacenter_media :p")->set($arrQuery)->execute();
if ($objQuery) {
$id = $objQuery->insertId;
$arrSucces[] = $strFile;
$this->tpl->assign_block_vars('mc_media_row', array('ICON' => $this->core->icon_font('fa-check'), 'NAME' => $strFile, 'STATUS' => "OK", 'EXTENSION' => $strExtension));
}
}
}
$this->pdh->enqueue_hook('mediacenter_media_update');
$this->pdh->enqueue_hook('mediacenter_categories_update');
$this->pdh->process_hook_queue();
$this->display(false);
}
示例14: scan_templates
public function scan_templates($templatepath, $orig_templatepath = false, $remove_templatepath = true)
{
$files = array();
if (!$orig_templatepath) {
$orig_templatepath = $templatepath;
}
if ($dir = @opendir($templatepath)) {
while ($file = @readdir($dir)) {
if (is_dir($templatepath . '/' . $file) && valid_folder($templatepath . '/' . $file)) {
$files_rec = $this->scan_templates($templatepath . '/' . $file, $templatepath, $remove_templatepath);
$files = array_merge($files, $files_rec);
} else {
$ext = pathinfo($file, PATHINFO_EXTENSION);
if ($file != "index.php" && $file != "index.html" && $file != 'user_additions.css' && $file != 'jquery_tmpl.css' && $file != "main.css" && in_array($ext, $this->allowed_extensions)) {
$filepath = $remove_templatepath ? str_replace($orig_templatepath . '/', '', $templatepath . '/' . $file) : $file;
$files[$filepath] = $file;
}
}
}
}
return $files;
}
示例15: get_available_authmethods
public function get_available_authmethods()
{
$auth = array();
// Build auth array
if ($dir = @opendir($this->root_path . 'core/auth/')) {
while ($file = @readdir($dir)) {
if (is_file($this->root_path . 'core/auth/' . $file) && valid_folder($file)) {
$name = substr(substr($file, 0, strpos($file, '.')), 5);
$auth[$name] = $this->lang('auth_' . $name, false, false) ? $this->lang('auth_' . $name) : ucfirst($name);
}
}
}
return $auth;
}