Example #1
0
 public function add($param = false)
 {
     $this->load->helper('url_helper');
     $auth = is_login_on($this);
     $msg = '';
     if ($param) {
         $msg = $param;
     }
     $header_data = array('base' => $this->config->item('base_url'), 'index' => $this->config->item('index_url'), 'css' => array($this->config->item('css_cat_skin_ccav1'), $this->config->item('css_cat_oh_nav1')), 'js' => array($this->config->item('jquery')), 'title' => 'Cat-Favorites_add', 'desc' => '');
     //----------------------------------------------------------------
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $type = trim($_POST['type']);
         switch ($type) {
             case 0:
                 //导入
                 $file = $_FILES['icon_file']['tmp_name'];
                 $this->import_url($file);
                 $msg = 'ok';
                 break;
         }
     }
     //----------------------------------------------------------------
     $this->load->model('cat_favorites');
     $types = $this->cat_favorites->cat_get_favorites_type();
     //dropdown
     $this->load->helper('form');
     $dropdownarray = array();
     foreach ($types as $type) {
         $dropdownarray[$type->type_id] = $type->name;
     }
     $dropdown = form_dropdown('url_type', $dropdownarray, '');
     $this->load->view('favorites/add.tpl.php', array('header' => $this->load->view('header.tpl.php', $header_data, TRUE), 'auth' => $auth, 'base' => $this->config->item('base_url'), 'msg' => $msg, 'types' => $types, 'dropdown' => $dropdown, 'cat_menu' => $this->load->view('layout/top.tpl.php', array('current' => 'Add', 'base' => $this->config->item('base_url'), 'auth' => $this->session->userdata('username')), TRUE)));
 }
Example #2
0
 private function help()
 {
     //is_login
     $this->load->helper('url_helper');
     $auth = is_login_on($this);
     //load model
     $this->load->model('cat_favorites');
     $this->cat_favorites->cat_insert_favorites(array('title' => '', 'url' => '', 'created_at' => date('Y-m-d H:i:s', time())));
     //load session
     $this->load->library('session');
     $this->session->set_userdata(array('username', ''));
     $auth = $this->session->userdata('username');
     //$_GET
     parse_str($_SERVER['QUERY_STRING'], $getparam);
     //$getparam
 }