public function __construct($Sender)
 {
     deprecated('DiscussionSorterModule', 'DiscussionSortFilterModule', 'March 2016');
     parent::__construct($Sender, 'Vanilla');
     $this->Visible = false;
     // Default options
     $this->SortOptions = array('d.DateLastComment' => t('SortOptionLastComment', 'by Last Comment'), 'd.DateInserted' => t('SortOptionStartDate', 'by Start Date'));
     // Get sort option selected
     $this->SortFieldSelected = Gdn::session()->GetPreference('Discussions.SortField', 'd.DateLastComment');
 }
示例#2
0
 /**
  * Set the logger.
  *
  * @param LoggerInterface $logger Specify a new value to set the logger to.
  */
 public static function setLogger($logger = null)
 {
     if ($logger instanceof \Vanilla\Logger) {
         self::$instance = $logger;
     } else {
         deprecated('Logger::setLogger()', 'Logger::addLogger');
         // Check for class compatibility while we update plugins.
         // TODO: Remove this check.
         if ($logger instanceof LoggerInterface) {
             static::addLogger($logger);
         }
     }
 }
示例#3
0
 /**
  * Set the owner of the object. If multiple owners are passed then the first owner is the 
  * primary owner and the rest just share the object with the owner
  *
  * @param ComActorsDomainEntityActor $owner The owner object
  * 
  * @return ComBaseDomainEntityNode Return the ownable object
  */
 public function setOwner($owner)
 {
     //multiple owners are passed
     $owner = KConfig::unbox($owner);
     if (is_array($owner)) {
         deprecated('array as owner');
     }
     if (is_array($owner) && $this->isSharable()) {
         $owners = AnHelperArray::unique($owner);
         //remove the first owner as the primary owner
         $owner = array_shift($owners);
         //create an edge with the story for each secondary owner
         //$this->addOwner($owners);
     }
     $this->_mixer->set('owner', $owner);
     return $this;
 }
示例#4
0
 /**
  * @DEPRECATED: This class will be removed soon.
  * Render the iCalendar object as a text string which is a single VEVENT (or other)
  *
  * @param boolean $as_calendar Whether or not to wrap the event in a VCALENDAR
  * @param string $type The type of iCalendar object (VEVENT, VTODO, VFREEBUSY etc.)
  * @param array $restrict_properties The names of the properties we want in our rendered result.
  */
 function Render($as_calendar = true, $type = null, $restrict_properties = null)
 {
     deprecated('iCalendar::Render');
     if ($as_calendar) {
         return $this->component->Render();
     } else {
         $components = $this->component->GetComponents($type);
         $rendered = "";
         foreach ($components as $k => $v) {
             $rendered .= $v->Render($restrict_properties);
         }
         return $rendered;
     }
 }
