function codeClean($var) { if (is_array($var)) { foreach ($var as $key => $val) { $output[$key] = codeClean($val); } } else { $var = strip_tags(trim($var)); if (function_exists("mysql_real_escape_string")) { $output = mysql_real_escape_string($var); } else { $output = stripslashes($var); } } if (!empty($output)) { return $output; } }
function getUsersForGMaps($data = false, $limit = false, $count_only = false) { global $cms_db_tables; $table = $cms_db_tables['table_users']; //$q = CI::model('core')->dbQuery ( $q, md5 ( $q ), 'comments' ); $data = codeClean($data); //var_dump($data); $get = CI::model('core')->getDbData($table = $table, $criteria = $data, $limit = $limit, $offset = false, $orderby = array('zip,updated_on', 'DESC'), $cache_group = false, $debug = false, $ids = false, $count_only = $count_only, $only_those_fields = false); return $get; }
function applyGlobalTemplateReplaceables($content, $replaceables = false) { static $mem = array(); $layout_md5 = md5($content); $options_md5 = md5(serialize($replaceables)); $check = $layout_md5 . $options_md5; if ($mem["{$check}"] != false) { return $mem[$check]; } //return false; //$is_post = $this->template['post']; if (strstr($content, 'content_meta_title')) { $is_content = $this->template['post']; if ($is_content == false) { $is_content = $this->template['page']; } //p($is_content); if ($is_content['content_meta_title']) { $content_meta_title = $is_content['content_meta_title']; } elseif ($is_content['content_title']) { $content_meta_title = codeClean($is_content['content_title']); } else { $content_meta_title = CI::model('core')->optionsGetByKey('content_meta_title'); } } if (strstr($content, 'content_meta_description')) { $content_meta_description = CI::model('core')->optionsGetByKey('content_meta_description'); } if (strstr($content, 'content_meta_keywords')) { $content_meta_keywords = CI::model('core')->optionsGetByKey('content_meta_keywords'); } if (strstr($content, 'content_meta_other_code')) { $content_meta_other_code = CI::model('core')->optionsGetByKey('content_meta_other_code'); } $global_replaceables = array(); $global_replaceables["content_meta_title"] = $content_meta_title; $global_replaceables["content_meta_description"] = codeClean($content_meta_description); $global_replaceables["content_meta_keywords"] = $content_meta_keywords; //$global_replaceables ["content_meta_other_code"] = $content_meta_other_code; $global_replaceables["content_meta_other_code"] = $global_replaceables["content_meta_other_code"]; if (trim($content["content_meta_other_code"]) != '') { $content["content_meta_other_code"] = $content["content_meta_other_code"]; } $content_to_return = false; foreach ($global_replaceables as $k => $v) { //if (array_key_exists ( $k, $replaceables ) == true) { $v = $replaceables[$k]; if (strval($v) == '') { $v = $global_replaceables[$k]; } $content = str_replace('{' . $k . '}', $v, $content); //$content = sprintf('{' . $k . '}', $v,$content); //$CI = get_instance (); //} } $media_url = MEDIA_URL; $content = str_ireplace('{MEDIAURL}', $media_url, $content); $content = str_ireplace('{SITEURL}', site_url(), $content); $content = str_ireplace('{SITE_URL}', site_url(), $content); $content = str_ireplace('{JS_API_URL}', site_url('api/js') . '/', $content); $content = str_ireplace('{API_URL}', site_url('api') . '/', $content); $mem[$check] = $content; return $content; }
$games = get_posts($var_params); $games = $games['posts']; @shuffle( $games); ?> <h2>New Toys</h2> <ul class="new-toys"> <? foreach($games as $item): $item = get_post($item['id']); ?> <li> <a class="img" href="<? print post_link($item['id']); ?>"><img src="<? print thumbnail($item['id'], 120) ?>" alt="" /></a> <div class="toy_desc"> <h4><a href="<? print post_link($item['id']); ?>"><? print $item['content_title']; ?></a></h4> <span><? print character_limiter(codeClean($item['content_body']), 100); ?></span> <strong class="red">$<? print $item["custom_fields"]['price'];?> </strong> <div class="c" style="padding-bottom: 5px;"></div> <a href="<? print post_link($item['id']); ?>" class="right">See more</a> </div> </li> <? endforeach; ?> </ul> </div> <div id="wall"> <h1 id="results_holder_title" style="display:none" ></h1> <div class="top_games" id="results_holder" style="display:none"></div> <?php if (count($active_categories) == 1) { ?> <h1 id="top_games_holder_title" ><? print $page['content_title'] ?></h1> <br /> <div class="top_games" id="top_games_holder">
/** * Generic function to get the users by db params defined in $data * @param $data * @param $limit * @param $count_only * @return array * */ function getUsers($data = false, $limit = false, $count_only = false) { global $cms_db_tables; $table = $cms_db_tables['table_users']; //$q = CI::model('core')->dbQuery ( $q, md5 ( $q ), 'comments' ); $data = codeClean($data); //var_dump($data); if ($limit == false) { $limit = array(0, 30); } //getDbData($table = false, $criteria = false, $limit = false, $offset = false, $orderby = false, $cache_group = false, $debug = false, $ids = false, $count_only = false, $only_those_fields = false, $exclude_ids = false, $force_cache_id = false, $get_only_whats_requested_without_additional_stuff = false) if (is_array($data['ids'])) { if (!empty($data['ids'])) { $ids = $data['ids']; } } //p($data); $data['search_by_keyword_in_fields'] = array('first_name', 'last_name', 'username', 'email'); //$data ['debug'] = 1; if (intval($data['id']) != 0) { $cache_group = 'users/' . $data['id']; } else { $cache_group = 'users/global'; } if ($data['only_those_fields']) { $only_those_fields = $data['only_those_fields']; } $get = CI::model('core')->getDbData($table, $criteria = $data, $limit, $offset = false, $orderby = array('updated_on', 'DESC'), $cache_group, $debug = false, $ids, $count_only = $count_only, $only_those_fields, $exclude_ids = false, $force_cache_id = false, $get_only_whats_requested_without_additional_stuff = true); return $get; }
function get_dashboard_action($log_id) { global $CI; $log = get_log_item($log_id); $data = $log; $to_return = array(); switch ($data['to_table']) { case 'table_users_statuses': $stat = CI::model('statuses')->statusGetById(intval($data['to_table_id'])); $stat = html_entity_decode($stat['status']); if (stristr($stat, 'http://') == true) { $term = 'shared a link'; $stat = auto_link($stat); $embedly = true; } else { $term = 'said '; $embedly = false; } $to_return['allow_comments'] = true; $to_return['allow_likes'] = true; if ($embedly == false) { $to_return['msg'] = "{$term} " . $stat; } else { $to_return['msg'] = "<div class='embedly'>{$term} " . $stat . "</div>"; } break; case 'table_users': $to_return['msg'] = "updated profile"; $to_return['allow_comments'] = false; $to_return['allow_likes'] = false; break; case 'table_messages': $to_return['msg'] = "send a message to " . $data['to_table_id'] . ".. must be implemented"; $to_return['allow_comments'] = false; $to_return['allow_likes'] = false; break; case 'table_comments': $to_return['allow_comments'] = true; $to_return['allow_likes'] = true; $comm = CI::model('comments')->commentGetById($data['to_table_id']); //p($comm); if ($comm['to_table'] == 'table_content') { $content_data = CI::model('content')->contentGetByIdAndCache($comm['to_table_id']); $url = CI::model('content')->getContentURLByIdAndCache($comm['to_table_id']); $comm_txt = $comm['comment_body']; $comm_txt = html_entity_decode($comm_txt); $comm_txt = auto_link($comm_txt); $thumb = thumbnail($content_data['id'], 90); //p($comm); $to_return['msg'] = "commented on <a href='{$url}'>{$content_data['content_title']}</a><br> {$comm_txt}"; $to_return['msg'] .= "<div class='post_item'><div style='height:10px;'> </div><a href='{$url}'><img class='embed_img' src='{$thumb}' border='0'></a><h3 style='padding-bottom:5px;'><a href='{$url}'>{$content_data['content_title']}</a></h3> {$desc} {$emded_txt} \t</div>"; } if ($comm['rel_table'] == 'table_content') { $content_data = CI::model('content')->contentGetByIdAndCache($comm['rel_table_id']); $url = CI::model('content')->getContentURLByIdAndCache($comm['rel_table_id']); $comm_txt = $comm['comment_body']; $comm_txt = html_entity_decode($comm_txt); $comm_txt = auto_link($comm_txt); $thumb = thumbnail($content_data['id'], 90); //p($comm); $to_return['msg'] = "commented on <a href='{$url}'>{$content_data['content_title']}</a><br> {$comm_txt}"; $to_return['msg'] .= "<div class='post_item'><div style='height:10px;'> </div><a href='{$url}'><img class='embed_img' src='{$thumb}' border='0'></a><h3 style='padding-bottom:5px;'><a href='{$url}'>{$content_data['content_title']}</a></h3> {$desc} {$emded_txt} \t</div>"; } if ($comm['to_table'] == 'table_users_statuses') { } break; case 'table_votes': $to_return['allow_comments'] = false; $to_return['allow_likes'] = false; $vote = CI::model('votes')->voteGetById($data['to_table_id']); if ($vote['to_table'] == 'table_content') { $more = CI::model('core')->getCustomFields('table_content', $vote['to_table_id']); $content_data = CI::model('content')->contentGetByIdAndCache($vote['to_table_id']); $url = CI::model('content')->getContentURLByIdAndCache($vote['to_table_id']); $to_return['msg'] = "liked <a href='{$url}'>{$content_data['content_title']}</a>"; if ($more['embed_code']) { $emded_txt = "<textarea>" . html_entity_decode($more['embed_code']) . "</textarea>"; } else { $emded_txt = false; } $thumb = thumbnail($content_data['id'], 90); $desc = codeClean($content_data['content_body']); $desc = character_limiter($desc, 140, '...'); $desc = str_ireplace("\n", ' ', $desc); $desc = str_ireplace('\\n', ' ', $desc); $to_return['msg'] .= "<div class='post_item'><div style='height:10px;'> </div><a href='{$url}'><img class='embed_img' src='{$thumb}' border='0'></a><h3 style='padding-bottom:5px;'><a href='{$url}'>{$content_data['content_title']}</a></h3> {$desc} {$emded_txt} \t</div>"; break; } else { } case 'table_content': $content_data = CI::model('content')->contentGetById($data['to_table_id']); if (empty($content_data)) { CI::model('notifications')->logDeleteById($data['id']); } else { $more = CI::model('core')->getCustomFields('table_content', $content_data['id']); $url = post_link($data['to_table_id']); $to_return['allow_comments'] = true; $to_return['allow_likes'] = true; $to_return['msg'] = "published <a href='{$url}'>{$content_data['content_title']}</a>"; if ($more['embed_code']) { $emded_txt = "<textarea>" . html_entity_decode($more['embed_code']) . "</textarea>"; } else { $emded_txt = false; } $thumb = thumbnail($content_data['id'], 90); $desc = codeClean($content_data['content_body']); $desc = character_limiter($desc, 140, '...'); $desc = str_ireplace("\n", ' ', $desc); $desc = str_ireplace('\\n', ' ', $desc); $to_return['msg'] .= "<div class='post_item'><div style='height:10px;'> </div><a href='{$url}'><img class='embed_img' src='{$thumb}' border='0'></a><h3 style='padding-bottom:5px;'><a href='{$url}'>{$content_data['content_title']}</a></h3> {$desc} {$emded_txt} \t</div>"; break; } case 'table_followers': $data = CI::model('core')->getById($data['to_table'], $data['to_table_id']); //p($data); if (!empty($data)) { $to_return['allow_comments'] = false; $to_return['allow_likes'] = false; $data2 = CI::model('users')->getUserById($data['follower_id']); $url = profile_link($data['follower_id']); $name = CI::model('users')->getPrintableName($data['follower_id']); $thumb = user_thumbnail($data['follower_id'], 70); $to_return['msg'] = "is friend with <a href='{$url}' class='user_photo' style='background-image:url({$thumb})'></a><a href='{$url}'>{$name}</a>"; } break; default: p($data); break; } $to_return['allow_votes'] = $to_return['allow_likes']; return $to_return; }
redirect('users/user_action:login'); } } } else { //require (APPPATH . 'controllers/advanced/users/force_profile_complete.php'); } /*~~~~~~~ Template initializations ~~~~~~~~~~*/ // set current user $currentUser = $user; if (intval($currentUser['id']) == 0) { $the_user = CI::library('session')->userdata('the_user'); $currentUser = $the_user; } $this->template['current_user'] = $currentUser; $this->load->vars($this->template); $user_action = codeClean($user_action); $file_maybe = TEMPLATE_DIR . '/dashboard/' . $user_action . '.php'; if (is_file($file_maybe)) { $content['content_filename'] = '/dashboard/' . $user_action . '.php'; } else { switch ($user_action) { case 'test': break; case 'messages': require APPPATH . 'controllers/advanced/dashboard/messages.php'; break; case 'my-pictures': $content['content_filename'] = 'dashboard/my_pictures.php'; //require (APPPATH . 'controllers/advanced/dashboard/my_pictures.php'); break; case 'my-videos':
function orderPaid($ord_id) { global $cms_db_tables; $table_cart_orders = $cms_db_tables['table_cart_orders']; $ord_id = codeClean($ord_id); $q = "Update {$table_cart_orders} set is_paid='y' where order_id='{$ord_id}'"; $q = CI::model('core')->dbQ($q); CI::model('core')->cacheDelete('cache_group', 'cart'); return true; }
function getIdByName($name) { $cache_group = 'taxonomy/global'; global $cms_db_tables; $table = $cms_db_tables['table_taxonomy']; $name = codeClean($name); $q = " select id from {$table} where taxonomy_value like '{$name}' limit 0,1"; $q = CI::model('core')->dbQuery($q, __FUNCTION__ . md5($q), $cache_group); if (!empty($q)) { $q = $q[0]['id']; return $q; } else { return $name; } }
function updateUser($id, $email, $user, $first_name, $last_name, $year, $month, $day, $gender, $add1, $add2, $city, $state, $zip, $mobile) { $id = codeClean($id); $email = codeClean($email); $user = codeClean($user); $fname = codeClean($first_name); $lname = codeClean($last_name); $year = codeClean($year); $month = codeClean($month); $day = codeClean($day); $gender = codeClean($gender); $add1 = codeClean($add1); $add2 = codeClean($add2); $city = codeClean($city); $state = codeClean($state); $zip = codeClean($zip); $country = codeClean($country); $mobile = codeClean($mobile); if ($month == '') { $month = 00; } if ($month == 'January') { $month = 01; } if ($month == 'February') { $month = 02; } if ($month == 'March') { $month = 03; } if ($month == 'April') { $month = 04; } if ($month == 'May') { $month = 05; } if ($month == 'June') { $month = 06; } if ($month == 'July') { $month = 07; } if ($month == 'August') { $month = 00; } if ($month == 'September') { $month = 00; } if ($month == 'October') { $month = 10; } if ($month == 'November') { $month = 11; } if ($month == 'December') { $month = 12; } $dob = sprintf("%04d-%02d-%02d", $year, $month, $day); $to = $email; $toname = $user; $from = "*****@*****.**"; $fromname = "Customer Service"; $subject = "Complete your registration"; $message = '<html> Dear ' . $user . ', <br /><br /> Your personal information was updated. We hope you have an enjoyable auction experience with us. <br /><br /> Thank You! <br /><br /> Best Regards,<br/> CoinCod Management Team </body> </html>'; $headers = "From: {$fromname} <{$from}>\r\n"; $headers .= "Content-type: text/html\r\n"; $headers .= "Bcc: wilson@nexvend.com"; $to = "{$toname} <{$to}>"; $sending = mail($to, $subject, $message, $headers); if ($sending) { $sql = "UPDATE user_account SET Username='******', first_name='{$fname}', last_name='{$lname}', date_birth='{$dob}', Gender='{$gender}', Address1='{$add1}', Address2='{$add2}', City='{$city}', Zip='{$zip}', State='{$state}', Mobile='{$mobile}' WHERE user_id='{$id}'"; $res = mysql_query($sql); return 99; } else { return 98; } }
/** * @desc parses the mw tags * @param $layout - string * @param $options * $options ['admin'] - loads the module admin * @return string * @author Microweber Dev Team * @version 1.0 * @since Version 1.0 */ function parseMicrwoberTags($layout, $options = false) { /* $function_cache_id = false; //$args = func_get_args (); if (! empty ( $options )) { foreach ( $options as $k => $v ) { $function_cache_id = $function_cache_id . serialize ( $k ) . serialize ( $v ); } } $function_cache_id = __FUNCTION__ . md5 ( $layout ) . md5 ( $function_cache_id ); $cache_group = 'extract_tags'; //$cache_content = CI::model ( 'core' )->cacheGetContent ( $function_cache_id, $cache_group ); if (($cache_content) != false) { //return $cache_content; }*/ //echo memory_get_usage() . "\n"; // 36640 /*$cache_id = md5 ( $layout ) . md5 ( serialize ( $options ) ); $cache_group = 'blocks/'.DIRECTORY_SEPARATOR.intval(PAGE_ID).DIRECTORY_SEPARATOR.''; $cache_content = CI::model ( 'core' )->cacheGetContentAndDecode ( $cache_id, $cache_group );*/ if ($cache_content != false) { //return $cache_content; } static $mem = array(); static $mem2 = array(); $layout_md5 = md5($layout); $options_md5 = md5(serialize($options)); $check = $layout_md5 . $options_md5; if ($mem["{$check}"] != false) { return $mem[$check]; } //var_dump( $this->$parse_memory); //$layout = str_ireplace ( '<mw', '<microweber', $layout ); $layout = CI::model('core')->replace_in_long_text('<mw', '<microweber', $layout, $use_normal_replace = true); $v = $layout; // $tags1 = CI::model ( 'core' )->extractTags ( $v, '*', $selfclosing = true, $return_the_entire_tag = true, $charset = 'UTF-8' ); if (strstr($layout, '<microweber') == true) { //$layout = $this->parseMicrwoberTags ( $layout, $options ); } if (strstr($layout, '<mw') == true) { //$layout = $this->parseMicrwoberTags ( $layout, $options ); } if (strstr($layout, '<nomw') == true) { $relations = array(); $tags = CI::model('core')->extractTags($layout, 'nomw', $selfclosing = false, $return_the_entire_tag = true, $charset = 'UTF-8'); // p($tags); $matches = $tags; $txt_to_replace_back = array(); if (!empty($matches)) { // foreach ($matches as $m) { $hash = md5($m['full_tag']); $hash = 'replace_back_' . $hash; $txt_to_replace_back[$hash] = $m['full_tag']; $layout = str_replace($m['full_tag'], $hash, $layout); } } } if (strstr($layout, '<block') == true) { $editmode = CI::model('core')->is_editmode(); //p($editmode); $relations = array(); $tags = CI::model('core')->extractTags($layout, 'block', $selfclosing = true, $return_the_entire_tag = true, $charset = 'UTF-8'); // p($tags); $matches = $tags; if (!empty($matches)) { // foreach ($matches as $m) { // if ($m['tag_name'] == 'block') { $attr = $m['attributes']; if ($attr['id'] != '') { // p($m); $attr['id'] = trim($attr['id']); $is_global = $attr['global']; if ($is_global == false) { $is_global2 = $attr['rel']; if (trim($is_global2) == 'global') { $is_global = true; } } if (PAGE_ID != false and $is_global == false) { $try_file = TEMPLATE_DIR . 'blocks/' . PAGE_ID; $try_file = normalize_path($try_file); $try_file .= $attr['id'] . '.php'; //p($try_file); if (is_file($try_file)) { } else { $try_file = TEMPLATE_DIR . 'blocks/' . $attr['id'] . '.php'; } } else { $try_file = TEMPLATE_DIR . 'blocks/' . $attr['id'] . '.php'; } $try_file_default = TEMPLATE_DIR . 'blocks/default.php'; if (is_file($try_file) == false) { $is_admin = is_admin(); if ($is_admin == true) { $dir = dirname($try_file); if (is_dir($dir) == false) { @mkdir_recursive($dir); } if (!copy($try_file_default, $try_file)) { @touch($try_file); //echo "failed to copy $file...\n"; } } } if (is_file($try_file) == true) { $arrts = array(); foreach ($attr as $att => $at) { $this->template[$att] = $at; $arrts[$att] = $at; } $this->template['params'] = $arrts; $this->load->vars($this->template); $module_file = $this->load->file($try_file, true); //p($arrts); /* if ($editmode == true) { //p($m); $edtid_hash = base64_encode ( $m ['full_tag'] ); if (strval ( $module_file ) != '') { $module_file = '<div class="editblock" id="' . $attr ['id'] . '">' . $module_file . '</div>'; } else { $module_file = false; } } else { if (strval ( $module_file ) != '') { $module_file = '<div class="editblock" id="' . $attr ['id'] . '">' . $module_file . '</div>'; } }*/ if (strval($module_file) != '') { if ($is_global == true) { $str123 = ' rel="global" '; } else { $str123 = false; } $module_file = '<div class="editblock" ' . $str123 . ' id="' . $attr['id'] . '">' . $module_file . '</div>'; } else { //$module_file = false; $module_file = '<div class="editblock" ' . $str123 . ' id="' . $attr['id'] . '">' . '</div>'; } if (strstr($module_file, '<block') == true) { $module_file = self::parseMicrwoberTags($module_file, $options); } $layout = str_replace_count($m['full_tag'], $module_file, $layout, 1); //$layout = str_replace ( $m ['full_tag'], '', $layout ); $layout = str_replace_count('</block>', '', $layout, 1); //$layout = str_replace ( '</microweber>', '', $layout ); } } } } } } // if (strstr($layout, '<microweber') == true) { $editmode = CI::model('core')->is_editmode(); $relations = array(); $tags = CI::model('core')->extractTags($layout, 'microweber', $selfclosing = true, $return_the_entire_tag = true, $charset = 'UTF-8'); // p($tags); $matches = $tags; if (!empty($matches)) { // foreach ($matches as $m) { if ($m['tag_name'] == 'microweber') { $attr = $m['attributes']; if ($attr['module'] != '') { $mmd5 = md5($attr['module']); $check_if_uninstalled = MODULES_DIR . '_system/' . $mmd5 . '.php'; if (is_dir(MODULES_DIR . '_system/') == false) { touch(MODULES_DIR . '_system/'); } if (is_file($check_if_uninstalled) == true) { // $attr ['module'] = false; } } if (strval($attr['module']) == '') { $attr['module'] = 'non_existing'; } //p($attr ['module']); if ($attr['module'] != '') { $attr['module'] = trim($attr['module']); $attr['module'] = str_replace('\\', '/', $attr['module']); $attr['module'] = reduce_double_slashes($attr['module']); $try_file1 = MODULES_DIR . '' . $attr['module'] . '.php'; $try_file = MODULES_DIR . 'modules/' . $attr['module'] . '.php'; if ($options['admin'] == true) { $try_file1 = MODULES_DIR . 'admin/' . $attr['module'] . '.php'; $try_filefront = MODULES_DIR . '' . $attr['module'] . '.php'; if (strstr($attr['module'], 'admin') == false) { $try_file1 = MODULES_DIR . 'admin/' . $attr['module'] . '.php'; } else { $try_file1 = MODULES_DIR . '' . $attr['module'] . '.php'; } } $try_file1 = normalize_path($try_file1, false); //$a = is_file ( $try_file1 ); //p($try_file1); //p($a); if (is_file($try_file1) == false) { if (is_file($try_file) == true) { $try_config_file = DEFAULT_TEMPLATE_DIR . 'modules/' . $attr['module'] . '_config.php'; } else { if ($options['admin'] == true) { if (strstr($attr['module'], 'admin') == false) { $try_file = MODULES_DIR . 'admin/' . '' . 'default' . '.php'; } else { $try_file = MODULES_DIR . '' . '' . 'default' . '.php'; } } } $is_admin = is_admin(); if ($is_admin == true) { $try_file1 = $try_filefront; $try_config_file = MODULES_DIR . '' . $attr['module'] . '_config.php'; $dir = dirname($try_file1); if (is_dir($dir) == false) { mkdir_recursive($dir); } //print ( "You are trying to call module that doesnt exist in $try_file1.$try_file Please create it!" ); //var_dump( $try_file, $try_file1); //exit ( "Modile file not found in $try_file1. Please create it!" ); //if (! copy ( $try_file, $try_file1 )) { //echo "failed to copy $file...\n"; //} $error = true; } else { //print ( "You are trying to call module that doesnt exist in $try_file1.$try_file Please create it!" ); $error = true; } } else { $try_config_file = MODULES_DIR . '' . $attr['module'] . '_config.php'; } if ($error == true) { $try_file1 = MODULES_DIR . 'non_existing.php'; $error = false; } // p($try_file1); if (is_file($try_file1) == true and $error == false) { $arrts = array(); foreach ($attr as $att => $at) { $this->template[$att] = $at; //$this->template [$att] = mw_get_var($at); $arrts[$att] = $at; } $no_edit = false; $no_admin = false; $check2 = false; $mem2_md5_1 = md5(serialize($m)); //$mem2_md5_2 = md5 ( serialize ( $arrts ) ); $temp2 = false; $check2 = $mem2_md5_1; $check2 = strval($check2); // $temp1 = parse_memory_storage($check2); if ($temp1 != false) { //var_dump ( $temp1 ); $module_file = $temp1; } else { // $try_config_file = normalize_path($try_config_file); $try_config_file = rtrim($try_config_file, '\\'); $cache_this = true; $force_cache_this = false; if (is_file($try_config_file)) { $config = false; include $try_config_file; if (!empty($config)) { $check_icon = MODULES_DIR . '' . $attr['module'] . '.png'; $icon = pathToURL($check_icon); //p($config); $config['icon'] = $icon; $this->template['config'] = $config; if (!empty($config['options'])) { $this->setup_module_options($config['options']); } $cache_for_session = false; if ($config['no_cache'] == true) { $cache_this = false; $do_not_cache_whole_block = true; $cache_for_session = true; } if ($config['cache'] == true) { $force_cache_this = true; $cache_for_session = true; } if ($config['no_edit'] == true) { $no_edit = true; } if ($config['no_admin'] == true) { $no_admin = true; } } } if ($arrts['no_cache'] == true) { $cache_this = false; } if ($options['no_cache'] == true) { $cache_this = false; } if ($force_cache_this == false) { if (strstr($attr['module'], 'admin/') == true) { $cache_this = false; } } if ($attr['module_id'] == true) { $mod_id = $attr['module_id']; } else { $mod_id = false; } if ($options['admin'] == true) { $cache_this = false; } $params_encoded = false; if ($force_cache_this == true) { $cache_this = true; } //var_dump($force_cache_this); if ($cache_this == true) { $cache_id = md5($try_file1) . md5(serialize($arrts)); if ($cache_for_session == true) { $cache_id = md5($try_file1) . sess_id() . md5(serialize($arrts)); } if ($_POST) { $cache_id = $cache_id . md5(serialize($_POST)); } $cache_group = 'global/blocks/'; $cache_content = CI::model('core')->cacheGetContentAndDecode($cache_id, $cache_group); if ($cache_content != false) { //var_dump($cache_content); $module_file = $cache_content; } else { $this->template['params'] = $arrts; $this->load->vars($this->template); //$module_file = $this->load->file ( $try_file1, true ); $module_file = CI::file($try_file1, true); CI::model('core')->cacheWriteAndEncode($module_file, $cache_id, $cache_group); } } else { $this->template['params'] = $arrts; $this->load->vars($this->template); //$module_file = $this->load->file ( $try_file1, true ); $module_file = CI::file($try_file1, true); } //$params_encoded = encode_var ( $arrts ); $params_encoded = 'edit_tag'; $params_module = codeClean($arrts['module']); } //if (($attr ['module'] != 'header') and ($attr ['module'] != 'footer')) { // if ($editmode == true) { // p($m); //p( $arrts); if ($no_admin == true) { $no_admin_tag = ' no_admin="true" '; } else { $no_admin_tag = ''; } if ($mod_id == true) { $mod_id_tag = ' module_id="' . $mod_id . '" '; } else { $mod_id_tag = ''; } //$edtid_hash = base64_encode ( $m ['full_tag'] ); $edtid_hash = 'edit_tag'; if (strval($module_file) != '') { if ($options['do_not_wrap'] == true) { $module_file = $module_file; } else { if ($no_edit == false) { //$module_file = '<div onmouseup="load_edit_module_by_module_id(\'' . $mod_id . '\')" mw_params_encoded="' . $params_encoded . '" mw_params_module="' . $params_module . '" ' . $mod_id_tag . ' class="module" ' . $no_admin_tag . ' edit="' . $edtid_hash . '">' . $module_file . '</div>'; $module_file = '<div mw_params_encoded="' . $params_encoded . '" mw_params_module="' . $params_module . '" ' . $mod_id_tag . ' class="module" ' . $no_admin_tag . ' edit="' . $edtid_hash . '">' . $module_file . '</div>'; //$module_file = '<div mw_params_encoded="' . $params_encoded . '" mw_params_module="' . $params_module . '" ' . $mod_id_tag . ' class="module" ' . $no_admin_tag . ' edit="' . $edtid_hash . '">' . $module_file . '</div>'; } else { $module_file = '<div mw_params_encoded="' . $params_encoded . '" mw_params_module="' . $params_module . '" ' . $mod_id_tag . ' ' . $no_admin_tag . ' class="module">' . $module_file . '</div>'; } } } else { $module_file = false; } // p($m ['full_tag']); } else { if (strval($module_file) != '') { $module_file = '<div class="module" mw_params_encoded="' . $params_encoded . '" mw_params_module="' . $params_module . '" >' . $module_file . '</div>'; } } //} ++ $module_file = str_replace('<mw', '<microweber', $module_file); if (strstr($module_file, '<microweber') == true and $error == false) { $module_file = self::parseMicrwoberTags($module_file, $options); } $layout = str_replace_count($m['full_tag'], $module_file, $layout, 1); //$layout = str_replace ( $m ['full_tag'], $module_file, $layout ); //$layout = str_replace_count ( '</microweber>', '', $layout, 1 ); $layout = str_replace_count('</mw>', '', $layout, 1); $layout = str_replace_count('</microweber>', '', $layout, 1); //$layout = str_replace ( '</mw>', '', $layout ); //$layout = str_replace ( '</microweber>', '', $layout ); //parse_memory_storage ( $check2, $layout ); } } } } } } if (strstr($layout, '<editable') == true and $error == false) { $editmode = CI::model('core')->is_editmode(); //p($editmode); $relations = array(); $tags = CI::model('core')->extractTags($layout, 'editable', $selfclosing = false, $return_the_entire_tag = true, $charset = 'UTF-8'); $matches = $tags; if (!empty($matches)) { foreach ($matches as $m) { if ($m['tag_name'] == 'editable') { $attr = $m['attributes']; $get_global = false; if ($editmode == true) { } if ($attr['rel'] == 'global') { $attr['global'] = true; $get_global = true; } if ($attr['rel'] == 'page') { $attr['page'] = PAGE_ID; } if ($attr['rel'] == 'post') { $attr['post'] = POST_ID; if ($attr['post'] == false) { $attr['post'] = PAGE_ID; //$attr ['page'] = PAGE_ID; } } if ($attr['rel'] == 'category') { $attr['category'] = CATEGORY_ID; } if ($attr['rel'] == 'module') { $relate_to_module = true; } else { $relate_to_module = false; } if ($relate_to_module == false) { if ($attr['page']) { $data = get_page($attr['page']); } else { if ($attr['post']) { $data = get_post($attr['post']); if ($data == false) { $data = get_page($attr['post']); } //p ( $data ); //p ( $attr ); } else { if ($attr['category']) { $data = get_category($attr['category']); } else { if ($attr['global']) { $get_global = true; } } } } } $cf = false; $field_content = false; if ($get_global == true) { $field_content = CI::model('core')->optionsGetByKey($attr['field'], $return_full = false, $orderby = false); } else { if (strstr($attr['field'], 'custom_field_') == true) { $cf = str_replace('custom_field_', '', $attr['field']); $field_content = $data['custom_fields'][$cf]; } else { $field_content = $data[$attr['field']]; } } //p($m ['full_tag']); if (trim($field_content) == '') { $field_content = $m['contents']; } else { //$quote_style = ENT_COMPAT [, string $charset = 'UTF-8' ]] $field_content = htmlspecialchars_decode($field_content); //$field_content = html_entity_decode ( $field_content, $quote_style = ENT_COMPAT, $charset = 'UTF-8' ); } // $field_content = html_entity_decode ( $field_content ); $field_content = htmlspecialchars_decode($field_content); $attrs_to_append = false; if ($editmode == true) { foreach ($attr as $at_key => $at_value) { $attrs_to_append .= "{$at_key}='{$at_value}' "; } //p($attrs_to_append); $layout = str_replace_count($m['full_tag'], "<div class='edit' {$attrs_to_append}>" . $field_content . '</div>', $layout, 1); } else { $layout = str_replace_count($m['full_tag'], $field_content, $layout, 1); } $layout = str_replace('<mw', '<microweber', $layout); if (strstr($layout, '<microweber') == true and $error == false) { $layout = self::parseMicrwoberTags($layout, $options); } } } } } //{SITE_URL} $site_url = site_url(); //$layout = str_replace ( '{SITE_URL}', $site_url, $layout ); $layout = CI::model('core')->replace_in_long_text('{SITE_URL}', $site_url, $layout, true); $layout = CI::model('core')->replace_in_long_text('{SITEURL}', $site_url, $layout, true); //$layout = str_replace ( '{SITEURL}', $site_url, $layout ); //$layout = $this->badWordsRemove ( $layout ); if (defined('POST_ID') == true) { //$layout = str_replace ( '{POST_ID}', POST_ID, $layout ); $layout = CI::model('core')->replace_in_long_text('{POST_ID}', POST_ID, $layout, true); } if (defined('PAGE_ID') == true) { //$layout = str_replace ( '{PAGE_ID}', PAGE_ID, $layout ); $layout = CI::model('core')->replace_in_long_text('{PAGE_ID}', PAGE_ID, $layout, true); } if (defined('CATEGORY_ID') == true) { //$layout = str_replace ( '{CATEGORY_ID}', CATEGORY_ID, $layout ); $layout = CI::model('core')->replace_in_long_text('{CATEGORY_ID}', CATEGORY_ID, $layout, true); } // $this->load->vars ( $this->template ); if (stristr($layout, 'content_meta_title')) { if (defined('POST_ID') == true) { $is_content = get_post(POST_ID); $is_content_post = $is_content; $layout = str_ireplace('{POST_ID}', POST_ID, $layout); } if ($is_content == false) { if (defined('PAGE_ID') == true) { $is_content = get_page(PAGE_ID); $is_content_page = $is_content; } } if ($is_content['content_meta_title']) { $content_meta_title = $is_content['content_meta_title']; } elseif ($is_content['content_title']) { $content_meta_title = codeClean($is_content['content_title']); } else { $content_meta_title = CI::model('core')->optionsGetByKey('content_meta_title'); } $layout = str_ireplace('{content_meta_title}', $content_meta_title, $layout); if ($is_content['content_meta_keywords']) { $content_meta_title = $is_content['content_meta_keywords']; } else { $content_meta_title = CI::model('core')->optionsGetByKey('content_meta_keywords'); } $layout = str_ireplace('{content_meta_keywords}', $content_meta_title, $layout); if ($is_content['content_meta_description']) { $content_meta_title = $is_content['content_meta_description']; } elseif ($is_content['content_description']) { $content_meta_title = codeClean($is_content['content_description']); } elseif ($is_content['content_body']) { $content_meta_title = codeClean($is_content['content_body']); } else { $content_meta_title = CI::model('core')->optionsGetByKey('content_meta_title'); } $layout = str_ireplace('{content_description}', $content_meta_title, $layout); } if (is_file(ACTIVE_TEMPLATE_DIR . 'controllers/pre_layout_display.php')) { include ACTIVE_TEMPLATE_DIR . 'controllers/pre_layout_display.php'; } if (strstr($layout, '<editable') == true or strstr($layout, '<mw') == true or strstr($layout, '<microweber') == true or strstr($layout, '<block') == true and $error == false) { $layout = self::parseMicrwoberTags($layout, $options); } if (!empty($txt_to_replace_back)) { foreach ($txt_to_replace_back as $k => $v) { // $v = html_entity_decode($v); $layout = str_replace($k, $v, $layout); } $layout = str_replace('<nomw>', '', $layout); $layout = str_replace('</nomw>', '', $layout); } if (empty($relations)) { $layout = str_ireplace('</head>', $prepend_to_head . '</head>', $layout); //$layout= '<div class="mw_module">'.$layout.'</div>'; $mem[$check] = $layout; //if ($do_not_cache_whole_block == false) { //CI::model ( 'core' )->cacheWriteAndEncode ( $layout, $cache_id, $cache_group ); //} //CI::model ( 'core' )->cacheWrite ( $layout, $function_cache_id, $cache_group ); return $layout; } else { //if ($do_not_cache_whole_block == false) { //CI::model ( 'core' )->cacheWriteAndEncode ( $v, $cache_id, $cache_group ); //} //CI::model ( 'core' )->cacheWrite ( $v, $function_cache_id, $cache_group ); $mem[$check] = $v; return $v; } //p($relations); }