/**
  * Grabs all new notifications and adds them to the sender's inform queue.
  *
  * This method gets called by dashboard's hooks file to display new
  * notifications on every pageload. 
  *
  * @since 2.0.18
  * @access public
  *
  * @param Gdn_Controller $Sender The object calling this method.
  */
 public static function InformNotifications($Sender)
 {
     $Session = Gdn::Session();
     if (!$Session->IsValid()) {
         return;
     }
     $ActivityModel = new ActivityModel();
     // Get five pending notifications.
     $Where = array('NotifyUserID' => Gdn::Session()->UserID, 'Notified' => ActivityModel::SENT_PENDING);
     // If we're in the middle of a visit only get very recent notifications.
     $Where['DateUpdated >'] = Gdn_Format::ToDateTime(strtotime('-5 minutes'));
     $Activities = $ActivityModel->GetWhere($Where, 0, 5)->ResultArray();
     $ActivityIDs = ConsolidateArrayValuesByKey($Activities, 'ActivityID');
     $ActivityModel->SetNotified($ActivityIDs);
     foreach ($Activities as $Activity) {
         if ($Activity['Photo']) {
             $UserPhoto = Anchor(Img($Activity['Photo'], array('class' => 'ProfilePhotoMedium')), $Activity['Url'], 'Icon');
         } else {
             $UserPhoto = '';
         }
         $Excerpt = Gdn_Format::Display($Activity['Story']);
         $ActivityClass = ' Activity-' . $Activity['ActivityType'];
         $Sender->InformMessage($UserPhoto . Wrap($Activity['Headline'], 'div', array('class' => 'Title')) . Wrap($Excerpt, 'div', array('class' => 'Excerpt')), 'Dismissable AutoDismiss' . $ActivityClass . ($UserPhoto == '' ? '' : ' HasIcon'));
     }
 }
Ejemplo n.º 2
0
function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
    $CssClass = 'Item';
    $CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
    $CssClass .= $Alt . ' ';
    $CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
    $CssClass .= $Discussion->Closed == '1' ? ' Closed' : '';
    $CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
    $CssClass .= $Discussion->CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
    $Sender->EventArguments['Discussion'] =& $Discussion;
    $Sender->FireEvent('BeforeDiscussionName');
    $DiscussionName = Gdn_Format::Text($Discussion->Name);
    if ($DiscussionName == '') {
        $DiscussionName = T('Blank Discussion Topic');
    }
    static $FirstDiscussion = TRUE;
    if (!$FirstDiscussion) {
        $Sender->FireEvent('BetweenDiscussion');
    } else {
        $FirstDiscussion = FALSE;
    }
    ?>
<li class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($Discussion->FirstPhoto != '') {
        if (strtolower(substr($Discussion->FirstPhoto, 0, 7)) == 'http://' || strtolower(substr($Discussion->FirstPhoto, 0, 8)) == 'https://') {
            $PhotoUrl = $Discussion->FirstPhoto;
        } else {
            $PhotoUrl = 'uploads/' . ChangeBasename($Discussion->FirstPhoto, 'n%s');
        }
        echo Img($PhotoUrl, array('alt' => $Discussion->FirstName));
    }
    ?>
   <div class="ItemContent Discussion">
      <?php 
    echo Anchor($DiscussionName, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 && C('Vanilla.Comments.AutoOffset') ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
    ?>
      <?php 
    $Sender->FireEvent('AfterDiscussionTitle');
    ?>
      <div class="Meta">
         <span class="Author"><?php 
    echo $Discussion->FirstName;
    ?>
</span>
         <?php 
    echo '<span class="Counts' . ($Discussion->CountUnreadComments > 0 ? ' NewCounts' : '') . '">' . ($Discussion->CountUnreadComments > 0 ? $Discussion->CountUnreadComments . '/' : '') . $Discussion->CountComments . '</span>';
    if ($Discussion->LastCommentID != '') {
        echo '<span class="LastCommentBy">' . sprintf(T('Latest %1$s'), $Discussion->LastName) . '</span> ';
    }
    echo '<span class="LastCommentDate">' . Gdn_Format::Date($Discussion->FirstDate) . '</span> ';
    ?>
      </div>
   </div>
</li>
<?php 
}
Ejemplo n.º 3
0
 function UserPhoto($User, $CssClass = '')
 {
     $CssClass = $CssClass == '' ? '' : ' class="' . $CssClass . '"';
     if ($User->Photo != '') {
         $PhotoUrl = strtolower(substr($User->Photo, 0, 7)) == 'http://' ? $User->Photo : 'uploads/n' . $User->Photo;
         return '<a href="' . Url('/profile/' . $User->UserID . '/' . urlencode($User->Name)) . '"' . $CssClass . '>' . Img($PhotoUrl, array('alt' => urlencode($User->Name))) . '</a>';
     } else {
         return '';
     }
 }
Ejemplo n.º 4
0
 public function PluginController_MembersListEnh_Create($Sender)
 {
     $Session = Gdn::Session();
     if ($Sender->Menu && (CheckPermission('Plugins.MembersListEnh.GenView') || CheckPermission('Plugins.MembersListEnh.IPEmailView'))) {
         $Sender->ClearCssFiles();
         $Sender->AddCssFile('style.css');
         $Sender->MasterView = 'default';
         $Sender->Render('memtable', '', 'plugins/MembersListEnh');
     } else {
         echo Wrap(Anchor(Img('/plugins/MembersListEnh/design/AccessDenied.png', array('width' => '100%'), array('title' => T('You Have No Permission To View This Page Go Back'))), '/discussions', array('target' => '_self')), 'h1');
     }
 }
Ejemplo n.º 5
0
 public static function connectButton($Provider, $Options = array())
 {
     if (!is_array($Provider)) {
         $Provider = self::getProvider($Provider);
     }
     $Url = htmlspecialchars(self::connectUrl($Provider));
     $Data = $Provider;
     $Target = Gdn::Request()->Get('Target');
     if (!$Target) {
         $Target = '/' . ltrim(Gdn::Request()->Path());
     }
     if (StringBeginsWith($Target, '/entry/signin')) {
         $Target = '/';
     }
     $ConnectQuery = array('client_id' => $Provider['AuthenticationKey'], 'Target' => $Target);
     $Data['Target'] = urlencode(Url('entry/jsconnect', TRUE) . '?' . http_build_query($ConnectQuery));
     $Data['Redirect'] = $Data['target'] = $Data['redirect'] = $Data['Target'];
     $SignInUrl = FormatString(GetValue('SignInUrl', $Provider, ''), $Data);
     $RegisterUrl = FormatString(GetValue('RegisterUrl', $Provider, ''), $Data);
     if ($RegisterUrl && !GetValue('NoRegister', $Options)) {
         $RegisterLink = ' ' . Anchor(sprintf(T('Register with %s', 'Register'), $Provider['Name']), $RegisterUrl, 'Button RegisterLink');
     } else {
         $RegisterLink = '';
     }
     if (IsMobile()) {
         $PopupWindow = '';
     } else {
         $PopupWindow = 'PopupWindow';
     }
     if (GetValue('NoConnectLabel', $Options)) {
         $ConnectLabel = '';
     } else {
         $ConnectLabel = '<span class="Username"></span><div class="ConnectLabel TextColor">' . sprintf(T('Sign In with %s'), $Provider['Name']) . '</div>';
     }
     if (!C('Plugins.JsConnect.NoGuestCheck')) {
         $Result = '<div style="display: none" class="JsConnect-Container ConnectButton Small UserInfo" rel="' . $Url . '">';
         if (!GetValue('IsDefault', $Provider)) {
             $Result .= '<div class="JsConnect-Guest">' . Anchor(sprintf(T('Sign In with %s'), $Provider['Name']), $SignInUrl, 'Button Primary SignInLink') . $RegisterLink . '</div>';
         }
         $Result .= '<div class="JsConnect-Connect"><a class="ConnectLink">' . Img('https://cd8ba0b44a15c10065fd-24461f391e20b7336331d5789078af53.ssl.cf1.rackcdn.com/images/usericon_50.png', array('class' => 'ProfilePhotoSmall UserPhoto')) . $ConnectLabel . '</a></div>';
         $Result .= '</div>';
     } else {
         if (!GetValue('IsDefault', $Provider)) {
             $Result = '<div class="JsConnect-Guest">' . Anchor(sprintf(T('Sign In with %s'), $Provider['Name']), $SignInUrl, 'Button Primary SignInLink') . $RegisterLink . '</div>';
         }
     }
     return $Result;
 }
