当前位置: 首页>>代码示例>>PHP>>正文


PHP Sanitize::getInt方法代码示例

本文整理汇总了PHP中Sanitize::getInt方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitize::getInt方法的具体用法?PHP Sanitize::getInt怎么用?PHP Sanitize::getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sanitize的用法示例。


在下文中一共展示了Sanitize::getInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 function save(&$data)
 {
     $isNew = Sanitize::getInt($data['FieldOption'], 'optionid') ? false : true;
     $field_id = Sanitize::getInt($data['FieldOption'], 'fieldid');
     if ($isNew) {
         // Remove non alphanumeric characters from option value
         $data['FieldOption']['value'] = Sanitize::translate($data['FieldOption']['value']);
         $data['FieldOption']['value'] = str_replace($this->blackList, '', $data['FieldOption']['value']);
         $data['FieldOption']['value'] = str_replace($this->dashReplacements, '-', $data['FieldOption']['value']);
         $data['FieldOption']['value'] = preg_replace(array('/[-]+/'), array('-'), $data['FieldOption']['value']);
         $data['FieldOption']['value'] = mb_strtolower($data['FieldOption']['value'], 'UTF-8');
         // If is new checks for duplicate value
         $query = "SELECT count(fieldid) FROM #__jreviews_fieldoptions WHERE fieldid = '{$field_id}' AND value = " . $this->_db->Quote($data['FieldOption']['value']);
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             return 'duplicate';
         }
         // Find last option
         $this->_db->setQuery("select max(ordering) FROM #__jreviews_fieldoptions WHERE fieldid = '" . $field_id . "'");
         $max = $this->_db->loadResult();
         if ($max > 0) {
             $data['FieldOption']['ordering'] = $max + 1;
         } else {
             $data['FieldOption']['ordering'] = 1;
         }
     }
     # store it in the db
     if (!$this->store($data)) {
         return 'db_error';
     }
     return 'success';
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:32,代码来源:field_option.php

