Esempio n. 1
0
function tep_define_vars($metrics_file)
{
    $vars_array = tep_get_file_array($metrics_file);
    foreach ($vars_array as $key => $value) {
        if (defined($key)) {
            continue;
        }
        define($key, $value);
    }
    return true;
}
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
    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);
            $dInfo = new objectInfo($tmp_array);
Esempio n. 4
0
 function delete_table($def_table)
 {
     extract(tep_load('database'));
     $error = false;
     $fs_includes = tep_front_physical_path(DIR_WS_CATALOG_INCLUDES);
     $tables_array = tep_get_file_array($fs_includes . 'database_language.php');
     $update_language_file = isset($tables_array[$def_table]) ? true : false;
     $language_tables = $this->get_language_tables_detailed($def_table);
     if (empty($language_tables) || !isset($language_tables['default'])) {
         $table = constant($def_table);
     } else {
         $table = $language_tables['default'];
     }
     foreach ($this->languages as $language_id => $language_array) {
         $new_table = $table;
         if (empty($language_array['language_code'])) {
             continue;
         }
         $new_table .= '_' . $language_array['language_code'];
         $db->query("drop table if exists " . $new_table);
     }
     if ($update_language_file) {
         $old_contents = $header_string = '';
         $result = tep_read_contents($fs_includes . 'database_language.php', $old_contents);
         $matches = array();
         if ($result && !empty($old_contents) && preg_match('!/\\*.*?\\*/!s', $old_contents, $matches)) {
             $header_string = $matches[0];
         }
         unset($tables_array[$def_table]);
         $contents = '<?php' . "\r\n" . $header_string . "\r\n\r\n";
         foreach ($tables_array as $key => $value) {
             $contents .= '$' . $key . ' = \'' . $value . '\';' . "\r\n";
         }
         $contents .= '?>' . "\r\n";
         $result = tep_write_contents($fs_includes . 'database_language.php', $contents);
         if (!$result) {
             $error = sprintf(ERROR_WRITING_FILE, $fs_includes . 'database_language.php');
         }
     }
     return $error;
 }