Beispiel #1
0
	public static function _(){
		$isSaved = MRequest::getCookie("profilesissaved",0, MREQUEST_INT);
		
		if($isSaved){
			MRequest::setCookie("profilesissaved", 0);
			$css = _FM_IS_DEMO ? "rejectedAdvice" : "savedAdvice";
			$text = _FM_IS_DEMO ? "notfordemo" : "datasaved";
			echo '
				<div id="mSavedAdvice" class="'.$css.'"><div>'.MText::_($text).'</div></div>
				<script type="text/javascript">
					dojo.addOnLoad(function(){
							var node = dojo.byId("mSavedAdvice");
							dojo.style(node,{opacity: 0});
							_fx.fadeOpacity(node,300,0,1,function(){
								setTimeout(function(){
									var node = dojo.byId("mSavedAdvice");
									dojo.style(node,{opacity: 1});
									_fx.fadeOpacity(node,400,1,0,function(){
										 _removeNode(dojo.byId("mSavedAdvice"));
									});
								},2000);
							});
					});
				</script>
			';
		}
		
		
	}
Beispiel #2
0
 public static function getInstance($handler = null, $options = array())
 {
     static $now = null;
     MCacheStorage::addIncludePath(MPATH_WP_CNT . '/miwi/framework/cache/storage');
     if (!isset($handler)) {
         $conf = MFactory::getConfig();
         $handler = $conf->get('cache_handler');
         if (empty($handler)) {
             return MError::raiseWarning(500, MText::_('MLIB_CACHE_ERROR_CACHE_HANDLER_NOT_SET'));
         }
     }
     if (is_null($now)) {
         $now = time();
     }
     $options['now'] = $now;
     $handler = strtolower(preg_replace('/[^A-Z0-9_\\.-]/i', '', $handler));
     $class = 'MCacheStorage' . ucfirst($handler);
     if (!class_exists($class)) {
         mimport('joomla.filesystem.path');
         if ($path = MPath::find(MCacheStorage::addIncludePath(), strtolower($handler) . '.php')) {
             include_once $path;
         } else {
             return MError::raiseWarning(500, MText::sprintf('MLIB_CACHE_ERROR_CACHE_STORAGE_LOAD', $handler));
         }
     }
     return new $class($options);
 }
Beispiel #3
0
 public function display($tpl = null)
 {
     $document = MFactory::getDocument();
     $document->addStyleSheet(MURL_MIWOSQL . '/admin/assets/css/miwosql.css');
     // Toolbar
     MToolBarHelper::title(MText::_('MiwoSQL') . ' - ' . MText::_('COM_MIWOSQL_RUN_QUERY'), 'miwosql');
     if (MiwosqlHelper::is30()) {
         MToolBarHelper::custom('run', 'play.png', 'play.png', MText::_('COM_MIWOSQL_RUN_QUERY'), false);
         MToolBarHelper::divider();
         MToolBarHelper::custom('savequery', 'folder-close.png', 'folder-close.png', MText::_('COM_MIWOSQL_SAVE_QUERY'), false);
         MToolBarHelper::divider();
         MToolBarHelper::custom('csv', 'upload.png', 'upload.png', MText::_('COM_MIWOSQL_EXPORT_CSV'), false);
     } else {
         MToolBarHelper::custom('run', 'run.png', 'run.png', MText::_('COM_MIWOSQL_RUN_QUERY'), false);
         MToolBarHelper::divider();
         MToolBarHelper::custom('savequery', 'savequery.png', 'savequery.png', MText::_('COM_MIWOSQL_SAVE_QUERY'), false);
         MToolBarHelper::divider();
         MToolBarHelper::custom('csv', 'csv.png', 'csv.png', MText::_('COM_MIWOSQL_EXPORT_CSV'), false);
     }
     // ACL
     if (version_compare(MVERSION, '1.6.0', 'ge') && MFactory::getUser()->authorise('core.admin', 'com_miwosql')) {
         MToolBarHelper::divider();
         MToolBarHelper::preferences('com_miwosql', '550');
     }
     $this->data = $this->get('Data');
     $this->tables = $this->get('Tables');
     $this->prefix = $this->get('Prefix');
     parent::display($tpl);
 }
