function listTemplates() { global $toC_Json, $osC_Language; $osC_DirectoryListing = new osC_DirectoryListing('../templates'); $osC_DirectoryListing->setIncludeDirectories(true); $osC_DirectoryListing->setIncludeFiles(false); $osC_DirectoryListing->setExcludeEntries('system'); $files = $osC_DirectoryListing->getFiles(true); foreach ($files as $file) { include '../templates/' . $file['name'] . '/template.php'; $code = $file['name']; $class = 'osC_Template_' . $code; if (class_exists($class)) { $module = new $class(); $module_title = $module->getTitle(); $action = array(); if ($module->isInstalled()) { if ($module->getCode() == DEFAULT_TEMPLATE) { $module_title .= ' (' . $osC_Language->get('default_entry') . ')'; $action[] = array('class' => 'icon-default-record', 'qtip' => $osC_Language->get('field_set_as_default')); } else { $action[] = array('class' => 'icon-default-gray-record', 'qtip' => $osC_Language->get('field_set_as_default')); } $action[] = array('class' => 'icon-uninstall-record', 'qtip' => $osC_Language->get('icon_uninstall')); } else { $action[] = array('class' => 'icon-empty-record', 'qtip' => $osC_Language->get('field_set_as_default')); $action[] = array('class' => 'icon-install-record', 'qtip' => $osC_Language->get('icon_install')); } $modules[] = array('code' => $module->getCode(), 'title' => $module_title, 'author' => $module->getAuthorName(), 'url' => $module->getAuthorAddress(), 'action' => $action); } } $response = array(EXT_JSON_READER_ROOT => $modules); echo $toC_Json->encode($response); }
function listBackup() { global $toC_Json; $osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_BACKUP); $osC_DirectoryListing->setIncludeDirectories(false); $osC_DirectoryListing->setExcludeEntries('.htaccess'); $response = array(); foreach ($osC_DirectoryListing->getFiles() as $file) { $response[] = array('file' => $file['name'], 'date' => osC_DateTime::getDate(osC_DateTime::fromUnixTimestamp(filemtime(DIR_FS_BACKUP . $file['name'])), true), 'size' => number_format(filesize(DIR_FS_BACKUP . $file['name']))); } $response = array(EXT_JSON_READER_ROOT => $response); echo $toC_Json->encode($response); }
function upload() { $logo_image = new upload('logo_image'); if ($logo_image->exists()) { self::deleteLogo('originals'); $img_type = substr($_FILES['logo_image']['name'], strrpos($_FILES['logo_image']['name'], '.') + 1); $original = DIR_FS_CATALOG . DIR_WS_IMAGES . 'logo_originals.' . $img_type; $logo_image->set_destination(realpath(DIR_FS_CATALOG . 'images/')); if ($logo_image->parse() && $logo_image->save()) { copy(DIR_FS_CATALOG . 'images/' . $logo_image->filename, $original); @unlink(DIR_FS_CATALOG . 'images/' . $logo_image->filename); $osC_DirectoryListing = new osC_DirectoryListing('../templates'); $osC_DirectoryListing->setIncludeDirectories(true); $osC_DirectoryListing->setIncludeFiles(false); $osC_DirectoryListing->setExcludeEntries('system'); $templates = $osC_DirectoryListing->getFiles(); foreach ($templates as $template) { $code = $template['name']; if (file_exists('../templates/' . $code . '/template.php')) { include '../templates/' . $code . '/template.php'; $class = 'osC_Template_' . $code; self::deleteLogo($code); if (class_exists($class)) { $module = new $class(); $logo_height = $module->getLogoHeight(); $logo_width = $module->getLogoWidth(); $dest_image = DIR_FS_CATALOG . DIR_WS_IMAGES . 'logo_' . $code . '.' . $img_type; osc_gd_resize($original, $dest_image, $logo_width, $logo_height); } } } return true; } } return false; }
$entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*'); } else { $page_filename = substr($box['name'], 0, strrpos($box['name'], '.')); $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename); } if ($_GET['filter'] != DEFAULT_TEMPLATE && $d_boxes->getSize() > 0) { $entry['group'] = '-- ' . $_GET['filter'] . ' --'; } $pages_array[] = $entry; } if ($_GET['filter'] != DEFAULT_TEMPLATE) { $d_boxes = new osC_DirectoryListing('../templates/' . DEFAULT_TEMPLATE . '/content'); $d_boxes->setRecursive(true); $d_boxes->setAddDirectoryToFilename(true); $d_boxes->setCheckExtension('php'); $d_boxes->setExcludeEntries('.svn'); foreach ($d_boxes->getFiles(false) as $box) { if ($box['is_directory'] === true) { $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*'); } else { $page_filename = substr($box['name'], 0, strrpos($box['name'], '.')); $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename); } $check_entry = $entry; $check_entry['group'] = '-- ' . $_GET['filter'] . ' --'; if (!in_array($check_entry, $pages_array)) { $entry['group'] = '-- ' . DEFAULT_TEMPLATE . ' --'; $pages_array[] = $entry; } } }
function getPages() { global $toC_Json, $osC_Database, $osC_Language; $Qtemplate = $osC_Database->query('select code from :table_templates where id = :id'); $Qtemplate->bindTable(':table_templates', TABLE_TEMPLATES); $Qtemplate->bindValue(':id', $_REQUEST['filter']); $Qtemplate->execute(); $filter_id = $_REQUEST['filter']; $_REQUEST['filter'] = $Qtemplate->Value('code'); $pages_array = array(array('id' => $filter_id . '/*', 'text' => '*')); $d_boxes = new osC_DirectoryListing('../templates/' . $_REQUEST['filter'] . '/content'); $d_boxes->setRecursive(true); $d_boxes->setAddDirectoryToFilename(true); $d_boxes->setCheckExtension('php'); $d_boxes->setExcludeEntries('.svn'); foreach ($d_boxes->getFiles(false) as $box) { if ($box['is_directory'] === true) { $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*'); } else { $page_filename = substr($box['name'], 0, strrpos($box['name'], '.')); $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename); } if ($_REQUEST['filter'] != DEFAULT_TEMPLATE && $d_boxes->getSize() > 0) { $entry['group'] = '-- ' . $_REQUEST['filter'] . ' --'; } $pages_array[] = $entry; } if ($_REQUEST['filter'] != DEFAULT_TEMPLATE) { $d_boxes = new osC_DirectoryListing('../templates/' . DEFAULT_TEMPLATE . '/content'); $d_boxes->setRecursive(true); $d_boxes->setAddDirectoryToFilename(true); $d_boxes->setCheckExtension('php'); $d_boxes->setExcludeEntries('.svn'); foreach ($d_boxes->getFiles(false) as $box) { if ($box['is_directory'] === true) { $entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*'); } else { $page_filename = substr($box['name'], 0, strrpos($box['name'], '.')); $entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename); } $check_entry = $entry; $check_entry['group'] = '-- ' . $_REQUEST['filter'] . ' --'; if (!in_array($check_entry, $pages_array)) { $entry['group'] = '-- ' . DEFAULT_TEMPLATE . ' --'; $pages_array[] = $entry; } } } $response = array(EXT_JSON_READER_ROOT => $pages_array); echo $toC_Json->encode($response); }
$Id: define_language.php,v 1.2 2004/11/07 21:00:46 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2004 osCommerce Released under the GNU General Public License */ require 'includes/classes/directory_listing.php'; $osC_DirectoryListing = new osC_DirectoryListing(realpath('../includes/languages/' . $lng)); $osC_DirectoryListing->setRecursive(true); $osC_DirectoryListing->setAddDirectoryToFilename(true); $osC_DirectoryListing->setCheckExtension('php'); $osC_DirectoryListing->setIncludeDirectories(false); $osC_DirectoryListing->setExcludeEntries('CVS'); $files = $osC_DirectoryListing->getFiles(); array_unshift($files, array('name' => '../' . $lng . '.php', 'is_directory' => false)); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><h1><?php echo HEADING_TITLE; ?> </h1></td> <td class="smallText" align="right"> <?php echo tep_draw_form('language', FILENAME_DEFINE_LANGUAGE, '', 'get') . tep_draw_pull_down_menu('lng', $languages_array, $lng, 'onChange="this.form.submit();"') . '</form>'; ?> </td>
$Qtc->execute(); $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE)); while ($Qtc->next()) { $tax_class_array[] = array('id' => $Qtc->valueInt('tax_class_id'), 'text' => $Qtc->value('tax_class_title')); } $Qwc = $osC_Database->query('select weight_class_id, weight_class_title from :table_weight_class where language_id = :language_id order by weight_class_title'); $Qwc->bindTable(':table_weight_class', TABLE_WEIGHT_CLASS); $Qwc->bindInt(':language_id', $osC_Language->getID()); $Qwc->execute(); $weight_class_array = array(); while ($Qwc->next()) { $weight_class_array[] = array('id' => $Qwc->valueInt('weight_class_id'), 'text' => $Qwc->value('weight_class_title')); } require 'includes/classes/directory_listing.php'; $osC_Dir_Images = new osC_DirectoryListing('../images'); $osC_Dir_Images->setExcludeEntries('CVS'); $osC_Dir_Images->setIncludeFiles(false); $osC_Dir_Images->setRecursive(true); $osC_Dir_Images->setAddDirectoryToFilename(true); $files = $osC_Dir_Images->getFiles(); $image_directories = array(array('id' => '', 'text' => 'images/')); foreach ($files as $file) { $image_directories[] = array('id' => $file['name'], 'text' => 'images/' . $file['name']); } ?> <script type="text/javascript" src="external/FCKeditor/2.0b1/fckeditor.js"></script> <style type="text/css">@import url('external/jscalendar/calendar-win2k-1.css');</style> <script type="text/javascript" src="external/jscalendar/calendar.js"></script> <script type="text/javascript" src="external/jscalendar/lang/calendar-en.js"></script> <script type="text/javascript" src="external/jscalendar/calendar-setup.js"></script>