Exemplo n.º 1
0
 /**
  * Retrieves a list of cached images
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return	
  */
 public function getCachedImages($options = array())
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_links_images');
     if (isset($options['storage'])) {
         $sql->where('storage', $options['storage']);
     }
     if (isset($options['exclusion']) && !empty($options['exclusion'])) {
         $sql->where('id', $options['exclusion'], 'NOT IN');
     }
     if (isset($options['limit'])) {
         $sql->limit($options['limit']);
     }
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     if (!$result) {
         return $result;
     }
     $images = array();
     foreach ($result as $row) {
         $linkImage = FD::table('LinkImage');
         $linkImage->bind($row);
         $images[] = $linkImage;
     }
     return $images;
 }
Exemplo n.º 2
0
 public function getItems()
 {
     $db = FD::db();
     $query = 'SELECT * FROM ' . $db->nameQuote('#__social_toolbar') . ' WHERE ' . $db->nameQuote('state') . '=' . $db->Quote(SOCIAL_STATE_PUBLISHED);
     $db->setQuery($query);
     return $db->loadObjectList();
 }
Exemplo n.º 3
0
 public function store($updateNulls = false)
 {
     if (empty($this->ordering)) {
         $this->ordering = $this->getNextOrder('type = ' . FD::db()->quote($this->type) . ' AND parent_uid = ' . FD::db()->quote($this->parent_uid));
     }
     parent::store($updateNulls);
 }
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_clusters_categories');
     $sql->where('type', 'group');
     $sql->where('ordering', '0');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     foreach ($result as $row) {
         $table = FD::table('GroupCategory');
         $table->bind($row);
         $table->ordering = $table->getNextOrder('type = ' . $db->quote('group'));
         $table->store();
     }
     $sql->clear();
     $sql->select('#__social_clusters_categories');
     $sql->where('type', 'group');
     $sql->order('ordering');
     $sql->order('id');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     $counter = 1;
     foreach ($result as $row) {
         $table = FD::table('GroupCategory');
         $table->bind($row);
         $table->ordering = $counter;
         $table->store();
         $counter++;
     }
     return true;
 }
Exemplo n.º 5
0
 public static function getFields(&$params)
 {
     $db = FD::db();
     $sql = $db->sql();
     static $fields = null;
     if (!$fields) {
         // later we need to respect the module settings.
         $elements = array('address', 'birthday', 'gender', 'joomla_fullname', 'joomla_username');
         $db = FD::db();
         $sql = $db->sql();
         $query = 'select a.`unique_key`, a.`title`, b.`element`';
         $query .= ' from `#__social_fields` as a';
         $query .= ' inner join `#__social_fields_steps` as fs on a.`step_id` = fs.`id` and fs.`type` = ' . $db->Quote('profiles');
         $query .= ' inner join `#__social_profiles` as p on fs.`uid` = p.`id`';
         $query .= ' inner join `#__social_apps` as b on a.`app_id` = b.`id` and b.`group` = ' . $db->Quote('user');
         $query .= ' where a.`searchable` = ' . $db->Quote('1');
         $query .= ' and a.`state` = ' . $db->Quote('1');
         $query .= ' and a.`unique_key` != ' . $db->Quote('');
         $query .= ' and p.`state` = ' . $db->Quote('1');
         $string = "'" . implode("','", $elements) . "'";
         $query .= ' and b.`element` IN (' . $string . ')';
         $sql->raw($query);
         // echo $sql;exit;
         $db->setQuery($sql);
         $results = $db->loadObjectList();
         // manual grouping / distinct
         if ($results) {
             foreach ($results as $result) {
                 //$fields[ $result->unique_key ] = $result;
                 $fields[$result->element] = $result;
             }
         }
     }
     return $fields;
 }