Beispiel #4
0
 function display($tpl = null)
 {
     $mainframe = MFactory::getApplication();
     $option = MRequest::getCmd('option');
     $document = MFactory::getDocument();
     $document->addStyleSheet(MURL_MIWOSQL . '/admin/assets/css/miwosql.css');
     MToolBarHelper::title(MText::_('MiwoSQL') . ' - ' . MText::_('COM_MIWOSQL_SAVED_QUERIES'), 'miwosql');
     MToolBarHelper::editList();
     MToolBarHelper::deleteList();
     // ACL
     if (version_compare(MVERSION, '1.6.0', 'ge') && MFactory::getUser()->authorise('core.admin', 'com_miwosql')) {
         MToolBarHelper::divider();
         MToolBarHelper::preferences('com_miwosql', '550');
     }
     $this->mainframe = MFactory::getApplication();
     $this->option = MRequest::getWord('option');
     $filter_order = $mainframe->getUserStateFromRequest($option . '.queries.filter_order', 'filter_order', 'title', 'string');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.queries.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($option . '.queries.search', 'search', '', 'string');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->lists = $lists;
     $this->items = $this->get('Data');
     $this->pagination = $this->get('Pagination');
     parent::display($tpl);
 }
Beispiel #5
0
 public static function runSqlFile($sql_file)
 {
     $db = MFactory::getDbo();
     if (!file_exists($sql_file)) {
         return;
     }
     $buffer = file_get_contents($sql_file);
     if ($buffer === false) {
         return;
     }
     $queries = $db->splitSql($buffer);
     if (count($queries) == 0) {
         return;
     }
     foreach ($queries as $query) {
         $query = trim($query);
         if ($query != '' && $query[0] != '#') {
             $db->setQuery($query);
             if (!$db->query()) {
                 MError::raiseWarning(1, 'MInstaller::install: ' . MText::_('SQL Error') . " " . $db->stderr(true));
                 return;
             }
         }
     }
 }
Beispiel #6
0
 public function _getFilePosition()
 {
     // gzipped file... unpack it first
     $position = 0;
     $info = @unpack('CCM/CFLG/VTime/CXFL/COS', substr($this->_data, $position + 2));
     if (!$info) {
         $this->set('error.message', MText::_('MLIB_FILESYSTEM_GZIP_UNABLE_TO_DECOMPRESS'));
         return false;
     }
     $position += 10;
     if ($info['FLG'] & $this->_flags['FEXTRA']) {
         $XLEN = unpack('vLength', substr($this->_data, $position + 0, 2));
         $XLEN = $XLEN['Length'];
         $position += $XLEN + 2;
     }
     if ($info['FLG'] & $this->_flags['FNAME']) {
         $filenamePos = strpos($this->_data, "", $position);
         $position = $filenamePos + 1;
     }
     if ($info['FLG'] & $this->_flags['FCOMMENT']) {
         $commentPos = strpos($this->_data, "", $position);
         $position = $commentPos + 1;
     }
     if ($info['FLG'] & $this->_flags['FHCRC']) {
         $hcrc = unpack('vCRC', substr($this->_data, $position + 0, 2));
         $hcrc = $hcrc['CRC'];
         $position += 2;
     }
     return $position;
 }
Beispiel #7
0
 protected function getOptions()
 {
     // Initialize variables.
     // This gets the connectors available in the platform and supported by the server.
     $available = MDatabase::getConnectors();
     $supported = $this->element['supported'];
     if (!empty($supported)) {
         $supported = explode(',', $supported);
         foreach ($supported as $support) {
             if (in_array($support, $available)) {
                 $options[$support] = ucfirst($support);
             }
         }
     } else {
         foreach ($available as $support) {
             $options[$support] = ucfirst($support);
         }
     }
     // This will come into play if an application is installed that requires
     // a database that is not available on the server.
     if (empty($options)) {
         $options[''] = MText::_('MNONE');
     }
     return $options;
 }
