public function index() { //$sitemap = new google_sitemap; //Create a new Sitemap Object $posts = Model('blog')->getRecentPosts('50'); $item = Library('sitemap')->google_sitemap_item(site_url(), date("Y-m-d", time()), 'daily', '1.0'); //Create a new Item Library('sitemap')->add_item($item); foreach ($posts->result_array() as $entry) { $link = get_page_url($entry); //Create a new Item $item = Library('sitemap')->google_sitemap_item(site_url($link), date("Y-m-d", strtotime($entry['page_date'])), 'daily', '0.5'); //Append the item to the sitemap object Library('sitemap')->add_item($item); } Library('sitemap')->build("sitemap.xml"); //Build it... //Let's compress it to gz $data = implode("", file("sitemap.xml")); $gzdata = gzencode($data, 9); $fp = fopen("sitemap.xml.gz", "w"); fwrite($fp, $gzdata); fclose($fp); //Let's Ping google $this->_pingGoogleSitemaps(base_url() . "/sitemap.xml.gz"); echo site_url(); }
function index() { $data = ''; if (isset($_POST['delete'])) { $data = $this->_delete(); } elseif (isset($_POST['approve'])) { $data = $this->_approve(); } /* * START: Pagination config and initialization */ $this->load->library('pagination'); $config['per_page'] = '20'; $config['uri_segment'] = 3; $config['num_links'] = 2; if ($this->uri->segment(3, 'pending-comment') == 'pending-comment') { $status = 0; } else { $status = 1; } $config['base_url'] = trim(site_url(), '/') . "/comment/" . $this->uri->segment(3, 'approved-comment') . "/"; $config['total_rows'] = Model('comment')->get_comment_count($status); $this->pagination->initialize($config); //END: Pagination //Get page content for the selected menu item. $data['pagination'] = $this->pagination->create_links(); //load comment menu $data['comment'] = Model('comment')->get_comment($config['per_page'], $this->uri->segment(3, 0), $status); //--- $html_string = $this->load->view('admin/comment/comment_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
private function _check_access() { $is_admin = $this->CI->user('is_admin'); if (!$is_admin) { return FALSE; } $group_id = $this->CI->user('group_id'); //@todo::check if the user can access //Check access rights Library('login')->check_login($group_id); $page = trim($this->CI->cfAdminController . '/' . $this->CI->cfAdminMethod, '/'); $defaultToAll = array('sortdata/menu', 'sortdata/folder', 'sortdata/group', 'form/ajax', 'file/file-search-form'); if (in_array($page, $defaultToAll)) { return TRUE; } $can_access = Model('module')->can_access($group_id, $page); if ($can_access) { return TRUE; } $default_landing = Model('module')->default_landing($group_id); if (!$default_landing) { return FALSE; } $msg = array('error' => '<p>You need access to perform action on page <strong>' . $page . '</strong>. </p>'); setMessages($msg, 'error'); redirect('admin/' . $default_landing); return TRUE; }
function index() { $data = ''; //--- $html_string = $this->load->view('admin/catalog/catalog_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
/** * User Group * Create group */ function index() { $data = ''; $data['group_id'] = $group_id = $this->input->post('group_id', 1); $data['modules'] = Model('module')->get(); $data['module_ids'] = Model('module')->get_ids(); $data['groups'] = Model('groups/permission')->get_group(); if (isset($_POST['group_id']) && isset($_POST['permission'])) { Model('groups/permission')->update_permissions($_POST['group_id'], $_POST['permission']); } $data['permissions'] = Model('groups/permission')->get_group_permission($group_id); //--- $html_string = $this->load->view('admin/group/permission_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
/** * Control Panel Admin(Index) Page Function * Get Top Page Of The Website. */ function index() { $data = ''; $sort = 1; $menu_item = Library('module')->_getAdminNav(); $query = $this->db->order_by('parent')->get('module'); $modules_db = $query->result_array(); foreach ($modules_db as $k => $v) { $modules_db[$v['url']] = $v; unset($modules_db[$k]); } foreach ($menu_item as $v) { $sql = array(); $key = 0; $sql[$key] = array('parent' => 'top', 'status' => 1, 'sort' => $sort++, 'url' => $v['url'], 'title' => $v['title'], 'is_menu' => $v['is_menu'], 'void' => $v['void'], 'menu' => serialize($v), 'child' => ''); if (isset($v['child']) && count($v['child']) > 0) { $sql[$key++]['child'] = serialize(array_keys($v['child'])); foreach ($v['child'] as $k2 => $v2) { $sql[$key] = array('parent' => $v['url'], 'status' => 1, 'sort' => $sort++, 'url' => $v2['url'], 'title' => $v2['title'], 'is_menu' => $v2['is_menu'], 'void' => $v2['void'], 'child' => ''); if (isset($v2['child']) && count($v2['child']) > 0) { $sql[$key++]['child'] = serialize(array_keys($v2['child'])); foreach ($v2['child'] as $k3 => $v3) { $sql[$key++] = array('parent' => $v2['url'], 'status' => 1, 'sort' => $sort++, 'url' => $v3['url'], 'title' => $v3['title'], 'is_menu' => $v3['is_menu'], 'void' => $v3['void'], 'child' => ''); } } $key++; } $key++; } foreach ($sql as $k => $v) { if (isset($modules_db[$v['url']])) { $this->db->update('module', $v, array('url' => $v['url'])); unset($sql[$k]); } } if (count($sql) > 0) { $this->db->insert_batch('module', $sql); } } //--- $html_string = $this->load->view('admin/moduleinstaller/moduleinstaller_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
/** * Control Panel Admin/Update Page Function * Get Release Notes From Official Site Of Codefight CMS. */ function update() { error_reporting(0); $data = ''; $codefight = array(); if ($xml =& simplexml_load_file('http://codefight.org/feed/releases')) { $channel = $xml->channel; foreach ($channel as $v) { foreach ($v->item as $w) { $codefight[] = $w; } } } $data['codefight'] = $codefight; //--- $html_string = $this->load->view('admin/cp/update_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
</a></h2> </div> <div id="pagenav"><?php //Load page menu horizontal block Library('block')->load('menu/page_horizontal', 'portfolio'); ?> </div> </div> <div id="main"> <div class="container"><?php //Load message block Library('block')->load('page_html/message'); //Load Content Block Library('block')->load($content_block, 'portfolio'); ?> </div> </div> <div id="footer"> <div class="footernav"> <ul> <li class="page_item page-item-3 current_page_item"> <a href="<?php echo base_url(); ?> " title="Home">Home</a> </li> </ul>
function sitemap() { $data = array(); $data['websites'] = Model('websites')->get_websites(); //--- $html_string = $this->load->view('admin/setting/sitemap_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
function index() { $url_to_trim = $this->input->post('longurl', TRUE); //Remove the last slash while (substr($url_to_trim, -1) == '/') { $url_to_trim = substr($url_to_trim, 0, -1); } //$url_to_trim = prep_url($url_to_trim); $error = FALSE; $data = array(); if (!empty($url_to_trim) && preg_match('|^https?://|', $url_to_trim)) { $this->config->load('trim.php'); $this->base = $this->config->item('allowed_chars'); //check if the client's IP is allowed to trim if ($_SERVER['REMOTE_ADDR'] != $this->config->item('limit_to_ip')) { $msg = array('error' => '<p>You are not allowed to trim URLs with this service.</p>'); setMessages($msg, 'error'); $error = TRUE; } // check if the URL is valid $pos = strpos($url_to_trim, base_url()); if ($this->config->item('verify_url') && !$error || $pos === FALSE) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url_to_trim); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($ch); if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == '404') { $msg = array('error' => '<p>That is not a valid URL.</p>'); setMessages($msg, 'error'); $error = TRUE; } curl_close($ch); } if (!$error) { // check if the URL has already been trimed $this->db->where('long_url', $url_to_trim); $query = $this->db->get('trim'); $already_trimed = $query->result_array(); if (!empty($already_trimed)) { // URL has already been trimed $integer = $already_trimed[0]['trim_id']; $trimed_url = $this->_getShortUrl($integer); } else { // URL not in database, insert $sql = array('long_url' => $url_to_trim, 'created' => time(), 'creator' => $_SERVER['REMOTE_ADDR']); $this->db->insert('trim', $sql); $trimed_url = $this->_getShortUrl($this->db->insert_id()); } $data['trim'] = site_url('trim/' . $trimed_url); $data['url'] = $url_to_trim; $msg = array('success' => '<p>URL successfully Trimed.</p>'); setMessages($msg, 'success'); } } elseif (isset($_POST['longurl'])) { $msg = array('error' => '<p>Not a valid URL.</p>'); setMessages($msg, 'error'); } $html_string = $this->load->view('admin/trim/trim_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
<script type="text/javascript">jQuery(document).ready(function($) { if($('#slider').length) { $('#slider').s3Slider({ timeOut: 5000 }); } });</script> <script type='text/javascript' src='<?php echo $this->config->item('skin_url'); ?> skin/frontend/portfolio/js/l10n.js?ver=20101110'></script> <script type='text/javascript' src='<?php echo $this->config->item('skin_url'); ?> skin/frontend/portfolio/js/comment-reply.js?ver=20090102'></script> <?php //Get Assets (js|css) //Library('asset')->get(); //If head text variable is set, echo it. if (isset($head_text)) { echo (string) $head_text; } //Load General_js.php file Library('block')->load('includes/general_js'); //Load Google Analytics Library('block')->load('seo/google_analytics'); ?> </head>
function parseContent($content = array(), $show_blurb = TRUE) { $_content = array(); if (isset($content) && is_array($content) && count($content) > 0) { foreach ($content as $k => $v) { //check access $access = Model('data')->is_granted($v['group_id']); //Get Author + Date Block $author_date = Model('data')->author_date($v['page_author'], $v['page_date'], $v['show_author'], $v['show_date']); //Get Tags Block $page_tag = Model('data')->page_tag($v['page_tag']); //Get Tags Block $content_content = Library('parser/bbcode')->parse(Model('data')->page_content($v, $show_blurb)); //$page_content = $this->phpcolor->color_code($content_content); $page_content = $content_content; //Get the Year | Month | Day the post was posted $_content[$k]['year'] = Model('data')->post_year($v['show_date'], $v['page_date']); $_content[$k]['month'] = Model('data')->post_month($v['show_date'], $v['page_date']); $_content[$k]['day'] = Model('data')->post_day($v['show_date'], $v['page_date']); //check to see if there is a form if (preg_match_all('#{{form (.+)}}#isU', $page_content, $identifier)) { $form = Library('form')->create($identifier, current_url()); if (isset($_POST['identifier'])) { $page_content .= '<script type="text/javascript"> jQuery(document).ready(function(){check_form();}); function check_form() { jQuery.post( \'form/ajax\', { '; foreach ($_POST as $pk => $pv) { if (!is_array($_POST[$pk])) { $page_content .= "{$pk}:document.getElementById(\"{$pk}\").value, \n"; } else { //print_r($_POST); foreach ($_POST[$pk] as $chk_k => $chk_v) { $page_content .= "'" . $pk . '[' . $chk_k . ']' . "'" . ':document.getElementById("' . $pk . '[' . $chk_k . ']").value, ' . "\n"; } } } $page_content .= ' }, function(data){ jQuery(\'#message_' . $_POST['identifier'] . '\').html(data); } ); } </script>'; } //replace identifiers with form. foreach ($form as $f) { $page_content = preg_replace('#' . $f['block'] . '#isU', $f['form'], $page_content); } } //check to see if there is a form if (preg_match_all('#{{banner (.+)}}#isU', $page_content, $identifier)) { $page_content = Model('banner')->parse($page_content, $identifier); } $_content[$k]['categories'] = Model('data')->post_category($v['menu_id'], true); //$v['menu_id'] = explode(',',$v['menu_id']); //$v['menu_id'] = array_filter($v['menu_id']); //$v['menu_id'] = array_shift($v['menu_id']); $link = get_page_url($v); //Model('data')->link_create(array(0 => 'page', 1 => $v['menu_id'], 3 => $v['page_id'], 4 => Model('data')->link_clean($v['page_title']))); //If the user has right to view this content... if ($access) { //Show heading of the content, ... $_content[$k]['title'] = $v['page_title']; $_content[$k]['author_date'] = $author_date; $_content[$k]['content'] = $page_content; $_content[$k]['tag'] = $page_tag; //add share button $_content[$k]['addthis'] = '<br /><!-- AddThis Button BEGIN --><div class="addthis_toolbox addthis_default_style "><a class="addthis_button_google_plusone"></a><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=dbashyal"></script><!-- AddThis Button END -->'; if (isset($v['allow_comment']) && $v['allow_comment']) { $data['page_id'] = $v['page_id']; $data['link'] = $link; //include($template_path . '/blocks/comment.php'); $this->lang->load('comment'); $_content[$k]['comment'] = Library('block')->load('comment', false, '.php', true); } } else { //Show heading of the content, ... $_content[$k]['title'] = $v['page_title']; $_content[$k]['author_date'] .= $author_date; //... but Display message to login $_content[$k]['content'] .= '<p class="error">You do not have access right to view this part of content, Please login.</p>'; $_content[$k]['tag'] .= $page_tag; } //Count total comment $_content[$k]['comment_count'] = Model('data')->post_comment_count($v['page_id']); } } //END: Foreach return $_content; }
function _edit() { $data = ''; Library('asset')->addJs('tiny_mce/tiny_mce'); $data['authors'] = $this->get_authors(); $id_array = array(); if (!isset($_POST['page'])) { if (isset($_POST['select'])) { $id_array = $_POST['select']; } else { $msg = array('error' => "<p>You must select atleast one page to edit</p>"); setMessages($msg, 'error'); unset($_POST); $this->index(); exit; } } !is_array($id_array) ? $id_array = array() : ''; //START: for the first page load, get data from database foreach ($id_array as $id) { $id = preg_replace('/[^0-9]+/', '', $id); $this->db->where('page_id', $id); $query = $this->db->get('page'); foreach ($query->result() as $row) { $_POST['page'][$row->page_id]['id'] = $row->page_id; $_POST['page'][$row->page_id]['page_active'] = $row->page_active; $_POST['page'][$row->page_id]['page_title'] = $row->page_title; //$_POST['page'][$row->page_id]['page_blurb'] = $row->page_blurb; //$_POST['page'][$row->page_id]['page_blurb_length'] = $row->page_blurb_length; $_POST['page'][$row->page_id]['page_body'] = $row->page_body; $_POST['page'][$row->page_id]['menu_id'] = $row->menu_id; $_POST['page'][$row->page_id]['websites_id'] = $row->websites_id; $_POST['page'][$row->page_id]['user_id'] = $row->user_id; $_POST['page'][$row->page_id]['page_author'] = $row->page_author; $_POST['page'][$row->page_id]['page_tag'] = $row->page_tag; $_POST['page'][$row->page_id]['page_date'] = $row->page_date; $_POST['page'][$row->page_id]['show_date'] = $row->show_date; $_POST['page'][$row->page_id]['show_author'] = $row->show_author; $_POST['page'][$row->page_id]['allow_comment'] = $row->allow_comment; $_POST['page'][$row->page_id]['page_meta_title'] = $row->page_meta_title; $_POST['page'][$row->page_id]['page_meta_keywords'] = $row->page_meta_keywords; $_POST['page'][$row->page_id]['page_meta_description'] = $row->page_meta_description; $_POST['page'][$row->page_id]['page_sort'] = $row->page_sort; $_POST['page'][$row->page_id]['group_id'] = array('1', '2', '3'); } $this->db->where('page_id', $id); $query = $this->db->get('page_access'); //$test = $query->result_array(); foreach ($query->result() as $row) { $_POST['page'][$row->page_id]['group_id'] = explode('_', $row->group_id); } //To make it multiple selected, we need more than two elements in array. if (count($_POST['page'][$row->page_id]['group_id']) == 1) { $_POST['page'][$row->page_id]['group_id'][] = '0'; } } //END: for the first page load, get data from database //START: clean data and update in database if ($this->input->post('edit') == 'Update' && isset($_POST['page']) && is_array($_POST['page'])) { foreach ($_POST['page'] as $v) { if (empty($v['menu_id'])) { $v['menu_id'][0] = 0; } if (empty($v['websites_id'])) { $v['websites_id'][0] = 0; } //print_r($v); //cleaning $id = xss_clean($v['id']); $page_active = xss_clean($v['page_active']); $page_title = $v['page_title']; $page_blurb = ''; //$page_blurb_length = xss_clean($v['page_blurb_length']); $page_body = $v['page_body']; $user_id = $v['user_id']; $page_author = $v['page_author']; $page_tag = $v['page_tag']; $page_date = date('Y-m-d H:i:s', strtotime($v['page_date'])); $show_date = isset($v['show_date']) ? $v['show_date'] : '0'; $show_author = isset($v['show_author']) ? $v['show_author'] : '0'; $allow_comment = isset($v['allow_comment']) ? $v['allow_comment'] : '0'; $page_body = $v['page_body']; //$menu_id = $v['menu_id']; $page_meta_title = xss_clean($v['page_meta_title']); $page_meta_keywords = xss_clean($v['page_meta_keywords']); $page_meta_description = xss_clean($v['page_meta_description']); $page_sort = xss_clean($v['page_sort']); $page_break = explode('<!-- pagebreak -->', $page_body); if (isset($page_break[0])) { $page_blurb = trim($page_break[0]); if (substr($page_blurb, -1, 3) == '<p>') { $page_blurb = substr($page_blurb, 0, -3); } } //clean up menu ids $menu_id = array(); foreach ($v['menu_id'] as $w) { $w = xss_clean($w); $menu_id[$w] = $w; } $websites_id = array(); foreach ($v['websites_id'] as $w) { $w = xss_clean($w); $websites_id[$w] = $w; } //clean up group id, selected from multi select $group_id = array(); foreach ($v['group_id'] as $w) { $group_id[] = xss_clean($w); } //clean the data to autofill in form $_POST['page'][$id]['id'] = $id; $_POST['page'][$id]['page_active'] = $page_active; $_POST['page'][$id]['page_title'] = $page_title; //$_POST['page'][$id]['page_blurb'] = $page_blurb; //$_POST['page'][$id]['page_blurb_length'] = $page_blurb_length; $_POST['page'][$id]['page_body'] = $page_body; $_POST['page'][$id]['user_id'] = $user_id; $_POST['page'][$id]['page_author'] = $page_author; $_POST['page'][$id]['page_tag'] = $page_tag; $_POST['page'][$id]['page_date'] = $page_date; $_POST['page'][$id]['show_date'] = $show_date; $_POST['page'][$id]['show_author'] = $show_author; $_POST['page'][$id]['allow_comment'] = $allow_comment; $_POST['page'][$id]['menu_id'] = $menu_id; $_POST['page'][$id]['websites_id'] = $websites_id; $_POST['page'][$id]['page_meta_title'] = $page_meta_title; $_POST['page'][$id]['page_meta_keywords'] = $page_meta_keywords; $_POST['page'][$id]['page_meta_description'] = $page_meta_description; $_POST['page'][$id]['page_sort'] = $page_sort; $_POST['page'][$id]['group_id'] = $group_id; //update database if set if (!empty($page_title) && !empty($page_body) && !empty($id)) { //delete previous tag //$this->db->delete('page_tag', array('page_id' => $id)); //delete|decrement previous tag count $this->db->where('page_id', $id); $query = $this->db->get('page'); $page_data = $query->result_array(); if ($page_data[0]['websites_id']) { $websites_ids = explode(',', trim($page_data[0]['websites_id'], ',')); Model('data')->tag_cloud_delete($id, $this->uri->segment(3, 'page'), $websites_ids); } //Model('data')->tag_cloud_delete($id, $this->uri->segment(3, 'page'), $websites_id); //update page $this->db->where('page_id', $id); $this->db->update('page', array('page_active' => $page_active, 'page_title' => $page_title, 'page_blurb' => $page_blurb, 'page_body' => $page_body, 'user_id' => $user_id, 'page_author' => $page_author, 'page_tag' => $page_tag, 'page_date' => $page_date, 'show_date' => $show_date, 'show_author' => $show_author, 'allow_comment' => $allow_comment, 'menu_id' => ',' . implode(',', $menu_id) . ',', 'websites_id' => ',' . implode(',', $websites_id) . ',', 'page_meta_title' => $page_meta_title, 'page_meta_keywords' => $page_meta_keywords, 'page_meta_description' => $page_meta_description, 'page_sort' => $page_sort)); //update page access $this->db->where('page_id', $id); $this->db->delete('page_access'); $this->db->insert('page_access', array('page_id' => $id, 'group_id' => implode('_', $group_id))); //update page tags if (isset($page_tag)) { $page_tag = explode(',', $page_tag); if (is_array($page_tag) && count($page_tag) > 0) { foreach ($page_tag as $v) { //clean tag $tag = url_title($v); //add|increment tag count Model('data')->tag_cloud_add($tag, $this->uri->segment(3, 'page'), $v, $websites_id); //insert tag to tag table $this->db->insert('page_tag', array('page_id' => $id, 'tag' => $tag)); } } } } $msg = array('success' => "<p>Updated successfully.</p>"); setMessages($msg, 'success'); } } //END: validate data and update in database //--- $html_string = $this->load->view('admin/' . $this->uri->segment(3, 'page') . '/page_edit_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
//Load Footer Block Library('block')->load('menu/sponsored_links_vertical'); ?> </div> <p class="clear"> </p> <div class="copyright"><?php //Load copyright Block Library('block')->load('page_html/copyright'); ?> </div> <p class="clear"> </p> <div class="powered_by"><?php //Load Powered By Block: I hope you keep as it is. Thanks. Library('block')->load('page_html/powered_by'); ?> </div> </div> </div> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> <img style="display:none;" src="http://www.feedburner.com/fb/images/pub/feed-icon32x32.png" width="0" height="0" alt=""/> <script type="text/javascript" src="http://s.skimresources.com/js/45041X1159517.skimlinks.js"></script> <?php Library('block')->load('seo/wibiya'); ?> </body> </html>
<?php if (!defined('BASEPATH')) { exit(__('No direct script access allowed')); } /* * Check app/modules folder for adding/removing menu items. * Menu is controlled from config files, * so its easy to add and remove. * Those configs are read every page visit in admin, * @todo::which will be cached in later versions to improve more performance. */ error_reporting(E_ALL); //$menu_item = $this->cf_module_lib->_getAdminNav(); $menu_item = Library('module')->get_nav_from_db(); //$cache = Library('cache')->cache(60); //print_r(get_class_vars(get_class($cache))); //$test = $cache->_display(json_encode($menu_item), 'blahblah_id'); //print_r($test); ?> <style type="text/css"> #top-menu-wrapper{background: #222;} ul#main-nav { list-style: none; padding: 0 20px; margin: 0; float: left; min-width: 908px; background: #222; font-size: 12px; z-index: 10;
<?php if (!defined('BASEPATH')) { exit('No direct script access allowed'); } $menu = array('menu_type' => 'page', 'ul_param' => 'class="sf-menu sf-js-enabled sf-shadow"'); $menu = Library('menu')->get($menu); if (!empty($menu)) { //echo '<div class="round15 sidebar-header">Blog Categories</div>'; echo $menu; }
</div> <p class="clear"> </p> <div class="copyright"> <?php Library('block')->load('page_html/copyright'); //Load copyright Block ?> </div> <p class="clear"> </p> <div class="powered_by"> <?php Library('block')->load('page_html/powered_by'); //Powered By: Please give me some credit :) ?> </div> </div> </div> </body> </html>
public function process_view($data = array(), $master_page = 'mainpage', $module = 'frontend') { //Get available templates, this should be called first //as this will get and set default template $data['templates'] = Model('setting')->get_templates(); //Get template $template = Model('setting')->selected_template(); //Get Body Id $data['bodyId'] = $this->getBodyId(); //load vars | so it can be retrived at view as variable $this->load->vars($data); //Get data from view. $template = $module . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . DIRECTORY_SEPARATOR . $master_page; $html_string = $this->load->view($template, '', true); if (isset($this->setting->display_view_path) && $this->setting->display_view_path == true) { echo '<p>' . $template . '</p>'; } Library('process')->view($html_string); }
function create_folder() { $data = ''; $this->load->library('form_validation'); $data['folder'] = Model('file')->get_active_folder(); $data['group'] = Model('group')->get_group(FALSE); $data['user'] = Model('user')->get_active_user(); $val = array(array('field' => 'active', 'label' => 'Status', 'rules' => 'trim|required|xss_clean'), array('field' => 'name', 'label' => 'Folder Name', 'rules' => 'trim|required|xss_clean'), array('field' => 'parent', 'label' => 'Parent Folder', 'rules' => 'trim|required|xss_clean'), array('field' => 'access', 'label' => 'ASSIGN TO', 'rules' => 'trim|required|xss_clean')); if (isset($_POST['access'])) { //--- switch ($_POST['access']) { case 'group': $val[] = array('field' => 'group[]', 'label' => 'User Group', 'rules' => 'trim|required|xss_clean'); $val[] = array('field' => 'user[]', 'label' => 'User', 'rules' => 'trim|xss_clean'); break; case 'user': $val[] = array('field' => 'group[]', 'label' => 'User Group', 'rules' => 'trim|xss_clean'); $val[] = array('field' => 'user[]', 'label' => 'User', 'rules' => 'trim|required|xss_clean'); break; default: $val[] = array('field' => 'group[]', 'label' => 'User Group', 'rules' => 'trim|xss_clean'); $val[] = array('field' => 'user[]', 'label' => 'User', 'rules' => 'trim|xss_clean'); } } $this->form_validation->set_rules($val); if ($this->form_validation->run() == FALSE) { if (validation_errors() !== '' && $this->input->post('create') == 'Create') { $msg = array('error' => validation_errors()); setMessages($msg, 'error'); } } else { $active = set_value('active'); $parent = set_value('parent'); $name = set_value('name'); $access = set_value('access'); $group = set_value('group[]'); $user = set_value('user[]'); $config['upload_path'] = FCPATH . 'media/folder-thumbs/'; $upload_data = $this->_upload($config); $folder = array('active' => $active, 'parent' => $parent, 'name' => $name, 'access' => $access, 'group' => $group, 'user' => $user, 'thumb' => $upload_data); //FCPATH $insert = Model('file')->create_folder($folder); if ($insert) { $msg = array('success' => '<p>New Folder(s) Created.</p>'); setMessages($msg, 'success'); } else { $msg = array('error' => '<p>Could not create folder specified.</p>'); setMessages($msg, 'error'); } } $data['folder'] = Model('file')->get_active_folder(); //--- $html_string = $this->load->view('admin/folder/folder_create_view', $data, TRUE); //Get view data in place of sending to browser. Library('process')->view($html_string); }
function _manage_group_item() { $data = ''; $id_array = array(); //if its not submitting edit page (form_item_edit_view.php) if (!isset($_POST['group'])) { if (isset($_POST['select'])) { $id_array = $_POST['select']; } else { $msg = array('error' => '<p>You must select atleast one item to edit.</p>'); setMessages($msg, 'error'); unset($_POST); $this->group(); exit; } } !is_array($id_array) ? $id_array = array() : ''; //START: for the first page load, get data from database foreach ($id_array as $id) { $id = preg_replace('/[^0-9]+/', '', $id); $this->db->where('form_group_id', $id); $query = $this->db->get('form_group'); foreach ($query->result() as $row) { $_POST['group'][$row->form_group_id]['form_group_id'] = $row->form_group_id; $_POST['group'][$row->form_group_id]['form_group_name'] = $row->form_group_name; $_POST['group'][$row->form_group_id]['form_group_identifier'] = $row->form_group_identifier; $_POST['group'][$row->form_group_id]['form_group_send_to'] = $row->form_group_send_to; } } //END: for the first page load, get data from database //START: clean data and update in database if ($this->input->post('edit') == 'Update' && isset($_POST['group']) && is_array($_POST['group'])) { foreach ($_POST['group'] as $v) { //cleaning $form_group_id = $v['form_group_id']; //clean the data to autofill in form $_POST['group'][$form_group_id]['form_group_id'] = $form_group_id; $_POST['group'][$form_group_id]['form_group_name'] = $v['form_group_name']; $_POST['group'][$form_group_id]['form_group_identifier'] = $v['form_group_identifier']; $_POST['group'][$form_group_id]['form_group_send_to'] = $v['form_group_send_to']; //update database if set if (!empty($v['form_group_name']) && !empty($v['form_group_identifier']) && !empty($v['form_group_id'])) { $this->db->where('form_group_id', $v['form_group_id']); $this->db->update('form_group', array('form_group_name' => $v['form_group_name'], 'form_group_identifier' => $v['form_group_identifier'], 'form_group_send_to' => $v['form_group_send_to'])); } //['update']: to avoid repeated success_message $msg = array('success' => '<p>Updated successfully.</p>'); setMessages($msg, 'success'); } } //END: validate data and update in database //--- $html_string = $this->load->view('admin/form/form_group_item_manage_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
/** * Login * * @access public * @return void */ public function login() { $data = ''; $val = array(array('field' => 'password', 'label' => 'Password', 'rules' => 'trim|required|xss_clean|md5'), array('field' => 'email', 'label' => 'Email', 'rules' => 'trim|required|valid_email|xss_clean')); $this->form_validation->set_rules($val); if ($this->form_validation->run() == FALSE) { if (!validation_errors() == '') { $msg = array('login' => validation_errors()); setMessages($msg, 'error'); } } else { $email = set_value('email'); $password = set_value('password'); /* check login */ Library('login')->process_login($email, $password); /* ------ */ if ($this->session->userdata('logged_in') == FALSE) { // display login error $msg = array('error' => '<p>Invalid Login Data, Please try again.</p>'); setMessages($msg, 'error'); } else { // display login success message $msg = array('success' => '<p>Login Successful.</p>'); setMessages($msg, 'success'); } } //main content block [content view] $data['content_block'] = 'registration/login_view'; /* | @process_view('data', 'master page') | @see app/core/MY_Controller.php */ $this->process_view($data); }
function _edit() { $data = ''; $id_array = array(); if (!isset($_POST['menu'])) { if (isset($_POST['select'])) { $id_array = $_POST['select']; } else { //$data['error_message']['select'] = "You must select atleast one menu to edit"; $msg = array('error' => '<p>You must select atleast one menu to edit.</p>'); setMessages($msg, 'error'); unset($_POST); $this->index(); exit; } } !is_array($id_array) ? $id_array = array() : ''; $menu_type = $this->uri->segment(3, 'page'); //START: for the first page load, get data from database foreach ($id_array as $id) { $id = preg_replace('/[^0-9]+/', '', $id); $this->db->where('menu_id', $id); $query = $this->db->get('menu'); foreach ($query->result() as $row) { $_POST['menu'][$row->menu_id]['id'] = $row->menu_id; $_POST['menu'][$row->menu_id]['menu_active'] = $row->menu_active; $_POST['menu'][$row->menu_id]['menu_parent_id'] = $row->menu_parent_id; $_POST['menu'][$row->menu_id]['menu_title'] = $row->menu_title; $_POST['menu'][$row->menu_id]['menu_link'] = $row->menu_link; $_POST['menu'][$row->menu_id]['menu_params'] = $row->menu_params; $_POST['menu'][$row->menu_id]['websites_id'] = $row->websites_id; $_POST['menu'][$row->menu_id]['menu_sort'] = $row->menu_sort; } } //END: for the first page load, get data from database //START: clean data and update in database if ($this->input->post('edit') == 'Update' && isset($_POST['menu']) && is_array($_POST['menu'])) { foreach ($_POST['menu'] as $v) { //cleaning $id = xss_clean($v['id']); $menu_active = xss_clean($v['menu_active']); $menu_parent_id = xss_clean($v['menu_parent_id']); $menu_title = $v['menu_title']; $menu_link = $v['menu_link']; $menu_params = $v['menu_params']; $menu_sort = xss_clean($v['menu_sort']); $menu_type = $this->uri->segment(3, 'page'); if (!isset($v['websites_id'])) { $v['websites_id'] = 0; } $websites_id = xss_clean($v['websites_id']); //If menu link is not defined, create one. if (empty($menu_link)) { $menu_link = preg_replace('/[^a-z0-9]+/i', '-', strtolower($menu_title)); } //remove last dashes if any while (substr($menu_link, -1) == '-') { $menu_link = substr($menu_link, 0, -1); } //clean the data to autofill in form $_POST['menu'][$id]['id'] = $id; $_POST['menu'][$id]['menu_active'] = $menu_active; $_POST['menu'][$id]['menu_parent_id'] = $menu_parent_id; $_POST['menu'][$id]['menu_title'] = $menu_title; $_POST['menu'][$id]['menu_link'] = $menu_link; $_POST['menu'][$id]['menu_params'] = $menu_params; $_POST['menu'][$id]['menu_sort'] = $menu_sort; $_POST['menu'][$id]['websites_id'] = $websites_id; //update database if set if (!empty($menu_title) && !empty($menu_link) && !empty($id)) { /* $this->db->where('menu_id', $id); $this->db->update('menu', array( 'menu_active' => $menu_active, 'menu_parent_id' => $menu_parent_id, 'menu_title' => $menu_title, 'menu_link' => $menu_link, 'menu_type' => $menu_type, 'menu_sort' => $menu_sort)); */ $_menu_data = array('menu_id' => $id, 'menu_active' => $menu_active, 'menu_parent_id' => $menu_parent_id, 'menu_link' => $menu_link, 'menu_params' => $menu_params, 'menu_title' => $menu_title, 'menu_type' => $menu_type, 'menu_meta_title' => '', 'menu_meta_keywords' => '', 'menu_meta_description' => '', 'websites_id' => ',' . implode(',', (array) $websites_id) . ',', 'menu_sort' => $menu_sort); //insert new menu to database $insert = Model('menu')->update($_menu_data); } //['update']: to avoid repeated success_message /* $msg = array('success' => '<p>Updated successfully.</p>'); setMessages($msg, 'success'); */ } } //END: validate data and update in database //--- $data['websites'] = Model('websites')->get_websites(); $html_string = $this->load->view('admin/menu/menu_edit_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
function _edit() { $data = ''; $id_array = array(); if (!isset($_POST['group'])) { if (isset($_POST['select'])) { $id_array = $_POST['select']; } else { $msg = array('error' => '<p>You must select atleast one group to edit.</p>'); setMessages($msg, 'error'); unset($_POST); $this->index(); exit; } } !is_array($id_array) ? $id_array = array() : ''; //START: for the first page load, get data from database foreach ($id_array as $id) { $id = preg_replace('/[^0-9]+/', '', $id); $this->db->where('group_id', $id); $query = $this->db->get('group'); foreach ($query->result() as $row) { $_POST['group'][$row->group_id]['id'] = $row->group_id; $_POST['group'][$row->group_id]['title'] = $row->group_title; $_POST['group'][$row->group_id]['description'] = $row->group_description; } } //END: for the first page load, get data from database //START: clean data and update in database if ($this->input->post('edit') == 'Update' && isset($_POST['group']) && is_array($_POST['group'])) { $msg = false; foreach ($_POST['group'] as $v) { //cleaning $id = xss_clean($v['id']); $title = xss_clean($v['title']); $description = xss_clean($v['description']); //clean the data to autofill in form $_POST['group'][$id]['id'] = $id; $_POST['group'][$id]['title'] = xss_clean($v['title']); $_POST['group'][$id]['description'] = xss_clean($v['description']); //update database if set if (!empty($title) && !empty($description) && !empty($id)) { $this->db->where('group_id', $id); $this->db->update('group', array('group_title' => $title, 'group_description' => $description)); if (!$msg) { $msg = array('success' => '<p>Updated successfully.</p>'); setMessages($msg, 'success'); } } } } //END: validate data and update in database //--- $html_string = $this->load->view('admin/group/group_edit_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
/** * @param string $html_string * @param bool $minify_this_page */ function view($html_string = '', $minify_this_page = true) { $CI =& get_instance(); if ($CI->cfModule != 'admin') { preg_match_all('/{{parse\\-(.*)\\s\\s*(.*)\\s*}}/isU', $html_string, $matches); if (count($matches) > 1) { foreach ($matches[1] as $k => $v) { $v = preg_replace('/[^a-z0-9]/isU', '', strtolower($v)); $html_string = Library('parser/' . $v)->parse($html_string, $matches); } } $html_string = preg_replace('/\\[\\[BASE_URL\\]\\]/i', base_url(), $html_string); /*@Deprecated - it's now managed through parser. preg_match_all('/{{tag\s\s*(.*)\s*}}/isU', $html_string, $matches); if(isset($matches[1])){ foreach($matches[1] as $k => $v){ preg_match_all("@\s*(.+)='(.+)'@isU", trim($v), $v); if(isset($v[1])){ $tagCode = $matches[0][$k]; $title = $url = $attr = ''; foreach($v[1] as $k1 => $v1){ $v1 = strtolower(trim($v1)); $v[2][$k1] = trim($v[2][$k1]); if($v1=='url'){ if(!preg_match('/mailto:|https?:\/\//isU',$v[2][$k1])){ $v[2][$k1] = site_url(url_title(strtolower(trim($v[2][$k1])))); } $url = $v[2][$k1]; } else if($v1=='title'){ $title = $v[2][$k1]; } else { $attr .= " {$v1}=\"{$v[2][$k1]}\""; } } if(empty($url) && !empty($title)){ $url = site_url('blog/tag/'.url_title(strtolower($title))); } if(empty($title)){ $tagReplace = $url; }else{ $tagReplace = '<a href="'. $url .'"'. $attr .'>' . $title . '</a>'; } $html_string = str_replace($tagCode, $tagReplace, $html_string); } } } */ //preg_match_all('/{{tag\s*(url=\'(.*)\')?\s*(rel=\'(.*)\')?\s*(title=\'(.*)\')?\s*(.*)}}/iSu', $html_string, $matches); $html_string = preg_replace('/\\{\\*\\{/i', '{{', $html_string); $html_string = preg_replace('/\\}\\*\\}/i', '}}', $html_string); } $html_string = preg_replace('/\\[\\*\\[/i', '[[', $html_string); $html_string = preg_replace('/\\]\\*\\]/i', ']]', $html_string); //Do you want to minify your html $html_tidy = Library('asset')->minify_html; //$CI->config->item('cf_minify_html'); if ($html_tidy == '1' && $minify_this_page == true) { $html_string = preg_replace('#>\\s+?<#sU', '><', $html_string); $html_string = trim(preg_replace('/\\s\\s+/', ' ', $html_string)); } echo $html_string; }
function _edit() { $this->load->library('form_validation'); $data = ''; $success_count = 1; $id_array = array(); if (!isset($_POST['user'])) { if (isset($_POST['select'])) { $id_array = $_POST['select']; } else { $msg = array('error' => '<p>You must select atleast one user to edit.</p>'); setMessages($msg, 'error'); unset($_POST); $this->index(); exit; } } !is_array($id_array) ? $id_array = array() : ''; //START: for the first page load, get data from database foreach ($id_array as $id) { $id = preg_replace('/[^0-9]+/', '', $id); $this->db->where('user_id', $id); $query = $this->db->get('user'); foreach ($query->result() as $row) { $_POST['user'][$row->user_id]['id'] = $row->user_id; $_POST['user'][$row->user_id]['active'] = $row->active; $_POST['user'][$row->user_id]['email'] = $row->email; $_POST['user'][$row->user_id]['firstname'] = $row->firstname; $_POST['user'][$row->user_id]['lastname'] = $row->lastname; $_POST['user'][$row->user_id]['group_id'] = $row->group_id; $_POST['user'][$row->user_id]['is_admin'] = $row->is_admin; $_POST['user'][$row->user_id]['is_author'] = $row->is_author; $_POST['user'][$row->user_id]['profile'] = $row->profile; $_POST['user'][$row->user_id]['profile_link'] = $row->profile_link; //$_POST['user'][$row->user_id]['password'] = $row->password; } } //END: for the first page load, get data from database //START: clean data and update in database if ($this->input->post('edit') == 'Update' && isset($_POST['user']) && is_array($_POST['user'])) { foreach ($_POST['user'] as $v) { //cleaning $id = (int) preg_replace('/[^0-9]+/', '', $v['id']); //only intergers $active = (int) preg_replace('/[^0-9]+/', '', $v['active']); $email = $v['email']; $firstname = $v['firstname']; $lastname = $v['lastname']; $profile = $v['profile']; $profile_link = $v['profile_link']; $is_author = (int) preg_replace('/[^0-9]+/', '', $v['is_author']); $is_admin = (int) preg_replace('/[^0-9]+/', '', $v['is_admin']); $group_id = (int) preg_replace('/[^0-9]+/', '', $v['group_id']); $password = $v['password']; //clean the data to autofill in form $_POST['user'][$id]['id'] = $id; $_POST['user'][$id]['active'] = $active; $_POST['user'][$id]['email'] = $email; $_POST['user'][$id]['firstname'] = $firstname; $_POST['user'][$id]['lastname'] = $lastname; $_POST['user'][$id]['is_admin'] = $is_admin; $_POST['user'][$id]['is_author'] = $is_author; $_POST['user'][$id]['group_id'] = $group_id; $_POST['user'][$id]['password'] = $password; $_POST['user'][$id]['profile'] = $profile; $_POST['user'][$id]['profile_link'] = $profile_link; //update database if set if (!empty($email) && !empty($group_id) && !empty($id)) { $_POST['email'] = $email; $_POST['is_admin'] = $is_admin; $_POST['is_author'] = $is_author; $_POST['group_id'] = $group_id; $_POST['firstname'] = $firstname; $_POST['lastname'] = $lastname; $_POST['password'] = $password; $_POST['profile'] = $profile; $_POST['profile_link'] = $profile_link; $val = array(array('field' => 'email', 'label' => 'Email', 'rules' => 'trim|required|valid_email'), array('field' => 'is_admin', 'label' => 'Is Admin', 'rules' => 'trim|required'), array('field' => 'is_author', 'label' => 'Is Author', 'rules' => 'trim|required'), array('field' => 'group_id', 'label' => 'Group', 'rules' => 'trim|required'), array('field' => 'password', 'label' => 'Password', 'rules' => 'trim|md5'), array('field' => 'firstname', 'label' => 'First Name', 'rules' => 'trim|required'), array('field' => 'lastname', 'label' => 'Last Name', 'rules' => 'trim|required'), array('field' => 'profile', 'label' => 'Profile', 'rules' => 'trim'), array('field' => 'profile_link', 'label' => 'Profile Link', 'rules' => 'trim')); $this->form_validation->set_rules($val); if ($this->form_validation->run() == FALSE) { if (!validation_errors() == '' && $this->input->post('edit') == 'Update') { $msg = array('error' => validation_errors()); setMessages($msg, 'error'); } } else { $my_data = array('active' => $active, 'email' => set_value('email'), 'user_id' => $id, 'firstname' => set_value('firstname'), 'lastname' => set_value('lastname'), 'profile' => $profile, 'profile_link' => set_value('profile_link'), 'is_author' => set_value('is_author'), 'is_admin' => set_value('is_admin'), 'group_id' => set_value('group_id')); if (!empty($password)) { $my_data['password'] = set_value('password'); } $save = Model('user')->reset()->set('table', 'user')->set('action', 'update')->save($my_data); if ($save) { $msg = array('success' => '<p>' . $success_count++ . ' Records Updated successfully.</p>'); setMessages($msg, 'success', false); } } } else { $msg = array('error' => '<p>Required fields can not be empty!</p>'); setMessages($msg, 'error'); } } } //END: validate data and update in database //--- $html_string = $this->load->view('admin/user/user_edit_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
function edit_file() { $data = ''; $success_count = 1; $id_array = array(); //$_POST['file'] || see edit view file if (!isset($_POST['file'])) { if (isset($_POST['select'])) { $id_array = $_POST['select']; } else { $msg = array('error' => '<p>You must select atleast one file to edit.</p>'); setMessages($msg, 'error'); unset($_POST); $this->index(); exit; } } $this->load->library('form_validation'); $data['folder'] = Model('file')->get_active_folder(); $data['group'] = Model('group')->get_group(FALSE); $data['user'] = Model('user')->get_active_user(); !is_array($id_array) ? $id_array = array() : ''; //START: for the first page load, get data from database foreach ($id_array as $id) { $id = preg_replace('/[^0-9]+/', '', $id); $this->db->where('file_id', $id); $query = $this->db->get('file'); foreach ($query->result() as $row) { $_POST['file'][$row->file_id]['id'] = $row->file_id; $_POST['file'][$row->file_id]['active'] = $row->file_status; $_POST['file'][$row->file_id]['access'] = $row->file_access; $_POST['file'][$row->file_id]['parent'] = $row->folder_id; $_POST['file'][$row->file_id]['name'] = $row->file_title; $_POST['file'][$row->file_id]['description'] = $row->file_description; $file_access_members = explode(',', trim($row->file_access_members, ',')); $_POST['file'][$row->file_id]['group'] = $file_access_members; $_POST['file'][$row->file_id]['user'] = $file_access_members; } } //END: for the first page load, get data from database //START: clean data and update in database if ($this->input->post('edit') == 'Update' && isset($_POST['file']) && is_array($_POST['file'])) { foreach ($_POST['file'] as $k => $v) { //cleaning $id = xss_clean($v['id']); //set_value('id'); $active = xss_clean($v['active']); //set_value('active'); $name = xss_clean($v['name']); //set_value('name'); $description = xss_clean($v['description']); //set_value('description'); $access = xss_clean($v['access']); $group = ''; if (isset($v['group'])) { $group = xss_clean($v['group']); } $user = ''; if (isset($v['user'])) { $user = xss_clean($v['user']); } //clean the data to autofill in form $_POST['file'][$id]['id'] = $id; $_POST['file'][$id]['active'] = $active; $_POST['file'][$id]['name'] = $name; $_POST['file'][$id]['description'] = $description; $_POST['file'][$id]['access'] = $access; $_POST['file'][$id]['group'] = $group; $_POST['file'][$id]['user'] = $user; //update database if set if (!empty($access) && !empty($name) && !empty($id)) { $val = array(array('field' => 'file[' . $k . '][active]', 'label' => 'STATUS[id: ' . $id . ']', 'rules' => 'trim|required|xss_clean'), array('field' => 'file[' . $k . '][name]', 'label' => 'FILE NAME[id: ' . $id . ']', 'rules' => 'trim|required|xss_clean'), array('field' => 'file[' . $k . '][description]', 'label' => 'FILE DESCRIPTION[id: ' . $id . ']', 'rules' => 'trim|xss_clean'), array('field' => 'file[' . $k . '][access]', 'label' => 'ASSIGN TO', 'rules' => 'trim|required|xss_clean')); if (isset($_POST['file'][$k]['access'])) { //--- switch ($_POST['file'][$k]['access']) { case 'group': $val[] = array('field' => 'file[' . $k . '][group][]', 'label' => 'User Group', 'rules' => 'trim|required|xss_clean'); $val[] = array('field' => 'file[' . $k . '][user][]', 'label' => 'User', 'rules' => 'trim|xss_clean'); break; case 'user': $val[] = array('field' => 'file[' . $k . '][group][]', 'label' => 'User Group', 'rules' => 'trim|xss_clean'); $val[] = array('field' => 'file[' . $k . '][user][]', 'label' => 'User', 'rules' => 'trim|required|xss_clean'); break; default: $val[] = array('field' => 'file[' . $k . '][group][]', 'label' => 'User Group', 'rules' => 'trim|xss_clean'); $val[] = array('field' => 'file[' . $k . '][user][]', 'label' => 'User', 'rules' => 'trim|xss_clean'); } } $this->form_validation->set_rules($val); if ($this->form_validation->run() == FALSE) { if (!validation_errors() == '' && $this->input->post('edit') == 'Update') { $msg = array('error' => validation_errors()); setMessages($msg, 'error'); } } else { $file = array('id' => $id, 'active' => $active, 'name' => $name, 'description' => $description, 'access' => $access, 'group' => $group, 'user' => $user); //FCPATH $update = Model('file')->update_file($file); if ($update) { $msg = array('success' => '<p>' . $success_count++ . ' Records Updated successfully.</p>'); setMessages($msg, 'success', false); } else { $msg = array('error' => '<p>Could not update files specified.</p>'); setMessages($msg, 'error'); } } } else { $msg = array('error' => '<p>Required fields can not be empty!</p>'); setMessages($msg, 'error'); } } } //END: validate data and update in database //--- $html_string = $this->load->view('admin/file/file_edit_view', $data, true); //Get view data in place of sending to browser. Library('process')->view($html_string); }
function parseContent($content = array(), $show_blurb = TRUE) { $_content = array(); if (isset($content) && is_array($content) && count($content) > 0) { foreach ($content as $k => $v) { //check access $access = Model('data')->is_granted($v['group_id']); //Get Author + Date Block $author_date = Model('data')->author_date($v); //Get Tags Block $page_tag = Model('data')->page_tag($v['page_tag']); //Get Tags Block $content_content = Library('parser/bbcode')->parse(Model('data')->page_content($v, $show_blurb)); //$page_content = $this->phpcolor->color_code($content_content); $page_content = $content_content; //Get the Year | Month | Day the post was posted $_content[$k]['year'] = Model('data')->post_year($v['show_date'], $v['page_date']); $_content[$k]['month'] = Model('data')->post_month($v['show_date'], $v['page_date']); $_content[$k]['day'] = Model('data')->post_day($v['show_date'], $v['page_date']); //check to see if there is a form if (preg_match_all('#{{form (.+)}}#isU', $page_content, $identifier)) { $form = Library('form')->create($identifier, current_url()); if (isset($_POST['identifier'])) { $page_content .= '<script type="text/javascript"> jQuery(document).ready(function(){check_form();}); function check_form() { jQuery.post( \'form/ajax\', { '; foreach ($_POST as $pk => $pv) { if (!is_array($_POST[$pk])) { $page_content .= "{$pk}:document.getElementById(\"{$pk}\").value, \n"; } else { //print_r($_POST); foreach ($_POST[$pk] as $chk_k => $chk_v) { $page_content .= "'" . $pk . '[' . $chk_k . ']' . "'" . ':document.getElementById("' . $pk . '[' . $chk_k . ']").value, ' . "\n"; } } } $page_content .= ' }, function(data){ jQuery(\'#message_' . $_POST['identifier'] . '\').html(data); } ); } </script>'; } //replace identifiers with form. foreach ($form as $f) { $page_content = preg_replace('#' . $f['block'] . '#isU', $f['form'], $page_content); } } //check to see if there is a form if (preg_match_all('#{{banner (.+)}}#isU', $page_content, $identifier)) { $page_content = Model('banner')->parse($page_content, $identifier); } $_content[$k]['categories'] = Model('data')->post_category($v['menu_id'], true); //$v['menu_id'] = explode(',',$v['menu_id']); //$v['menu_id'] = array_filter($v['menu_id']); //$v['menu_id'] = array_shift($v['menu_id']); $link = get_page_url($v); //Model('data')->link_create(array(0 => 'page', 1 => $v['menu_id'], 3 => $v['page_id'], 4 => Model('data')->link_clean($v['page_title']))); //If the user has right to view this content... if ($access) { //Show heading of the content, ... $_content[$k]['title'] = $v['page_title']; $_content[$k]['title-link'] = anchor($link, $v['page_title']); $_content[$k]['title-url'] = $link; $_content[$k]['author_date'] = $author_date; $_content[$k]['content'] = $page_content; $_content[$k]['tag'] = $page_tag; if ($this->uri->segment(3, 0) == $v['page_id']) { //add share button $_content[$k]['addthis'] = '<br /><!-- AddThis Button BEGIN --><script type="text/javascript">var addthis_pub="dbashyal";</script><a href="http://www.addthis.com/bookmark.php?v=20" onmouseover="return addthis_open(this, \'\', \'[URL]\', \'[TITLE]\')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script><!-- AddThis Button END -->'; $_content[$k]['sharethis'] = ' <div class="post_share social-media"><div class="large-buttons"><div class="wdt_button"> <iframe id="tweet_frame_483679" name="tweet_frame_483679" allowtransparency="true" frameborder="0" role="presentation" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url=' . urlencode(site_url($link)) . '&via=@codefight&text=' . urlencode($v['page_title']) . '&count=vertical" width="55" height="63"></iframe> </div><div class="wdt_button wdt_fb"><fb:share-button href="' . site_url($link) . '" type="box_count"></fb:share-button></div><div class="wdt_button"> <script src="http://www.stumbleupon.com/hostedbadge.php?s=5&r=' . urlencode(site_url($link)) . '&title=' . urlencode($v['page_title']) . '"></script></div></div><div class="small-buttons" style="display:none"><div class="wdt_button_min"> <iframe id="tweet_frame_483679" name="tweet_frame_483679" allowtransparency="true" frameborder="0" role="presentation" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url=' . urlencode(site_url($link)) . '&via=@codefight&text=' . urlencode($v['page_title']) . '&count=horizontal" width="110" height="20"></iframe> </div><div class="wdt_button_min"><fb:share-button href="' . $link . '" type="button_count"></fb:share-button></div><div class="wdt_button_min"> <script src="http://www.stumbleupon.com/hostedbadge.php?s=1&r=' . urlencode(site_url($link)) . '&title=' . urlencode($v['page_title']) . '"></script></div><div class="wdt_button_min"> <a class="chicklet" id="st_email_min" href="javascript:void(0);">email</a></div><div class="wdt_button_min" ><a class="chicklet" id="st_sharethis_min" href="javascript:void(0);">share</a> <script type="text/javascript"> var shared_object = SHARETHIS.addEntry({title: "' . $v['page_title'] . '",url: "' . site_url($link) . '"}, {button:false,onmouseover:false}); shared_object.attachButton(document.getElementById(\'st_sharethis_min\')); shared_object.attachChicklet(\'email\', document.getElementById(\'st_email_min\')); </script> </div></div><div class="wdt_button"><a class="chicklet" id="st_email" href="javascript:void(0);">email</a></div><div class="wdt_button"> <a class="chicklet" id="st_sharethis" href="javascript:void(0);">share</a> <script type="text/javascript"> var shared_object = SHARETHIS.addEntry({title: "' . $v['page_title'] . '",url: "' . site_url($link) . '"}, {button:false,onmouseover:false}); shared_object.attachButton(document.getElementById(\'st_sharethis\'));shared_object.attachChicklet(\'email\', document.getElementById(\'st_email\')); </script></div></div>'; if (isset($v['allow_comment']) && $v['allow_comment']) { $data['page_id'] = $v['page_id']; $data['link'] = $link; //include($template_path . '/blocks/comment.php'); $this->lang->load('comment'); $_content[$k]['comment'] = Library('block')->load('comment', false, '.php', true); } } } else { //Show heading of the content, ... $_content[$k]['title'] = $v['page_title']; $_content[$k]['author_date'] .= $author_date; //... but Display message to login $_content[$k]['content'] .= '<p class="error">You do not have access right to view this part of content, Please login.</p>'; $_content[$k]['tag'] .= $page_tag; } //Count total comment $_content[$k]['comment_count'] = Model('data')->post_comment_count($v['page_id']); } } //END: Foreach return $_content; }
function __construct() { parent::MY_Controller(); $this->load->helper('file'); Library('banner'); }
function _mergeCnfs($files = array()) { if (!count($files)) { return ''; } $nav = array(); $sort = array(); $xmlRaw = '<' . '?xml version="1.0"?' . '><cfmodules>'; foreach ($files as $v) { $xmlRaw .= preg_replace('@<\\?xml(.+)\\?>@iU', '', file_get_contents($v)); } $xmlRaw .= '</cfmodules>'; $xmlData = Library('simplexml')->xml_parse($xmlRaw); if (!isset($xmlData['module'])) { return array(); } foreach ($xmlData['module'] as $k => $v) { $position = 99999; if (!isset($v['active']) || strtolower($v['active']) !== 'true') { continue; } //die($data->active);// if (isset($v['sort'])) { $position = (string) $v['sort']; } if (isset($v['admin']['navigation'])) { $data = $v['admin']['navigation']; if (!isset($sort[key($data)]) || $sort[key($data)] > $position) { $sort[key($data)] = $position; } $nav = array_merge_recursive($nav, $data); } } asort($sort); foreach ($sort as $k => $v) { $sort[$k] = $nav[$k]; unset($nav[$k]); } return array_merge_recursive($sort, $nav); }
startTop:139, pageWidth:1190, shareLeft:-94, marginFixed:'0 7px 4px -676px', animate:false }); } }) </script> </div> </div> <?php //Load message block Library('block')->load('page_html/message'); //Load Content Block Library('block')->load($content_block, 'sketchawebsite'); ?> </div> <p> </p> <div id="pagination"><?php if (isset($data->pagination)) { echo str_replace('http://templates.zoosper.org/cat', site_url() . uri_segment(1), $data->pagination); } ?> </div> </div> <div class="comments"></div> </div>