function index() { $this->template['functionName'] = strtolower(__FUNCTION__); $data = array(); $data['is_moderated'] = 'n'; $form_values = CI::model('comments')->commentsGet($data); $this->template['new_comments'] = $form_values; $this->load->vars($this->template); $data = array(); $data['is_moderated'] = 'y'; $limit[0] = 0; $limit[1] = 100; $form_values = CI::model('comments')->commentsGet($data); $this->template['old_comments'] = $form_values; $this->load->vars($this->template); $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('admin/comments/index', true, true); //$secondarycontent = CI::view ( 'admin/content/sidebar', true, true ); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); //CI::view('welcome_message'); CI::library('output')->set_output($layout); }
function load() { $plugin_name = $this->uri->segment(4); $this->template['functionName'] = strtolower(__FUNCTION__); $this->template['pluginName'] = $plugin_name; $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = ''; $secondarycontent = ''; $plugindata = CI::model('core')->plugins_getPluginConfig($plugin_name); // //print PLUGINS_DIRNAME . $dirname .$plugin_name.'/'.$plugindata['plugin_admin_dir']. '/controller.php' ; if (is_file(PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/controller.php') == true) { $firecms = get_instance(); define('THIS_PLUGIN_URL', site_url('admin/plugins/load') . '/' . $plugin_name . '/'); define('THIS_PLUGIN_DIRNAME', PLUGINS_DIRNAME . $dirname . $plugin_name . '/'); define('THIS_PLUGIN_DIRNAME_ADMIN', PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/'); require_once PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/controller.php'; } //$primarycontent = CI::view ( 'admin/comments/index', true, true ); //$secondarycontent = CI::view ( 'admin/content/sidebar', true, true ); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); //CI::view('welcome_message'); CI::library('output')->set_output($layout); }
function edit() { $this->template['functionName'] = strtolower(__FUNCTION__); $this->load->vars($this->template); if ($_POST) { $save = $this->cacaomail_model->saveMailAccounts($_POST); redirect('mailaccounts'); } $segs = $this->uri->segment_array(); $the_id = false; foreach ($segs as $segment) { if (stristr($segment, 'id:') == true) { $the_id = $segment; $the_id = substr($the_id, 3, strlen($the_id)); } } if (intval($the_id) != 0) { $form_values = $this->cacaomail_model->getMailAccounts(array('id' => $the_id), 1); $form_values = $form_values[0]; $this->template['form_values'] = $form_values; } else { //$this->template ['form_values'] = false; } $this->template['form_values']['account_groups'] = $this->cacaomail_model->getMailAccountsGroups(); $this->load->vars($this->template); $layout = CI::view('layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('mailaccounts/edit', true, true); $secondarycontent = CI::view('mailaccounts/sidebar', true, true); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); //CI::view('welcome_message'); CI::library('output')->set_output($layout); }
function register() { $this->template['functionName'] = strtolower(__FUNCTION__); $rules['username'] = "******"; $rules['password'] = "******"; $rules['passconf'] = "trim|required"; $rules['email'] = "trim|required|valid_email|xss_clean|callback_useremail_check"; $rules['accept'] = "callback_acceptterms_check|required|xss_clean"; $rules['captcha'] = "callback_captcha_check|required|xss_clean"; $this->validation->set_rules($rules); $fields['username'] = '******'; $fields['password'] = '******'; $fields['passconf'] = 'Password Confirmation'; $fields['email'] = 'Email Address'; //$fields ['accept'] = 'Please accept the Terms and Conditions'; $this->validation->set_fields($fields); $this->validation->set_error_delimiters('<div class="error">', '</div>'); if ($this->validation->run() == FALSE) { $primarycontent = CI::view('me/register', true, true); } else { $register = array(); $register['username'] = $this->input->post('username'); $register['password'] = $this->input->post('password'); $register['email'] = $this->input->post('email'); $register['is_active'] = 1; CI::model('users')->saveUser($register); $primarycontent = CI::view('me/register_done', true, true); } $this->load->vars($this->template); $layout = CI::view('layout', true, true); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); CI::library('output')->set_output($layout); }
function index() { $this->template['functionName'] = strtolower(__FUNCTION__); $tags = CI::model('core')->getParamFromURL('tags'); $data = array(); $this->template['search_by_keyword'] = ''; if ($tags) { $data['search_by_keyword'] = $tags; $this->template['search_by_keyword'] = $tags; } $results_count = CI::model('comments')->commentsGet($data, false, true); $items_per_page = CI::model('core')->optionsGetByKey('admin_default_items_per_page'); $content_pages_count = ceil($results_count / $items_per_page); $curent_page = CI::model('core')->getParamFromURL('curent_page'); if (intval($curent_page) < 1 || intval($curent_page) > $content_pages_count) { $curent_page = 1; } $page_start = ($curent_page - 1) * $items_per_page; $page_end = $page_start + $items_per_page; //$data ['is_moderated'] = 'n'; $form_values = CI::model('comments')->commentsGet($data, array($page_start, $page_end), false); $new_comments = array(); $old_comments = array(); for ($i = 0; $i < count($form_values); $i++) { if ($form_values[$i]['is_moderated'] == 'n') { $new_comments[] = $form_values[$i]; } else { $old_comments[] = $form_values[$i]; } } $this->template['content_pages_count'] = $content_pages_count; //var_dump($content_pages_count); $this->template['content_pages_curent_page'] = $curent_page; //get paging urls $content_pages = CI::model('content')->pagingPrepareUrls(false, $content_pages_count); $this->template['content_pages_links'] = $content_pages; $this->template['new_comments'] = $new_comments; $this->load->vars($this->template); /* $data = array ( ); $data ['is_moderated'] = 'y'; $limit [0] = 0; $limit [1] = 100; $form_values = CI::model('comments')->commentsGet ( $data ); */ $this->template['old_comments'] = $old_comments; $this->load->vars($this->template); $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('admin/comments/index', true, true); //$secondarycontent = CI::view ( 'admin/content/sidebar', true, true ); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); //CI::view('welcome_message'); CI::library('output')->set_output($layout); }
function edit() { //CI::library ( 'session' )->set_userdata ( 'editmode', false ); $is_admin = is_admin(); if ($is_admin == false) { $go = site_url('login'); safe_redirect($go); } $layout = CI::view('admin/iframe', true, true); $layout = CI::model('template')->parseMicrwoberTags($layout); //$layout = CI::model('template')->parseMicrwoberTags ( $layout ); CI::library('output')->set_output($layout); }
function stylesList() { $data = CI::model('template')->stylesList(trim($_REQUEST['layout'])); $active = trim($_REQUEST['active_style']); $this->template['active'] = $active; $view = TEMPLATES_DIR . 'layouts/styles_list.php'; $this->template['data'] = $data; if (is_readable($view) == true) { $this->load->vars($this->template); $layout = $this->load->file($view, true); $layout = CI::model('content')->applyGlobalTemplateReplaceables($layout, $global_template_replaceables = false); CI::library('output')->set_output($layout); } else { exit("Error: the file {$view} is not readable or does not exist."); } }
function index() { $this->template['functionName'] = strtolower(__FUNCTION__); if (CI::library('session')->userdata('user') == false) { //redirect ( 'index' ); } $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('admin/index', true, true); //$layout = str_ireplace ( '{primarycontent }', $primarycontent, $layout ); //$layout = str_ireplace ( '{secondarycontent}', $secondarycontent, $layout ); //CI::view('welcome_message'); CI::library('output')->set_output($layout); }
function login() { $back_to = CI::model('core')->getParamFromURL('back_to'); global $cms_db_tables; $table = $cms_db_tables['table_users']; $username = $this->input->post('username', TRUE); $password = $this->input->post('password', TRUE); $user_action = $this->input->post('user_action', TRUE); if ($user_action == 'register') { $q = "select username from " . $table . " where username='******' "; $query = CI::db()->query($q); $query = $query->row_array(); $query = array_values($query); $username = $query[0]; if ($username != '') { $this->template['message'] = 'This user exists, try another one!'; } else { $data = array('updated_on' => date("Y-m-d h:i:s"), 'is_active' => 0, 'username' => $username, 'password' => $password); $this->db->insert($table, $data); $this->template['message'] = 'Success, try login now!'; } } else { $q = "select * from " . $table . " where username='******' and password='******' and is_active=1"; $query = CI::db()->query($q); $query = $query->row_array(); if (empty($query)) { $this->template['message'] = 'Wrong username or password, or user is disabled!'; } else { CI::library('session')->set_userdata('user', $query); if ($back_to == false) { redirect('dashboard'); } else { redirect(base64_decode($back_to)); } } } $this->load->vars($this->template); $layout = CI::view('layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('login', true, true); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); //CI::view('welcome_message'); //CI::library('output')->set_output ( $layout ); }
function edit() { $this->template['functionName'] = strtolower(__FUNCTION__); $this->load->vars($this->template); if ($_POST) { $save = $this->cacaomail_model->saveMailCampaigns($_POST); redirect('mailcampaigns'); } $segs = $this->uri->segment_array(); $the_id = false; foreach ($segs as $segment) { if (stristr($segment, 'id:') == true) { $the_id = $segment; $the_id = substr($the_id, 3, strlen($the_id)); } } if (intval($the_id) != 0) { $form_values = $this->cacaomail_model->getMailCampaigns(array('id' => $the_id), 1); $form_values = $form_values[0]; $this->template['form_values'] = $form_values; //$mailist_groups_titles = $this->cacaomail_model->getMailAccountsGroups(); //$this->template ['form_values']['mailist_groups_titles'] = $mailist_groups_titles; } $mailist_account_groups = $this->cacaomail_model->getMailAccountsGroups(); $this->template['form_values']['mail_accounts_groups'] = $mailist_account_groups; $mailist_account_single = $this->cacaomail_model->getMailAccounts(); $this->template['form_values']['mail_accounts_singles'] = $mailist_account_single; $temp = $this->cacaomail_model->getJobfeedsGroups(); $this->template['form_values']['mail_lists_groups'] = $temp; $temp = $this->cacaomail_model->getJobfeeds(); $this->template['form_values']['mail_lists_singles'] = $temp; //`mailists_groups_ids` text, //`mailists_single_id` int(11) default NULL, $this->load->vars($this->template); $layout = CI::view('layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('mailcampaigns/edit', true, true); $secondarycontent = CI::view('mailcampaigns/sidebar', true, true); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); //CI::view('welcome_message'); CI::library('output')->set_output($layout); }
function index() { $gogo = site_url('admin/content/posts_manage') . $togo_categories . $togo_tags; $gogo = reduce_double_slashes($gogo); header("Location: {$gogo} "); //var_dump ( $gogo ); exit; //http://test3.ooyes.net/admin $this->template['functionName'] = strtolower(__FUNCTION__); if (CI::library('session')->userdata('user') == false) { //redirect ( 'index' ); } $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('admin/index', true, true); //$layout = str_ireplace ( '{primarycontent }', $primarycontent, $layout ); //$layout = str_ireplace ( '{secondarycontent}', $secondarycontent, $layout ); //CI::view('welcome_message'); CI::library('output')->set_output($layout); }
function index() { $this->template['functionName'] = strtolower(__FUNCTION__); $data = array(); $reports_for = CI::model('core')->getParamFromURL('t'); if ($reports_for != false) { // $data['to_table'] = $reports_for; $data[] = array('to_table', $reports_for); } $reports = CI::model('reports')->reportsGet($data, false); $this->template['reports'] = $reports; $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('admin/reports/index', true, true); //$secondarycontent = CI::view ( 'admin/content/sidebar', true, true ); $layout = str_ireplace('{primarycontent}', $primarycontent, $layout); $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout); //CI::view('welcome_message'); CI::library('output')->set_output($layout); }
function add() { $this->template['functionName'] = strtolower(__FUNCTION__); if ($_POST) { CI::model('core')->cacheDelete('cache_group', 'options'); CI::model('core')->optionsSave($_POST); redirect('admin/options/index'); } $all_options = CI::model('core')->optionsGet(false); $this->template['all_options'] = $all_options; $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('admin/options/add', true, true); $nav = CI::view('admin/options/subnav', 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'); CI::library('output')->set_output($layout); }
$layout = $this->load->file($the_active_site_template_dir . 'users/layout.php', true); } } } else { $layout = '{content}'; } if (trim($content['content_filename']) != '') { if (is_readable($the_active_site_template_dir . $content['content_filename']) == true) { $this->load->vars($this->template); $content_filename = $this->load->file($the_active_site_template_dir . $content['content_filename'], true); $layout = str_ireplace('{content}', $content_filename, $layout); // $layout = str_ireplace ( '{content}', $content_filename_pre, $layout ); } } if (trim($content['content_body']) != '') { $this->load->vars($this->template); $layout = str_ireplace('{content}', $content['content_body'], $layout); } if (trim($taxonomy_data) != '') { $this->load->vars($this->template); $layout = str_ireplace('{content}', $taxonomy_data, $layout); } $layout = CI::model('content')->applyGlobalTemplateReplaceables($layout, $global_template_replaceables = false); //var_dump($layout); $opts = array(); $opts['no_microwber_tags'] = false; $opts['no_remove_div'] = false; //$opts = array (); $layout = CI::model('template')->parseMicrwoberTags($layout, $opts); CI::library('output')->set_output($layout);
//p($subdomain_user); //$this->template ['created_by'] = false; } /* * Make some initializations - constants, libraries, template variables */ //$this->load->library ( 'form_validation' ); $this->template['className'] = strtolower(get_class()); //$this->template ['cache_queries_count'] = CI::model('core')->cacheGetCount (); //$this->template ['cache_size'] = CI::model('core')->cacheGetSize (); $this->template['cms_db_tables'] = $cms_db_tables; $this->template['__GET'] = $_GET; $this->template['__POST'] = $_POST; $this->template['__REQUEST'] = $_REQUEST; $this->load->vars($this->template); $user_session = CI::library('session')->userdata('user_session'); $this->template['user_session'] = $user_session; $this->template['user_id'] = CI::model('core')->userId(); $the_active_site_template = CI::model('core')->optionsGetByKey('curent_template'); $the_active_site_template_dir = TEMPLATEFILES . $the_active_site_template . '/'; if (defined('ACTIVE_TEMPLATE_DIR') == false) { define('ACTIVE_TEMPLATE_DIR', $the_active_site_template_dir); } if (defined('TEMPLATES_DIR') == false) { define('TEMPLATES_DIR', $the_active_site_template_dir); } if (defined('TEMPLATE_DIR') == false) { define('TEMPLATE_DIR', $the_active_site_template_dir); } if (defined('DEFAULT_TEMPLATE_DIR') == false) { define('DEFAULT_TEMPLATE_DIR', TEMPLATEFILES . 'default/');
if (empty($check[0])) { $check = array(); $check['username'] = $username_or_email; $check['password'] = $password; $check['is_active'] = 'y'; $check = CI::model('users')->getUsers($check); } if (empty($check[0])) { $user_login_errors['login_failed'] = 'Login failed. Please verify your username and password.'; } else { //sync with the forum userbase CI::model('users')->forum_sync($check[0]); $user_session['is_logged'] = 'yes'; $user_session['user_id'] = $check[0]['id']; CI::library('session')->set_userdata('user_session', $user_session); CI::library('session')->set_userdata('user', $check[0]); $back_to = CI::model('core')->getParamFromURL('back_to'); $first_name = $check[0]['first_name']; $last_name = $check[0]['last_name']; $email = $check[0]['email']; if (trim($first_name) == '' or trim($last_name) == '' or trim($email) == '') { redirect('users/user_action:profile'); } if ($back_to != '') { $back_to = base64_decode($back_to); if (trim($back_to) != '') { header('Location: ' . $back_to); exit; } else { redirect('dashboard'); }
<?php $the_user = CI::library('session')->userdata('the_user'); if (empty($the_user)) { $go = site_url('login'); header("Location: {$go}"); } else { if ($the_user['is_admin'] != 'y') { $go = site_url(); header("Location: {$go}"); } else { } }
} else { $reg_is_error = true; $user_edit_errors['email_blankn'] = 'Cannot use blank email!'; } if ($reg_is_error == true) { $this->template['user_edit_errors'] = $user_edit_errors; } else { $to_save = $_POST; $to_save['id'] = $user_session['user_id']; $saved_id = CI::model('users')->saveUser($to_save); $new_data = CI::model('users')->getUserById($saved_id); $old_user_session = CI::library('session')->userdata('user_session'); //p($old_user_session,1); foreach ($new_data as $k => $v) { $old_user_session[$k] = $v; } CI::library('session')->set_userdata('user_session', $old_user_session); $this->template['form_values'] = $new_data; $this->template['user_edit_errors'] = false; $this->template['user_edit_done'] = true; $this->load->vars($this->template); } } $userdata = array(); $userdata['id'] = $user_session['user_id']; $userdata = CI::model('users')->getUsers($userdata); $userdata = $userdata[0]; $this->template['form_values'] = $userdata; $this->load->vars($this->template); $user_session['user_action'] = $user_action; $content['content_filename'] = 'users/profile.php';
function taxonomy_tags() { $this->template['functionName'] = strtolower(__FUNCTION__); $tags = CI::model('taxonomy')->taxonomyTagsGetOrderByPopularity(); $this->template['form_values'] = $tags; $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_tags', 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'); CI::library('output')->set_output($layout); }
function menus_add() { $this->template['functionName'] = strtolower(__FUNCTION__); //edit menu $edit = CI::model('core')->getParamFromURL('edit'); //var_dump ( $edit ); if (intval($edit) != 0) { $data = array(); $data['item_type'] = 'menu'; $data['id'] = $edit; $menu = CI::model('content')->getMenus($data); $this->template['form_values'] = $menu[0]; } $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = CI::view('admin/content/menus/menus_add', 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 sess_id() { $session_id = CI::library('session')->userdata('session_id'); return $session_id; }
function securityDecryptString($plaintext) { $plaintext = base64_decode($plaintext); $plaintext = CI::library('encrypt')->decode($plaintext); return $plaintext; $the_pass = $this->optionsGetByKey('ecnryption_hash'); //$the_pass = intval ( $the_pass ); require_once 'crypt/class.hash_crypt.php'; $the_pass = CI::library('session')->userdata('session_id'); //$the_pass = $this->optionsGetByKey ( 'ecnryption_hash' ); $crypt = new hash_encryption($the_pass); $encrypted = $crypt->decrypt($plaintext); return $encrypted; }
function sitemaps() { ob_clean(); header("Content-Type: text/xml; charset=UTF-8"); //header ( "Content-Type: application/rss+xml" ); global $cms_db_tables; $table = $cms_db_tables['table_content']; $sitemaps_count = false; $q = "select count(*) as qty from {$table} "; $q = CI::model('core')->dbQuery($q); $q = $q[0]['qty']; $q = intval($q); $maps_count = ceil($q / 200); $this->template['maps_count'] = $maps_count; $map_id = $this->uri->segment(3); $map_id = intval($map_id); if ($map_id == 0) { $this->template['the_index'] = true; $this->load->vars($this->template); $upperLimit = $maps_count; $lowerLimit = 1; $updates = array(); $sitemaps_urls = array(); while ($lowerLimit <= $upperLimit) { $some = ($upperLimit - $lowerLimit) * 200 + 0; $some2 = ($upperLimit - $lowerLimit) * 200 + 1; $q = "select updated_on from {$table} order by updated_on DESC limit 0,1 "; //var_dump($q); $q = CI::model('core')->dbQuery($q); $q = $q[0]['updated_on']; $updates[] = $q; $sitemaps_urls[] = urlencode(site_url('main/sitemaps/' . $lowerLimit)); $lowerLimit++; } $this->template['updates'] = $updates; $this->load->vars($this->template); foreach ($sitemaps_urls as $item1) { $ch = curl_init("http://www.google.com/webmasters/tools/ping?sitemap=" . $item1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); //echo $output; $ch = curl_init("http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=" . $item1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); } } else { $some = 200 * ($map_id - 1); $some2 = 200 * ($map_id + 0); $q = "select id, updated_on from {$table} order by updated_on DESC limit {$some},{$some2} "; $q = CI::model('core')->dbQuery($q); $updates = $q; $this->template['updates'] = $updates; $this->load->vars($this->template); } //www.google.com/webmasters/tools/ping?sitemap=http%3A%2F%2Fwww.yoursite.com%2Fsitemap.gz $this->template['posts'] = $posts; $this->load->vars($this->template); $layout = CI::view('sitemap.php', true, true); CI::library('output')->set_output($layout); }
function get_cart_total() { $promo_code = CI::library('session')->userdata('promo_code'); $total = CI::model('cart')->itemsGetTotal($promo_code); return $total; }
/** * get_messages * * @desc get the messages by parameters * @access public * @category general * @author Microweber * @link http://microweber.com * @param $params = array(); $params['user_id'] = false; //the user id $params['show'] = false; // params: read, unread, 'all' @return string - The thumbnail link. @example Use <? print post_thumbnail($post['id']); ?> */ function get_messages($params) { if (!is_array($params)) { $params = array(); $numargs = func_num_args(); if ($numargs > 0) { foreach (func_get_args() as $name => $value) { //$arg_list = func_get_args (); $params['user_id'] = func_get_arg(0); } $params['show'] = func_get_arg(1); } } //var_Dump($params); global $CI; if ($params['user_id'] == false) { $params['user_id'] = user_id(); } $currentUserId = $params['user_id']; if ($show == false and $conversation == false) { $show = 'read'; } if ($show_inbox == 1 and $conversation == false) { $show = 'unread'; } if ($show == 'unread') { $messages = $unreadedMessages = CI::model('messages')->messagesGetUnreadForUser($params['user_id']); } $some_items_per_page = 50; $opts = array(); $opts['get_count'] = false; $opts['items_per_page'] = $some_items_per_page; $opts['only_fields'] = array('id', 'parent_id', 'max(id) as id_1'); // array of fields $opts['group_by'] = 'parent_id , id'; // if set the results will be grouped by the filed name $opts['order'] = array('id_1', 'desc'); $opts['debug'] = 0; $msg_params = array(); $msg_params[] = array('to_user', $currentUserId, '=', 'OR'); $msg_params[] = array('from_user', $currentUserId); $msg_params[] = array('parent_id', 0); //$msg_params [] = array ('from_user', $currentUserId, '=', 'OR' ); //$params [] = array ('is_read', 'y' ); $msg_params[] = array('deleted_from_receiver', 'n'); $msg_params[] = array('deleted_from_sender', 'n'); //$params [] = array ('from_user', $currentUserId); //$msg_params [] = array ('from_user', $currentUserId, '<>', 'and' ); foreach ($params as $pk => $pv) { $msg_params[] = array($pk, $pv); } //$execQuery $table = TABLE_PREFIX . 'messages'; $opts['query'] = "select id,parent_id from {$table} where"; $opts['query'] .= "(to_user={$currentUserId} or from_user={$currentUserId}) "; $opts['query'] .= "and parent_id=0 and deleted_from_receiver='n' and deleted_from_sender='n'"; $msg_params['query'] = $opts['query']; $messages = $conversations = CI::model('messages')->messagesGetByParams($msg_params, $opts); $res = array(); if (!empty($messages)) { foreach ($messages as $message) { //if(intval($message ['parent_id']) == 0){ $res[] = $message['id']; //} } } return $res; $opts = array(); $opts['get_count'] = true; $opts['items_per_page'] = 100; $conversations_count = CI::model('messages')->messagesGetByParams($msg_params, $opts); $results_count = intval($conversations_count); $pages_count = ceil($results_count / $some_items_per_page); //p ( $conversations ); $url = site_url('dashboard/action:messages/show:read'); $paging = CI::model('content')->pagingPrepareUrls($url, $pages_count); //} if ($show == 'sent') { $params = array(); $params[] = array('from_user', CI::model('core')->userId()); $some_items_per_page = 1; $opts = array(); $opts['get_count'] = false; $opts['items_per_page'] = $some_items_per_page; $conversations = CI::model('messages')->messagesGetByDefaultParams($params, $opts); $opts = array(); $opts['get_count'] = true; $opts['items_per_page'] = 1; $conversations_count = CI::model('messages')->messagesGetByDefaultParams($params, $opts); $results_count = intval($conversations_count); $pages_count = ceil($results_count / $some_items_per_page); $url = site_url('dashboard/action:messages/show:read'); $paging = CI::model('content')->pagingPrepareUrls($url, $pages_count); } if ($conversation != false) { $conversation = intval($conversation); if (intval($conversation) > 0) { $q = "UPDATE " . TABLE_PREFIX . 'messages' . " SET is_read='y' where (id = {$conversation} OR parent_id = {$conversation})\nand to_user={$userid}\n\t\t "; $q = CI::model('core')->dbQ($q); } $params = array(); $params[] = array('id', $conversation); $parentMessage = CI::library('messages')->messagesGetByParams($params, $options = false); $parentMessage = $parentMessage[0]; if ($parentMessage['from_user'] == CI::model('core')->userId()) { $receiver = $parentMessage['to_user']; } elseif ($parentMessage['to_user'] == CI::model('core')->userId()) { $receiver = $parentMessage['from_user']; } else { //throw new Exception ( 'You have no permission to view this conversation.' ); exit('You have no permission to view this conversation.'); } $q = "(id = {$conversation}\n\tOR parent_id = {$conversation})\n\tAND ((from_user = {$currentUser['id']}\n\tAND deleted_from_sender = 'n') OR (to_user = {$currentUser['id']}\n\tAND deleted_from_receiver = 'n'))"; $messages = CI::library('messages')->messagesThread($conversation); } return $messages; }
function whoami() { $the_user = CI::library('session')->userdata('the_user'); //..var_dump($the_user); $the_user['password'] = '******'; //var_dump($the_user); $the_user = serialize($the_user); exit($the_user); }
function currencies() { $this->template['functionName'] = strtolower(__FUNCTION__); $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); $primarycontent = ''; $secondarycontent = ''; $primarycontent = CI::view('admin/orders/currency', true, true); $nav = CI::view('admin/orders/subnav', 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'); CI::library('output')->set_output($layout); }
public function dashboardCounts() { if ($_POST) { $this->_requireLogin(); $currentUser = CI::library('session')->userdata('user'); $statusesIds = $_POST['statusesIds']; $contentsIds = $_POST['contentsIds']; /* comments and votes count */ $contentVotes = CI::model('votes')->votesGetCounts('table_content', $contentsIds); $contentComments = CI::model('comments')->commentsGetCounts('table_content', $contentsIds); $statusesVotes = CI::model('votes')->votesGetCounts('table_users_statuses', $statusesIds); $statusesComments = CI::model('comments')->commentsGetCounts('table_users_statuses', $statusesIds); $stats = array('statuses' => array('votes' => $statusesVotes, 'comments' => $statusesComments), 'contents' => array('votes' => $contentVotes, 'comments' => $contentComments)); echo json_encode($stats); } }
function index() { $url = url(); $cache_id = "js_api_" . md5($url); $cache_group = 'global/blocks'; $edit = $this->template['edit']; if (!$edit) { $edit = url_param('edit'); if ($edit) { $this->template['edit'] = true; } } $editmode = CI::library('session')->userdata('editmode'); if ($editmode == true) { $edit = true; } if ($edit == true) { $cache_group = 'global/blocks/edit'; } //$cache_content = CI::model ( 'core' )->cacheGetContentAndDecode ( $cache_id, $cache_group ); if ($cache_content != false) { //CI::library ( 'output' )->set_output ( $cache_content ); } else { //header ( 'Content-type: application/javascript' ); $load_extra_libs = false; $files = readDirIntoArray(APPPATH . 'controllers/api/js/', 'files'); //$layout = $layout . "\n\n\n // File: _php.default.min.js \n\n" . $this->load->file ( APPPATH . 'controllers/api/js/' . '_php.default.min.js', true ); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery.min.js', true); if (isset($_SERVER['HTTP_REFERER']) and $_SERVER['HTTP_REFERER'] != '') { $url = urldecode($_SERVER['HTTP_REFERER']); if (eregi("admin", $url)) { //preg_match ( "'(\?¦&)q=(.*?)(&¦$)'si", " $url ", $keywords ); $load_extra_libs = true; $in_admin = true; } } $and_ui = url_param('ui'); if ($and_ui) { } else { $and_ui = false; } $no_mw_edit = url_param('no_mw_edit'); if ($no_mw_edit) { } else { $no_mw_edit = false; } if ($editmode == true or $load_extra_libs == true or $and_ui == true) { $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery-ui-1.8.12.custom.min.js', true); //$apicss = '<link rel="stylesheet" href="' . ADMIN_STATIC_FILES_URL . 'css/api.css" type="text/css" media="screen" />'; } $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery.form.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery.embedly.min.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery_plugins.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'rangy-core.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'rangy-cssclassapplier.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery.cookie.js', true); $layout = $layout . "\n\n\n // File: _mw.js \n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . '_mw.js', true); $ajax = isAjax(); if ($ajax == false) { if ($edit == true and $in_admin == false and $no_mw_edit == false) { $layout = $layout . "\n\n\n // File: _mw_edit.js \n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . '_mw_edit.js', true); } if ($editmode == true or $load_extra_libs == true) { $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . '_mw_extra.js', true); } } $layout = $layout . "\n\n\n // File: utils.js \n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . 'utils.js', true); foreach ($files as $file) { if (substr($file, -2) == 'js') { if ($file != '_mw.js' and $file != 'utils.js' and $file != '_mw_edit.js') { $this->load->vars($this->template); $layout = $layout . "\n\n\n // File: {$file} \n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . $file, true); } } } $layout = CI::model('content')->applyGlobalTemplateReplaceables($layout); //$layout = $layout . $apicss; CI::library('output')->set_output($layout); CI::model('core')->cacheWriteAndEncode($layout, $cache_id, $cache_group); } //var_dump ($content_filename_pre, $files ); }
// $to_reg ['parent'] = $parent [0] ['username']; // // $to_reg ['option_key'] = 'mail_new_user_reg'; // CI::model('core')->sendMail ( $to_reg, true ); //$primarycontent = CI::view ( 'me/register_done', true, true ); $this->template['user_registration_done'] = true; $userId = CI::model('users')->saveUser($to_reg); /*~~~~~~~~~~~~~~~ Send activation email ~~~~~~~~~~~~~~~~~~~*/ $emailTemplate = CI::model('core')->optionsGetByKey('registration_email', true); $from = CI::model('core')->optionsGetByKey('reg_email_from', true); $message = str_replace("{activation_url}", site_url('users/user_action:activate/code:' . md5($userId)), $emailTemplate['option_value2']); // Send activation email $sendOptions = array('subject' => $emailTemplate['option_value'], 'message' => $message, 'from_email' => $from['option_value'], 'from_name' => $from['option_value2'], 'to_email' => $to_reg['email']); CI::model('core')->sendMail2($sendOptions); /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ // redirect user to back_url $back_to = CI::library('session')->userdata('back_to'); if ($back_to) { $back_to = base64_decode($back_to); CI::library('session')->unset_userdata('back_to'); if (trim($back_to) != '') { header('Location: ' . $back_to); exit; } } } $this->load->vars($this->template); } //$user_session ['user_action'] = $user_action; $this->load->vars($this->template); $content['content_filename'] = 'users/register.php';