示例#5
0
 /**
  * Deprecated.
  *
  * @return array Deprecated.
  */
 public function findThemeFiles()
 {
     deprecated('Gdn_ThemeManager->findThemeFiles');
     return [];
 }
 /**
  * Does actual de-authentication of a user. Used by SignOut().
  *
  * @access public
  * @since 2.0.0
  *
  * @param string $AuthenticationSchemeAlias
  * @param string $TransientKey Unique value to prove intent.
  */
 public function leave($AuthenticationSchemeAlias = 'default', $TransientKey = '')
 {
     deprecated(__FUNCTION__);
     $this->EventArguments['AuthenticationSchemeAlias'] = $AuthenticationSchemeAlias;
     $this->fireEvent('BeforeLeave');
     // Allow hijacking deauth type
     $AuthenticationSchemeAlias = $this->EventArguments['AuthenticationSchemeAlias'];
     try {
         $Authenticator = Gdn::authenticator()->authenticateWith($AuthenticationSchemeAlias);
     } catch (Exception $e) {
         $Authenticator = Gdn::authenticator()->authenticateWith('default');
     }
     // Only sign the user out if this is an authenticated postback! Start off pessimistic
     $this->Leaving = false;
     $Result = Gdn_Authenticator::REACT_RENDER;
     // Build these before doing anything desctructive as they are supposed to have user context
     $LogoutResponse = $Authenticator->logoutResponse();
     $LoginResponse = $Authenticator->loginResponse();
     $AuthenticatedPostbackRequired = $Authenticator->requireLogoutTransientKey();
     if (!$AuthenticatedPostbackRequired || Gdn::session()->validateTransientKey($TransientKey)) {
         $Result = $Authenticator->deauthenticate();
         $this->Leaving = true;
     }
     if ($Result == Gdn_Authenticator::AUTH_SUCCESS) {
         $this->View = 'leave';
         $Reaction = $LogoutResponse;
     } else {
         $this->View = 'auth/' . $Authenticator->getAuthenticationSchemeAlias();
         $Reaction = $LoginResponse;
     }
     switch ($Reaction) {
         case Gdn_Authenticator::REACT_RENDER:
             break;
         case Gdn_Authenticator::REACT_EXIT:
             exit;
             break;
         case Gdn_Authenticator::REACT_REMOTE:
             // Render the view, but set the delivery type to VIEW
             $this->_DeliveryType = DELIVERY_TYPE_VIEW;
             break;
         case Gdn_Authenticator::REACT_REDIRECT:
         default:
             // If we're just told to redirect, but not where... try to figure out somewhere that makes sense.
             if ($Reaction == Gdn_Authenticator::REACT_REDIRECT) {
                 $Route = '/';
                 $Target = $this->target();
                 if (!is_null($Target)) {
                     $Route = $Target;
                 }
             } else {
                 $Route = $Reaction;
             }
             if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
                 $this->RedirectUrl = url($Route);
             } else {
                 if ($Route !== false) {
                     redirect($Route);
                 } else {
                     redirect(Gdn::router()->getDestination('DefaultController'));
                 }
             }
             break;
     }
     $this->render();
 }
示例#7
0
 /**
  * Get the path of a view.
  *
  * @param string $View The name of the view.
  * @param string $Controller The name of the controller invoking the view or blank.
  * @param string $Folder The application folder or plugins/plugin folder.
  * @return string|false The path to the view or false if it wasn't found.
  * @deprecated
  */
 function viewLocation($View, $Controller, $Folder)
 {
     deprecated('viewLocation()');
     $Paths = array();
     if (strpos($View, '/') !== false) {
         // This is a path to the view from the root.
         $Paths[] = $View;
     } else {
         $View = strtolower($View);
         $Controller = strtolower(StringEndsWith($Controller, 'Controller', true, true));
         if ($Controller) {
             $Controller = '/' . $Controller;
         }
         $Extensions = array('tpl', 'php');
         // 1. First we check the theme.
         if (Gdn::Controller() && ($Theme = Gdn::Controller()->Theme)) {
             foreach ($Extensions as $Ext) {
                 $Paths[] = PATH_THEMES . "/{$Theme}/views{$Controller}/{$View}.{$Ext}";
             }
         }
         // 2. Then we check the application/plugin.
         if (StringBeginsWith($Folder, 'plugins/')) {
             // This is a plugin view.
             foreach ($Extensions as $Ext) {
                 $Paths[] = PATH_ROOT . "/{$Folder}/views{$Controller}/{$View}.{$Ext}";
             }
         } else {
             // This is an application view.
             $Folder = strtolower($Folder);
             foreach ($Extensions as $Ext) {
                 $Paths[] = PATH_APPLICATIONS . "/{$Folder}/views{$Controller}/{$View}.{$Ext}";
             }
             if ($Folder != 'dashboard' && StringEndsWith($View, '.master')) {
                 // This is a master view that can always fall back to the dashboard.
                 foreach ($Extensions as $Ext) {
                     $Paths[] = PATH_APPLICATIONS . "/dashboard/views{$Controller}/{$View}.{$Ext}";
                 }
             }
         }
     }
     // Now let's search the paths for the view.
     foreach ($Paths as $Path) {
         if (file_exists($Path)) {
             return $Path;
         }
     }
     Trace(array('view' => $View, 'controller' => $Controller, 'folder' => $Folder), 'View');
     Trace($Paths, 'ViewLocation()');
     return false;
 }
