Example #1
0
 /**
  * Method to get the data that should be injected in the form.
  *
  * @return	mixed	The data for the form.
  * @since	1.6
  */
 protected function loadFormData()
 {
     if ($this->data === null) {
         $userId = $this->state->get('user.id');
         // Initialise the table with JUser.
         $this->data = new JUser($userId);
         // Set the base user data.
         $this->data->email1 = $this->data->get('email');
         $this->data->email2 = $this->data->get('email');
         // Override the base user data with any data in the session.
         $temp = (array) JFactory::getApplication()->getUserState('com_users.registration.data', array());
         foreach ($temp as $k => $v) {
             $this->data->{$k} = $v;
         }
         // Unset the passwords.
         unset($this->data->password1);
         unset($this->data->password2);
         $registry = new JRegistry($this->data->params);
         $this->data->params = $registry->toArray();
         // Get the dispatcher and load the users plugins.
         JPluginHelper::importPlugin('user');
         // Trigger the data preparation event.
         $results = JFactory::getApplication()->triggerEvent('onContentPrepareData', array('com_userxtd.profile', $this->data));
         // Check for errors encountered while preparing the data.
         if (count($results) && in_array(false, $results, true)) {
             //$this->setError($dispatcher->getError());
             $this->data = false;
         }
     }
     return $this->data;
 }
Example #2
0
 /**
  * Retrieve a value from the request (GET/POST/REQUEST)
  *
  * @param string $name name of the variable to be retrieved
  * @param string $type  type of the variable (see CRM_Utils_Type for details)
  * @param stdClass $store session scope where variable is stored
  * @param bool $abort is this variable required
  * @param mixed $default default value of the variable if not present
  * @param string $method where should we look for the variable
  *
  * @return mixed the value of the variable
  * @access public
  * @static
  */
 static function retrieve($name, $type, &$store = NULL, $abort = FALSE, $default = NULL, $method = 'REQUEST')
 {
     // hack to detect stuff not yet converted to new style
     if (!is_string($type)) {
         CRM_Core_Error::backtrace();
         CRM_Core_Error::fatal(ts("Please convert retrieve call to use new function signature"));
     }
     $value = NULL;
     switch ($method) {
         case 'GET':
             $value = CRM_Utils_Array::value($name, $_GET);
             break;
         case 'POST':
             $value = CRM_Utils_Array::value($name, $_POST);
             break;
         default:
             $value = CRM_Utils_Array::value($name, $_REQUEST);
             break;
     }
     if (isset($value) && CRM_Utils_Type::validate($value, $type, $abort, $name) === NULL) {
         $value = NULL;
     }
     if (!isset($value) && $store) {
         $value = $store->get($name);
     }
     if (!isset($value) && $abort) {
         CRM_Core_Error::fatal(ts("Could not find valid value for %1", array(1 => $name)));
     }
     if (!isset($value) && $default) {
         $value = $default;
     }
     // minor hack for action
     if ($name == 'action' && is_string($value)) {
         $value = CRM_Core_Action::resolve($value);
     }
     if (isset($value) && $store) {
         $store->set($name, $value);
     }
     return $value;
 }
Example #3
0
 /**
  * Check if there is a valid cache entry for the key required
  * @param string $key the key of the data that you want to be checked
  * @return bool true if the key exists, false otherwise
  */
 public function exist($key)
 {
     return $this->_cache->get($this->combineKey($key)) !== false;
 }
Example #4
0
 /**
  * @param string $attrName
  * @param Entity $entity
  * @param string $defaultValue
  * @return ElementAbstract
  * */
 public function fieldForeign($attrName, Entity $entity, $defaultValue = NULL)
 {
     $info = $this->_FKConfig->get($attrName);
     return new Select($attrName, $this->_executor->execute(QueryAbstract::factory($this->_executor->getConfig()->get('driver'), $entity)), $info->value, $info->label, $defaultValue);
 }
