本文整理汇总了PHP中FlexicontentHelperPerm::getPerm方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentHelperPerm::getPerm方法的具体用法?PHP FlexicontentHelperPerm::getPerm怎么用?PHP FlexicontentHelperPerm::getPerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentHelperPerm
的用法示例。
在下文中一共展示了FlexicontentHelperPerm::getPerm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display the view
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$document = JFactory::getDocument();
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
//add css and submenu to document
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
// Get User's Global Permissions
$perms = FlexicontentHelperPerm::getPerm();
// Create Submenu (and also check access to current view)
FLEXISubmenu('CanGroups');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_GROUPS');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'groups');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
$this->addToolbar();
parent::display($tpl);
}
示例2: display
function display($tpl = null)
{
//initialise variables
$mainframe = JFactory::getApplication();
$option = JRequest::getVar('option');
$document = JFactory::getDocument();
$user = JFactory::getUser();
$db = JFactory::getDBO();
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
//add css and submenu to document
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
$permission = FlexicontentHelperPerm::getPerm();
if (!$permission->CanTemplates) {
$mainframe->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS'));
}
// Get User's Global Permissions
$perms = FlexicontentHelperPerm::getPerm();
//Create Submenu
FLEXISubmenu('CanTemplates');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_TEMPLATES');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'templates');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
//JToolBarHelper::Back();
if ($perms->CanConfig) {
//JToolBarHelper::divider(); JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
$tmpldirectory = JPATH_COMPONENT_SITE . DS . 'templates' . DS;
$source = JRequest::getString('source', '');
$dest = $source ? flexicontent_upload::sanitizedir($tmpldirectory, $source) : '';
//Get data from the model
$rows = $this->get('Data');
//assign data to template
$this->assignRef('rows', $rows);
$this->assignRef('user', $user);
$this->assignRef('tmpldirectory', $tmpldirectory);
$this->assignRef('source', $source);
$this->assignRef('dest', $dest);
parent::display($tpl);
}
示例3: display
function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$app = JFactory::getApplication();
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$option = JRequest::getCmd('option');
$view = JRequest::getVar('view');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Get filters
$count_filters = 0;
$search = $app->getUserStateFromRequest($option . '.' . $view . '.search', 'search', '', 'string');
$search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search)));
// **************************
// Add css and js to document
// **************************
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css');
}
}
// *****************************
// Get user's global permissions
// *****************************
$perms = FlexicontentHelperPerm::getPerm();
// ************************
// Create Submenu & Toolbar
// ************************
// Create Submenu (and also check access to current view)
FLEXISubmenu('CanGroups');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_GROUPS');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'groups');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
$this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null;
$this->addToolbar();
//assign data to template
$this->lists['search'] = $search;
$this->count_filters = $count_filters;
$this->option = $option;
$this->view = $view;
parent::display($tpl);
}
示例4: setToolbar
/**
* Method to configure the toolbar for this view.
*
* @access public
* @return void
*/
function setToolbar()
{
$document = JFactory::getDocument();
$js = "jQuery(document).ready(function(){";
$toolbar = JToolBar::getInstance('toolbar');
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=basic';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-basicindex a.toolbar, #toolbar-basicindex button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'basicindex.png', 'basicindex_f2.png', 'FLEXI_REINDEX_BASIC_CONTENT_LISTS', false);
} else {
$toolbar->appendButton('Popup', 'basicindex', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', str_replace('&', '&', $popup_load_url), 500, 240);
}
JToolBarHelper::divider();
JToolBarHelper::spacer();
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-advindex a.toolbar, #toolbar-advindex button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'advindex.png', 'advindex_f2.png', 'FLEXI_REINDEX_ADVANCED_SEARCH_VIEW', false);
} else {
$toolbar->appendButton('Popup', 'advindex', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', str_replace('&', '&', $popup_load_url), 500, 240);
}
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced&rebuildmode=quick';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'advindexdirty.png', 'advindexdirty_f2.png', 'FLEXI_REINDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', false);
} else {
$toolbar->appendButton('Popup', 'advindexdirty', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', str_replace('&', '&', $popup_load_url), 500, 240);
}
$toolbar->appendButton('Confirm', 'FLEXI_DELETE_INDEX_CONFIRM', 'trash', 'FLEXI_INDEX_ADVANCED_PURGE', FLEXI_J16GE ? 'search.purge' : 'purge', false);
$user = JFactory::getUser();
$perms = FlexicontentHelperPerm::getPerm();
if ($perms->CanConfig) {
JToolBarHelper::divider();
JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
$js .= "});";
$document->addScriptDeclaration($js);
}
示例5: display
function display($tpl = null)
{
// ********************
// Initialise variables
// ********************
$app = JFactory::getApplication();
$jinput = $app->input;
$option = $jinput->get('option', '', 'cmd');
$view = $jinput->get('view', '', 'cmd');
$task = $jinput->get('task', '', 'cmd');
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$session = JFactory::getSession();
// Get model
$model = $this->getModel();
// Some flags
$has_zlib = function_exists("zlib_encode");
//version_compare(PHP_VERSION, '5.4.0', '>=');
// Get session information
$conf = $session->get('csvimport_config', "", 'flexicontent');
$conf = unserialize($conf ? $has_zlib ? zlib_decode(base64_decode($conf)) : base64_decode($conf) : "");
$lineno = $session->get('csvimport_lineno', 999999, 'flexicontent');
$session->set('csvimport_parse_log', null, 'flexicontent');
// This is the flag if CSV file has been parsed (import form already submitted), thus to display the imported data
// **************************
// Add css and js to document
// **************************
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH);
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH);
// Add JS frameworks
flexicontent_html::loadFramework('select2');
$prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable');
flexicontent_html::loadFramework('flexi-lib');
// Add js function to overload the joomla submitform validation
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH);
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH);
// *****************************
// Get user's global permissions
// *****************************
$perms = FlexicontentHelperPerm::getPerm();
// ************************
// Create Submenu & Toolbar
// ************************
// Create Submenu (and also check access to current view)
FLEXISubmenu('CanImport');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_IMPORT');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'import');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
$toolbar = JToolBar::getInstance('toolbar');
if (!empty($conf)) {
if ($task != 'processcsv') {
$ctrl_task = 'import.processcsv';
$import_btn_title = empty($lineno) ? 'FLEXI_IMPORT_START_TASK' : 'FLEXI_IMPORT_CONTINUE_TASK';
JToolBarHelper::custom($ctrl_task, 'save.png', 'save.png', $import_btn_title, $list_check = false);
}
$ctrl_task = 'import.clearcsv';
JToolBarHelper::custom($ctrl_task, 'cancel.png', 'cancel.png', 'FLEXI_IMPORT_CLEAR_TASK', $list_check = false);
} else {
$ctrl_task = 'import.initcsv';
JToolBarHelper::custom($ctrl_task, 'import.png', 'import.png', 'FLEXI_IMPORT_PREPARE_TASK', $list_check = false);
$ctrl_task = 'import.testcsv';
JToolBarHelper::custom($ctrl_task, 'test.png', 'test.png', 'FLEXI_IMPORT_TEST_FILE_FORMAT', $list_check = false);
}
//JToolBarHelper::Back();
if ($perms->CanConfig) {
JToolBarHelper::divider();
JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
// Get types
$types = flexicontent_html::getTypesList($_type_ids = false, $_check_perms = false, $_published = true);
// Get Languages
$languages = FLEXIUtilities::getLanguages('code');
// Get categories
global $globalcats;
$categories = $globalcats;
// ************************************
// Decide layout to load: 'import*.php'
// ************************************
$this->setLayout('import');
$this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null;
// Execute the import task, load the log-like AJAX-based layout (import_process.php), to display results including any warnings
if (!empty($conf) && $task == 'processcsv') {
$this->assignRef('conf', $conf);
parent::display('process');
return;
} else {
if (!empty($conf)) {
//.........这里部分代码省略.........
示例6: buildcatselect
/**
* Build a html select form field that displays a Category Tree
*
* The output is filtered (via FLEXIaccess or via J1.6+ permission) and has disabled specific categories
* About Disabled categories:
* - currently edited category is disabled
* - if the user can view all categories then categories he has no permission are disabled !!!
*
* @param array $list
* @param string $name
* @param array $selected
* @param bool $top
* @param string $check_published
* @param string $check_perms
* @param string $require_all
* @param array $skip_subtrees
* @param array $disable_subtrees
* @param array $custom_options
*
* @return a category form field element
*/
public static function buildcatselect($list, $name, $selected, $top, $attribs = 'class="inputbox"', $check_published = false, $check_perms = true, $actions_allowed = array('core.create', 'core.edit', 'core.edit.own'), $require_all = true, $skip_subtrees = array(), $disable_subtrees = array(), $custom_options = array(), $disable_specific_cats = array(), $empty_errmsg = false)
{
// ***************************
// Initialize needed variables
// ***************************
global $globalcats;
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
$controller = JRequest::getVar('controller');
$task = JRequest::getVar('task');
$print_logging_info = $cparams->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
$start_microtime = microtime(true);
}
// Privilege of (a) viewing all categories (even if disabled) and (b) viewing as a tree
require_once JPATH_ROOT . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'permission.php';
$viewallcats = FlexicontentHelperPerm::getPerm()->ViewAllCats;
$viewtree = FlexicontentHelperPerm::getPerm()->ViewTree;
// Global parameter to force always displaying of categories as tree
if ($cparams->get('cats_always_astree', 1)) {
$viewtree = 1;
}
// **************************************************************
// Find user allowed categories to be used during Filtering below
// **************************************************************
if ($check_perms) {
// Get user allowed categories, NOTE: if user (a) (J2.5) has 'core.admin' or (b) (J1.5) user is super admin (gid==25) then all cats are allowed
$usercats = FlexicontentHelperPerm::getAllowedCats($user, $actions_allowed, $require_all, $check_published);
// NOTE: already selected categories will be allowed to the user, add them to the category list
$selectedcats = !is_array($selected) ? array($selected) : $selected;
$usercats_indexed = array_flip($usercats);
foreach ($selectedcats as $selectedcat) {
if ($selectedcat) {
$usercats_indexed[$selectedcat] = 1;
}
}
}
// *********************************************************************************
// Excluded subtrees e.g. featured categories subtree in item form
// Disabled subtrees e.g. existing children subtree when selecting category's parent
// *********************************************************************************
$skip_cats_arr = array();
if (!empty($skip_subtrees)) {
foreach ($skip_subtrees as $subtree_rootid) {
if ($subtree_rootid && isset($globalcats[$subtree_rootid]->descendantsarray)) {
foreach ($globalcats[$subtree_rootid]->descendantsarray as $_excluded) {
$skip_cats_arr[$_excluded] = 1;
}
}
}
}
$disable_cats_arr = array();
if (!empty($disable_subtrees)) {
foreach ($disable_subtrees as $subtree_rootid) {
if ($subtree_rootid && isset($globalcats[$subtree_rootid]->descendantsarray)) {
foreach ($globalcats[$subtree_rootid]->descendantsarray as $_excluded) {
$disable_cats_arr[$_excluded] = 1;
}
}
}
}
// Disable specific categories
if (!empty($disable_specific_cats)) {
foreach ($disable_specific_cats as $_excluded) {
$disable_cats_arr[$_excluded] = 1;
}
}
// **************************************************************************
// TOP parameter: defines the APPROPRIATE PROMPT option at top of select list
// **************************************************************************
$cats_count = 0;
$catlist = array();
// A tree to select: e.g. a parent category
if (!is_numeric($top) && strlen($top)) {
$catlist[] = JHTML::_('select.option', '', $top);
} else {
if ($top == 1) {
$catlist[] = JHTML::_('select.option', FLEXI_J16GE ? 1 : 0, JText::_('FLEXI_TOPLEVEL'));
//.........这里部分代码省略.........
示例7: getItemsMultiprop
/**
* Method to get items using files VIA (multi property) field types that store file as as property either file id or filename!
*
* @access public
* @return object
*/
function getItemsMultiprop($field_props = array('image' => 'originalname'), $value_props = array('image' => 'filename'), $file_ids = array(), $count_items = false, $ignored = false)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$option = JRequest::getVar('option');
$filter_uploader = $app->getUserStateFromRequest($option . '.' . $this->viewid . '.filter_uploader', 'filter_uploader', 0, 'int');
$where = array();
$file_ids_list = '';
if (count($file_ids)) {
$file_ids_list = ' AND f.id IN (' . "'" . implode("','", $file_ids) . "')";
} else {
$permission = FlexicontentHelperPerm::getPerm();
$CanViewAllFiles = $permission->CanViewAllFiles;
if (!$CanViewAllFiles) {
$where[] = ' f.uploaded_by = ' . (int) $user->id;
} else {
if ($filter_uploader) {
$where[] = ' f.uploaded_by = ' . $filter_uploader;
}
}
}
if (isset($ignored['item_id'])) {
$where[] = ' i.id!=' . (int) $ignored['item_id'];
}
$where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
$groupby = !$count_items ? ' GROUP BY i.id' : ' GROUP BY f.id';
// file maybe used in more than one fields or ? in more than one values for same field
$orderby = !$count_items ? ' ORDER BY i.title ASC' : '';
// Serialized values are like : "__field_propname__";s:33:"__value__"
$format_str = 'CONCAT("%%","\\"%s\\";s:%%:%%\\"",%s,"\\"%%")';
$items = array();
$files = array();
foreach ($field_props as $field_type => $field_prop) {
// Some fields may not be using DB, create a limitation for them
$field_ids = $this->getFieldsUsingDBmode($field_type);
$field_ids_list = !$field_ids ? "" : " AND fi.id IN ('" . implode("','", $field_ids) . "')";
// Create a matching condition for the value depending on given configuration (property name of the field, and value property of file: either id or filename or ...)
$value_prop = $value_props[$field_type];
$like_str = $this->_db->escape('f.' . $value_prop, false);
$like_str = sprintf($format_str, $field_prop, $like_str);
// File field relation sub query
$query = 'SELECT ' . ($count_items ? 'f.id as file_id, COUNT(i.id) as item_count' : 'i.id as id, i.title') . ' FROM #__content AS i' . ' JOIN #__flexicontent_fields_item_relations AS rel ON rel.item_id = i.id' . ' JOIN #__flexicontent_fields AS fi ON fi.id = rel.field_id AND fi.field_type IN (' . $this->_db->Quote($field_type) . ')' . $field_ids_list . ' JOIN #__flexicontent_files AS f ON rel.value LIKE ' . $like_str . ' AND f.' . $value_prop . '<>""' . $file_ids_list . $where . $groupby . $orderby;
//echo nl2br( "\n".$query."\n");
$this->_db->setQuery($query);
$_item_data = $this->_db->loadObjectList($count_items ? 'file_id' : 'id');
if ($this->_db->getErrorNum()) {
JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($this->_db->getErrorMsg()), 'error');
}
if ($_item_data) {
foreach ($_item_data as $item) {
if ($count_items) {
$items[$item->file_id] = (int) @$items[$item->file_id] + $item->item_count;
} else {
$items[$item->title] = $item;
}
}
}
//echo "<pre>"; print_r($_item_data); exit;
}
//echo "<pre>"; print_r($items); exit;
return $items;
}
示例8: gettags
/**
* Method to fetch the tags form, this is currently NOT USED
*
* @since 1.5
*/
function gettags()
{
$id = JRequest::getInt('id', 0);
$model = $this->getModel('item');
$tags = $model->gettags();
$user = JFactory::getUser();
$used = null;
if ($id) {
$used = $model->getUsedtagsIds($id);
}
if (!is_array($used)) {
$used = array();
}
$permission = FlexicontentHelperPerm::getPerm();
$CanCreateTags = $permission->CanCreateTags;
$CanUseTags = $permission->CanUseTags;
$CanUseTags = $CanUseTags ? '' : ' disabled="disabled"';
$n = count($tags);
$rsp = '';
if ($n > 0) {
$rsp .= '<div class="qf_tagbox" id="qf_tagbox">';
$rsp .= '<ul id="ultagbox">';
for ($i = 0, $n; $i < $n; $i++) {
$tag = $tags[$i];
if (!in_array($tag->id, $used)) {
continue;
}
// tag not assigned to item
if ($CanUseTags && in_array($tag->id, $used)) {
$rsp .= '
<li class="tagitem">
<span>' . $tag->name . '</span>
<input type="hidden" name="jform[tag][]" value="' . $tag->tid . '" />
<a href="javascript:;" class="deletetag" onclick="javascript:deleteTag(this);" title="' . JText::_('FLEXI_DELETE_TAG') . '"></a>
</li>';
} else {
$rsp .= '
<li class="tagitem plain">
<span>' . $tag->name . '</span>
<input type="hidden" name="jform[tag][]" value="' . $tag->tid . '" />
</li>';
}
}
$rsp .= '</ul>';
$rsp .= '</div>';
$rsp .= '<div class="clear"></div>';
}
if ($CanCreateTags) {
$rsp .= '
<div class="qf_addtag">
<label for="addtags">' . JText::_('FLEXI_ADD_TAG') . '</label>
<input type="text" id="tagname" class="inputbox" size="30" />
<input type="button" class="fc_button" value="' . JText::_('FLEXI_ADD') . '" onclick="addtag()" />
</div>';
}
echo $rsp;
}
示例9: saveorder
/**
* Logic to mass ordering fields
*
* @access public
* @return void
* @since 1.0
*/
function saveorder()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
// Get variables: model, user, field id, new ordering
$model = $this->getModel('fields');
$user = JFactory::getUser();
$cid = JRequest::getVar('cid', array(0), 'default', 'array');
$order = JRequest::getVar('order', array(0), 'post', 'array');
// calculate access
if (FLEXI_J16GE) {
$is_authorised = $user->authorise('flexicontent.orderfields', 'com_flexicontent');
} else {
if (FLEXI_ACCESS && $user->gid < 25) {
$perms = FlexicontentHelperPerm::getPerm();
$is_authorised = $perms->CanFields;
// For FLEXIAccess consider MANAGE privilege as REORDER Field privilege
} else {
// Only admin or super admin can reorder fields
$is_authorised = $user->gid >= 24;
}
}
// check access
if (!$is_authorised) {
JError::raiseWarning(403, JText::_('FLEXI_ALERTNOTAUTH'));
} else {
if (!$model->saveorder($cid, $order)) {
$msg = JText::_('FLEXI_OPERATION_FAILED');
JError::raiseWarning(500, $model->getError());
} else {
$msg = JText::_('FLEXI_NEW_ORDERING_SAVED');
}
}
$this->setRedirect('index.php?option=com_flexicontent&view=fields', $msg);
}
示例10: checkDirtyFields
function checkDirtyFields()
{
if (JRequest::getVar('task') != '' || JRequest::getVar('format') != '' || JRequest::getVar('tmpl') != '') {
return;
}
$perms = FlexicontentHelperPerm::getPerm();
if (!$perms->CanFields) {
return;
}
$db = JFactory::getDBO();
// GET fields having dirty field properties, NOTE: a dirty field property means that search index must be updated,
// even if the field was unpublished, because the field values may still exists in the search index for some items
$query = 'SELECT COUNT(*) ' . ' FROM #__flexicontent_fields' . ' WHERE (issearch=-1 || issearch=2)';
$db->setQuery($query);
$dirty_basic = $db->loadResult();
$query = 'SELECT COUNT(*) ' . ' FROM #__flexicontent_fields' . ' WHERE (isadvsearch=-1 OR isadvsearch=2 OR isadvfilter=-1 OR isadvfilter=2)';
$db->setQuery($query);
$dirty_advanced = $db->loadResult();
if ($dirty_basic) {
JError::raiseNotice(403, JText::sprintf('FLEXI_ALERT_UPDATE_BASIC_INDEX', $dirty_basic));
}
if ($dirty_advanced) {
JError::raiseNotice(403, JText::sprintf('FLEXI_ALERT_UPDATE_ADVANCED_INDEX', $dirty_advanced));
}
}
示例11: gettags
/**
* Method to fetch the tags form
*
* @since 1.5
*/
function gettags()
{
$id = JRequest::getInt('id', 0);
$model = $this->getModel('item');
$tags = $model->gettags();
$user = JFactory::getUser();
$used = null;
if ($id) {
$used = $model->getUsedtagsIds($id);
}
if (!is_array($used)) {
$used = array();
}
if (FLEXI_J16GE) {
$permission = FlexicontentHelperPerm::getPerm();
$CanNewTags = $permission->CanNewTags;
$CanUseTags = $permission->CanUseTags;
}
if (FLEXI_ACCESS) {
$CanNewTags = $user->gid < 25 ? FAccess::checkComponentAccess('com_flexicontent', 'newtags', 'users', $user->gmid) : 1;
$CanUseTags = $user->gid < 25 ? FAccess::checkComponentAccess('com_flexicontent', 'usetags', 'users', $user->gmid) : 1;
} else {
// no FLEXIAccess everybody can create / use tags
$CanNewTags = 1;
$CanUseTags = 1;
}
$CanUseTags = $CanUseTags ? '' : ' disabled="disabled"';
$n = count($tags);
$rsp = '';
if ($n > 0) {
$rsp .= '<div class="qf_tagbox">';
$rsp .= '<ul>';
for ($i = 0, $n; $i < $n; $i++) {
$tag = $tags[$i];
$rsp .= '<li><div><span class="qf_tagidbox"><input type="checkbox" name="tag[]" value="' . $tag->id . '"' . (in_array($tag->id, $used) ? 'checked="checked"' : '') . $CanUseTags . ' /></span>' . $tag->name . '</div></li>';
if ($CanUseTags && in_array($tag->id, $used)) {
$rsp .= '<input type="hidden" name="tag[]" value="' . $tag->id . '" />';
}
}
$rsp .= '</ul>';
$rsp .= '</div>';
$rsp .= '<div class="clear"></div>';
}
if ($CanNewTags) {
$rsp .= '<div class="qf_addtag">';
$rsp .= '<label for="addtags">' . JText::_('FLEXI_ADD_TAG') . '</label>';
$rsp .= '<input type="text" id="tagname" class="inputbox" size="30" />';
$rsp .= '<input type="button" class="fc_button" value="' . JText::_('FLEXI_ADD') . '" onclick="addtag()" />';
$rsp .= '</div>';
}
echo $rsp;
}
示例12: statebutton
/**
* Creates the state selector button
*
* @param int $id
* @param array $params
* @since 1.0
*/
static function statebutton($item, &$params = null, $addToggler = true)
{
// Check for empty params too
if ($params && !$params->get('show_state_icon', 1) || JRequest::getCmd('print')) {
return;
}
$user = JFactory::getUser();
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$nullDate = $db->getNullDate();
$app = JFactory::getApplication();
// Determine general archive privilege
static $has_archive = null;
if ($has_archive === null) {
$permission = FlexicontentHelperPerm::getPerm();
$has_archive = $permission->CanArchives;
}
// Determine edit state, delete privileges of the current user on the given item
$asset = 'com_content.article.' . $item->id;
$has_edit_state = $user->authorise('core.edit.state', $asset) || $user->authorise('core.edit.state.own', $asset) && $item->created_by == $user->get('id');
$has_delete = $user->authorise('core.delete', $asset) || $user->authorise('core.delete.own', $asset) && $item->created_by == $user->get('id');
// Display state toggler if it can do any of state change
$canChangeState = $has_edit_state || $has_delete || $has_archive;
static $js_and_css_added = false;
if (!$js_and_css_added && $canChangeState && $addToggler) {
// File exists both in frontend & backend (and is different), so we will use 'base' method and not 'root'
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/stateselector.js', FLEXI_VERSION);
$js = '
function fc_setitemstate(state, id)
{
var handler = new fc_statehandler({task: "' . ($app->isAdmin() ? 'items.setitemstate' : 'setitemstate') . '"});
handler.setstate( state, id );
}';
$document->addScriptDeclaration($js);
$js_and_css_added = true;
}
static $state_names = null;
static $state_descrs = null;
static $state_imgs = null;
static $tooltip_class = null;
static $state_tips = null;
static $button_classes = null;
static $icon_sep = null;
if (!$state_names) {
$state_names = array(1 => JText::_('FLEXI_PUBLISHED'), -5 => JText::_('FLEXI_IN_PROGRESS'), 0 => JText::_('FLEXI_UNPUBLISHED'), -3 => JText::_('FLEXI_PENDING'), -4 => JText::_('FLEXI_TO_WRITE'), 2 => JText::_('FLEXI_ARCHIVED'), -2 => JText::_('FLEXI_TRASHED'), '' => JText::_('FLEXI_UNKNOWN'));
$state_descrs = array(1 => JText::_('FLEXI_PUBLISH_THIS_ITEM'), -5 => JText::_('FLEXI_SET_STATE_AS_IN_PROGRESS'), 0 => JText::_('FLEXI_UNPUBLISH_THIS_ITEM'), -3 => JText::_('FLEXI_SET_STATE_AS_PENDING'), -4 => JText::_('FLEXI_SET_STATE_AS_TO_WRITE'), 2 => JText::_('FLEXI_ARCHIVE_THIS_ITEM'), -2 => JText::_('FLEXI_TRASH_THIS_ITEM'), '' => 'FLEXI_UNKNOWN');
$state_imgs = array(1 => 'tick.png', -5 => 'publish_g.png', 0 => 'publish_x.png', -3 => 'publish_r.png', -4 => 'publish_y.png', 2 => 'archive.png', -2 => 'trash.png', '' => 'unknown.png');
$tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip';
$state_tips = array();
$title_header = '';
//JText::_( 'FLEXI_ACTION' );
foreach ($state_names as $state_id => $i) {
$state_tips[$state_id] = flexicontent_html::getToolTip($title_header, $state_names[$state_id], 0);
}
$button_classes = 'fc_statebutton';
$button_classes .= FLEXI_J30GE ? ' btn btn-small' : ' fc_button fcsimple fcsmall';
$button_classes .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip';
$icon_sep = JText::_('FLEXI_ICON_SEP');
}
// Create state icon
$state = $item->state;
$state_text = '';
$tmpparams = new JRegistry();
$tmpparams->set('stateicon_popup', 'none');
$stateicon = flexicontent_html::stateicon($state, $tmpparams, $state_text);
$tz_string = JFactory::getApplication()->getCfg('offset');
$tz = new DateTimeZone($tz_string);
$tz_offset = $tz->getOffset(new JDate()) / 3600;
// Calculate common variables used to produce output
$publish_up = JFactory::getDate($item->publish_up);
$publish_down = JFactory::getDate($item->publish_down);
$publish_up->setTimezone($tz);
$publish_down->setTimezone($tz);
$img_path = JURI::root(true) . "/components/com_flexicontent/assets/images/";
// Create publish information
$publish_info = '';
if (isset($item->publish_up)) {
if ($item->publish_up == $nullDate) {
$publish_info .= JText::_('FLEXI_START_ALWAYS');
} else {
$publish_info .= JText::_('FLEXI_START') . ": " . JHTML::_('date', $publish_up->toSql(), 'Y-m-d H:i:s');
}
}
if (isset($item->publish_down)) {
if ($item->publish_down == $nullDate) {
$publish_info .= ($publish_info ? '<br/>' : '') . JText::_('FLEXI_FINISH_NO_EXPIRY');
} else {
$publish_info .= ($publish_info ? '<br/>' : '') . JText::_('FLEXI_FINISH') . ": " . JHTML::_('date', $publish_down->toSql(), 'Y-m-d H:i:s');
}
}
$publish_info = $state_text . '<br/>' . $publish_info;
// Create the state selector button and return it
if ($canChangeState && $addToggler) {
//.........这里部分代码省略.........
示例13: access
/**
* Logic to set the access level of the Fields
*
* @access public
* @return void
* @since 1.5
*/
function access()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$user = JFactory::getUser();
$model = $this->getModel('filemanager');
$task = JRequest::getVar('task');
$cid = JRequest::getVar('cid', array(0), 'default', 'array');
$file_id = (int) $cid[0];
$row = JTable::getInstance('flexicontent_files', '');
$row->load($file_id);
// calculate access
if (FLEXI_J16GE || FLEXI_ACCESS) {
$perms = FlexicontentHelperPerm::getPerm();
$is_authorised = $perms->CanFiles && ($perms->CanViewAllFiles || $user->id == $row->uploaded_by);
} else {
// Only manager/admin/super admin or uploader can change view level of file
$is_authorised = $user->gid >= 23 || $user->id == $row->uploaded_by;
}
// check access
if (!$is_authorised) {
JError::raiseNotice(403, JText::_('FLEXI_ALERTNOTAUTH'));
$this->setRedirect('index.php?option=com_flexicontent&view=filemanager', '');
return;
}
if (FLEXI_J16GE) {
$accesses = JRequest::getVar('access', array(0), 'post', 'array');
$access = $accesses[$file_id];
} else {
if ($task == 'accesspublic') {
$access = 0;
} elseif ($task == 'accessregistered') {
$access = 1;
} else {
if (FLEXI_ACCESS) {
$access = 3;
} else {
$access = 2;
}
}
}
if (!$model->saveaccess($file_id, $access)) {
$msg = JText::_('FLEXI_OPERATION_FAILED');
JError::raiseWarning(500, $model->getError());
} else {
$msg = '';
$cache = JFactory::getCache('com_flexicontent');
$cache->clean();
}
$view = JRequest::getVar('view', 'filemanager');
if ($view != 'filemanager') {
$url = $_SERVER['HTTP_REFERER'];
} else {
$url = 'index.php?option=com_flexicontent&view=filemanager';
}
$this->setRedirect($url, $msg);
}
示例14: _getItemPerms
/**
* Calculates the user permission on the given item
*
* @since 1.0
*/
function _getItemPerms(&$item)
{
$user = JFactory::getUser();
// get current user
$permission = FlexicontentHelperPerm::getPerm();
// get global perms
$model = $this->getModel();
$perms = array();
$perms['isSuperAdmin'] = $permission->SuperAdmin;
$perms['multicat'] = $permission->MultiCat;
$perms['cantags'] = $permission->CanUseTags;
$perms['canparams'] = $permission->CanParams;
$perms['cantemplates'] = $permission->CanTemplates;
$perms['canarchive'] = $permission->CanArchives;
$perms['canright'] = $permission->CanRights;
$perms['canacclvl'] = $permission->CanAccLvl;
$perms['canversion'] = $permission->CanVersion;
$perms['editcreationdate'] = $permission->EditCreationDate;
// Get general edit/publish/delete permissions (we will override these for existing items)
$perms['canedit'] = $permission->CanEdit || $permission->CanEditOwn;
$perms['canpublish'] = $permission->CanPublish || $permission->CanPublishOwn;
$perms['candelete'] = $permission->CanDelete || $permission->CanDeleteOwn;
$perms['canchange_cat'] = $permission->CanChangeCat;
$perms['canchange_seccat'] = $permission->CanChangeSecCat;
$perms['canchange_featcat'] = $permission->CanChangeFeatCat;
// OVERRIDE global with existing item's atomic settings
if ($model->get('id')) {
// the following include the "owned" checks too
$itemAccess = $model->getItemAccess();
$perms['canedit'] = $itemAccess->get('access-edit');
// includes temporary editable via session's 'rendered_uneditable'
$perms['canpublish'] = $itemAccess->get('access-edit-state');
// includes (frontend) check (and allows) if user is editing via a coupon and has 'edit.state.own'
$perms['candelete'] = $itemAccess->get('access-delete');
}
// Get can change categories ACL access
$type = $this->get('Typesselected');
if ($type->id) {
$perms['canchange_cat'] = $user->authorise('flexicontent.change.cat', 'com_flexicontent.type.' . $type->id);
$perms['canchange_seccat'] = $user->authorise('flexicontent.change.cat.sec', 'com_flexicontent.type.' . $type->id);
$perms['canchange_featcat'] = $user->authorise('flexicontent.change.cat.feat', 'com_flexicontent.type.' . $type->id);
}
return $perms;
}
示例15: setToolbar
/**
* Method to configure the toolbar for this view.
*
* @access public
* @return void
*/
function setToolbar()
{
$document = JFactory::getDocument();
$js = "jQuery(document).ready(function(){";
$toolbar = JToolBar::getInstance('toolbar');
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=basic';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-basicindex a.toolbar, #toolbar-basicindex button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'basicindex.png', 'basicindex_f2.png', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', false);
JHtml::_('behavior.modal', '#toolbar-basicindex a.toolbar, #toolbar-basicindex button');
} else {
$toolbar->appendButton('Popup', 'basicindex', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', str_replace('&', '&', $popup_load_url), 500, 240);
}
JToolBarHelper::divider();
JToolBarHelper::spacer();
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-advindex a.toolbar, #toolbar-advindex button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'advindex.png', 'advindex_f2.png', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', false);
JHtml::_('behavior.modal', '#toolbar-advindex a.toolbar, #toolbar-advindex button');
} else {
$toolbar->appendButton('Popup', 'advindex', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', str_replace('&', '&', $popup_load_url), 500, 240);
}
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced&rebuildmode=quick';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'advindexdirty.png', 'advindexdirty_f2.png', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', false);
JHtml::_('behavior.modal', '#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button');
} else {
$toolbar->appendButton('Popup', 'advindexdirty', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', str_replace('&', '&', $popup_load_url), 500, 240);
}
$toolbar->appendButton('Confirm', 'FLEXI_DELETE_INDEX_CONFIRM', 'trash', 'FLEXI_INDEX_ADVANCED_PURGE', FLEXI_J16GE ? 'search.purge' : 'purge', false);
$user = JFactory::getUser();
$perms = FlexicontentHelperPerm::getPerm();
if ($perms->CanConfig) {
JToolBarHelper::divider();
JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
$js .= "});";
$document->addScriptDeclaration($js);
}