示例#8
0
 /**
  * Deprecated.
  *
  * @param bool $Enabled Deprecated.
  * @return array|bool Deprecated.
  * @deprecated
  */
 public function getAddonUpdates($Enabled = false)
 {
     deprecated('UpdateModel->getAddonUpdates()');
 }
示例#9
0
 /**
  * Allows the explicit definition of a schema to use.
  *
  * @param array $Schema
  * @deprecated This method has been deprecated in favor of {@link Gdn_Validation::SetSchema()}.
  */
 public function applySchema($Schema)
 {
     deprecated('ApplySchema', 'SetSchema');
     $this->setSchema($Schema);
 }
示例#10
0
 /**
  * Find the method to call on a controller, based on a path.
  *
  * @param Gdn_Controller $controller The controller or name of the controller class to look at.
  * @param string[] $pathArgs An array of path arguments.
  * @return array Returns an array in the form `[$methodName, $pathArgs]`.
  * If the method is not found then an empty string is returned for the method name.
  */
 private function findControllerMethod($controller, $pathArgs)
 {
     if ($this->methodExists($controller, reset($pathArgs))) {
         return [array_shift($pathArgs), $pathArgs];
     } elseif ($this->methodExists($controller, 'x' . reset($pathArgs))) {
         $method = array_shift($pathArgs);
         deprecated(get_class($controller) . "->x{$method}", get_class($controller) . "->{$method}");
         return ['x' . $method, $pathArgs];
     } elseif ($this->methodExists($controller, 'index')) {
         // "index" is the default controller method if an explicit method cannot be found.
         $this->EventArguments['PathArgs'] = $pathArgs;
         $this->fireEvent('MethodNotFound');
         return ['index', $pathArgs];
     } else {
         return ['', $pathArgs];
     }
 }
示例#11
0
 /**
  * Get the description of a given content type
  *
  * @param $pContentType Content type GUID you want the description for
  * @return Content type description
  * @access public
  **/
 function getContentTypeDescription($pContentType)
 {
     deprecated('You are calling the deprecated method getContentTypeDescription, use getContentTypeName( $pPlural )');
     return $this->getContentTypeName($pContentType);
 }
示例#12
0
 /**
  * @deprecated deprecated since version 2.0.0
  */
 function db_byte_decode(&$pData)
 {
     deprecated($this->depText('db_byte_decode', 'dbByteDecode'));
     return $this->dbByteDecode($pData);
 }
示例#13
0
 /**
  * hasAdminBlock
  *
  * @access public
  * @return TRUE on success, FALSE on failure
  * @deprecated i think this isn't used any more
  */
 function hasAdminBlock()
 {
     deprecated("i think this isn't used anymore.");
     global $gBitUser;
     // Let's find out if we are have admin perm or a root user
     $ret = TRUE;
     if (empty($gBitUser) || $gBitUser->isAdmin()) {
         $ret = FALSE;
     } else {
         // let's try to load up user_id - if successful, we know we have one.
         $rootUser = new BitPermUser(1);
         $rootUser->load();
         if (!$rootUser->isValid()) {
             $ret = FALSE;
         }
     }
     return $ret;
 }
示例#14
0
 /**
  * Delete records from a table.
  *
  * @param array|int $where The where clause to delete or an integer value.
  * @param array|true $options An array of options to control the delete.
  *
  *  - limit: A limit to the number of records to delete.
  *  - reset: Deprecated. Whether or not to reset this SQL statement after the delete. Defaults to false.
  * @return Gdn_Dataset Returns the result of the delete.
  */
 public function delete($where = [], $options = [])
 {
     if (is_numeric($where)) {
         deprecated('Gdn_Model->delete(int)', 'Gdn_Model->deleteID()');
         $where = array($this->PrimaryKey => $where);
     }
     $ResetData = false;
     if ($options === true || val('reset', $options)) {
         deprecated('Gdn_Model->delete() with reset true');
         $ResetData = true;
     } elseif (is_numeric($options)) {
         deprecated('The $limit parameter is deprecated in Gdn_Model->delete(). Use the limit option.');
         $limit = $options;
     } else {
         $limit = val('limit', $options);
     }
     if ($ResetData) {
         $Result = $this->SQL->delete($this->Name, $where, $limit);
     } else {
         $Result = $this->SQL->noReset()->delete($this->Name, $where, $limit);
     }
     return $Result;
 }