Example #5
0
File: Pot.php Project: elkuku/g11n
 /**
  * Generate a language file.
  *
  * @param   FileInfo   $checker  FileInfo object.
  * @param   \stdClass  $options  Options.
  *
  * @return string
  */
 public function generate(FileInfo $checker, $options)
 {
     $dateTimeZone = new \DateTimeZone(date_default_timezone_get());
     $dateTime = new \DateTime('now', $dateTimeZone);
     $timeOffset = $dateTimeZone->getOffset($dateTime) / 3600;
     $contents = array();
     $strings = $checker->strings;
     $stringsPlural = $checker->stringsPlural;
     $contents[] = '' . "\n# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR Free Software Foundation, Inc.\n# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n#\n#, fuzzy\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: PACKAGE VERSION\\n\"\n\"Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\\n\"\n\"POT-Creation-Date: " . date('Y-m-d H:i ') . $timeOffset . "00\\n\"\n\"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n\"Language-Team: LANGUAGE <*****@*****.**>\\n\"\n\"Content-Type: text/plain; charset=CHARSET\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Generator: G11n\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n";
     foreach ($strings as $key => $string) {
         if ($string->info) {
             $contents[] = trim($string->info);
         }
         if ($options->get('includeLineNumbers')) {
             foreach ($string->files as $f => $locs) {
                 foreach ($locs as $loc) {
                     $contents[] = "#: {$f}:{$loc}";
                 }
             }
         }
         $key = html_entity_decode($key);
         $key = addcslashes($key, '"');
         while (strpos($key, "\\\\") != false) {
             $key = str_replace('\\\\', '\\', $key);
         }
         while (strpos($key, "\\'") != false) {
             $key = str_replace("\\'", "'", $key);
         }
         $contents[] = 'msgid "' . htmlentities($key) . '"';
         $contents[] = 'msgstr ""';
         $contents[] = '';
     }
     foreach ($stringsPlural as $key => $string) {
         if ($options->get('includeLineNumbers')) {
             foreach ($string->files as $f => $locs) {
                 foreach ($locs as $loc) {
                     $contents[] = "#: {$f}:{$loc}";
                 }
             }
         }
         $key = html_entity_decode($key);
         $value = html_entity_decode($string->pluralForms[1]);
         $contents[] = 'msgid "' . htmlspecialchars($key) . '"';
         $contents[] = 'msgid_plural "' . htmlspecialchars($value) . '"';
         $contents[] = 'msgstr[0] ""';
         $contents[] = 'msgstr[1] ""';
         $contents[] = '';
     }
     return implode("\n", $contents);
 }
