Example #1
0
 function method_list($payment_method_id = "")
 {
     global $mosConfig_absolute_path;
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $db = new ps_DB();
     $row = array();
     $files = vmReadDirectory(CLASSPATH . 'shipping/', '.ini$');
     if ($files) {
         require_once CLASSPATH . 'ps_ini.php';
         $ShippingModule = new mShop_ini();
         $i = 0;
         foreach ($files as $file) {
             $i++;
             $ShippingModule->load(CLASSPATH . 'shipping/' . $file);
         }
         return $ShippingModule->_elements;
     } else {
         return false;
     }
 }
Example #2
0
 /**
  * Enter description here...
  *
  * @param unknown_type $name
  * @param unknown_type $preselected
  * @return unknown
  */
 function list_available_classes($name, $preselected = 'ps_xmlexport')
 {
     $files = vmReadDirectory(CLASSPATH . "export/", ".php", true, true);
     $array = array();
     foreach ($files as $file) {
         $file_info = pathinfo($file);
         $filename = $file_info['basename'];
         if (stristr($filename, '.cfg')) {
             continue;
         }
         $array[basename($filename, '.php')] = basename($filename, '.php');
     }
     return ps_html::selectList($name, $preselected, $array);
 }
Example #3
0
/**
* Utility function to read the files in a directory
* @param string The file system path
* @param string A filter for the names
* @param boolean Recurse search into sub-directories
* @param boolean True if to prepend the full path to the file name
*/
function vmReadDirectory($path, $filter = '.', $recurse = false, $fullpath = false)
{
    $arr = array();
    if (!@is_dir($path)) {
        return $arr;
    }
    $handle = opendir($path);
    while ($file = readdir($handle)) {
        $dir = vmPathName($path . '/' . $file, false);
        $isDir = is_dir($dir);
        if ($file != "." && $file != "..") {
            if (preg_match("/{$filter}/", $file)) {
                if ($fullpath) {
                    $arr[] = trim(vmPathName($path . '/' . $file, false));
                } else {
                    $arr[] = trim($file);
                }
            }
            if ($recurse && $isDir) {
                $arr2 = vmReadDirectory($dir, $filter, $recurse, $fullpath);
                $arr = array_merge($arr, $arr2);
            }
        }
    }
    closedir($handle);
    asort($arr);
    return $arr;
}
Example #4
0
 /**
  * @param string The name of the form element
  * @param string The value of the element
  * @param object The xml element for the parameter
  * @param string The control name
  * @return string The html for the element
  */
 function _form_filelist($name, $value, &$node, $control_name)
 {
     // path to images directory
     $path = JPATH_SITE . $node->attributes('directory');
     $filter = $node->attributes('filter');
     $files = vmReadDirectory($path, $filter);
     $options = array();
     foreach ($files as $file) {
         $options[$file] = $file;
     }
     if (!$node->attributes('hide_none')) {
         array_unshift($options, array('-1', '- ' . 'Do Not Use' . ' -'));
     }
     if (!$node->attributes('hide_default')) {
         array_unshift($options, array('', '- ' . 'Use Default' . ' -'));
     }
     return VmHTML::selectList('' . $control_name . '[' . $name . ']', $value, $options, 1, '', 'class="inputbox"');
 }
Example #5
0
 /**
  * Funtion to create a select list holding all files for a special template section (e.g. order_emails)
  *
  * @param string $name
  * @param string $section
  * @param string $preselected
  * @return string
  */
 function list_template_files($name, $section = 'browse', $preselected = '')
 {
     $files = vmReadDirectory(VM_THEMEPATH . "templates/{$section}/");
     $array = array();
     foreach ($files as $file) {
         if (is_dir($file)) {
             continue;
         }
         $file_info = pathinfo($file);
         $filename = $file_info['basename'];
         if ($filename == 'index.html') {
             continue;
         }
         $array[basename($filename, '.' . $file_info['extension'])] = basename($filename, '.' . $file_info['extension']);
     }
     if ($section == 'browse') {
         $array = array_merge(array('managed' => 'managed'), $array);
     }
     return ps_html::selectList($name, $preselected, $array);
 }
Example #6
0
    <tr> 
      <td class="labelcell"><?php 
echo $VM_LANG->_('PHPSHOP_FILES_LIST_FILENAME');
?>
:</td>
      <td> 
        <input type="file" class="inputbox" name="file_upload" size="32" />
      </td>
    </tr>
    <tr id="filename2">
    	<td class="labelcell"><?php 
echo $VM_LANG->_('PHPSHOP_FILES_LIST_FILENAME');
?>
:</td>
    	<td><?php 