示例2: _addOption

 function _addOption()
 {
     $this->autoRender = false;
     $this->autoLayout = false;
     $response = array();
     $option = $this->data['FieldOption']['text'] = Sanitize::getString($this->data, 'text');
     $value = $this->data['FieldOption']['value'] = Sanitize::stripAll($this->data, 'text');
     $fieldid = $this->data['FieldOption']['fieldid'] = Sanitize::getInt($this->data, 'field_id');
     $fieldName = Sanitize::getString($this->data, 'name');
     // Begin validation
     if ($value == '') {
         $validation = __t("The field is empty.", true);
         $response[] = "jQuery('#jr_fieldOption{$fieldid}').siblings('.jr_loadingSmall').after('<span class=\"jr_validation\">&nbsp;" . $validation . "</span>');";
         return $this->ajaxResponse($response);
     }
     // Save
     $result = $this->FieldOption->save($this->data);
     switch ($result) {
         case 'success':
             // Begin update display
             $option = $this->data['FieldOption']['text'];
             $value = $this->data['FieldOption']['value'];
             $response = "\n                        jQuery('#{$fieldName}').addOption('{$value}','" . addslashes($option) . "');\n                        jQuery('#jr_fieldOption{$fieldid}').val('');            \n                        jQuery('#submitButton{$fieldid}').removeAttr('disabled');\n                    ";
             return $this->ajaxResponse($response);
         case 'duplicate':
             $validation = sprintf(__t("%s already exists", true), $value);
             break;
         case 'db_error':
             $validation = s2Messages::submitErrorGeneric();
             break;
     }
     $response[] = "jQuery('#{$fieldName}').selectOptions('" . addslashes($option) . "');";
     $response[] = "jQuery('#jr_fieldOption{$fieldid}').siblings('.jr_loadingSmall').after('<span class=\"jr_validation\">&nbsp;" . $validation . "</span>');";
     return $this->ajaxResponse($response);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:35,代码来源:field_options_controller.php

示例3: overallRatings

 function overallRatings($listing, $page, $type = '')
 {
     $editor_reviews = $this->Config->getOverride('author_review', $listing['ListingType']['config']);
     $user_reviews = $this->Config->getOverride('user_reviews', $listing['ListingType']['config']);
     if (!($listing['Criteria']['state'] == 1 && ($editor_reviews || $user_reviews))) {
         return '';
     }
     $ratings = '<div class="overall_ratings">';
     // editor ratings
     if ($editor_reviews && $type != 'user') {
         $editor_rating = Sanitize::getVar($listing['Review'], 'editor_rating');
         $editor_rating_count = Sanitize::getInt($listing['Review'], 'editor_rating_count');
         $rating_stars = $this->drawStars($editor_rating, $this->Config->rating_scale, 'editor');
         $rating_value = $this->round($editor_rating, $this->Config->rating_scale);
         $rating_count = $editor_rating_count > 1 ? ' (' . $editor_rating_count . ')' : '';
         $ratings .= '<div class="overall_editor" title="' . __t("Editor rating", true) . '">';
         $ratings .= '<span class="rating_label jrIcon jrIconEditorReview">' . __t("Editor rating", true) . '</span>';
         $ratings .= '<div class="rating_stars">' . $rating_stars . '</div>';
         $ratings .= '<span class="rating_value">' . $rating_value . $rating_count . '</span>';
         $ratings .= '</div>';
     }
     // user ratings
     if ($page == 'content' && $user_reviews && $type != 'editor') {
         $user_rating = Sanitize::getVar($listing['Review'], 'user_rating');
         $rating_stars = $this->drawStars($user_rating, $this->Config->rating_scale, 'user');
         $rating_value = $this->round($user_rating, $this->Config->rating_scale);
         $rating_count = Sanitize::getInt($listing['Review'], 'user_rating_count');
         $review_s = "";
         if ($rating_count > 1) {
             $review_s = "reviews";
         } else {
             $review_s = "review";
         }
         $ratings .= '<div class="overall_user rating" title="' . __t("User rating", true) . '">';
         $ratings .= '<span class="rating_label jrIcon jrIconUserReviews">' . __t("User rating", true) . '</span>';
         $ratings .= '<div class="rating_stars">' . $rating_stars . '</div>';
         $ratings .= '<span class="rating_value average">' . $rating_value . '<span class="best"><span class="value-title" title="' . $this->Config->rating_scale . '"></span></span> (<span class="count">' . $rating_count . '</span> ' . $review_s . ')</span>';
         $ratings .= '</div>';
     } else {
         if ($page == 'list' && $user_reviews && $this->Config->list_show_user_rating && $type != 'editor') {
             $user_rating = Sanitize::getVar($listing['Review'], 'user_rating');
             $rating_stars = $this->drawStars($user_rating, $this->Config->rating_scale, 'user');
             $rating_value = $this->round($user_rating, $this->Config->rating_scale);
             $rating_count = Sanitize::getInt($listing['Review'], 'user_rating_count');
             $review_s = "";
             if ($rating_count > 1) {
                 $review_s = "reviews";
             } else {
                 $review_s = "review";
             }
             $ratings .= '<div class="overall_user" title="' . __t("User rating", true) . '">';
             $ratings .= '<span class="rating_label jrIcon jrIconUserReviews">' . __t("User rating", true) . '</span>';
             $ratings .= '<div class="rating_stars">' . $rating_stars . '</div>';
             $ratings .= '<span class="rating_value">' . $rating_value . ' (<span class="count">' . $rating_count . '</span> ' . $review_s . ')</span>';
             $ratings .= '</div>';
         }
     }
     $ratings .= '</div>';
     return $ratings;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:60,代码来源:rating.php

示例4: index

 /**
  * Method used in Everywhere extensions detail pages
  *
  * @return array with html output, listing, reviews, rating summary
  */
 function index()
 {
     $listing_id = Sanitize::getInt($this->data, 'listing_id');
     $listing = $this->Listing->findRow(array('conditions' => "Listing.{$this->Listing->realKey} = {$listing_id}"));
     if (!is_array($listing) || empty($listing)) {
         return false;
     }
     $listing['Criteria']['required'] = explode("\n", $listing['Criteria']['required']);
     $extension = isset($this->Listing->extension_alias) ? $this->Listing->extension_alias : $this->Listing->extension;
     $fields = array('Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.state AS `Criteria.state`', 'Criteria.required AS `Criteria.required`');
     $conditions = array('Review.pid= ' . $listing_id, 'Review.author = 0', 'Review.published = 1', "Review.mode = " . $this->quote($extension), "JreviewsCategory.`option` = " . $this->quote($extension));
     $this->limit = Sanitize::getInt($this->data, 'limit_special', $this->Config->user_limit);
     $queryData = array('fields' => $fields, 'conditions' => $conditions, 'offset' => 0, 'limit' => $this->limit, 'order' => array('Review.created DESC'));
     $reviews = $this->Review->findAll($queryData);
     // Remove unnecessary query parameters for findCount
     $this->Review->joins = array();
     // Only need to query comments table
     unset($conditions[4]);
     // JreviewsCategory join above
     $queryData = array('conditions' => $conditions);
     $review_count = $this->Review->findCount($queryData);
     // prepare ratings_summary array
     $query = "\n            SELECT\n                user_rating, user_criteria_rating, user_rating_count, user_criteria_rating_count\n            FROM\n                #__jreviews_listing_totals\n            WHERE\n                listing_id = {$listing_id}\n                AND extension = " . $this->quote($extension);
     $this->_db->setQuery($query);
     $totals = current($this->_db->loadAssocList());
     $ratings_summary = array('Rating' => array('average_rating' => $totals['user_rating'], 'ratings' => explode(',', $totals['user_criteria_rating']), 'criteria_rating_count' => explode(',', $totals['user_criteria_rating_count'])), 'Criteria' => $listing['Criteria'], 'summary' => 1);
     $ratings_summary['Criteria']['required'] = $listing['Criteria']['required'];
     $review_fields = $this->review_fields = $this->Field->getFieldsArrayNew($listing['Criteria']['criteria_id'], 'review');
     $security_code = '';
     if ($this->Access->showCaptcha()) {
         $captcha = $this->Captcha->displayCode();
         $security_code = $captcha['image'];
     }
     # Initialize review array and set Criteria and extension keys
     $review = $this->Review->init();
     $review['Review']['extension'] = $extension;
     $review = array_merge($review, $ratings_summary);
     // Adds the missing required criteria array
     # check for duplicate reviews
     $this->_user->duplicate_review = false;
     // It's a guest so we only care about checking the IP address if this feature is not disabled and
     // server is not localhost
     if (!$this->_user->id) {
         if (!$this->Config->review_ipcheck_disable && $this->ipaddress != '127.0.0.1') {
             // Do the ip address check everywhere except in localhost
             $this->_user->duplicate_review = (bool) $this->Review->findCount(array('conditions' => array('Review.pid = ' . $listing_id, "Review.ipaddress = '{$this->ipaddress}'", "Review.mode = '{$extension}'", "Review.author = 0", "Review.published >= 0")));
         }
     } else {
         if (!$this->Config->user_multiple_reviews) {
             $this->_user->duplicate_review = (bool) $this->Review->findCount(array('conditions' => array('Review.pid = ' . $listing_id, "(Review.userid = {$this->_user->id}" . ($this->ipaddress != '127.0.0.1' && !$this->Config->review_ipcheck_disable ? " OR Review.ipaddress = '{$this->ipaddress}') " : ')'), "Review.mode = '{$extension}'", "Review.author = 0", "Review.published >= 0")));
         }
     }
     $this->set(array('Access' => $this->Access, 'User' => $this->_user, 'listing' => $listing, 'reviews' => $reviews, 'ratings_summary' => $ratings_summary, 'reviewType' => 'user', 'review_count' => $review_count, 'user_rating_count' => $totals['user_rating_count'], 'review_fields' => $review_fields, 'review' => $review, 'captcha' => $security_code));
     if (!class_exists('RatingHelper')) {
         App::import('Helper', 'rating', 'jreviews');
     }
     $Rating = ClassRegistry::getClass('RatingHelper');
     $output = array('output' => $this->render($this->name, 'reviews'), 'summary' => $Rating->overallRatings($listing, 'content'), 'detailed_ratings' => $Rating->detailedRatings($review, 'user'), 'listing' => $listing, 'reviews' => $reviews, 'review_count' => $review_count, 'ratings' => $ratings_summary);
     return $output;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:65,代码来源:everywhere_controller.php

示例5: beforeFilter

 function beforeFilter()
 {
     parent::beforeFilter();
     if (Sanitize::getInt($this->data, 'OwnerReply')) {
         $this->review_id = Sanitize::getInt($this->data['OwnerReply'], 'id');
     } else {
         $this->review_id = Sanitize::getInt($this->params, 'review_id');
     }
     if (!$this->Config->owner_replies || $this->review_id == 0 || $this->_user->id == 0) {
         $this->denyAccess = true;
         return;
     }
     // Get the listing id and extension
     $this->_db->setQuery("\n            SELECT \n                Review.pid AS listing_id, Review.`mode` AS extension\n            FROM \n                #__jreviews_comments AS Review\n            WHERE \n                Review.id = " . $this->review_id);
     // Get listing owner id and check if it matches the current user
     if ($listing = current($this->_db->loadAssocList())) {
         // Automagically load and initialize Everywhere Model to check if user is listing owner
         App::import('Model', 'everywhere_' . $listing['extension'], 'jreviews');
         $class_name = inflector::camelize('everywhere_' . $listing['extension']) . 'Model';
         if (class_exists($class_name)) {
             $this->Listing = new $class_name();
             $owner = $this->Listing->getListingOwner($listing['listing_id']);
             if ($this->_user->id != $owner['user_id']) {
                 $this->denyAccess = true;
                 return;
             }
             $this->data['Listing']['created_by'] = $owner['user_id'];
             // Used in the Activities component
             $this->data['Listing']['listing_id'] = $listing['listing_id'];
             // Used in the Activities component
             $this->data['Listing']['extension'] = $listing['extension'];
             // Used in the Activities component
         }
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:35,代码来源:owner_replies_controller.php

示例6: _getMarkerTooltip

 function _getMarkerTooltip()
 {
     $listing_id = Sanitize::getInt($this->params, 'listing_id');
     $listing = $this->Listing->findRow(array('conditions' => array('Listing.id = ' . $listing_id)));
     $this->set('listing', $listing);
     return $this->render('geomaps', 'map_infowindow');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:7,代码来源:geomaps_controller.php

示例7: getListingFavorites

 function getListingFavorites($listing_id, $user_id, $passedArgs)
 {
     $conditions = array();
     $avatar = Sanitize::getInt($passedArgs['module'], 'avatar', 1);
     // Only show users with avatars
     $count = Sanitize::getInt($passedArgs['module'], 'module_limit', 5);
     $module_id = Sanitize::getInt($passedArgs, 'module_id');
     $rand = Sanitize::getFloat($passedArgs, 'rand');
     $fields = array('Community.' . $this->realKey . ' AS `User.user_id`', 'User.name AS `User.name`', 'User.username AS `User.username`');
     if ($avatar) {
         $conditions[] = 'Community.thumb <> "components/com_community/assets/default_thumb.jpg"';
     }
     if ($listing_id) {
         $conditions[] = 'Community.' . $this->realKey . ' in (SELECT user_id FROM #__jreviews_favorites WHERE content_id = ' . $listing_id . ')';
     }
     $order = array('RAND(' . $rand . ')');
     $joins = array('LEFT JOIN #__users AS User ON Community.' . $this->realKey . ' = User.id');
     $profiles = $this->findAll(array('fields' => $fields, 'conditions' => $conditions, 'order' => $order, 'joins' => $joins));
     if (Sanitize::getInt($passedArgs['module'], 'ajax_nav', 1)) {
         $fields = array('count(Community.' . $this->realKey . ')');
         $group = array('Community.' . $this->realKey);
         $this->count = $this->findCount(array('fields' => $fields, 'conditions' => $conditions, 'group' => $group, 'joins' => $joins));
     } else {
         $this->count = Sanitize::getInt($passedArgs['module'], 'module_limit', 5);
     }
     return $this->addProfileInfo($profiles, 'User', 'user_id');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:27,代码来源:anahita.php

示例8: findChildOptions

 function findChildOptions()
 {
     $response = array();
     $childField = Sanitize::getString($this->data, 'childField');
     $childSelected = Sanitize::getString($this->data, 'childSelected');
     $parentValue = Sanitize::getString($this->data, 'parentValue');
     $module_id = Sanitize::getInt($this->data, 'module_id');
     if ($parentValue == '') {
         $ret = '<option value="">' . __t("Select", true, true) . '</option>';
         $response[] = "jQuery(\"#{$childField}{$module_id}\").html('{$ret}').attr('disabled','disabled');";
         return implode(' ', $response);
     }
     $query = "                                                                                           \r\n            SELECT \r\n                FieldOption.optionid, FieldOption.text, FieldOption.value\r\n            FROM #__jreviews_fieldoptions AS FieldOption\r\n            INNER JOIN #__jreviews_fields AS Field ON FieldOption.fieldid = Field.fieldid AND Field.name = '" . $childField . "'\r\n            WHERE FieldOption.value LIKE '" . $parentValue . "-%'\r\n        ";
     $this->_db->setQuery($query);
     $options = $this->_db->loadAssocList();
     $ret = '<option value="">' . __t("Select", true, true) . '</option>';
     foreach ($options as $option) {
         if ($childSelected != '' && $option['value'] == $childSelected) {
             $ret .= '<option selected="selected" value="' . $option['value'] . '">' . $option['text'] . '</option>';
         } else {
             $ret .= '<option value="' . $option['value'] . '">' . $option['text'] . '</option>';
         }
     }
     $response[] = "jQuery(\"#{$childField}{$module_id}\").html('{$ret}').removeAttr('disabled');";
     return implode(' ', $response);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:26,代码来源:related_fields_controller.php

示例9: index

 function index($params)
 {
     $this->action = 'directory';
     // Set view file
     # Read module params
     $dir_id = cleanIntegerCommaList(Sanitize::getString($this->params['module'], 'dir_ids'));
     $conditions = array();
     $order = array();
     $cat_id = '';
     $section_id = '';
     $directories = $this->Directory->getTree($dir_id, true);
     if ($menu_id = Sanitize::getInt($this->params, 'Itemid')) {
         $menuParams = $this->Menu->getMenuParams($menu_id);
     }
     # Category auto detect
     $ids = CommonController::_discoverIDs($this);
     extract($ids);
     if ($cat_id != '' && $section_id == '') {
         $cat_id = cleanIntegerCommaList($cat_id);
         $sql = "SELECT section FROM #__categories WHERE id IN (" . $cat_id . ")";
         $this->_db->setQuery($sql);
         $section_id = $this->_db->loadResult();
     }
     $this->set(array('directories' => $directories, 'cat_id' => is_numeric($cat_id) && $cat_id > 0 ? $cat_id : false, 'section_id' => $section_id));
     return $this->render('modules', 'directories');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:26,代码来源:module_directories_controller.php

示例10: index

 function index($params)
 {
     $this->action = 'directory';
     // Trigger assets helper method
     if ($this->_user->id === 0) {
         $this->cacheAction = Configure::read('Cache.expires');
     }
     $page = array('title' => '', 'show_title' => 0);
     $conditions = array();
     $order = array();
     if ($menu_id = Sanitize::getInt($this->params, 'Itemid')) {
         $menuParams = $this->Menu->getMenuParams($menu_id);
         $page['title'] = Sanitize::getString($menuParams, 'title');
         $page['show_title'] = Sanitize::getString($menuParams, 'dirtitle', 0);
     }
     $override_keys = array('dir_show_alphaindex', 'dir_cat_images', 'dir_columns', 'dir_cat_num_entries', 'dir_category_hide_empty', 'dir_category_levels', 'dir_cat_format');
     if (Sanitize::getBool($menuParams, 'dir_overrides')) {
         $overrides = array_intersect_key($menuParams, array_flip($override_keys));
         $this->Config->override($overrides);
     }
     if ($this->cmsVersion == CMS_JOOMLA15) {
         $directories = $this->Directory->getTree(Sanitize::getString($this->params, 'dir'));
     } else {
         $directories = $this->Category->findTree(array('level' => $this->Config->dir_cat_format === 0 ? 2 : $this->Config->dir_category_levels, 'menu_id' => true, 'dir_id' => Sanitize::getString($this->params, 'dir'), 'pad_char' => ''));
     }
     $this->set(array('page' => $page, 'directories' => $directories));
     return $this->render('directories', 'directory');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:28,代码来源:directories_controller.php

示例11: index

 function index()
 {
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     $cache_file = 'modules_totals_' . $module_id . '_' . md5(serialize($this->params['module']));
     $page = $this->cached($cache_file);
     if ($page) {
         return $page;
     }
     // Initialize variables
     $extension = Sanitize::getString($this->params['module'], 'extension');
     // Automagically load and initialize Everywhere Model
     App::import('Model', 'everywhere_' . $extension, 'jreviews');
     $class_name = inflector::camelize('everywhere_' . $extension) . 'Model';
     $conditions_reviews = array('Review.published = 1');
     $extension == 'com_content' and $conditions_listings = array('Listing.state = 1');
     $extension != '' and $conditions_reviews[] = "Review.mode = " . $this->quote($extension);
     if (class_exists($class_name)) {
         $this->Listing = new $class_name();
         $this->Listing->_user = $this->_user;
         $listings = $this->Listing->findCount(array('conditions' => $conditions_listings), 'DISTINCT Listing.' . $this->Listing->realKey);
         $reviews = $this->Review->findCount(array('conditions' => $conditions_reviews), 'DISTINCT Review.id');
     }
     # Send variables to view template
     $this->set(array('listing_count' => isset($listings) ? $listings : 0, 'review_count' => isset($reviews) ? $reviews : 0));
     $page = $this->render('modules', 'totals');
     # Save cached version
     $this->cacheView('modules', 'totals', $cache_file, $page);
     return $page;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:30,代码来源:module_totals_controller.php

示例12: index

 function index($params)
 {
     /*        if($this->_user->id === 0) 
             {
                 $this->cacheAction = Configure::read('Cache.expires');        
             }*/
     $this->action = 'directory';
     // Set view file
     # Read module params
     $dir_id = isset($this->params['module']) ? cleanIntegerCommaList(Sanitize::getString($this->params['module'], 'dir_ids')) : '';
     $conditions = array();
     $order = array();
     $cat_id = '';
     $section_id = '';
     if ($this->cmsVersion == CMS_JOOMLA15) {
         $directories = $this->Directory->getTree($dir_id, true);
     } else {
         $directories = $this->Category->findTree(array('level' => $this->Config->dir_category_levels, 'menu_id' => true, 'dir_id' => $dir_id, 'pad_char' => ''));
     }
     if ($menu_id = Sanitize::getInt($this->params, 'Itemid')) {
         $menuParams = $this->Menu->getMenuParams($menu_id);
     }
     # Category auto detect
     $ids = CommonController::_discoverIDs($this);
     extract($ids);
     if ($this->cmsVersion == CMS_JOOMLA15 && ($cat_id != '' && $section_id == '')) {
         $cat_id = cleanIntegerCommaList($cat_id);
         $sql = "SELECT section FROM #__categories WHERE id IN (" . $cat_id . ")";
         $this->_db->setQuery($sql);
         $section_id = $this->_db->loadResult();
     }
     $this->set(array('directories' => $directories, 'dir_id' => $dir_id, 'cat_id' => is_numeric($cat_id) && $cat_id > 0 ? $cat_id : false, 'section_id' => $section_id));
     return $this->render('modules', 'directories');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:34,代码来源:module_directories_controller.php

示例13: index

 function index()
 {
     $Session = RegisterClass::getInstance('MvcSession');
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     if (!isset($this->params['module'])) {
         $this->params['module'] = array();
     }
     // For direct calls to the controller
     if ($this->ajaxRequest) {
         $this->params = $Session->get('module_params' . $module_id, null, S2Paths::get('jreviews', 'S2_CMSCOMP'));
     } else {
         srand((double) microtime() * 1000000);
         $this->params['rand'] = rand();
         $Session->set('module_rand' . $module_id, $this->params['rand'], S2Paths::get('jreviews', 'S2_CMSCOMP'));
         $Session->set('module_params' . $module_id, $this->params, S2Paths::get('jreviews', 'S2_CMSCOMP'));
     }
     $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     // Read the module parameters
     $img_width = Sanitize::getInt($this->params['module'], 'img_width', 50);
     $random_mode = Sanitize::getString($this->params['module'], 'random_mode', 'Random Users');
     $favorites_mode = Sanitize::getString($this->params['module'], 'favorites_mode', 'Other users interested in {title}');
     // Pagination
     $this->Community->limit = $this->module_limit;
     $this->Community->offset = $this->module_offset;
     # Get url params for current controller/action
     $url = Sanitize::getString($_REQUEST, 'url');
     $route['url']['url'] = $url;
     $route['data'] = array();
     $route = S2Router::parse($route, true, 'jreviews');
     # Check if page is listing detail
     $detail = Sanitize::getString($route['url'], 'extension', 'com_content') == 'com_content' && isset($route['data']) && Sanitize::getString($route['data'], 'controller') == 'listings' && Sanitize::getString($route['data'], 'action') == 'detail' ? true : false;
     # Initialize variables
     $listing_id = $detail ? Sanitize::getInt($route, 'id') : Sanitize::getInt($this->params, 'id');
     $option = Sanitize::getString($this->params, 'option');
     $view = Sanitize::getString($this->params, 'view');
     $task = Sanitize::getString($this->params, 'task');
     $listing_title = '';
     # Article auto-detect - only for com_content
     if ($detail || 'com_content' == $option && ('article' == $view || 'view' == $task)) {
         $query = "SELECT Listing.id, Listing.title FROM #__content AS Listing WHERE Listing.id = " . $listing_id;
         $this->_db->setQuery($query);
         $listing = current($this->_db->loadObjectList());
         $listing_title = $listing->title;
     } else {
         $listing_id = null;
     }
     $profiles = $this->Community->getListingFavorites($listing_id, $this->_user->id, $this->params);
     $total = $this->Community->count;
     unset($this->Community->count);
     $this->set(array('profiles' => $profiles, 'listing_title' => $listing_title, 'total' => $total));
     $page = $this->render('modules', 'favorite_cbusers');
     if ($this->ajaxRequest) {
         return $this->ajaxResponse($page, false);
     } else {
         return $page;
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:57,代码来源:module_favorite_cbusers_controller.php

示例14: reviews

 function reviews()
 {
     $access = $this->cmsVersion == CMS_JOOMLA15 ? $this->Access->getAccessId() : $this->Access->getAccessLevels();
     $feed_filename = PATH_ROOT . 'cache' . DS . 'jreviewsfeed_' . md5($access . $this->here) . '.xml';
     $this->Feeds->useCached($feed_filename, 'reviews');
     $extension = Sanitize::getString($this->params, 'extension', 'com_content');
     $cat_id = Sanitize::getInt($this->params, 'cat');
     $section_id = Sanitize::getInt($this->params, 'section');
     $dir_id = Sanitize::getInt($this->params, 'dir');
     $listing_id = Sanitize::getInt($this->params, 'id');
     $this->encoding = cmsFramework::getCharset();
     $feedPage = null;
     $this->EverywhereAfterFind = true;
     // Triggers the afterFind in the Observer Model
     $this->limit = $this->Config->rss_limit;
     $rss = array('title' => $this->Config->rss_title, 'link' => WWW_ROOT, 'description' => $this->Config->rss_description, 'image_url' => WWW_ROOT . "images/stories/" . $this->Config->rss_image, 'image_link' => WWW_ROOT);
     $queryData = array('conditions' => array('Review.published = 1', "Review.mode = '{$extension}'"), 'fields' => array('Review.mode AS `Review.extension`'), 'limit' => $this->limit, 'order' => array('Review.created DESC'));
     if ($extension == 'com_content') {
         $queryData['conditions'][] = 'Listing.state = 1';
         $queryData['conditions'][] = '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )';
         $queryData['conditions'][] = '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )';
         # Shows only links users can access
         if ($this->cmsVersion == CMS_JOOMLA15) {
             $access_id = $this->Access->getAccessId();
             $queryData['conditions'][] = 'Listing.access <= ' . $access_id;
             $queryData['conditions'][] = 'Category.access <= ' . $access_id;
         } else {
             $cat_id > 0 and $cat_id = array_keys($this->Category->getChildren($cat_id));
             $access_id = $this->Access->getAccessLevels();
             $queryData['conditions'][] = 'Listing.access IN ( ' . $access_id . ')';
             $queryData['conditions'][] = 'Category.access IN ( ' . $access_id . ')';
         }
     }
     if (!empty($cat_id) && $extension == 'com_content') {
         // Category feeds only supported for core content
         $queryData['conditions'][] = 'JreviewsCategory.id IN (' . $this->quote($cat_id) . ')';
         $feedPage = 'category';
     } elseif ($section_id > 0 && $extension == 'com_content') {
         $queryData['conditions'][] = 'Listing.sectionid= ' . $section_id;
         $feedPage = 'section';
     } elseif ($dir_id > 0 && $extension == 'com_content') {
         $queryData['conditions'][] = 'JreviewsCategory.dirid= ' . $dir_id;
         $feedPage = 'directory';
     } elseif ($extension != 'com_content') {
         unset($this->Review->joins['listings'], $this->Review->joins['jreviews_categories'], $this->Review->joins['listings']);
         $feedPage = 'everywhere';
     }
     if ($listing_id > 0) {
         $queryData['conditions'][] = 'Review.pid = ' . $listing_id;
         $feedPage = 'listing';
     }
     # Don't run it here because it's run in the Everywhere Observer Component
     $this->Review->runProcessRatings = false;
     $reviews = $this->Review->findAll($queryData);
     $this->set(array('feedPage' => $feedPage, 'encoding' => $this->encoding, 'rss' => $rss, 'reviews' => $reviews));
     return $this->Feeds->saveFeed($feed_filename, 'reviews');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:57,代码来源:feeds_controller.php

示例15: _deleteModeration

 function _deleteModeration()
 {
     $response = array();
     $entry_id = Sanitize::getInt($this->data, 'entry_id');
     $deleted = $this->Claim->delete('claim_id', $entry_id);
     if ($deleted) {
         $response[] = "jreviews_admin.dialog.close();";
         $response[] = "jQuery('#jr_moderateForm" . $entry_id . "').fadeOut(1500,function(){jQuery(this).html('');});";
         $response[] = "jreviews_admin.menu.moderation_counter('claim_count');";
     }
     return $this->ajaxResponse($response);
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:12,代码来源:admin_claims_controller.php


注:本文中的Sanitize::getInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。