Beispiel #8
0
 protected function getOptions()
 {
     MLog::add('MFormFieldEditors is deprecated. Use MFormFieldPlugins instead (with folder="editors").', MLog::WARNING, 'deprecated');
     // Get the database object and a new query object.
     $db = MFactory::getDBO();
     $query = $db->getQuery(true);
     // Build the query.
     $query->select('element AS value, name AS text');
     $query->from('#__extensions');
     $query->where('folder = ' . $db->quote('editors'));
     $query->where('enabled = 1');
     $query->order('ordering, name');
     // Set the query and load the options.
     $db->setQuery($query);
     $options = $db->loadObjectList();
     $lang = MFactory::getLanguage();
     foreach ($options as $i => $option) {
         $lang->load('plg_editors_' . $option->value, MPATH_ADMINISTRATOR, null, false, false) || $lang->load('plg_editors_' . $option->value, MPATH_PLUGINS . '/editors/' . $option->value, null, false, false) || $lang->load('plg_editors_' . $option->value, MPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load('plg_editors_' . $option->value, MPATH_PLUGINS . '/editors/' . $option->value, $lang->getDefault(), false, false);
         $options[$i]->text = MText::_($option->text);
     }
     // Check for a database error.
     if ($db->getErrorNum()) {
         MError::raiseWarning(500, $db->getErrorMsg());
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #9
0
 protected function getOptions()
 {
     // Initialise variables
     $folder = $this->element['folder'];
     if (!empty($folder)) {
         // Get list of plugins
         $db = MFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('element AS value, name AS text');
         $query->from('#__extensions');
         $query->where('folder = ' . $db->q($folder));
         $query->where('enabled = 1');
         $query->order('ordering, name');
         $db->setQuery($query);
         $options = $db->loadObjectList();
         $lang = MFactory::getLanguage();
         foreach ($options as $i => $item) {
             $source = MPATH_PLUGINS . '/' . $folder . '/' . $item->value;
             $extension = 'plg_' . $folder . '_' . $item->value;
             $lang->load($extension . '.sys', MPATH_ADMINISTRATOR, null, false, false) || $lang->load($extension . '.sys', $source, null, false, false) || $lang->load($extension . '.sys', MPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false);
             $options[$i]->text = MText::_($item->text);
         }
         if ($db->getErrorMsg()) {
             MError::raiseWarning(500, MText::_('MFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'));
             return '';
         }
     } else {
         MError::raiseWarning(500, MText::_('MFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'));
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #10
0
 protected function getInput()
 {
     // Initialize variables.
     $html = array();
     // Initialize some field attributes.
     $class = $this->element['class'] ? ' class="checkboxes ' . (string) $this->element['class'] . '"' : ' class="checkboxes"';
     // Start the checkbox field output.
     $html[] = '<fieldset id="' . $this->id . '"' . $class . '>';
     // Get the field options.
     $options = $this->getOptions();
     // Build the checkbox field output.
     $html[] = '<ul>';
     foreach ($options as $i => $option) {
         // Initialize some option attributes.
         $checked = in_array((string) $option->value, (array) $this->value) ? ' checked="checked"' : '';
         $class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
         $disabled = !empty($option->disable) ? ' disabled="disabled"' : '';
         // Initialize some JavaScript option attributes.
         $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';
         $html[] = '<li>';
         $html[] = '<input type="checkbox" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';
         $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . MText::_($option->text) . '</label>';
         $html[] = '</li>';
     }
     $html[] = '</ul>';
     // End the checkbox field output.
     $html[] = '</fieldset>';
     return implode($html);
 }
Beispiel #11
0
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
     $value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
     $translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
     $query = (string) $this->element['query'];
     // Get the database object.
     $db = MFactory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Check for an error.
     if ($db->getErrorNum()) {
         MError::raiseWarning(500, $db->getErrorMsg());
         return $options;
     }
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = MHtml::_('select.option', $item->{$key}, MText::_($item->{$value}));
             } else {
                 $options[] = MHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #12
0
 protected function getInput()
 {
     // Initialize variables.
     $html = array();
     // Initialize some field attributes.
     $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"';
     // Start the radio field output.
     $html[] = '<fieldset id="' . $this->id . '"' . $class . '>';
     // Get the field options.
     $options = $this->getOptions();
     // Build the radio field output.
     foreach ($options as $i => $option) {
         // Initialize some option attributes.
         $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : '';
         $class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
         $disabled = !empty($option->disable) ? ' disabled="disabled"' : '';
         // Initialize some JavaScript option attributes.
         $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';
         $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';
         $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . MText::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</label>';
     }
     // End the radio field output.
     $html[] = '</fieldset>';
     return implode($html);
 }
Beispiel #13
0
 protected function getLabel()
 {
     $html = array();
     $class = $this->element['class'] ? (string) $this->element['class'] : '';
     $html[] = '<span class="spacer">';
     $html[] = '<span class="before"></span>';
     $html[] = '<span class="' . $class . '">';
     if ((string) $this->element['hr'] == 'true') {
         $html[] = '<hr class="' . $class . '" />';
     } else {
         $label = '';
         // Get the label text from the XML element, defaulting to the element name.
         $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
         $text = $this->translateLabel ? MText::_($text) : $text;
         // Build the class for the label.
         $class = !empty($this->description) ? 'hasTip' : '';
         $class = $this->required == true ? $class . ' required' : $class;
         // Add the opening label tag and main attributes attributes.
         $label .= '<label id="' . $this->id . '-lbl" class="' . $class . '"';
         // If a description is specified, use it to build a tooltip.
         if (!empty($this->description)) {
             $label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . ($this->translateDescription ? MText::_($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"';
         }
         // Add the label text and closing tag.
         $label .= '>' . $text . '</label>';
         $html[] = $label;
     }
     $html[] = '</span>';
     $html[] = '<span class="after"></span>';
     $html[] = '</span>';
     return implode('', $html);
 }
Beispiel #14
0
 protected function _getCommand($ref, $com, $override, $component)
 {
     // Get Help URL
     mimport('framework.language.help');
     $url = MHelp::createURL($ref, $com, $override, $component);
     $url = htmlspecialchars($url, ENT_QUOTES);
     $cmd = "Miwi.popupWindow('{$url}', '" . MText::_('MHELP', true) . "', 700, 500, 1)";
     return $cmd;
 }
Beispiel #15
0
 public static function cloak($mail, $mailto = true, $text = '', $email = true)
 {
     // Convert text
     $mail = self::_convertEncoding($mail);
     // Split email by @ symbol
     $mail = explode('@', $mail);
     $mail_parts = explode('.', $mail[1]);
     // Random number
     $rand = rand(1, 100000);
     $replacement = "<script type='text/javascript'>";
     $replacement .= "\n <!--";
     $replacement .= "\n var prefix = '&#109;a' + 'i&#108;' + '&#116;o';";
     $replacement .= "\n var path = 'hr' + 'ef' + '=';";
     $replacement .= "\n var addy" . $rand . " = '" . @$mail[0] . "' + '&#64;';";
     $replacement .= "\n addy" . $rand . " = addy" . $rand . " + '" . implode("' + '&#46;' + '", $mail_parts) . "';";
     if ($mailto) {
         // Special handling when mail text is different from mail address
         if ($text) {
             if ($email) {
                 // Convert text
                 $text = self::_convertEncoding($text);
                 // Split email by @ symbol
                 $text = explode('@', $text);
                 $text_parts = explode('.', $text[1]);
                 $replacement .= "\n var addy_text" . $rand . " = '" . @$text[0] . "' + '&#64;' + '" . implode("' + '&#46;' + '", @$text_parts) . "';";
             } else {
                 $replacement .= "\n var addy_text" . $rand . " = '" . $text . "';";
             }
             $replacement .= "\n document.write('<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>');";
             $replacement .= "\n document.write(addy_text" . $rand . ");";
             $replacement .= "\n document.write('<\\/a>');";
         } else {
             $replacement .= "\n document.write('<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>');";
             $replacement .= "\n document.write(addy" . $rand . ");";
             $replacement .= "\n document.write('<\\/a>');";
         }
     } else {
         $replacement .= "\n document.write(addy" . $rand . ");";
     }
     $replacement .= "\n //-->";
     $replacement .= '\\n </script>';
     // XHTML compliance no Javascript text handling
     $replacement .= "<script type='text/javascript'>";
     $replacement .= "\n <!--";
     $replacement .= "\n document.write('<span style=\\'display: none;\\'>');";
     $replacement .= "\n //-->";
     $replacement .= "\n </script>";
     $replacement .= MText::_('MLIB_HTML_CLOAKING');
     $replacement .= "\n <script type='text/javascript'>";
     $replacement .= "\n <!--";
     $replacement .= "\n document.write('</');";
     $replacement .= "\n document.write('span>');";
     $replacement .= "\n //-->";
     $replacement .= "\n </script>";
     return $replacement;
 }
Beispiel #16
0
 public function __construct($name = '', $text = 'default', $size = 0, $fColor = array(0, 0, 0), $bColor = array(255, 255, 255), $ttfFont = 'arial', $bold = false)
 {
     parent::__construct($name, $text, '', $color, NULL, $bold);
     $this->ttfFont = $ttfFont;
     $this->size = $size;
     $this->foreColor = $fColor;
     $this->backColor = $bColor;
     $this->manager->conf->loadConf('', $this->manager->getConf('home.classes') . '/etc/gdtext.xml');
     $this->key = $this->manager->getConf("gdtext.key");
 }
Beispiel #17
0
 public static function user($noUser = true)
 {
     $optionNo = '';
     if ($noUser) {
         $optionNo = '<option value="0">' . MText::_('MLIB_HTML_BATCH_USER_NOUSER') . '</option>';
     }
     // Create the batch selector to select a user on a selection list.
     $lines = array('<label id="batch-user-lbl" for="batch-user" class="hasTip"' . ' title="' . MText::_('MLIB_HTML_BATCH_USER_LABEL') . '::' . MText::_('MLIB_HTML_BATCH_USER_LABEL_DESC') . '">', MText::_('MLIB_HTML_BATCH_USER_LABEL'), '</label>', '<select name="batch[user_id]" class="inputbox" id="batch-user-id">', '<option value="">' . MText::_('MLIB_HTML_BATCH_USER_NOCHANGE') . '</option>', $optionNo, MHtml::_('select.options', MHtml::_('user.userlist'), 'value', 'text'), '</select>');
     return implode("\n", $lines);
 }
Beispiel #18
0
 public function fetchButton($type = 'Link', $name = 'back', $text = '', $url = null)
 {
     $text = MText::_($text);
     $class = $this->fetchIconClass($name);
     $doTask = $this->_getCommand($url);
     $html = "<a class=\"add-new-h2\" href=\"{$doTask}\">\n";
     $html .= "{$text}\n";
     $html .= "</a>\n";
     return $html;
 }
Beispiel #19
0
 public function extract($archive, $destination, $options = array())
 {
     // Initialise variables.
     $this->_data = null;
     if (!extension_loaded('bz2')) {
         $this->set('error.message', MText::_('MLIB_FILESYSTEM_BZIP_NOT_SUPPORTED'));
         return MError::raiseWarning(100, $this->get('error.message'));
     }
     if (!isset($options['use_streams']) || $options['use_streams'] == false) {
         // Old style: read the whole file and then parse it
         if (!($this->_data = MFile::read($archive))) {
             $this->set('error.message', 'Unable to read archive');
             return MError::raiseWarning(100, $this->get('error.message'));
         }
         $buffer = bzdecompress($this->_data);
         unset($this->_data);
         if (empty($buffer)) {
             $this->set('error.message', 'Unable to decompress data');
             return MError::raiseWarning(100, $this->get('error.message'));
         }
         if (MFile::write($destination, $buffer) === false) {
             $this->set('error.message', 'Unable to write archive');
             return MError::raiseWarning(100, $this->get('error.message'));
         }
     } else {
         // New style! streams!
         $input = MFactory::getStream();
         $input->set('processingmethod', 'bz');
         // use bzip
         if (!$input->open($archive)) {
             $this->set('error.message', MText::_('MLIB_FILESYSTEM_BZIP_UNABLE_TO_READ'));
             return MError::raiseWarning(100, $this->get('error.message'));
         }
         $output = MFactory::getStream();
         if (!$output->open($destination, 'w')) {
             $this->set('error.message', MText::_('MLIB_FILESYSTEM_BZIP_UNABLE_TO_WRITE'));
             $input->close();
             // close the previous file
             return MError::raiseWarning(100, $this->get('error.message'));
         }
         do {
             $this->_data = $input->read($input->get('chunksize', 8196));
             if ($this->_data) {
                 if (!$output->write($this->_data)) {
                     $this->set('error.message', MText::_('MLIB_FILESYSTEM_BZIP_UNABLE_TO_WRITE_FILE'));
                     return MError::raiseWarning(100, $this->get('error.message'));
                 }
             }
         } while ($this->_data);
         $output->close();
         $input->close();
     }
     return true;
 }
Beispiel #20
0
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Convert to name => name array.
     foreach (MCache::getStores() as $store) {
         $options[] = MHtml::_('select.option', $store, MText::_('MLIB_FORM_VALUE_CACHE_' . $store), 'value', 'text');
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #21
0
 public function display($tpl = null)
 {
     $document = MFactory::getDocument();
     $document->addStyleSheet(MURL_MIWOSQL . '/admin/assets/css/miwosql.css');
     // Toolbar
     MToolBarHelper::title(MText::_('MiwoSQL'), 'miwosql');
     MToolBarHelper::save();
     MToolBarHelper::cancel();
     $this->row = $this->get('QueryData');
     parent::display($tpl);
 }
Beispiel #22
0
 protected function getOptions()
 {
     // Initialise variables.
     $options = array();
     $extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $this->element['scope'];
     $published = (string) $this->element['published'];
     $name = (string) $this->element['name'];
     // Load the category options for a given extension.
     if (!empty($extension)) {
         // Filter over published state or not depending upon if it is present.
         if ($published) {
             $options = MHtml::_('category.options', $extension, array('filter.published' => explode(',', $published)));
         } else {
             $options = MHtml::_('category.options', $extension);
         }
         // Verify permissions.  If the action attribute is set, then we scan the options.
         if ((string) $this->element['action']) {
             // Get the current user object.
             $user = MFactory::getUser();
             // For new items we want a list of categories you are allowed to create in.
             if (!$this->form->getValue($name)) {
                 foreach ($options as $i => $option) {
                     // To take save or create in a category you need to have create rights for that category
                     // unless the item is already in that category.
                     // Unset the option if the user isn't authorised for it. In this field assets are always categories.
                     if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true) {
                         unset($options[$i]);
                     }
                 }
             } else {
                 $categoryOld = $this->form->getValue($name);
                 foreach ($options as $i => $option) {
                     // If you are only allowed to edit in this category but not edit.state, you should not get any
                     // option to change the category.
                     if ($user->authorise('core.edit.state', $extension . '.category.' . $categoryOld) != true) {
                         if ($option->value != $categoryOld) {
                             unset($options[$i]);
                         }
                     } elseif ($user->authorise('core.create', $extension . '.category.' . $option->value) != true && $option->value != $categoryOld) {
                         unset($options[$i]);
                     }
                 }
             }
         }
         if (isset($this->element['show_root'])) {
             array_unshift($options, MHtml::_('select.option', '0', MText::_('MGLOBAL_ROOT')));
         }
     } else {
         MError::raiseWarning(500, MText::_('MLIB_FORM_ERROR_FIELDS_CATEGORY_ERROR_EXTENSION_EMPTY'));
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #23
0
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Get the options from MSession.
     foreach (MSession::getStores() as $store) {
         $options[] = MHtml::_('select.option', $store, MText::_('MLIB_FORM_VALUE_SESSION_' . $store), 'value', 'text');
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #24
0
 protected function _getCommand($msg, $name, $task, $list)
 {
     MHtml::_('behavior.framework');
     $message = MText::_('MLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
     $message = addslashes($message);
     if ($list) {
         $cmd = "if (document.adminForm.boxchecked.value==0){alert('{$message}');}else{if (confirm('{$msg}')){Miwi.submitbutton('{$task}');}}";
     } else {
         $cmd = "if (confirm('{$msg}')){Miwi.submitbutton('{$task}');}";
     }
     return $cmd;
 }
Beispiel #25
0
 public function _default()
 {
     if (_FM_IS_DEMO) {
         return $this->view->add2Content('<div style="display:block; padding: 10px; font-size: 16px; font-weight: bold;">' . MText::_("notfordemo") . '</div>');
     }
     $this->includeLanguage();
     MDiagHelper::start();
     $this->view->add2Menu("");
     $this->view->add2Content(MDiagHelper::generate());
     MDiagHelper::save();
     // 		$this->view->addPreToContent(MDiagHelper::getTests());
 }
Beispiel #26
0
 public function delete()
 {
     // Check for request forgeries
     //MRequest::checkToken() or mexit('Invalid Token');
     if ($this->_model->delete($this->_table)) {
         $msg = MText::_('COM_MIWOSQL_DELETE_TRUE');
     } else {
         $msg = MText::_('COM_MIWOSQL_DELETE_FALSE');
     }
     $vars = 'ja_tbl_g=' . base64_encode($this->_table) . '&ja_qry_g=' . base64_encode($this->_query);
     $this->setRedirect('index.php?option=com_miwosql&' . $vars, $msg);
 }
Beispiel #27
0
 protected function authAndDie($rule = null)
 {
     $rule = trim($rule);
     if (!$rule || !MRights::can($rule)) {
         $errorText = $rule !== null ? MText::_("rights_noauth_" . $rule) : MText::_("noauth");
         $goBackUrl = MURL::_();
         ob_start();
         include _FM_HOME_FOLDER . DS . "templates" . DS . "noaccess.php";
         $dieOut = ob_get_clean();
         ob_get_clean();
         die($dieOut);
     }
 }
Beispiel #28
0
 public function register($event, $handler)
 {
     // Are we dealing with a class or function type handler?
     if (function_exists($handler)) {
         // Ok, function type event handler... let's attach it.
         $method = array('event' => $event, 'handler' => $handler);
         $this->attach($method);
     } elseif (class_exists($handler)) {
         // Ok, class type event handler... let's instantiate and attach it.
         $this->attach(new $handler($this));
     } else {
         return MError::raiseWarning('SOME_ERROR_CODE', MText::sprintf('MLIB_EVENT_ERROR_DISPATCHER', $handler));
     }
 }
Beispiel #29
0
 public function save()
 {
     // Check for request forgeries
     MRequest::checkToken() or jexit('Invalid Token');
     $post = MRequest::get('post');
     $post['query'] = base64_encode(MRequest::getVar('ja_query', '', 'post', 'string', MREQUEST_ALLOWRAW));
     unset($post['ja_query']);
     if ($this->_model->saveQuery($post)) {
         $msg = MText::_('COM_MIWOSQL_SAVE_TRUE');
     } else {
         $msg = MText::_('COM_MIWOSQL_SAVE_FALSE');
     }
     $this->setRedirect('index.php?option=com_miwosql&controller=queries', $msg);
 }
Beispiel #30
0
 public function test(&$element, $value, $group = null, &$input = null, &$form = null)
 {
     // Check for a valid regex.
     if (empty($this->regex)) {
         throw new MException(MText::sprintf('MLIB_FORM_INVALID_FORM_RULE', get_class($this)));
     }
     // Add unicode property support if available.
     if (MCOMPAT_UNICODE_PROPERTIES) {
         $this->modifiers = strpos($this->modifiers, 'u') !== false ? $this->modifiers : $this->modifiers . 'u';
     }
     // Test the value against the regular expression.
     if (preg_match(chr(1) . $this->regex . chr(1) . $this->modifiers, $value)) {
         return true;
     }
     return false;
 }