public function add($id = NULL) { $this->load->library('form_validation'); $data = array(); if ($id !== NULL) { $data = $this->mongo_db->user->findOne(array('_id' => new MongoID($id))); if (!count($data)) { show_404(); } $this->form_validation->set_rules('confirm_password', 'Şifre tekrarı', 'trim|xss_clean|matches[password]'); } else { $this->form_validation->set_rules('password', 'Şifre', 'trim|required|xss_clean'); $this->form_validation->set_rules('confirm_password', 'Şifre tekrarı', 'trim|required|xss_clean|matches[password]'); } $this->form_validation->set_rules('email', 'E-posta', 'trim|required|xss_clean|valid_email'); $this->form_validation->set_rules('name', 'İsim', 'trim|required|xss_clean'); if ($this->form_validation->run()) { if ($id === NULL) { $data['name'] = set_value('name'); $data['permissions'] = set_value('permissions'); if ($this->auth->create(set_value('email'), set_value('password'), $data)) { flash_message('success', 'Üye başarıyla eklendi.'); } else { flash_message('error', $this->auth->get_error_messages()); } } else { $data = array('name' => set_value('name'), 'email' => set_value('email'), 'password' => set_value('password'), 'permissions' => set_value('permissions')); $this->auth->update($id, $data); flash_message('success', 'Üye başarıyla düzenlendi.'); } redirect('admin/user/index'); } $this->template->view('admin/add', $data)->render(); }
private function update() { global $db, $mybb, $cache, $lang; $new_settings = $drop_settings = array(); // Get the gid $query = $db->simple_select("settinggroups", "gid", "name='mytwconnect'"); $gid = (int) $db->fetch_field($query, "gid"); // 1.0.2 if (version_compare($this->old_version, '1.0.1', "<")) { require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets('mytwconnect_usercp_settings', '#' . preg_quote('<input type="submit" value="{$lang->mytwconnect_settings_save}" />') . '#i', '<input type="submit" class=\\"button\\" value="{$lang->mytwconnect_settings_save}" />{$unlink}'); } // 2.0 if (version_compare($this->old_version, '2.0', "<")) { $new_settings[] = array("name" => "mytwconnect_twavatar", "title" => $db->escape_string($lang->setting_mytwconnect_twavatar), "description" => $db->escape_string($lang->setting_mytwconnect_twavatar_desc), "optionscode" => "yesno", "value" => 1, "disporder" => 30, "gid" => $gid); $new_settings[] = array("name" => "mytwconnect_tweet", "title" => $db->escape_string($lang->setting_mytwconnect_tweet), "description" => $db->escape_string($lang->setting_mytwconnect_tweet_desc), "optionscode" => "yesno", "value" => 0, "disporder" => 31, "gid" => $gid); $new_settings[] = array("name" => "mytwconnect_tweet_message", "title" => $db->escape_string($lang->setting_mytwconnect_tweet_message), "description" => $db->escape_string($lang->setting_mytwconnect_tweet_message_desc), "optionscode" => "textarea", "value" => $lang->mytwconnect_default_tweet, "disporder" => 32, "gid" => $gid); // Let's at least try to change that, anyway, 2.0 has backward compatibility so it doesn't matter if this fails require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets('header_welcomeblock_guest', '#' . preg_quote('twlogin') . '#i', 'login'); } if ($new_settings) { $db->insert_query_multiple('settings', $new_settings); } if ($drop_settings) { $db->delete_query('settings', "name IN ('mytwconnect_" . implode("','mytwconnect_", $drop_settings) . "')"); } rebuild_settings(); // Update the current version number and redirect $this->plugins[$this->info['name']] = array('title' => $this->info['name'], 'version' => $this->version); $cache->update('shade_plugins', $this->plugins); flash_message($lang->sprintf($lang->mytwconnect_success_updated, $this->old_version, $this->version), "success"); admin_redirect($_SERVER['HTTP_REFERER']); }
function uploadTop() { $this->load->library('file_lib'); $this->session->set_userdata(array(config_item('session_admin') . 'menu_current' => 1)); $cauhinh = new Cauhinh(); $cauhinh->where('fieldname', "topBanner"); $cauhinh->get(); if (!$cauhinh->exists()) { show_404(); } if ($_SERVER['REQUEST_METHOD'] == "POST") { $dataupload = $this->file_lib->upload('image', "img/banner"); $this->resize_image("img/banner/" . $dataupload['file_name'], 1015, 267); if (!is_array($dataupload)) { flash_message('error', "Hình ảnh :" . $dataupload); $flag_error = true; } else { $cauhinh->value = $dataupload['file_name']; $cauhinh->save(); } } $dis['cauhinh'] = $cauhinh; $dis['view'] = 'util/topBanner'; $dis['menu_active'] = 'Banner top'; $dis['title'] = "Thay đổi hình đại diện trang web"; $dis['base_url'] = base_url(); $this->viewadmin($dis); }
function tslink_install() { global $db, $PL, $lang, $mybb; if (!$lang->tslink) { $lang->load('tslink'); } if (!file_exists(PLUGINLIBRARY)) { flash_message($lang->tslink_pluginlibrary_missing, 'error'); admin_redirect('index.php?module=config-plugins'); } $PL or (require_once PLUGINLIBRARY); $PL->settings('tslink_settings', $lang->setting_group_tslink, $lang->setting_group_tslink_desc, ['enabled' => ['title' => $lang->setting_tslink_enable, 'description' => $lang->setting_tslink_enable_desc, 'value' => '1'], 'onregister' => ['title' => $lang->setting_tslink_onregister, 'description' => $lang->setting_tslink_onregister_desc, 'value' => '1'], 'admincp' => ['title' => $lang->setting_tslink_admincp, 'description' => $lang->setting_tslink_admincp_desc, 'value' => '1'], 'modcp' => ['title' => $lang->setting_tslink_modcp, 'description' => $lang->setting_tslink_modcp_desc, 'value' => '1'], 'usercp' => ['title' => $lang->setting_tslink_usercp, 'description' => $lang->setting_tslink_usercp_desc, 'value' => '1']]); if ($db->field_exists('memberstatus', 'users')) { // Don't do anything } else { // Insert our memberstatus column into the database. $db->query('ALTER TABLE ' . TABLE_PREFIX . 'users ADD (`memberstatus` int(10) NOT NULL DEFAULT 0)'); } $db->query('CREATE TABLE IF NOT EXISTS ' . TABLE_PREFIX . 'tslink_uids ( uid int(10) NOT NULL, ts_uid varchar(50) NOT NULL, ts_cldbid int(10) DEFAULT NULL, UNIQUE KEY (uid) ) '); }
function pages($params) { global $pages_schema; $data = array('schema' => $pages_schema); $db = connect_database(); // if (isset($params[0])) { $data['page'] = $params[0]; // $found = false; $content = $db->query('SELECT stub, en, ch FROM content WHERE stub = \'' . $params[0] . '\''); if ($content = mysql_fetch_assoc($content)) { $data['content'] = $content; $found = true; } // if (isset($params['en'])) { if ($found) { $db->update('content', array('ch' => $params['ch'], 'en' => $params['en']), 'stub = \'' . $params['stub'] . '\''); } else { $db->insert('content', $params); } flash_message('Content is saved', 'success'); redirect('admin', 'pages'); } } else { $data['pages'] = $db->query('SELECT stub FROM content'); } // $data['html_head'] = array('title' => 'Pages: Admin Dashboard'); return $data; }
public function onPageRequest(PageRequestEvent $event) { global $database, $page, $user; if ($event->page_matches("untag")) { if ($user->can("ban_image")) { if ($event->get_arg(0) == "add") { $tag = $_POST["tag"]; $redirect = isset($_POST['redirect']) ? $_POST['redirect'] : "DNP"; $database->Execute("INSERT INTO untags(tag, redirect) VALUES (?, ?)", array($tag, $redirect)); $page->set_mode("redirect"); $page->set_redirect($_SERVER['HTTP_REFERER']); } else { if ($event->get_arg(0) == "remove") { if (isset($_POST['tag'])) { $database->Execute("DELETE FROM untags WHERE tag = ?", array($_POST['tag'])); flash_message("Image ban removed"); $page->set_mode("redirect"); $page->set_redirect($_SERVER['HTTP_REFERER']); } } else { if ($event->get_arg(0) == "list") { $page_num = 0; if ($event->count_args() == 2) { $page_num = int_escape($event->get_arg(1)); } $page_size = 100; $page_count = ceil($database->get_one("SELECT COUNT(tag) FROM untags") / $page_size); $this->theme->display_untags($page, $page_num, $page_count, $this->get_untags($page_num, $page_size)); } } } } } }
public function index() { if ($this->mongo_db->user->find()->count() && !$this->input->get('ok')) { show_error('Kurulum zaten yapılmış!'); } $this->load->library('form_validation'); $this->load->library('user/auth'); $data = array(); $this->form_validation->set_rules('password', 'Şifre', 'trim|required|xss_clean'); $this->form_validation->set_rules('confirm_password', 'Şifre tekrarı', 'trim|required|xss_clean|matches[password]'); $this->form_validation->set_rules('email', 'E-posta', 'trim|required|xss_clean|valid_email'); $this->form_validation->set_rules('name', 'İsim', 'trim|required|xss_clean'); if ($this->form_validation->run()) { $data['name'] = set_value('name'); $data['permissions'] = set_value('permissions'); if ($this->auth->create(set_value('email'), set_value('password'), $data, TRUE)) { set_option('site_name', set_value('site_name')); set_option('site_email', set_value('site_email')); set_option('per_page', 10); set_option('per_page_admin', 20); set_option('debug', 0); $navigation = array('slug' => 'HEAD_MENU', 'title' => 'Üst Menü', 'items' => array(array('title' => 'Anasayfa', 'url' => '/', 'access_level' => '0', 'target' => ''), array('title' => 'İletişim', 'url' => '/contact', 'access_level' => '0', 'target' => ''))); $this->mongo_db->navigation->insert($navigation); flash_message('success', 'Üye başarıyla eklendi.'); redirect('install?ok=1'); } } $this->load->view('index', $data); }
function mytwconnect_uninstall() { global $db, $PL, $cache, $lang; if (!$lang->mytwconnect) { $lang->load('mytwconnect'); } if (!file_exists(PLUGINLIBRARY)) { flash_message($lang->mytwconnect_pluginlibrary_missing, "error"); admin_redirect("index.php?module=config-plugins"); } $PL or (require_once PLUGINLIBRARY); // Drop settings $PL->settings_delete('mytwconnect'); // Delete our columns $db->query("ALTER TABLE " . TABLE_PREFIX . "users DROP `twavatar`, DROP `twbio`, DROP `twlocation`, DROP `mytw_uid`"); // Delete the plugin from cache $info = mytwconnect_info(); $shadePlugins = $cache->read('shade_plugins'); unset($shadePlugins[$info['name']]); $cache->update('shade_plugins', $shadePlugins); $PL->templates_delete('mytwconnect'); // Try to update templates require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; find_replace_templatesets('header_welcomeblock_guest', '#' . preg_quote('— <a href="{$mybb->settings[\'bburl\']}/mytwconnect.php?action=login">{$lang->mytwconnect_login}</a>') . '#i', ''); }
function edit($id = 0) { $this->load->library('file_lib'); $metro = new metro($id); if ($_SERVER['REQUEST_METHOD'] == "GET") { } else { $metro->title = $this->input->post('title'); $metro->link = $this->input->post('link'); $metro->dir = 'img/metro'; $metro->type = $this->input->post('type'); $new_image = $this->input->post('newimage'); $dataupload = $this->file_lib->upload('image', 'img/metro'); if (!is_array($dataupload)) { //flash_message('error',$dataupload); } else { $metro->img = 'img/metro/' . $dataupload['file_name']; } if ($metro->save()) { flash_message('success', 'Thành công. Thao tác đã được thực hiện.'); redirect($this->admin . 'metros/edit/' . $metro->id); } } $dis['base_url'] = base_url(); $dis['title'] = "Add/Edit Metro Slideshow"; $dis['menu_active'] = "Metro"; $dis['view'] = "metro/edit"; $dis['object'] = $metro; $dis['nav_menu'] = array(array("type" => "back", "text" => "Back", "link" => "{$this->admin_url}metros", "onclick" => "")); $this->viewadmin($dis); }
function inquiry($params) { $data = array(); // flash_message('Under Construction', 'warning'); // $data['html_head'] = array('title' => 'Inquiry: Admin Dashboard'); return $data; }
function vcs($params) { $data = array(); // flash_message('Under Construction', 'warning'); // $data['html_head'] = array('title' => 'Version Control System'); return $data; }
function do_upgrade() { if(!$this->upgrade_model->do_upgrade()) { $this->upgrade_model->clean(); log_message('error', 'upgrade.php do_upgrade(): failed upgrade'); flash_message('error', _('Upgrade failed: check file permissions.')); } echo json_encode(array('href' => site_url('admin/upgrade'))); }
function loginconvert_activate() { global $db; // Don't activate the plugin if it isn't needed if (!$db->field_exists("passwordconvert", "users")) { flash_message("There's no need to activate this plugin as there aren't any passwords which need to be converted", "error"); admin_redirect("index.php?module=config-plugins"); } }
function delete() { $id = $this->uri->segment(4); $direction = new Estatedirection($id); //delete direction $direction->delete(); flash_message('success', 'Xóa thành công'); //redirect to direction redirect($this->admin . 'estatedirections/list_all'); }
function delete() { $id = $this->uri->segment(4); $catalogue = new Landcategory($id); //delete catalogue $catalogue->delete(); flash_message('success', 'Xóa thành công'); //redirect to catalogue redirect($this->admin . 'landcategories/list_all'); }
function delete() { $id = $this->uri->segment(4); $price = new Estateprice($id); //delete price $price->delete(); flash_message('success', 'Xóa thành công'); //redirect to price redirect($this->admin . 'estateprices/list_all'); }
function delete() { $id = $this->uri->segment(4); $area = new Estatearea($id); //delete area $area->delete(); flash_message('success', 'Xóa thành công'); //redirect to area redirect($this->admin . 'estateareas/list_all'); }
function delete($id) { $o = new Job($id); if ($o->delete()) { flash_message('success', 'Level đã được xóa thành công'); redirect($this->admin_url . 'jobs/listAll'); } else { flash_message('error', 'Có lỗi. Vui lòng kiểm tra lại'); redirect($this->admin_url . 'jobs/listAll'); } }
function myalerts_acp_manage_alert_types() { global $mybb, $lang, $page, $db, $cache; $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance(); $alertTypes = $alertTypeManager->getAlertTypes(); if (strtolower($mybb->request_method) == 'post') { if (!verify_post_check($mybb->get_input('my_post_key'))) { flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=config-myalerts_alert_types"); } $enabledAlertTypes = $mybb->get_input('alert_types_enabled', MyBB::INPUT_ARRAY); $canBeUserDisabled = $mybb->get_input('alert_types_can_be_user_disabled', MyBB::INPUT_ARRAY); $enabledAlertTypes = array_map('intval', array_keys($enabledAlertTypes)); $canBeUserDisabled = array_map('intval', array_keys($canBeUserDisabled)); $updateArray = array(); foreach ($alertTypes as $alertType) { $type = MybbStuff_MyAlerts_Entity_AlertType::unserialize($alertType); $type->setEnabled(in_array($type->getId(), $enabledAlertTypes)); $type->setCanBeUserDisabled(in_array($type->getId(), $canBeUserDisabled)); $updateArray[] = $type; } $alertTypeManager->updateAlertTypes($updateArray); flash_message($lang->myalerts_alert_types_updated, 'success'); admin_redirect("index.php?module=config-myalerts_alert_types"); } else { $page->output_header($lang->myalerts_alert_types); $form = new Form('index.php?module=config-myalerts_alert_types', 'post'); $table = new Table(); $table->construct_header($lang->myalerts_alert_type_code); $table->construct_header($lang->myalerts_alert_type_enabled, array('width' => '5%', 'class' => 'align_center')); $table->construct_header($lang->myalerts_alert_type_can_be_user_disabled, array('width' => '10%', 'class' => 'align_center')); $noResults = false; if (!empty($alertTypes)) { foreach ($alertTypes as $type) { $alertCode = htmlspecialchars_uni($type['code']); $table->construct_cell($alertCode); $table->construct_cell($form->generate_check_box('alert_types_enabled[' . $type['id'] . ']', '', '', array('checked' => $type['enabled']))); $table->construct_cell($form->generate_check_box('alert_types_can_be_user_disabled[' . $type['id'] . ']', '', '', array('checked' => $type['can_be_user_disabled']))); $table->construct_row(); } } else { $table->construct_cell($lang->myalerts_no_alert_types, array('colspan' => 2)); $table->construct_row(); $noResults = true; } $table->output($lang->myalerts_alert_types); if (!$noResults) { $buttons[] = $form->generate_submit_button($lang->myalerts_update_alert_types); $form->output_submit_wrapper($buttons); } $form->end(); $page->output_footer(); } }
function delete($id) { $banners = new Banner($id); if (!$banners->exists()) { show_404(); } if ($banners->delete()) { flash_message('success', 'Thành công. Thao tác đã được thực hiện.'); redirect($_SERVER['HTTP_REFERER']); } }
function delete() { $id = $this->uri->segment(4); $catalogue = new Estatecatalogue($id); //delete catalogue if (count($catalogue->child->all) > 0) { flash_message('error', 'Không thể xóa danh mục cha, vui lòng xóa mục con trước'); } else { $catalogue->delete(); flash_message('success', 'Xóa thành công'); } //redirect to catalogue redirect($this->admin . 'estatecatalogues/list_all'); }
function delete($id) { $category = $this->mongo_db->category->findOne(array('_id' => new MongoID($id))); if (count($category) < 1) { flash_message('error', 'Üzgünüm, böyle bir Kategori yok.'); } else { if ($this->mongo_db->category->remove(array('_id' => new MongoID($id)))) { flash_message('success', 'Kategori silindi'); } else { flash_message('error', 'Kategori <b>silinemedi.</b>'); } } redirect('admin/category/index'); }
function delete($id) { $navigation = $this->mongo_db->navigation->findOne(array('_id' => new MongoID($id))); if (count($navigation) < 1) { flash_message('error', 'Üzgünüm, böyle bir menü yok.'); } else { if ($this->mongo_db->navigation->remove(array('_id' => new MongoID($id)))) { flash_message('success', 'Menü silindi'); } else { flash_message('error', 'Menü <b>silinemedi.</b>'); } } redirect('admin/navigation/index'); }
function delete() { $id = $this->uri->segment(4); $city = new Estatecity($id); //delete city if (count($city->estatedistrict->all) > 0) { flash_message('error', 'Không thể xóa Thành phố/Tỉnh, vui lòng xóa Quận/Huyện trước'); } else { $city->delete(); flash_message('success', 'Xóa Thành phố/Tỉnh thành công'); } //redirect to city redirect($this->admin . 'estatecitys/list_all'); }
function delete($id) { $page = $this->mongo_db->page->findOne(array('_id' => new MongoID($id))); if (count($page) < 1) { flash_message('error', 'Üzgünüm, böyle bir sayfa yok.'); } else { if ($this->mongo_db->page->remove(array('_id' => new MongoID($id)))) { flash_message('success', 'Sayfa silindi'); } else { flash_message('error', 'Sayfa <b>silinemedi.</b>'); } } redirect('admin/page/index'); }
function index() { $this->form_validation->set_rules('email', 'E-Posta', 'trim|required|valid_email'); $this->form_validation->set_rules('name', 'İsim', 'trim|required'); $this->form_validation->set_rules('message', 'Mesaj', 'trim|required'); if ($this->form_validation->run()) { $edata = array('name' => $this->form_validation->set_value('name'), 'email' => $this->form_validation->set_value('email'), 'message' => $this->form_validation->set_value('message')); if ($this->_send_email($edata)) { flash_message('success', 'Mesajınız başarıyla gönderildi. Görüş ve önerileriniz için teşekkürler.'); } else { flash_message('error', 'Teknik bir hatadan dolayı mesajınız <b>gönderilemedi</b>.'); } redirect('contact'); } $this->template->set_keyword('İletişim')->set_description('İletişim - ' . get_option('site_name'))->set_title('İletişim - ' . get_option('site_name'))->view('contact')->render(); }
function delete($id) { if ($id != 0) { $productstatus = new Productstatu($id); if ($productstatus->delete()) { flash_message('success', 'Thành công. Đối tượng đã được xóa.'); redirect($_SERVER['HTTP_REFERER']); } } else { $arr = $this->input->post('checkinput'); foreach ($arr as $row) { $productstatus = new Productstatu($id); $productmanufacture->delete(); flash_message('success', 'Thành công. Các đối tượng đã được xóa.'); redirect($_SERVER['HTTP_REFERER']); } } }
function edit_fomal() { $logged_role = $this->logged_in_user->adminrole->id; $cauhinh = new cauhinh(); $cauhinh->get(); $this->load->library('file_lib'); if ($_SERVER['REQUEST_METHOD'] == "POST") { foreach ($cauhinh as $row) { if ($logged_role != 1 && $row->for_webmaster == 0 || $logged_role == 1) { if ($row->type == "file" || $row->type == "image") { if ($_FILES[$row->fieldname]['name'] != "") { $dataupload = $this->file_lib->upload($row->fieldname, 'img/config/'); if (is_array($dataupload)) { $row->value = 'img/config/' . $dataupload['file_name']; $row->save(); } else { flash_message('error', $dataupload); } } } else { $row->value = $this->input->post($row->fieldname); $row->save(); } } } $cauhinh->refresh_all(); redirect("admin/cauhinhs/edit_fomal"); } $configgroup = new configgroup(); $configgroup->order_by('position', 'asc'); $configgroup->get(); $dis['logged_role'] = $logged_role; $dis['configgroup'] = $configgroup; $dis['base_url'] = base_url(); $dis['menu_active'] = "Cấu hình hệ thống"; $dis['title'] = "Thông số cấu hình"; $dis['cauhinh'] = $cauhinh; $dis['view'] = 'cauhinh/edit_fomal'; $dis['nav_menu'] = array(); if ($this->logged_in_user->adminrole->id == 1) { array_push($dis['nav_menu'], array("type" => "list", "text" => "Chỉnh sửa", "link" => "{$this->admin_url}cauhinhs/list_all/", "onclick" => "")); } $this->viewadmin($dis); }
function myprofile_uninstall() { global $mybb; if ($mybb->request_method == 'post') { if (!verify_post_check($mybb->input['my_post_key'])) { global $lang; flash_message($lang->invalid_post_verify_key2, 'error'); admin_redirect("index.php?module=config-plugins"); } if (isset($mybb->input['no'])) { admin_redirect('index.php?module=config-plugins'); } myprofile_bundles_propagate_call("uninstall"); $mybb->cache->delete("myprofile"); return true; } global $page; $page->output_confirm_action("index.php?module=config-plugins&action=deactivate&uninstall=1&plugin=myprofile"); }
function edit($id = 0) { $khachhang = new khachhang($id); if ($_SERVER['REQUEST_METHOD'] == "GET") { } else { $file = 'img/logo/'; $position = $this->input->post('position'); $partner = new Khachhang(); $partner->where('position >', $position); $partner->get()->all; foreach ($partner as $row) { $row->position = $row->position + 1; $row->save(); $row->clear(); } $this->load->library('file_lib'); $khachhang->name_vietnamese = $this->input->post('name'); $khachhang->description = $this->input->post('description'); $khachhang->link = $this->input->post('link'); $khachhang->address = $this->input->post('address'); $khachhang->email = $this->input->post('email'); $khachhang->phone = $this->input->post('phone'); $khachhang->position = $position; $dataupload = $this->file_lib->upload('image', $file); if (!is_array($dataupload)) { flash_message('info', $dataupload); } else { $khachhang->logo = $file . $dataupload['file_name']; $this->resize_image('img/partner/' . $dataupload['file_name']); } if ($khachhang->save()) { redirect($this->admin . 'partner/edit/' . $khachhang->id); } } $dis['base_url'] = base_url(); $dis['title'] = "Add/Edit Language"; $dis['menu_active'] = "Đối tác"; $dis['view'] = "khachhang/edit"; $dis['object'] = $khachhang; $dis['nav_menu'] = array(array("type" => "back", "text" => "Back", "link" => "{$this->admin_url}partner", "onclick" => "")); $this->viewadmin($dis); }