Exemplo n.º 6
0
 public function loadByUIDBatch($ids)
 {
     $db = FD::db();
     $sql = $db->sql();
     $streamIds = array();
     foreach ($ids as $pid) {
         if (!isset(self::$_streamitems[$pid])) {
             $streamIds[] = $pid;
         }
     }
     if ($streamIds) {
         foreach ($streamIds as $pid) {
             self::$_streamitems[$pid] = false;
         }
         $idSegments = array_chunk($streamIds, 5);
         //$idSegments = array_chunk( $streamIds, count($streamIds) );
         $query = '';
         for ($i = 0; $i < count($idSegments); $i++) {
             $segment = $idSegments[$i];
             $ids = implode(',', $segment);
             $query .= 'select * from `#__social_stream_item` where `uid` IN ( ' . $ids . ')';
             if ($i + 1 < count($idSegments)) {
                 $query .= ' UNION ';
             }
         }
         $sql->raw($query);
         $db->setQuery($sql);
         $results = $db->loadObjectList();
         if ($results) {
             foreach ($results as $row) {
                 self::$_streamitems[$row->uid] = $row;
             }
         }
     }
 }
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_fields_data', 'a');
     $sql->column('a.*');
     $sql->leftjoin('#__social_fields', 'b');
     $sql->on('a.field_id', 'b.id');
     $sql->leftjoin('#__social_apps', 'c');
     $sql->on('b.app_id', 'c.id');
     $sql->where('c.type', 'fields');
     $sql->where('c.element', array('birthday', 'datetime'), 'IN');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     $json = FD::json();
     foreach ($result as $row) {
         $table = FD::table('fielddata');
         $table->bind($row);
         if ($json->isJsonString($table->data)) {
             $table->datakey = 'date';
             $table->store();
         }
     }
     return true;
 }
Exemplo n.º 8
0
 /**
  * Broadcast a message to a set of profiles on the site.
  *
  * @since	1.3
  * @access	public
  * @param 	int 	The profile id to target. 0 for all
  * @param	string  The message to be broadcasted
  * @param 	string  The title for the announcement
  * @return
  */
 public function broadcast($id, $content, $createdBy, $title = '', $link = '')
 {
     $db = FD::db();
     $sql = $db->sql();
     $query = array();
     $query[] = 'INSERT INTO ' . $db->quoteName('#__social_broadcasts');
     $query[] = '(`target_id`,`target_type`,`title`,`content`,`link`,`state`,`created`,`created_by`)';
     // Get the creation date
     $date = FD::date();
     $query[] = 'SELECT';
     $query[] = '`user_id`,' . $db->Quote(SOCIAL_TYPE_USER) . ',' . $db->Quote($title) . ',' . $db->Quote($content) . ',' . $db->Quote($link) . ',1,' . $db->Quote($date->toSql()) . ',' . $db->Quote($createdBy);
     $query[] = 'FROM ' . $db->quoteName('#__social_profiles_maps');
     $query[] = 'WHERE 1';
     if (!empty($id)) {
         $query[] = 'AND ' . $db->quoteName('profile_id') . '=' . $db->Quote($id);
     }
     // Exclude the broadcaster because it would be pretty insane if I am spamming myself
     $my = FD::user();
     $query[] = 'AND `user_id` !=' . $db->Quote($my->id);
     $query = implode(' ', $query);
     $sql->raw($query);
     $db->setQuery($sql);
     $state = $db->Query();
     if (!$state) {
         return $state;
     }
     // Get the id of the new broadcasted item
     $id = $db->insertid();
     return $id;
 }
