|
|
|
Excellent Product - But with one problem! 1 Year, 3 Months ago
|
|
Hey folks
I have to say I purchased this plugin yesterday and from what it seems this product is just EXCELLENT!!!!
However, I've not yet had the priviledge to use it due to one niggly problem.
When I enable the plugin through my Joomla backend, the following code shows up at the top of all of my articles on the frontend of the site (which isn't pretty as it defeats the purpose of having a news site).
The code which shows up is as follows:
| Code: |
registerEvent( 'onPrepareContent', 'plgContentITB' ); function plgContentITB( &$row, &$params, $page=0 ) { global $my; $db =& JFactory::getDBO(); // get plugin parameters $plugin =& JPluginHelper::getPlugin('content', 'itb'); $pluginParams = new JParameter( $plugin->params ); // fix the symbols $row->text = str_replace(">", ">", $row->text); $row->text = str_replace("<", "<", $row->text); // if the plugin is not enabled replace the tags with nothing if ( !$pluginParams->get( 'enabled', 1 ) OR $my->id == "0" ) { $row->text = preg_replace("/{itb \w*[=><#]\([\w\s\S]*?\)}[\w\s\S\r\n]*?{\/itb}/i", "", $row->text); // otherwise do all of the work } else { // check for Community Builder, if it exists, query user info $query = "SELECT *" ." FROM #__comprofiler" ." LIMIT 0,1"; $db->setQuery( $query ); $cb_check = $db->query(); if ($cb_check) { $query = "SELECT *" ." FROM #__comprofiler" ." WHERE user_id =" . $my->id; $db->setQuery( $query ); $user_field = $db->loadAssoc(); } // add Joomla fields to user_field array $user_field['username'] = $my->username; $user_field['name'] = $my->name; $user_field['email'] = $my->email; $user_field['usertype'] = $my->usertype; $user_field['registerdate'] = $my->registerDate; $user_field['lastvisitdate'] = $my->lastvisitDate; // build tag array preg_match_all("/{itb \w*[=><#]\([\w\s\S]*?\)}[\w\s\S\r\n]*?{\/itb}/i", $row->text, $itb_tag_array, PREG_SET_ORDER); $tag_array = array(); $i = 0; $tag_count = 0; foreach($itb_tag_array as $tag) { $tag_array[$i] = $tag[0]; $i++; $tag_count++; } // build the test and result array from tag array $i = 0; $test_array = array(); $result_array = array(); foreach ($tag_array as $tag) { preg_match("/{itb (\w*[=><#]\([\w\s\S]*?\))}/i", $tag, $test_match); $fix = array("(", ")"); $test_array[$i] = str_replace($fix, "", $test_match[1]); preg_match("/}([\w\s\S\r\n]*?){/i", $tag, $result_match); $result_array[$i] = $result_match[1]; $i++; } // rock the casbah $i = 0; foreach ($test_array as $test) { $test_result = run_test($test, $user_field); if ($test_result === true) { $row->text = str_replace($tag_array[$i], $result_array[$i], $row->text); } else { $row->text = str_replace($tag_array[$i], "", $row->text); } $i++; } } // end of function return true; } function run_test($test, $user_field) { $test_params = preg_split("/([=><#])/i", $test, -1, PREG_SPLIT_DELIM_CAPTURE); $field_value = $test_params[0]; if (array_key_exists($field_value, $user_field)) { switch ($test_params[1]) { case "=": $check = strpos($test_params[2], "@"); if ($check !== false) { $test_params[2] = str_replace("@", "", $test_params[2]); $stored_date = date("m-d-Y", strtotime($user_field[$field_value])); if ($stored_date == $test_params[2]) { return true; } else { return false; } } else { if ($test_params[2] == "*") { if ($user_field[$field_value] != "") { return true; } else { return false; } } if ($user_field[$field_value] == $test_params[2]) { return true; } else { return false; } } break; case ">": $check = strpos($test_params[2], "@"); if ($check !== false) { $test_params[2] = str_replace("@", "", $test_params[2]); $today = strtotime(date("Y-m-d")); $user_day = strtotime($user_field[$field_value]); $result = ($today-$user_day)/86400; if ($result > $test_params[2]) { return true; } else { return false; } } else { if ($user_field[$field_value] > $test_params[2]) { return true; } else { return false; } } break; case "<": $check = strpos($test_params[2], "@"); if ($check !== false) { $today = strtotime(date("Y-m-d")); $user_day = strtotime($user_field[$field_value]); $result = ($today-$user_day)/86400; $test_params[2] = str_replace("@", "", $test_params[2]); if ($result < $test_params[2]) { return true; } else { return false; } } else { if ($user_field[$field_value] < $test_params[2]) { return true; } else { return false; } } break; case "#": $check = strpos($user_field[$field_value], $test_params[2]); if ($check === false ) { return false; } else { return true; } break; case "@": $today = strtotime(date("Y-m-d")); $user_day = strtotime($user_field[$field_value]); $result = ($today-$user_day)/86400; if ($result > $test_params[2]) { return true; } else { return false; } break; default: return false; } } else { return false; } } ?>
|
I am running Joomla 1.5.10 in Legacy mode (as per the instructions - and a few other modules I'm running requires Legacy to be enabled).
This joomla I'm working on is currently in my development environment (which is JSAS). If you need the site to be in a production environment - I could probably get it up but if you can help me fix this without me publishing the site then that would be MUCH better! 
Can you guys help???
I hope to hear from you soon and keep up the great work!
Kind regards
Anis
|
|