Example #1
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     // Get project id.
     $this->projectId = $this->input->getUint('pid');
     // Prepare log object
     $registry = Joomla\Registry\Registry::getInstance('com_crowdfunding');
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get('logger.file');
     $tableName = $registry->get('logger.table');
     $file = JPath::clean($this->app->get('log_path') . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new Prism\Log\Log();
     $this->log->addAdapter(new Prism\Log\Adapter\Database(JFactory::getDbo(), $tableName));
     $this->log->addAdapter(new Prism\Log\Adapter\File($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $this->app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = JString::trim(JString::strtolower($this->input->getCmd('payment_service')));
     $paymentService = $filter->clean($paymentService, 'ALNUM');
     $this->context = JString::strlen($paymentService) > 0 ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams('com_crowdfunding');
 }
Example #2
0
 /**
  * Parse CBR XML
  * TODO: Sometimes SimpleXML doesn't work, so we used preg_matches
  * @param null $currency
  * @return array|void
  */
 public function _loadData($currency = null)
 {
     if (is_null($this->_curList)) {
         $this->_curList = array();
         $params = array();
         if ((int) $this->config->get('force_date', 1)) {
             $params['date_req'] = date("d/m/Y");
         }
         $xmlString = $this->_loadUrl($this->_apiUrl, $params);
         if (empty($xmlString)) {
             $xmlString = $this->app->jbhttp->url($this->_apiUrl, $params);
             // anti ban
         }
         if (empty($xmlString)) {
             return $this->_curList;
         }
         $xmlString = JString::trim(iconv("WINDOWS-1251", "UTF-8//TRANSLIT", $xmlString));
         preg_match_all('#<Valute(.*?)<\\/Valute>#ius', $xmlString, $out);
         if (!empty($out) && isset($out[1])) {
             foreach ($out[1] as $row) {
                 preg_match("#<Value>(.*?)</Value>#ius", $row, $value);
                 preg_match("#<CharCode>(.*?)</CharCode>#ius", $row, $code);
                 preg_match("#<Nominal>(.*?)</Nominal>#ius", $row, $nominal);
                 $value = $this->_jbmoney->clearValue($value[1]);
                 $nominal = trim(strtolower($nominal[1]));
                 $code = trim(strtolower($code[1]));
                 $this->_curList[$code] = $value / $nominal;
             }
             $this->_curList['rub'] = 1;
         }
         $this->_curList = $this->_normToDefault($this->_curList);
     }
     return $this->_curList;
 }
Example #3
0
 /**
  * @param array $params
  * @return array|mixed|null|string
  */
 public function render($params = array())
 {
     if (!$this->hasValue($params)) {
         return $this->renderWrapper();
     }
     $prices = $this->getPrices();
     $discount = JBCart::val();
     $curList = $discount->getCurList();
     if ($prices['save']->isNegative()) {
         $discount->set($prices['save']->val(), $prices['save']->cur());
     }
     /** @type JBCartValue $total */
     $total = $prices['total'];
     $message = JText::_(JString::trim($params->get('empty_text', '')));
     $layout = $params->get('layout', 'full-div');
     if ($total->isEmpty() && !empty($message)) {
         $layout = 'empty';
     }
     if ($layout == 'totla-cur' && isset($curList[$total->cur()])) {
         unset($curList[$total->cur()]);
     }
     unset($curList[JBCartValue::DEFAULT_CODE]);
     if ($layout = $this->getLayout($layout . '.php')) {
         return $this->renderLayout($layout, array('total' => $total, 'price' => $prices['price'], 'save' => $prices['save']->abs(true), 'discount' => $discount->abs(), 'currency' => $this->currency(), 'curList' => $curList, 'message' => $message));
     }
     return null;
 }
Example #4
0
 public function display($tpl = null)
 {
     // Initialise variables
     $mainframe = JFactory::getApplication();
     $tagId = JRequest::getVar('tagid', '');
     $tag = JTable::getInstance('Tags', 'Discuss');
     $tag->load($tagId);
     $tag->title = JString::trim($tag->title);
     $tag->alias = JString::trim($tag->alias);
     $this->tag = $tag;
     // Generate All tags for merging selections
     $tagsModel = $this->getModel('Tags');
     $tags = $tagsModel->getData(false);
     $tagList = array();
     array_push($tagList, JHTML::_('select.option', 0, 'Select tag', 'value', 'text', false));
     if (!empty($tags)) {
         foreach ($tags as $item) {
             if ($item->id != $tagId) {
                 $tagList[] = JHtml::_('select.option', $item->id, $item->title);
             }
         }
     }
     // Set default values for new entries.
     if (empty($tag->created)) {
         $date = DiscussHelper::getDate();
         $date->setOffSet($mainframe->getCfg('offset'));
         $tag->created = $date->toFormat();
         $tag->published = true;
     }
     $this->assignRef('tag', $tag);
     $this->assignRef('tagList', $tagList);
     parent::display($tpl);
 }
Example #5
0
 function check()
 {
     //initialize
     $this->_error = null;
     $this->oldurl = JString::trim($this->oldurl);
     $this->newurl = JString::trim($this->newurl);
     // check for valid URLs
     if ($this->oldurl == '' || $this->newurl == '') {
         $this->_error .= JTExt::_('COM_SH404SEF_EMPTYURL');
         return false;
     }
     if (JString::substr($this->oldurl, 0, 1) == '/') {
         $this->_error .= JText::_('COM_SH404SEF_NOLEADSLASH');
     }
     if (JString::substr($this->newurl, 0, 9) != 'index.php') {
         $this->_error .= JText::_('COM_SH404SEF_BADURL');
     }
     // V 1.2.4.t remove this check. We check for pre-existing non-sef instead of SEF
     if (is_null($this->_error)) {
         // check for existing URLS
         $this->_db->setQuery("SELECT id,oldurl FROM #__sh404sef_urls WHERE `newurl` LIKE " . $this->_db->Quote($this->newurl));
         $xid = $this->_db->loadObject();
         // V 1.3.1 don't raise error if both newurl and old url are same. It means we may have changed alias list
         if ($xid && $xid->id != intval($this->id)) {
             $this->_error = JText::_('COM_SH404SEF_URLEXIST');
             return false;
         }
         $identical = $xid->id == intval($this->id) && $xid->oldurl == $this->oldurl;
         return $identical ? 'identical' : true;
     } else {
         return false;
     }
 }
Example #6
0
 function check()
 {
     //initialize
     $this->_error = null;
     $this->newurl = JString::trim($this->newurl);
     $this->metadesc = JString::trim($this->metadesc);
     $this->metakey = JString::trim($this->metakey);
     $this->metatitle = JString::trim($this->metatitle);
     $this->metalang = JString::trim($this->metalang);
     $this->metarobots = JString::trim($this->metarobots);
     // check for valid URLs
     if ($this->newurl == '') {
         $this->_error .= COM_SH404SEF_EMPTYURL;
         return false;
     }
     if (substr($this->newurl, 0, 9) != 'index.php') {
         $this->_error .= COM_SH404SEF_BADURL;
     }
     if (is_null($this->_error)) {
         // check for existing URLS
         $this->_db->setQuery("SELECT id FROM #__sh404SEF_meta WHERE `newurl` LIKE " . $this->_db->Quote($this->newurl));
         $xid = intval($this->_db->loadResult());
         if ($xid && $xid != intval($this->id)) {
             $this->_error = COM_SH404SEF_URLEXIST;
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
Example #7
0
 public function check()
 {
     //initialize
     $this->oldurl = JString::trim($this->oldurl);
     $this->newurl = JString::trim($this->newurl);
     // check for valid URLs
     if ($this->oldurl == '' || $this->newurl == '') {
         $this->setError(COM_SH404SEF_EMPTYURL);
         return false;
     }
     if (JString::substr($this->oldurl, 0, 1) == '/') {
         $this->setError(COM_SH404SEF_NOLEADSLASH);
         return false;
     }
     if (JString::substr($this->newurl, 0, 9) != 'index.php') {
         $this->setError(COM_SH404SEF_BADURL);
         return false;
     }
     // check for pre-existing non-sef
     $this->_db->setQuery('SELECT id, oldurl FROM #__redirection WHERE `newurl` LIKE ' . $this->_db->Quote($this->newurl));
     $xid = $this->_db->loadObject();
     // raise error if we found a record with the same non-sef url
     // but don't if both newurl and old url are same. It means we may have changed alias list
     if ($xid && $xid->id != intval($this->id)) {
         $this->setError(COM_SH404SEF_URLEXIST);
         return false;
     }
     return true;
 }
Example #8
0
 private function setQueryConditions(&$query)
 {
     $db = $this->getDBO();
     if (is_numeric($this->getState('state'))) {
         $query->where($db->quoteName('extraField.state') . ' = ' . (int) $this->getState('state'));
     }
     if ($this->getState('id')) {
         $id = $this->getState('id');
         if (is_array($id)) {
             JArrayHelper::toInteger($id);
             $query->where($db->quoteName('extraField.id') . ' IN ' . $id);
         } else {
             $query->where($db->quoteName('extraField.id') . ' = ' . (int) $id);
         }
     }
     if ($this->getState('group')) {
         $query->where($db->quoteName('extraField.group') . ' = ' . (int) $this->getState('group'));
     }
     if ($this->getState('type')) {
         $query->where($db->quoteName('extraField.type') . ' = ' . $db->quote($this->getState('type')));
     }
     if ($this->getState('search')) {
         $search = JString::trim($this->getState('search'));
         $search = JString::strtolower($search);
         if ($search) {
             $search = $db->escape($search, true);
             $query->where('( LOWER(' . $db->quoteName('extraField.name') . ') LIKE ' . $db->Quote('%' . $search . '%', false) . ' 
	OR ' . $db->quoteName('extraField.id') . ' = ' . (int) $search . ')');
         }
     }
 }
Example #9
0
 function check()
 {
     // Check name
     $this->name = JString::trim($this->name);
     if (empty($this->name)) {
         $this->setError(JText::_('NOTICE_MISSING_NAME'));
         return false;
     }
     // Check html
     $this->htmltext = trim($this->htmltext);
     $this->htmlsmall = trim($this->htmlsmall);
     $this->htmllarge = trim($this->htmllarge);
     $this->htmlbutton = trim($this->htmlbutton);
     $this->htmlcustom = trim($this->htmlcustom);
     $defSize = 'html' . $this->size;
     if (empty($this->{$defSize})) {
         $this->setError(JText::_('NOTICE_MISSING_HTML'));
         return false;
     }
     $this->popular = $this->popular ? 1 : 0;
     $this->text = JString::trim($this->text);
     if (empty($this->text)) {
         $this->text = $this->name;
     }
     return true;
 }
Example #10
0
 function changepassword()
 {
     $mainframe = JFactory::getApplication();
     $return = JRequest::getVar('return', 0);
     $return = base64_decode($return);
     $user_data = $_POST;
     if ($user_data['password'] == $user_data['password2']) {
         $user = JFactory::getUser();
         $salt = JUserHelper::genRandomPassword(32);
         $crypt = JUserHelper::getCryptedPassword(JString::trim($user_data['password']), $salt);
         $password = $crypt . ':' . $salt;
         $user->set('password', $password);
         if ($user->save()) {
             $mainframe->enqueueMessage(JText::_('Successfully saved'), 'message');
         }
     } else {
         JError::raiseWarning('', JText::_(' Passwords do not match. Please re-enter password.'));
     }
     $config = JBFactory::getConfig();
     if ($return) {
         $this->setRedirect($return);
     } else {
         $this->setRedirect('index.php?option=com_bookpro&view=account&form=password&Itemid=' . JRequest::getVar('Itemid'));
     }
 }
Example #11
0
 /**
  * Constructor
  */
 public function __construct()
 {
     try {
         /* get template assigned */
         $this->_template = JSNTemplateModel::getDefaultTemplate();
         /* get template mainfet*/
         $client = JApplicationHelper::getClientInfo($this->_template->client_id);
         @($this->_template->xml = new SimpleXMLElement($client->path . '/templates/' . $this->_template->element . '/templateDetails.xml', null, true));
         /* get author template */
         $author = JString::trim(JString::strtolower($this->_template->xml->author));
         if (!$author) {
             $author = JString::trim(JString::strtolower($this->_template->xml->authorEmail));
             if ($author) {
                 @(list($eName, $eHost) = explode('@', $author));
                 @(list($this->_author, $dotCom) = explode('.', $author));
             }
         } else {
             @(list($this->_author, $dotCom) = explode('.', $author));
         }
         if (empty($this->_author)) {
             $this->_author = 'default';
         }
         switch ($this->_author) {
             case 'joomagic':
                 // An template using T3 Framework
                 $this->_author = 'joomlart';
                 break;
         }
     } catch (Exception $e) {
         throw new Exception(JText::_('JSN_EXTFW_NOTICE_SITE_TEMPLATE_NOT_SET'));
     }
 }
Example #12
0
 /**
  * @return null|string
  */
 public function getRedirectUrl()
 {
     if ($url = JString::trim($this->config->get('redirect_url'))) {
         return $url;
     }
     return null;
 }
Example #13
0
 public function check()
 {
     if (JString::trim($this->name) == '') {
         $this->setError(JText::_('K2_TAG_MUST_HAVE_A_NAME'));
         return false;
     }
     $this->normalize();
     $this->alias = $this->name;
     if (JFactory::getConfig()->get('unicodeslugs') == 1) {
         $this->alias = JFilterOutput::stringURLUnicodeSlug($this->alias);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select($db->quoteName('id'))->from($db->quoteName('#__k2_tags'))->where($db->quoteName('alias') . ' = ' . $db->quote($this->alias));
     if ($this->id) {
         $query->where($db->quoteName('id') . ' != ' . (int) $this->id);
     }
     $db->setQuery($query);
     if ($db->loadResult()) {
         $this->alias .= '-' . uniqid();
     }
     return true;
 }
Example #14
0
 function getCategoriesTree()
 {
     $db = JFactory::getDBO();
     $this->setState('published', -1);
     $this->setState('trash', -1);
     $this->setState('ordering', 'category.parent, category.ordering');
     $this->setState('orderingDir', '');
     $rows = $this->getData();
     $children = array();
     if ($rows) {
         foreach ($rows as $row) {
             $row->title = $row->name;
             $row->parent_id = $row->parent;
             $index = $row->parent;
             $list = @$children[$index] ? $children[$index] : array();
             array_push($list, $row);
             $children[$index] = $list;
         }
     }
     $categories = JHTML::_('menu.treerecurse', isset($rows[0]->parent) ? $rows[0]->parent : 0, '', array(), $children, 9999, 0, 0);
     foreach ($categories as $category) {
         $category->treename = JString::trim($category->treename);
         $category->treename = JString::str_ireplace('&#160;&#160;', '- ', $category->treename);
         $category->treename = JString::str_ireplace('- ', ' ', $category->treename, 1);
     }
     return $categories;
 }
Example #15
0
 function getEventcategoryHTML($name, $value, $control_name = 'params', $reqnone = false, $reqall = false)
 {
     $required = '1';
     $html = '';
     $class = $required == 1 ? ' required' : '';
     $options = $this->getEventcategory();
     $html .= '<select id="' . $control_name . '[' . $name . ']" name="' . $control_name . '[' . $name . ']" title="' . "Select Group Category" . '">';
     if ($reqall) {
         $selected = JString::trim(0) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . 0 . '"' . $selected . '>' . XiptText::_("ALL") . '</option>';
     }
     if ($reqnone) {
         $selected = JString::trim(-1) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . -1 . '"' . $selected . '>' . XiptText::_("NONE") . '</option>';
     }
     foreach ($options as $op) {
         $option = $op->name;
         $id = $op->id;
         $selected = JString::trim($id) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . $id . '"' . $selected . '>' . $option . '</option>';
     }
     $html .= '</select>';
     $html .= '<span id="errprofiletypemsg" style="display: none;">&nbsp;</span>';
     return $html;
 }
Example #16
0
 /**
  * Validate a date.
  *
  * <code>
  * $date = "01-01-2020";
  *
  * $validator = new Prism\Validator\Date($date);
  *
  * if (!$validator->isValid()) {
  * ...
  * }
  *
  * </code>
  *
  * @return bool
  */
 public function isValid()
 {
     $string = \JString::trim($this->date);
     if ($string === '') {
         return false;
     }
     if (is_numeric($string)) {
         $string = (int) $string;
         if ($string === 0) {
             return false;
         }
         $string = '@' . $string;
     }
     try {
         $date = new \DateTime($string);
     } catch (\Exception $e) {
         return false;
     }
     $month = $date->format('m');
     $day = $date->format('d');
     $year = $date->format('Y');
     if (checkdate($month, $day, $year)) {
         return true;
     } else {
         return false;
     }
 }
Example #17
0
 /**
  * More CSS compressing!! =)
  * @param string $code
  * @return string
  */
 protected function _minify($code)
 {
     $code = (string) $code;
     // remove comments
     $code = preg_replace('#/\\*[^*]*\\*+([^/][^*]*\\*+)*/#ius', '', $code);
     // remove tabs, spaces, newlines, etc.
     $code = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $code);
     $code = str_replace(' {', '{', $code);
     // spaces
     $code = str_replace('{ ', '{', $code);
     // spaces
     $code = str_replace(' }', '}', $code);
     // spaces
     $code = str_replace('; ', ';', $code);
     // spaces
     $code = str_replace(';;', ';', $code);
     // typos
     $code = str_replace(';}', '}', $code);
     // last ";"
     // remove space after colons
     $code = preg_replace('#([a-z])(:\\s)#ius', '$1:', $code);
     // spaces before "!important"
     $code = preg_replace('#(\\s\\!important)#ius', '!important', $code);
     // trim
     $code = JString::trim($code);
     return $code;
 }
 /**
  * Prepare value
  * @param array|string $value
  * @param bool $exact
  * @return array|mixed
  */
 protected function _prepareValue($value, $exact = false)
 {
     $value = parent::_prepareValue($value);
     $values = array();
     if (!empty($value['range-date']) || !empty($value['range'])) {
         $value = array($value);
     }
     foreach ($value as $val) {
         if ($this->_isDate($val)) {
             $tmp = $val['range-date'];
         } elseif (is_string($val) && strpos($val, '/')) {
             $tmp = explode('/', $val);
         } else {
             if (is_string($val['range']) && strpos($val['range'], '/')) {
                 $tmp = explode('/', $val['range']);
             } else {
                 $tmp = $val['range'];
             }
         }
         if ($this->_isDate($val)) {
             $values[] = array($this->app->jbdate->toMysql($tmp[0]), $this->app->jbdate->toMysql($tmp[1]));
         } else {
             $values[] = array(JString::trim($tmp[0]), JString::trim($tmp[1]));
         }
     }
     return $values;
 }
Example #19
0
 public function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (DiscussHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('discuss.manage.tags', 'com_easydiscuss')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     // Initialise variables
     $mainframe = JFactory::getApplication();
     $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.tags.filter_state', 'filter_state', '*', 'word');
     $search = $mainframe->getUserStateFromRequest('com_easydiscuss.tags.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     $order = $mainframe->getUserStateFromRequest('com_easydiscuss.tags.filter_order', 'filter_order', 'id', 'cmd');
     $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.tags.filter_order_Dir', 'filter_order_Dir', '', 'word');
     // Get data from the model
     $tags = $this->get('Data');
     $model = $this->getModel('tags');
     for ($i = 0; $i < count($tags); $i++) {
         $tag = $tags[$i];
         $tag->count = $model->getUsedCount($tag->id);
         $tag->title = JString::trim($tag->title);
         $tag->alias = JString::trim($tag->alias);
     }
     $pagination = $this->get('Pagination');
     $this->assignRef('tags', $tags);
     $this->assignRef('pagination', $pagination);
     $this->assign('state', JHTML::_('grid.state', $filter_state));
     $this->assign('search', $search);
     $this->assign('order', $order);
     $this->assign('orderDirection', $orderDirection);
     parent::display($tpl);
 }
Example #20
0
 /**
  * Inject data from paramter to content tags ({}) .
  *
  * @param	$content	Original content with content tags.
  * @param	$params	Text contain all values need to be replaced.
  * @param	$html	Auto detect url tag and insert inline.
  * @return	$text	The content after replacing.
  **/
 public static function injectTags($content, $paramsTxt, $html = false)
 {
     $params = new CParameter($paramsTxt);
     preg_match_all("/{(.*?)}/", $content, $matches, PREG_SET_ORDER);
     if (!empty($matches)) {
         foreach ($matches as $val) {
             $replaceWith = JString::trim($params->get($val[1], null));
             if (!is_null($replaceWith)) {
                 //if the replacement start with 'index.php', we can CRoute it
                 if (JString::strpos($replaceWith, 'index.php') === 0) {
                     $replaceWith = CRoute::getExternalURL($replaceWith);
                 }
                 if ($html) {
                     $replaceUrl = $params->get($val[1] . '_url', null);
                     if (!is_null($replaceUrl)) {
                         if ($val[1] == 'stream') {
                             $replaceUrl .= '#activity-stream-container';
                         }
                         //if the replacement start with 'index.php', we can CRoute it
                         if (JString::strpos($replaceUrl, 'index.php') === 0) {
                             $replaceUrl = CRoute::getExternalURL($replaceUrl);
                         }
                         $replaceWith = '<a href="' . $replaceUrl . '">' . $replaceWith . '</a>';
                     }
                 }
                 $content = CString::str_ireplace($val[0], $replaceWith, $content);
             }
         }
     }
     return $content;
 }
Example #21
0
 function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('easyblog.manage.tag', 'com_easyblog')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     //initialise variables
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     // Render modal
     JHTML::_('behavior.modal');
     $tagId = JRequest::getVar('tagid', '');
     $tag = EasyBlogHelper::getTable('Tag', 'Table');
     $tag->load($tagId);
     $tag->title = JString::trim($tag->title);
     $tag->alias = JString::trim($tag->alias);
     $this->tag = $tag;
     // Set default values for new entries.
     if (empty($tag->created)) {
         $date = EasyBlogDateHelper::getDate();
         $now = EasyBlogDateHelper::toFormat($date);
         $tag->created = $now;
         $tag->published = true;
     }
     $this->assignRef('my', $user);
     $this->assignRef('tag', $tag);
     parent::display($tpl);
 }
Example #22
0
	/**
	 * Constructor
	 */
	function AVideo($userId)
	{
		$user	 = &JFactory::getUser();
		$this->videoUser	= $userId;
				
		$this->videofolder	= 'images';
		$this->videofolder	= JString::trim($this->videofolder);
		$this->videofolder	= JString::trim($this->videofolder, '/');
		$this->videoRoot	= JPATH_ROOT . DS . $this->videofolder;
		
		$this->videoHome	= 'videos';
		$this->videoThumb	= 'thumbs';		
		$this->videoSize	= '400x300';
		$this->thumbSize	= '112x84';

		$this->videoRootHome		= $this->videoRoot . DS . $this->videoHome;
		$this->videoRootOrig		= $this->videoRoot . DS . $this->videoOrig;
		$this->videoRootHomeUser	= $this->videoRootHome . DS . $this->videoUser;	
		$this->videoHomeUser		= $this->videoHome . DS . $this->videoUser;		
		$this->videoRootHomeUserThumb = $this->videoRootHomeUser . DS . $this->videoThumb;
		$this->videoHomeUserThumb	= $this->videoHomeUser . DS . $this->videoThumb;

		$arrThumbSize				= explode('x', $this->thumbSize, 2);
		$this->videoThumbWidth		= intval($arrThumbSize[0]);
		$this->videoThumbHeight		= intval($arrThumbSize[1]);
		
	}
Example #23
0
 /**
  * Render position
  * @param string $position
  * @param array  $args
  * @return string
  */
 public function renderPosition($position, $args = array())
 {
     // init vars
     $output = array();
     $i = 0;
     $this->app->jbdebug->mark('filter::position-' . $position . '::start');
     // TODO check file exists
     $style = isset($args['style']) && $args['style'] ? $args['style'] : 'filter.block';
     $elementsConfig = $this->_getConfigPosition($position);
     foreach ($elementsConfig as $data) {
         $element = $this->app->jbfilter->getElement($data['element']);
         if ($element && $element->canAccess()) {
             $i++;
             $params = array_merge(array('first' => $i == 1, 'last' => $i == count($elementsConfig) - 1, 'item_type' => $this->_type, 'item_template' => $this->_template, 'item_application_id' => $this->_application->id, 'moduleParams' => $this->_moduleParams), $data, $args);
             $attrs = array('id' => 'jbfilter-id-' . trim($element->identifier, '_'), 'class' => array('jbfilter-element-' . strtolower($element->getElementType()), 'jbfilter-element-tmpl-' . trim($params['jbzoo_filter_render'], '_')));
             $value = $this->_getRequest($element->identifier);
             $elementHTML = $this->app->jbfilter->elementRender($element->identifier, $value, $params, $attrs);
             $elementHTML = JString::trim($elementHTML);
             if (empty($elementHTML)) {
                 continue;
             }
             if ($style) {
                 $output[$i] = parent::render($style, array('element' => $element, 'params' => $params, 'attrs' => $attrs, 'value' => $value, 'config' => $element->getConfig(), 'elementHTML' => $elementHTML));
             } else {
                 $output[$i] = $elementHTML;
             }
         }
     }
     $this->app->jbdebug->mark('filter::position-' . $position . '::end');
     return implode(PHP_EOL, $output);
 }
Example #24
0
 function connector()
 {
     $mainframe = JFactory::getApplication();
     $params = JComponentHelper::getParams('com_digicom');
     $root = $params->get('ftp_source_path', 'digicom');
     $folder = JRequest::getVar('folder', $root, 'default', 'path');
     if (JString::trim($folder) == "") {
         $folder = $root;
     } else {
         // Ensure that we are always below the root directory
         if (strpos($folder, $root) !== 0) {
             $folder = $root;
         }
     }
     // Disable debug
     JRequest::setVar('debug', false);
     $url = JURI::root(true) . '/' . $folder;
     $path = JPATH_SITE . '/' . JPath::clean($folder);
     JPath::check($path);
     include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderConnector.class.php';
     include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinder.class.php';
     include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderVolumeDriver.class.php';
     include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderVolumeLocalFileSystem.class.php';
     function access($attr, $path, $data, $volume)
     {
         $mainframe = JFactory::getApplication();
         // Hide PHP files.
         $ext = strtolower(JFile::getExt(basename($path)));
         if ($ext == 'php') {
             return true;
         }
         // Hide files and folders starting with .
         if (strpos(basename($path), '.') === 0 && $attr == 'hidden') {
             return true;
         }
         // Read only access for front-end. Full access for administration section.
         switch ($attr) {
             case 'read':
                 return true;
                 break;
             case 'write':
                 return $mainframe->isSite() ? false : true;
                 break;
             case 'locked':
                 return $mainframe->isSite() ? true : false;
                 break;
             case 'hidden':
                 return false;
                 break;
         }
     }
     if ($mainframe->isAdmin()) {
         $permissions = array('read' => true, 'write' => true);
     } else {
         $permissions = array('read' => true, 'write' => false);
     }
     $options = array('debug' => false, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
     $connector = new elFinderConnector(new elFinder($options));
     $connector->run();
 }
Example #25
0
    public function getFieldHTML($field, $required)
    {
        $required = $field->required == 1 ? ' data-required="true"' : '';
        //a fix for wrong data
        $field->value = JString::trim($field->value);
        if (JString::strrpos($field->value, ',') == JString::strlen($field->value) - 1) {
            $field->value = JString::substr($field->value, 0, -1);
        }
        $lists = explode(',', $field->value);
        //CFactory::load( 'helpers' , 'string' );
        $html = '<select id="field' . $field->id . '" name="field' . $field->id . '[]" type="select-multiple" multiple="multiple" class="joms-select joms-select--multiple" title="' . CStringHelper::escape(JText::_($field->tips)) . '" ' . $required . '>';
        $elementSelected = 0;
        foreach ($field->options as $option) {
            $selected = in_array($option, $lists) ? ' selected="selected"' : '';
            if (empty($selected)) {
                $elementSelected++;
            }
            $html .= '<option value="' . $option . '"' . $selected . '>' . JText::_($option) . '</option>';
        }
        if ($elementSelected == 0) {
            //if nothing is selected, we default the 1st option to be selected.
            $elementName = 'field' . $field->id;
            $html .= <<<HTML

                   <script type='text/javascript'>
                       var slt = document.getElementById('{$elementName}');
                       if(slt != null){
                          slt.options[0].selected = true;
                       }
                   </script>
HTML;
        }
        $html .= '</select>';
        return $html;
    }
Example #26
0
 function getContactName($id)
 {
     $sefConfig =& SEFConfig::getConfig();
     $title = array();
     $field = 'name';
     if (SEFTools::UseAlias($this->params, 'contact_alias')) {
         $field = 'alias';
     }
     $id = intval($id);
     $query = "SELECT `id`, `{$field}` AS `name`, `catid`, `metakey`, `metadesc`, `metadata`, `language`,`misc` FROM `#__contact_details` WHERE `id` = '{$id}'";
     $this->_db->setQuery($query);
     $row = $this->_db->loadObject('stdClass', $this->config->translateItems);
     if (is_null($row)) {
         JoomSefLogger::Log("Contact with ID {$id} could not be found.", $this, 'com_contact');
         return array();
     }
     $name = ($this->params->get('contactid', '0') != '0' ? $id . '-' : '') . $row->name;
     // use contact description as page meta tags if available
     if ($row->misc = JString::trim($row->misc)) {
         $this->metadesc = $row->misc;
     }
     if ($this->params->get('show_category', '2') != '0') {
         $catInfo = $this->getCategoryInfo($row->catid);
         if ($catInfo === false) {
             JoomSefLogger::Log("Category with ID {$row->catid} could not be found.", $this, 'com_contact');
         }
         if (is_array($catInfo->path)) {
             $title = array_merge($title, $catInfo->path);
         }
     }
     $title[] = $row->name;
     $this->getMetaData($row);
     return $title;
 }
Example #27
0
 function check()
 {
     if (JString::trim($this->url) != '' && substr($this->url, 0, 7) != 'http://') {
         $this->url = 'http://' . $this->url;
     }
     return true;
 }
Example #28
0
 public function getFieldHTML($field, $required)
 {
     $class = $field->required == 1 ? ' required validate-custom-checkbox' : '';
     $lists = is_array($field->value) ? $field->value : explode(',', $field->value);
     $html = '';
     $elementSelected = 0;
     $elementCnt = 0;
     $style = ' style="margin: 0 5px 5px 0;' . $this->getStyle() . '" ';
     $cnt = 0;
     CFactory::load('helpers', 'string');
     $class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
     $html .= '<div class="' . $class . '" style="display: inline-block;" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
     if (is_array($field->options)) {
         foreach ($field->options as $option) {
             $selected = in_array(JString::trim($option), $lists) ? ' checked="checked"' : '';
             if (empty($selected)) {
                 $elementSelected++;
             }
             $html .= '<label class="lblradio-block">';
             $html .= '<input type="checkbox" name="field' . $field->id . '[]" value="' . $option . '"' . $selected . ' class="checkbox ' . $class . $style . ' />';
             $html .= JText::_($option) . '</label>';
             $elementCnt++;
         }
     }
     $html .= '<span id="errfield' . $field->id . 'msg" style="display: none;">&nbsp;</span>';
     $html .= '</div>';
     return $html;
 }
 /**
  * Get conditions for search
  * @param $value
  * @return array
  */
 protected function _getWhere($value)
 {
     if ($this->_isUserExists($value)) {
         return array('tItem.created_by = ' . (int) $value);
     }
     if (!is_array($value)) {
         $value = array($value);
     }
     $conditions = array();
     foreach ($value as $oneValue) {
         $oneValue = JString::trim($oneValue);
         if (empty($oneValue)) {
             continue;
         }
         $userIds = $this->_getUserIdByName($oneValue);
         if (!empty($userIds)) {
             $conditions[] = 'tItem.created_by IN (' . implode(', ', $userIds) . ')';
         }
         $conditions[] = 'tItem.created_by_alias LIKE ' . $this->_db->quote('%' . $oneValue . '%');
     }
     if (!empty($conditions)) {
         return array('( ' . implode(' OR ', $conditions) . ' )');
     }
     return array('tItem.id IN (0)');
 }
Example #30
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Get project id.
     $this->projectId = $this->input->getUint("pid");
     // Prepare log object
     $registry = JRegistry::getInstance("com_crowdfunding");
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get("logger.file");
     $tableName = $registry->get("logger.table");
     $file = JPath::clean(JFactory::getApplication()->get("log_path") . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new ITPrismLog();
     $this->log->addWriter(new ITPrismLogWriterDatabase(JFactory::getDbo(), $tableName));
     $this->log->addWriter(new ITPrismLogWriterFile($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = CrowdFundingConstants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = JString::trim(JString::strtolower($this->input->getCmd("payment_service")));
     $paymentService = $filter->clean($paymentService, "ALNUM");
     $this->context = !empty($paymentService) ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams("com_crowdfunding");
 }