Exemplo n.º 9
0
 public function init($options = array())
 {
     $this->db = FD::db();
     if (isset($options['mode'])) {
         $this->mode = $options['mode'];
     }
     if (isset($options['key'])) {
         $this->key = $options['key'];
     }
     if (isset($options['tablename'])) {
         $this->tablename = $options['tablename'];
     }
     if (isset($options['tablekey'])) {
         $this->tablekey = $options['tablekey'];
     }
     $table = $this->getTable();
     if (empty($this->tablename)) {
         $this->tablename = $table->getTableName();
     }
     if (empty($this->tablekey)) {
         $this->tablekey = $table->getKeyName();
     }
     if ($this->mode === 'full') {
         $this->initTable();
     }
 }
 public function main()
 {
     // Loop through 200 users at one time
     $limit = 200;
     // Set all points status to 0 first.
     $db = FD::db();
     $sql = $db->sql();
     $sql->update('#__social_points_history');
     $sql->set('state', 0);
     $db->setQuery($sql);
     $db->Query();
     // Now we need to merge all of these records into 1
     $sql->clear();
     // We need to use Joomla's date instead of mysql's NOW() because the timezone on mysql could be different.
     $date = FD::date();
     $query = array();
     $query[] = 'INSERT INTO `#__social_points_history`(`points_id`,`user_id`,`points`,`created`,`state`,`message`)';
     $query[] = "SELECT 0, `user_id` ,SUM(`points`), '" . $date->toSql() . "', 1, 'COM_EASYSOCIAL_POINTS_AGGREGATED' FROM `#__social_points_history` GROUP BY `user_id`";
     $query = implode(' ', $query);
     $sql->raw($query);
     $db->setQuery($sql);
     $db->Query();
     // Then we need to delete all the unpublished records
     $sql->clear();
     $sql->delete('#__social_points_history');
     $sql->where('state', 0);
     $db->setQuery($sql);
     $db->Query();
     // Also delete any points history that is assigned to guests
     $sql->clear();
     $sql->delete('#__social_points_history');
     $sql->where('user_id', 0);
     $db->setQuery($sql);
     $db->Query();
 }
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_fields_data', 'a')->column('a.*')->leftjoin('#__social_fields', 'b')->on('b.id', 'a.field_id')->leftjoin('#__social_apps', 'c')->on('c.id', 'b.app_id')->where('a.datakey', '')->where('c.type', 'fields')->where('c.element', 'joomla_fullname');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     $json = FD::json();
     foreach ($result as $row) {
         if ($json->isJsonString($row->data)) {
             $data = $json->decode($row->data);
             // Split json object into each individual row
             foreach ($data as $k => $v) {
                 if (!empty($v)) {
                     $table = $this->getTable($row->field_id, $row->uid, $row->type, $k);
                     $table->data = $v;
                     $table->raw = $v;
                     $table->store();
                 }
             }
         }
         // Remove the row with empty key
         $sql->clear();
         $sql->delete('#__social_fields_data')->where('id', $row->id);
         $db->setQuery($sql);
         $db->query();
     }
     return true;
 }
Exemplo n.º 12
0
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     // reset fields privacy if the option is customize, set it back to only me.
     $query = "update `#__social_privacy` as a";
     $query .= " left join `#__social_privacy_map` as b on a.`id` = b.`privacy_id`";
     $query .= " left join `#__social_privacy_items` as c on a.`id` = c.`privacy_id`";
     $query .= " set a.`options` = " . $db->Quote('{"options":["public","member","friend","only_me"]}') . ",";
     $query .= "     b.`value` = if(b.`value` = '100', '40', b.`value`),";
     $query .= "     c.`value` = if(c.`value` = '100', '40', c.`value`)";
     $query .= " where a.`type` = 'field'";
     $sql->raw($query);
     $db->setQuery($sql);
     $db->query();
     // now we need to remove fields privacy of 'joomla_username' and 'joomla_fullname'
     $query = "delete a, b, c";
     $query .= " from `#__social_privacy` as a";
     $query .= "     left join `#__social_privacy_map` as b on a.`id` = b.`privacy_id`";
     $query .= "     left join `#__social_privacy_items` as c on a.`id` = c.`privacy_id`";
     $query .= " where a.`type` = 'field'";
     $query .= " and a.`rule` in ('joomla_fullname', 'joomla_username')";
     $sql->clear();
     $sql->raw($query);
     $db->setQuery($sql);
     $db->query();
     return true;
 }
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     // For country field
     $sql->select('#__social_fields_data', 'a')->column('a.*')->leftjoin('#__social_fields', 'b')->on('b.id', 'a.field_id')->leftjoin('#__social_apps', 'c')->on('c.id', 'b.app_id')->where('a.datakey', '')->where('c.type', 'fields')->where('c.element', 'country');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     $json = FD::json();
     // Load up the list of countries
     $file = SOCIAL_ADMIN_DEFAULTS . '/countries.json';
     $list = FD::makeObject($file);
     foreach ($result as $row) {
         if ($json->isJsonString($row->data)) {
             $data = $json->decode($row->data);
             // Split json object into each individual row
             foreach ($data as $k => $v) {
                 if (!empty($v)) {
                     $table = $this->getTable($row->field_id, $row->uid, $row->type, $k);
                     $country = $list->{$v};
                     $table->data = $country;
                     $table->raw = $country;
                     $table->store();
                 }
             }
         }
         // Remove the row with empty key
         $sql->clear();
         $sql->delete('#__social_fields_data')->where('id', $row->id);
         $db->setQuery($sql);
         $db->query();
     }
     return true;
 }