示例#15
0
 /**
  * Save conversation from form submission.
  *
  * @param array $formPostValues Values submitted via form.
  * @param array $settings Not used.
  * @return int Unique ID of conversation created or updated.
  */
 public function save($formPostValues, $settings = [])
 {
     if ($settings instanceof ConversationMessageModel) {
         deprecated('ConversationModel->save(array, ConversationMessageModel)');
         $MessageModel = $settings;
     } else {
         $MessageModel = ConversationMessageModel::instance();
     }
     // Define the primary key in this model's table.
     $this->defineSchema();
     $MessageModel->defineSchema();
     $this->EventArguments['FormPostValues'] = $formPostValues;
     $this->fireEvent('BeforeSaveValidation');
     if (!val('RecipientUserID', $formPostValues) && isset($formPostValues['To'])) {
         $To = explode(',', $formPostValues['To']);
         $To = array_map('trim', $To);
         $RecipientUserIDs = $this->SQL->select('UserID')->from('User')->whereIn('Name', $To)->get()->resultArray();
         $RecipientUserIDs = array_column($RecipientUserIDs, 'UserID');
         $formPostValues['RecipientUserID'] = $RecipientUserIDs;
     }
     if (c('Garden.ForceInputFormatter')) {
         $formPostValues['Format'] = c('Garden.InputFormatter');
     }
     // Add & apply any extra validation rules:
     $this->Validation->applyRule('Body', 'Required');
     $MessageModel->Validation->applyRule('Body', 'Required');
     // Make sure that there is at least one recipient
     $this->Validation->addRule('OneOrMoreArrayItemRequired', 'function:ValidateOneOrMoreArrayItemRequired');
     $this->Validation->applyRule('RecipientUserID', 'OneOrMoreArrayItemRequired');
     // Add insert/update fields
     $this->addInsertFields($formPostValues);
     $this->addUpdateFields($formPostValues);
     // Validate the form posted values
     $ConversationID = false;
     if ($this->validate($formPostValues) && $MessageModel->validate($formPostValues) && !$this->checkForSpam('Conversation')) {
         $Fields = $this->Validation->validationFields();
         // All fields on the form that relate to the schema
         // Define the recipients, and make sure that the sender is in the list
         $RecipientUserIDs = val('RecipientUserID', $Fields, 0);
         if (!in_array($formPostValues['InsertUserID'], $RecipientUserIDs)) {
             $RecipientUserIDs[] = $formPostValues['InsertUserID'];
         }
         // Also make sure there are no duplicates in the recipient list
         $RecipientUserIDs = array_unique($RecipientUserIDs);
         sort($RecipientUserIDs);
         $Fields = $this->Validation->schemaValidationFields();
         // All fields on the form that relate to the schema
         $ConversationID = $this->SQL->insert($this->Name, $Fields);
         $formPostValues['ConversationID'] = $ConversationID;
         // Notify the message model that it's being called as a direct result
         // of a new conversation being created. As of now, this is being used
         // so that spam checks between new conversations and conversation
         // messages each have a separate counter. Without this, a new
         // conversation will cause itself AND the message model spam counter
         // to increment by 1.
         $MessageID = $MessageModel->save($formPostValues, null, array('NewConversation' => true));
         $this->SQL->update('Conversation')->set('FirstMessageID', $MessageID)->where('ConversationID', $ConversationID)->put();
         // Now that the message & conversation have been inserted, insert all of the recipients
         foreach ($RecipientUserIDs as $UserID) {
             $CountReadMessages = $UserID == $formPostValues['InsertUserID'] ? 1 : 0;
             $this->SQL->options('Ignore', true)->insert('UserConversation', array('UserID' => $UserID, 'ConversationID' => $ConversationID, 'LastMessageID' => $MessageID, 'CountReadMessages' => $CountReadMessages, 'DateConversationUpdated' => $formPostValues['DateUpdated']));
         }
         // And update the CountUnreadConversations count on each user related to the discussion.
         $this->updateUserUnreadCount(array_diff($RecipientUserIDs, array($formPostValues['InsertUserID'])));
         $this->updateParticipantCount($ConversationID);
         $body = val('Body', $formPostValues, '');
         $subject = val('Subject', $Fields, '');
         $this->EventArguments['Recipients'] = $RecipientUserIDs;
         $Conversation = $this->getID($ConversationID);
         $this->EventArguments['Conversation'] = $Conversation;
         $Message = $MessageModel->getID($MessageID, DATASET_TYPE_ARRAY);
         $this->EventArguments['Message'] = $Message;
         $this->EventArguments['Body'] =& $body;
         $this->EventArguments['Subject'] =& $subject;
         $this->fireEvent('AfterAdd');
         // Add notifications (this isn't done by the conversationmessagemodule
         // because the conversation has not yet been created at the time they are
         // inserted)
         $UnreadData = $this->SQL->select('uc.UserID')->from('UserConversation uc')->where('uc.ConversationID', $ConversationID)->where('uc.UserID <>', $formPostValues['InsertUserID'])->get();
         $Activity = array('ActivityType' => 'ConversationMessage', 'ActivityUserID' => $formPostValues['InsertUserID'], 'HeadlineFormat' => t('HeadlineFormat.ConversationMessage', '{ActivityUserID,User} sent you a <a href="{Url,html}">message</a>'), 'RecordType' => 'Conversation', 'RecordID' => $ConversationID, 'Story' => $body, 'ActionText' => t('Reply'), 'Format' => val('Format', $formPostValues, c('Garden.InputFormatter')), 'Route' => "/messages/{$ConversationID}#Message_{$MessageID}");
         if ($subject) {
             $Activity['Story'] = sprintf(t('Re: %s'), $subject) . '<br>' . $body;
         }
         $ActivityModel = new ActivityModel();
         foreach ($UnreadData->result() as $User) {
             $Activity['NotifyUserID'] = $User->UserID;
             $ActivityModel->queue($Activity, 'ConversationMessage');
         }
         $ActivityModel->saveQueue();
     } else {
         // Make sure that all of the validation results from both validations are present for view by the form
         foreach ($MessageModel->validationResults() as $FieldName => $Results) {
             foreach ($Results as $Result) {
                 $this->Validation->addValidationResult($FieldName, $Result);
             }
         }
     }
     return $ConversationID;
 }