Ejemplo n.º 6
0
function writeConnection($Row)
{
    $c = Gdn::controller();
    $Connected = val('Connected', $Row);
    ?>
    <li id="<?php 
    echo "Provider_{$Row['ProviderKey']}";
    ?>
" class="Item">
        <div class="Connection-Header">
         <span class="IconWrap">
            <?php 
    echo img(val('Icon', $Row, Asset('/applications/dashboard/design/images/connection-64.png')));
    ?>
         </span>
         <span class="Connection-Name">
            <?php 
    echo val('Name', $Row, t('Unknown'));
    if ($Connected) {
        echo ' <span class="Gloss Connected">';
        if ($Photo = valr('Profile.Photo', $Row)) {
            echo ' ' . Img($Photo, array('class' => 'ProfilePhoto ProfilePhotoSmall'));
        }
        echo ' ' . htmlspecialchars(GetValueR('Profile.Name', $Row)) . '</span>';
    }
    ?>
         </span>
         <span class="Connection-Connect">
            <?php 
    echo ConnectButton($Row);
    ?>
         </span>
        </div>
        <!--      <div class="Connection-Body">
         <?php 
    //         if (Debug()) {
    //            decho(val($Row['ProviderKey'], $c->User->Attributes), 'Attributes');
    //         }
    ?>
      </div>-->
    </li>
<?php 
}
Ejemplo n.º 7
0
    echo anchor($Name, userUrl($Session->User), 'Profile');
    echo anchor(t('Sign Out'), SignOutUrl(), 'Leave');
}
?>
        </div>
    </div>
    <div id="Body">
        <div id="Panel">
            <?php 
$this->RenderAsset('Panel');
?>
        </div>
        <div id="Content"><?php 
$this->RenderAsset('Content');
?>
</div>
    </div>
    <div id="Foot">
        <?php 
$this->RenderAsset('Foot');
echo '<div class="Version">Version ', APPLICATION_VERSION, '</div>';
echo wrap(Anchor(Img('/applications/dashboard/design/images/logo_footer.png', array('alt' => 'Vanilla Forums')), c('Garden.VanillaUrl')), 'div');
?>
    </div>
</div>
<?php 
$this->fireEvent('AfterBody');
?>
</body>
</html>
Ejemplo n.º 8
0
?>
</td>
         <td><?php 
echo T('Thumbnail');
?>
</td>
      </tr>
   </thead>
   <tbody>
      <tr>
         <td>
            <?php 
echo Img(Gdn_Upload::Url(ChangeBasename($this->User->Photo, 'p%s')), array('id' => 'cropbox'));
?>
         </td>
         <td>
            <div style="<?php 
echo 'width:' . $this->ThumbSize . 'px;height:' . $this->ThumbSize . 'px;';
?>
overflow:hidden;">
               <?php 
echo Img(Gdn_Upload::Url(ChangeBasename($this->User->Photo, 'p%s')), array('id' => 'preview'));
?>
            </div>
         </td>
      </tr>
   </tbody>
</table>

<?php 
echo $this->Form->Close('Save', '', array('class' => 'Button Primary'));
Ejemplo n.º 9
0
            <td class="<?php 
            echo $ColClass;
            ?>
