当前位置: 首页>>代码示例>>PHP>>正文


PHP CParameter::toString方法代码示例

本文整理汇总了PHP中CParameter::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP CParameter::toString方法的具体用法?PHP CParameter::toString怎么用?PHP CParameter::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CParameter的用法示例。


在下文中一共展示了CParameter::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: removeActivity

 public function removeActivity($app, $uniqueId)
 {
     $db = $this->getDBO();
     /*
      * @todo add in additional info if needed
      * when removing photo app, we need to remove the likes and comments as well
      */
     $additionalQuery = '';
     switch ($app) {
         case 'photos':
             //before we remove anything, lets check if this photo is included in the params of activity
             // that might be more than one photo
             $db->setQuery("SELECT albumid FROM " . $db->quoteName('#__community_photos') . " WHERE id=" . $db->quote($uniqueId));
             $albumId = $db->loadResult();
             $db->setQuery("SELECT id, params FROM " . $db->quoteName('#__community_activities') . " WHERE " . $db->quoteName('app') . '=' . $db->Quote($app) . " AND " . $db->quoteName('cid') . '=' . $db->Quote($uniqueId));
             $activities = $db->loadObjectList();
             if (count($activities) == 0) {
                 return;
             }
             //search through the parameters of the activities
             foreach ($activities as $activity) {
                 $params = new CParameter($activity->params);
                 $photoIds = $params->get('photosId');
                 $photoIds = explode(',', $photoIds);
                 if (in_array($uniqueId, $photoIds)) {
                     if (count($photoIds) > 1) {
                         //do not delete this activities as there is another photo associated with this activity
                         if (($key = array_search($uniqueId, $photoIds)) !== false) {
                             unset($photoIds[$key]);
                         }
                         $params->set('photosId', implode(',', $photoIds));
                         $activityTable = JTable::getInstance('Activity', 'CTable');
                         $activityTable->load($uniqueId);
                         //just update the activity will do
                         $activityTable->params = $params->toString();
                         $activityTable->store();
                     } else {
                         // just delete the activity
                         $db->setQuery("DELETE FROM " . $db->quoteName('#__community_activities') . " WHERE " . $db->quoteName('id') . ' = ' . $db->quote($activity->id));
                         $db->execute();
                     }
                 }
             }
             return;
             //return as the additional steps are not needed
             //we should remove the likes and comments <-- we should reaccess this query
             $additionalQuery = '(' . $db->quoteName('app') . '=' . $db->Quote($app) . ' OR ' . $db->quoteName('app') . '=' . $db->Quote('photos.comment') . ' OR ' . $db->quoteName('app') . '=' . $db->Quote('album.like') . ' OR ' . $db->quoteName('app') . '=' . $db->Quote('profile.avatar.upload') . ' OR ' . $db->quoteName('app') . '=' . $db->Quote('photo.like') . ')';
             break;
         case 'videos':
             $additionalQuery = '(' . $db->quoteName('app') . '=' . $db->Quote($app) . ' OR ' . $db->quoteName('app') . '=' . $db->Quote('videos.linking') . ' OR ' . $db->quoteName('app') . '=' . $db->Quote('videos.comment') . ' OR ' . $db->quoteName('app') . '=' . $db->Quote('videos.like') . ')';
             break;
         case 'albums':
             $additionalQuery = $db->quoteName('app') . ' like' . $db->Quote('%' . $app . '%');
             break;
         default:
             // this is the default state
             $additionalQuery = $db->quoteName('app') . '=' . $db->Quote($app);
     }
     $query = 'DELETE FROM ' . $db->quoteName('#__community_activities') . ' ' . 'WHERE ' . $additionalQuery . ' ' . 'AND ' . $db->quoteName('cid') . '=' . $db->Quote($uniqueId);
     $db->setQuery($query);
     $status = $db->query();
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     return $status;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:66,代码来源:activities.php

示例2: _createPhotoUploadStream

 private function _createPhotoUploadStream($album, $jsonObj)
 {
     $obj = json_decode($jsonObj);
     $photoIds = array();
     $batchcount = count($obj->files);
     foreach ($obj->files as $file) {
         $photoIds[] = $file->photoId;
     }
     $photoTable = JTable::getInstance('Photo', 'cTable');
     $photoTable->load($photoIds[count($photoIds) - 1]);
     $my = CFactory::getUser();
     $handler = $this->_getHandler($album);
     // Generate activity stream
     $act = new stdClass();
     $act->cmd = 'photo.upload';
     $act->actor = $my->id;
     $act->access = $album->permissions;
     $act->target = 0;
     $act->title = '';
     // Empty title, auto-generated by stream
     $act->content = '';
     // Gegenerated automatically by stream. No need to add anything
     $act->app = 'photos';
     $act->cid = $album->id;
     $act->location = $album->location;
     // Store group info
     // I hate to load group here, but unfortunately, album does
     // not store group permission setting
     $group = JTable::getInstance('Group', 'CTable');
     $group->load($album->groupid);
     $act->groupid = $album->groupid;
     $act->group_access = $group->approvals;
     // Allow comment on the album
     $act->comment_type = 'photos';
     $act->comment_id = $photoTable->id;
     // Allow like on the album
     $act->like_type = 'photo';
     $act->like_id = $photoTable->id;
     $params = new CParameter('');
     $params->set('multiUrl', $handler->getAlbumURI($album->id, false));
     $params->set('photoid', $photoTable->id);
     $params->set('action', 'upload');
     $params->set('photo_url', $photoTable->getThumbURI());
     $params->set('style', COMMUNITY_STREAM_STYLE);
     // Get the upload count per session
     $session = JFactory::getSession();
     $uploadSessionCount = $session->get('album-' . $album->id . '-upload', 0);
     $params->set('count', $uploadSessionCount);
     $params->set('batchcount', $batchcount);
     $params->set('photosId', implode(',', $photoIds));
     // Add activity logging
     CActivityStream::add($act, $params->toString());
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:53,代码来源:photos.php

示例3: saveWall

 /**
  * @param $uniqueId
  * @param $message
  * @param $appType
  * @param $creator
  * @param $isOwner
  * @param string $processFunc
  * @param string $templateFile
  * @param int $wallId
  * @param int $photoId to attach photoid in the wall if exists
  * @return stdClass
  */
 public static function saveWall($uniqueId, $message, $appType, &$creator, $isOwner, $processFunc = '', $templateFile = 'wall/content', $wallId = 0, $photoId = 0)
 {
     $my = CFactory::getUser();
     // Add some required parameters, otherwise assert here
     CError::assert($uniqueId, '', '!empty', __FILE__, __LINE__);
     CError::assert($appType, '', '!empty', __FILE__, __LINE__);
     CError::assert($my->id, '', '!empty', __FILE__, __LINE__);
     // Load the models
     $wall = JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     if ($wallId == 0) {
         // Get current date
         $now = JFactory::getDate();
         $now = $now->toSql();
         // Set the wall properties
         $wall->type = $appType;
         $wall->contentid = $uniqueId;
         $wall->post_by = $creator->id;
         $wall->date = $now;
         $wall->published = 1;
         // @todo: set the ip address
         $wall->ip = $_SERVER['REMOTE_ADDR'];
     }
     //if photo id is not 0, this wall is appended with a picture
     if ($photoId > 0) {
         //lets check if the photo belongs to the uploader
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($photoId);
         //save the data into the wall table
         $wallParam = new CParameter($wall->params);
         if ($photo->creator == $my->id && $photo->albumid == '-1') {
             $wallParam->set('attached_photo_id', $photoId);
             //sets the status to ready so that it wont be deleted on cron run
             $photo->status = 'ready';
             $photo->store();
         }
         $wall->params = $wallParam->toString();
     } elseif ($photoId == -1) {
         //if there is nothing, remove the param if applicable
         $wallParam = new CParameter($wall->params);
         //delete from db and files
         $photoModel = CFactory::getModel('photos');
         if ($wallParam->get('attached_photo_id') > 0) {
             $photoTable = $photoModel->getPhoto($wallParam->get('attached_photo_id'));
             $photoTable->delete();
         }
         $wallParam->set('attached_photo_id', 0);
         $wall->params = $wallParam->toString();
     }
     /* URL fetch */
     $graphObject = CParsers::linkFetch($message);
     if ($graphObject) {
         $graphObject->merge(new CParameter($wall->params));
         $wall->params = $graphObject->toString();
     }
     $wall->comment = $message;
     // Store the wall message
     $wall->store();
     // Convert it to array so that the walls can be processed by plugins
     $args = array();
     $args[0] = $wall;
     //Process wall comments
     $comment = new CComment();
     $wallComments = $wall->comment;
     $wall->comment = $comment->stripCommentData($wall->comment);
     // Trigger the wall comments
     CWall::triggerWallComments($args);
     $wallData = new stdClass();
     $wallData->id = $wall->id;
     $wallData->content = CWallLibrary::_getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile);
     $wallData->content = CStringHelper::replaceThumbnails($wallData->content);
     CTags::add($wall);
     return $wallData;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:86,代码来源:wall.php

示例4: ajaxeditComment

 public function ajaxeditComment($id, $value, $photoId = 0)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $actModel = CFactory::getModel('activities');
     $objResponse = new JAXResponse();
     $json = array();
     if ($my->id == 0) {
         $this->blockUnregister();
     }
     $wall = JTable::getInstance('wall', 'CTable');
     $wall->load($id);
     $cid = isset($wall->contentid) ? $wall->contentid : null;
     $activity = $actModel->getActivity($cid);
     $ownPost = $my->id == $wall->post_by;
     $targetPost = $activity->target == $my->id;
     $allowEdit = COwnerHelper::isCommunityAdmin() || ($ownPost || $targetPost) && !empty($my->id);
     $value = trim($value);
     if (empty($value)) {
         $json['error'] = JText::_('COM_COMMUNITY_CANNOT_EDIT_COMMENT_ERROR');
     } else {
         if ($config->get('wallediting') && $allowEdit) {
             $params = new CParameter($wall->params);
             //if photo id is not 0, this wall is appended with a picture
             if ($photoId > 0 && $params->get('attached_photo_id') != $photoId) {
                 //lets check if the photo belongs to the uploader
                 $photo = JTable::getInstance('Photo', 'CTable');
                 $photo->load($photoId);
                 if ($photo->creator == $my->id && $photo->albumid == '-1') {
                     $params->set('attached_photo_id', $photoId);
                     //sets the status to ready so that it wont be deleted on cron run
                     $photo->status = 'ready';
                     $photo->store();
                 }
             } else {
                 if ($photoId == -1) {
                     //if there is nothing, remove the param if applicable
                     //delete from db and files
                     $photoModel = CFactory::getModel('photos');
                     $photoTable = $photoModel->getPhoto($params->get('attached_photo_id'));
                     $photoTable->delete();
                     $params->set('attached_photo_id', 0);
                 }
             }
             $wall->params = $params->toString();
             $wall->comment = $value;
             $wall->store();
             $CComment = new CComment();
             $value = $CComment->stripCommentData($value);
             // Need to perform basic formatting here
             // 1. support nl to br,
             // 2. auto-link text
             $CTemplate = new CTemplate();
             $value = $origValue = $CTemplate->escape($value);
             $value = CStringHelper::autoLink($value);
             $value = nl2br($value);
             $value = CUserHelper::replaceAliasURL($value);
             $value = CStringHelper::getEmoticon($value);
             $json['comment'] = $value;
             $json['originalComment'] = $origValue;
             // $objResponse->addScriptCall("joms.jQuery('div[data-commentid=" . $id . "] .cStream-Content span.comment').html", $value);
             // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-editor] textarea").val', $origValue);
             // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-editor] textarea").removeData', 'initialized');
             // if ($photoId == -1) {
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-thumb").parent().remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-attachment").css("display", "none").attr("data-no_thumb", 1);');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-thumbnail").html', '<img/>');
             // } else if ($photoId != 0) {
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-fetch-wrapper").remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-thumb").parent().remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-content] .cStream-Meta").before', '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . JUri::root(true) ."/". $photo->thumbnail . '" /></div>');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-attachment").css("display", "block").removeAttr("data-no_thumb");');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-thumbnail img").attr("src", "' . JUri::root(true) ."/". $photo->thumbnail . '").attr("data-photo_id", "0").data("photo_id", 0);');
             // }
         } else {
             $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_EDIT');
         }
     }
     if (!isset($json['error'])) {
         $json['success'] = true;
     }
     die(json_encode($json));
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:83,代码来源:system.php