示例#16
0
 /**
  *
  *
  * @param null $Path
  * @return null|string
  * @todo Remove this.
  */
 public function autoTogglePath($Path = null)
 {
     deprecated('Gdn_Plugin->autoTogglePath()');
     if (is_null($Path)) {
         $PluginName = $this->getPluginIndex();
         $Path = '/dashboard/plugin/' . strtolower($PluginName) . '/toggle/' . Gdn::session()->transientKey();
     }
     return $Path;
 }
示例#17
0
 /**
  * Lookup the path to a JS file and return its info array
  *
  * @param string $filename name/relative path to js file
  * @param string $folder optional. app or plugin folder to search
  * @param string $themeType mobile or desktop
  * @return array|bool
  */
 public static function jsPath($filename, $folder = '', $themeType = '')
 {
     if (!$themeType) {
         $themeType = isMobile() ? 'mobile' : 'desktop';
     }
     // 1. Check for a url.
     if (isUrl($filename)) {
         return [$filename, $filename];
     }
     $paths = [];
     // 2. Check for a full path.
     if (strpos($filename, '/') === 0) {
         $filename = ltrim($filename, '/');
         // Direct path was given
         $filename = "/{$filename}";
         $path = PATH_ROOT . $filename;
         if (file_exists($path)) {
             deprecated(htmlspecialchars($path) . ": AssetModel::JsPath() with direct paths");
             return [$path, $filename];
         }
         return false;
     }
     // 3. Check the theme.
     $theme = Gdn::themeManager()->themeFromType($themeType);
     if ($theme) {
         $path = "/{$theme}/js/{$filename}";
         $paths[] = [PATH_THEMES . $path, "/themes{$path}"];
     }
     // 4. Static, Plugin, or App relative file
     if ($folder) {
         if (in_array($folder, ['resources', 'static'])) {
             $path = "/resources/js/{$filename}";
             $paths[] = [PATH_ROOT . $path, $path];
             // A plugin-relative path was given
         } elseif (stringBeginsWith($folder, 'plugins/')) {
             $folder = substr($folder, strlen('plugins/'));
             $path = "/{$folder}/js/{$filename}";
             $paths[] = [PATH_PLUGINS . $path, "/plugins{$path}"];
             // Allow direct-to-file links for plugins
             $paths[] = [PATH_PLUGINS . "/{$folder}/{$filename}", "/plugins/{$folder}/{$filename}", true];
             // deprecated
             // An app-relative path was given
         } else {
             // App-relative path under the theme
             if ($theme) {
                 $path = "/{$theme}/{$folder}/js/{$filename}";
                 $paths[] = [PATH_THEMES . $path, "/themes{$path}"];
             }
             $path = "/{$folder}/js/{$filename}";
             $paths[] = [PATH_APPLICATIONS . $path, "/applications{$path}"];
         }
     }
     // 5. Check the global js folder.
     $paths[] = [PATH_ROOT . "/js/{$filename}", "/js/{$filename}"];
     $paths[] = [PATH_ROOT . "/js/library/{$filename}", "/js/library/{$filename}"];
     foreach ($paths as $info) {
         if (file_exists($info[0])) {
             if (!empty($info[2])) {
                 // This path is deprecated.
                 unset($info[2]);
                 deprecated("The js file '{$filename}' in folder '{$folder}'");
             }
             return $info;
         }
     }
     if (!stringEndsWith($filename, 'custom.js')) {
         trace("Could not find file '{$filename}' in folder '{$folder}'.");
     }
     return false;
 }