Exemplo n.º 14
0
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_apps');
     $sql->where('type', 'fields');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     foreach ($result as $row) {
         $file = SOCIAL_FIELDS . '/' . $row->group . '/' . $row->element . '/' . $row->element . '.xml';
         if (!JFile::exists($file)) {
             continue;
         }
         $table = FD::table('App');
         $table->bind($row);
         $parser = FD::get('Parser');
         $parser->load($file);
         $val = $parser->xpath('unique');
         $unique = 0;
         if ($val) {
             $unique = (string) $val[0];
             $unique = $unique == 'true' ? 1 : 0;
         }
         $table->unique = $unique;
         $table->store();
     }
     return true;
 }
Exemplo n.º 15
0
 public function getItems($options = array())
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_clusters_nodes', 'a');
     $sql->column('a.*');
     $eventid = isset($options['eventid']) ? $options['eventid'] : 0;
     $sql->where('cluster_id', $eventid);
     if (isset($options['state'])) {
         $sql->where('state', $state);
     }
     if (isset($options['admin'])) {
         $sql->where('admin', $options['admin']);
     }
     $ordering = $this->getState('ordering');
     if (!empty($ordering)) {
         $direction = $this->getState('direction');
         if ($ordering == 'username') {
             $sql->leftjoin('#__users', 'b');
             $sql->on('a.uid', 'b.id');
             $sql->order('b.username', $direction);
         } elseif ($ordering == 'name') {
             $sql->leftjoin('#__users', 'b');
             $sql->on('a.uid', 'b.id');
             $sql->order('b.name', $direction);
         } else {
             $sql->order($ordering, $direction);
         }
     }
     $this->setTotal($sql->getTotalSql());
     $result = $this->getData($sql->getSql());
     $guests = $this->bindTable('EventGuest', $result);
     return $guests;
 }
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     // First we get the core.view privacy id
     $sql->select('#__social_privacy')->column('id')->where('type', 'core')->where('rule', 'view');
     $db->setQuery($sql);
     $origId = $db->loadResult();
     // Then we cache a copy of all the new field rules and the id
     $sql->clear();
     $sql->select('#__social_privacy')->column('id')->column('rule')->where('type', 'field');
     $db->setQuery($sql);
     $rules = $db->loadObjectList('rule');
     // Then we get all the privacy items with this id and type = 'field'
     $sql->clear();
     $sql->select('#__social_privacy_items', 'a')->column('a.*')->column('c.element')->leftjoin('#__social_fields', 'b')->on('b.id', 'a.uid')->leftjoin('#__social_apps', 'c')->on('b.app_id', 'c.id')->where('(')->where('a.type', 'field')->where('a.type', 'field.datetime.year', '=', 'OR')->where(')');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     // Based on the element, we need to find the new id to map it to the rule
     foreach ($result as $row) {
         if (isset($rules[$row->element])) {
             $table = FD::table('privacyitems');
             $table->bind($row);
             $table->privacy_id = $rules[$row->element]->id;
             $table->store();
         }
     }
     // field.datetime.year need to change to year
     $sql->clear();
     $sql->update('#__social_privacy_items')->set('type', 'year')->where('type', 'field.datetime.year');
     $db->setQuery($sql);
     $db->query();
     return true;
 }
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $queries = array();
     // photos
     $query = "update `#__social_notifications`";
     $query .= " set `context_type` = 'photos.create'";
     $query .= " where `context_type` = 'photos'";
     $query .= " and `cmd` = 'likes.likes'";
     $queries[] = $query;
     // albums
     $query = "update `#__social_notifications`";
     $query .= " set `context_type` = 'albums.create'";
     $query .= " where `context_type` = 'albums'";
     $query .= " and `cmd` = 'likes.likes'";
     $queries[] = $query;
     foreach ($queries as $query) {
         $sql->clear();
         $sql->raw($query);
         $db->setQuery($sql);
         $db->query();
     }
     return true;
 }
