function action_comments_remove() { $comm = new table("comments"); $id = intval($_GET["id"]); $comm->delete($id); show_msg("删除成功", $_SERVER["HTTP_REFERER"]); }
function table_nodes() { global $construct, $db, $main; $form_search_nodes = $this->form_search_nodes(); $where = $form_search_nodes->db_data_where(array("nodes__name" => "starts_with")); if ($main->userdata->privileges['admin'] !== TRUE) { $where = "users.status = 'activated'" . ($where != '' ? ' AND (' . $where . ')' : ""); } $table_nodes = new table(array('TABLE_NAME' => 'table_nodes')); $table_nodes->db_data('nodes.id, nodes.name AS nodes__name, areas.name AS areas__name', 'nodes LEFT JOIN areas ON nodes.area_id = areas.id LEFT JOIN regions ON areas.region_id = regions.id ' . 'INNER JOIN users_nodes ON nodes.id = users_nodes.node_id ' . 'LEFT JOIN users ON users.id = users_nodes.user_id', $where != '' ? $where : "", "nodes.id", "nodes.id ASC"); $table_nodes->db_data_search($form_search_nodes); for ($i = 1; $i < count($table_nodes->data); $i++) { if (isset($table_nodes->data[$i])) { $table_nodes->data[$i]['nodes__name'] .= " (#" . $table_nodes->data[$i]['id'] . ")"; $table_nodes->info['PICKUP_VALUE'][$i] = $table_nodes->data[$i]['id']; $table_nodes->info['PICKUP_OUTPUT'][$i] = $table_nodes->data[$i]['nodes__name']; } } $table_nodes->info['PICKUP_COLUMN'] = 'nodes__name'; $table_nodes->info['PICKUP_OBJECT'] = stripslashes(get('object')); $table_nodes->db_data_remove('id'); return $table_nodes; }
function __construct() { parent::__construct(); $geometryColumnsObj = new table("settings.geometry_columns_view"); $this->rows = $geometryColumnsObj->getRecords(); $this->rows = $this->rows['data']; }
function updateCartoMobileSettings($data, $_key_) { $table = new table("settings.geometry_columns_join"); $data = $table->makeArray($data); $cartomobileArr = (array) json_decode($this->getValueFromKey($_key_, "cartomobile")); foreach ($data as $value) { $safeColumn = $table->toAscii($value->column, array(), "_"); if ($value->id != $value->column && $value->column && $value->id) { unset($cartomobileArr[$value->id]); } $cartomobileArr[$safeColumn] = $value; } $conf['cartomobile'] = json_encode($cartomobileArr); $conf['_key_'] = $_key_; $table->updateRecord(json_decode(json_encode($conf)), "_key_"); $this->execQuery($sql, "PDO", "transaction"); if (!$this->PDOerror || !$sql) { $response['success'] = true; $response['message'] = "Column renamed"; } else { $response['success'] = false; $response['message'] = $this->PDOerror[0]; } return $response; }
function query($argv = '') { error_reporting(7); $table_queryer_file = __DIR__ . DIRECTORY_SEPARATOR . 'ThinkPHP-Queryer'; $content = file_get_contents($table_queryer_file); $sep = '##########################################################################'; $arr_content = split($sep, $content); $sql = trim($arr_content[0]); connect_db($argv); $result = mysql_query($sql); $rows = array(); if ($result) { $i = 0; while ($row = mysql_fetch_assoc($result)) { if ($i == 0) { $header = array_keys($row); } $i++; $rows[] = array_values($row); } } require __DIR__ . '/table.php'; $in = array('header' => $header ? $header : array(), 'rows' => $rows); // file_put_contents('./', data); file_put_contents('./debug.php', var_export($in, 1)); if ($rows) { $table = new table($in); $output = $table->render(0); } if (!$output) { $output = 'no results!'; } exit($output); }
function get_table() { $obj_test = new table(); @$obj_test->create_table(); @$obj_test->create_content(); //@table::create_table(); }
function table_dns() { global $construct, $db, $vars; $form_search_dns = $this->form_search_dns(); if (substr($form_search_dns->data[1]['value'], -strlen("." . $vars['dns']['root_zone'])) == "." . $vars['dns']['root_zone']) { $form_search_dns->data[1]['value'] = substr($form_search_dns->data[1]['value'], 0, -strlen("." . $vars['dns']['root_zone'])); } $where = $form_search_dns->db_data_where(array("dns_zones__name" => "starts_with")); $table_dns = new table(array('TABLE_NAME' => 'table_dns', 'FORM_NAME' => 'table_dns')); $table_dns->db_data('dns_zones.id AS dns_zones__id, dns_zones.name AS dns_zones__name, dns_zones.type, dns_zones.date_in, dns_zones.status, nodes.name AS nodes__name, nodes.id AS nodes__id', 'dns_zones LEFT JOIN nodes ON dns_zones.node_id = nodes.id', $where, "", "dns_zones.status ASC, dns_zones.type ASC, dns_zones.name ASC"); for ($i = 1; $i < count($table_dns->data); $i++) { if (isset($table_dns->data[$i])) { $table_dns->data[$i]['nodes__name'] .= " (#" . $table_dns->data[$i]['nodes__id'] . ")"; if ($table_dns->data[$i]['type'] == 'forward') { $table_dns->data[$i]['dns_zones__name'] .= "." . $vars['dns']['root_zone']; } $table_dns->info['EDIT'][$i] = makelink(array("page" => "nodes", "node" => $table_dns->data[$i]['nodes__id'])); } } $table_dns->info['EDIT_COLUMN'] = 'nodes__name'; $table_dns->db_data_remove('dns_zones__id', 'type', 'nodes__id'); $table_dns->db_data_translate('dns_zones__status'); return $table_dns; }
/** 统计单个地区出现的次数; */ static function stat_single_area($area) { global $DBR; $pw = new table("pw_threads"); $row = $pw->findROW("count(*) as c", "fid=" . BBS_BID . " AND subject like '%" . mysql_escape_string($area) . "%'"); return intval($row["c"]); }
private function parseTable(DOMNode $tableNode) { $table = new table($tableNode->getAttribute('name')); $allFieldsList = $tableNode->getElementsByTagName('field'); for ($i = 0; $i < $allFieldsList->length; $i++) { $fieldNode = $allFieldsList->item($i); $table->addField($this->parseField($fieldNode)); } $utags = $tableNode->getElementsByTagName('unique'); $ftag = $utags->item(0); $uniqueKeys = $ftag->nodeValue; //only one unique key supported $table->addUniqueKeys(explode(',', $uniqueKeys)); $utags = $tableNode->getElementsByTagName('primary'); $ftag = $utags->item(0); $pKey = $ftag->nodeValue; $table->setPrimaryAutocountKey($pKey); $allRowsList = $tableNode->getElementsByTagName('row'); for ($i = 0; $i < $allRowsList->length; $i++) { $rowNode = $allRowsList->item($i); $table->addRow($this->parseRow($rowNode, $table->getFields(), $i)); } $table->setNewID($tableNode->getAttribute('newID')); return $table; }
function table_ip_ranges() { global $construct, $db; $form_search_ranges = $this->form_search_ranges(); $where = $form_search_ranges->db_data_where(array('ip' => 'exclude')); $table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges')); $s_ip = $form_search_ranges->data[0]['value']; $where = $where != '' ? "(" . $where . ") AND " : ""; if ($s_ip != '') { $where .= '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 1)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 1)) . ") OR " . '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 2)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 2)) . ") OR " . '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 3)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 3)) . ") AND "; } //$where = // ($s_ip !=''?"ip_ranges.ip_start <= ".ip2long($s_ip)." AND ip_ranges.ip_end >= ".ip2long($s_ip)." AND ":""); if ($where != '') { $where = substr($where, 0, -5); } #@# $table_ip_ranges->db_data('"" AS ip_range, ip_ranges.ip_start, ip_ranges.ip_end, ip_ranges.date_in, ip_ranges.status, nodes.name AS nodes__name, nodes.id AS nodes__id, communities.name AS communities__name', 'ip_ranges LEFT JOIN nodes ON ip_ranges.node_id = nodes.id LEFT JOIN communities ON nodes.community_id = communities.id', $where != '' ? "(" . $where . ")" : "", "", "ip_ranges.status ASC, ip_ranges.ip_start ASC"); #@# foreach ((array) $table_ip_ranges->data as $key => $value) { if ($key != 0) { $table_ip_ranges->data[$key]['ip_start'] = long2ip($table_ip_ranges->data[$key]['ip_start']); $table_ip_ranges->data[$key]['ip_end'] = long2ip($table_ip_ranges->data[$key]['ip_end']); $table_ip_ranges->data[$key]['ip_range'] = $table_ip_ranges->data[$key]['ip_start'] . " - " . $table_ip_ranges->data[$key]['ip_end']; $table_ip_ranges->data[$key]['nodes__name'] .= " (#" . $table_ip_ranges->data[$key]['nodes__id'] . ")"; $table_ip_ranges->info['EDIT'][$key] = makelink(array("page" => "nodes", "node" => $table_ip_ranges->data[$key]['nodes__id'])); } } $table_ip_ranges->info['EDIT_COLUMN'] = 'nodes__name'; $table_ip_ranges->db_data_remove('ip_start', 'ip_end', 'nodes__id'); $table_ip_ranges->db_data_translate('ip_ranges__status'); return $table_ip_ranges; }
function table_ip_ranges() { global $construct, $db, $lang; $form_search_ranges = $this->form_search_ranges(); $where = $form_search_ranges->db_data_where(array('ip' => 'exclude', 'nodes__name' => 'starts_with', "total_active_p2p" => 'exclude', "total_active_aps" => 'exclude')); $table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges')); $where = $where != '' ? "(" . $where . ") AND " : ""; if ($form_search_ranges->data[0]['value'] != '') { $where .= "("; $s_ranges = ip_to_ranges($form_search_ranges->data[0]['value']); foreach ($s_ranges as $s_range) { $where .= "(ip_ranges.ip_start BETWEEN " . ip2long($s_range['min']) . " AND " . ip2long($s_range['max']) . ") OR "; } $where = substr($where, 0, -4) . ") AND "; } if ($where != '') { $where = substr($where, 0, -5); } $having = $form_search_ranges->db_data_where(array('ip' => 'exclude', 'ip_ranges__status' => 'exclude', 'ip_ranges__delete_req' => 'exclude', 'nodes__id' => 'exclude', 'nodes__name' => 'exclude')); $table_ip_ranges->db_data('ip_ranges.id, "" AS ip_range, ip_ranges.ip_start, ip_ranges.ip_end, ip_ranges.date_in, ip_ranges.status, ip_ranges.delete_req, COUNT(DISTINCT p2p.id) AS total_active_p2p, COUNT(DISTINCT aps.id) AS total_active_aps, "" AS total_active_peers', 'ip_ranges ' . 'LEFT JOIN nodes ON ip_ranges.node_id = nodes.id LEFT JOIN links ON ip_ranges.node_id = links.node_id AND links.status = "active" LEFT JOIN links AS p2p ON links.type = "p2p" AND links.peer_node_id = p2p.node_id AND p2p.type = "p2p" AND p2p.peer_node_id = links.node_id AND p2p.status = "active" LEFT JOIN links as aps ON links.type = "ap" AND links.id = aps.id', $where, "ip_ranges.id" . ($having != '' ? ' HAVING (' . $having . ')' : ""), "ip_ranges.date_in DESC, ip_ranges.status ASC"); $table_ip_ranges->db_data_search($form_search_ranges); foreach ((array) $table_ip_ranges->data as $key => $value) { if ($key != 0) { $table_ip_ranges->data[$key]['ip_start'] = long2ip($table_ip_ranges->data[$key]['ip_start']); $table_ip_ranges->data[$key]['ip_end'] = long2ip($table_ip_ranges->data[$key]['ip_end']); $table_ip_ranges->data[$key]['ip_range'] = $table_ip_ranges->data[$key]['ip_start'] . " - " . $table_ip_ranges->data[$key]['ip_end']; } } $table_ip_ranges->db_data_multichoice('ip_ranges', 'id'); for ($i = 1; $i < count($table_ip_ranges->data); $i++) { if (isset($table_ip_ranges->data[$i])) { $table_ip_ranges->data[$i]['total_active_peers'] = ($table_ip_ranges->data[$i]['total_active_p2p'] > 0 ? $table_ip_ranges->data[$i]['total_active_p2p'] . " " . $lang['backbones_abbr'] : "") . ($table_ip_ranges->data[$i]['total_active_aps'] > 0 ? " + " . $table_ip_ranges->data[$i]['total_active_aps'] . " " . $lang['aps_abbr'] : ""); $table_ip_ranges->info['EDIT'][$i] = make_ref('/hostmaster/range', array("iprange" => $table_ip_ranges->data[$i]['id'])); } } $table_ip_ranges->info['EDIT_COLUMN'] = 'ip_range'; $table_ip_ranges->info['MULTICHOICE_LABEL'] = 'delete'; $table_ip_ranges->db_data_remove('id', 'ip_start', 'ip_end', 'total_active_p2p', 'total_active_aps'); $table_ip_ranges->db_data_translate('ip_ranges__status', 'ip_ranges__delete_req'); return $table_ip_ranges; }
public function __construct(PDO $pdo, table $table, array $parameters = array(), array $data = array()) { $this->pdo = $pdo; $this->table = $table; $this->fields = ''; $this->order = $table->getDefaultOrder(); $this->limit = array(); $this->data = $data; $this->queryType = ''; $this->queryText = ''; $this->parameters = $parameters; $this->validationRules = $table->getValidationRules(); }
function table_nodes() { global $construct, $db, $main, $lang; $form_search_nodes = $this->form_search_nodes(); $where = $form_search_nodes->db_data_where(array("nodes__name" => "starts_with", "total_active_peers" => 'exclude', "total_active_clients" => 'exclude', "has_ap" => 'exclude')); $having = $form_search_nodes->db_data_where(array("nodes__id" => "exclude", "nodes__name" => "exclude", "areas__id" => "exclude", "regions__id" => "exclude", "has_ap" => 'exclude')); if ($form_search_nodes->data[6]['value'] != '') { $having .= ($having != '' ? ' AND ' : '') . 'total_active_aps ' . ($form_search_nodes->data[6]['value'] == 'Y' ? '>' : '=') . ' 0'; } $table_nodes = new table(array('TABLE_NAME' => 'table_nodes')); $table_nodes->db_data('nodes.id, nodes.name AS nodes__name, areas.name AS areas__name, communities.name AS communities__name, COUNT(DISTINCT p2p.id) AS total_active_p2p, COUNT(DISTINCT aps.id) AS total_active_aps, COUNT(DISTINCT p2p.id)+COUNT(DISTINCT client.id) AS total_active_peers, COUNT(DISTINCT cl.id) AS total_active_clients, nodes.freeifs AS nodes__freeifs', 'nodes LEFT JOIN areas ON nodes.area_id = areas.id LEFT JOIN regions ON areas.region_id = regions.id LEFT JOIN communities ON nodes.community_id = communities.id LEFT JOIN links ON nodes.id = links.node_id AND links.status = "active" LEFT JOIN links AS client ON links.peer_ap_id = client.id AND links.type = "client" AND client.type = "ap" AND client.status = "active" LEFT JOIN links AS p2p ON p2p.peer_node_id = links.node_id AND links.peer_node_id = p2p.node_id AND links.type = "p2p" AND p2p.type = "p2p" AND p2p.status = "active" LEFT JOIN links AS aps ON nodes.id = aps.node_id AND aps.type = "ap" AND aps.status = "active" LEFT JOIN links AS cl ON cl.peer_ap_id = aps.id AND cl.type = "client" AND cl.status = "active" INNER JOIN users_nodes ON nodes.id = users_nodes.node_id LEFT JOIN users ON users.id = users_nodes.user_id', 'users.status = "activated"' . ($where != '' ? ' AND (' . $where . ')' : ""), 'nodes.id' . ($having != '' ? ' HAVING (' . $having . ')' : ""), "total_active_peers DESC, total_active_aps DESC, total_active_clients DESC, nodes.id"); $table_nodes->db_data_search($form_search_nodes); for ($i = 1; $i < count($table_nodes->data); $i++) { if (isset($table_nodes->data[$i])) { $table_nodes->data[$i]['nodes__name'] .= " (#" . $table_nodes->data[$i]['id'] . ")"; $table_nodes->data[$i]['total_active_peers'] = $table_nodes->data[$i]['total_active_peers'] . ($table_nodes->data[$i]['total_active_aps'] > 0 ? " (+" . $table_nodes->data[$i]['total_active_aps'] . " " . $lang['aps'] . ")" : ""); $table_nodes->info['EDIT'][$i] = makelink(array("page" => "nodes", "node" => $table_nodes->data[$i]['id'])); } } $table_nodes->info['EDIT_COLUMN'] = 'nodes__name'; $table_nodes->db_data_remove('id', 'total_active_p2p', 'total_active_aps'); return $table_nodes; }
function generate() { $this->appendSuperHeader(); $code = ""; $tables = $this->getTablesArray(); $code .= $this->getCodeStarter(); for ($a = 0; $a < count($tables); $a++) { $thisTable = new table($tables[$a], $this->getDb()); $fields = $thisTable->getFieldNameArray(); $code .= $this->getLineEnder(); $code .= "// " . $thisTable->getTableName() . " Table" . $this->getLineEnder(); $code .= "define(\"TABLE_" . strtoupper($tables[$a]) . "\",\"" . $thisTable->getTableName() . "\");" . $this->getLineEnder(); $code .= "// Primary Key for Table " . $thisTable->getTableName() . $this->getLineEnder(); $code .= "define(\"FIELD_" . strtoupper($tables[$a]) . "_PK\",\"" . $thisTable->getPrimaryKey() . "\");" . $this->getLineEnder(); $code .= "// Field Name Mapping for Table " . $thisTable->getTableName() . $this->getLineEnder(); for ($b = 0; $b < count($fields); $b++) { $code .= "define(\"FIELD_" . strtoupper($tables[$a]) . "_" . strtoupper($fields[$b]) . "\",\"" . $fields[$b] . "\");" . $this->getLineEnder(); } $code .= "// Display Labels of Field for Table " . $thisTable->getTableName() . $this->getLineEnder(); for ($c = 0; $c < count($fields); $c++) { $code .= "define(\"LABEL_" . strtoupper($tables[$a]) . "_" . strtoupper($fields[$c]) . "\",\"" . ucfirst(strtolower($fields[$c])) . "\");" . $this->getLineEnder(); } $code .= $this->getLineEnder(); } $code .= $this->getCodeEnder(); $this->appendToCode($code); $beautifulCode = codeBeautifier::beautify($this->getSourceCode()); return $beautifulCode; }
function table_communities() { global $construct, $db, $lang; $form_search_communities = $this->form_search_communities(); $where = ""; #$form_search_communities->db_data_where(); $table_communities = new table(array('TABLE_NAME' => 'table_communities', 'FORM_NAME' => 'table_communities')); $table_communities->db_data('communities.id, communities.name,communities.fullname, communities.windURL, communities.TOS, communities.dnstld, communities.ns1, communities.ns2, communities.admins', 'communities', $where, '', "communities.id ASC"); $table_communities->db_data_search($form_search_communities); foreach ((array) $table_communities->data as $key => $value) { if ($key != 0) { if ($table_communities->data[$key]['ns1']) { $table_communities->data[$key]['ns1'] = long2ip($table_communities->data[$key]['ns1']); #if ($table_services->data[$key]['protocol'] && $table_communities->data[$key]['port']) { # $table_services->data[$key]['ip'] .= ' ('.$lang['db']['nodes_services__protocol-'.$table_communities->data[$key]['protocol']].'/'.$table_communities->data[$key]['port'].')'; #} } if ($table_communities->data[$key]['ns2']) { $table_communities->data[$key]['ns2'] = long2ip($table_communities->data[$key]['ns2']); } $cadmins = explode(",", $table_communities->data[$key]['admins']); #print_r($cadmins);echo "admins<br>"; foreach ($cadmins as $key_name => $key_value) { $i++; #print_r($key_value); $queryusers = $db->query("SELECT\n\t\t\t\t\t\t\t\t\tusers.username\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\tusers\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tusers.id = '{$key_value}'\n\t\t\t\t\t\t\t\t\t"); $usernames = mysql_fetch_assoc($queryusers); #echo $usernames['username']; $cadmins[$key_name] = $usernames['username']; #echo $cadmins[$key_name]; #print_r($usernames); #$cadmins[$key_name]=$usernames[$i];#echo "users:$key_name:$key_value<br>"; print_r($usernames); #$new=implode(",",$usernames); #$basket = array_replace_recursive($base, $replacements);print_r($basket); #$usernames_comma_separated = implode(",", $usernames); #$basket = array_combine($cadmins, $usernames);print_r($basket); } #$basket = array_combine($cadmins, $usernames);print_r($basket); $table_communities->data[$key]['admins'] = implode(", ", $cadmins); # $cadmins->data[$k]['links__ip'] = $cadmins->data[$k]['links__ip'];#@# #$table_communities->data[$key]['nodes__name'] .= " (#".$table_communities->data[$key]['nodes__id'].")"; #$table_communities->info['LINK']['nodes__name'][$key] = makelink(array("page" => "nodes", "node" => $table_communities->data[$key]['nodes__id'])); #$table_communities->info['LINK']['services__title'][$key] = $table_communities->data[$key]['url']; } } #$table_communities->db_data_translate('communities__TOS'); $table_communities->db_data_remove('TOS'); return $table_communities; }
function selectKeywordGenerator($table, $db, $selectedFieldsArray = "", $orderByArray = "", $orderDirection = "", $startLimit = "", $numOfRows = "", $distinct = "", $wherePk = "") { $thisTable = new table($table, $db); $fieldNames = $thisTable->getFieldNameArray(); $whereString = " WHERE "; $fieldCount = count($fieldNames); for ($c = 0; $c < $fieldCount; $c++) { $whereString .= $fieldNames[$c] . " like '%\$thisKeyword%' "; if ($c != $fieldCount - 1) { $whereString .= " OR "; } } $this->setWhereString($whereString); $this->constructSQL($thisTable); }
function _make_user_table($n, &$data) { $dbh = getdbh(); //pagination $stmt = $dbh->query('SELECT count(*) "total" FROM "users"'); $rs = $stmt->fetch(PDO::FETCH_ASSOC); $total = $rs['total']; $limit = $GLOBALS['pagination']['per_page']; $data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>'; $data['body'][] = pagination::makePagination($n, $total, myUrl('users/manage'), $GLOBALS['pagination']); //table $stmt = $dbh->query("SELECT * FROM \"users\" LIMIT {$n},{$limit}"); $tablearr[] = explode(',', 'uid,username,password,fullname,created_dt,Action'); while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) { $uid = $rs['uid']; $row = null; foreach ($rs as $k => $v) { $row[$k] = htmlspecialchars($v); } $row[] = '<a href="' . myUrl("users/edit/{$uid}") . '">Edit</a> | <a href="javascript:jsconfirm(\'Really Delete User?\',\'' . myUrl("users/ops_delete/{$uid}") . '\')">Delete</a>'; $tablearr[] = $row; } $data['body'][] = table::makeTable($tablearr); $data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>'; }
public function __construct() { parent::__construct('buyer', array('id_buyer' => 'i', 'surname' => 's', 'name' => 's', 'middlename' => 's', 'address' => 's', 'number' => 's', 'hours' => 's', 'login' => 's', 'password' => 's')); parent::setFormFields(array('surname' => array('text', 'Фамилия'), 'name' => array('text', 'Имя'), 'middlename' => array('text', 'Отчество'), 'address' => array('text', 'Адрес'), 'number' => array('text', 'Телефон'), 'hours' => array('text', 'Желаемое время доставки'), 'login' => array('text', 'Логин'), 'password' => array('password', 'Пароль'))); //'id_hours' => array('radio', 'C 6 00 до 12 00 ','C 12 00 до 18 00 ','C 18 00 до 21 00 '))); parent::setValidationRules(array('surname' => '/[А-Яа-яЁё]{1,20}/', 'name' => '/[А-Яа-яЁё]{1,20}/', 'middlename' => '/[А-Яа-яЁё]{1,20}/', 'address' => '/[А-Яа-яЁё]{1,20}/', 'number' => '/\\b[0-9]{1,20}\\b/', 'hours' => '/\\b[0-9]{1,20}\\b/', 'login' => '/[A-Za-z]{1,20}/', 'password' => '/[A-Za-z]{1,20}/')); }
function _make_html_table($table, $item, $urlPrefix, $n, &$data) { $dbh = getdbh(); //pagination $stmt = $dbh->query("SELECT count(OID) total FROM {$table}"); $total = $stmt->fetchColumn(); $limit = $GLOBALS['pagination']['per_page']; $data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>'; $data['body'][] = pagination::makePagination($n, $total, myUrl("{$urlPrefix}/manage"), $GLOBALS['pagination']); //table $fields = "URL,stationId,lastContact,debug"; $stmt = $dbh->query("SELECT OID,CID,{$fields} FROM {$table} LIMIT {$n},{$limit}"); if ($stmt === false) { var_dump($dbh->errorInfo()); return; } $tablearr[] = explode(',', $fields); while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) { $OID = $rs['OID']; $CID = $rs['CID']; $row = null; foreach ($tablearr[0] as $f) { $row[] = htmlspecialchars($rs[$f]); } $row[] = '<a href="' . myUrl("{$urlPrefix}/ops_reset/{$OID}/{$CID}") . '">Reset</a> | ' . '<a href="' . myUrl("{$urlPrefix}/ops_shutdown/{$OID}/{$CID}") . '">Shutdown</a> | ' . '<a href="' . myUrl("{$urlPrefix}/edit/{$OID}/{$CID}") . '">Edit</a> | ' . '<a href="javascript:jsconfirm(\'Really Delete ' . $item . '?\',\'' . myUrl("{$urlPrefix}/ops_delete/{$OID}/{$CID}") . '\')">Delete</a>'; $tablearr[] = $row; } $data['body'][] = table::makeTable($tablearr); $data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>'; }
function table_areas() { global $construct, $db; $table_areas = new table(array('TABLE_NAME' => 'table_areas', 'FORM_NAME' => 'table_areas')); $table_areas->db_data('"" AS ip_range, areas.name AS areas__name, regions.name AS regions__name, areas.ip_start, areas.ip_end', 'areas LEFT JOIN regions ON areas.region_id = regions.id', "", "", "areas.ip_start ASC"); foreach ((array) $table_areas->data as $key => $value) { if ($key != 0) { $table_areas->data[$key]['ip_start'] = long2ip($table_areas->data[$key]['ip_start']); $table_areas->data[$key]['ip_end'] = long2ip($table_areas->data[$key]['ip_end']); $table_areas->data[$key]['ip_range'] = $table_areas->data[$key]['ip_start'] . " - " . $table_areas->data[$key]['ip_end']; } } $table_areas->db_data_remove('ip_start', 'ip_end'); return $table_areas; }
public function __construct() { parent::__construct(); $this->set_table(S_DB_PREFIX . 'message'); $this->set_where("mes_lang = '" . S_LANG . "'"); $this->set_order('mes_id'); }
function table_ip_ranges_v6() { global $construct, $db, $lang; $form_search_ranges_v6 = $this->form_search_ranges_v6(); $table_ip_ranges_v6 = new table(array('TABLE_NAME' => 'table_ip_ranges_v6', 'FORM_NAME' => 'table_ip_ranges_v6')); $table_ip_ranges_v6->db_data('ipv6_node_repos.v6net AS v6net, ip_ranges_v6.id AS v6net_id, ip_ranges_v6.date_in, ip_ranges_v6.status, ip_ranges_v6.delete_req', 'ip_ranges_v6, ipv6_node_repos ', 'ipv6_node_repos.id = ip_ranges_v6.v6net_id', "ip_ranges_v6.id", "ip_ranges_v6.date_in DESC, ip_ranges_v6.status ASC"); $table_ip_ranges_v6->db_data_search($form_search_ranges_v6); foreach ((array) $table_ip_ranges_v6->data as $key => $value) { if ($key != 0) { $table_ip_ranges_v6->data[$key]['v6net'] = inet_ntop($table_ip_ranges_v6->data[$key]['v6net']); } } $table_ip_ranges_v6->db_data_remove('v6net_id'); $table_ip_ranges_v6->db_data_translate('ip_ranges_v6__status', 'ip_ranges_v6__delete_req'); return $table_ip_ranges_v6; }
public function __construct() { parent::__construct('inkind', array('inkind' => 's', 'kindparent' => 's', 'id_inkind' => 'i', 'id_parent' => 'i')); parent::setDefaultOrder('id_parent asc'); parent::setTableSelect('inkind natural join kindparent'); parent::setFormFields(array('inkind' => array('text', 'Название вида'))); }
function refresh_users_modules($overwrite = false) { global $conex, $conf_default_lang; if ($overwrite || !isset($_SESSION['login']['modules'])) { $_SESSION['login']['modules'] = array(); $lang = $_SESSION['misc']['lang'] ? $_SESSION['misc']['lang'] : $conf_default_lang; $ob_table = new table('modules'); $sql = 'SELECT m.mod_id, m.tra_name, m.tra_desc, m.icon, um.read_ind, um.write_ind FROM ' . $ob_table->get_translated_table_name() . ' m INNER JOIN users_modules um ON um.mod_id = m.mod_id WHERE um.user_id = ' . $_SESSION['login']['user_id'] . ' AND um.read_ind = 1 AND m.active = 1 ORDER BY m.mod_order'; $select_modules = my_query($sql, $conex); while ($record = my_fetch_array($select_modules)) { $_SESSION['login']['modules'][$record['mod_id']] = array('name' => $record['tra_name'], 'desc' => $record['tra_desc'], 'icon' => $record['icon'], 'read' => $record['read_ind'], 'write' => $record['write_ind']); } } }
public function __construct() { parent::__construct('import', array('id_product' => 'i', 'id_buyer' => 'i')); // parent::setFormFields( // array('id_product' => array('text', '' ), // 'id_buyer' => array('text', '' ))); }
public function __construct() { parent::__construct('buyer', array('login' => 's', 'password' => 's')); parent::setFormFields(array('login' => array('text', 'Логин'), 'password' => array('password', 'Пароль'))); //'id_hours' => array('radio', 'C 6 00 до 12 00 ','C 12 00 до 18 00 ','C 18 00 до 21 00 '))); parent::setValidationRules(array('login' => '/[A-Za-z]{1,20}/', 'password' => '/[A-Za-z]{1,20}/')); }
public function __construct() { parent::__construct(); $this->set_table(S_DB_PREFIX . 'comment'); $this->set_where("com_lang = '" . S_LANG . "'"); $this->set_order('com_id'); }
function _make_html_table($n, &$data) { $dbh = getdbh(); //pagination $stmt = $dbh->query('SELECT count(OID) total FROM t_user'); $total = $stmt->fetchColumn(); $limit = $GLOBALS['pagination']['per_page']; $data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>'; $data['body'][] = pagination::makePagination($n, $total, myUrl('mgmt_user/manage'), $GLOBALS['pagination']); //table $stmt = $dbh->query("SELECT OID,CID,permissions,username,fullname FROM t_user LIMIT {$n},{$limit}"); $tablearr[] = explode(',', 'username,roll,fullname'); while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) { $OID = $rs['OID']; $CID = $rs['CID']; $row = null; $row['username'] = htmlspecialchars($rs['username']); $row['roll'] = htmlspecialchars(User::getPermissionsAsRollText($rs['permissions'])); $row['fullname'] = htmlspecialchars($rs['fullname']); $row[] = '<a href="' . myUrl("mgmt_user/edit/{$OID}/{$CID}") . '">Edit</a> | <a href="javascript:jsconfirm(\'Really Delete User?\',\'' . myUrl("mgmt_user/ops_delete/{$OID}/{$CID}") . '\')">Delete</a>'; $tablearr[] = $row; } $data['body'][] = table::makeTable($tablearr); $data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>'; }
public function __construct() { parent::__construct('buyer', array('id_buyer' => 'i', 'hours' => 's', 'address' => 's')); parent::setTableSelect('buyer natural join product'); parent::setFormFields(array('id_buyer' => array('', ''), 'hours' => array('text', 'Желаемое время'), 'address' => array('text', 'Адрес'))); //'id_hours' => array('radio', 'C 6 00 до 12 00 ','C 12 00 до 18 00 ','C 18 00 до 21 00 '))); parent::setValidationRules(array('hours' => '/\\b[0-9]{1,20}\\b/', 'address' => '/[А-Яа-яЁё]{1,20}/')); }
public static function footer($str = '') { table::$footer = $str; echo table::render(); table::$attrs = array(); table::$datas = array(); table::$footer = ''; }