function html_start_sub1() { extract(tep_load('http_headers', 'database', 'message_stack')); if (DEFAULT_WARNING_PASSWORD_PROTECT_REMIND == 'true') { $cfq_query = $db->query("select configuration_id, configuration_group_id from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_WARNING_PASSWORD_PROTECT_REMIND'"); $cfg_array = $db->fetch_array($cfq_query); $warning_string = '<a class="headerLink" href="' . tep_href_link(FILENAME_CONFIGURATION, 'action=edit&gID=' . $cfg_array['configuration_group_id'] . '&cID=' . $cfg_array['configuration_id']) . '">' . WARNING_PASSWORD_PROTECT_REMIND . '</a>'; $msg->add($warning_string, 'error', 'header'); } // check if the 'install' directory exists, and warn of its existence if (DEFAULT_WARNING_INSTALL_EXISTS == 'true') { $check_dir = DIR_FS_CATALOG . 'install'; if (file_exists($check_dir)) { $install_string = sprintf(WARNING_INSTALL_DIRECTORY_EXISTS, $check_dir); $msg->add($install_string, 'error', 'header'); } } if ((bool) ini_get('file_uploads') == false) { $msg->add(WARNING_FILE_UPLOADS_DISABLED, 'warning', 'header'); } $images_path = tep_front_physical_path(DIR_WS_CATALOG_IMAGES); if (!is_writeable($images_path)) { $msg->add(WARNING_IMAGE_UPLOADS_DISABLED, 'warning', 'header'); } $images_path = tep_front_physical_path(DIR_WS_CATALOG . FLY_THUMB_FOLDER); if (!is_writeable($images_path)) { $msg->add(WARNING_IMAGE_THUMBS_DISABLED, 'warning', 'header'); } $http->send_cookies(); }
function backup_database() { extract(tep_load('languages', 'database', 'database_backup', 'message_stack')); $path = tep_front_physical_path(DIR_WS_CATALOG); $files_query_raw = "select filename from " . TABLE_BANNERS; $files_array = $db->query_to_array($files_query_raw, false, false); for ($i = 0, $j = count($files_array); $i < $j; $i++) { $src = $path . $files_array[$i]['filename']; $dst = $this->admin_path . 'front/images/' . basename($files_array[$i]['filename']); if (is_file($src)) { copy($src, $dst); } } $tables_array = array(TABLE_BANNERS_GROUP); $tmp_array = $lng->get_language_tables(TABLE_BANNERS); $tables_array = array_merge($tables_array, $tmp_array); $database_backup->save_tables($this->admin_path . 'database.sql', $tables_array); $msg->add_session(sprintf(SUCCESS_PLUGIN_DATABASE_BACKUP, $db->prepare_input($this->title)), 'success'); return true; }
function generate_collection_link($abstract_zone_id) { extract(tep_load('database')); $result = false; $check_query = $db->query("select seo_name from " . TABLE_SEO_TO_ABSTRACT . " where abstract_zone_id = '" . (int) $abstract_zone_id . "'"); if (!$db->num_rows($check_query)) { return $result; } $check_array = $db->fetch_array($check_query); $db->query("delete from " . TABLE_SEO_URL . " where seo_url_get like '%" . $db->input($check_array['seo_name']) . "%'"); $cAbstract = new abstract_zones(); $class_name = $cAbstract->get_zone_class($abstract_zone_id . false); $script = 'FILENAME_COLLECTIONS'; $files_array = tep_get_file_array(tep_front_physical_path(DIR_WS_CATALOG_INCLUDES) . 'filenames.php'); if (!isset($files_array[$script])) { return $result; } $script = $files_array[$script]; $osc_link = tep_catalog_href_link($script, 'abz_id=' . (int) $abstract_zone_id); $link = $this->get_naked_link($osc_link); $osc_md5 = md5($link); $db->query("delete from " . TABLE_SEO_URL . " where osc_url_key = '" . $db->input($osc_md5) . "'"); $seo_link = $check_array['seo_name'] . $this->default_extension; $seo_md5 = md5($seo_link); $check_query = $db->query("select seo_url_key from " . TABLE_SEO_URL . " where seo_url_key = '" . $db->input($seo_md5) . "'"); if (!$db->num_rows($check_query)) { $sql_data_array = array('seo_url_key' => $db->prepare_input($seo_md5), 'seo_url_get' => $db->prepare_input($seo_link), 'osc_url_key' => $db->prepare_input($osc_md5), 'seo_url_org' => $db->prepare_input($link), 'date_added' => 'now()', 'last_modified' => 'now()'); $db->perform(TABLE_SEO_URL, $sql_data_array); $db->query("truncate table " . TABLE_SEO_CACHE); $result = true; } return $result; }
// http://www.oscommerce.com // Copyright (c) 2003 osCommerce ------------------------------------------------------------------------------ // Released under the GNU General Public License //---------------------------------------------------------------------------- // */ $action = isset($_GET['action']) ? tep_sanitize_string($g_db->prepare_input($_GET['action'])) : ''; $img_alt = isset($_POST['img_alt']) ? tep_sanitize_string($g_db->prepare_input($_POST['img_alt'])) : ''; $img_desc = isset($_POST['img_desc']) ? tep_sanitize_string($g_db->prepare_input($_POST['img_desc'])) : ''; $img_popup = isset($_POST['img_popup']) ? tep_sanitize_string($g_db->prepare_input($_POST['img_popup'])) : ''; $img_group_name = isset($_POST['img_group_name']) ? tep_sanitize_string($g_db->prepare_input($_POST['img_group_name'])) : ''; $img_thumb = isset($_POST['img_thumb']) ? true : false; $org_image = $image = isset($_POST['image']) ? tep_sanitize_string($g_db->prepare_input($_POST['image'])) : ''; $resize_image = ''; $fs_dir = tep_front_physical_path(DIR_WS_CATALOG_IMAGES); $length = strlen(DIR_WS_CATALOG); $rel_path = substr(DIR_WS_CATALOG_IMAGES, $length); $image = substr($image, strlen($rel_path)); $tmp_array = explode('.', $image); if (!is_array($tmp_array) || count($tmp_array) != 2 || strlen($tmp_array[0]) < 1 || !file_exists($fs_dir . $image)) { $action = 'error'; } switch ($action) { case 'error': break; default: $resize_flag = false; $width = isset($_POST['width']) ? (int) $_POST['width'] : ''; $height = isset($_POST['height']) ? (int) $_POST['height'] : ''; if (!$width && $height) {
tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action') . 'action=values_list')); } break; case 'delete_value_confirm': if (isset($_POST['mark']) && is_array($_POST['mark'])) { foreach ($_POST['mark'] as $key => $val) { $g_db->query("delete from " . TABLE_FORM_VALUES . " where form_values_id= '" . (int) $key . "' and form_fields_id= '" . (int) $fID . "' and form_options_id = '" . (int) $oID . "'"); } } tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action') . 'action=values_list')); break; case 'remove_values_image': if (isset($_GET['pm_id']) && tep_not_null($_GET['pm_id'])) { $check_query = $g_db->query("select form_values_image from " . TABLE_FORM_VALUES . " where form_values_id= '" . (int) $_GET['pm_id'] . "' and form_fields_id= '" . (int) $fID . "' and form_options_id = '" . (int) $oID . "'"); if ($check_array = $g_db->fetch_array($check_query)) { $images_path = tep_front_physical_path(DIR_WS_CATALOG_IMAGES); if (strlen($check_array['form_values_image']) > 4 && file_exists($images_path . $check_array['form_values_image'])) { @unlink($images_path . $check_array['form_values_image']); clearstatcache(); } $g_db->query("update " . TABLE_FORM_VALUES . " set form_values_image = '' where form_values_id= '" . (int) $_GET['pm_id'] . "' and form_fields_id= '" . (int) $fID . "' and form_options_id = '" . (int) $oID . "'"); } } tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action', 'pm_id') . 'action=values_list')); break; case 'values_list': break; case 'options_list': break; case 'list': break;
function display_multi_entries() { extract(tep_load('defs', 'database')); clearstatcache(); $html_string = ''; $html_string .= ' <div class="comboHeading splitLine">' . "\n" . ' <div class="floater" style="padding-right: 8px;"><b>' . TEXT_INFO_UPLOAD_IMAGES . ':</b></div>' . "\n" . ' <div class="floater"><a href="#" id="image_upload">' . tep_image(DIR_WS_ICONS . 'icon_upload_head.png', TEXT_INFO_UPLOAD_IMAGES) . '</a></div>' . "\n" . ' </div>' . "\n" . ' <div class="comboHeading">' . "\n" . ' <div>' . TEXT_SELECT_MULTIENTRIES . '</div>' . "\n" . ' </div>' . "\n" . ' <div class="formArea">' . tep_draw_form('mc', $cDefs->script, tep_get_all_get_params('action') . 'action=insert_multi_entries', 'post') . '<table class="tabledata">' . "\n" . ' <tr class="dataTableHeadingRow">' . "\n" . ' <th class="calign"><a href="#gt_id" class="page_select" title="' . TEXT_PAGE_SELECT . '">' . tep_image(DIR_WS_ICONS . 'icon_tick.png', TEXT_PAGE_SELECT) . '</a></th>' . "\n" . ' <th>' . TABLE_HEADING_ENTRIES . tep_draw_hidden_field('multi_form', 'insert_multi_entries') . '</th>' . "\n" . ' <th>' . TABLE_HEADING_LAST_MODIFIED . '</th>' . "\n" . ' </tr>' . "\n"; $rows = 0; $images_path = tep_front_physical_path(DIR_WS_CATALOG_IMAGES); $switch_folder = $images_path . $this->m_sID; $current_dir = getcwd(); $dir = dir($switch_folder); chdir($switch_folder); $files_array = array(); $subdirs_array = array(); if (!empty($this->m_sID)) { $subdirs_array[] = ''; } while (false !== ($script = $dir->read())) { if (substr($script, 0, 1) != '.' && is_dir($script)) { $subdirs_array[] = $switch_folder . $script; } elseif (substr($script, 0, 1) != '.' && !is_dir($script)) { if (!empty($this->m_sID)) { $files_array[] = $this->m_sID . '/' . $script; } else { $files_array[] = $script; } } } chdir($current_dir); sort($subdirs_array, SORT_STRING); sort($files_array, SORT_STRING); $j = count($subdirs_array); if ($j) { foreach ($subdirs_array as $dirkey => $dirname) { if (empty($dirname)) { $tmp_array = explode('/', $this->m_sID); array_pop($tmp_array); if (count($tmp_array)) { array_pop($tmp_array); } $attr = implode('/', $tmp_array); $dirname = TEXT_INFO_UP_ONE_LEVEL; $folder_image = 'folder_up.png'; } else { $attr = trim(basename($dirname), ' /'); $folder_image = 'folder_image.png'; if (!empty($this->m_sID)) { $attr = $this->m_sID . $attr; } $dirname = $attr; } $rows++; $row_class = $rows % 2 ? 'dataTableRowYellow' : 'dataTableRowYellowLow'; if (!empty($attr)) { $mod_time = date("m/d/Y H:i:s", filemtime($images_path . $attr)); } else { $mod_time = TEXT_INFO_NA; } $html_string .= ' <tr class="' . $row_class . '">' . "\n" . ' <td class="calign"><a href="' . tep_href_link($cDefs->script, tep_get_all_get_params('sID') . 'sID=' . $attr) . '">' . tep_image(DIR_WS_ICONS . 'icon_folder.png', $dirname) . '</a></td>' . "\n" . ' <td><a href="' . tep_href_link($cDefs->script, tep_get_all_get_params('sID') . 'sID=' . $attr) . '">' . $dirname . '</a></td>' . "\n" . ' <td>' . $mod_time . '</td>' . "\n" . ' </tr>' . "\n"; } } $bCheck = false; foreach ($files_array as $filekey => $filename) { $check_query = $db->query("select abstract_zone_id, image_key, image_title from " . TABLE_IMAGE_ZONES . " where abstract_zone_id = '" . (int) $this->m_zID . "' and image_key = '" . $db->filter(md5($filename)) . "'"); $bCheck = $db->num_rows($check_query) ? true : false; $rows++; $row_class = $rows % 2 ? 'dataTableRow' : 'dataTableRowAlt'; if ($bCheck) { $row_class = 'dataTableRowGreen'; } $final_name = basename($filename); $mod_time = date("m/d/Y H:i:s", filemtime($images_path . $filename)); $html_string .= ' <tr class="' . $row_class . '">' . "\n" . ' <td class="calign">' . ($bCheck ? 'Included' : tep_draw_checkbox_field('gt_id[' . md5($filename) . ']', $filename)) . '</td>' . "\n" . ' <td><a href="' . $cDefs->cserver . DIR_WS_CATALOG_IMAGES . $filename . '" target="_blank">' . $final_name . '</a></td>' . "\n" . ' <td>' . $mod_time . '</td>' . "\n" . ' </tr>' . "\n"; } $buttons = array('<a href="' . tep_href_link($cDefs->script, tep_get_all_get_params('action', 'sID') . 'action=list') . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>', tep_image_submit('button_insert.gif', IMAGE_INSERT)); $html_string .= ' </table><div class="formButtons">' . implode('', $buttons) . '</div></form></div>' . "\n" . ' <div class="listArea splitLine">' . "\n" . ' <div class="floater">' . sprintf(TEXT_DISPLAY_NUMBER_OF_ENTRIES, 1, count($files_array), count($files_array)) . '</div>' . "\n" . ' </div>' . "\n"; return $html_string; }
function delete_files() { $result_array = array(); $fs_dir = tep_front_physical_path('', false); $result_front = $this->delete_paths($this->files_array, $fs_dir, $this->front == 1); $fs_dir = ''; $result_admin = $this->delete_paths($this->admin_files_array, $fs_dir); $result_array = array_merge($result_front, $result_admin); if (isset($_POST['zip'])) { if (!$this->create_zip_plugin()) { return $result_array; } $pdir = DIR_FS_PLUGINS . $this->key . '/'; $root_array = glob($pdir . '*'); foreach ($root_array as $value) { if (is_file($value)) { if ($this->key . '.zip' == basename($value)) { continue; } @unlink($value); } else { tep_erase_dir($value); } } } return $result_array; }
function tep_catalog_calculate_image($src, &$width, &$height, $relative_path = 0) { extract(tep_load('defs')); $images_path = tep_front_physical_path(DIR_WS_CATALOG_IMAGES); if ($relative_path == 1) { $rel_path = $cDefs->cserver . DIR_WS_CATALOG_IMAGES; } elseif ($relative_path == 2) { $rel_path = ''; } else { $length = strlen(DIR_FS_CATALOG); $rel_path = substr($images_path, $length); } $resize = true; // Get the image's information if ($image_size = @getimagesize($images_path . $src)) { if (!is_array($image_size) || count($image_size) < 2 || !$image_size[0] || !$image_size[1]) { $image = '<img src="' . DIR_WS_CATALOG_TEMPLATE . 'design/' . IMAGE_NOT_AVAILABLE . '"'; return tep_image_params($image, $alt, $width, $height, $params); } if (tep_image_dimensions($width, $height, $image_size[0], $image_size[1])) { $image = $cDefs->crelpath . 'fly_thumb.php?no_cache=1&img=' . $rel_path . $src . '&w=' . tep_output_string($width) . '&h=' . tep_output_string($height); return $image; } else { $image = $cDefs->cserver . DIR_WS_CATALOG_IMAGES . $src; return $image; } } return ''; }
function delete_references() { extract(tep_load('database')); $tables_array = $db->get_tables(); if (isset($tables_array[TABLE_DOWNLOAD])) { $files_query_raw = "select filename from " . TABLE_DOWNLOAD . " where filename != ''"; $files_array = $db->query_to_array($files_query_raw, false, false); $path = tep_front_physical_path(DIR_WS_CATALOG); for ($i = 0, $j = count($files_array); $i < $j; $i++) { if (is_file($path . $files_array[$i]['filename'])) { unlink($path . $files_array[$i]['filename']); } } } $db->query("drop table if exists " . TABLE_DOWNLOAD); }
$sql_data_array = array('content_id' => (int) $_POST['content_id'], 'content_type' => (int) $_POST['content_type'], 'content_name' => $content_name, 'content_text' => $g_db->prepare_input($_POST['content_text']), 'filename' => $direct_filename, 'sort_id' => (int) $_POST['sort_id'], 'status_id' => isset($_POST['status_id']) ? 1 : 0); $g_db->perform(TABLE_DOWNLOAD, $sql_data_array, 'update', "auto_id='" . (int) $ddID . "'"); $messageStack->add_session(SUCCESS_ENTRY_UPDATED, 'success'); tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action', 'type_id', 'ddID') . 'ddID=' . $ddID)); break; case 'delete_confirm': if (isset($_POST['auto_id']) && !empty($_POST['auto_id'])) { $auto_id = (int) $_POST['auto_id']; $check_query = $g_db->query("select filename from " . TABLE_DOWNLOAD . " where auto_id = '" . (int) $auto_id . "'"); if (!$g_db->num_rows($check_query)) { $messageStack->add_session(ERROR_DOWNLOAD_INVALID); tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action', 'type_id', 'ddID'))); } $check_array = $g_db->fetch_array($check_query); if (!empty($check_array['filename'])) { $path = tep_front_physical_path(DIR_WS_CATALOG); unlink($path . $check_array['filename']); } $g_db->query("delete from " . TABLE_DOWNLOAD . " where auto_id = '" . (int) $auto_id . "'"); $messageStack->add_session(SUCCESS_ENTRY_REMOVED, 'success'); } tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action', 'type_id', 'ddID'))); break; case 'delete_all': if (!isset($_POST['mark']) || !is_array($_POST['mark']) || !count($_POST['mark'])) { $messageStack->add_session(ERROR_NOTHING_SELECTED); tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action', 'type_id'))); } break; case 'delete_all_confirm': if (!isset($_POST['mark']) || !is_array($_POST['mark']) || !count($_POST['mark'])) {
<th><?php echo TABLE_HEADING_DB_STRING; ?> </th> <th><?php echo TABLE_HEADING_LANGUAGE_TABLES; ?> </th> <th class="calign"><?php echo TABLE_HEADING_ACTION; ?> </th> </tr> <?php $rows = 0; $fs_includes = tep_front_physical_path(DIR_WS_CATALOG_INCLUDES); $all_tables = tep_get_file_array($fs_includes . 'database_tables.php'); $tables = array(); $args = array('tables' => &$tables); $g_plugins->invoke('languages_sync', $args); $all_tables = array_merge($all_tables, $args['tables']); unset($all_tables['TABLE_LANGUAGES']); ksort($all_tables); $language_tables = $g_lng->get_all_tables(); foreach ($all_tables as $def => $table_string) { $rows++; $row_class = $rows % 2 ? 'dataTableRow' : 'dataTableRowAlt'; $bCheck = false; $tables_array = $g_lng->get_tables($def); if ((empty($dID) || $dID == $def) && !isset($dInfo)) { $tmp_array = array('def' => $def, 'tables' => $tables_array);
function get_string_file_path($plugin_name, $file, $physical = false) { $result_array = array(); $fs_plugins = $physical ? tep_front_physical_path(DIR_WS_CATALOG_STRINGS) : DIR_WS_CATALOG_STRINGS; foreach ($this->languages as $id => $value) { $path = $fs_plugins . tep_trail_path($value['language_path']) . tep_trail_path($plugin_name); $result_array[] = $path . $file; } return $result_array; }
function tep_read_dir($dir, $area = 0, $pulldown = true, $ext = 'php') { $scripts_array = array(); if ($area == 1) { $fs_dir = tep_front_physical_path($dir); } else { $fs_dir = $dir; } rtrim($fs_dir, ' /'); $cDir = dir($fs_dir); if (!is_object($cDir)) { return; } while (false !== ($script = $cDir->read())) { if (!empty($ext)) { $check_array = explode('.', $script); if (!count($check_array) || $check_array[count($check_array) - 1] != $ext) { continue; } } $scripts_array[strtolower($script)] = array('id' => $script, 'text' => $script); } $cDir->close(); ksort($scripts_array, SORT_STRING); if (!$pulldown) { $scripts_array = tep_array_invert_flat($scripts_array, 'text', 'text'); } $scripts_array = array_values($scripts_array); return $scripts_array; }