static function show_menu(config $config, $num) { $result = sql_use::select_one($config->d_table, $config->d_columns[content], $config->d_columns[kind] . " = 12 and " . $config->d_columns[upid] . "=" . $num); $match = "/(元)\\s+|(元)\$|(\\/例)\\s+|(\\/例)\$|(:)/"; $result = preg_replace($match, "\$1\n", $result); // $match="/:/"; // $result = preg_replace($match, ":\n", $result); return $result; }
static function del_one($id = null, $kind = null, $upid = null, $author = null, $where = null) { if (!$author) { $author = data_use::get_usr('userid'); if (!$author) { die("请登录后重试!"); } $where = $where . " and " . self::$data_columns[author] . "=" . $author; //只能修改自己的 } $columns = self::$data_columns[content]; if ($id) { $where_plus = " and " . self::$data_id . "=" . $id; } if ($kind && $upid) { $where_plus = " and " . self::$data_columns[upid] . "=" . $upid . " and " . self::$data_columns[kind] . "='" . $kind . "'"; } if ($where_plus) { $where = $where . $where_plus; } sql_use::update_nowtime(self::$data_table, self::$data_columns[changetime], $where); $result = sql_use::update_delone(self::$data_table, $columns, $where); return $result; }
static function exist($table, $where) { $result = sql_use::select_row($table, $where); if (!empty($result)) { return $result; } else { return false; } }
static function delete($id, $ifupid = null, $where = null) { if (!$where) { $where = "1=1"; } if (1 == $ifupid) { $where_plus = " and " . self::$data_columns[upid] . "=" . $id; } else { $where_plus = " and (" . self::$data_id . "=" . $id . " or " . self::$data_columns[upid] . "=" . $id . ")"; } if ($where_plus) { $where = $where . $where_plus; } return sql_use::delet(self::$data_table, $where); }
protected function setting_in($where) { for ($i = 0; $i < count($this->columns); $i++) { if (!empty($this->values[$i])) { $update[] = "{$this->columns}[{$i}]='{$this->values}[{$i}]'"; } } sql_use::update($this->table, $update, $where); }