/**
  * Change the owner of an addon.
  *
  * @param int $AddonID Addon to manage.
  * @throws Exception Addon not found.
  */
 public function changeOwner($AddonID)
 {
     $this->permission('Garden.Settings.Manage');
     $Addon = $this->AddonModel->getSlug($AddonID);
     if (!$Addon) {
         throw notFoundException('Addon');
     }
     if ($this->Form->authenticatedPostBack()) {
         $this->Form->validateRule('User', 'ValidateRequired');
         if ($this->Form->errorCount() == 0) {
             $NewUser = $this->Form->getFormValue('User');
             if (is_numeric($NewUser)) {
                 $User = Gdn::userModel()->getID($NewUser, DATASET_TYPE_ARRAY);
             } else {
                 $User = Gdn::userModel()->getByUsername($NewUser);
             }
             if (!$User) {
                 $this->Form->addError('@' . self::notFoundString('User', $NewUser));
             }
         }
         if ($this->Form->errorCount() == 0) {
             $this->AddonModel->setField($Addon['AddonID'], 'InsertUserID', val('UserID', $User));
         }
     } else {
         $this->Form->addError('You must POST to this page.');
     }
     $this->render();
 }
Esempio n. 2
0
 /**
  * Homepage of VanillaForums.org.
  *
  * @param Gdn_Controller $sender
  */
 public function homeController_homepage_create($sender)
 {
     try {
         $AddonModel = new AddonModel();
         $Addon = $AddonModel->getSlug('vanilla-core', true);
         $sender->setData('CountDownloads', val('CountDownloads', $Addon));
         $sender->setData('Version', val('Version', $Addon));
         $sender->setData('DateUploaded', val('DateInserted', $Addon));
     } catch (Exception $ex) {
     }
     $sender->title('The most powerful custom community solution in the world');
     $sender->setData('Description', "Vanilla is forum software that powers discussions on hundreds of thousands of sites. Built for flexibility and integration, Vanilla is the best, most powerful community solution in the world.");
     $sender->Head->addTag('meta', array('name' => 'description', 'content' => $sender->data('Description')));
     $sender->clearJsFiles();
     $sender->addJsFile('jquery.js', 'vforg');
     $sender->addJsFile('easySlider1.7.js', 'vforg');
     saveToConfig('Garden.Embed.Allow', false, false);
     // Prevent JS errors
     $sender->clearCssFiles();
     $sender->addCssFile('vforg-home.css', 'vforg');
     $sender->MasterView = 'empty';
     $sender->render('index', 'home', 'vforg');
 }