Exemplo n.º 18
0
 public function getItems($options = array())
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select($this->_tbl);
     if (isset($options['type'])) {
         $sql->where('type', $options['type']);
     }
     if (isset($options['parent_uid'])) {
         $sql->where('parent_uid', $options['parent_uid']);
     }
     if (isset($options['parent_type'])) {
         $sql->where('parent_type', $options['parent_type']);
     }
     $state = $this->getState('state');
     if ($state !== 'all') {
         $sql->where('state', $state);
     }
     $search = $this->getState('search');
     if (!empty($search)) {
         $sql->where('name', '%' . $search . '%', 'LIKE');
     }
     $sql->order($this->getState('ordering'), $this->getState('direction'));
     $this->setTotal($sql->getTotalSql());
     $result = $this->getData($sql->getSql());
     return $this->bindTable('Region', $result);
 }
Exemplo n.º 19
0
 public function loadByField($fieldId)
 {
     $db = FD::db();
     $query = 'SELECT a.* FROM ' . $db->nameQuote($this->_tbl) . ' AS a ' . 'INNER JOIN ' . $db->nameQuote('#__social_fields') . ' AS b ' . 'ON b.field_id=a.id ' . 'WHERE b.' . $db->nameQuote('id') . '=' . $db->Quote($fieldId);
     $db->setQuery($query);
     $data = $db->loadObject();
     return parent::bind($data);
 }
Exemplo n.º 20
0
 public function getItems($options = array())
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_clusters_nodes', 'a');
     $sql->column('a.*');
     $sql->leftjoin('#__users', 'b');
     $sql->on('a.uid', 'b.id');
     if (FD::config()->get('users.blocking.enabled') && !JFactory::getUser()->guest) {
         $sql->leftjoin('#__social_block_users', 'bus');
         $sql->on('b.id', 'bus.user_id');
         $sql->on('bus.target_id', JFactory::getUser()->id);
         $sql->isnull('bus.id');
     }
     $sql->where('b.block', 0);
     if (!empty($options['groupid'])) {
         $sql->where('cluster_id', $options['groupid']);
     }
     if (isset($options['state'])) {
         $sql->where('state', $state);
     }
     if (isset($options['admin'])) {
         $sql->where('admin', $options['admin']);
     }
     $ordering = $this->getState('ordering');
     if (!empty($ordering)) {
         $direction = $this->getState('direction');
         if ($ordering == 'username') {
             $sql->order('b.username', $direction);
         } elseif ($ordering == 'name') {
             $sql->order('b.name', $direction);
         } else {
             $sql->order($ordering, $direction);
         }
     }
     $limit = $this->getState('limit');
     if ($limit > 0) {
         $this->setState('limit', $limit);
         // Get the limitstart.
         $limitstart = $this->getUserStateFromRequest('limitstart', 0);
         $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
         $this->setState('limitstart', $limitstart);
         // Set the total number of items.
         $this->setTotal($sql->getTotalSql());
         // Get the list of users
         $result = parent::getData($sql->getSql());
     } else {
         $db->setQuery($sql);
         $result = $db->loadObjectList();
     }
     $members = array();
     foreach ($result as $row) {
         $member = FD::table('GroupMember');
         $member->bind($row);
         $members[] = $member;
     }
     return $members;
 }
Exemplo n.º 21
0
 /**
  * Deletes all news from a specific cluster
  *
  * @since	1.2
  * @access	public
  * @param	int		The cluster id
  * @return	bool	True on success false otherwise.
  */
 public function delete($id)
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->delete('#__social_clusters_news');
     $sql->where('cluster_id', $id);
     $db->setQuery($sql);
     return $db->Query();
 }
