/** * Initialize the products form */ public function initialize($entity = null, $options = array()) { $f = new text("url_base"); $f->setLabel('URL BASE'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new select("ativo", array('1' => 'Sim', '0' => 'Não')); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new select("manutencao", array('1' => 'Sim', '0' => 'Não')); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new select("orcamento", array('1' => 'Sim', '0' => 'Não')); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new select("adicionar_carrinho", array('1' => 'Sim', '0' => 'Não')); $f->setLabel('Adicionar Carrinho'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("plano"); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new numeric("limite_produtos"); $f->setLabel('Limite de Produtos'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new select("certificado", array('certising' => 'Certising', 'comodo' => 'Comodo', 'norton' => 'Norton', 'rapidssl' => 'Rapid SSL', 'site_blindado' => 'Site Blindado')); $f->setAttribute('class', 'form-control'); $this->add($f); }
/** * Initialize the products form */ public function initialize($entity = null, $options = array()) { $f = new text("aws_bucket"); $f->setLabel('AWS Bucket'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("aws_id"); $f->setLabel('AWS ID'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("aws_location"); $f->setLabel('AWS LOCATION'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("aws_secret_key"); $f->setLabel('AWS SECRET KEY'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("facebook_appId"); $f->setLabel('Facebook app id'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("facebook_appSecret"); $f->setLabel('Facebooke app secret'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("sendgrid_username"); $f->setLabel('Sendgrid username'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("sendgrid_password"); $f->setLabel('sendgrid password'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("sendgrid_templateId"); $f->setLabel('sendgrid template ID'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new TextArea("mapa"); $f->setLabel('Google Maps'); $f->setAttribute('class', 'form-control'); $f->setAttribute('rows', '10'); $this->add($f); $f = new TextArea("chat"); $f->setLabel('Chat'); $f->setAttribute('class', 'form-control'); $f->setAttribute('rows', '10'); $this->add($f); }
public function reset() { if ($this->owner->logged_in()) { url::redirect('/admin/testimonials/display'); } $login_shell = new View('admin/login_shell'); $login_shell->content = new View('admin/reset'); if (empty($_POST)) { die($login_shell); } $post = new Validation($_POST); $post->pre_filter('trim'); $post->add_rules('email', 'required', 'valid::email'); # if Post is good, atttempt to log owner in. if ($post->validate()) { $owner = ORM::factory('owner')->find($_POST['email']); if (!$owner->loaded) { die('email does not have an account'); } $pw = text::random('alnum', 8); $owner->password = $pw; $owner->save(); $replyto = 'unknown'; $body = "Your auto-generated password is: {$pw} \r\n" . "Change your password to something more appropriate by going here:\r\n" . "http://pluspanda.com/admin/account?old={$pw} \r\n\n" . "Thank you! - Jade from pluspanda"; # to do FIX THE HEADERS. $subject = 'Your Pluspanda Password Has Been Reset =)'; $headers = "From: noreply@pluspanda.com \r\n" . "Reply-To: Jade \r\n" . 'X-Mailer: PHP/' . phpversion(); mail($_POST['email'], $subject, $body, $headers); die('Please check your email for your new password!'); } # error $login_shell->content->alert = alerts::display(array('error' => 'Invalid Email or Password.')); $login_shell->content->values = $_POST; die($login_shell); }
protected function create_token() { // Token will always be 64 chars, as uniqid is 13 chars $unique = uniqid(); $hard_to_guess = text::random('alnum', 51); return $unique . $hard_to_guess; }
/** * quickbox::__construct() * * @param array $init Initialization configuration * * Constructor which basically creates quickbox * and readies it for doing things. */ public function __construct ($init) { # We need to include initialize the config class because it allows us to get and # set configuration variables without using a global require $init['quickbox/path'] . '/classes/core/config.class.php'; config::init($init); define(DEBUG, config::get('debug')); # Start a database connection $this->db = new database(); try { $this->db->init(); } catch (Exception $e) { trigger_error(text::get('system/fatalError',$e->getMessage()), E_USER_ERROR); } require $init['quickbox/path'] . '/classes/core/metaclass.class.php'; metaclass::init($this->db); # Put the post and get variables into a private for later use. $_POST = $_POST; $this->qbGet = $_GET; # Start the session, giving it the database connection. $this->qbSession = new session($this->db); if ($this->qbGet['page'] == 'logout') { $this->qbSession->logout(); } $this->qbSession->checkCookie(); if (strlen($_POST['user']) > 0 && $_POST['login'] == 1) { $this->qbErrors['login'] = $this->qbSession->login($_POST['user'], $_POST['password']); } $this->qbPage = ($_GET['page'] ? janitor::cleanData($_GET['page']) : 'home'); }
public function login ($user, $password) { $safeUser = janitor::cleanData($user, 'sql'); $query = new query(); $query->select()->from('userUsers')->joinLeft('userGroups', 'userUsers.group', 'id')->where('username', $user)->limit( '1'); $result = $this->sDb->query($query); if ($this->sDb->numRows($result) > 0) { $row = $this->sDb->assoc($result); $safePassword = janitor::passwd($password, $row['salt']); if ($safePassword['passwd'] == $row['password']) { $this->user = $user; $this->userData = $row; $this->setCookie($user, $row['email']); $this->setSession($safeUser); return false; } else { return text::get('login/failedLogin'); } } else { return text::get('login/failedLogin'); } }
private function getUri() { self::$URL = $_SERVER['HTTP_HOST']; // $URI = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['PHP_SELF']); // var_dump($_SERVER['SCRIPT_NAME'], $_SERVER['PHP_SELF']); $URI = $_SERVER['REQUEST_URI']; list(self::$URN) = explode("?", $URI); // remove '?' self::$URI = self::$URL . self::$URN; if (strlen(self::$URN) > 2 && substr(self::$URN, -1, 1) == "/") { self::$URN = substr(self::$URN, 0, -1); } $arr = explode("/", substr(self::$URN, 1)); foreach ($arr as $val) { self::$URNPart[] = $val; } list(self::$URL) = explode(":", self::$URL); // remove ':' port $arr = explode(".", self::$URL); foreach ($arr as $val) { self::$URLPart[] = $val; } self::$subdomain = implode(".", array_slice(self::$URLPart, 0, -2)); Log::log(self::CLASSNAME, 'URN: ' . self::$URN); Log::log(self::CLASSNAME, 'URL: ' . self::$URL); Log::log(self::CLASSNAME, 'URI: ' . self::$URI); Log::log(self::CLASSNAME, 'URN parts: ' . text::arrayToString(self::$URNPart, true)); Log::log(self::CLASSNAME, 'URL parts: ' . text::arrayToString(self::$URLPart, true)); Log::log(self::CLASSNAME, 'Subdomain: ' . self::$subdomain); }
/** * 列表 */ public function index() { //查询条件 $query_struct = array('orderby' => array('id' => 'DESC')); /* 搜索 */ $search_arr = array('title', 'content'); $search_type = $this->input->get('search_type'); $search_value = $this->input->get('search_value'); if (!empty($search_value) && in_array($search_type, $search_arr)) { $query_struct['like'][$search_type] = $search_value; } $where_view['search_value'] = $search_value; //调用分页 $per_page = controller_tool::per_page(); $query_struct['per_page'] = $per_page; $this->pagination = new Pagination(array('total_items' => Mynotice::instance()->count($query_struct), 'items_per_page' => $per_page)); $query_struct['per_page'] = $this->pagination->sql_offset; $notice = Mynotice::instance()->lists($query_struct); foreach ($notice as $k => $v) { $notice[$k]['content_small'] = strip_tags(text::limit_words($v['content'], 30)); $notice[$k]['manager_id'] = Mymanager::instance($v['manager_id'])->get('name'); } //VIEW $this->template->content = new View("manage/notice_list"); $this->template->content->notice = $notice; $this->template->content->where = $where_view; }
public static function token() { if (($token = Session::instance()->get('csrf')) === FALSE) { Session::instance()->set('csrf', $token = text::random('alnum', 16)); } return $token; }
/** @function QPHeader Encodes given string as a quoted printable mail header. @param str string String to encode @return string */ public static function QPHeader($str, $charset = 'UTF-8') { if (!preg_match('/[^\\x00-\\x3C\\x3E-\\x7E]/', $str)) { return $str; } return '=?' . $charset . '?Q?' . text::QPEncode($str) . '?='; }
/** * 列表 */ public function index() { $query_struct = array(); /** * 搜索 */ $search_value = $this->input->get('search_value'); if ($search_value) { $query_struct['where']['mail_category_id'] = $search_value; } //调用分页 $per_page = controller_tool::per_page(); $this->pagination = new Pagination(array('total_items' => Mymail_template::instance()->count($query_struct), 'items_per_page' => $per_page)); $mail_templates = Mymail_template::instance()->mail_templates($query_struct, array('id' => 'DESC'), $per_page, $this->pagination->sql_offset); foreach ($mail_templates as $k => $v) { foreach ($v as $key => $value) { if (!is_numeric($value) && empty($value)) { $mail_templates[$k][$key] = 'NULL'; } } $mail_templates[$k]['content_small'] = strip_tags(text::limit_words($v['content'], 30)); $mail_templates[$k]['active_img'] = view_tool::get_active_img($v['active']); } $mail_categories = Mymail_category::instance()->mail_categories(); $this->template->content = new View("manage/mail_template_list"); $this->template->content->mail_templates = $mail_templates; $this->template->content->mail_categories = $mail_categories; }
public function save() { if (!$_POST) { die; } $this->rsp = Response::instance(); if (!valid::email($_POST['email'])) { $this->rsp->msg = 'Invalid Email!'; $this->rsp->send(); } elseif ($this->owner->unique_key_exists($_POST['email'])) { $this->rsp->msg = 'Email already exists!'; $this->rsp->send(); } $pw = text::random('alnum', 8); $this->owner->email = $_POST['email']; $this->owner->password = $pw; $this->owner->save(); $replyto = 'unknown'; $body = "Hi there, thanks for saving your progess over at http://pluspanda.com \r\n" . "Your auto-generated password is: {$pw} \r\n" . "Change your password to something more appropriate by going here:\r\n" . "http://pluspanda.com/admin/account?old={$pw} \r\n\n" . "Thank you! - Jade from pluspanda"; # to do FIX THE HEADERS. $subject = 'Your Pluspanda account information =)'; $headers = "From: welcome@pluspanda.com \r\n" . "Reply-To: Jade \r\n" . 'X-Mailer: PHP/' . phpversion(); mail($_POST['email'], $subject, $body, $headers); # add to mailing list. include Kohana::find_file('vendor/mailchimp', 'MCAPI'); $config = Kohana::config('mailchimp'); $mailchimp = new MCAPI($config['apikey']); $mailchimp->listSubscribe($config['list_id'], $_POST['email'], '', 'text', FALSE, TRUE, TRUE, FALSE); $this->rsp->status = 'success'; $this->rsp->msg = 'Thanks, Account Saved!'; $this->rsp->send(); }
/** * Cache data. * * @return void */ public static function cache() { if (!Profiler::show('cache')) { return; } $queries = Cache::$queries; $table = new Profiler_Table(); $table->add_column(); $table->add_column('kp-column kp-data'); $table->add_column('kp-column kp-data'); $table->add_column('kp-column kp-data'); $table->add_row(array('Cache', 'Gets', 'Sets', 'Deletes'), 'kp-title', 'background-color: #E0FFE0'); text::alternate(); $total_gets = $total_sets = $total_deletes = 0; $total_requests = array(); foreach ($queries as $type => $requests) { foreach ($requests as $query) { if (!isset($total_requests[$query])) { $total_requests[$query] = array('gets' => 0, 'sets' => 0, 'deletes' => 0); } $total_requests[$query][$type]++; } } foreach ($total_requests as $query => $types) { $data = array($query, $types['gets'], $types['sets'], $types['deletes']); $class = text::alternate('', 'kp-altrow'); $table->add_row($data, $class); $total_gets += $types['gets']; $total_sets += $types['sets']; $total_deletes += $types['deletes']; } $data = array('Total: ' . count($total_requests), $total_gets, $total_sets, $total_deletes); $table->add_row($data, 'kp-totalrow'); Profiler::add($table); }
/** * Generates a new Captcha challenge. * * @return string The challenge answer */ public function generate_challenge() { // Complexity setting is used as character count $text = text::random('distinct', max(1, Captcha::$config['complexity'])); // Complexity setting is used as character count return $text; }
/** * 分类列表 */ public function index() { //* 权限验证 */ $site_id = site::id(); Myseo_manage::instance()->update_seo_manage_by_site_id($site_id); if ($site_id == 0) { remind::set('请首先进入所要操作的站点', request::referrer(), 'error'); } $site_id_list = role::check('seo_manage', 0, 0); if (empty($site_id_list)) { remind::set('access denied', request::referrer(), 'error'); } $query_struct = array(); $query_struct = array('where' => array('site_id' => $site_id)); $list_columns = array(array('name' => 'ID', 'column' => 'id', 'class_num' => '1'), array('name' => '分类', 'column' => 'parent_id', 'class_num' => '4'), array('name' => '包含子分类', 'column' => 'is_contain_child', 'class_num' => '3'), array('name' => 'Meta Title', 'column' => 'meta_title', 'class_num' => '5'), array('name' => 'Meta Keywords', 'column' => 'meta_keywords', 'class_num' => '5'), array('name' => 'Meta Description', 'column' => 'meta_description', 'class_num' => '6'), array('name' => '发布时间', 'column' => 'create_timestamp', 'class_num' => '5'), array('name' => '更新时间', 'column' => 'update_timestamp', 'class_num' => '5')); $this->template->content = new View("product/seo_manage_list"); $this->template->content->list_columns = $list_columns; /** * 搜索 */ /* $search_arr = array('site_domain','site_id'); $search_type = $this->input->get('search_type'); $search_value = $this->input->get('search_value'); if($search_value&&$search_type) { if(in_array($search_type,$search_arr)) { $query_struct['like'][$search_type] = $search_value; } }*/ //调用分页 $per_page = controller_tool::per_page(); $this->pagination = new Pagination(array('total_items' => Myseo_manage::instance()->count($query_struct), 'items_per_page' => $per_page)); $orderby = array('update_timestamp' => 'DESC'); $seo_manages = Myseo_manage::instance()->seo_manages($query_struct, $orderby, $per_page, $this->pagination->sql_offset); $request_category = array('where' => array('site_id' => $site_id), 'like' => array(), 'orderby' => array()); $category = Mycategory::instance()->lists($request_category); foreach ($category as $val) { $category_list[$val['id']] = $val; } foreach ($seo_manages as $seo_manages_key => $seo_manages_value) { $seo_manages[$seo_manages_key]['is_contain_child'] = view_tool::get_active_img($seo_manages_value['is_contain_child']); $seo_manages[$seo_manages_key]['meta_description'] = strip_tags(text::limit_words($seo_manages_value['meta_description'], 50)); $seo_manages[$seo_manages_key]['create_timestamp'] = date('Y-m-d H:i:s', $seo_manages_value['create_timestamp']); $seo_manages[$seo_manages_key]['update_timestamp'] = date('Y-m-d H:i:s', $seo_manages_value['update_timestamp']); if ($seo_manages_value['parent_id'] && array_key_exists($seo_manages_value['parent_id'], $category_list)) { $seo_manages[$seo_manages_key]['parent_id'] = $category_list[$seo_manages_value['parent_id']]['name']; } else { $seo_manages[$seo_manages_key]['parent_id'] = ''; } foreach ($seo_manages_value as $key => $value) { if (!is_numeric($value) && empty($value)) { $seo_manages[$seo_manages_key][$key] = "NULL"; } } } $this->template->content->seo_manages = $seo_manages; }
function form ($action, $method = 'post', $id = null, $invalid = false, $title = false, $submitted = false) { $this->header .= '<form action="' . $action . '" method="' . $method . '"' . ($id ? " id=\"$id\"" : null) . '><fieldset>'; if ($title) { $this->header .= '<h2>' . $title . '</h2>'; } if ($submitted) { $this->header .= '<br/>'; if (count($invalid) > 0) { $this->header .= '<h6>' . text::get('validation/errorsProcessing') . '</h6><br/>'; foreach ($invalid as $k => $v) { $this->header .= '<p class="error">' . $v . '</p>'; } } else { $this->header .= '<p class="success">' . text::get('validation/success') . '</p>'; } } $this->footer .= ' <p> <button type="submit" class="button positive"> <img src="' . config::get( 'site/htmlRoot') . 'css/blueprint/plugins/buttons/icons/tick.png" alt="Save"/> ' . text::get('form/save') . ' </button> <button type="reset" class="button negative"> <img src="' . config::get('site/htmlRoot') . 'qbres/images/no.png" alt="Reset"/> ' . text::get( 'form/reset') . ' </button></p> </fieldset></form>'; }
/** * 列表 */ public function index() { $mails = Mymail::instance()->mails(); foreach ($mails as $k => $v) { $mails[$k]['content_small'] = strip_tags(text::limit_words($v['content'], 30)); $mails[$k]['active_img'] = view_tool::get_active_img($v['active']); } $this->template->content = new View("site/mail_list"); $this->template->content->mails = $mails; }
/** * Generates an returns a randon token for CSRF * prevention * * @param bool $replace Whether to replace the current token * @return string */ public static function token($replace = FALSE) { $token = Session::instance()->get(self::$_csrf_session_key); if (!$token or $replace) { // Generates a hash of variable length random alpha-numeric string $token = hash('sha256', text::random('alnum', rand(25, 32))); Session::instance()->set('csrf-token', $token); } return $token; }
/** * Finds a new unique token, using a loop to make sure that the token does * not already exist in the database. This could potentially become an * infinite loop, but the chances of that happening are very unlikely. * * @return string */ protected function create_token() { while (true) { // Create a random token $token = text::random('alnum', 32); // Make sure the token does not already exist if ($this->db->select('id')->where('token', $token)->get($this->table_name)->count() === 0) { return $token; } } }
public function full() { $posts = ORM::factory('feedpost')->{$feed}->where(array('status_id' => 2))->find_all(); $items = array(); foreach ($posts as $item) { $items[] = array("pubDate" => $item->get_date('r'), "title" => $item->title, "description" => text::limit_words($item->text, 200), "item_is_complete" => 1, "link" => "http://" . $_SERVER['HTTP_HOST'] . $item->get_url()); } $channel = array("title" => ORM::factory('setting', 'COMPANY_NAME')->value . " - " . $feed->title, "description" => $feed->description, "link" => "http://" . $_SERVER['HTTP_HOST'] . url::base(), "items" => $items); $rss = new RSS_Writer($channel); echo $rss->get_feed(); }
public function reset_password() { $str = text::random($type = 'alnum', $length = 10); $this->password = $str; $subject = "Your password has been reset for " . $_SERVER['HTTP_HOST']; $message = "Your username is: " . $this->username . "\n\n"; $message .= "Your new password is: " . $str . "\n\n"; $message .= "You can reset it from the profile section of the user area"; $this->save(); email::send($this->email, 'admin@' . str_replace('www.', '', $_SERVER['HTTP_HOST']), $subject, $message, FALSE); }
/** * Overload saving to set the created time and to create a new token * when the object is saved. */ public function save() { if ($this->loaded === FALSE) { $this->created = time(); $this->token = text::random('alnum', 6); } else { $this->updated = time(); } $this->url = str_replace('http://', '', strtolower($this->url)); #$this->body_edit = json_encode($this->body_edit); return parent::save(); }
/** * Transliterate UTF8 text to lowercase 7bit ASCII, 0-9a-z * * @param string $str * @return string */ public static function clean($str) { $str = mb_strtolower(text::strip_ascii_ctrl($str)); if (!text::is_ascii($str)) { $str = strtolower(text::transliterate_to_ascii($str)); } if (!text::is_ascii($str)) { $str = text::strip_non_ascii($str); } return $str; // return strtolower(iconv(Kohana::CHARSET, 'ASCII//TRANSLIT//IGNORE', $str)); }
/** * Finds a new unique token, using a loop to make sure that the token does * not already exist in the database. This could potentially become an * infinite loop, but the chances of that happening are very unlikely. * * @return string */ public function create_token() { while (TRUE) { // Create a random token $token = text::random('alnum', 32); // Make sure the token does not already exist if (!Jelly::select('user_token')->where('token', '=', $token)->count()) { // A unique token has been found return $token; } } }
/** * Finds a new unique token, using a loop to make sure that the token does * not already exist in the database. This could potentially become an * infinite loop, but the chances of that happening are very unlikely. * * @return string */ protected function create_token() { while (TRUE) { // Create a random token $token = text::random('alnum', 32); // Make sure the token does not already exist $count = DB::select('id')->where('token', '=', $token)->from($this->_table_name)->execute($this->_db)->count(); if ($count === 0) { // A unique token has been found return $token; } } }
/** * Create root user */ public function action_root() { echo '<h1>Root Account:</h1>'; $pass = text::random('alnum', 8); $user = Sprig::factory('user')->values(array('username' => 'root', 'email' => '*****@*****.**', 'password' => $pass, 'password_confirm' => $pass, 'role' => 'admin')); try { $user->create(); echo 'Root user created, password is ' . $pass . '.'; } catch (Exception $e) { echo 'Error creating root user.'; throw $e; } }
/** * Initialize the products form */ public function initialize($entity = null, $options = array()) { $f = new select("template_nome", array('7store' => '7store', 'Bewear' => 'Bewear', 'Bohase' => 'Bohase', 'Classic' => 'Classic', 'Everything' => 'Everything', 'Hosoren' => 'Hosoren', 'Micra' => 'Micra', 'ShopMe' => 'ShopMe', 'Smile' => 'Smile', 'Unicase' => 'Unicase')); $f->setLabel('Template Nome'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("template_variacao"); $f->setLabel('Template Variação'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("imagem_size"); $f->setLabel('Imagem Size'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("thumbnail_size"); $f->setLabel('Thumbnail Size'); $f->setAttribute('class', 'form-control'); $this->add($f); $f = new text("paginacao_tipo"); $f->setLabel('Paginaçao Tipo'); $f->setAttribute('class', 'form-control'); $this->add($f); }
/** * Get newsfeed item as HTML * * @param Newsfeed_Model $item * @return string */ public static function get(NewsFeedItem_Model $item) { $text = ''; switch ($item->type) { case self::TYPE_COMMENT: $gallery = new Gallery_Model($item->data['gallery_id']); $image = new Image_Model($item->data['image_id']); if ($gallery->loaded() && $image->loaded()) { $text = __('commented to an image in :gallery', array(':gallery' => html::anchor(url::model($gallery) . '/' . $image->id, text::title($gallery->name), array('title' => $gallery->name)))); } break; } return $text; }
/** * Get CSRF token * * @param mixed $id Custom token id, e.g. uid * @param string $action Optional action * @param integer $time * @return string */ public static function token($id = '', $action = '', $time = 0) { // Get id string for token, could be uid or ip etc if (!$id) { $id = Input::instance()->ip_address(); } // Get time to live if (!$time) { $time = ceil(time() / self::$ttl); } // Get session specific salt if (!isset($_SESSION['csrf_secret'])) { $_SESSION['csrf_secret'] = text::random('alnum', 16); } return md5($time . $_SESSION['csrf_secret'] . $id . $action); }
function formField ($name, $title, $value = null, $linkfield, $properties) { $cvs = metaclass::getClassVars($properties['requirements']['real']); if (metaclass::$db->tableExists($cvs['table'])) { $query = new query(); $query->select(array ( 'id' , 'title' ))->from($cvs['table']); $result = metaclass::$db->query($query); $return .= '<label for="' . $name . '"> ' . $title . ' </label><br/> <select id="' . $name . '" name="' . $name . '">'; while ($row = metaclass::$db->assoc($result)) { $return .= '<option value="' . $row['id'] . '"' . ($row['id'] == $value ? ' selected' : null) . '>' . $row['title'] . '</option>'; } $return .= '</select> <br/>'; } else { $return .= '<label for="' . $name . '"> ' . $title . ' </label><br/>'; $return .= '<p class="error">' . text::get('form/foreignTableNotExist', $cvs['title']) . '</p>'; } return $return; }