Overview

Packages

  • controller
  • models
  • None

Classes

  • Ajax
  • Article
  • Cache
  • Employee
  • Firefly
  • gmreader
  • gmsite
  • Home
  • Link
  • Merchant
  • Model_article
  • Model_cache
  • Model_employee
  • Model_firefly
  • Model_gmreader
  • Model_gmsite
  • Model_link
  • Model_merchant
  • Model_reference
  • Model_user
  • Reference
  • Setting
  • User

Functions

  • check_permission
  • data_status
  • data_status_select
  • dump_html_tree
  • employee_select
  • file_get_html
  • generate_page
  • gerenate_pager_from_table
  • get_desc_asc
  • get_url_support
  • is_admin
  • is_loggedin
  • link_extractor
  • merchant_status
  • reference_reverter
  • role_select
  • siteinfo
  • str_get_html
  • yes_no
  • yesno_select
  • Overview
  • Package
  • Class
  1: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2: 
  3: class Firefly extends CI_Controller {
  4: 
  5:     /* Article List Page */
  6:     public function index()
  7:     {
  8:         $this->load->model('Model_firefly');
  9:         $this->Model_firefly->remove_article_full();
 10:         $this->load->view('head');
 11:         $this->load->view('firefly/list');
 12:         $this->load->view('foot');
 13:     }
 14:     
 15:     /* Article Add */
 16: 
 17:     public function add(){
 18: 
 19:         $this->load->model('Model_firefly');
 20:         $ar = $this->Model_firefly->add();
 21:         $this->load->view('head');      
 22:         $this->load->view('firefly/add',(is_array($ar)?$ar:array()));
 23:         $this->load->view('foot');
 24:     }
 25:     
 26:     /* Article Edit */
 27:     public function edit($id,$action = ''){
 28:         $id_decrypted = base64_decode(urldecode($id));
 29:         $this->load->model('Model_firefly');
 30:         $ar = $this->Model_firefly->update($id);
 31:         $data['article'] = $this->Model_firefly->pick($id);
 32:         $this->load->view('head',(is_array($ar)?$ar:array()));      
 33:         $this->load->view('firefly/edit',$data);
 34:         $this->load->view('foot');
 35:     }
 36:     /* Article Popups */
 37:     public function poplist(){
 38:         if($this->input->get('selected')!=''){
 39:             $url = base64_decode(urldecode($this->input->get('selected'))); 
 40:                 
 41:             $this->session->set_flashdata('current_article',$url);
 42:             //echo $this->session->flashdata('current_article');exit();
 43:         }
 44:         $this->load->model('Model_firefly');
 45:         $this->Model_firefly->remove_article_full();
 46:         $this->load->view('head_pop');
 47:         $this->load->view('firefly/list-popup');
 48:         $this->load->view('foot_pop');
 49:     }
 50:     
 51:     /* Article Generate Reference */
 52:     public function generate()
 53:     {
 54:         $this->load->model('Model_firefly');
 55:         $this->load->view('head');      
 56:         $this->load->view('firefly/generate');
 57:         $this->load->view('foot');
 58:     }
 59: 
 60:     /* Article View */
 61:     public function detail($id,$backup_id = ''){
 62:         $this->load->model('Model_firefly');
 63:         $article = '';
 64:         $article = $this->Model_firefly->pick($id);
 65:         $this->load->view('head');      
 66:         $this->load->view('firefly/detail',array('article'=>$article));
 67:     }
 68:     /* Link Parser */
 69:     public function core($id){
 70:         $this->load->model('Model_firefly');
 71:         $this->load->view('head');      
 72:         $this->load->view('firefly/link',array('article'=>$this->Model_firefly->pick($id),'indexs'=>$this->Model_firefly->index($id),'references'=>$this->Model_firefly->reference($id)));
 73:         $this->load->view('foot');
 74:     }
 75:     
 76:     /* Cache Creator */
 77:     public function cache($action = 'refresh'){
 78:         $all_nodes = $this->db->query('select * from xenon_data limit 1000');
 79:         foreach($all_nodes->result() as $article){
 80:             $ref_count = 0;
 81:             $dom = new DOMDocument();
 82:             $dom->loadHTML(html_entity_decode(mb_convert_encoding($article->data_body_temp,"HTML-ENTITIES","UTF-8")));
 83:             $a_tags = $dom->getElementsByTagName('a');
 84:             foreach ($a_tags as $a_tag) {
 85:                 $txt = str_replace('&#38;','&amp;',str_replace('’', "'", $a_tag->nodeValue));
 86:                 $txt = htmlentities($txt);
 87:                 if($txt == 'references'){
 88:                     $ref_count = $ref_count + 1;
 89:                     $txt = '['.$ref_count.']';
 90:                 }
 91:                 echo $txt.'<br />';
 92:             }
 93:             
 94:             /*$data_final['data_body_cache'] = substr($dom->saveHTML(),119,-15);
 95:             $this->db->where('data_id',$article->data_id);
 96:             $this->db->update('xenon_data',$data_final);*/
 97:         }
 98:     }
 99: 
100:     public function links(){
101:         $this->load->model('Model_firefly');
102:         $this->load->view('head');      
103:         $this->load->view('firefly/link');
104:         $this->load->view('foot');
105:     }
106:     
107:     /* Product Match Generator */
108:     
109:     public function matchprod($user_id){
110:         $this->load->model('Model_firefly');
111:         $this->load->view('head');      
112:         $this->load->view('firefly/match');
113:         $this->load->view('foot');
114:     }
115:     
116:     public function portal(){
117:         $this->load->model('Model_firefly');
118:         $this->load->view('head');      
119:         $this->load->view('firefly/portal');
120:         $this->load->view('foot');  
121:     }
122:     
123:     public function submit(){
124:         $this->load->model('Model_firefly');
125:         if(isset($_POST['action'])){
126:             unset($_POST['action']);
127:             $_POST['user_opening'] = $_POST['content'];
128:             unset($_POST['content']);
129:             $_POST['user_theme'] = serialize($_POST['user_theme']);
130:             $data = $_POST;
131:             $id = $this->Model_firefly->add_portal($data);
132:             redirect('firefly/manage/'.$id);
133:         }
134:         $this->load->view('head');      
135:         $this->load->view('firefly/new_portal');
136:         $this->load->view('foot');  
137:     }
138:     
139:     public function manage($portalId){
140:         $this->load->model('Model_firefly');
141:         if(isset($_POST['action'])){
142:             unset($_POST['action']);
143:             $_POST['user_opening'] = $_POST['content'];
144:             unset($_POST['content']);
145:             $_POST['user_theme'] = serialize($_POST['user_theme']);
146:             $data = $_POST;
147:             $id = $this->Model_firefly->update_portal($portalId,$data);
148:         }
149:         $this->load->view('head');
150:         $portal = $this->Model_firefly->get_portal($portalId);      
151:         $portal->user_theme = unserialize($portal->user_theme);
152:         $this->load->view('firefly/portal_detail',array('portal'=>$portal));
153:         $this->load->view('foot');          
154:     }
155: }
API documentation generated by ApiGen