示例5: addShare

 /**
  * Function to share status
  * @param [Int] $activityId [description]
  * @param [JSON] $attachment [description]
  */
 public static function addShare($activityId, $attachment)
 {
     $my = CFactory::getUser();
     $params = new CParameter('');
     $attachment = json_decode($attachment);
     $act = new stdClass();
     $act->cmd = 'profile.status.share';
     $act->actor = $my->id;
     $act->target = $my->id;
     $act->title = $attachment->msg;
     $act->content = '';
     $act->app = 'profile.status.share';
     $act->verb = 'share';
     $act->cid = $my->id;
     $act->comment_id = CActivities::COMMENT_SELF;
     $act->comment_type = 'profile.status.share';
     $act->like_id = CActivities::LIKE_SELF;
     $act->like_type = 'profile.status.share';
     $act->access = $attachment->privacy;
     $params->set('activityId', $activityId);
     $act->params = $params->toString();
     return self::add($act);
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:28,代码来源:activities.php

示例6: removecover

 public function removecover()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $message = '';
     $userId = $jinput->post->get('userid', 0, 'INT');
     $my = CFactory::getUser();
     if ($userId == 0) {
         /* redirect back to current user profile */
         $url = CRoute::_('index.php?option=com_community&view=profile', false);
     } else {
         /* redirect back to viewing user profile */
         $url = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userId, false);
     }
     if ($my->id == 0) {
         return $this->blockUnregister();
     }
     //Admin and owner can use this function
     if (COwnerHelper::isCommunityAdmin($my->id) || $userId == $my->id) {
         $user = CFactory::getUser($userId);
         // User id should be valid and admin should not be allowed to block themselves.
         if ($user->id) {
             $userModel = CFactory::getModel('User');
             $userModel->removeProfileCover($user->id);
             $userTable = JTable::getInstance('Profile', 'CTable');
             $userTable->load($user->id);
             $params = new CParameter($userTable->params);
             $params->set('coverPosition', 0);
             $userTable->params = $params->toString();
             $userTable->store();
             $message = JText::_('COM_COMMUNITY_PROFILE_COVER_REMOVED');
         } else {
             $message = JText::_('COM_COMMUNITY_INVALID_PROFILE');
         }
     } else {
         $message = JText::_('COM_COMMUNITY_ADMIN_ACCESS_ONLY');
     }
     $mainframe->redirect($url, $message);
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:39,代码来源:profile.php

