function _register_options_dynamic() { if (!$this->udm->admin) { return; } if ($override_set = AMPfile_list('custom', 'xml')) { $this->options['override_file']['values'] = array('' => AMP_TEXT_OPTION_DEFAULT) + $override_set; } else { $this->options['override_file']['values'] = array('' => AMP_TEXT_OPTION_BLANK); } }
function all($current_page = 1) { $filelist = AMPfile_list('img/thumb/', null, true); unset($filelist['']); $page_of_filenames = $this->paginate($filelist, $current_page); $new_filelist = array(); foreach ($page_of_filenames as $local_index => $listed_name) { $image = new AMP_System_File_Image(AMP_LOCAL_PATH . '/img/thumb/' . $listed_name); $new_filelist[] = $image; } return $new_filelist; }
function AMPSystemLookup_NavFiles() { $core_nav_files = AMPfile_list(AMP_BASE_INCLUDE_PATH . 'AMP/Nav', 'php'); $core_badge_files = AMPfile_list(AMP_BASE_INCLUDE_PATH . 'AMP/Badge', 'php'); $custom_files = AMP_lookup('customFiles'); foreach ($core_badge_files as $key => $core_file) { if (!$key) { continue; } $full_core_file = 'AMP/Badge/' . $core_file; $this->dataset[$full_core_file] = $full_core_file; } foreach ($core_nav_files as $key => $core_file) { if (!$key) { continue; } $full_core_file = 'AMP/Nav/' . $core_file; $this->dataset[$core_file] = $full_core_file; } $this->dataset = array_merge($this->dataset, $custom_files); asort($this->dataset); }
function setDynamicValues() { $this->setFieldValueSet('file', AMPfile_list('downloads', 'mp3')); }
#image_search_form { margin-bottom: 20px } #image_search_form label { margin-right: 10px; } #image_search_form input, #image_search_form select { margin-right: 30px; } </style> </HEAD><BODY> <?php require_once 'AMP/BaseDB.php'; $filelist = AMPfile_list('img/thumb/', null, true); unset($filelist['']); # handy for debugging this #$filelist = array_slice( $filelist, 0, 200 ); require_once 'AMP/Renderer/HTML.php'; $renderer = new AMP_Renderer_HTML(); $folders = AMP_lookup('image_folders'); print "<form method='GET' action='/system/imgpreview.php' id='image_search_form'>\n"; print "<p>"; print $renderer->label('image_filename', "Search in file names"); print $renderer->input('image_filename', null, array('id' => 'search_image_filename')); print "</p>"; if ($folders) { print "<p>"; print $renderer->label('image_folder', "Show images in folder"); print $renderer->select('image_folder', null, array('' => 'None') + $folders, array('id' => 'search_image_folder'));
function AMPfile_list($file, $ext = null, $recursive = false, $truncate = false) { if (strpos($file, AMP_LOCAL_PATH) === FALSE && substr($file, 0, 1) != DIRECTORY_SEPARATOR) { $dir_name = AMP_LOCAL_PATH . DIRECTORY_SEPARATOR . $file; } else { $dir_name = $file; } $dir = opendir($dir_name); if (!$dir) { return false; } $basename = basename($dir_name); $fileArr = array(); while ($file_name = readdir($dir)) { if (is_dir($dir_name . DIRECTORY_SEPARATOR . $file_name)) { if (!$recursive || substr($file_name, 0, 1) == '.') { continue; } $subdir_results = AMPfile_list($dir_name . DIRECTORY_SEPARATOR . $file_name, $ext, $recursive); if ($subdir_results) { foreach ($subdir_results as $result_key => $result_name) { if (!$result_key) { continue; } $fileArr[$file_name . DIRECTORY_SEPARATOR . $result_name] = $file_name . DIRECTORY_SEPARATOR . $result_name; } } continue; } if (isset($ext) && $ext) { $file_ext = false; if ($dotspot = strrpos($file_name, ".")) { $file_ext = strtolower(substr($file_name, $dotspot + 1)); } if (!$file_ext || $ext != $file_ext) { continue; } } $file_display_name = $file_name; if ($truncate) { $file_display_name = substr($file_name, 0, $truncate); } $fileArr[$file_name] = $file_display_name; } //uksort($fileArr, "strnatcasecmp"); natcasesort($fileArr); $final_list = array('' => 'Select') + $fileArr; return $final_list; }
function clear($key_token = null) { foreach ($this->_index as $authorized_key => $time_stored) { if (isset($key_token) && strpos($authorized_key, $key_token) === FALSE) { continue; } $this->delete($authorized_key); } $file_set = AMPfile_list($this->_path_cache); $this->_load_file(); foreach ($file_set as $file_name => $file_display) { if (!$file_name) { continue; } if (isset($key_token) && strpos($file_name, $key_token) === FALSE) { continue; } $entry_ref =& new AMP_System_File($this->_path($file_name)); if ($entry_ref->getTime() + AMP_SYSTEM_CACHE_TIMEOUT < time()) { $entry_ref->delete(); } } }
(short!)</td> <td> <input name="alttag" type="textarea" id="alttag" value="<?php echo $r->Fields("alttag"); ?> " size="50"> </td> </tr> <tr class="intitle"> <td colspan="2" valign="top"><?php echo helpme("Attached Document"); ?> Attached Document</td> </tr> <?php $doc_filelist = AMPfile_list('downloads/'); $Doc =& new Select('doc', $doc_filelist, $r->Fields("doc")); echo $buildform->add_row('Document Name', $Doc); ?> <tr> <td valign="top"></td> <td><span class="text"><a href="docdir.php" target="_blank">view documents</a> | <a href="doc_upload.php" target="_blank">upload document</a> </span></td> </tr> <tr> <td valign="top" class="name">Document Type</td> <td><span class="text"> <input <?php if ($r->Fields("doctype") == "pdf") {
<tr class="text"> <td valign="top"><div align="right"></div></td> <td><p><a href="#" onclick="change2('upload');" >Upload Image</a></td> </tr><tr><td colspan="2"><div id="upload" style="display:none;"><table width="100%" border="0" align="center"> <?php echo addfield('file','Upload New Image <br>(jpg files only)','file','','Select image');?> </table></div> </td></tr><tr class="text"> <td valign="top"><div align="right"></div></td> </tr> </tr> <tr> <?php $filelist = AMPfile_list('img/'); $galattr= 'onChange="art_showThumb2(\'img/\'+this.value);"'; $Gal = & new Select('flash',$filelist,$subtype->Fields("flash"),false,10,null,null,$galattr); $th_style2 = $subtype->Fields("flash")?null:" style='display:none' "; $th_img2= '<P><img align="center" width=100 src="http://'.$_SERVER['SERVER_NAME'].'/img/'.$subtype->Fields("flash").'" id="active_thumb2"'.$th_style2.'>'; echo $buildform->add_row('Section Banner Image'.$th_img2, $Gal); ?> <script type="text/javascript"> function art_showThumb2(imgname) { th_img2 = document.getElementById('active_thumb2'); th_img2.src='http://'+window.location.host+"/"+imgname; th_img2.style.display="block"; } </script>
function AMPSystemLookup_CustomFiles() { $this->dataset = AMPfile_list('custom', 'php'); }