public function editAction($id, $type = '') { $config = zotop::model('zotop.config'); $config->id = $id; if (form::isPostBack()) { $post = form::post(); $post['settings'] = json_encode($post['settings']); $update = $config->update($post, $id); if ($update) { msg::success('保存成功,重新加载中,请稍后……', zotop::url('zotop/config/index', array('parentid' => $post['parentid']))); } msg::error(zotop::dump($post, true)); } $field = $config->read(); $field['settings'] = (array) json_decode($field['settings']); $type = empty($type) ? $field['type'] : $type; $field['type'] = $type; $page = new dialog(); $page->set('title', '编辑'); $page->set('body', array('style' => 'min-width:600px;')); $page->set('field', $field); $page->set('type', $type); $page->set('types', $config->types()); $page->set('controls', $config->controls()); $page->set('attrs', $config->attrs($type)); $page->display(); }
public function actionEdit($id) { $blog = zotop::model('blog.blog'); $status = $blog->status(); $category = zotop::model('blog.category'); $categorys = $category->getAll(); if (form::isPostBack()) { $post = form::post(); $blog->edit($post, $id); if (!$blog->error()) { msg::success('保存成功', form::referer()); } msg::error($blog->msg()); } //读取数据 $data = $blog->read($id); $categoryid = $data['categoryid']; //渲染页面 $page = new page(); $page->set('title', '编辑日志'); $page->set('navbar', $this->navbar($categoryid)); $page->set('globalid', $blog->globalid()); $page->set('data', $data); $page->set('status', $status); $page->set('categoryid', $categoryid); $page->set('categorys', $categorys); $page->display(); }
public function actionEdit($id, $type = '') { $config = zotop::model('system.config'); $config->id = $id; if (form::isPostBack()) { $post = form::post(); $post['settings'] = json_encode($post['settings']); $update = $config->update($post, $id); if ($update) { $config->cache(true); msg::success('保存成功,重新加载中,请稍后……', zotop::url('system/config/index/' . $post['parentid'])); } msg::error($update); } $field = $config->read(); $field['settings'] = (array) json_decode($field['settings']); //重新选择 if (!empty($type)) { $field['type'] = $type; } else { $type = $field['type']; } $page = new dialog(); $page->set('title', '编辑'); $page->set('body', array('style' => 'min-width:600px;')); $page->set('field', $field); $page->set('type', $type); $page->set('types', $config->getControlTypes()); $page->set('attrs', $config->getControlAttrs($type, $field)); $page->display(); }
public function run() { try { $form = new form(); $form->post('new_email')->val('is_email', '', 'Please enter a valid email address'); $form->post('new_user')->val('minlength', 5, 'Username is too short')->val('maxlength', 15, 'now it\'s too long!'); $form->post('new_pass')->val('minlength', 7, 'password is too short'); $to_check = $form->fetch('new_pass'); $form->post('new_pass_check')->val('confirm', $to_check, 'passwords do not match bruvnaar'); $form->submit(); $data = $form->fetch(); $this->model->createUser($data); } catch (Exception $e) { session::set('error_message', $e->getMessage()); header('Location: ../register'); } }
public function run() { try { $form = new form(); $form->post('username')->val('asci_check', '', 'No strange characters mind..'); $form->post('password'); if (isset($_POST['remember'])) { $form->post('remember'); } $form->submit(); $data = $form->fetch(); //print_r($data);die; $this->model->link($data); } catch (Exception $e) { $_SESSION = array(); $_SESSION['errors'] = $e->getMessage(); header('Location: ../login'); } }
public function subVal() { try { $form = new form(); $form->post('name')->val('minlength', 2)->val('maxlength', 20)->post('password')->val('minlength', 1)->val('maxlength', 20)->post2('password', 'passwordConfirm')->val('samepass', 'password', 'passwordConfirm'); $form->mit(); $data = $form->fetch(); $this->editSave($_SESSION['userId']); } catch (Exception $e) { $str = $form->mit2(); $this->view->ValError = $str; $this->edit(); } }
public function emailValidation() { try { $form = new form(); $form->post('email')->val('minlength', 5)->val('emailExist'); $form->mit(); $data = $form->fetch(); return $data['email']; // print_r($data); // $this->view->render('signup/reset'); } catch (Exception $e) { $str = $form->mit2(); $this->view->ValError = $str; // $this->view->render('signup/reset'); } }
function addNew_exec() { $response_array = array(); try { $form = new form(); $form->post('comp_name')->val('Individual / Company Name', 'minlength')->post('comp_reg_no')->post('comp_address')->val('Address', 'minlength')->post('comp_postcode')->val('Poscode', 'minlength')->post('comp_state')->val('State', 'minlength')->post('state_other')->val('State', 'minlength')->post('comp_country')->val('Country', 'minlength')->post('comp_phone1')->val('Phone 1', 'minlength')->post('comp_phone2')->post('comp_fax')->post('website')->post('category')->val('Category', 'minlength')->post('tag')->val('Keyword Tag', 'minlength')->post('desc')->val('Description', 'minlength')->post('salutation')->val('Salutation', 'minlength')->post('p_fullname')->val('Fullname', 'minlength')->post('p_pos')->post('p_phone')->post('p_mobile')->val('Mobile No.', 'minlength')->post('p_gender')->val('Gender', 'minlength')->post('comp_email')->val('Email', 'minlength')->post('regdate'); $form->submit(); $data = $form->fetch(); $result = $this->model->addNew_exec($data); $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } catch (Exception $e) { $response_array['r'] = 'false'; $response_array['msg'] = $e->getMessage(); } echo json_encode($response_array); }
function forgotPass() { $response_array = array(); try { $form = new form(); $form->post('email')->val('Email', 'email'); $form->submit(); $data = $form->fetch(); $result = $this->model->forgotPass_exec($data); $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } catch (Exception $e) { $response_array['r'] = 'false'; $response_array['msg'] = $e->getMessage(); } echo json_encode($response_array); }
public function update() { try { $form = new form(); $form->post('email')->val('minlength', 5)->val('subExist')->post('notify'); $form->mit(); $data = $form->fetch(); $this->model->updateEmail($data); $this->view->ValError2 = 'Email options successfully updated!'; header('location: ' . URL . 'email?email=' . $data['email']); // $this->view->render('email/index'); } catch (Exception $e) { $str = $form->mit2(); $this->view->ValError = $str; $this->view->render('email/index'); } }
public function actionEdit($id) { $category = zotop::model('blog.category'); if (form::isPostBack()) { $post = form::post(); $category->update($post, $id); if (!$category->error()) { msg::success('保存成功', zotop::url('blog/category/index')); } msg::error($category->msg()); } $category->id = $id; $data = $category->read(); $page = new dialog(); $page->set('title', '编辑分类'); $page->set('data', $data); $page->display(); }
public function actionTheme() { $config = zotop::model('system.config'); if (form::isPostBack()) { $post = form::post(); $config->save($post); if ($config->error()) { msg::error($config->msg()); } msg::success('保存成功'); } $theme = $config->fields('system.theme'); $page = new page(); $page->set('title', zotop::t('系统设置')); $page->set('navbar', $this->navbar()); $page->set('theme', $theme); $page->display(); }
public function actionUpload() { $config = zotop::model('zotop.config'); if (form::isPostBack()) { $post = form::post(); $save = $config->save($post); if ($save) { msg::success('保存成功,重新加载中,请稍后……'); } msg::error($save); } $fields = $config->fields('upload'); $page = new page(); $page->set('title', '上传设置'); $page->set('navbar', $this->navbar()); $page->set('fields', $fields); $page->display(); }
public function changeInfoAction() { $user = zotop::model('zotop.user'); $user->id = (int) zotop::user('id'); if (form::isPostBack()) { $post = form::post(); $update = $user->update($post, $user->id); if ($update) { msg::success('资料设置成功,正在刷新页面,请稍后……', url::current()); } msg::error(); } $data = $user->read(); $page = new page(); $page->title = '修改我的基本信息'; $page->set('navbar', $this->navbar()); $page->set('data', $data); $page->display(); }
public function addAction() { $user = zotop::model('zotop.user'); $usergroup = zotop::model('zotop.usergroup'); if (form::isPostBack()) { $post = form::post(); if (empty($post['id'])) { $post['id'] = $user->max('id') + 1; } if (empty($post['username'])) { msg::error('帐户名称不能为空'); } if (empty($post['password'])) { msg::error('帐户密码不能为空'); } if ($post['password'] != $_POST['_password']) { msg::error('两次输入的密码不一致'); } if ($user->isExist('username', $post['username'])) { msg::error('帐户名称<b>' . $post['username'] . '</b>已经存在'); } if ($user->isExist('email', $post['email'])) { msg::error('电子邮件<b>' . $post['email'] . '</b>已经存在'); } $post['password'] = $user->password($post['password']); $post['loginnum'] = $post['loginnum'] || 0; $post['createtime'] = $post['createtime'] || TIME; $post['modelid'] = 'system'; $insert = $user->insert($post); if ($insert) { msg::success('保存成功,正在返回列表页面,请稍后……', zotop::url('zotop/user')); } } //获取用户组 $usergroups = $usergroup->getIndex('system'); $page = new page(); $page->set('title', '添加新用户'); $page->set('position', $position); $page->set('navbar', $this->navbar()); $page->set('data', $data); $page->set('usergroups', $usergroups); $page->display(); }
public function actionInfo() { $user = zotop::model('system.user'); $user->id = (int) zotop::user('id'); if (form::isPostBack()) { $post = form::post(); $update = $user->update($post, $user->id); if ($update) { msg::success('资料设置成功,正在刷新页面,请稍后……', url::location()); } msg::error(); } $data = $user->read(); $page = new page(); $page->title = zotop::t('个人中心'); $page->set('navbar', $this->navbar()); $page->set('globalid', $user->globalid()); $page->set('data', $data); $page->display(); }
public function actionEdit($id) { $model = zotop::model('content.model'); if (form::isPostBack()) { $post = form::post(); $model->edit($post, $id); if (!$model->error()) { msg::success('保存成功', zotop::url('content/model/index/')); } msg::error($model->msg()); } $data = $model->read($id); $data['settings'] = $model->settings(); $page = new page(); $page->set('title', zotop::t('模型管理')); $page->set('position', array(zotop::url('content') => zotop::t('内容管理'), zotop::url('content/model') => zotop::t('模型管理'), zotop::t('编辑模型'))); $page->set('navbar', $this->navbar()); $page->set('data', $data); $page->display(); }
public function actionIndex() { $user = zotop::model('system.user'); if (form::isPostBack()) { $post = form::post(); $user->login($post); if (!$user->error()) { msg::success(zotop::t('登陆成功,系统正在加载中'), zotop::url(), 2); } msg::error($user->msg()); } if (!empty($this->user)) { header("Location: " . zotop::url()); exit; } $page = new page(); $page->set('title', zotop::t('系统管理登陆')); $page->set('body', array('class' => 'login')); $page->display(); }
function exec() { $response_array = array(); try { $form = new form(); $form->post('name')->val('Name', 'minlength')->post('email')->val('Email', 'email')->post('phone')->post('message')->val('Message', 'minlength'); $form->submit(); $data = $form->fetch(); $result = $this->model->exec($data); if ($result['r'] == 'true') { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } else { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } } catch (Exception $e) { $response_array['r'] = 'false'; $response_array['msg'] = $e->getMessage(); } echo json_encode($response_array); }
function exec() { $response_array = array(); try { $form = new form(); $form->post('salutation')->val('Salutation', 'minlength')->post('fullname')->val('Fullname', 'minlength')->post('username')->val('Username', 'minlength')->post('dob')->val('Date Of Birth', 'minlength')->post('email')->val('Email', 'minlength')->post('cemail')->val('Confirm Email', 'minlength')->post('acc_type')->val('Account Type', 'minlength')->post('subscribe')->post('chkusername')->post('dt_join')->post('sponsor_id')->val('Refferal ID', 'minlength'); $form->submit(); $data = $form->fetch(); $result = $this->model->join_exec($data); if ($result['r'] == 'true') { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } else { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } } catch (Exception $e) { $response_array['r'] = 'false'; $response_array['msg'] = $e->getMessage(); } echo json_encode($response_array); }
public function actionEdit($id) { $folder = zotop::model('system.folder'); if (form::isPostBack()) { $post = form::post(); if ($post['id'] == $post['parentid']) { msg::error('上级分类不能和当前分类相同'); } $folder->update($post, $id); if (!$folder->error()) { msg::success('保存成功', zotop::url('system/folder/index/' . $post['parentid'])); } msg::error($folder->msg()); } $folder->id = $id; $data = $folder->read(); $folders = $folder->getAll(); $tree = new tree($folders, 0); $data['parentid_options'] = $tree->getOptionsArray(); $page = new dialog(); $page->set('title', '编辑分类'); $page->set('data', $data); $page->display(); }
public function editAction($id) { $usergroup = zotop::model('zotop.usergroup'); if (form::isPostBack()) { $post = form::post(); if (empty($post['title'])) { msg::error('用户组名称不能为空'); } $post['type'] = empty($post['type']) ? 'system' : $post['type']; $post['order'] = $post['order'] || 0; $update = $usergroup->update($post, $id); if ($update) { $usergroup->cache(); msg::success('保存成功,正在返回列表页面,请稍后……', zotop::url('zotop/usergroup')); } } $data = $usergroup->read($id); $page = new page(); $page->set('title', '添加新用户'); $page->set('position', $position); $page->set('navbar', $this->navbar()); $page->set('data', $data); $page->display(); }
public function onAdd() { if (form::isPostBack()) { $module = zotop::model('zotop.module'); $post = form::post(); $result = $module->insert($post); if ($result) { msg::success('保存成功', '添加成功,正在刷新页面,请稍后……', zotop::url('zotop/module')); } } $page['title'] = '新建模块'; page::header($page); page::top(); page::navbar($this->navbar()); form::header(); block::header('基本信息'); form::field(array('type' => 'text', 'label' => '模块ID', 'name' => 'id', 'value' => $data['id'], 'valid' => 'required:true,minlength:3,maxlength:32,remote:"' . zotop::url('zotop/module/checkid') . '"', 'description' => '允许使用数字、英文字符(不区分大小写)或者下划线,不允许使用其它特殊字符,3~32位')); form::field(array('type' => 'text', 'label' => '模块名称', 'name' => 'name', 'value' => $data['name'], 'valid' => 'required:true', 'description' => '')); form::field(array('type' => 'radio', 'options' => array('system' => '核心模块', 'plugin' => '插件模块'), 'label' => '模块类型', 'name' => 'type', 'value' => $data['type'], 'valid' => 'required:true', 'description' => '')); form::field(array('type' => 'text', 'label' => '访问地址', 'name' => 'url', 'value' => $data['url'], 'valid' => 'url:true', 'description' => '可以为模块绑定访问域名,如:http://bbs.***.com/ 如果不绑定域名,请留空')); form::field(array('type' => 'textarea', 'label' => '模块说明', 'name' => 'description', 'value' => $data['description'], 'valid' => '', 'description' => '')); block::footer(); block::header('开发者信息'); form::field(array('type' => 'text', 'label' => '开发者', 'name' => 'author', 'value' => $data['author'], 'valid' => 'required:true', 'description' => '')); form::field(array('type' => 'text', 'label' => '电子邮件', 'name' => 'email', 'value' => $data['email'], 'valid' => 'required:true,email:true', 'description' => '')); form::field(array('type' => 'text', 'label' => '官方网站', 'name' => 'site', 'value' => $data['site'], 'valid' => 'required:true', 'description' => '')); block::footer(); form::buttons(array('type' => 'submit'), array('type' => 'back')); form::footer(); page::bottom(); page::footer(); }
function savePayment() { $response_array = array(); try { $form = new form(); $form->post('agent_id')->post('payment_for')->post('ads_pin')->post('payment_date')->val('Payment Date', 'minlength')->post('payment_time')->val('Payment Time', 'minlength')->post('from_acc')->val('From Account', 'minlength')->post('to_acc')->val('To Account', 'minlength')->post('payment_type')->val('Payment Type', 'minlength')->post('ref')->post('amount')->val('Amount', 'minlength')->val('Amount', 'digit')->post('payment_price')->post('date_submit'); $form->submit(); $data = $form->fetch(); $result = $this->model->savePayment($data); if ($result['r'] == 'true') { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } else { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } } catch (Exception $e) { $response_array['r'] = 'false'; $response_array['msg'] = $e->getMessage(); } echo json_encode($response_array); }
function withdrawal_exec() { $response_array = array(); try { $form = new form(); $form->post('agent_id')->post('bank_name')->val('Bank Name', 'minlength')->post('acc_no')->val('Account No.', 'digit')->post('holder_name')->val('Bank Holder Name', 'minlength')->post('amount')->val('Amount', 'minlength')->post('password')->val('Password', 'minlength')->post('date_request'); $form->submit(); $data = $form->fetch(); $result = $this->model->withdrawal_exec($data); if ($result['r'] == 'true') { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } else { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } } catch (Exception $e) { $response_array['r'] = 'false'; $response_array['msg'] = $e->getMessage(); } echo json_encode($response_array); }
public function addagent_exec() { $response_array = array(); try { $form = new form(); $form->post('acc_type')->val('Account Type', 'minlength')->post('sponsor_id')->val('Sponsor ID', 'minlength')->post('lv1')->val('Upline ID', 'minlength')->post('salutation')->val('Salutation', 'minlength')->post('fullname')->val('Fullname', 'minlength')->post('ic_no')->val('IC Number', 'digit')->post('dob')->val('Date Of Birth', 'minlength')->post('address')->val('Mailing Address', 'minlength')->post('country')->val('Country', 'minlength')->post('states')->post('gender')->val('Gender', 'minlength')->post('phone')->post('mobile')->val('Mobile', 'minlength')->post('username')->val('Username', 'minlength')->post('chkusername')->post('email')->val('Email', 'minlength')->post('cemail')->val('Confirm Email', 'minlength')->post('lv2')->post('lv3')->post('lv4')->post('lv5')->post('lv6')->post('lv7')->post('lv8')->post('lv9')->post('lv10')->post('dt_join')->post('subscribe'); $form->submit(); $data = $form->fetch(); $result = $this->model->addagent_exec($data); if ($result['r'] == 'true') { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } else { $response_array['r'] = $result['r']; $response_array['msg'] = $result['msg']; } } catch (Exception $e) { $response_array['r'] = 'false'; $response_array['msg'] = $e->getMessage(); } echo json_encode($response_array); }
<?php require '../libs/form.php'; require '../libs/val.php'; if (isset($_REQUEST['run'])) { try { $form = new form(); $form->post('name')->val('minlength', 4)->post('age')->val('digit')->post('gender'); $form->submit(); $data = $form->fetch(); echo '<pre>'; print_r($data); echo '</pre>'; } catch (Exception $ex) { echo $ex->getMessage(); } } ?> <form method="POST" action="?run"> <label>Name :</label><input type="text" name="name" /> <label>Age :</label><input type="text" name="age" /> <label>Gender :</label> <select name="gender"> <option value="male">Male</option> <option value="female">Female</option> </select> <input type="submit" value="Submit" /> </form>
public function onChangeInfo($id) { $user = zotop::model('zotop.user'); $user->id = (int) $id; if (form::isPostBack()) { $post = form::post(); $update = $user->update($post, $user->id); if ($update) { msg::success('保存成功', '资料设置成功,正在刷新页面,请稍后……', zotop::url('zotop/user')); } } $data = $user->read(); $data['updatetime'] = TIME; $page['title'] = '修改我的资料'; page::header($page); page::top(); page::navbar($this->navbar()); form::header(); block::header('账户信息'); form::field(array('type' => 'label', 'label' => zotop::t('账户名称'), 'name' => 'username', 'value' => $data['username'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'text', 'label' => zotop::t('安全问题'), 'name' => 'question', 'value' => $data['question'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'text', 'label' => zotop::t('安全答案'), 'name' => 'answer', 'value' => $data['answer'], 'valid' => '', 'description' => zotop::t(''))); block::footer(); block::header('个人信息'); form::field(array('type' => 'text', 'label' => zotop::t('真实姓名'), 'name' => 'name', 'value' => $data['name'], 'valid' => 'required:true', 'description' => zotop::t(''))); form::field(array('type' => 'radio', 'options' => array('男' => '男', '女' => '女'), 'label' => zotop::t('性别'), 'name' => 'gender', 'value' => $data['gender'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'image', 'label' => zotop::t('头像'), 'name' => 'image', 'value' => $data['image'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'text', 'label' => zotop::t('电子邮件'), 'name' => 'email', 'value' => $data['email'], 'valid' => 'required:true,email:true', 'description' => zotop::t(''))); form::field(array('type' => 'textarea', 'label' => zotop::t('个人签名'), 'name' => 'sign', 'value' => $data['sign'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'hidden', 'label' => zotop::t('更新时间'), 'name' => 'updatetime', 'value' => $data['updatetime'], 'valid' => '', 'description' => zotop::t(''))); block::footer(); form::buttons(array('type' => 'submit'), array('type' => 'back')); form::footer(); page::bottom(); page::footer(); }
public function actionMove($id) { $category = zotop::model('content.category'); $categories = $category->cache(); if (form::isPostBack()) { $post = form::post(); $category->move($id, $post['id']); if (!$category->error()) { msg::success('移动成功', zotop::url('content/category/index/' . $categories[$id]['parentid'])); } msg::error($category->msg()); } $tree = $category->getTree(0, '<input type="radio" name="id" id="id_$id" value="$id" $checked/> <label for="id_$id"><span class="zotop-icon zotop-icon-$icon"></span><span class="title">$title</span></label>', $categories[$id]['parentid']); $page = new dialog(); $page->set('title', zotop::t('移动栏目')); $page->set('id', $id); $page->set('parentid', $categories[$id]['parentid']); $page->set('categories', $categories); $page->set('tree', $tree); $page->display(); }
function post($name, $mode = 'title') { return form::post($name, $mode); }