function create_references() { extract(tep_load('database')); tep_define_vars($this->admin_path . 'back/admin_defs.php'); $fields_array = $db->query_to_array("show fields from " . TABLE_CUSTOMERS); $fields_names = tep_array_invert_flat($fields_array, 'Field', 'Field'); if (!isset($fields_names['newsletter'])) { $db->query("alter table " . TABLE_CUSTOMERS . " add newsletter text null"); } $check_query = $db->query("select group_id from " . TABLE_TEMPLATES_GROUPS . " where group_title = '" . $db->filter(PLUGIN_NEWSLETTER_TEMPLATE_GROUP) . "'"); if (!$db->num_rows($check_query)) { $sql_data_array = array('group_title' => $db->prepare_input(PLUGIN_NEWSLETTER_TEMPLATE_GROUP)); $db->perform(TABLE_TEMPLATES_GROUPS, $sql_data_array); } }
if (!empty($priority_filter)) { $where_array[] = "ht.priority_id = '" . $g_db->input($priority_filter) . "'"; } $order_array[] = "ht.ticket_id desc"; $tables_string = implode(', ', $tables_array); $where_string = ''; if (!empty($where_array)) { $where_string = "where " . implode(' and ', $where_array); } $order_string = "order by " . implode(',', $order_array); $tickets_query_raw .= " " . $tables_string . " " . $where_string . $group_string . $order_string; $entries_split = new splitPageResults($tickets_query_raw, MAX_DISPLAY_ADMIN_HELP_DESK); $entries_query = $g_db->query($entries_split->sql_query); $entry_status_array = tep_array_invert_flat($statuses_array, 'id', 'text'); $entry_priority_array = tep_array_invert_flat($priorities_array, 'id', 'text'); $entry_department_email_array = tep_array_invert_flat($departments_email_array, 'id', 'text'); $row_array = array('dataTableRowGreenLite', 'dataTableRowYellowLow', 'dataTableRowHigh', 'dataTableRowBlueLite'); $rows = 0; while ($entries = $g_db->fetch_array($entries_query)) { $rows++; $row_class = $rows % 2 ? 'dataTableRow' : 'dataTableRowAlt'; $ticket_query = $g_db->query("select helpdesk_entries_id, sender, subject, ip_address, datestamp from " . TABLE_HELPDESK_ENTRIES . " where ticket_id = '" . (int) $entries['ticket_id'] . "' and parent_id = '0'"); $ticket_array = $g_db->fetch_array($ticket_query); $entries_query_raw = "select helpdesk_entries_id from " . TABLE_HELPDESK_ENTRIES . " where ticket_id = '" . (int) $entries['ticket_id'] . "'"; $entries_array = $g_db->query_to_array($entries_query_raw, 'helpdesk_entries_id'); $postings_query = $g_db->query("select count(*) as count from " . TABLE_HELPDESK_ENTRIES . " where ticket_id = '" . (int) $entries['ticket_id'] . "' and parent_id != '0'"); $postings = $g_db->fetch_array($postings_query); $unread_query = $g_db->query("select count(*) as count from " . TABLE_HELPDESK_ENTRIES . " where ticket_id = '" . (int) $entries['ticket_id'] . "' and entry_read = '0'"); $unread = $g_db->fetch_array($unread_query); $last_post_query = $g_db->query("select email_address from " . TABLE_HELPDESK_ENTRIES . " where ticket_id = '" . (int) $entries['ticket_id'] . "' order by helpdesk_entries_id desc limit 1"); $last_post = $g_db->fetch_array($last_post_query);
$data_array = $g_db->get_table_fields($dID); $fields_array = $data_array['fields_array']; $primary_array = $data_array['primary_array']; $last_keys = $data_array['primary_keys_array']; $primary_string = implode(',', $primary_array); $table_query_raw = "select " . $primary_string . " from " . $table_string . " order by " . $primary_string; $table_split = new splitPageResults($table_query_raw); $table_query = $g_db->query($table_split->sql_query); $rows = 0; $lArray = $g_lng->get_tables($dID); $lArray = array_flip($lArray); unset($lArray[$table_string]); $lArray = array_values(array_flip($lArray)); $default_language_array = $g_lng->get_table_language($table_string); $base_language = $default_language_array['language_name']; $field_names = tep_array_invert_flat($fields_array, 'Field', 'Field'); for ($i = 0, $j = count($primary_array); $i < $j; $i++) { $field_names[$primary_array[$i]] = '<span class="required">' . $field_names[$primary_array[$i]] . '</span>'; } ?> <div class="comboHeading"> <div><h2><?php echo TEXT_INFO_FIELD; ?> </h2></div> <div><b><?php echo implode(' | ', $field_names); ?> </b></div> </div> <div class="formArea"><?php
function get_banners() { extract(tep_load('defs', 'database')); $result_array = array(); $content_type = 0; switch ($cDefs->script) { case FILENAME_GENERIC_PAGES: $content_type = 1; break; case FILENAME_COLLECTIONS: $content_type = 2; break; default: $content_type = 0; break; } $result_array = $db->query_to_array("select auto_id, group_id, filename, content_id, content_name, content_type, content_link from " . TABLE_BANNERS . " where (content_type = '" . (int) $content_type . "' or content_type = '0') and status_id = 1 order by sort_id"); if (empty($result_array)) { return $result_array; } $tmp_array = tep_array_invert_flat($result_array, 'group_id', 'group_id'); $groups_array = $db->query_to_array("select group_id, group_pos, group_type, group_width, group_height from " . TABLE_BANNERS_GROUP . " where group_id in (" . implode(',', array_keys($tmp_array)) . ")", 'group_id'); $tmp_array = array(); for ($i = 0, $j = count($result_array); $i < $j; $i++) { $group_id = $result_array[$i]['group_id']; $tmp_array[$group_id] = isset($tmp_array[$group_id]) ? count($tmp_array[$group_id]) : 0; $result_array[$i]['group_pos'] = $groups_array[$group_id]['group_pos']; } foreach ($tmp_array as $group_id => $count) { if ($groups_array[$group_id]['group_type'] == 1 && $count) { $index = 0; $keep = tep_rand(0, $count); for ($i = 0, $j = count($result_array); $i < $j; $i++) { if ($result_array[$i]['group_id'] == $group_id) { if ($keep != $index) { unset($result_array[$i]); } $index++; } } $result_array = array_values($result_array); } } return $result_array; }
function form_fields() { $this->flat_array = tep_array_invert_flat($this->types_array, 'id', 'text'); }
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; }