本文整理汇总了PHP中osC_DirectoryListing::setCheckExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_DirectoryListing::setCheckExtension方法的具体用法?PHP osC_DirectoryListing::setCheckExtension怎么用?PHP osC_DirectoryListing::setCheckExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osC_DirectoryListing
的用法示例。
在下文中一共展示了osC_DirectoryListing::setCheckExtension方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLocalImages
public static function getLocalImages()
{
$osC_DirectoryListing = new osC_DirectoryListing('../images/products/_upload', true);
$osC_DirectoryListing->setCheckExtension('gif');
$osC_DirectoryListing->setCheckExtension('jpg');
$osC_DirectoryListing->setCheckExtension('png');
$osC_DirectoryListing->setIncludeDirectories(false);
$result = array('entries' => array());
foreach ($osC_DirectoryListing->getFiles() as $file) {
$result['entries'][] = $file['name'];
}
$result['rpcStatus'] = RPC_STATUS_SUCCESS;
echo json_encode($result);
}
示例2: listCache
function listCache()
{
global $toC_Json;
$osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_WORK);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('cache');
$response = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$last_modified = filemtime(DIR_FS_WORK . '/' . $file['name']);
if (strpos($file['name'], '-') !== false) {
$code = substr($file['name'], 0, strpos($file['name'], '-'));
} else {
$code = substr($file['name'], 0, strpos($file['name'], '.'));
}
if (isset($cached_files[$code])) {
$cached_files[$code]['total']++;
if ($last_modified > $cached_files[$code]['last_modified']) {
$cached_files[$code]['last_modified'] = $last_modified;
}
} else {
$cached_files[$code] = array('total' => 1, 'last_modified' => $last_modified);
}
$response[] = array('code' => $code, 'total' => $cached_files[$code]['total'], 'last_modified' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($cached_files[$code]['last_modified']), true));
}
$response = array(EXT_JSON_READER_ROOT => $response);
echo $toC_Json->encode($response);
}
示例3: getLanguages
function getLanguages()
{
global $toC_Json;
$osC_DirectoryListing = new osC_DirectoryListing('../includes/languages');
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('xml');
$records = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$records[] = array('id' => substr($file['name'], 0, strrpos($file['name'], '.')), 'text' => substr($file['name'], 0, strrpos($file['name'], '.')));
}
$response = array(EXT_JSON_READER_ROOT => $records);
echo $toC_Json->encode($response);
}
示例4: foreach
function osC_LanguageInstall()
{
$osC_DirectoryListing = new osC_DirectoryListing('../includes/languages');
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('xml');
foreach ($osC_DirectoryListing->getFiles() as $file) {
$osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file['name']));
$lang = $osC_XML->toArray();
$this->_languages[$lang['language']['data']['code']] = array('name' => $lang['language']['data']['title'], 'code' => $lang['language']['data']['code'], 'charset' => $lang['language']['data']['character_set']);
}
unset($lang);
$language = isset($_GET['language']) && !empty($_GET['language']) ? $_GET['language'] : '';
$this->set($language);
$this->loadIniFile();
$this->loadIniFile(basename($_SERVER['SCRIPT_FILENAME']));
}
示例5: listImages
function listImages()
{
global $toC_Json;
$osC_DirectoryListing = new osC_DirectoryListing('includes/modules/image');
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('php');
$record = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$class = 'osC_Image_Admin_' . substr($file['name'], 0, strrpos($file['name'], '.'));
if (class_exists($class)) {
$module = new $class();
$record[] = array('module' => $module->getTitle(), 'run' => substr($file['name'], 0, strrpos($file['name'], '.')));
}
}
$response = array(EXT_JSON_READER_ROOT => $record);
echo $toC_Json->encode($response);
}
示例6: fopen
function _createIndexSitemap()
{
global $osC_Language;
$handle = fopen($this->_save_path . 'sitemapsIndex.xml', 'w');
$xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$xml .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
fwrite($handle, $xml);
$directory_listing = new osC_DirectoryListing($this->_save_path);
$directory_listing->setIncludeDirectories(false);
$directory_listing->setIncludeFiles(true);
$directory_listing->setCheckExtension('xml');
$xmls = $directory_listing->getFiles();
if (!empty($xmls)) {
foreach ($xmls as $xml) {
if ($xml['name'] !== $this->_file_name . 'Index.xml' && preg_match('/^sitemaps[A-Za-z_]+\\.xml$/', $xml['name'])) {
$content = "\t" . '<sitemap>' . "\n";
$content .= "\t\t" . '<loc>' . $this->_base_url . basename($xml['name']) . '</loc>' . "\n";
$content .= "\t\t" . '<lastmod>' . date("Y-m-d", filemtime($this->_save_path . basename($xml['name']))) . '</lastmod>' . "\n";
$content .= "\t" . '</sitemap>' . "\n";
fwrite($handle, $content);
}
}
}
fwrite($handle, '</sitemapindex>');
fclose($handle);
$osC_Language->set($this->_original_language_code);
return true;
}
示例7: import
function import($file, $type)
{
global $osC_Database, $osC_Currencies;
if (file_exists('../includes/languages/' . $file . '.xml')) {
$osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file . '.xml'));
$source = $osC_XML->toArray();
$language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => $source['language']['data']['parent_language_code'], 'parent_id' => 0);
if (!$osC_Currencies->exists($language['currency'])) {
$language['currency'] = DEFAULT_CURRENCY;
}
if (!empty($language['parent_language_code'])) {
$Qlanguage = $osC_Database->query('select languages_id from :table_languages where code = :code');
$Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
$Qlanguage->bindValue(':code', $language['parent_language_code']);
$Qlanguage->execute();
if ($Qlanguage->numberOfRows() === 1) {
$language['parent_id'] = $Qlanguage->valueInt('languages_id');
}
}
$definitions = array();
if (isset($source['language']['definitions']['definition'])) {
$definitions = $source['language']['definitions']['definition'];
if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
$definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
}
}
$tables = array();
if (isset($source['language']['tables']['table'])) {
$tables = $source['language']['tables']['table'];
}
unset($source);
$error = false;
$add_category_and_product_placeholders = true;
$osC_Database->startTransaction();
$Qcheck = $osC_Database->query('select languages_id from :table_languages where code = :code');
$Qcheck->bindTable(':table_languages', TABLE_LANGUAGES);
$Qcheck->bindValue(':code', $language['code']);
$Qcheck->execute();
if ($Qcheck->numberOfRows() === 1) {
$add_category_and_product_placeholders = false;
$language_id = $Qcheck->valueInt('languages_id');
$Qlanguage = $osC_Database->query('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id where languages_id = :languages_id');
$Qlanguage->bindInt(':languages_id', $language_id);
} else {
$Qlanguage = $osC_Database->query('insert into :table_languages (name, code, locale, charset, date_format_short, date_format_long, time_format, text_direction, currencies_id, numeric_separator_decimal, numeric_separator_thousands, parent_id) values (:name, :code, :locale, :charset, :date_format_short, :date_format_long, :time_format, :text_direction, :currencies_id, :numeric_separator_decimal, :numeric_separator_thousands, :parent_id)');
}
$Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
$Qlanguage->bindValue(':name', $language['name']);
$Qlanguage->bindValue(':code', $language['code']);
$Qlanguage->bindValue(':locale', $language['locale']);
$Qlanguage->bindValue(':charset', $language['charset']);
$Qlanguage->bindValue(':date_format_short', $language['date_format_short']);
$Qlanguage->bindValue(':date_format_long', $language['date_format_long']);
$Qlanguage->bindValue(':time_format', $language['time_format']);
$Qlanguage->bindValue(':text_direction', $language['text_direction']);
$Qlanguage->bindInt(':currencies_id', $osC_Currencies->getID($language['currency']));
$Qlanguage->bindValue(':numeric_separator_decimal', $language['numeric_separator_decimal']);
$Qlanguage->bindValue(':numeric_separator_thousands', $language['numeric_separator_thousands']);
$Qlanguage->bindInt(':parent_id', $language['parent_id']);
$Qlanguage->setLogging($_SESSION['module'], $Qcheck->numberOfRows() === 1 ? $language_id : null);
$Qlanguage->execute();
if ($osC_Database->isError()) {
$error = true;
} else {
if ($Qcheck->numberOfRows() !== 1) {
$language_id = $osC_Database->nextID();
}
$default_language_id = osC_Language_Admin::getData(osC_Language_Admin::getID(DEFAULT_LANGUAGE), 'languages_id');
if ($type == 'replace') {
$Qdel = $osC_Database->query('delete from :table_languages_definitions where languages_id = :languages_id');
$Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
$Qdel->bindInt(':languages_id', $language_id);
$Qdel->execute();
if ($osC_Database->isError()) {
$error = true;
}
}
}
if ($error === false) {
$osC_DirectoryListing = new osC_DirectoryListing('../includes/languages/' . $file);
$osC_DirectoryListing->setRecursive(true);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setAddDirectoryToFilename(true);
$osC_DirectoryListing->setCheckExtension('xml');
foreach ($osC_DirectoryListing->getFiles() as $files) {
$definitions = array_merge($definitions, osC_Language_Admin::extractDefinitions($file . '/' . $files['name']));
}
foreach ($definitions as $def) {
$insert = false;
$update = false;
if ($type == 'replace') {
$insert = true;
} else {
$Qcheck = $osC_Database->query('select definition_key, content_group from :table_languages_definitions where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
$Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
$Qcheck->bindValue(':definition_key', $def['key']);
$Qcheck->bindInt(':languages_id', $language_id);
$Qcheck->bindValue(':content_group', $def['group']);
$Qcheck->execute();
if ($Qcheck->numberOfRows() > 0) {
//.........这里部分代码省略.........
示例8: array
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 ($_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;
}
}
示例9: getLocalImages
function getLocalImages()
{
global $toC_Json;
$osC_DirectoryListing = new osC_DirectoryListing('../images/products/_upload', true);
$osC_DirectoryListing->setCheckExtension('gif');
$osC_DirectoryListing->setCheckExtension('jpg');
$osC_DirectoryListing->setCheckExtension('png');
$osC_DirectoryListing->setIncludeDirectories(false);
$records = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$records[] = array('id' => $file['name'], 'text' => $file['name']);
}
$response = array(EXT_JSON_READER_TOTAL => sizeof($records), EXT_JSON_READER_ROOT => $records);
echo $toC_Json->encode($response);
}
示例10: osc_link_object
/*
$Id: $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2007 osCommerce
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 (1991)
as published by the Free Software Foundation.
*/
$modules_array = array();
$osC_DirectoryListing = new osC_DirectoryListing('../includes/modules/variants');
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('php');
foreach ($osC_DirectoryListing->getFiles() as $file) {
$module = substr($file['name'], 0, strrpos($file['name'], '.'));
$modules_array[] = array('id' => $module, 'text' => $module);
}
$osC_ObjectInfo = new osC_ObjectInfo(osC_ProductVariants_Admin::getData($_GET['paID']));
?>
<h1><?php
echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle());
?>
</h1>
<?php
if ($osC_MessageStack->size($osC_Template->getModule()) > 0) {
echo $osC_MessageStack->get($osC_Template->getModule());
示例11: Copyright
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2007 osCommerce
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 (1991)
as published by the Free Software Foundation.
*/
$osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_WORK);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('cache');
$cached_files = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$last_modified = filemtime(DIR_FS_WORK . '/' . $file['name']);
if (strpos($file['name'], '-') !== false) {
$code = substr($file['name'], 0, strpos($file['name'], '-'));
} else {
$code = substr($file['name'], 0, strpos($file['name'], '.'));
}
if (isset($cached_files[$code])) {
$cached_files[$code]['total']++;
if ($last_modified > $cached_files[$code]['last_modified']) {
$cached_files[$code]['last_modified'] = $last_modified;
}
} else {
$cached_files[$code] = array('total' => 1, 'last_modified' => $last_modified);
示例12: getPages
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);
}
示例13: import
public static function import($file, $type)
{
global $osC_Database;
if (file_exists('../includes/languages/' . $file . '.xml')) {
$osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file . '.xml'));
$source = $osC_XML->toArray();
$language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => isset($source['language']['data']['parent_language_code']) ? $source['language']['data']['parent_language_code'] : '', 'parent_id' => 0);
if (osC_Currencies_Admin::exists($language['currency']) === false) {
$language['currency'] = DEFAULT_CURRENCY;
}
if (!empty($language['parent_language_code']) && self::exists($language['parent_language_code'])) {
$language['parent_id'] = self::get($language['parent_language_code'], 'languages_id');
}
$definitions = array();
if (isset($source['language']['definitions']['definition'])) {
$definitions = $source['language']['definitions']['definition'];
if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
$definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
}
}
unset($source);
$error = false;
$add_category_and_product_placeholders = true;
$osC_Database->startTransaction();
$language_id = self::get($language['code'], 'languages_id');
if ($language_id !== false) {
$add_category_and_product_placeholders = false;
$Qlanguage = $osC_Database->query('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id where languages_id = :languages_id');
$Qlanguage->bindInt(':languages_id', $language_id);
} else {
$Qlanguage = $osC_Database->query('insert into :table_languages (name, code, locale, charset, date_format_short, date_format_long, time_format, text_direction, currencies_id, numeric_separator_decimal, numeric_separator_thousands, parent_id) values (:name, :code, :locale, :charset, :date_format_short, :date_format_long, :time_format, :text_direction, :currencies_id, :numeric_separator_decimal, :numeric_separator_thousands, :parent_id)');
}
$Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
$Qlanguage->bindValue(':name', $language['name']);
$Qlanguage->bindValue(':code', $language['code']);
$Qlanguage->bindValue(':locale', $language['locale']);
$Qlanguage->bindValue(':charset', $language['charset']);
$Qlanguage->bindValue(':date_format_short', $language['date_format_short']);
$Qlanguage->bindValue(':date_format_long', $language['date_format_long']);
$Qlanguage->bindValue(':time_format', $language['time_format']);
$Qlanguage->bindValue(':text_direction', $language['text_direction']);
$Qlanguage->bindInt(':currencies_id', osC_Currencies_Admin::get($language['currency'], 'currencies_id'));
$Qlanguage->bindValue(':numeric_separator_decimal', $language['numeric_separator_decimal']);
$Qlanguage->bindValue(':numeric_separator_thousands', $language['numeric_separator_thousands']);
$Qlanguage->bindInt(':parent_id', $language['parent_id']);
$Qlanguage->setLogging($_SESSION['module'], $language_id !== false ? $language_id : null);
$Qlanguage->execute();
if ($osC_Database->isError()) {
$error = true;
} else {
if ($language_id === false) {
$language_id = $osC_Database->nextID();
}
$default_language_id = osC_Languages_Admin::get(DEFAULT_LANGUAGE, 'languages_id');
if ($type == 'replace') {
$Qdel = $osC_Database->query('delete from :table_languages_definitions where languages_id = :languages_id');
$Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
$Qdel->bindInt(':languages_id', $language_id);
$Qdel->execute();
if ($osC_Database->isError()) {
$error = true;
}
}
}
if ($error === false) {
$osC_DirectoryListing = new osC_DirectoryListing('../includes/languages/' . $file);
$osC_DirectoryListing->setRecursive(true);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setAddDirectoryToFilename(true);
$osC_DirectoryListing->setCheckExtension('xml');
foreach ($osC_DirectoryListing->getFiles() as $files) {
$definitions = array_merge($definitions, osC_Language_Admin::extractDefinitions($file . '/' . $files['name']));
}
foreach ($definitions as $def) {
$insert = false;
$update = false;
if ($type == 'replace') {
$insert = true;
} else {
$Qcheck = $osC_Database->query('select definition_key, content_group from :table_languages_definitions where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
$Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
$Qcheck->bindValue(':definition_key', $def['key']);
$Qcheck->bindInt(':languages_id', $language_id);
$Qcheck->bindValue(':content_group', $def['group']);
$Qcheck->execute();
if ($Qcheck->numberOfRows() > 0) {
if ($type == 'update') {
$update = true;
}
} elseif ($type == 'add') {
$insert = true;
}
}
if ($insert === true || $update === true) {
if ($insert === true) {
$Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
} else {
$Qdef = $osC_Database->query('update :table_languages_definitions set content_group = :content_group, definition_key = :definition_key, definition_value = :definition_value where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
$Qdef->bindValue(':definition_key', $def['key']);
$Qdef->bindValue(':content_group', $def['group']);
//.........这里部分代码省略.........
示例14: osc_link_object
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2007 osCommerce
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 (1991)
as published by the Free Software Foundation.
*/
$osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_BACKUP);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('zip');
$osC_DirectoryListing->setCheckExtension('sql');
$osC_DirectoryListing->setCheckExtension('gz');
?>
<h1><?php
echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle());
?>
</h1>
<?php
if ($osC_MessageStack->size($osC_Template->getModule()) > 0) {
echo $osC_MessageStack->get($osC_Template->getModule());
}
?>