示例#18
0
 /**
  * @see Gdn_Form::escapeFieldName()
  * @deprecated
  *
  * @param string $string
  * @return string
  */
 public function escapeString($string)
 {
     deprecated('Gd_Form::escapeString()');
     return $this->escapeFieldName($string);
 }
 /**
  * Set user preference for sorting discussions.
  *
  * @param string $Target The target to redirect to.
  */
 public function sort($Target = '')
 {
     deprecated("sort");
     if (!Gdn::session()->isValid()) {
         throw permissionException();
     }
     if (!$this->Request->isAuthenticatedPostBack()) {
         throw forbiddenException('GET');
     }
     if ($Target) {
         redirect($Target);
     }
     // Send sorted discussions.
     $this->setData('Deprecated', true);
     $this->deliveryMethod(DELIVERY_METHOD_JSON);
     $this->render();
 }
示例#20
0
 public function getGroupList()
 {
     deprecated(TRUE);
     return M('ReportGroup')->getGroupList();
 }
示例#21
0
 /**
  * Gets the locale sources for a given locale.
  *
  * @param string $locale The name of the locale.
  * @return array Returns an array of paths to the translations for the locale.
  * @deprecated Use the {@link AddonManager} for this.
  */
 public function getLocaleSources($locale)
 {
     deprecated('Gdn_PluginManager->getLocaleSources()', 'AddonManager->getEnabledLocaleSources()');
     $result = $this->addonManager->getEnabledTranslationPaths($locale);
     return $result;
 }
示例#22
0
 public function companyGroup()
 {
     M('Debug')->stacktrace();
     deprecated();
     return $this->getCompanyGroup();
 }
示例#23
0
 /**
  * Delete a category.
  *
  * {@inheritdoc}
  */
 public function delete($where = [], $options = [])
 {
     if (is_numeric($where) || is_object($where)) {
         deprecated('CategoryModel->delete()', 'CategoryModel->deleteandReplace()');
         $result = $this->deleteAndReplace($where, $options);
         return $result;
     }
     throw new \BadMethodCallException("CategoryModel->delete() is not supported.", 400);
 }