">
               <?php 
            echo '<h4>';
            echo $ThemeUrl != '' ? Url($ThemeName, $ThemeUrl) : $ThemeName;
            if ($Version != '') {
                $Info = sprintf(T('Version %s'), $Version);
            }
            if ($Author != '') {
                $Info .= sprintf('by %s', $AuthorUrl != '' ? Anchor($Author, $AuthorUrl) : $Author);
            }
            echo '</h4>';
            if ($PreviewImage) {
                echo Anchor(Img('/themes/' . $ThemeFolder . '/' . $PreviewImage, array('alt' => $ThemeName, 'height' => '112', 'width' => '150')), 'dashboard/settings/previewtheme/' . $ThemeFolder, '', array('target' => '_top'));
            }
            echo '<div class="Buttons">';
            echo Anchor('Apply', 'dashboard/settings/themes/' . $ThemeFolder . '/' . $Session->TransientKey(), 'SmallButton', array('target' => '_top'));
            echo Anchor('Preview', 'dashboard/settings/previewtheme/' . $ThemeFolder, 'SmallButton', array('target' => '_top'));
            echo '</div>';
            $Description = ArrayValue('Description', $ThemeInfo);
            if ($Description) {
                echo '<em>' . $Description . '</em>';
            }
            $RequiredApplications = ArrayValue('RequiredApplications', $ThemeInfo, FALSE);
            if (is_array($RequiredApplications)) {
                echo '<dl>
                        <dt>' . T('Requires') . '</dt>
                        <dd>';
                $i = 0;
Ejemplo n.º 10
0
   function UserPhoto($User, $Options = array()) {
		$User = (object)$User;
      if (is_string($Options))
         $Options = array('LinkClass' => $Options);
      
      $LinkClass = GetValue('LinkClass', $Options, 'ProfileLink');
      $ImgClass = GetValue('ImageClass', $Options, 'ProfilePhotoBig');
      
      $LinkClass = $LinkClass == '' ? '' : ' class="'.$LinkClass.'"';
      if ($User->Photo) {
         if (!preg_match('`^https?://`i', $User->Photo)) {
            $PhotoUrl = Gdn_Upload::Url(ChangeBasename($User->Photo, 'n%s'));
         } else {
            $PhotoUrl = $User->Photo;
         }
         
         return '<a title="'.htmlspecialchars($User->Name).'" href="'.Url('/profile/'.$User->UserID.'/'.rawurlencode($User->Name)).'"'.$LinkClass.'>'
            .Img($PhotoUrl, array('alt' => htmlspecialchars($User->Name), 'class' => $ImgClass))
            .'</a>';
      } else {
         return '';
      }
   }
Ejemplo n.º 11
0
 /**
  * Takes a user object, and writes out an anchor of the user's icon to the user's profile.
  *
  * @param object|array $User A user object or array.
  * @param array $Options
  */
 function userPhoto($User, $Options = array())
 {
     if (is_string($Options)) {
         $Options = array('LinkClass' => $Options);
     }
     if ($Px = GetValue('Px', $Options)) {
         $User = UserBuilder($User, $Px);
     } else {
         $User = (object) $User;
     }
     $LinkClass = ConcatSep(' ', GetValue('LinkClass', $Options, ''), 'PhotoWrap');
     $ImgClass = GetValue('ImageClass', $Options, 'ProfilePhoto');
     $Size = GetValue('Size', $Options);
     if ($Size) {
         $LinkClass .= " PhotoWrap{$Size}";
         $ImgClass .= " {$ImgClass}{$Size}";
     } else {
         $ImgClass .= " {$ImgClass}Medium";
         // backwards compat
     }
     $FullUser = Gdn::UserModel()->GetID(GetValue('UserID', $User), DATASET_TYPE_ARRAY);
     $UserCssClass = GetValue('_CssClass', $FullUser);
     if ($UserCssClass) {
         $LinkClass .= ' ' . $UserCssClass;
     }
     $LinkClass = $LinkClass == '' ? '' : ' class="' . $LinkClass . '"';
     $Photo = GetValue('Photo', $User);
     $Name = GetValue('Name', $User);
     $Title = htmlspecialchars(GetValue('Title', $Options, $Name));
     if ($FullUser && $FullUser['Banned']) {
         $Photo = C('Garden.BannedPhoto', 'http://cdn.vanillaforums.com/images/banned_large.png');
         $Title .= ' (' . T('Banned') . ')';
     }
     if (!$Photo && function_exists('UserPhotoDefaultUrl')) {
         $Photo = UserPhotoDefaultUrl($User, $ImgClass);
     }
     if ($Photo) {
         if (!isUrl($Photo)) {
             $PhotoUrl = Gdn_Upload::Url(ChangeBasename($Photo, 'n%s'));
         } else {
             $PhotoUrl = $Photo;
         }
         $Href = Url(UserUrl($User));
         return '<a title="' . $Title . '" href="' . $Href . '"' . $LinkClass . '>' . Img($PhotoUrl, array('alt' => $Name, 'class' => $ImgClass)) . '</a>';
     } else {
         return '';
     }
 }
Ejemplo n.º 12
0
?>
<div class="Connect">
	<h1><?php 
echo StringIsNullOrEmpty($ConnectSource) ? T("Sign in") : sprintf(T('%s Connect'), $ConnectSource);
?>
</h1>
	<div>
	<?php 
echo $this->Form->Open();
echo $this->Form->Errors();
if ($ConnectName || $ConnectPhoto) {
    ?>
		<div class="MeBox">
			<?php 
    if ($ConnectPhoto) {
        echo '<span class="PhotoWrap">', Img($ConnectPhoto, array('alt' => T('Profile Picture'), 'class' => 'ProfilePhoto')), '</span>';
    }
    echo '<div class="WhoIs">';
    if ($ConnectName && $ConnectSource) {
        $NameFormat = T('You are connected as %s through %s.');
    } elseif ($ConnectName) {
        $NameFormat = T('You are connected as %s.');
    } elseif ($ConnectSource) {
        $NameFormat = T('You are connected through %2$s.');
    } else {
        $NameFormat = '';
    }
    $NameFormat = '%1$s';
    echo sprintf($NameFormat, '<span class="Name">' . htmlspecialchars($ConnectName) . '</span>', '<span class="Source">' . htmlspecialchars($ConnectSource) . '</span>');
    echo Wrap(T('ConnectCreateAccount', 'Add Info &amp; Create Account'), 'h3');
    echo '</div>';
Ejemplo n.º 13
0
    $Col = 0;
    foreach ($this->Data('AvailableThemes') as $ThemeName => $ThemeInfo) {
        $ScreenName = GetValue('Name', $ThemeInfo, $ThemeName);
        $ThemeFolder = GetValue('Folder', $ThemeInfo, '');
        $Active = $ThemeFolder == $this->Data('EnabledThemeFolder');
        $Version = GetValue('Version', $ThemeInfo, '');
        $ThemeUrl = GetValue('Url', $ThemeInfo, '');
        $Author = GetValue('Author', $ThemeInfo, '');
        $AuthorUrl = GetValue('AuthorUrl', $ThemeInfo, '');
        $NewVersion = GetValue('NewVersion', $ThemeInfo, '');
        $Upgrade = $NewVersion != '' && version_compare($NewVersion, $Version, '>');
        $PreviewUrl = GetValue('MobileScreenshotUrl', $ThemeInfo, FALSE);
        $Description = GetValue('Description', $ThemeInfo);
        $RequiredApplications = GetValue('RequiredApplications', $ThemeInfo, FALSE);
        $ClassCurrentTheme = $EnabledThemeInfo['Index'] == $ThemeInfo['Index'] ? 'current-theme' : '';
        $PreviewImageHtml = $PreviewUrl !== FALSE ? Anchor(Img($PreviewUrl, array('alt' => $ScreenName)), $PreviewUrl, '', array('class' => 'theme-image mfp-image')) : '<div class="theme-image"></div>';
        $DescriptionHtml = $Description ? '<em class="theme-description">' . $Description . '</em>' : '';
        $Col++;
        if ($Col == 1) {
            $ColClass = 'FirstCol';
            echo '<tr>';
        } elseif ($Col == 2) {
            $ColClass = 'MiddleCol';
        } else {
            $ColClass = 'LastCol';
            $Col = 0;
        }
        ?>

         <td class="themeblock <?php 
        echo $ClassCurrentTheme;
Ejemplo n.º 14
0
echo Wrap(T('FaviconDescription', "Your site's favicon appears in your browser's title bar. It will be scaled to 16x16 pixels."), 'div', array('class' => 'Info'));
$Favicon = $this->Data('Favicon');
if ($Favicon) {
    echo Wrap(Img(Gdn_Upload::Url($Favicon)), 'div');
    echo Wrap(Anchor(T('Remove Favicon'), '/dashboard/settings/removefavicon/' . $Session->TransientKey(), 'SmallButton'), 'div', array('style' => 'padding: 10px 0;'));
    echo Wrap(T('FaviconBrowse', 'Browse for a new favicon if you would like to change it:'), 'div', array('class' => 'Info'));
} else {
    echo Wrap(T('FaviconDescription', "The shortcut icon that shows up in your browser's bookmark menu (16x16 px)."), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('Favicon', 'file');
?>
         </li>
         <li>
            <?php 
echo $this->Form->Label('Share Image', 'ShareImage');
echo Wrap(T('ShareImageDescription', "When someone shares a link from your site we try and grab an image from the page. If there isn't an image on the page then we'll use this image instead. The image should be at least 50&times;50, but we recommend 200&times;200."), 'div', array('class' => 'Info'));
$ShareImage = $this->Data('ShareImage');
if ($ShareImage) {
    echo Wrap(Img(Gdn_Upload::Url($ShareImage), array('style' => 'max-width: 300px')), 'div');
    echo Wrap(Anchor(T('Remove Image'), '/dashboard/settings/removeshareimage', 'SmallButton Hijack'), 'div', array('style' => 'padding: 10px 0;'));
    echo Wrap(T('FaviconBrowse', 'Browse for a new favicon if you would like to change it:'), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('ShareImage', 'file');
?>
         </li>
      </ul>
   </div>
</div>
<?php 
echo '<div class="Buttons">' . $this->Form->Button('Save') . '</div>';
echo $this->Form->Close();
Ejemplo n.º 15
0
 /**
  * Format a serialized string of image properties as html.
  * @param string $Body a serialized array of image properties (Image, Thumbnail, Caption)
  */
 public static function Image($Body)
 {
     if (is_string($Body)) {
         $Image = @unserialize($Body);
         if (!$Image) {
             return Gdn_Format::Html($Body);
         }
     }
     $Url = GetValue('Image', $Image);
     $Caption = Gdn_Format::PlainText(GetValue('Caption', $Image));
     return '<div class="ImageWrap">' . '<div class="Image">' . Img($Url, array('alt' => $Caption, 'title' => $Caption)) . '</div>' . '<div class="Caption">' . $Caption . '</div>' . '</div>';
 }
Ejemplo n.º 16
0
 /**
  * Create or update a comment.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $DiscussionID Unique ID to add the comment to. If blank, this method will throw an error.
  */
 public function Comment($DiscussionID = '')
 {
     // Get $DiscussionID from RequestArgs if valid
     if ($DiscussionID == '' && count($this->RequestArgs)) {
         if (is_numeric($this->RequestArgs[0])) {
             $DiscussionID = $this->RequestArgs[0];
         }
     }
     // If invalid $DiscussionID, get from form.
     $this->Form->SetModel($this->CommentModel);
     $DiscussionID = is_numeric($DiscussionID) ? $DiscussionID : $this->Form->GetFormValue('DiscussionID', 0);
     // Set discussion data
     $this->DiscussionID = $DiscussionID;
     $this->Discussion = $Discussion = $this->DiscussionModel->GetID($DiscussionID);
     // Is this an embedded comment being posted to a discussion that doesn't exist yet?
     $vanilla_type = $this->Form->GetFormValue('vanilla_type', '');
     $vanilla_url = $this->Form->GetFormValue('vanilla_url', '');
     $vanilla_category_id = $this->Form->GetFormValue('vanilla_category_id', '');
     $Attributes = array('ForeignUrl' => $vanilla_url);
     $vanilla_identifier = $this->Form->GetFormValue('vanilla_identifier', '');
     // Only allow vanilla identifiers of 32 chars or less - md5 if larger
     if (strlen($vanilla_identifier) > 32) {
         $Attributes['vanilla_identifier'] = $vanilla_identifier;
         $vanilla_identifier = md5($vanilla_identifier);
     }
     if (!$Discussion && $vanilla_url != '' && $vanilla_identifier != '') {
         $Discussion = $Discussion = $this->DiscussionModel->GetForeignID($vanilla_identifier, $vanilla_type);
         if ($Discussion) {
             $this->DiscussionID = $DiscussionID = $Discussion->DiscussionID;
             $this->Form->SetValue('DiscussionID', $DiscussionID);
         }
     }
     // If so, create it!
     if (!$Discussion && $vanilla_url != '' && $vanilla_identifier != '') {
         // Add these values back to the form if they exist!
         $this->Form->AddHidden('vanilla_identifier', $vanilla_identifier);
         $this->Form->AddHidden('vanilla_type', $vanilla_type);
         $this->Form->AddHidden('vanilla_url', $vanilla_url);
         $this->Form->AddHidden('vanilla_category_id', $vanilla_category_id);
         $PageInfo = FetchPageInfo($vanilla_url);
         if (!($Title = $this->Form->GetFormValue('Name'))) {
             $Title = GetValue('Title', $PageInfo, '');
             if ($Title == '') {
                 $Title = T('Undefined discussion subject.');
             }
         }
         $Description = GetValue('Description', $PageInfo, '');
         $Images = GetValue('Images', $PageInfo, array());
         $LinkText = T('EmbededDiscussionLinkText', 'Read the full story here');
         if (!$Description && count($Images) == 0) {
             $Body = FormatString('<p><a href="{Url}">{LinkText}</a></p>', array('Url' => $vanilla_url, 'LinkText' => $LinkText));
         } else {
             $Body = FormatString('
         <div class="EmbeddedContent">{Image}<strong>{Title}</strong>
            <p>{Excerpt}</p>
            <p><a href="{Url}">{LinkText}</a></p>
            <div class="ClearFix"></div>
         </div>', array('Title' => $Title, 'Excerpt' => $Description, 'Image' => count($Images) > 0 ? Img(GetValue(0, $Images), array('class' => 'LeftAlign')) : '', 'Url' => $vanilla_url, 'LinkText' => $LinkText));
         }
         if ($Body == '') {
             $Body = $vanilla_url;
         }
         if ($Body == '') {
             $Body = T('Undefined discussion body.');
         }
         // Validate the CategoryID for inserting.
         $Category = CategoryModel::Categories($vanilla_category_id);
         if (!$Category) {
             $vanilla_category_id = C('Vanilla.Embed.DefaultCategoryID', 0);
             if ($vanilla_category_id <= 0) {
                 // No default category defined, so grab the first non-root category and use that.
                 $vanilla_category_id = $this->DiscussionModel->SQL->Select('CategoryID')->From('Category')->Where('CategoryID >', 0)->Get()->FirstRow()->CategoryID;
                 // No categories in the db? default to 0
                 if (!$vanilla_category_id) {
                     $vanilla_category_id = 0;
                 }
             }
         } else {
             $vanilla_category_id = $Category['CategoryID'];
         }
         $EmbedUserID = C('Garden.Embed.UserID');
         if ($EmbedUserID) {
             $EmbedUser = Gdn::UserModel()->GetID($EmbedUserID);
         }
         if (!$EmbedUserID || !$EmbedUser) {
             $EmbedUserID = Gdn::UserModel()->GetSystemUserID();
         }
         $EmbeddedDiscussionData = array('InsertUserID' => $EmbedUserID, 'DateInserted' => Gdn_Format::ToDateTime(), 'DateUpdated' => Gdn_Format::ToDateTime(), 'CategoryID' => $vanilla_category_id, 'ForeignID' => $vanilla_identifier, 'Type' => $vanilla_type, 'Name' => $Title, 'Body' => $Body, 'Format' => 'Html', 'Attributes' => serialize($Attributes));
         $this->EventArguments['Discussion'] = $EmbeddedDiscussionData;
         $this->FireEvent('BeforeEmbedDiscussion');
         $DiscussionID = $this->DiscussionModel->SQL->Insert('Discussion', $EmbeddedDiscussionData);
         $ValidationResults = $this->DiscussionModel->ValidationResults();
         if (count($ValidationResults) == 0 && $DiscussionID > 0) {
             $this->Form->AddHidden('DiscussionID', $DiscussionID);
             // Put this in the form so reposts won't cause new discussions.
             $this->Form->SetFormValue('DiscussionID', $DiscussionID);
             // Put this in the form values so it is used when saving comments.
             $this->SetJson('DiscussionID', $DiscussionID);
             $this->Discussion = $Discussion = $this->DiscussionModel->GetID($DiscussionID, DATASET_TYPE_OBJECT, array('Slave' => FALSE));
             // Update the category discussion count
             if ($vanilla_category_id > 0) {
                 $this->DiscussionModel->UpdateDiscussionCount($vanilla_category_id, $DiscussionID);
             }
         }
     }
     // If no discussion was found, error out
     if (!$Discussion) {
         $this->Form->AddError(T('Failed to find discussion for commenting.'));
     }
     $PermissionCategoryID = GetValue('PermissionCategoryID', $Discussion);
     // Setup head
     $this->AddJsFile('jquery.autosize.min.js');
     $this->AddJsFile('post.js');
     $this->AddJsFile('autosave.js');
     // Setup comment model, $CommentID, $DraftID
     $Session = Gdn::Session();
     $CommentID = isset($this->Comment) && property_exists($this->Comment, 'CommentID') ? $this->Comment->CommentID : '';
     $DraftID = isset($this->Comment) && property_exists($this->Comment, 'DraftID') ? $this->Comment->DraftID : '';
     $this->EventArguments['CommentID'] = $CommentID;
     $this->EventArguments['DraftID'] = $DraftID;
     // Determine whether we are editing
     $Editing = $CommentID > 0 || $DraftID > 0;
     $this->EventArguments['Editing'] = $Editing;
     // If closed, cancel & go to discussion
     if ($Discussion && $Discussion->Closed == 1 && !$Editing && !$Session->CheckPermission('Vanilla.Discussions.Close', TRUE, 'Category', $PermissionCategoryID)) {
         Redirect(DiscussionUrl($Discussion));
     }
     // Add hidden IDs to form
     $this->Form->AddHidden('DiscussionID', $DiscussionID);
     $this->Form->AddHidden('CommentID', $CommentID);
     $this->Form->AddHidden('DraftID', $DraftID, TRUE);
     // Check permissions
     if ($Discussion && $Editing) {
         // Permisssion to edit
         if ($this->Comment->InsertUserID != $Session->UserID) {
             $this->Permission('Vanilla.Comments.Edit', TRUE, 'Category', $Discussion->PermissionCategoryID);
         }
         // Make sure that content can (still) be edited.
         $EditContentTimeout = C('Garden.EditContentTimeout', -1);
         $CanEdit = $EditContentTimeout == -1 || strtotime($this->Comment->DateInserted) + $EditContentTimeout > time();
         if (!$CanEdit) {
             $this->Permission('Vanilla.Comments.Edit', TRUE, 'Category', $Discussion->PermissionCategoryID);
         }
         // Make sure only moderators can edit closed things
         if ($Discussion->Closed) {
             $this->Permission('Vanilla.Comments.Edit', TRUE, 'Category', $Discussion->PermissionCategoryID);
         }
         $this->Form->SetFormValue('CommentID', $CommentID);
     } else {
         if ($Discussion) {
             // Permission to add
             $this->Permission('Vanilla.Comments.Add', TRUE, 'Category', $Discussion->PermissionCategoryID);
         }
     }
     if (!$this->Form->IsPostBack()) {
         // Form was validly submitted
         if (isset($this->Comment)) {
             $this->Form->SetData((array) $this->Comment);
         }
     } else {
         // Save as a draft?
         $FormValues = $this->Form->FormValues();
         $FormValues = $this->CommentModel->FilterForm($FormValues);
         if ($DraftID == 0) {
             $DraftID = $this->Form->GetFormValue('DraftID', 0);
         }
         $Type = GetIncomingValue('Type');
         $Draft = $Type == 'Draft';
         $this->EventArguments['Draft'] = $Draft;
         $Preview = $Type == 'Preview';
         if ($Draft) {
             $DraftID = $this->DraftModel->Save($FormValues);
             $this->Form->AddHidden('DraftID', $DraftID, TRUE);
             $this->Form->SetValidationResults($this->DraftModel->ValidationResults());
         } else {
             if (!$Preview) {
                 // Fix an undefined title if we can.
                 if ($this->Form->GetFormValue('Name') && GetValue('Name', $Discussion) == T('Undefined discussion subject.')) {
                     $Set = array('Name' => $this->Form->GetFormValue('Name'));
                     if (isset($vanilla_url) && $vanilla_url && strpos(GetValue('Body', $Discussion), T('Undefined discussion subject.')) !== FALSE) {
                         $LinkText = T('EmbededDiscussionLinkText', 'Read the full story here');
                         $Set['Body'] = FormatString('<p><a href="{Url}">{LinkText}</a></p>', array('Url' => $vanilla_url, 'LinkText' => $LinkText));
                     }
                     $this->DiscussionModel->SetField(GetValue('DiscussionID', $Discussion), $Set);
                 }
                 $Inserted = !$CommentID;
                 $CommentID = $this->CommentModel->Save($FormValues);
                 // The comment is now half-saved.
                 if (is_numeric($CommentID) && $CommentID > 0) {
                     if ($this->_DeliveryType == DELIVERY_TYPE_ALL) {
                         $this->CommentModel->Save2($CommentID, $Inserted, TRUE, TRUE);
                     } else {
                         $this->JsonTarget('', Url("/vanilla/post/comment2.json?commentid={$CommentID}&inserted={$Inserted}"), 'Ajax');
                     }
                     // $Discussion = $this->DiscussionModel->GetID($DiscussionID);
                     $Comment = $this->CommentModel->GetID($CommentID, DATASET_TYPE_OBJECT, array('Slave' => FALSE));
                     $this->EventArguments['Discussion'] = $Discussion;
                     $this->EventArguments['Comment'] = $Comment;
                     $this->FireEvent('AfterCommentSave');
                 } elseif ($CommentID === SPAM || $CommentID === UNAPPROVED) {
                     $this->StatusMessage = T('CommentRequiresApprovalStatus', 'Your comment will appear after it is approved.');
                 }
                 $this->Form->SetValidationResults($this->CommentModel->ValidationResults());
                 if ($CommentID > 0 && $DraftID > 0) {
                     $this->DraftModel->Delete($DraftID);
                 }
             }
         }
         // Handle non-ajax requests first:
         if ($this->_DeliveryType == DELIVERY_TYPE_ALL) {
             if ($this->Form->ErrorCount() == 0) {
                 // Make sure that this form knows what comment we are editing.
                 if ($CommentID > 0) {
                     $this->Form->AddHidden('CommentID', $CommentID);
                 }
                 // If the comment was not a draft
                 if (!$Draft) {
                     // Redirect to the new comment.
                     if ($CommentID > 0) {
                         Redirect("discussion/comment/{$CommentID}/#Comment_{$CommentID}");
                     } elseif ($CommentID == SPAM) {
                         $this->SetData('DiscussionUrl', DiscussionUrl($Discussion));
                         $this->View = 'Spam';
                     }
                 } elseif ($Preview) {
                     // If this was a preview click, create a comment shell with the values for this comment
                     $this->Comment = new stdClass();
                     $this->Comment->InsertUserID = $Session->User->UserID;
                     $this->Comment->InsertName = $Session->User->Name;
                     $this->Comment->InsertPhoto = $Session->User->Photo;
                     $this->Comment->DateInserted = Gdn_Format::Date();
                     $this->Comment->Body = ArrayValue('Body', $FormValues, '');
                     $this->Comment->Format = GetValue('Format', $FormValues, C('Garden.InputFormatter'));
                     $this->AddAsset('Content', $this->FetchView('preview'));
                 } else {
                     // If this was a draft save, notify the user about the save
                     $this->InformMessage(sprintf(T('Draft saved at %s'), Gdn_Format::Date()));
                 }
             }
         } else {
             // Handle ajax-based requests
             if ($this->Form->ErrorCount() > 0) {
                 // Return the form errors
                 $this->ErrorMessage($this->Form->Errors());
             } else {
                 // Make sure that the ajax request form knows about the newly created comment or draft id
                 $this->SetJson('CommentID', $CommentID);
                 $this->SetJson('DraftID', $DraftID);
                 if ($Preview) {
                     // If this was a preview click, create a comment shell with the values for this comment
                     $this->Comment = new stdClass();
                     $this->Comment->InsertUserID = $Session->User->UserID;
                     $this->Comment->InsertName = $Session->User->Name;
                     $this->Comment->InsertPhoto = $Session->User->Photo;
                     $this->Comment->DateInserted = Gdn_Format::Date();
                     $this->Comment->Body = ArrayValue('Body', $FormValues, '');
                     $this->View = 'preview';
                 } elseif (!$Draft) {
                     // If the comment was not a draft
                     // If Editing a comment
                     if ($Editing) {
                         // Just reload the comment in question
                         $this->Offset = 1;
                         $Comments = $this->CommentModel->GetIDData($CommentID, array('Slave' => FALSE));
                         $this->SetData('Comments', $Comments);
                         $this->SetData('Discussion', $Discussion);
                         // Load the discussion
                         $this->ControllerName = 'discussion';
                         $this->View = 'comments';
                         // Also define the discussion url in case this request came from the post screen and needs to be redirected to the discussion
                         $this->SetJson('DiscussionUrl', DiscussionUrl($this->Discussion) . '#Comment_' . $CommentID);
                     } else {
                         // If the comment model isn't sorted by DateInserted or CommentID then we can't do any fancy loading of comments.
                         $OrderBy = GetValueR('0.0', $this->CommentModel->OrderBy());
                         //                     $Redirect = !in_array($OrderBy, array('c.DateInserted', 'c.CommentID'));
                         //							$DisplayNewCommentOnly = $this->Form->GetFormValue('DisplayNewCommentOnly');
                         //                     if (!$Redirect) {
                         //                        // Otherwise load all new comments that the user hasn't seen yet
                         //                        $LastCommentID = $this->Form->GetFormValue('LastCommentID');
                         //                        if (!is_numeric($LastCommentID))
                         //                           $LastCommentID = $CommentID - 1; // Failsafe back to this new comment if the lastcommentid was not defined properly
                         //
                         //                        // Don't reload the first comment if this new comment is the first one.
                         //                        $this->Offset = $LastCommentID == 0 ? 1 : $this->CommentModel->GetOffset($LastCommentID);
                         //                        // Do not load more than a single page of data...
                         //                        $Limit = C('Vanilla.Comments.PerPage', 30);
                         //
                         //                        // Redirect if the new new comment isn't on the same page.
                         //                        $Redirect |= !$DisplayNewCommentOnly && PageNumber($this->Offset, $Limit) != PageNumber($Discussion->CountComments - 1, $Limit);
                         //                     }
                         //                     if ($Redirect) {
                         //                        // The user posted a comment on a page other than the last one, so just redirect to the last page.
                         //                        $this->RedirectUrl = Gdn::Request()->Url("discussion/comment/$CommentID/#Comment_$CommentID", TRUE);
                         //                     } else {
                         //                        // Make sure to load all new comments since the page was last loaded by this user
                         //								if ($DisplayNewCommentOnly)
                         $this->Offset = $this->CommentModel->GetOffset($CommentID);
                         $Comments = $this->CommentModel->GetIDData($CommentID, array('Slave' => FALSE));
                         $this->SetData('Comments', $Comments);
                         $this->SetData('NewComments', TRUE);
                         $this->ClassName = 'DiscussionController';
                         $this->ControllerName = 'discussion';
                         $this->View = 'comments';
                         //                     }
                         // Make sure to set the user's discussion watch records
                         $CountComments = $this->CommentModel->GetCount($DiscussionID);
                         $Limit = is_object($this->Data('Comments')) ? $this->Data('Comments')->NumRows() : $Discussion->CountComments;
                         $Offset = $CountComments - $Limit;
                         $this->CommentModel->SetWatch($this->Discussion, $Limit, $Offset, $CountComments);
                     }
                 } else {
                     // If this was a draft save, notify the user about the save
                     $this->InformMessage(sprintf(T('Draft saved at %s'), Gdn_Format::Date()));
                 }
                 // And update the draft count
                 $UserModel = Gdn::UserModel();
                 $CountDrafts = $UserModel->GetAttribute($Session->UserID, 'CountDrafts', 0);
                 $this->SetJson('MyDrafts', T('My Drafts'));
                 $this->SetJson('CountDrafts', $CountDrafts);
             }
         }
     }
     // Include data for FireEvent
     if (property_exists($this, 'Discussion')) {
         $this->EventArguments['Discussion'] = $this->Discussion;
     }
     if (property_exists($this, 'Comment')) {
         $this->EventArguments['Comment'] = $this->Comment;
     }
     $this->FireEvent('BeforeCommentRender');
     if ($this->DeliveryType() == DELIVERY_TYPE_DATA) {
         $Comment = $this->Data('Comments')->FirstRow(DATASET_TYPE_ARRAY);
         if ($Comment) {
             $Photo = $Comment['InsertPhoto'];
             if (strpos($Photo, '//') === FALSE) {
                 $Photo = Gdn_Upload::Url(ChangeBasename($Photo, 'n%s'));
             }
             $Comment['InsertPhoto'] = $Photo;
         }
         $this->Data = array('Comment' => $Comment);
         $this->RenderData($this->Data);
     } else {
         require_once $this->FetchViewLocation('helper_functions', 'Discussion');
         // Render default view.
         $this->Render();
     }
 }
Ejemplo n.º 17
0
?>
</h1>
<?php 
echo $this->Form->Open(array('enctype' => 'multipart/form-data'));
echo $this->Form->Errors();
?>
<ul>
   <li>
      <?php 
echo $this->Form->Label('Banner Title', 'Garden.Title');
echo Wrap(T('The banner title appears on the top-left of every page. If a banner logo is uploaded, it will replace the banner title on user-facing forum pages.'), 'div', array('class' => 'Info'));
echo $this->Form->TextBox('Garden.Title');
?>
   </li>
   <li>
      <?php 
echo $this->Form->Label('Banner Logo', 'Garden.Logo');
$Logo = $this->Data('Logo');
if ($Logo) {
    echo Wrap(Img(Gdn_Upload::Url($Logo)), 'div');
    echo Wrap(Anchor(T('Remove Banner Logo'), '/dashboard/settings/removelogo/' . $Session->TransientKey(), 'SmallButton'), 'div', array('style' => 'padding: 10px 0;'));
    echo Wrap(T('Browse for a new banner logo if you would like to change it:'), 'div', array('class' => 'Info'));
} else {
    echo Wrap(T('The banner logo appears at the top of your forum.'), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('Logo', 'file');
?>
   </li>
</ul>
<?php 
echo $this->Form->Close('Save');
Ejemplo n.º 18
0
 function ThumbnailImage($Data, $Attributes = False)
 {
     if (function_exists('Debug') && Debug()) {
         Deprecated(__FUNCTION__, 'Thumbnail');
     }
     $Width = ArrayValue('width', $Attributes, '');
     $Height = ArrayValue('height', $Attributes, '');
     if (Is_Array($Data)) {
         // group, todo
         // <ul><li><a></a></li>
     }
     $Prefix = substr($Data, 0, 7);
     //if(In_Array($Prefix, array('http://', 'https:/'))) {}
     //$bLocalImage = False;
     if ($Prefix != 'http://') {
         //$bLocalImage = True;
         $IncomingImage = $Data;
         $ImageFindPaths[] = 'uploads' . DS . $Data;
         $ImageFindPaths[] = $Data;
         foreach ($ImageFindPaths as $File) {
             if (file_exists($File) && is_file($File)) {
                 $IncomingImage = $File;
                 break;
             }
         }
     } else {
         $IncomingImage = $Data;
     }
     $CacheDirectory = 'uploads/cached';
     if (!is_writable($CacheDirectory)) {
         mkdir($CacheDirectory, 0777, True);
         if (!is_writable($CacheDirectory)) {
             $ErrorMessage = ErrorMessage(sprintf(T('Directory (%s) is not writable.'), $CacheDirectory), 'PHP', __FUNCTION__);
             trigger_error($ErrorMessage, E_USER_ERROR);
             return '';
         }
     }
     $Name = CleanupString(pathinfo($IncomingImage, PATHINFO_FILENAME) . ' ' . $Width . ' ' . $Height);
     $Extension = FileExtension($IncomingImage);
     $Target = $CacheDirectory . DS . $Name . '.' . $Extension;
     if (!file_exists($Target)) {
         Gdn_UploadImage::SaveImageAs($IncomingImage, $Target, $Height, $Width);
     }
     $Target = str_replace(DS, '/', $Target);
     if (!array_key_exists('alt', $Attributes)) {
         $Attributes['alt'] = pathinfo($Name, PATHINFO_FILENAME);
     }
     list($Width, $Height, $Type) = GetImageSize($IncomingImage);
     $Attributes['alt'] .= sprintf(' (%d×%d)', $Width, $Height);
     $Image = Img($Target, $Attributes);
     return Anchor($Image, Url($IncomingImage), '', '', True);
 }
Ejemplo n.º 19
0
 public function FetchPageInfo($Url, $ThrowError = FALSE)
 {
     $PageInfo = FetchPageInfo($Url, 3, $ThrowError);
     $Title = GetValue('Title', $PageInfo, '');
     if ($Title == '') {
         if ($ThrowError) {
             throw new Gdn_UserException(T("The page didn't contain any information."));
         }
         $Title = FormatString(T('Undefined discussion subject.'), array('Url' => $Url));
     } else {
         if ($Strip = C('Vanilla.Embed.StripPrefix')) {
             $Title = StringBeginsWith($Title, $Strip, TRUE, TRUE);
         }
         if ($Strip = C('Vanilla.Embed.StripSuffix')) {
             $Title = StringEndsWith($Title, $Strip, TRUE, TRUE);
         }
     }
     $Title = trim($Title);
     $Description = GetValue('Description', $PageInfo, '');
     $Images = GetValue('Images', $PageInfo, array());
     $Body = FormatString(T('EmbeddedDiscussionFormat'), array('Title' => $Title, 'Excerpt' => $Description, 'Image' => count($Images) > 0 ? Img(GetValue(0, $Images), array('class' => 'LeftAlign')) : '', 'Url' => $Url));
     if ($Body == '') {
         $Body = $ForeignUrl;
     }
     if ($Body == '') {
         $Body = FormatString(T('EmbeddedNoBodyFormat.'), array('Url' => $Url));
     }
     $Result = array('Name' => $Title, 'Body' => $Body, 'Format' => 'Html');
     return $Result;
 }
Ejemplo n.º 20
0
 function FlashObject($Movie, $Attributes = array(), $FlashVars = False)
 {
     //static $Defaults = array('allowfullscreen' => 'true', 'allowscriptaccess' => 'always', 'quality' => 'best', 'menu' => 'false');
     //$Attributes = array_merge($Defaults, $Attributes);
     $ScriptRender = GetValue('ScriptRender', $Attributes, False, True);
     $FlashVars = GetValue('FlashVars', $Attributes, $FlashVars, True);
     $Params = GetValue('Params', $Attributes, array(), True);
     $Movie = Asset($Movie, True);
     $AltContent = GetValue('AltContent', $Attributes, Anchor(Img('http://wwwimages.adobe.com/www.adobe.com/images/shared/download_buttons/get_flash_player.gif', array('alt' => 'Get Adobe Flash player')), 'http://www.adobe.com/go/getflashplayer', '', array('rel' => 'nofollow'), True), True);
     foreach (array('wmode', 'allowfullscreen', 'allowscriptaccess', 'quality', 'menu') as $Name) {
         $Value = GetValue($Name, $Attributes, False, True);
         if ($Value !== False) {
             $Params[$Name] = $Value;
         }
     }
     if (!array_key_exists('width', $Attributes) || !array_key_exists('height', $Attributes)) {
         $ImageInfo = GetImageSize($Movie);
         TouchValue('width', $Attributes, $ImageInfo[0]);
         TouchValue('height', $Attributes, $ImageInfo[1]);
     }
     $Attributes['type'] = 'application/x-shockwave-flash';
     $Attributes['data'] = $Movie;
     $HtmlParams = Wrap('', 'param', array('name' => 'movie', 'value' => $Movie));
     foreach ($Params as $Name => $Value) {
         $HtmlParams .= Wrap('', 'param', array('name' => $Name, 'value' => $Value));
     }
     if (is_array($FlashVars)) {
         foreach ($FlashVars as $Name => $Value) {
             $Variables[] = $Name . '=' . urlencode($Value);
         }
     }
     if (isset($Variables)) {
         $HtmlParams .= Wrap('', 'param', array('name' => 'flashvars', 'value' => implode('&', $Variables)));
     }
     /*		$Agent = ArrayValue('HTTP_USER_AGENT', $_SERVER);
     		if ($Agent != False && stripos($Agent, 'MSIE ') > 0) {
     			$Attributes['classid'] = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
     		}*/
     $Return = Wrap($HtmlParams . $AltContent, 'object', $Attributes);
     //d($Return);
     if ($ScriptRender) {
         $Return = JavaScript($Return, True);
     }
     return $Return;
 }
Ejemplo n.º 21
0
echo Wrap(T('LogoDescription', 'The banner logo appears at the top of your site. Some themes may not display this logo.'), 'div', array('class' => 'Info'));
$Logo = $this->Data('Logo');
if ($Logo) {
    echo Wrap(Img(Gdn_Upload::Url($Logo)), 'div');
    echo Wrap(Anchor(T('Remove Banner Logo'), '/dashboard/settings/removelogo/' . $Session->TransientKey(), 'SmallButton'), 'div', array('style' => 'padding: 10px 0;'));
    echo Wrap(T('LogoBrowse', 'Browse for a new banner logo if you would like to change it:'), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('Logo', 'file');
?>
         </li>
         <li>
            <?php 
echo $this->Form->Label('Favicon', 'Favicon');
echo Wrap(T('FaviconDescription', "Your site's favicon appears in your browser's title bar. It will be scaled to 16x16 pixels."), 'div', array('class' => 'Info'));
$Favicon = $this->Data('Favicon');
if ($Favicon) {
    echo Wrap(Img(Gdn_Upload::Url($Favicon)), 'div');
    echo Wrap(Anchor(T('Remove Favicon'), '/dashboard/settings/removefavicon/' . $Session->TransientKey(), 'SmallButton'), 'div', array('style' => 'padding: 10px 0;'));
    echo Wrap(T('FaviconBrowse', 'Browse for a new favicon if you would like to change it:'), 'div', array('class' => 'Info'));
} else {
    echo Wrap(T('FaviconDescription', "The shortcut icon that shows up in your browser's bookmark menu (16x16 px)."), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('Favicon', 'file');
?>
         </li>
      </ul>
   </div>
</div>
<?php 
echo '<div class="Buttons">' . $this->Form->Button('Save') . '</div>';
echo $this->Form->Close();
 /** Add a button to the navbar. */
 private function AddButton($Sender, $ButtonType)
 {
     if (is_object($Sender->Menu)) {
         if ($ButtonType == 'Discussion') {
             $Sender->Menu->AddLink('NewDiscussion', Img('themes/mobile/design/images/new.png', array('alt' => T('New Discussion'))), '/post/discussion' . (array_key_exists('CategoryID', $Sender->Data) ? '/' . $Sender->Data['CategoryID'] : ''), array('Garden.SignIn.Allow'), array('class' => 'NewDiscussion'));
         } elseif ($ButtonType == 'Conversation') {
             $Sender->Menu->AddLink('NewConversation', Img('themes/mobile/design/images/new.png', array('alt' => T('New Conversation'))), '/messages/add', '', array('class' => 'NewConversation'));
         }
     }
 }
Ejemplo n.º 23
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
echo $this->Form->Open();
?>
<div class="Title">
   <h1>
      <?php 
echo Img('applications/dashboard/design/images/vanilla_logo.png', array('alt' => 'Vanilla'));
?>
      <p><?php 
echo T('Version 2 Installer');
?>
</p>
   </h1>
</div>
<div class="Form">
   <?php 
echo $this->Form->Errors();
?>
   <ul>
      <li>
         <?php 
echo $this->Form->Label('Database Host', 'Database.Host');
echo $this->Form->TextBox('Database.Host');
?>
      </li>
      <li>
         <?php 
Ejemplo n.º 24
0
?>
</h1>
<?php 
echo $this->Form->Open(array('enctype' => 'multipart/form-data'));
echo $this->Form->Errors();
?>
<ul>
   <li>
      <?php 
echo $this->Form->Label('Banner Title', 'Garden.Title');
echo Wrap(T('The banner title appears on the top-left of every page. If a banner logo is uploaded, it will replace the banner title on user-facing forum pages.'), 'div', array('class' => 'Info'));
echo $this->Form->TextBox('Garden.Title');
?>
   </li>
   <li>
      <?php 
echo $this->Form->Label('Banner Logo', 'Garden.Logo');
$Logo = C('Garden.Logo');
if ($Logo) {
    echo Wrap(Img($Logo), 'div');
    echo Wrap(Anchor('Remove Banner Logo', '/dashboard/settings/removelogo/' . $Session->TransientKey(), 'SmallButton'), 'div', array('style' => 'padding: 10px 0;'));
    echo Wrap(T('Browse for a new banner logo if you would like to change it:'), 'div', array('class' => 'Info'));
} else {
    echo Wrap(T('The banner logo appears at the top of your forum.'), 'div', array('class' => 'Info'));
}
echo $this->Form->Input('Logo', 'file');
?>
   </li>
</ul>
<?php 
echo $this->Form->Close('Save');
Ejemplo n.º 25
0
 /**
  * Returns the mobile banner logo. If there is no mobile logo defined then this will just return
  * the regular logo or the mobile title.
  *
  * @return string
  */
 public static function mobileLogo()
 {
     $Logo = C('Garden.MobileLogo', C('Garden.Logo'));
     $Title = C('Garden.MobileTitle', C('Garden.Title', 'Title'));
     if ($Logo) {
         return Img(Gdn_Upload::url($Logo), array('alt' => $Title));
     } else {
         return $Title;
     }
 }
Ejemplo n.º 26
0
        $AuthorUrl = ArrayValue('AuthorUrl', $PluginInfo, '');
        $NewVersion = ArrayValue('NewVersion', $PluginInfo, '');
        $Upgrade = $NewVersion != '' && version_compare($NewVersion, $Version, '>');
        $RowClass = $Css;
        if ($Alt) {
            $RowClass .= ' Alt';
        }
        $IconPath = '/plugins/' . GetValue('Folder', $PluginInfo, '') . '/icon.png';
        $IconPath = file_exists(PATH_ROOT . $IconPath) ? $IconPath : 'applications/dashboard/design/images/plugin-icon.png';
        ?>
      <tr <?php 
        echo 'id="' . Gdn_Format::Url(strtolower($PluginName)) . '-plugin"', ' class="More ' . $RowClass . '"';
        ?>
>
         <td rowspan="2" class="Less"><?php 
        echo Img($IconPath, array('class' => 'PluginIcon'));
        ?>
</td>
         <th><?php 
        echo $ScreenName;
        ?>
</th>
         <td class="Alt"><?php 
        echo Gdn_Format::Html(GetValue('Description', $PluginInfo, ''));
        ?>
</td>
      </tr>
      <tr class="<?php 
        echo ($Upgrade ? 'More ' : '') . $RowClass;
        ?>
">
Ejemplo n.º 27
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
<div class="Box InThisConversation">
   <?php 
echo panelHeading(T('In this Conversation'));
?>
   <ul class="PanelInfo">
   <?php 
foreach ($this->Data->Result() as $User) {
    ?>
      <li>
         <?php 
    $Username = htmlspecialchars(GetValue('Name', $User));
    $Photo = GetValue('Photo', $User);
    if (GetValue('Deleted', $User)) {
        echo Anchor(Wrap(Img($Photo, array('class' => 'ProfilePhoto ProfilePhotoSmall')) . ' ' . Wrap($Username, 'del', array('class' => 'Username')), 'span', array('class' => 'Conversation-User')), UserUrl($User), array('title' => sprintf(T('%s has left this conversation.'), $Username)));
    } else {
        echo Anchor(Wrap(Img($Photo, array('class' => 'ProfilePhoto ProfilePhotoSmall')) . ' ' . Wrap($Username, 'span', array('class' => 'Username')), 'span', array('class' => 'Conversation-User')), UserUrl($User));
    }
    ?>
      </li>
   <?php 
}
?>
   </ul>
</div>
Ejemplo n.º 28
0
    <p>Our experienced service professionals can customize and implement your Vanilla installation.</p>
</div>

<div class="Service">
    <h2>VanillaForums.com Installation</h2>
    <?php 
echo Img('applications/vforg/design/images/services-scripts.png');
?>
    <p>We configure a hosted forum for you at <a href="http://vanillaforums.com">VanillaForums.com</a>. Includes a default Vanilla installation and any of our approved addons.</p>
</div>
<div class="Service" style="margin: 0 18px;">
    <h2>Custom Development</h2>
    <?php 
echo Img('applications/vforg/design/images/services-stagescreen.png');
?>
    <p>Includes a default Vanilla installation &amp; custom built addons.</p>
</div>
<div class="Service">
    <h2>Remote Installation</h2>
    <?php 
echo Img('applications/vforg/design/images/services-audience.png');
?>
    <p>We no longer support remote installations. <a href="http://vanillaforums.org/docs/CustomDevelopment">Contact our development partners</a> for help with your self-hosted installations.</p>
</div>
<div style="clear: both; font-size: 14px; text-align: center; padding: 20px 0 60px;">
    <strong>Contact sales for more information: <?php 
echo Gdn_Format::Email('*****@*****.**');
?>
 or 1-855-836-7867</strong>
</div>
Ejemplo n.º 29
0
 /**
  * Returns the current image in a field.
  * This is meant to be used with image uploads so that users can see the current value.
  * 
  * @param type $FieldName
  * @param type $Attributes
  * @since 2.1
  */
 public function CurrentImage($FieldName, $Attributes = array())
 {
     $Result = $this->Hidden($FieldName);
     $Value = $this->GetValue($FieldName);
     if ($Value) {
         TouchValue('class', $Attributes, 'CurrentImage');
         $Result .= Img(Gdn_Upload::Url($Value), $Attributes);
     }
     return $Result;
 }
Ejemplo n.º 30
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
	<li class="SteamProfile">
      <?php 
echo $Sender->Form->Label('Steam Profile');
// Do we happen to already have a Steam ID for our current user?
if ($Sender->Data('SteamID64')) {
    // If so, we just output it.  Nothing fancy.
    echo '<div>' . T('Steam ID') . ': ' . Gdn_Format::Text($Sender->Data('SteamID64')) . '</div>';
} else {
    // If not, we drop in a button and set the stage for OpenID magic.
    echo Anchor(Img('plugins/steamprofile/design/images/sits_small.png', array('alt' => 'Sign in through Steam')), $Sender->Data('SteamAuthenticationUrl'), '', array('title' => 'Sign in through Steam'));
}
?>
   </li>