Exemplo n.º 22
0
 public function getTaxonomyTypes($type = null)
 {
     $db = FD::db();
     $sql = $db->sql();
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $query = "select distinct a.* from `#__finder_taxonomy` as a";
     $query .= " \tinner join `#__finder_taxonomy_map` as b on a.`id` = b.`node_id`";
     $query .= " \tinner join `#__finder_links` as c on c.`link_id` = b.`link_id`";
     $query .= " where a.`access` IN ( {$groups} )";
     $query .= " and a.`state` = 1";
     $query .= " and a.`parent_id` = ( select id from `#__finder_taxonomy` where title = 'Type' )";
     if ($type) {
         $query .= " and a.`title` = '{$type}'";
     } else {
         $query .= " and a.`title` IN ( select title from `#__finder_types` )";
     }
     // echo $query;
     $sql->raw($query);
     $db->setQuery($sql);
     $results = $db->loadObjectList();
     if ($results) {
         for ($i = 0; $i < count($results); $i++) {
             $row =& $results[$i];
             $row->displayTitle = $row->title;
             $row->icon = $this->getIcon($row->title);
             switch ($row->title) {
                 case 'EasySocial.Albums':
                     $row->displayTitle = JText::_('COM_EASYSOCIAL_SEARCH_TYPE_ALBUMS');
                     break;
                 case 'EasySocial.Photos':
                     $row->displayTitle = JText::_('COM_EASYSOCIAL_SEARCH_TYPE_PHOTOS');
                     break;
                 case 'EasySocial.Users':
                     $row->displayTitle = JText::_('COM_EASYSOCIAL_SEARCH_TYPE_PEOPLE');
                     break;
                 case 'EasySocial.Groups':
                     $row->displayTitle = JText::_('COM_EASYSOCIAL_SEARCH_TYPE_GROUPS');
                     break;
                 case 'EasySocial.Events':
                     $row->displayTitle = JText::_('COM_EASYSOCIAL_SEARCH_TYPE_EVENTS');
                     break;
                 case 'EasyBlog':
                     $row->displayTitle = JText::_('COM_EASYSOCIAL_SEARCH_TYPE_BLOG');
                     break;
                 case 'EasyDiscuss':
                     $row->displayTitle = JText::_('COM_EASYSOCIAL_SEARCH_TYPE_DISCUSS');
                     break;
                 default:
                     $row->displayTitle = JText::_($row->displayTitle);
                     break;
             }
         }
     }
     return $results;
 }
Exemplo n.º 23
0
 public function loadStoryForm()
 {
     FD::checkToken();
     FD::requireLogin();
     FD::language()->loadAdmin();
     $categoryid = FD::input()->getInt('id', 0);
     $category = FD::table('EventCategory');
     $category->load($categoryid);
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_fields', 'a');
     $sql->column('a.*');
     $sql->column('d.element');
     $sql->leftjoin('#__social_fields_steps', 'b');
     $sql->on('a.step_id', 'b.id');
     $sql->leftjoin('#__social_clusters_categories', 'c');
     $sql->on('b.uid', 'c.id');
     $sql->leftjoin('#__social_apps', 'd');
     $sql->on('a.app_id', 'd.id');
     $sql->where('b.type', SOCIAL_TYPE_CLUSTERS);
     $sql->where('c.id', $category->id);
     $sql->where('d.group', SOCIAL_FIELDS_GROUP_EVENT);
     $sql->where('d.type', SOCIAL_APPS_TYPE_FIELDS);
     $sql->where('d.element', array('startend', 'title', 'description'), 'in');
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     $theme = FD::themes();
     foreach ($result as $row) {
         $field = FD::table('Field');
         $field->bind($row);
         $params = $field->getParams();
         if ($row->element === 'startend') {
             $dateFormat = $params->get('date_format', 'DD-MM-YYYY');
             if ($params->get('allow_time', true)) {
                 $dateFormat .= ' ' . $params->get('time_format', 'hh:mm A');
             }
             if ($params->get('allow_timezone', true)) {
                 $theme->set('timezones', $this->getTimezones());
             }
             $theme->set('dateFormat', $dateFormat);
             $theme->set('allowTimezone', $params->get('allow_timezone', 1));
             $theme->set('allowTime', $params->get('allow_time', 1));
             $theme->set('yearfrom', $params->get('yearfrom'));
             $theme->set('yearto', $params->get('yearto'));
             $theme->set('disallowPast', $params->get('disallow_past', 0));
             $theme->set('minuteStepping', $params->get('minute_stepping', 15));
         }
         if ($row->element === 'title') {
             $theme->set('titlePlaceholder', $field->get('title'));
         }
         if ($row->element === 'description') {
             $theme->set('descriptionPlaceholder', $field->get('description'));
         }
     }
     FD::ajax()->resolve($theme->output('apps/user/events/story/panel.form'));
 }