示例#24
0
 /**
  * Allows the definition of a masterview other than the default: "email.master".
  *
  * @deprecated since version 2.2
  * @param string $MasterView
  * @return Gdn_Email
  */
 public function masterView($MasterView)
 {
     deprecated(__METHOD__);
     return $this;
 }
示例#25
0
 /**
  * Set the list of emoji that can be used by the editor.
  *
  * @param array $value The new editor list.
  */
 public function setEmojiEditorList($value)
 {
     deprecated('setEmojiEditorList', 'setEditorList');
     return $this->setEditorList($value);
 }
示例#26
0
 /**
  * @deprecated deprecated since version 2.0.0
  */
 function getStyleCss($pStyle = NULL)
 {
     deprecated('Please use: BitThemes::getStyleCssFile()');
     return $this->getStyleCssFile($pStyle, TRUE);
 }
示例#27
0
 /**
  * Sync user data.
  *
  * @param array|int $CurrentUser
  * @param array $NewUser Data to overwrite user with.
  * @param bool $Force
  * @since 2.1
  * @deprecated since 2.2.
  */
 public function synchUser($CurrentUser, $NewUser, $Force = false)
 {
     deprecated('UserModel::synchUser', 'UserModel::syncUser');
     return $this->syncUser($CurrentUser, $NewUser, $Force);
 }
 /**
  * {@inheritdoc}
  * @deprecated
  */
 public function getCount($wheres = [])
 {
     deprecated('ConversationMessageModel->getCount()', 'ConversationMessageModel->getCountByConversation()');
     $args = func_get_args();
     return $this->getCountByConversation(val(0, $args, 0), val(1, $args, Gdn::session()->UserID), val(2, $args, ''));
 }
示例#29
0
 /**
  * Delete a comment.
  *
  * {@inheritdoc}
  */
 public function delete($where = [], $options = [])
 {
     if (is_numeric($where)) {
         deprecated('CommentModel->delete(int)', 'CommentModel->deleteID(int)');
         $result = $this->deleteID($where, $options);
         return $result;
     }
     throw new \BadMethodCallException("CommentModel->delete() is not supported.", 400);
 }
示例#30
0
 /**
  * Takes a mixed variable, formats it in the specified format type, and returns it.
  *
  * @param mixed $Mixed An object, array, or string to be formatted.
  * @param string $FormatMethod The method with which the variable should be formatted.
  * @return mixed
  */
 public static function to($Mixed, $FormatMethod)
 {
     // Process $Mixed based on its type.
     if (is_string($Mixed)) {
         if (in_array(strtolower($FormatMethod), self::$SanitizedFormats) && method_exists('Gdn_Format', $FormatMethod)) {
             $Mixed = self::$FormatMethod($Mixed);
         } elseif (function_exists('format' . $FormatMethod)) {
             deprecated('format' . $FormatMethod, 'gdn_formatter_' . $FormatMethod, '2015-10-26');
             $FormatMethod = 'format' . $FormatMethod;
             $Mixed = $FormatMethod($Mixed);
         } elseif (function_exists('gdn_formatter_' . $FormatMethod)) {
             $FormatMethod = 'gdn_formatter_' . $FormatMethod;
             $Mixed = $FormatMethod($Mixed);
         } elseif ($Formatter = Gdn::factory($FormatMethod . 'Formatter')) {
             $Mixed = $Formatter->format($Mixed);
         } else {
             $Mixed = Gdn_Format::text($Mixed);
         }
     } elseif (is_array($Mixed)) {
         foreach ($Mixed as $Key => $Val) {
             $Mixed[$Key] = self::to($Val, $FormatMethod);
         }
     } elseif (is_object($Mixed)) {
         foreach (get_object_vars($Mixed) as $Prop => $Val) {
             $Mixed->{$Prop} = self::to($Val, $FormatMethod);
         }
     }
     return $Mixed;
 }