function daftar() { $this->load->helper(array('captcha', 'url')); if ($this->input->post() && $this->input->post('secutity_code') == $this->session->userdata('mycaptcha')) { $database = array('user_id' => load_model("akun", "akun_model", "generate_iduser"), 'username' => $this->input->post('username'), 'email' => $this->input->post('email'), 'password' => $this->input->post('password'), 'status_id' => 0, 'no_hp' => $this->input->post('no_hp'), 'alamat' => $this->input->post('alamat')); $this->db->insert('users', $database); echo "<script>alert('Registrasi Berhasil, Silahkan Login!!')</script>"; redirect('akun/masuk', 'refresh'); } else { $this->session->unset_userdata('mycaptcha'); $this->load->helper('captcha'); $vals = array('img_path' => './captcha/', 'img_url' => base_url() . 'captcha/', 'img_width' => '200', 'img_height' => 30, 'border' => 1, 'word_length' => 4, 'pool' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'expiration' => 7200); $cap = create_captcha($vals); if ($this->input->post()) { $this->session->set_userdata('mycaptcha', $cap['word']); $this->session->set_flashdata('message', 'Captcha yang anda masukan salah!!'); } $data_param['image'] = $cap['image']; echo load_controller("web", "web", "web_header", $data_param); echo load_controller("web", "web", "web_open_content", $data_param); echo load_model("akun", "akun_model", "generate_iduser"); $this->load->view("akun/daftar", $data_param); echo load_controller("web", "web", "web_close_content", $data_param); echo load_controller("web", "web", "web_footer", $data_param); } }
function web_premium_lelang($data_param) { $data['data_premium_lelang'] = load_model("web", "web_model", "get_list_premium_lelang"); //$data_param['data_premium_lelang'] = $data->result_array(); //$data_param['status_id'] = 1; $this->load->view("web/premium_lelang", $data); }
/** * Make a new model object, optionally with some initialization data * * @param String $model the name of the model class to make * @param Array $data an optional array of initialization data * @param Boolean $has_changed whether the newly made object has changed * @return SQL_model/Remote the newly made model object or its remote object */ public static function make($model, $data = array(), $has_changed = TRUE) { load_model($model); $object = new $model($data, $has_changed); if (array_key(self::$is_remote, Symbol::ALL) || array_key(self::$is_remote, $model)) { $object = new Remote($object); } return $object; }
public function delete() { $id = get_routing_value(); if ($id !== null) { $user = load_model('Example', (int) $id, null, true); $user->set_to_delete(); } return F\Core::redirect('home', 'main'); }
function modcall($model, $func, $args) { load_model($model); $class = ucfirst($model) . "Model"; if (!class_exists($class)) { Umsg("模型无效"); } $rs = BaseCall("ctl", $class, $func, $args); return $rs; }
function __construct() { global $limit; global $page; $this->limit = $limit; $this->page = $page; $model = Utils::singularize(get_class($this)); load_model($model); $this->model = ucfirst($model); header('Content-Type: application/json'); }
function Controller() { $this->validate = Inspekt::makeSuperCage(); $this->db = Database::getInstance(array('conn_id' => Config::item('LINK_ID'))); $this->view = new View(); // auto load helper load_helper(array('php', 'time', 'html', 'form', 'table', 'forum')); // load forum model load_model('forum', FALSE); load_model('check', FALSE); $this->forum = forum_model::getInstance(); }
function send() { if ($this->tpl_name) { include_once '../tf_app/template_/Template_.class.php'; $tpl = new Template_(); $tpl->define('mail', 'views/mail/' . $this->tpl_name . '.tpl'); $tpl->assign($this->assigns); $this->content = $tpl->fetch('mail'); } /* $subject=iconv("UTF-8", "EUC-KR", $subject); $content=iconv("UTF-8", "EUC-KR", $content); */ if (!$this->sender_name) { $this->sender_name = $this->settings->sender_name; } if (!$this->sender_password) { $this->sender_password = $this->settings->sender_password; } // if (!$this->mailto) // { // $this->mailto = $this->settings->mailto; // } if (!$this->server) { $this->server = $this->settings->server; } if (!$this->sender_user) { $this->sender_user = $this->settings->sender_user; } if (!$this->sender_address) { $this->sender_address = $this->settings->sender_address; } if ($this->mailto) { require_once '../tf_app/ext/phpmailer/class.phpmailer.php'; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; $mail->Host = $this->server; $mail->Port = 465; $mail->Username = $this->sender_user; $mail->Password = $this->sender_password; $mail->From = $this->sender_address; $mail->FromName = $this->sender_name; $mail->Subject = $this->subject; $mail->Body = $this->content; $mail->AddAddress($this->mailto); $mail->Send(); $mail_log = load_model("Members"); $mail_log->log_mail($this->mailto, $this->tpl_name, $this->content); } }
function kategori() { $data_param = ""; $url = $this->uri->segment(3); $url_1 = explode("-", $url); $id = $url_1[0]; $data_param['data_kategori_lelang'] = load_model("produk", "produk_model", "get_detail_kategori", array('id' => $id)); echo load_controller("web", "web", "web_header", $data_param); echo load_controller("web", "web", "web_open_content", $data_param); $this->load->view("produk/detail_kategori", $data_param); echo load_controller("web", "web", "web_close_content", $data_param); echo load_controller("web", "web", "web_footer", $data_param); }
function lelang() { $data_param = ""; $url = $this->uri->segment(3); $url_1 = explode("-", $url); $id = $url_1[0]; $data_detail = load_model("produk", "produk_model", "get_detail_lelang", array('id' => $id)); foreach ($data_detail->result() as $detail) { $produk_id = $detail->produk_id; } $data_gambar = load_model("produk", "produk_model", "get_gambar_produk", array('id' => $produk_id)); $data['data_detail'] = $data_detail; $data['data_gambar'] = $data_gambar; echo load_controller("web", "web", "web_header", $data_param); echo load_controller("web", "web", "web_open_content", $data_param); $this->load->view("produk/detail_lelang", $data); echo load_controller("web", "web", "web_close_content", $data_param); echo load_controller("web", "web", "web_footer", $data_param); }
function category_loadpreview($c) { $data = false; switch ($c['template']) { case 'news-list': load_model('news.func'); $query = 'WHERE category=' . $c['index'] . ' AND isdelete=0' . ' AND ishide=0' . ' ORDER BY istop DESC LIMIT 8'; $data = news_getBySQL($query); break; case 'item-list': load_model('item.func'); $data = item_ofcategory($c['index']); break; case 'download-list': load_model('download.func'); $data = download_ofcategory($c['index']); break; default: # code... break; } return $data; }
function auth_check($domain, $did, $auth, $level = 1) { if (!user_isLogin()) { return false; } $auth = base_protect($auth); $domain = base_protect($domain); $did = (int) $did; $level = (int) $level; if (auth_checkSession($domain, $did, $auth, $level)) { return true; } load_model('user.func'); $user = user_getById($_SESSION['twt_uid']); if (!$user) { return false; } $query = 'SELECT * FROM ' . table('authmap') . ' WHERE ' . '((`ownertype`="group" AND `ownerid`="' . $user['gid'] . '")' . ' OR ' . '(`ownertype`="user" AND `ownerid`="' . $user['uid'] . '"))' . ' AND `domain`="' . $domain . '"' . ' AND `did`="' . $did . '"' . ' AND `auth`="' . $auth . '"' . ' ORDER BY `iscancel` DESC LIMIT 1'; // echo $query; global $db; $result = $db->sql($query); $row = $db->getRow($result); if (!$row) { return -1; } if ($row['iscancel'] != '0') { return -2; } if ($row['level'] < $level) { return -3; } if ($row['bindtype'] == 'group') { return 2; } auth_setSession($row['domain'], $row['did'], $row['auth'], $row['level']); return 1; }
if (!is_null($default)) { if (array_key_exists("libraries", $default)) { foreach ($default["libraries"] as $library) { if (!load_library($library)) { show_error("The library " . $library . " not loaded."); } } } if (array_key_exists("config", $default)) { foreach ($default["config"] as $conf) { $config->load($conf); } } if (array_key_exists("models", $default)) { foreach ($default["models"] as $model) { if (!load_model($model)) { show_error("The model " . $model . " not loaded."); } } } } /* * --------------------------------------------------------------- * Start router * --------------------------------------------------------------- */ require_once BASEPATH . "router.php"; /* * --------------------------------------------------------------- * Get data * ---------------------------------------------------------------
function web_premium_lelang($data_param) { $data['data_premium_lelang'] = load_model("web", "web_model", "get_list_premium_lelang"); $this->load->view("web/premium_lelang", $data); }
/** * Load a model. * @param string $name - Name of the model. * @return {Model} * @throws {RuntimeException} if anything goes wrong. */ protected function model($name) { return load_model($name); }
<? load_model('Message'); load_helper('Spam'); class Contact_controller extends App_controller { public function form() { $this->render->title = 'Contact form'; $message = $this->render->message = new Message($this->params->message); if (Spam::is_spam($this->params)) return; $message->status = 'P'; // Pending if ($message->save()) { $this->flash->sent = $this->send($message); $this->redirect('default/index', array('notice' => 'Thank you for your interest. Please expect a friendly email from us in the next few days.')); } } private function send($message) { return $this->send_mail('message', array( 'to' => CONTACT_EMAIL, 'from' => $message->email, 'subject' => 'Plumline website message', 'message' => $message, )); } }
function init_global($trail) { if ($_SESSION["s"]) { return; } //자동 로그인 $next = $_REQUEST['next']; $id_save = $_COOKIE['dcamp_id_save']; if (!$_SESSION["s"] && $id_save) { $users = load_model("Members"); $users_info = $users->get($id_save); if ($users_info && $users_info['auto_login'] == 1) { $akey = $_COOKIE['dcamp_akey']; //$current_time = date('Y-m-d H:i:s',time()); $users_auto = load_model("Member_auto"); //자동 설정 되어 있고 세션에 키가 있으면 $users_auto_info = $users_auto->get_by_id_user_akey($id_save, $akey); if ($users_auto_info) { $_SESSION["s"] = $users_info; if (!$_SESSION["s"]["picture"]) { $_SESSION["s"]["picture"] = '/img/default-img-member.png'; } $act = load_model("Activity"); $_SESSION["s"]["acnt"] = $act->get_a_cnt(1, $_SESSION["s"]["id"], '0'); $m_ext = load_model("Member_ext"); $_SESSION["s"]["fb"] = $m_ext->get_by_user_id_type($_SESSION["s"]["id"], 1); $_SESSION["s"]["tw"] = $m_ext->get_by_user_id_type($_SESSION["s"]["id"], 2); $cc = load_model("Content_category"); $con = $cc->get_cat_by_user($_SESSION["s"]["id"], 'cc.hidden = 0'); if (sizeof($con) > 0) { $_SESSION["s"]["con"] = $con; } $om = load_model("Office_mento"); $mt = $om->cnt("user_id = " . $_SESSION["s"]["id"]); if ($mt > 0) { $_SESSION["s"]["mento"] = true; } setcookie("dcamp_id_save", $users_info['id'], time() + 1209600, "/"); setcookie("dcamp_akey", $users_auto_info['akey'], time() + 1209600, "/"); } } } }
protected function exec_model($model) { if (is_array($model)) { return $this->exec_array('model', $model); } elseif (is_callable($model)) { return array('function' => $model()); } elseif (is_object($model)) { if (array_key_exists('model', $this->actions)) { return array(get_class($model) => $this->exec_object($model, $this->actions['model'])); } else { // error } } elseif (is_string($model)) { return array($model => load_model($model)); } }
function user_login($username, $password, $ishashed = 0) { if (Database::isConnected()) { global $db; $db->close(); } $twtapi = user_getTWTAPI(); $result = $twtapi->query('twt.login', array('username' => $username, 'password' => $password, 'ishashed' => $ishashed)); if ($result) { user_touch($result->twtname, $result->auth_key, $result->realname, $result->uid); if ($db) { global $db; $db->conn(); load_model('user.func'); user_APISync($result); } } return $result; }
<?php /** * Template created by Gregory Chris */ load_model('admin/blog'); if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Save') { if (array_key_exists('post_id', $_POST) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) { update_post($_POST['post_id'], $_POST); } } if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Delete') { if (array_key_exists('post_id', $_POST) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) { delete_post($_POST['post_id']); } } if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Add') { add_post($_POST); } header('Location: ' . _HTTP_ROOT . '/admin/blog/'); die;
<?php /** * Template created by Gregory Chris */ load_model('admin/snippets'); if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Save') { if (array_key_exists('post_id', $_POST) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) { update_post($_POST['post_id'], $_POST); } } if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Delete') { if (array_key_exists('post_id', $_POST) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) { delete_post($_POST['post_id']); } } if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Add') { add_post($_POST); } header('Location: ' . _HTTP_ROOT . '/admin/snippets/'); die;
<?php load_model('common.func'); //我要引用common.func里面的查询函数.... load_model('user.func'); //我要引用common.func里面的查询函数.... @session_start(); function manager_islogin() { //下面是判断用户是否登陆... if (isset($_SESSION['realname']) && isset($_SESSION['twtname']) && isset($_SESSION['authority'])) { return true; } return false; } function manager_sustain_session() { $_SESSION['realname'] = $_SESSION['realname']; $_SESSION['twtname'] = $_SESSION['twtname']; $_SESSION['usernumb'] = $_SESSION['usernumb']; $_SESSION['is_gangbu'] = $_SESSION['is_gangbu']; $_SESSION['is_teacher'] = $_SESSION['is_teacher']; $_SESSION['partybranch_id'] = $_SESSION['partybranch_id']; $_SESSION['authority'] = $_SESSION['authority']; } function manager_clearCookie() { @session_destroy(); //这里就首先将所有的session删除了.. setcookie("twtname", 0, time() - 3600, '/', 'twt.edu.cn'); setcookie("twtname", 0, time() - 3600, '/');
<?php /** * Template created by Gregory Chris */ load_model('snippets'); $params = array(); $params['items'] = get_snippet_items(); $params['search_string'] = ''; $params['tag'] = ''; $params['language'] = ''; if ($GLOBALS['url_params'][0] == 'tag' && !empty($GLOBALS['url_params'][1])) { // load snippets with specific tag $params['items'] = get_snippet_items_by_tag($GLOBALS['url_params'][1]); $params['tag'] = htmlentities(urldecode($GLOBALS['url_params'][1]), ENT_NOQUOTES, 'utf-8'); } if ($GLOBALS['url_params'][0] == 'load' && !empty($GLOBALS['url_params'][1]) && is_numeric($GLOBALS['url_params'][1]) && $GLOBALS['url_params'][1] > 0) { // load snippets with specific tag $item = get_snippet_item($GLOBALS['url_params'][1]); die(highlight_string($item['code'], true)); } if ($GLOBALS['url_params'][0] == 'search' && !empty($GLOBALS['url_params'][1])) { // load snippets with specific tag $params['items'] = get_snippet_item_by_name($GLOBALS['url_params'][1]); $params['search_string'] = str_replace('\\', '\', htmlentities(urldecode($GLOBALS['url_params'][1]), ENT_QUOTES, 'utf-8')); } if ($GLOBALS['url_params'][0] == 'language' && !empty($GLOBALS['url_params'][1])) { // load snippets with specific tag $params['items'] = get_snippet_item_by_language($GLOBALS['url_params'][1]); $params['language'] = urldecode($GLOBALS['url_params'][1]); }
function web_slider_front($data_param) { $data_param['get_list_categori'] = load_model("web", "web_model", "get_list_categori"); return $this->load->view("web/slider_front", $data_param); }
/** * Return the data model class name (and ensure it has been loaded) * * @return String the name of the model class (e.g. "User") */ protected function get_model_class() { $model_class = preg_replace('/(_test)?_service$/', '', get_class($this)); $model_class = Text::singularize($model_class); // services may use plurals load_model($model_class); // in case we haven't loaded it already return $model_class; }
/** * Setup a relationship whereby this model has a relation with other models. * As a side-effect the models will all be loaded and "setup" ready for use. * * @param Array $models a list of models that this model has a relation with * @param Array $options an array of options, including the relation type */ private function set_relations_for($models, $options) { $is_singular = array_key($options, 'is_singular', FALSE); $relation = array_key($options, 'relation'); foreach ($models as $model) { $options = array('is_singular' => $is_singular); if (is_array($model)) { // Turn "through" relations into "join" relations with casting if ($through = array_key($model, 'through')) { $join = $model['join'] = $model['cast'] = $model['model']; $model['model'] = $through; $model['as'] = array_key($model, 'as', Text::tableize($join)); } // Extract model arrays into relation options $options['join'] = array_key($model, 'join'); $options['cast'] = array_key($model, 'cast'); $options['as'] = array_key($model, 'as'); $model = $model['model']; if ($join_model = $options['join']) { load_model($join_model); } if ($cast_model = $options['cast']) { load_model($cast_model); } } $this->set_relation($model, $relation, $options); load_model($model); } }
<?php /** * Template created by Gregory Chris */ load_model('version'); load_view('login_screen', array('version' => get_current_version())); load_view('footer');
function bottom_main() { $main = load_model("Main")->list_("", "type > 0 and type != 3 and type != 4"); for ($m = 0; $m < sizeof($main); $m++) { if ($main[$m]["type"] == 1) { $main[$m] = load_model("Event")->get_detail($main[$m]["cid"]); if ($main[$m]) { $main[$m]["cat"] = "event"; } else { $main[$m]["cat"] = ""; } } else { if ($main[$m]["type"] == 2) { $main[$m] = load_model("Notice")->get_detail($main[$m]["cid"], 1); if ($main[$m]) { $main[$m]["cat"] = "notice"; } else { $main[$m]["cat"] = ""; } } else { if ($main[$m]["type"] == 5) { $main[$m] = load_model("Content")->get($main[$m]["cid"]); if ($main[$m]) { $main[$m]["cat"] = "content"; } else { $main[$m]["cat"] = ""; } } else { if ($main[$m]["type"] == 7) { $main[$m] = load_model("Competitions")->get($main[$m]["cid"]); if ($main[$m]) { $main[$m]["cat"] = "competition"; } else { $main[$m]["cat"] = ""; } } else { if ($main[$m]["type"] == 8) { $main[$m] = load_model("Office_hours")->get($main[$m]["cid"]); $main[$m]["u"] = load_model("Members")->get($main[$m]["mid"]); if ($main[$m]) { $main[$m]["cat"] = "office"; } else { $main[$m]["cat"] = ""; } } else { if ($main[$m]["type"] == 10) { $main[$m] = load_model("Program")->get($main[$m]["cid"]); $main[$m]["u"] = load_model("Members")->get($main[$m]["user_id"]); if ($main[$m]) { $main[$m]["cat"] = "benefits"; } else { $main[$m]["cat"] = ""; } } } } } } } } # new if ($_opt) { $l_main = sizeof($main); if ($l_main < $_opt) { $tt = 0; for ($t = $l_main; $t < $_opt; $t++) { $main[$t] = $main[$tt]; $tt++; if ($tt == $l_main) { $tt = 0; } } } else { $main = array_slice($main, 0, $_opt); } } return $main; }
<?php /** * Template created by Gregory Chris */ load_model('admin/tutorials'); if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Save') { if (array_key_exists('post_id', $_POST) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) { update_post($_POST['post_id'], $_POST); } } if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Delete') { if (array_key_exists('post_id', $_POST) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) { delete_post($_POST['post_id']); } } if (array_key_exists('submit', $_POST) && $_POST['submit'] == 'Add') { add_post($_POST); } header('Location: ' . _HTTP_ROOT . '/admin/tutorials/'); die;
<?php /** * Template created by Gregory Chris */ if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['username']) && !empty($_POST['password'])) { load_model('admin/funcs'); $user = get_user($_POST['username'], $_POST['password']); if (!empty($user)) { $_SESSION['user'] = $user; } } header('Location: ' . $_SERVER['HTTP_REFERER']); die;