$downloadRootFiles = vmReadDirectory(DOWNLOADROOT, '.', true);
$mappedDownloadRootFiles = array();
foreach ($downloadRootFiles as $file) {
    if (is_file(DOWNLOADROOT . $file) && basename($file) != 'index.html' && basename($file) != '.htaccess') {
        $mappedDownloadRootFiles[$file] = $file;
    }
}
echo $ps_html->selectList('downloadable_file', basename($db->f("file_name")), $mappedDownloadRootFiles);
?>
    	</td>
    </tr>
    <tr> 
      <td class="labelcell"><?php 
echo $VM_LANG->_('PHPSHOP_FILES_LIST_FILETYPE');
?>
:</td>
Example #7
0
?>
 value="1" />
        </td>
        <td><?php 
echo vmToolTip($VM_LANG->_('PHPSHOP_ADMIN_CFG_SHOW_PRODUCT_COUNT_TIP'));
?>
</td>
    </tr>
    <tr>
        <td class="labelcell"><?php 
echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NOIMAGEPAGE');
?>
</td>
        <td>
	        <?php 
$images = vmReadDirectory(VM_THEMEPATH . 'images', '\\.png$|\\.bmp$|\\.jpg$|\\.jpeg$|\\.gif$|\\.ico$');
foreach ($images as $image) {
    $imageArr[basename($image)] = $image;
}
echo ps_html::selectList('conf_NO_IMAGE', NO_IMAGE, $imageArr);
?>
        </td>
        <td><?php 
echo vmToolTip($VM_LANG->_('PHPSHOP_ADMIN_CFG_NOIMAGEPAGE_EXPLAIN'));
?>
        </td>
    </tr>
    <tr>
        <td class="labelcell"><?php 
echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_SHOWPHPSHOP_VERSION');
?>
Example #8
0
 /**
  * Lists all available files from the /classes directory
  *
  * @param string $name
  * @param string $preselected
  * @return string
  */
 function list_classes($name, $preselected)
 {
     global $mosConfig_absolute_path;
     $classes = vmReadDirectory(CLASSPATH, '\\.php$', false, true);
     $array = array();
     foreach ($classes as $class) {
         if (is_dir($class) || $class[0] == '.') {
             continue;
         }
         $classname = basename($class, '.php');
         if ($classname != 'ps_main' && $classname != 'ps_ini') {
             $array[$classname] = $classname;
         }
     }
     return ps_html::selectList($name, $preselected, $array, 1, '', 'id="' . $name . '"');
 }
Example #9
0
echo vmToolTip($VM_LANG->_('PHPSHOP_PRODUCT_FORM_AVAILABILITY_TOOLTIP1'));
?>
      <br /><br />
        <select class="inputbox" name="image" onchange="javascript:if (document.adminForm.image.options[selectedIndex].value!='') {document.imagelib.src='<?php 
echo VM_THEMEURL;
?>
images/availability/' + document.adminForm.image.options[selectedIndex].value; document.adminForm.product_availability.value=document.adminForm.image.options[selectedIndex].value;} else {document.imagelib.src='<?php 
echo VM_THEMEURL . 'images/' . NO_IMAGE;
?>
'; document.adminForm.product_availability.value=''}">
          <option value=""><?php 
echo $VM_LANG->_('VM_PRODUCT_FORM_AVAILABILITY_SELECT_IMAGE');
?>
</option><?php 
$path = VM_THEMEPATH . "images/availability";
$files = vmReadDirectory("{$path}", ".", true, true);
foreach ($files as $file) {
    $file_info = pathinfo($file);
    $filename = $file_info['basename'];
    if ($filename != "index.html") {
        ?>
                <option <?php 
        echo $db->f("product_availability") == $filename ? "selected=\"selected\"" : "";
        ?>
 value="<?php 
        echo $filename;
        ?>
">
                <?php 
        echo $filename;
        ?>
Example #10
0
 /**
  * @param string The name of the form element
  * @param string The value of the element
  * @param object The xml element for the parameter
  * @param string The control name
  * @return string The html for the element
  */
 function _form_filelist($name, $value, &$node, $control_name)
 {
     global $mosConfig_absolute_path;
     // path to images directory
     $path = $mosConfig_absolute_path . $node->getAttribute('directory');
     $filter = $node->getAttribute('filter');
     $files = vmReadDirectory($path, $filter);
     $options = array();
     foreach ($files as $file) {
         $options[] = mosHTML::makeOption($file, $file);
     }
     if (!$node->getAttribute('hide_none')) {
         array_unshift($options, mosHTML::makeOption('-1', '- ' . 'Do Not Use' . ' -'));
     }
     if (!$node->getAttribute('hide_default')) {
         array_unshift($options, mosHTML::makeOption('', '- ' . 'Use Default' . ' -'));
     }
     return mosHTML::selectList($options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, "param{$name}");
 }