function __construct()
 {
     parent::__construct();
     switch ($this->integrationMode) {
         case 'groups':
             // The primary key for categories
             switch (getCmsVersion()) {
                 case CMS_JOOMLA10:
                 case CMS_MAMBO46:
                     $this->categoryPrimaryKey = 'group_id';
                     break;
                 case CMS_JOOMLA15:
                     $this->categoryPrimaryKey = 'id';
                     break;
             }
             $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id");
             $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             break;
         case 'fields':
             $this->fields = array('Listing.id AS `Listing.listing_id`', 'Listing.username AS `Listing.title`', 'CommunityBuilder.avatar AS `Listing.images`', 'CommunityBuilder.avatarapproved AS `Listing.images_approved`', "'com_comprofiler' AS `Listing.extension`", 'JreviewsCategory.id AS `Listing.cat_id`', 'Category.fieldtitle AS `Category.title`', 'JreviewsCategory.id AS `Category.cat_id`', 'Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.required AS `Criteria.required`', 'Criteria.state AS `Criteria.state`');
             $this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             $this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             break;
     }
     $this->tag = __t("COMMUNITY_BUILDER_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
 }
Example #2
0
 function getAccessGroupList($groups = null)
 {
     /* Groupids reference */
     //    18 - Registered
     //    19 - Author
     //    20 - Editor
     //    21 - Published
     //    23 - Manager
     //    24 - Administrator
     //    25 - Super Administrator
     $whereGroups = $groups ? "\n AND id IN ({$groups})" : "";
     switch (getCmsVersion()) {
         case CMS_JOOMLA16:
             $query = "\n                    SELECT \n                        id AS value, title AS text\n                    FROM \n                        #__usergroups" . $whereGroups;
             break;
         case CMS_JOOMLA15:
             $excludedGroups = array("'ROOT'", "'USERS'", "'Public Frontend'", "'Public Backend'");
             $excludedGroups = implode(",", $excludedGroups);
             $query = "\n                    SELECT \n                        id AS value, name AS text\n                    FROM \n                        #__core_acl_aro_groups\n                    WHERE \n                        name NOT IN ({$excludedGroups})" . $whereGroups;
             break;
     }
     $this->_db->setQuery($query);
     $results = $this->_db->loadAssocList();
     return $results;
 }
 function create()
 {
     if (getCmsVersion() != CMS_JOOMLA15) {
         return $this->create_j16();
     }
     $this->name = 'categories';
     $this->autoRender = true;
     $sectionid = Sanitize::getInt($this->params, 'sectionid', '');
     $limit = Sanitize::getInt($this->params, 'limit', cmsFramework::getConfig('list_limit'));
     $limitstart = Sanitize::getInt($this->params, 'limitstart', '');
     $this->set(array('sectionid' => $sectionid, 'limit' => $limit, 'limitstart' => $limitstart, 'criterias' => $this->Criteria->getSelectList(), 'directories' => $this->Directory->getSelectList(), 'categories' => $this->Category->getSelectList()));
 }
 function __construct()
 {
     parent::__construct();
     // The primary key for categories
     switch (getCmsVersion()) {
         case CMS_JOOMLA10:
         case CMS_MAMBO46:
             $this->categoryPrimaryKey = 'group_id';
             break;
         case CMS_JOOMLA15:
             $this->categoryPrimaryKey = 'id';
             break;
     }
     $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = '{$this->extension_alias}'", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__community_users AS Community ON Listing.id = Community.userid', "LEFT JOIN #__users AS User ON User.id = Listing.id");
     $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
     $this->tag = __t("JOMSOCIAL_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
 }
Example #5
0
 function user($title, $user_id, $attributes)
 {
     if ($user_id == 0) {
         return '"' . $title . '"';
     }
     switch (getCmsVersion()) {
         case CMS_JOOMLA10:
         case CMS_MAMBO46:
             $route = $this->routes['user10'];
             $url = sprintf($route, $user_id);
             break;
         case CMS_JOOMLA15:
             $route = $this->routes['user15'];
             $url = sprintf($route, $user_id);
             break;
     }
     $attributes['sef'] = false;
     return $this->Html->link($title, $url, $attributes);
 }
 function __construct()
 {
     parent::__construct();
     $this->tag = __t("Listing", true);
     // Used in MyReviews page to differentiate from other component reviews
     // Uncomment line below to show tag in My Reviews page
     //		$this->fields[] = "'{$this->tag }' AS `Listing.tag`";
     if (getCmsVersion() == CMS_JOOMLA15) {
         // Add listing, category aliases to fields
         $this->fields[] = 'Listing.alias AS `Listing.slug`';
         $this->fields[] = 'Category.alias AS `Category.slug`';
         $this->fields[] = 'Section.alias AS `Section.slug`';
     } else {
         $this->fields[] = 'Listing.title_alias AS `Listing.slug`';
         $this->fields[] = 'Category.name AS `Category.slug`';
         $this->fields[] = 'Section.name AS `Section.slug`';
     }
     // PaidListings integration - when completing review info needs to be triggered here
     if (class_exists('PaidListingsComponent')) {
         PaidListingsComponent::applyBeforeFindListingChanges($this);
     }
     $this->Routes = RegisterClass::getInstance('RoutesHelper');
 }
Example #7
0
 function getCategory($id, $section_id, $dir_id, $listing = false)
 {
     if ($listing) {
         $core = $this->get('core_content_menu_id_' . $listing, '');
         if ($core != '') {
             return $core;
         }
         $core = $this->get('core_category_menu_id_' . $id, $this->getSection($section_id, $dir_id, $listing));
         if ($core != '') {
             return $core;
         } elseif (getCmsVersion() == CMS_JOOMLA15 && cmsFramework::getConfig('sef') == 1) {
             // There's a problem with J1.5 core sef urls with Itemids from non-core menus, so we make sure the jReviews menu ids are not used
             return false;
         }
     }
     return $this->get('jr_category_menu_id_' . $id, $this->getSection($section_id, $dir_id));
 }
Example #8
0
 function __construct()
 {
     $this->cmsVersion = getCmsVersion();
 }
Example #9
0
    } else {
        $_GET['url'] = Sanitize::getString($_GET, 'url', 'about');
    }
    /*******************************************************************
     *                         FRONT-END ROUTING
     ******************************************************************/
} elseif ($menu_id && !isset($_POST['data']['controller']) && (!$url || !isset($route['data']['controller']) || preg_match('/^menu\\//', $route['url']['url']))) {
    // If no task is passed in the url, then this is a menu item and we read the menu parameters
    $segments = array();
    $url_param = $url;
    $url = str_replace('menu', '', $url);
    $db = cmsFramework::getDB();
    $query = "SELECT * FROM #__menu WHERE id = " . $menu_id;
    $db->setQuery($query);
    $menu = end($db->loadObjectList());
    $mparams = getCmsVersion() == CMS_JOOMLA16 ? json_decode($menu->params, true) : stringToArray($menu->params);
    if (isset($mparams['action'])) {
        $action = paramsRoute((int) $mparams['action']);
        $_REQUEST['Itemid'] = $_GET['Itemid'] = $menu->id;
        // For default - home page menu
        unset($mparams['action']);
        $menu_params['data'] = $mparams;
        $filters = array('dir' => 'dirid', 'section' => 'sectionid', 'cat' => 'catid', 'criteria' => 'criteriaid');
        foreach ($filters as $key => $key2) {
            $menu_params[$key] = Sanitize::getVar($mparams, $key2);
            is_array($menu_params[$key]) and $menu_params[$key] = implode(',', $menu_params[$key]);
        }
        //        $menu_params['url'] = 'menu';
        $menu_params['data']['component_menu'] = true;
        $menu_params['data']['controller'] = $action[0];
        $menu_params['data']['action'] = $action[1];
Example #10
0
S2Paths::set($s2_app, 'S2_VIEWS_URL', S2Paths::get($s2_app, 'S2_APP_URL') . 'views' . _DS);
S2Paths::set($s2_app, 'S2_THEMES_URL', S2Paths::get($s2_app, 'S2_VIEWS_URL') . 'themes' . _DS);
S2Paths::set($s2_app, 'S2_IMAGES_URL', S2Paths::get($s2_app, 'S2_VIEWS_URL') . 'images' . _DS);
S2Paths::set($s2_app, 'S2_CSS_URL', S2Paths::get($s2_app, 'S2_VIEWS_URL') . 'css' . _DS);
S2Paths::set($s2_app, 'S2_CMS_ADMIN', PATH_ROOT . 'administrator' . DS . 'components' . DS . S2Paths::get($s2_app, 'S2_CMSCOMP') . DS);
S2Paths::set($s2_app, 'S2_ADMIN_CONTROLLERS', S2Paths::get($s2_app, 'S2_APP') . 'admin_controllers' . DS);
S2Paths::set($s2_app, 'S2_ADMIN_COMPONENTS', S2Paths::get($s2_app, 'S2_ADMIN_CONTROLLERS') . 'components' . DS);
S2Paths::set($s2_app, 'S2_ADMIN_VIEWS', S2Paths::get($s2_app, 'S2_APP') . 'views' . DS . 'admin' . DS);
S2Paths::set($s2_app, 'S2_ADMIN_HELPERS', S2Paths::get($s2_app, 'S2_ADMIN_VIEWS') . 'helpers' . DS);
S2Paths::set($s2_app, 'S2_ADMIN_VIEWS_URL', S2Paths::get($s2_app, 'S2_VIEWS_URL') . 'admin' . _DS);
S2Paths::set($s2_app, 'S2_ADMIN_THEMES_URL', S2Paths::get($s2_app, 'S2_ADMIN_VIEWS_URL') . 'themes' . _DS);
S2Paths::set($s2_app, 'S2_CSS_ADMIN_URL', S2Paths::get($s2_app, 'S2_ADMIN_VIEWS_URL') . 'css' . _DS);
S2Paths::set($s2_app, 'S2_JS_ADMIN_URL', S2Paths::get($s2_app, 'S2_ADMIN_VIEWS_URL') . 'js' . _DS);
// Whatever path you enter here, JReviews will add an additional folder called jreviews so it becomes your/path/jreviews/
// Thumbnails will be stored in your/path/jreviews/tn/ so make sure you create that folder as well
if (getCmsVersion() == CMS_JOOMLA16) {
    if (!defined('_JR_WWW_IMAGES')) {
        define('_JR_WWW_IMAGES', 'images' . _DS);
    }
    if (!defined('_JR_PATH_IMAGES')) {
        define('_JR_PATH_IMAGES', 'images' . DS);
    }
} else {
    if (!defined('_JR_WWW_IMAGES')) {
        define('_JR_WWW_IMAGES', 'images' . _DS . 'stories' . _DS);
    }
    if (!defined('_JR_PATH_IMAGES')) {
        define('_JR_PATH_IMAGES', 'images' . DS . 'stories' . DS);
    }
}
/**
Example #11
0
 function ModuleReviews()
 {
     $assets = array();
     $inline = in_array(getCmsVersion(), array(CMS_JOOMLA10, CMS_MAMBO46));
     if (Sanitize::getInt($this->params['module'], 'ajax_nav', 1)) {
         $assets['js'] = array('jreviews', 'jquery' => 'jquery', 'jq.scrollable');
     }
     $assets['css'] = array('theme', 'modules', 'paginator');
     $this->send($assets, $inline);
 }
Example #12
0
    } else {
        define('_PLUGIN_DIR_NAME', 'mambots');
    }
}
$query = "SELECT published,params FROM #__" . _PLUGIN_DIR_NAME . " WHERE element = 'jreviews' AND folder = 'content' LIMIT 1";
$CMS->_db->setQuery($query);
$jrbot = current($CMS->_db->loadObjectList());
$params = stringToArray($jrbot->params);
$published = $jrbot->published;
if ((int) (!$published)) {
    return;
}
$frontpageOff = Sanitize::getVar($params, 'frontpage');
$blogLayoutOff = Sanitize::getVar($params, 'blog');
# Get theme, suffix and load CSS so it's not killed by the built-in cache
if (getCmsVersion() == CMS_JOOMLA10 || getCmsVersion() == CMS_MAMBO46) {
    if ($option == 'com_content' && ($task == 'category' || $task == 'section' || $blogLayoutOff && $task == 'blogsection' || $blogLayoutOff && $task == 'blogcategory') || $frontpageOff && $option == 'com_frontpage') {
        return;
    }
} elseif ($blogLayoutOff && $option == 'com_content' && ($view == 'category' || $view == 'section') && ($layout == 'blog' || $layout == 'blogfull')) {
    return;
} elseif ($frontpageOff && $view == 'frontpage') {
    return;
}
jimport('joomla.plugin.plugin');
class plgContentJreviews extends JPlugin
{
    function plgContentJreviews(&$subject, $params)
    {
        parent::__construct($subject, $params);
    }
Example #13
0
/**
 * Converts string to array and removes empty elements
 */
function stringToArray($string, $separator = "\n")
{
    if (getCmsVersion() == CMS_JOOMLA16 && !strstr($string, $separator)) {
        $result = json_decode($string, true);
        if (is_array($result)) {
            return $result;
        }
    }
    $out = array();
    $array = explode($separator, $string);
    foreach ($array as $key => $value) {
        if ($value != '') {
            $pos = strpos($value, '=');
            $property = trim(substr($value, 0, $pos));
            $pvalue = trim(substr($value, $pos + 1));
            $out[$property] = $pvalue;
        }
    }
    return $out;
}
 function getUsedCategoriesgroups()
 {
     $table = '#__usergroups';
     $key = 'title';
     if (getCmsVersion() == CMS_JOOMLA15) {
         $table = '#__core_acl_aro_groups';
         $key = 'name';
     }
     $query = "\n            SELECT \n                Component.{$this->categoryPrimaryKey} AS `Component.cat_id`,Component.{$key} as `Component.cat_title`, Criteria.title AS `Component.criteria_title`\n            FROM \n                {$table} AS Component\n            INNER JOIN \n                #__jreviews_categories AS JreviewCategory ON Component.{$this->categoryPrimaryKey} = JreviewCategory.id AND JreviewCategory.`option` = '{$this->extension}'\n            LEFT JOIN \n                #__jreviews_criteria AS Criteria ON JreviewCategory.criteriaid = Criteria.id\n            LIMIT \n                {$this->offset},{$this->limit}\n        ";
     $this->_db->setQuery($query);
     appLogMessage("getUsedCategories\n" . $this->_db->getQuery(), 'everywhere');
     $results = $this->_db->loadObjectList();
     appLogMessage($this->_db->getErrorMsg(), 'everywhere');
     $results = $this->__reformatArray($results);
     $results = $this->changeKeys($results, 'Component', 'cat_id');
     $query = "SELECT count(JreviewCategory.id)" . "\n FROM #__jreviews_categories AS JreviewCategory" . "\n WHERE JreviewCategory.`option` = '{$this->extension}'";
     $this->_db->setQuery($query);
     $count = $this->_db->loadResult();
     return array('rows' => $results, 'count' => $count);
 }
Example #15
0
 function startup(&$controller = null)
 {
     # Use different default values for J15 access settings
     if (getCmsVersion() == CMS_JOOMLA15) {
         $this->security_image = "0,18";
         $this->moderation_item = "0,18";
         $this->moderation_reviews = "0,18";
         $this->editaccess = "24,25";
         $this->listing_publish_access = "24,25";
         $this->listing_delete_access = "24,25";
         $this->editaccess_reviews = "24,25";
         $this->addnewaccess = "24,25";
         $this->addnewaccess_reviews = "18,19,20,21,23,24,25";
         $this->addnewwysiwyg = "24,25";
         $this->addnewmeta = "24,25";
         $this->user_vote_public = "0,18,19,20,21,23,24,25";
         $this->addnewaccess_posts = "18,19,20,21,23,24,25";
         $this->moderation_posts = "0,18";
         $this->post_edit_access = "18,19,20,21,23,24,25";
         $this->post_delete_access = "18,19,20,21,23,24,25";
         $this->moderation_owner_replies = "18";
         $this->claims_enable_userids = "62";
         $this->authorids = "62";
     }
     if ($Config = Configure::read('JreviewsSystem.Config')) {
         $this->merge($Config);
     } else {
         $cache_file = 'jreviews_config_' . md5(cmsFramework::getConfig('secret'));
         $Config = S2Cache::read($cache_file);
         if (false == $Config || empty($Config)) {
             $Config = $this->load();
             S2Cache::write($cache_file, $Config);
         }
         $this->merge($Config);
         Configure::write('JreviewsSystem.Config', $Config);
     }
     Configure::write('System.version', strip_tags($this->version));
     Configure::write('Theme.name', $this->template);
     Configure::write('Community.extension', $this->community);
     Configure::write('Cache.enable', true);
     Configure::write('Cache.disable', false);
     Configure::write('Cache.expires', $this->cache_expires);
     Configure::write('Cache.query', (bool) $this->cache_query);
     Configure::write('Cache.view', (bool) $this->cache_view);
     Configure::write('Jreviews.editor_rank_exclude', (bool) $this->editor_rank_exclude);
 }
 /**
  * Gets the most basic listing info to construct the urls for them
  * 
  * @param mixed $id
  */
 function getListingById($id)
 {
     # Add Menu ID info for each row (Itemid)
     $Menu = ClassRegistry::getClass('MenuModel');
     $fields = array('Listing.id AS `Listing.listing_id`', 'Listing.alias AS `Listing.slug`', 'Listing.title AS `Listing.title`', 'Listing.catid AS `Listing.cat_id`', 'Category.alias AS `Category.slug`', 'Category.id AS `Category.cat_id`', 'Category.title AS `Category.title`');
     if (getCmsVersion() == CMS_JOOMLA15) {
         $fields[] = 'Listing.sectionid AS `Listing.section_id`';
     }
     $query = "\n            SELECT \n                " . implode(",", $fields) . "\n            FROM \n                #__content AS Listing\n            LEFT JOIN \n                #__categories AS Category ON Category.id = Listing.catid\n            WHERE \n                Listing.id IN (" . $this->Quote($id) . ")        \n        ";
     $this->_db->setQuery($query);
     $listings = $this->__reformatArray($this->_db->loadObjectList());
     $listings = $this->changeKeys($listings, 'Listing', 'listing_id');
     $listings = $Menu->addMenuListing($listings);
     foreach ($listings as $key => $listing) {
         $listings[$key]['Listing']['url'] = $this->listingUrl($listing);
     }
     return $listings;
 }
Example #17
0
 function _installfix()
 {
     // Load fields model
     App::import('Model', 'field', 'jreviews');
     $FieldModel = new FieldModel();
     $task = Sanitize::getString($this->data, 'task');
     $msg = '';
     $mambot_error = 0;
     switch ($task) {
         case 'fix_install_jreviews':
             $query = "SELECT id,published FROM #__" . _PLUGIN_DIR_NAME . " WHERE element = 'jreviews' AND folder = 'content'";
             $this->_db->setQuery($query);
             $jReviewsMambot = $this->_db->loadObjectList();
             if (!$jReviewsMambot || empty($jReviewsMambot)) {
                 // Install in DB
                 $this->_db->setQuery("INSERT INTO #__" . _PLUGIN_DIR_NAME . " (`name`, `element`, `folder`, `access`, `ordering`, `published`, `iscore`, `client_id`, `checked_out`, `checked_out_time`, `params`) VALUES ('jReviews Comment Plugin', 'jreviews', 'content', 0, 0, 1, 0, 0, 0, '0000-00-00 00:00:00', '');");
                 $this->_db->query();
             } else {
                 // Publish
                 $jReviewsMambot = $jReviewsMambot[0];
                 if (!$jReviewsMambot->published) {
                     $this->_db->setQuery("UPDATE #__" . _PLUGIN_DIR_NAME . " SET published = '1' WHERE id='{$jReviewsMambot->id}'");
                     $this->_db->query();
                 }
             }
             if (!file_exists(PATH_ROOT . _PLUGIN_DIR_NAME . DS . 'content' . DS . 'jreviews.php')) {
                 $package = PATH_ROOT . 'administrator' . DS . 'components' . DS . 'com_jreviews' . DS . 'jreviews.plugin.s2';
                 $target = PATH_ROOT . _PLUGIN_DIR_NAME . DS . 'content';
                 $target_file = $target . DS . 'jreviews.php';
                 if (getCmsVersion() == CMS_JOOMLA15) {
                     jimport('joomla.filesystem.file');
                     jimport('joomla.filesystem.folder');
                     jimport('joomla.filesystem.archive');
                     jimport('joomla.filesystem.path');
                     $adapter =& JArchive::getAdapter('zip');
                     $result = $adapter->extract($package, $target);
                 }
                 if (!file_exists($target_file)) {
                     require_once PATH_ROOT . 'administrator' . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php';
                     require_once PATH_ROOT . 'administrator' . DS . 'includes' . DS . 'pcl' . DS . 'pclerror.lib.php';
                     $extract = new PclZip($package);
                     if (substr(PHP_OS, 0, 3) == 'WIN') {
                         if (!defined('OS_WINDOWS')) {
                             define('OS_WINDOWS', 1);
                         }
                     } else {
                         if (!defined('OS_WINDOWS')) {
                             define('OS_WINDOWS', 0);
                         }
                     }
                     $result = $extract->extract(PCLZIP_OPT_PATH, $target);
                 }
                 if (!$result) {
                     $mambot_error = true;
                 } else {
                     $mambot_error = false;
                 }
             }
             if ($mambot_error) {
                 $msg = "It was not possible to copy the mambot/plugin files. Make sure the /" . _PLUGIN_DIR_NAME . "/content folder is writable and try again.";
             }
             break;
         case 'fix_content_fields':
             $output = '';
             $rows = $this->_db->getTableFields(array('#__jreviews_content'));
             $columns = array_keys($rows['#__jreviews_content']);
             $sql = "SELECT name,type FROM #__jreviews_fields WHERE location = 'content'";
             $this->_db->setQuery($sql);
             $fields = $this->_db->loadObjectList('name');
             $missing = array();
             foreach ($fields as $field) {
                 if (!in_array($field->name, $columns)) {
                     $output = $FieldModel->addTableColumn($field->name, $field->type, 'content');
                 }
             }
             $query = "DELETE FROM #__jreviews_fields WHERE name = ''";
             $this->_db->setQuery($query);
             $output = $this->_db->query();
             if ($output != '') {
                 $msg = "There was a problem fixing one or more of the content fields";
             }
             break;
         case 'fix_review_fields':
             $output = '';
             $rows = $this->_db->getTableFields(array('#__jreviews_review_fields'));
             $columns = array_keys($rows['#__jreviews_review_fields']);
             $sql = "SELECT name,type FROM #__jreviews_fields WHERE location = 'review'";
             $this->_db->setQuery($sql);
             $fields = $this->_db->loadObjectList('name');
             $missing = array();
             foreach ($fields as $field) {
                 if (!in_array($field->name, $columns)) {
                     $output = $FieldModel->addTableColumn($field->name, $field->type, 'review');
                 }
             }
             $query = "DELETE FROM #__jreviews_fields WHERE name = ''";
             $this->_db->setQuery($query);
             $output = $this->_db->query();
             if ($output != '') {
                 $msg = "There was a problem fixing one or more of the review fields";
             }
             break;
         default:
             break;
     }
     cmsFramework::redirect("index.php?option=com_jreviews", $msg);
 }