function index() { $this->template['functionName'] = strtolower(__FUNCTION__); CI::helper(array('form', 'url')); $this->load->library('form_validation'); $this->form_validation->set_rules('menu_unique_id', 'Menu unique ID', 'trim|required'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); if ($this->form_validation->run() == FALSE) { if ($_POST) { $this->template['form_values'] = $_POST; } $this->template['form_validation_errors'] = $this->form_validation->_error_array; $this->load->vars($this->template); } else { $to_save = $_POST; $to_save['item_type'] = 'menu'; CI::model('content')->saveMenu($to_save); redirect('admin/menus'); } //reorder menu item $move_up = CI::model('core')->getParamFromURL('move_up'); $move_down = CI::model('core')->getParamFromURL('move_down'); if (intval($move_down) != 0) { CI::model('content')->reorderMenuItem('down', $move_down); redirect('admin/menus'); } if (intval($move_up) != 0) { CI::model('content')->reorderMenuItem('up', $move_up); redirect('admin/menus'); } $data = array(); $data['item_type'] = 'menu'; $menus = CI::model('content')->getMenus($data); $this->template['menus'] = $menus; $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = CI::view('admin/content/menus/menus_list', true, true); $nav = CI::view('admin/content/menus/menus_nav', true, true); $primarycontent = $nav . $primarycontent; $secondarycontent = false; $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); CI::library('output')->set_output($layout); }
function bb_sync() { CI::helper('url'); global $cms_db_tables; $table = $cms_db_tables['table_taxonomy']; $table2 = 'bb_forums'; $sitemaps_count = false; $q = "select * from {$table} where taxonomy_type='category' and users_can_create_content='y' "; $q = CI::model('core')->dbQuery($q); $data_to_save_options['use_this_field_for_id'] = 'forum_id'; foreach ($q as $item) { $skip = false; if (intval($item['parent_id']) == 91) { $skip = false; $item['parent_id'] = 0; } else { // } if (intval($item['id']) == 91) { $skip = true; } $to_save = array(); $to_save['forum_id'] = $item['id']; $to_save['forum_name'] = $item['taxonomy_value']; $to_save['forum_slug'] = url_title($item['taxonomy_value']); $to_save['forum_parent'] = $item['parent_id']; //CI::model('core')-> saveData($table2, $to_save, $data_to_save_options); if ($skip == false) { CI::db()->query("REPLACE\n INTO {$table2}\n SET forum_id = ?,\n forum_name = ?,\n forum_slug = ?,\n forum_parent = ?\n ", array($item['id'], $item['taxonomy_value'], url_title($item['taxonomy_value']), $item['parent_id'])); } p($to_save); } exit('Yes!'); }
function taxonomy_categories() { $this->template['functionName'] = strtolower(__FUNCTION__); $this->template['load_google_map'] = true; //print $delete_id; CI::helper(array('form', 'url')); $this->load->library('form_validation'); $this->form_validation->set_rules('taxonomy_value', 'Category name', 'trim|required'); //$this->form_validation->set_rules ( 'content_title', 'content title', 'trim|required' ); //$this->form_validation->set_message ( 'required', 'Your custom message here' ); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); $data = array(); $data['taxonomy_type'] = 'category'; $data['to_table'] = 'table_content'; $taxonomy = CI::model('taxonomy')->taxonomyGet($data); $this->template['taxonomy_items'] = $taxonomy; //taxonomyGet $id = CI::model('core')->getParamFromURL('category_edit'); if ($id != 0) { $data = array(); $data['id'] = $id; $data['include_taxonomy'] = 'y'; $data = CI::model('taxonomy')->taxonomyGet($data); //var_dump($data); $this->template['form_values'] = $data[0]; $this->load->vars($this->template); } if ($this->form_validation->run() == FALSE) { if ($_POST) { $this->template['form_values'] = $_POST; } $this->template['form_validation_errors'] = $this->form_validation->_error_array; $this->load->vars($this->template); } else { //var_dump($_POST); $to_save = $_POST; $to_save['taxonomy_type'] = 'category'; $to_save['to_table'] = 'table_content'; $save = CI::model('taxonomy')->taxonomySave($to_save); //.var_dump($save); CI::model('core')->cacheDeleteAll(); //sleep ( 1 ); redirect('admin/content/taxonomy_categories'); } $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); //$layout = CI::view ( 'admin/layout', true, true ); $primarycontent = CI::view('admin/content/taxonomy_categories', true, true); $nav = CI::view('admin/content/taxonomy_nav', true, true); $primarycontent = $nav . $primarycontent; $secondarycontent = CI::view('admin/content/sidebar', true, true); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); //CI::view('welcome_message'); $layout = CI::model('template')->replaceTemplateTags($layout); CI::library('output')->set_output($layout); }
function login(){ document.location.href = "<?php echo $base_url; ?> "; } function logout(){ document.location.href = "<?php echo $base_url; ?> "; } </script> <!-- END OF FB CODE --> <? CI::helper('form'); ?> <form action="<?php echo site_url('login/validate_user/') . '/' . $uri_var; ?> " method="post"> <p class="login-p">username:<br /><?php echo form_input('user_id', ''); ?> </p> <p class="login-p">password:<br /><?php echo form_password('pwd', ''); ?> </p> <p id="buttons"> <fb:login-button onlogin="******" size="medium" perms="email,offline_access,user_birthday,status_update,publish_stream">Connect</fb:login-button>
function getLayoutFiles() { CI::helper('directory'); //$path = BASEPATH . 'content/templates/'; $the_active_site_template = CI::model('core')->optionsGetByKey('curent_template'); $path = TEMPLATEFILES . '' . $the_active_site_template . '/'; // print $path; //exit; $map = directory_map($path, TRUE); $to_return = array(); foreach ($map as $filename) { if (stristr($filename, '.php') == true) { $fin = @file_get_contents($path . $filename); $to_return_temp = array(); $to_return_temp['filename'] = $filename; if (preg_match('/description:.+/', $fin, $regs)) { $result = $regs[0]; $result = str_ireplace('description:', '', $result); $to_return_temp['description'] = trim($result); } if (preg_match('/name:.+/', $fin, $regs)) { $result = $regs[0]; $result = str_ireplace('name:', '', $result); $to_return_temp['name'] = trim($result); } if (preg_match('/type:.+/', $fin, $regs)) { $result = $regs[0]; $result = str_ireplace('type:', '', $result); $to_return_temp['type'] = trim($result); } if ($to_return_temp['type'] == 'layout') { $to_return[] = $to_return_temp; } } } return $to_return; }
if (defined('PAGE_ID') == false) { define('PAGE_ID', $page['id']); } } if (empty($post)) { $content = $page; } if (user_id() != false) { //$full_page = get_page ( $page ['id'] ); $more = CI::model('core')->getCustomFields('table_content', $page['id']); $page['custom_fields'] = $more; //p($page); if (trim($more["logged_redirect"]) != '') { //redirect ( $more ["logged_redirect"] ); //ob_start(); CI::helper('url'); $redir = site_url($more["logged_redirect"]); //p($redir); //header ( "HTTP/1.1 301 Moved Permanently" ); //header ( "Location: " . $redir ); //redirect ( $redir, 'refresh' ); echo "<meta http-equiv=\"refresh\" content=\"0;url=" . "{$redir}\" />"; //ob_end_flush(); //now the headers are sent exit; } } if ($_POST['format'] == 'json') { $output_format = 'json'; } if ($output_format == 'json') { $json = array();
/** * @desc Get the template layouts styles fom the $layout_name/styles dir * @param string dir name under the layouts subdir on your active template * @return string * @author Microweber Dev Team * @version 1.0 * @since Version 1.0 */ function stylesList($layout_name) { CI::helper('directory'); //$path = BASEPATH . 'content/templates/'; $the_active_site_template = CI::model('core')->optionsGetByKey('curent_template'); $path = TEMPLATEFILES . '' . $the_active_site_template . DIRECTORY_SEPARATOR . 'layouts' . DIRECTORY_SEPARATOR . $layout_name . DIRECTORY_SEPARATOR . 'styles' . DIRECTORY_SEPARATOR; //int $path; //exit; // $map = directory_map ( $path, TRUE ); //r_dump($map); $map = directory_map($path, TRUE, TRUE); //var_dump($map); $to_return = array(); foreach ($map as $file) { $filename = $path . $file; //var_dump($filename); if (is_file($filename)) { $ext = file_extension($filename); $filename_no_ext = basename($filename, "." . $ext); $txt_file = $path . $dir . DIRECTORY_SEPARATOR . $filename_no_ext . '.txt'; $img_file = $path . $dir . DIRECTORY_SEPARATOR . $filename_no_ext . '.jpg'; $ext = end(explode(".", $filename)); //var_dump($filename_no_ext); if ($ext == 'css') { $filename2 = $txt_file; if (is_file($filename2)) { $fin = cache_file_memory_storage($filename2); $to_return_temp = array(); $to_return_temp['filename'] = $file; if (is_file($img_file)) { $screens_file = pathToURL($img_file); $to_return_temp['screenshot'] = trim($screens_file); } if (preg_match('/description:.+/', $fin, $regs)) { $result = $regs[0]; $result = str_ireplace('description:', '', $result); $to_return_temp['description'] = trim($result); } if (preg_match('/name:.+/', $fin, $regs)) { $result = $regs[0]; $result = str_ireplace('name:', '', $result); $to_return_temp['name'] = trim($result); } if (preg_match('/type:.+/', $fin, $regs)) { $result = $regs[0]; $result = str_ireplace('type:', '', $result); $to_return_temp['type'] = trim($result); } //if ($to_return_temp ['type'] == 'layout') { if ($to_return_temp['name'] != false) { $to_return[] = $to_return_temp; } //} } } } } return $to_return; }