Exemplo n.º 24
0
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $config = FD::config();
     $relative = rtrim($config->get('photos.storage.container'), '/') . '/';
     // lets get the paths that need to be updated.
     $query = "select `value` from `#__social_photos_meta`";
     $query .= " where `group` = 'path'";
     $query .= " and `value` not like '{$relative}%'";
     $query .= ' limit 1';
     // $query .= " and `photo_id` in ( select id from `#__social_photos` where `user_id` = '84' and `album_id` = '229' )";
     $sql->raw($query);
     $db->setQuery($sql);
     $results = $db->loadObjectList();
     $paths = array();
     if ($results) {
         // foreach ($results as $item) {
         $item = $results[0];
         //$pattern = '/.*\/\D*\//i';
         $pattern = '/\\/.*\\//i';
         preg_match($pattern, $item->value, $matches);
         if ($matches) {
             // we do not want the [albumid]/[photoid] segments.
             $path = $matches[0];
             $path = rtrim($path, '/');
             $path = ltrim($path, '/');
             $segments = explode('/', $path);
             // remove the last two elements since we knwo that is the album id and photo id.
             array_pop($segments);
             array_pop($segments);
             //now we glue the segments back
             $segmentPath = implode('/', $segments);
             //now we need to add back the leading / and ending /
             $segmentPath = '/' . $segmentPath . '/';
             if (!in_array($segmentPath, $paths)) {
                 $paths[] = $segmentPath;
             }
         }
         // } //end foreach
     }
     //end if
     // if found, lets replace these paths to the one admin configured.
     if ($paths) {
         foreach ($paths as $pitem) {
             $query = "UPDATE `#__social_photos_meta` SET `value` = replace(`value`, '{$pitem}' , '{$relative}')";
             $query .= " WHERE `group`= 'path'";
             $query .= " and `value` like '{$pitem}%'";
             $sql->clear();
             $sql->raw($query);
             $db->setQuery($sql);
             $db->Query();
         }
     }
     return true;
 }
Exemplo n.º 25
0
 /**
  * Returns the configuration data
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getConfig($type, $debug = false)
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_config');
     $sql->where('type', $type);
     $db->setQuery($sql);
     $obj = $db->loadObject();
     return $obj;
 }
Exemplo n.º 26
0
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     // updating comment the element column
     $sql->update('#__social_privacy_map')->set('utype', 'profiles')->where('utype', 'profile');
     $db->setQuery($sql);
     $db->query();
     return true;
 }
Exemplo n.º 27
0
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     // Update all privacy column for the `state` to be published
     $sql->update('#__social_privacy')->set('state', 1)->set('core', 1);
     $db->setQuery($sql);
     $db->query();
     return true;
 }
Exemplo n.º 28
0
 /**
  * Purges the URL cache from the site
  *
  * @since	1.0
  * @access	public
  * @param	int		The number of days interval
  * @return	bool	True on success, false otherwise.
  */
 public function clearExpired($interval)
 {
     $db = FD::db();
     $sql = $db->sql();
     $date = FD::date();
     $query = 'DELETE FROM `#__social_links` WHERE DATE_ADD( `created` , INTERVAL ' . $interval . ' DAY) <= ' . $db->Quote($date->toMySQL());
     $sql->raw($query);
     $db->setQuery($sql);
     return $db->Query();
 }
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     // Update all privacy column for the `state` to be published
     $sql->update('#__social_apps')->set('state', 0)->where('element', 'locations')->where('group', 'user');
     $db->setQuery($sql);
     $db->query();
     return true;
 }
Exemplo n.º 30
0
 /**
  * Some desc
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPullableClients()
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_oauth');
     $sql->where('pull', 1);
     $db->setQuery($sql);
     $items = $db->loadObjectList();
     return $items;
 }