Example #6
0
File: content.php Project: cwcw/cms
/**
* @param int The category id
* @param int The group id of the user
* @param int The access level of the user
* @param int The section id
* @param int The number of items to dislpay
* @param int The offset for pagination
*/
function showCategory($id, $gid, &$access, $sectionid, $limit, $limitstart, $now)
{
    global $database, $mainframe, $Itemid, $mosConfig_offset, $mosConfig_list_limit;
    $noauth = !$mainframe->getCfg('shownoauth');
    $selected = mosGetParam($_POST, 'order', '');
    // Paramters
    $params = new stdClass();
    if ($Itemid) {
        $menu = new mosMenu($database);
        $menu->load($Itemid);
        $params =& new mosParameters($menu->params);
    } else {
        $menu = "";
        $params =& new mosParameters('');
    }
    if ($selected) {
        $orderby = $selected;
    } else {
        $orderby = $params->get('orderby', 'rdate');
        $selected = $orderby;
    }
    $params->def('page_title', 1);
    $params->def('title', 1);
    $params->def('hits', $mainframe->getCfg('hits'));
    $params->def('author', !$mainframe->getCfg('hideAuthor'));
    $params->def('date', !$mainframe->getCfg('hideCreateDate'));
    $params->def('date_format', _DATE_FORMAT_LC);
    $params->def('navigation', 2);
    $params->def('display', 1);
    $params->def('display_num', $mosConfig_list_limit);
    $params->def('other_cat', 1);
    $params->def('empty_cat', 0);
    $params->def('cat_items', 1);
    $params->def('cat_description', 1);
    $params->def('back_button', $mainframe->getCfg('back_button'));
    $params->def('pageclass_sfx', '');
    $params->def('headings', 1);
    $params->def('order_select', 1);
    $params->def('filter', 1);
    $params->def('filter_type', 'title');
    // Ordering control
    $orderby = _orderby_sec($orderby);
    $category = new mosCategory($database);
    $category->load($id);
    if ($sectionid == 0) {
        $sectionid = $category->section;
    }
    if ($access->canEdit) {
        $xwhere = '';
        $xwhere2 = "AND b.state >= '0'";
    } else {
        $xwhere = "\n AND c.published='1'";
        $xwhere2 = "\n AND b.state='1'" . "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '" . $now . "' )" . "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '" . $now . "' )";
    }
    // check if this is a category menu item
    if ($Itemid) {
        $menu = new mosMenu($database);
        $menu->load($Itemid);
        if ($menu->type == 'content_category') {
            $xwhere = "\n\tAND a.id = '" . $id . "'";
        }
    } else {
        $menu = "";
    }
    // show/hide empty categories
    if ($params->get('empty_cat')) {
        $empty = '';
    } else {
        $empty = "\n HAVING COUNT( b.id ) > 0";
    }
    // get the list of other categories
    $query = "SELECT c.*, COUNT( b.id ) AS numitems" . "\n FROM #__categories AS c" . "\n LEFT JOIN #__content AS b ON b.catid = c.id " . $xwhere2 . "\n WHERE c.section = '" . $category->section . "'" . ($noauth ? "\n AND c.access <= '" . $gid . "'" : '') . "\n GROUP BY c.id" . $empty . "\n ORDER BY c.ordering";
    $database->setQuery($query);
    $other_categories = $database->loadObjectList();
    // get the total number of published items in the category
    if ($access->canEdit) {
        $xwhere = "AND a.state >= '0'";
    } else {
        $xwhere = "\n AND a.state='1'" . "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '{$now}' )" . "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '{$now}' )";
    }
    $query = "SELECT a.id" . "\n FROM #__content AS a" . "\n WHERE a.sectionid = '" . $category->section . "'" . "\n AND a.catid = '" . $category->id . "'" . $xwhere;
    $database->setQuery($query);
    $counter = $database->loadObjectList();
    $total = count($counter);
    $limit = $limit ? $limit : $params->get('display_num');
    if ($total <= $limit) {
        $limitstart = 0;
    }
    require_once $GLOBALS['mosConfig_absolute_path'] . '/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    // filter functionality
    $filter = trim(mosGetParam($_POST, 'filter', ''));
    $filter = strtolower($filter);
    $and = '';
    if ($filter) {
        if ($params->get('filter')) {
            switch ($params->get('filter_type')) {
                case 'title':
                    $and = "\n AND LOWER( a.title ) LIKE '%" . $filter . "%'";
                    break;
                case 'author':
                    $and = "\n AND ( ( LOWER( u.name ) LIKE '%" . $filter . "%' ) OR ( LOWER( a.created_by_alias ) LIKE '%" . $filter . "%' ) )";
                    break;
                case 'hits':
                    $and = "\n AND a.hits LIKE '%" . $filter . "%'";
                    break;
            }
        }
    }
    // get the list of items for this category
    $query = "SELECT a.id, a.title, a.hits, a.created_by, a.created_by_alias, a.created AS created, a.access, u.name AS author, a.state, g.name AS groups" . "\n FROM #__content AS a" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__groups AS g ON a.access = g.id" . "\n WHERE a.catid='" . $category->id . "' " . $xwhere . ($noauth ? "\n AND a.access<='" . $gid . "'" : '') . "\n AND '" . $category->access . "'<='" . $gid . "'" . $and . "\n ORDER BY " . $orderby . "" . "\n LIMIT " . $limitstart . ", " . $limit;
    $database->setQuery($query);
    $items = $database->loadObjectList();
    $check = 0;
    if ($params->get('date')) {
        $order[] = mosHTML::makeOption('date', _ORDER_DROPDOWN_DA);
        $order[] = mosHTML::makeOption('rdate', _ORDER_DROPDOWN_DD);
        $check .= 1;
    }
    if ($params->get('title')) {
        $order[] = mosHTML::makeOption('alpha', _ORDER_DROPDOWN_TA);
        $order[] = mosHTML::makeOption('ralpha', _ORDER_DROPDOWN_TD);
        $check .= 1;
    }
    if ($params->get('hits')) {
        $order[] = mosHTML::makeOption('hits', _ORDER_DROPDOWN_HA);
        $order[] = mosHTML::makeOption('rhits', _ORDER_DROPDOWN_HD);
        $check .= 1;
    }
    if ($params->get('author')) {
        $order[] = mosHTML::makeOption('author', _ORDER_DROPDOWN_AUA);
        $order[] = mosHTML::makeOption('rauthor', _ORDER_DROPDOWN_AUD);
        $check .= 1;
    }
    $order[] = mosHTML::makeOption('order', _ORDER_DROPDOWN_O);
    $lists['order'] = mosHTML::selectList($order, 'order', 'class="inputbox" size="1"  onchange="document.adminForm.submit();"', 'value', 'text', $selected);
    if ($check < 1) {
        $lists['order'] = '';
        $params->set('order_select', 0);
    }
    $lists['task'] = 'category';
    $lists['filter'] = $filter;
    // Dynamic Page Title
    $mainframe->SetPageTitle($menu->name);
    HTML_content::showContentList($category, $items, $access, $id, $sectionid, $gid, $params, $pageNav, $other_categories, $lists);
}
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
require_once "priceguard.html.php";
require_once "tools.php";
require_once "Services/AmazonECS4.php";
//$id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );
//$catid = intval( mosGetParam( $_REQUEST, 'catid', 0 ) );
// get parameters
$params = new stdClass();
if ($Itemid) {
    $menu = new mosMenu($database);
    $menu->load($Itemid);
    $params =& new mosParameters($menu->params);
} else {
    die('Something is wrong here...');
}
$task = $params->get('task');
switch ($task) {
    case 'add_product':
        addProduct();
        break;
    case 'show_products':
        showProducts();
        break;
    case 'show_products_delete':
        showProductsDelete();
        break;
    case 'create_category':
        createCategory();
        break;
    default:
        showProducts();
function testClassMethodMemberPrimaryPrefixIsStaticReturnsTrue()
{
    return stdClass::get();
}