示例7: ajaxSaveField

 /**
  * AJAX method to save a field
  *
  * @param   int id  Current field id
  * @param   Array data  The fields data
  *
  * @return  JAXResponse object  Azrul's AJAX Response object
  **/
 public function ajaxSaveField($id, $data)
 {
     $user = JFactory::getUser();
     if ($user->get('guest')) {
         JError::raiseError(403, JText::_('COM_COMMUNITY_ACCESS_FORBIDDEN'));
         return;
     }
     $response = new JAXResponse();
     // Load the JTable Object.
     $row = JTable::getInstance('profiles', 'CommunityTable');
     $row->load($id);
     $isValid = true;
     $row->bindAjaxPost($data);
     // override the option visiable, registration and required for label type.
     if ($row->type == 'label') {
         //$row->visible         = 0;
         $row->required = 0;
     }
     // Do some validation before blindly saving the profile.
     if (empty($row->name)) {
         $error = JText::_('COM_COMMUNITY_PROFILE_NAME_EMPTY_WARN');
         $response->addScriptCall('joms.jQuery("#error-notice").html("' . $error . '");');
         $isValid = false;
     }
     if (empty($row->fieldcode)) {
         $error = JText::_('COM_COMMUNITY_PROFILE_FIELD_CODE_EMPTY_WARN');
         $response->addScriptCall('joms.jQuery("#error-notice").html("' . $error . '");');
         $isValid = false;
     }
     if (($row->type == 'select' || $row->type == 'singleselect' || $row->type == 'list' || $row->type == 'radio' || $row->type == 'checkbox') && empty($row->options)) {
         $error = JText::_('COM_COMMUNITY_PROFILE_FIELD_OPTIONS_EMPTY_WARN');
         $response->addScriptCall('joms.jQuery("#error-notice").html("' . $error . '");');
         $isValid = false;
     }
     if ($row->required && !$row->registration) {
         $error = JText::_('COM_COMMUNITY_PROFILE_FIELD_REQUIRED_CHECK_WARN');
         $response->addScriptCall('joms.jQuery("#error-notice").html("' . $error . '");');
         $isValid = false;
     }
     if ($isValid) {
         $groupOrdering = isset($data['group']) ? $data['group'] : '';
         /* Now, save optional params items */
         $xmlPath = JPATH_ROOT . '/components/com_community/libraries/fields/' . $row->type . '.xml';
         if (JFile::exists($xmlPath)) {
             $postvars = $data;
             $post = array();
             // convert $postvars to normal post
             $pattern = "'params\\[(.*?)\\]'s";
             for ($i = 0; $i < count($postvars); $i++) {
                 if (!empty($postvars[$i]) && is_array($postvars[$i])) {
                     $key = $postvars[$i][0];
                     // @TODO: support 'usergroup' param type
                     preg_match($pattern, $key, $matches);
                     if ($matches) {
                         $key = $matches[1];
                         $post[$key] = $postvars[$i][1];
                     }
                 }
             }
             $params = new CParameter('', $xmlPath);
             $params->bind($post);
             $row->params = $params->toString();
         }
         if ($row->type == 'gender') {
             $row->options = "COM_COMMUNITY_MALE\nCOM_COMMUNITY_FEMALE";
         } elseif ($row->type == 'country') {
             $row->options = 'Afghanistan' . "\n" . 'Albania' . "\n" . 'Algeria' . "\n" . 'American Samoa' . "\n" . 'Andorra' . "\n" . 'Angola' . "\n" . 'Anguilla' . "\n" . 'Antarctica' . "\n" . 'Antigua and Barbuda' . "\n" . 'Argentina' . "\n" . 'Armenia' . "\n" . 'Aruba' . "\n" . 'Australia' . "\n" . 'Austria' . "\n" . 'Azerbaijan' . "\n" . 'Bahamas' . "\n" . 'Bahrain' . "\n" . 'Bangladesh' . "\n" . 'Barbados' . "\n" . 'Belarus' . "\n" . 'Belgium' . "\n" . 'Belize' . "\n" . 'Benin' . "\n" . 'Bermuda' . "\n" . 'Bhutan' . "\n" . 'Bolivia' . "\n" . 'Bosnia and Herzegovina' . "\n" . 'Botswana' . "\n" . 'Bouvet Island' . "\n" . 'Brazil' . "\n" . 'British Indian Ocean Territory' . "\n" . 'Brunei Darussalam' . "\n" . 'Bulgaria' . "\n" . 'Burkina Faso' . "\n" . 'Burundi' . "\n" . 'Cambodia' . "\n" . 'Cameroon' . "\n" . 'Canada' . "\n" . 'Cape Verde' . "\n" . 'Cayman Islands' . "\n" . 'Central African Republic' . "\n" . 'Chad' . "\n" . 'Chile' . "\n" . 'China' . "\n" . 'Christmas Island' . "\n" . 'Cocos (Keeling) Islands' . "\n" . 'Colombia' . "\n" . 'Comoros' . "\n" . 'Congo' . "\n" . 'Cook Islands' . "\n" . 'Costa Rica' . "\n" . 'Cote D\'Ivoire (Ivory Coast)' . "\n" . 'Croatia (Hrvatska)' . "\n" . 'Cuba' . "\n" . 'Cyprus' . "\n" . 'Czechoslovakia (former)' . "\n" . 'Czech Republic' . "\n" . 'Denmark' . "\n" . 'Djibouti' . "\n" . 'Dominica' . "\n" . 'Dominican Republic' . "\n" . 'East Timor' . "\n" . 'Ecuador' . "\n" . 'Egypt' . "\n" . 'El Salvador' . "\n" . 'Equatorial Guinea' . "\n" . 'Eritrea' . "\n" . 'Estonia' . "\n" . 'Ethiopia' . "\n" . 'Falkland Islands (Malvinas)' . "\n" . 'Faroe Islands' . "\n" . 'Fiji' . "\n" . 'Finland' . "\n" . 'France' . "\n" . 'France, Metropolitan' . "\n" . 'French Guiana' . "\n" . 'French Polynesia' . "\n" . 'French Southern Territories' . "\n" . 'Gabon' . "\n" . 'Gambia' . "\n" . 'Georgia' . "\n" . 'Germany' . "\n" . 'Ghana' . "\n" . 'Gibraltar' . "\n" . 'Great Britain (UK)' . "\n" . 'Greece' . "\n" . 'Greenland' . "\n" . 'Grenada' . "\n" . 'Guadeloupe' . "\n" . 'Guam' . "\n" . 'Guatemala' . "\n" . 'Guinea' . "\n" . 'Guinea-Bissau' . "\n" . 'Guyana' . "\n" . 'Haiti' . "\n" . 'Heard and McDonald Islands' . "\n" . 'Honduras' . "\n" . 'Hong Kong' . "\n" . 'Hungary' . "\n" . 'Iceland' . "\n" . 'India' . "\n" . 'Indonesia' . "\n" . 'Iran' . "\n" . 'Iraq' . "\n" . 'Ireland' . "\n" . 'Israel' . "\n" . 'Italy' . "\n" . 'Jamaica' . "\n" . 'Japan' . "\n" . 'Jordan' . "\n" . 'Kazakhstan' . "\n" . 'Kenya' . "\n" . 'Kiribati' . "\n" . 'Korea, North' . "\n" . 'South Korea' . "\n" . 'Kuwait' . "\n" . 'Kyrgyzstan' . "\n" . 'Laos' . "\n" . 'Latvia' . "\n" . 'Lebanon' . "\n" . 'Lesotho' . "\n" . 'Liberia' . "\n" . 'Libya' . "\n" . 'Liechtenstein' . "\n" . 'Lithuania' . "\n" . 'Luxembourg' . "\n" . 'Macau' . "\n" . 'Macedonia' . "\n" . 'Madagascar' . "\n" . 'Malawi' . "\n" . 'Malaysia' . "\n" . 'Maldives' . "\n" . 'Mali' . "\n" . 'Malta' . "\n" . 'Marshall Islands' . "\n" . 'Martinique' . "\n" . 'Mauritania' . "\n" . 'Mauritius' . "\n" . 'Mayotte' . "\n" . 'Mexico' . "\n" . 'Micronesia' . "\n" . 'Moldova' . "\n" . 'Monaco' . "\n" . 'Mongolia' . "\n" . 'Montserrat' . "\n" . 'Morocco' . "\n" . 'Mozambique' . "\n" . 'Myanmar' . "\n" . 'Namibia' . "\n" . 'Nauru' . "\n" . 'Nepal' . "\n" . 'Netherlands' . "\n" . 'Netherlands Antilles' . "\n" . 'Neutral Zone' . "\n" . 'New Caledonia' . "\n" . 'New Zealand' . "\n" . 'Nicaragua' . "\n" . 'Niger' . "\n" . 'Nigeria' . "\n" . 'Niue' . "\n" . 'Norfolk Island' . "\n" . 'Northern Mariana Islands' . "\n" . 'Norway' . "\n" . 'Oman' . "\n" . 'Pakistan' . "\n" . 'Palau' . "\n" . 'Panama' . "\n" . 'Papua New Guinea' . "\n" . 'Paraguay' . "\n" . 'Peru' . "\n" . 'Philippines' . "\n" . 'Pitcairn' . "\n" . 'Poland' . "\n" . 'Portugal' . "\n" . 'Puerto Rico' . "\n" . 'Qatar' . "\n" . 'Reunion' . "\n" . 'Romania' . "\n" . 'Russian Federation' . "\n" . 'Rwanda' . "\n" . 'Saint Kitts and Nevis' . "\n" . 'Saint Lucia' . "\n" . 'Saint Vincent and the Grenadines' . "\n" . 'Samoa' . "\n" . 'San Marino' . "\n" . 'Sao Tome and Principe' . "\n" . 'Saudi Arabia' . "\n" . 'Senegal' . "\n" . 'Seychelles' . "\n" . 'S. Georgia and S. Sandwich Isls.' . "\n" . 'Sierra Leone' . "\n" . 'Singapore' . "\n" . 'Slovak Republic' . "\n" . 'Slovenia' . "\n" . 'Solomon Islands' . "\n" . 'Somalia' . "\n" . 'South Africa' . "\n" . 'Spain' . "\n" . 'Sri Lanka' . "\n" . 'St. Helena' . "\n" . 'St. Pierre and Miquelon' . "\n" . 'Sudan' . "\n" . 'Suriname' . "\n" . 'Svalbard and Jan Mayen Islands' . "\n" . 'Swaziland' . "\n" . 'Sweden' . "\n" . 'Switzerland' . "\n" . 'Syria' . "\n" . 'Taiwan' . "\n" . 'Tajikistan' . "\n" . 'Tanzania' . "\n" . 'Thailand' . "\n" . 'Togo' . "\n" . 'Tokelau' . "\n" . 'Tonga' . "\n" . 'Trinidad and Tobago' . "\n" . 'Tunisia' . "\n" . 'Turkey' . "\n" . 'Turkmenistan' . "\n" . 'Turks and Caicos Islands' . "\n" . 'Tuvalu' . "\n" . 'Uganda' . "\n" . 'Ukraine' . "\n" . 'United Arab Emirates' . "\n" . 'United Kingdom' . "\n" . 'United States' . "\n" . 'Uruguay' . "\n" . 'US Minor Outlying Islands' . "\n" . 'USSR (former)' . "\n" . 'Uzbekistan' . "\n" . 'Vanuatu' . "\n" . 'Vatican City State (Holy Sea)' . "\n" . 'Venezuela' . "\n" . 'Viet Nam' . "\n" . 'Virgin Islands (British)' . "\n" . 'Virgin Islands (U.S.)' . "\n" . 'Wallis and Futuna Islands' . "\n" . 'Western Sahara' . "\n" . 'Yemen' . "\n" . 'Yugoslavia' . "\n" . 'Zaire' . "\n" . 'Zambia' . "\n" . 'Zimbabwe';
         }
         $row->store($groupOrdering);
         $parent = '';
         // Get the view
         $view = $this->getView('profiles', 'html');
         if ($id != 0) {
             $name = '<a href="javascript:void(0);" onclick="azcommunity.editField(\'' . $row->id . '\');">' . $row->name . '</a>';
             $type = '<span id="type' . $row->id . '" onclick="$(\'typeOption\').style.display = \'block\';$(this).style.display = \'none\';">' . JString::ucfirst($row->type) . '</span>';
             $publish = $view->getPublish($row, 'published', 'profiles,ajaxTogglePublish');
             if ($row->type == 'label') {
                 $required = $view->showPublish($row, 'required');
                 //$visible      = $view->showPublish( $row , 'visible');
                 $visible = $view->getPublish($row, 'visible', 'profiles,ajaxTogglePublish');
             } else {
                 $required = $view->getPublish($row, 'required', 'profiles,ajaxTogglePublish');
                 $visible = $view->getPublish($row, 'visible', 'profiles,ajaxTogglePublish');
             }
             $registration = $view->getPublish($row, 'registration', 'profiles,ajaxTogglePublish');
             // Set the parent id
             $parent = $row->id;
             $response->addScriptCall('location.reload();');
         } else {
             $response->addScriptCall('location.reload();');
         }
         $response->addScriptCall('cWindowHide();');
//.........这里部分代码省略.........
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:101,代码来源:profiles.php

示例8: deleteFromCommunityActivities

 function deleteFromCommunityActivities($user)
 {
     $db = JFactory::getDBO();
     $sql = "DELETE\r\n\r\n\t\t\t\tFROM\r\n\t\t\t\t\t\t" . $db->quoteName("#__community_activities") . "\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t\t(" . $db->quoteName("actor") . " = " . $db->quote($user['id']) . " OR\r\n\t\t\t\t\t\t" . $db->quoteName("target") . " = " . $db->quote($user['id']) . ") AND\r\n\t\t\t\t\t\t" . $db->quoteName("archived") . " = " . $db->quote(0);
     $db->setQuery($sql);
     $db->Query();
     //remove from any user participation activity
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('*')->from($db->quoteName('#__community_activities'))->where($db->quoteName('actors') . ' LIKE ' . $db->quote('%"id":"' . $user['id'] . '"%'));
     $db->setQuery($query);
     $results = $db->loadObjectList();
     foreach ($results as $result) {
         // lets start with actors column
         $actors = new CParameter($result->actors);
         $actorsArr = $actors->get('userid');
         foreach ($actorsArr as $key => $actor) {
             if ($user['id'] == $actor->id) {
                 unset($actorsArr[$key]);
                 break;
             }
         }
         $actorsArr = array_values($actorsArr);
         $actors->set('userid', $actorsArr);
         $actorsUpdate = $actors->toString();
         // followed by the params
         $actors = new CParameter($result->params);
         $actorsArr = $actors->get('actors');
         $actorsArr = explode(',', $actorsArr);
         foreach ($actorsArr as $key => $actor) {
             if ($user['id'] == $actor) {
                 unset($actorsArr[$key]);
                 break;
             }
         }
         $actorsArr = implode(',', $actorsArr);
         $actors->set('actors', $actorsArr);
         $params = $actors->toString();
         $activityRec = new stdClass();
         $activityRec->id = $result->id;
         $activityRec->actors = $actorsUpdate;
         $activityRec->params = $params;
         JFactory::getDbo()->updateObject('#__community_activities', $activityRec, 'id');
     }
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:48,代码来源:jomsocialuser.php

示例9: communityAjaxEntry

        jimport('joomla.filesystem.file');
        $logFile = COMMUNITY_COM_PATH . '/access.log';
        $content = '';
        if (JFile::exists($logFile)) {
            $content = JFile::read(COMMUNITY_COM_PATH . '/access.log');
        }
        $params = new CParameter($content);
        $today = strftime('%Y-%m-%d');
        $loadTime = $params->get($today, 0);
        if ($loadTime > 0) {
            $loadTime = ($loadTime + (xdebug_time_index() - $tm)) / 2;
        } else {
            $loadTime = xdebug_time_index() - $tm;
        }
        $params->set($today, $loadTime);
        $paramsText = $params->toString();
        JFile::write(COMMUNITY_COM_PATH . '/access.log', $paramsText);
    }
    echo getJomSocialPoweredByLink();
    //	getTriggerCount
    //	$appLib = CAppPlugins::getInstance();
    //	echo 'Trigger count: '. $appLib->triggerCount . '<br/>';
    //	$time_end = microtime(true);
    //	$time = $time_end - $time_start;
    //	echo $time;
}
/**
 * Entry poitn for all ajax call
 */
function communityAjaxEntry($func, $args = null)
{
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:community.php

示例10: addMood

 public function addMood($mood)
 {
     $params = new CParameter($this->params);
     $params->set('mood', $mood);
     $this->params = $params->toString();
     if ($this->store()) {
         return true;
     }
     return false;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:10,代码来源:activity.php

示例11: save

 public function save()
 {
     // Check for request forgeries
     JRequest::checkToken('request') or jexit('Invalid Token');
     // initialise
     $postData = array();
     $logo_file = array();
     $logo_replace = 0;
     $save_image_ok = null;
     // get post data
     $postData = JRequest::get('post');
     $logo_file = JRequest::get('files');
     $session = JFactory::getSession();
     $token = $session->getFormToken(false);
     if (!empty($logo_file['network_Filedata'])) {
         $logo_image = $logo_file['network_Filedata'];
     }
     if (isset($postData['network_replace_image'])) {
         if ($postData['network_replace_image'] == 1) {
             $logo_replace = 1;
         }
     }
     // instanstiate the table
     JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
     $table = JTable::getInstance('configuration', 'CommunityTable');
     $table->load('config');
     $params = new CParameter($table->params);
     // save logo image
     if (!empty($logo_image['name']) && $logo_image['size'] > 0) {
         $save_image_ok = $this->saveImage($logo_image, $logo_replace);
     }
     // clean and limits to maximum 10 tags/keywords
     $filteredTags = explode(",", $postData['network_keywords']);
     foreach ($filteredTags as $key => $filteredTag) {
         $filteredTags[$key] = trim($filteredTag);
     }
     $filteredTags = array_unique($filteredTags);
     foreach ($filteredTags as $key => $filteredTag) {
         if (empty($filteredTag)) {
             unset($filteredTags[$key]);
         }
     }
     $filteredTags = array_slice($filteredTags, 0, 10);
     $postData['network_keywords'] = implode(", ", $filteredTags);
     // set data properly
     foreach ($postData as $key => $value) {
         // exclude unnecessary keys from form
         $wanted_keys = array('network_enable', 'network_description', 'network_keywords', 'network_join_url', 'network_logo_url', 'network_cron_freq', 'network_cron_last_run');
         if (in_array($key, $wanted_keys)) {
             $params->set($key, $value);
         }
     }
     // update data if new logo image saved
     if ($save_image_ok) {
         $params->set('logo_url', $save_image_ok);
     }
     // convert final data in INI string and put in table
     $table->params = $params->toString();
     // Save it
     if (!$table->store()) {
         return false;
     }
     return true;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:64,代码来源:network.php

示例12: addJSGroup

 static function addJSGroup($name, $description, $course_id, $website)
 {
     if (file_exists(JPATH_ADMINISTRATOR . '/components/com_community/tables/cache.php')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_community/tables/cache.php';
     }
     require_once JPATH_SITE . '/components/com_community/libraries/core.php';
     require_once JPATH_SITE . '/components/com_community/models/groups.php';
     $mainframe = JFactory::getApplication();
     // Get my current data.
     $validated = true;
     $group = JTable::getInstance('Group', 'CTable');
     $model = CFactory::getModel('groups');
     // @rule: Test for emptyness
     if (empty($name)) {
         $validated = false;
     }
     // @rule: Test if group exists
     if ($model->groupExist($name)) {
         $validated = false;
     }
     // @rule: Test for emptyness
     if (empty($description)) {
         $validated = false;
     }
     $categoryId = JoomdleHelperGroups::get_main_category();
     if (empty($categoryId)) {
         $validated = false;
     }
     if ($validated) {
         // Assertions
         // Category Id must not be empty and will cause failure on this group if its empty.
         CError::assert($categoryId, '', '!empty', __FILE__, __LINE__);
         // @rule: Retrieve params and store it back as raw string
         $params = new CParameter('');
         $discussordering = JRequest::getVar('discussordering', DISCUSSION_ORDER_BYLASTACTIVITY, 'REQUEST');
         $params->set('discussordering', $discussordering);
         $photopermission = JRequest::getVar('photopermission', GROUP_PHOTO_PERMISSION_ADMINS, 'REQUEST');
         $params->set('photopermission', $photopermission);
         $videopermission = JRequest::getVar('videopermission', GROUP_PHOTO_PERMISSION_ADMINS, 'REQUEST');
         $params->set('videopermission', $videopermission);
         $grouprecentphotos = JRequest::getVar('grouprecentphotos', GROUP_PHOTO_RECENT_LIMIT, 'REQUEST');
         $params->set('grouprecentphotos', $grouprecentphotos);
         $grouprecentvideos = JRequest::getVar('grouprecentvideos', GROUP_VIDEO_RECENT_LIMIT, 'REQUEST');
         $params->set('grouprecentvideos', $grouprecentvideos);
         $newmembernotification = JRequest::getVar('newmembernotification', '1', 'REQUEST');
         $params->set('newmembernotification', $newmembernotification);
         $joinrequestnotification = JRequest::getVar('joinrequestnotification', '1', 'REQUEST');
         $params->set('joinrequestnotification', $joinrequestnotification);
         $params->set('course_id', $course_id);
         CFactory::load('helpers', 'owner');
         $group->name = $name;
         $group->description = $description;
         $group->categoryid = $categoryId;
         $group->website = $website;
         $group->ownerid = JoomdleHelperSystem::get_admin_id();
         $group->created = gmdate('Y-m-d H:i:s');
         $group->approvals = 1;
         $group->params = $params->toString();
         // Set the default thumbnail and avatar for the group just in case
         // the user decides to skip this
         //   $group->thumb           = 'components/com_community/assets/group_thumb.jpg';
         //   $group->avatar          = 'components/com_community/assets/group.jpg';
         $group->published = 1;
         // Store the group now.
         $group->store();
         // Since this is storing groups, we also need to store the creator / admin
         // into the groups members table
         $member = JTable::getInstance('GroupMembers', 'CTable');
         $member->groupid = $group->id;
         $member->memberid = $group->ownerid;
         // Creator should always be 1 as approved as they are the creator.
         $member->approved = 1;
         // @todo: Setup required permissions in the future
         $member->permissions = '1';
         $member->store();
         // Increment the member count
         $group->updateStats();
         $group->store();
     }
     return "OK";
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:81,代码来源:groups.php

示例13: upload


//.........这里部分代码省略.........
         $imgType = $result['imgType'];
         $isDefaultPhoto = $result['isDefaultPhoto'];
         // Remove the filename extension from the caption
         if (JString::strlen($photoTable->caption) > 4) {
             $photoTable->caption = JString::substr($photoTable->caption, 0, JString::strlen($photoTable->caption) - 4);
         }
         // @todo: configurable options?
         // Permission should follow album permission
         $photoTable->published = '1';
         $photoTable->permissions = $album->permissions;
         // Set the relative path.
         // @todo: configurable path?
         $storedPath = $handler->getStoredPath($storage, $albumId);
         $storedPath = $storedPath . DS . $albumPath . $hashFilename . CImageHelper::getExtension($imageFile['type']);
         $photoTable->image = CString::str_ireplace(JPATH_ROOT . DS, '', $storedPath);
         $photoTable->thumbnail = CString::str_ireplace(JPATH_ROOT . DS, '', $thumbPath);
         //In joomla 1.6, CString::str_ireplace is not replacing the path properly. Need to do a check here
         if ($photoTable->image == $storedPath) {
             $photoTable->image = str_ireplace(JPATH_ROOT . DS, '', $storedPath);
         }
         if ($photoTable->thumbnail == $thumbPath) {
             $photoTable->thumbnail = str_ireplace(JPATH_ROOT . DS, '', $thumbPath);
         }
         //photo filesize, use sprintf to prevent return of unexpected results for large file.
         $photoTable->filesize = sprintf("%u", filesize($originalPath));
         // @rule: Set the proper ordering for the next photo upload.
         $photoTable->setOrdering();
         // Store the object
         $photoTable->store();
         // We need to see if we need to rotate this image, from EXIF orientation data
         // Only for jpeg image.
         if ($config->get('photos_auto_rotate') && $imgType == 'image/jpeg') {
             $this->_rotatePhoto($imageFile, $photoTable, $storedPath, $thumbPath);
         }
         // Trigger for onPhotoCreate
         CFactory::load('libraries', 'apps');
         $apps =& CAppPlugins::getInstance();
         $apps->loadApplications();
         $params = array();
         $params[] =& $photoTable;
         $apps->triggerEvent('onPhotoCreate', $params);
         // Set image as default if necessary
         // Load photo album table
         if ($isDefaultPhoto) {
             // Set the photo id
             $album->photoid = $photoTable->id;
             $album->store();
         }
         // @rule: Set first photo as default album cover if enabled
         if (!$isDefaultPhoto && $config->get('autoalbumcover')) {
             $photosModel = CFactory::getModel('Photos');
             $totalPhotos = $photosModel->getTotalPhotos($album->id);
             if ($totalPhotos <= 1) {
                 $album->photoid = $photoTable->id;
                 $album->store();
             }
         }
         // Generate activity stream
         $act = new stdClass();
         $act->cmd = 'photo.upload';
         $act->actor = $my->id;
         $act->access = $album->permissions;
         $act->target = 0;
         //$act->title	  	= JText::sprintf( $handler->getUploadActivityTitle() , '{photo_url}', $album->name );
         $act->title = JText::sprintf($handler->getUploadActivityTitle(), '{multiUrl}', $album->name);
         $act->content = '';
         // Gegenerated automatically by stream. No need to add anything
         $act->app = 'photos';
         $act->cid = $albumId;
         $act->location = $album->location;
         // Store group info
         // I hate to load group here, but unfortunately, album does
         // not store group permission setting
         $group =& JTable::getInstance('Group', 'CTable');
         $group->load($album->groupid);
         $act->groupid = $album->groupid;
         $act->group_access = $group->approvals;
         // Allow comment on the album
         $act->comment_type = 'photos.album';
         $act->comment_id = $albumId;
         // Allow like on the album
         $act->like_type = 'photos.album';
         $act->like_id = $albumId;
         $params = new CParameter('');
         $params->set('multiUrl', $handler->getAlbumURI($albumId, false));
         $params->set('photoid', $photoTable->id);
         $params->set('action', 'upload');
         $params->set('photo_url', $photoTable->getThumbURI());
         // Add activity logging
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act, $params->toString());
         //add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('photo.upload');
         // Photo upload was successfull, display a proper message
         $this->_showUploadError(false, JText::sprintf('COM_COMMUNITY_PHOTO_UPLOADED_SUCCESSFULLY', $photoTable->caption), $photoTable->getThumbURI(), $albumId, $photoTable->id);
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_FRONTPAGE, COMMUNITY_CACHE_TAG_ACTIVITIES));
     exit;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:101,代码来源:photos.php

示例14: ajaxSaveWall

 /**
  * @param $message    A message that is submitted by the user
  * @param $uniqueId    The unique id for this group
  * @param int $photoId
  */
 public function ajaxSaveWall($message, $uniqueId, $photoId = 0)
 {
     $filter = JFilterInput::getInstance();
     $uniqueId = $filter->clean($uniqueId, 'int');
     $photoId = $filter->clean($photoId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $response = new JAXResponse();
     $json = array();
     $my = CFactory::getUser();
     $video = JTable::getInstance('Video', 'CTable');
     $video->load($uniqueId);
     // If the content is false, the message might be empty.
     if (empty($message) && $photoId == 0) {
         $json['error'] = JText::_('COM_COMMUNITY_WALL_EMPTY_MESSAGE');
     } else {
         $config = CFactory::getConfig();
         // @rule: Spam checks
         if ($config->get('antispam_akismet_walls')) {
             //CFactory::load( 'libraries' , 'spamfilter' );
             $filter = CSpamFilter::getFilter();
             $filter->setAuthor($my->getDisplayName());
             $filter->setMessage($message);
             $filter->setEmail($my->email);
             $filter->setURL(CRoute::_('index.php?option=com_community&view=videos&task=video&videoid=' . $uniqueId));
             $filter->setType('message');
             $filter->setIP($_SERVER['REMOTE_ADDR']);
             if ($filter->isSpam()) {
                 $json['error'] = JText::_('COM_COMMUNITY_WALLS_MARKED_SPAM');
                 die(json_encode($json));
             }
         }
         //CFactory::load( 'libraries' , 'wall' );
         $wall = CWallLibrary::saveWall($uniqueId, $message, 'videos', $my, $my->id == $video->creator, 'videos,video', 'wall/content', 0, $photoId);
         // Add activity logging
         $url = $video->getViewUri(false);
         $params = new CParameter('');
         $params->set('videoid', $uniqueId);
         $params->set('action', 'wall');
         $params->set('wallid', $wall->id);
         $params->set('video_url', $url);
         $act = new stdClass();
         $act->cmd = 'videos.wall.create';
         $act->actor = $my->id;
         $act->access = $video->permissions;
         $act->target = 0;
         $act->title = JText::sprintf('COM_COMMUNITY_VIDEOS_ACTIVITIES_WALL_POST_VIDEO', '{video_url}', $video->title);
         $act->app = 'videos.comment';
         $act->cid = $uniqueId;
         $act->params = $params->toString();
         $act->groupid = $video->groupid;
         $act->eventid = $video->eventid;
         CActivityStream::add($act);
         // Add notification
         //CFactory::load( 'libraries' , 'notification' );
         $params = new CParameter('');
         $params->set('url', $url);
         $params->set('message', CUserHelper::replaceAliasURL($message));
         $params->set('video', $video->title);
         $params->set('video_url', $url);
         if ($my->id !== $video->creator) {
             CNotificationLibrary::add('videos_submit_wall', $my->id, $video->creator, JText::sprintf('COM_COMMUNITY_VIDEO_WALL_EMAIL_SUBJECT'), '', 'videos.wall', $params);
         } else {
             //for activity reply action
             //get relevent users in the activity
             $wallModel = CFactory::getModel('wall');
             $users = $wallModel->getAllPostUsers('videos', $video->id, $video->creator);
             if (!empty($users)) {
                 CNotificationLibrary::add('videos_reply_wall', $my->id, $users, JText::sprintf('COM_COMMUNITY_VIDEO_WALLREPLY_EMAIL_SUBJECT'), '', 'videos.wallreply', $params);
             }
         }
         //email and add notification if user are tagged
         $info = array('type' => 'video-comment', 'video_id' => $video->id);
         CUserHelper::parseTaggedUserNotification($message, CFactory::getUser($video->creator), $wall, $info);
         // Add user points
         CUserPoints::assignPoint('videos.comment');
         //@since 4.1 we dump the info into photo stats
         $statsModel = CFactory::getModel('stats');
         $statsModel->addVideoStats($video->id, 'comment');
         // Log user engagement
         CEngagement::log('video.comment', $my->id);
         $json['html'] = $wall->content;
         $json['success'] = true;
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
     die(json_encode($json));
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:93,代码来源:videos.php

示例15: ajaxSaveSettings

 /**
  *
  */
 public function ajaxSaveSettings($postvars)
 {
     // Check permissions
     $my = CFactory::getUser();
     $filter = JFilterInput::getInstance();
     $postvars = $filter->clean($postvars, 'array');
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     $json = array();
     $appsModel = CFactory::getModel('apps');
     $appName = $postvars['appname'];
     $id = $postvars['appid'];
     // @rule: Test if app is core app as we need to add into the db
     $pluginId = $appsModel->getPluginId($appName);
     $appParam = new CParameter($appsModel->getPluginParams($pluginId));
     if ($pluginId && $my->id != 0 && $appParam->get('coreapp')) {
         // Add new app in the community plugins table
         $appsModel->addApp($my->id, $appName);
         // @rule: For core applications, the ID might be referring to Joomla's id. Get the correct id if needed.
         $id = $appsModel->getUserApplicationId($appName, $my->id);
     }
     // Make sure this is valid for current user.
     if (!$appsModel->isOwned($my->id, $id)) {
         $json['error'] = JText::_('COM_COMMUNITY_PERMISSION_ERROR');
         die(json_encode($json));
     }
     $post = array();
     // convert $postvars to normal post
     $pattern = "'params\\[(.*?)\\]'s";
     for ($i = 0; $i < count($postvars); $i++) {
         if (!empty($postvars[$i]) && is_array($postvars[$i])) {
             $key = $postvars[$i][0];
             // Blogger view
             preg_match($pattern, $key, $matches);
             if ($matches) {
                 $key = $matches[1];
             }
             $post[$key] = $postvars[$i][1];
         }
     }
     //$xmlPath = JPATH_COMPONENT.'/applications/'.$appName.'/'.$appName.'.xml';
     $xmlPath = CPluginHelper::getPluginPath('community', $appName) . '/config.xml';
     $params = new CParameter($appsModel->getUserAppParams($id), $xmlPath);
     $params->bind($post);
     //echo $params->toString();
     $appsModel->storeParams($id, $params->toString());
     $json['success'] = true;
     die(json_encode($json));
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:53,代码来源:apps.php


注:本文中的CParameter::toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。