Exemplo n.º 1
0
 public function Gdn_Dispatcher_AfterAnalyzeRequest_Handler($Sender)
 {
     // Remove plugins so they don't mess up layout or functionality.
     if (in_array($Sender->Application(), array('vanilla', 'conversations')) && IsMobile() || $Sender->Application() == 'dashboard' && in_array($Sender->Controller(), array('Activity', 'Profile', 'Search'))) {
         Gdn::PluginManager()->RemoveMobileUnfriendlyPlugins();
     }
     SaveToConfig('Garden.Format.EmbedSize', '240x135', FALSE);
 }
 /**
  * Main function that 
  *   1. adds CSS file to controller
  *   2. adds new categories module
  */
 private function AttachModule($Sender)
 {
     if (IsMobile()) {
         return;
     } else {
         include_once PATH_PLUGINS . DS . 'CategoriesModulePlus' . DS . 'modules' . DS . 'class.categoriesmoduleplusmodule.php';
         // ApplicationFolder is needed for rendering the view
         $ApplicationFolder = 'plugins/CategoriesModulePlus';
         $Sender->AddCssFile('categoriesmoduleplus.css', $ApplicationFolder);
         $CategoriesModulePlusModule = new CategoriesModulePlusModule($Sender, $ApplicationFolder);
         // add module to the panel
         $Sender->AddModule($CategoriesModulePlusModule);
     }
 }
 /**
  * Loads default page view.
  *
  * @param string $PageUrlCode ; Unique page URL stub identifier.
  */
 public function Index($PageUrlCode = '')
 {
     $this->Page = $this->PageModel->GetByUrlCode($PageUrlCode);
     // Require the custom view permission if it exists.
     // Otherwise, the page is public by default.
     $ViewPermissionName = 'BasicPages.' . $PageUrlCode . '.View';
     if (array_key_exists($ViewPermissionName, Gdn::PermissionModel()->PermissionColumns())) {
         $this->Permission($ViewPermissionName);
     }
     // If page doesn't exist.
     if ($this->Page == null) {
         throw new Exception(sprintf(T('%s Not Found'), T('Page')), 404);
         return null;
     }
     $this->SetData('Page', $this->Page, false);
     // Add body CSS class.
     $this->CssClass = 'Page-' . $this->Page->UrlCode;
     if (IsMobile()) {
         $this->CssClass .= ' PageMobile';
     }
     // Set the canonical URL to have the proper page link.
     $this->CanonicalUrl(PageModel::PageUrl($this->Page));
     // Add modules
     $this->AddModule('GuestModule');
     $this->AddModule('SignedInModule');
     // Add CSS files
     $this->AddCssFile('page.css');
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('DiscussionFilterModule');
     $this->AddModule('BookmarkedModule');
     $this->AddModule('DiscussionsModule');
     $this->AddModule('RecentActivityModule');
     // Setup head.
     if (!$this->Data('Title')) {
         $Title = C('Garden.HomepageTitle');
         $DefaultControllerDestination = Gdn::Router()->GetDestination('DefaultController');
         if ($Title != '' && strpos($DefaultControllerDestination, 'page/' . $this->Page->UrlCode) !== false) {
             // If the page is set as DefaultController.
             $this->Title($Title, '');
             // Add description meta tag.
             $this->Description(C('Garden.Description', null));
         } else {
             // If the page is NOT the DefaultController.
             $this->Title($this->Page->Name);
             // Add description meta tag.
             $this->Description(SliceParagraph(Gdn_Format::PlainText($this->Page->Body, $this->Page->Format), 160));
         }
     }
     $this->Render();
 }
    /**
     * Add mobile meta info. Add script to hide iphone browser bar on pageload.
     */
    public function Base_Render_Before($Sender)
    {
        if (IsMobile() && is_object($Sender->Head)) {
            $Sender->Head->AddTag('meta', array('name' => 'viewport', 'content' => "width=device-width,minimum-scale=1.0,maximum-scale=1.0"));
            $Sender->Head->AddString('<script type="text/javascript">
// If not looking for a specific comment, hide the address bar in iphone
var hash = window.location.href.split("#")[1];
if (typeof(hash) == "undefined") {
	setTimeout(function () {
	  window.scrollTo(0, 1);
	}, 1000);
}
</script>');
        }
    }
Exemplo 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;
 }
 public function Base_Render_Before($Sender)
 {
     $InDashboard = !($Sender->MasterView == 'default' || $Sender->MasterView == '');
     $Sender->AddJsFile('plugins/embedvanilla/local.js');
     // Record the remote source using the embed feature.
     $RemoteUrl = C('Plugins.EmbedVanilla.RemoteUrl');
     if (!$RemoteUrl) {
         $RemoteUrl = GetIncomingValue('remote');
         if ($RemoteUrl) {
             SaveToConfig('Plugins.EmbedVanilla.RemoteUrl', $RemoteUrl);
         }
     }
     // Report the remote url to redirect to if not currently embedded.
     $Sender->AddDefinition('RemoteUrl', $RemoteUrl);
     if (!IsSearchEngine() && !$InDashboard && !IsMobile() && C('Plugins.EmbedVanilla.ForceRemoteUrl')) {
         $Sender->AddDefinition('ForceRemoteUrl', TRUE);
     }
     $Sender->AddDefinition('Path', Gdn::Request()->Path());
     if ($InDashboard) {
         $Sender->AddDefinition('InDashboard', C('Plugins.EmbedVanilla.EmbedDashboard'));
     }
 }
Exemplo n.º 7
0
 public function Rack()
 {
     header('Content-Type: application/json; charset=utf-8');
     date_default_timezone_set('America/Montreal');
     $keys = array('REQUEST_METHOD', 'SCRIPT_NAME', 'PATH_INFO', 'SERVER_NAME', 'SERVER_PORT', 'HTTP_ACCEPT', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_ACCEPT_CHARSET', 'HTTP_USER_AGENT', 'HTTP_REMOTE_ADDR');
     $rack = array_intersect_key($_SERVER, array_fill_keys($keys, true));
     ksort($rack);
     // Extract the headers from $_SERVER.
     $headers = array();
     foreach ($_SERVER as $key => $value) {
         $key = strtoupper($key);
         if (strpos($key, 'X_') === 0 || strpos($key, 'HTTP_') === 0 || in_array($key, static::$specialHeaders)) {
             if ($key === 'HTTP_CONTENT_TYPE' || $key === 'HTTP_CONTENT_LENGTH') {
                 continue;
             }
             $headers[$key] = $value;
         }
     }
     ksort($headers);
     $result = array('rack' => $rack, 'headers' => $headers, 'get' => $_GET, 'cookie' => $_COOKIE, 'mobile' => array('userAgentType' => userAgentType(), 'isMobile' => IsMobile()));
     echo json_encode($result);
 }
Exemplo n.º 8
0
 /**
  *
  *
  * @return mixed
  */
 public function currentTheme()
 {
     if (IsMobile()) {
         if ($this->hasMobilePreview()) {
             return $this->getMobilePreview();
         }
         return c('Garden.MobileTheme', 'default');
     } else {
         if ($this->hasPreview()) {
             return $this->getPreview();
         }
         return c('Garden.Theme', 'default');
     }
 }
Exemplo n.º 9
0
 /**
  * Return the default input formatter.
  *
  * @param bool|null $is_mobile Whether or not you want the format for mobile browsers.
  * @return string
  */
 public static function DefaultFormat($is_mobile = NULL)
 {
     if ($is_mobile === true || $is_mobile === null && IsMobile()) {
         return C('Garden.MobileInputFormatter', C('Garden.InputFormatter', 'Html'));
     } else {
         return C('Garden.InputFormatter', 'Html');
     }
 }
Exemplo n.º 10
0
 /**
  *
  * 检测数据输入是否正确
  */
 private function check_format($type, $val)
 {
     if ($type == 'phone') {
         $is_error = true;
         if (is_string($val) || is_numeric($val)) {
             if (IsTel($val) || IsMobile($val)) {
                 $is_error = false;
             } elseif (empty($val)) {
                 $is_error = false;
             }
         }
         if ($is_error) {
             $this->errorOutput('您输入的电话号码或者手机号码格式错误');
         }
     }
 }
Exemplo n.º 11
0
    require_once PHPMYWIND_INC . '/mysql.class.php';
}
//引入语言包
//Session保存路径
$sess_savepath = PHPMYWIND_DATA . '/sessions/';
if (is_writable($sess_savepath) && is_readable($sess_savepath)) {
    session_save_path($sess_savepath);
}
//上传文件保存路径
$cfg_image_dir = PHPMYWIND_UPLOAD . '/image';
$cfg_soft_dir = PHPMYWIND_UPLOAD . '/soft';
$cfg_media_dir = PHPMYWIND_UPLOAD . '/media';
//系统版本号
$cfg_vernum = '5.3 Beta';
$cfg_vertime = '20150913221909';
//设置默认时区
if (PHP_VERSION > '5.1') {
    $time51 = $cfg_timezone * -1;
    @date_default_timezone_set('Etc/GMT' . $time51);
}
//判断是否开启错误提示
if ($cfg_diserror == 'Y') {
    error_reporting(E_ALL);
} else {
    error_reporting(0);
}
//判断访问设备
//如果手动更改后台目录,请将/admin目录更改成新后台目录
if (IsMobile() && !strstr(GetCurUrl(), '4g.php') && $cfg_mobile == 'Y' && !strstr(GetCurUrl(), '/admin')) {
    header('location:4g.php');
}
Exemplo n.º 12
0
 /** Whether or not this pocket should be processed based on its state.
  *
  *  @Param array $Data Data specific to the request.
  *  @return bool
  */
 public function CanRender($Data)
 {
     if (!$this->ShowInDashboard && InSection('Dashboard')) {
         return FALSE;
     }
     $IsMobile = IsMobile();
     if ($this->MobileOnly && !$IsMobile || $this->MobileNever && $IsMobile) {
         return FALSE;
     }
     if ($this->IsAd() && Gdn::Session()->CheckPermission('Garden.NoAds.Allow')) {
         return FALSE;
     }
     if ($this->EmbeddedNever && strcasecmp(Gdn::Controller()->RequestMethod, 'embed') == 0) {
         return FALSE;
     }
     // Check to see if the pocket is enabled.
     switch ($this->Disabled) {
         case Pocket::DISABLED:
             return FALSE;
         case Pocket::TESTING:
             if (!Gdn::Session()->CheckPermission('Plugins.Pockets.Manage')) {
                 return FALSE;
             }
             break;
     }
     // Check to see if the page matches.
     if ($this->Page && strcasecmp($this->Page, GetValue('PageName', $Data)) != 0) {
         return FALSE;
     }
     // Check to see if this is repeating.
     $Count = GetValue('Count', $Data);
     if ($Count) {
         switch ($this->RepeatType) {
             case Pocket::REPEAT_AFTER:
                 if (strcasecmp($Count, Pocket::REPEAT_AFTER) != 0) {
                     return FALSE;
                 }
                 break;
             case Pocket::REPEAT_BEFORE:
                 if (strcasecmp($Count, Pocket::REPEAT_BEFORE) != 0) {
                     return FALSE;
                 }
                 break;
             case Pocket::REPEAT_ONCE:
                 if ($Count != 1) {
                     return FALSE;
                 }
                 break;
             case Pocket::REPEAT_EVERY:
                 $Frequency = (array) $this->RepeatFrequency;
                 $Every = GetValue(0, $Frequency, 1);
                 if ($Every < 1) {
                     $Every = 1;
                 }
                 $Begin = GetValue(1, $Frequency, 1);
                 if ($Count % $Every != $Begin % $Every) {
                     return FALSE;
                 }
                 break;
             case Pocket::REPEAT_INDEX:
                 if (!in_array($Count, (array) $this->RepeatFrequency)) {
                     return FALSE;
                 }
                 break;
         }
     }
     // If we've passed all of the tests then the pocket can be processed.
     return TRUE;
 }
Exemplo n.º 13
0
    // Include the application's bootstrap.
    $Gdn_Path = PATH_APPLICATIONS . DS . $ApplicationFolder . DS . 'settings' . DS . 'bootstrap.php';
    if (file_exists($Gdn_Path)) {
        include_once $Gdn_Path;
    }
    // Include the application's hooks.
    $Hooks_Path = PATH_APPLICATIONS . DS . $ApplicationFolder . DS . 'settings' . DS . 'class.hooks.php';
    if (file_exists($Hooks_Path)) {
        include_once $Hooks_Path;
    }
}
unset($Gdn_EnabledApplications);
unset($Gdn_Path);
unset($Hooks_Path);
// If there is a hooks file in the theme folder, include it.
$ThemeName = C(!IsMobile() ? 'Garden.Theme' : 'Garden.MobileTheme', 'default');
$ThemeHooks = PATH_THEMES . DS . $ThemeName . DS . 'class.' . strtolower($ThemeName) . 'themehooks.php';
if (file_exists($ThemeHooks)) {
    include_once $ThemeHooks;
}
// Set up the plugin manager (doing this early so it has fewer classes to
// examine to determine if they are plugins).
Gdn::FactoryInstall(Gdn::AliasPluginManager, 'Gdn_PluginManager', PATH_LIBRARY . DS . 'core' . DS . 'class.pluginmanager.php', Gdn::FactorySingleton);
Gdn::PluginManager()->IncludePlugins();
Gdn::PluginManager()->RegisterPlugins();
Gdn::FactoryOverwrite($FactoryOverwriteBak);
unset($FactoryOverwriteBak);
Gdn::Authenticator()->StartAuthenticator();
/// Include a user-defined bootstrap.
if (file_exists(PATH_ROOT . DS . 'conf' . DS . 'bootstrap.after.php')) {
    require_once PATH_ROOT . DS . 'conf' . DS . 'bootstrap.after.php';
Exemplo n.º 14
0
 function Theme()
 {
     return C(!IsMobile() ? 'Garden.Theme' : 'Garden.MobileTheme', 'default');
 }
 private function Resources($Sender)
 {
     if (!$this->Enabled()) {
         return;
     }
     $Sender->AddDefinition('InfiniteScroll.HideHead', C('InfiniteScroll.HideHead', true));
     $Sender->AddDefinition('InfiniteScroll.Treshold', (int) C('InfiniteScroll.Treshold', 200));
     $Sender->AddDefinition('InfiniteScroll.Hotkey', C('InfiniteScroll.Hotkey', 'j'));
     $Sender->AddDefinition('InfiniteScroll.NavStyle', (int) C('InfiniteScroll.NavStyle', 0));
     $Sender->AddDefinition('InfiniteScroll.ProgressBg', C('InfiniteScroll.ProgressColor', '#38abe3'));
     $Sender->AddDefinition('InfiniteScroll.Mobile', IsMobile());
     //$Sender->AddJsFile('nanobar.min.js', 'plugins/InfiniteScroll');
     //$Sender->AddJsFile('infinitescroll.js', 'plugins/InfiniteScroll');
     $Sender->AddJsFile('infinitescroll.min.js', 'plugins/InfiniteScroll');
     $Sender->AddCssFile('infinitescroll.css', 'plugins/InfiniteScroll', array('Sort' => 1));
 }
Exemplo n.º 16
0
 /**
  *
  * @param Gdn_Controller $Sender
  */
 public function Base_Render_Before($Sender)
 {
     $Session = Gdn::Session();
     // Enable theme previewing
     if ($Session->IsValid()) {
         $PreviewThemeName = $Session->GetPreference('PreviewThemeName', '');
         $PreviewThemeFolder = $Session->GetPreference('PreviewThemeFolder', '');
         if ($PreviewThemeName != '') {
             $Sender->Theme = $PreviewThemeName;
             $Sender->InformMessage(sprintf(T('You are previewing the %s theme.'), Wrap($PreviewThemeName, 'em')) . '<div class="PreviewThemeButtons">' . Anchor(T('Apply'), 'settings/themes/' . $PreviewThemeName . '/' . $Session->TransientKey(), 'PreviewThemeButton') . ' ' . Anchor(T('Cancel'), 'settings/cancelpreview/', 'PreviewThemeButton') . '</div>', 'DoNotDismiss');
         }
     }
     if ($Session->IsValid() && ($EmailKey = Gdn::Session()->GetAttribute('EmailKey'))) {
         $NotifyEmailConfirm = TRUE;
         // If this user was manually moved out of the confirmation role, get rid of their 'awaiting confirmation' flag
         $ConfirmEmailRole = C('Garden.Registration.ConfirmEmailRole', FALSE);
         $UserRoles = array();
         $RoleData = Gdn::UserModel()->GetRoles($Session->UserID);
         if ($RoleData !== FALSE && $RoleData->NumRows() > 0) {
             $UserRoles = ConsolidateArrayValuesByKey($RoleData->Result(DATASET_TYPE_ARRAY), 'RoleID', 'Name');
         }
         if ($ConfirmEmailRole !== FALSE && !array_key_exists($ConfirmEmailRole, $UserRoles)) {
             Gdn::UserModel()->SaveAttribute($Session->UserID, "EmailKey", NULL);
             $NotifyEmailConfirm = FALSE;
         }
         if ($NotifyEmailConfirm) {
             $Message = FormatString(T('You need to confirm your email address.', 'You need to confirm your email address. Click <a href="{/entry/emailconfirmrequest,url}">here</a> to resend the confirmation email.'));
             $Sender->InformMessage($Message, '');
         }
     }
     // Add Message Modules (if necessary)
     $MessageCache = Gdn::Config('Garden.Messages.Cache', array());
     $Location = $Sender->Application . '/' . substr($Sender->ControllerName, 0, -10) . '/' . $Sender->RequestMethod;
     $Exceptions = array('[Base]');
     // 2011-09-09 - mosullivan - No longer allowing messages in dashboard
     //		if ($Sender->MasterView == 'admin')
     //			$Exceptions[] = '[Admin]';
     //		else if (in_array($Sender->MasterView, array('', 'default')))
     if (in_array($Sender->MasterView, array('', 'default'))) {
         $Exceptions[] = '[NonAdmin]';
     }
     // SignIn popup is a special case
     $SignInOnly = $Sender->DeliveryType() == DELIVERY_TYPE_VIEW && $Location == 'Dashboard/entry/signin';
     if ($SignInOnly) {
         $Exceptions = array();
     }
     if ($Sender->MasterView != 'admin' && (GetValue('MessagesLoaded', $Sender) != '1' && $Sender->MasterView != 'empty' && ArrayInArray($Exceptions, $MessageCache, FALSE) || InArrayI($Location, $MessageCache))) {
         $MessageModel = new MessageModel();
         $MessageData = $MessageModel->GetMessagesForLocation($Location, $Exceptions);
         foreach ($MessageData as $Message) {
             $MessageModule = new MessageModule($Sender, $Message);
             if ($SignInOnly) {
                 // Insert special messages even in SignIn popup
                 echo $MessageModule;
             } elseif ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
                 $Sender->AddModule($MessageModule);
             }
         }
         $Sender->MessagesLoaded = '1';
         // Fixes a bug where render gets called more than once and messages are loaded/displayed redundantly.
     }
     // If there are applicants, alert admins by showing in the main menu
     if (in_array($Sender->MasterView, array('', 'default')) && $Sender->Menu && C('Garden.Registration.Method') == 'Approval') {
         // $CountApplicants = Gdn::UserModel()->GetApplicantCount();
         // if ($CountApplicants > 0)
         // $Sender->Menu->AddLink('Applicants', T('Applicants').' <span class="Alert">'.$CountApplicants.'</span>', '/dashboard/user/applicants', array('Garden.Applicants.Manage'));
         $Sender->Menu->AddLink('Applicants', T('Applicants'), '/dashboard/user/applicants', array('Garden.Applicants.Manage'));
     }
     if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
         $Gdn_Statistics = Gdn::Factory('Statistics');
         $Gdn_Statistics->Check($Sender);
     }
     // Allow forum embedding
     if (C('Garden.Embed.Allow')) {
         // Record the remote url where the forum is being embedded.
         $RemoteUrl = C('Garden.Embed.RemoteUrl');
         if (!$RemoteUrl) {
             $RemoteUrl = GetIncomingValue('remote');
             if ($RemoteUrl) {
                 SaveToConfig('Garden.Embed.RemoteUrl', $RemoteUrl);
             }
         }
         if ($RemoteUrl) {
             $Sender->AddDefinition('RemoteUrl', $RemoteUrl);
         }
         // Force embedding?
         if (!IsSearchEngine() && !IsMobile()) {
             $Sender->AddDefinition('ForceEmbedForum', C('Garden.Embed.ForceForum') ? '1' : '0');
             $Sender->AddDefinition('ForceEmbedDashboard', C('Garden.Embed.ForceDashboard') ? '1' : '0');
         }
         $Sender->AddDefinition('Path', Gdn::Request()->Path());
         // $Sender->AddDefinition('MasterView', $Sender->MasterView);
         $Sender->AddDefinition('InDashboard', $Sender->MasterView == 'admin' ? '1' : '0');
         $Sender->AddJsFile('js/embed_local.js');
     }
     // Allow return to mobile site
     $ForceNoMobile = Gdn_CookieIdentity::GetCookiePayload('VanillaNoMobile');
     if ($ForceNoMobile !== FALSE && is_array($ForceNoMobile) && in_array('force', $ForceNoMobile)) {
         $Sender->AddAsset('Foot', Wrap(Anchor(T('Back to Mobile Site'), '/profile/nomobile/1'), 'div'), 'MobileLink');
     }
 }
Exemplo n.º 17
0
 protected function hide()
 {
     if ($this->Disabled) {
         return TRUE;
     }
     if (!Gdn::Session()->IsValid() && C('Plugins.Signatures.HideGuest')) {
         return TRUE;
     }
     if (strcasecmp(Gdn::Controller()->RequestMethod, 'embed') == 0 && C('Plugin.Signatures.HideEmbed', TRUE)) {
         return TRUE;
     }
     if ($this->UserPreferences('Plugin.Signatures.HideAll', FALSE)) {
         return TRUE;
     }
     if (IsMobile() && (C('Plugins.Signatures.HideMobile', TRUE) || $this->UserPreferences('Plugin.Signatures.HideMobile', FALSE))) {
         return TRUE;
     }
     return FALSE;
 }
Exemplo n.º 18
0
                    //提取当前用户账号
                    $_SESSION['admin'] = $row['username'];
                    //提取当前用户权限
                    $_SESSION['adminlevel'] = $row['levelname'];
                    //提取上次登录时间
                    $_SESSION['lastlogintime'] = $row['logintime'];
                    //提取上次登录IP
                    $_SESSION['lastloginip'] = $row['loginip'];
                    //记录本次登录时间
                    $_SESSION['logintime'] = $logintime;
                    //更新登录数据
                    $dosql->ExecNoneQuery("UPDATE `#@__admin` SET loginip='{$loginip}',logintime='{$logintime}' WHERE `username`='{$username}'");
                    //更新操作日志
                    SetSysEvent('login');
                    //判断访问设备
                    if (IsMobile()) {
                        $_SESSION['siteeq'] = 'mobile';
                        header('location:default_mb.php?c=index');
                        exit;
                    } else {
                        $_SESSION['siteeq'] = 'pc';
                        header('location:default.php');
                        exit;
                    }
                }
            }
        }
    }
}
//获取登录背景
function GetLoginBg()
Exemplo n.º 19
0
 /**
  *
  * @param Gdn_Controller $Sender
  */
 public function Base_Render_Before($Sender)
 {
     $Session = Gdn::Session();
     // Enable theme previewing
     if ($Session->IsValid()) {
         $PreviewThemeName = $Session->GetPreference('PreviewThemeName', '');
         $PreviewThemeFolder = $Session->GetPreference('PreviewThemeFolder', '');
         if ($PreviewThemeName != '') {
             $Sender->Theme = $PreviewThemeName;
             $Sender->InformMessage(sprintf(T('You are previewing the %s theme.'), Wrap($PreviewThemeName, 'em')) . '<div class="PreviewThemeButtons">' . Anchor(T('Apply'), 'settings/themes/' . $PreviewThemeName . '/' . $Session->TransientKey(), 'PreviewThemeButton') . ' ' . Anchor(T('Cancel'), 'settings/cancelpreview/', 'PreviewThemeButton') . '</div>', 'DoNotDismiss');
         }
     }
     if ($Session->IsValid()) {
         $ConfirmEmail = C('Garden.Registration.ConfirmEmail', false);
         $Confirmed = GetValue('Confirmed', Gdn::Session()->User, true);
         if ($ConfirmEmail && !$Confirmed) {
             $Message = FormatString(T('You need to confirm your email address.', 'You need to confirm your email address. Click <a href="{/entry/emailconfirmrequest,url}">here</a> to resend the confirmation email.'));
             $Sender->InformMessage($Message, '');
         }
     }
     // Add Message Modules (if necessary)
     $MessageCache = Gdn::Config('Garden.Messages.Cache', array());
     $Location = $Sender->Application . '/' . substr($Sender->ControllerName, 0, -10) . '/' . $Sender->RequestMethod;
     $Exceptions = array('[Base]');
     // 2011-09-09 - mosullivan - No longer allowing messages in dashboard
     //		if ($Sender->MasterView == 'admin')
     //			$Exceptions[] = '[Admin]';
     //		else if (in_array($Sender->MasterView, array('', 'default')))
     if (in_array($Sender->MasterView, array('', 'default'))) {
         $Exceptions[] = '[NonAdmin]';
     }
     // SignIn popup is a special case
     $SignInOnly = $Sender->DeliveryType() == DELIVERY_TYPE_VIEW && $Location == 'Dashboard/entry/signin';
     if ($SignInOnly) {
         $Exceptions = array();
     }
     if ($Sender->MasterView != 'admin' && !$Sender->Data('_NoMessages') && (GetValue('MessagesLoaded', $Sender) != '1' && $Sender->MasterView != 'empty' && ArrayInArray($Exceptions, $MessageCache, FALSE) || InArrayI($Location, $MessageCache))) {
         $MessageModel = new MessageModel();
         $MessageData = $MessageModel->GetMessagesForLocation($Location, $Exceptions, $Sender->Data('Category.CategoryID'));
         foreach ($MessageData as $Message) {
             $MessageModule = new MessageModule($Sender, $Message);
             if ($SignInOnly) {
                 // Insert special messages even in SignIn popup
                 echo $MessageModule;
             } elseif ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
                 $Sender->AddModule($MessageModule);
             }
         }
         $Sender->MessagesLoaded = '1';
         // Fixes a bug where render gets called more than once and messages are loaded/displayed redundantly.
     }
     if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
         $Gdn_Statistics = Gdn::Factory('Statistics');
         $Gdn_Statistics->Check($Sender);
     }
     // Allow forum embedding
     if ($Embed = C('Garden.Embed.Allow')) {
         // Record the remote url where the forum is being embedded.
         $RemoteUrl = C('Garden.Embed.RemoteUrl');
         if (!$RemoteUrl) {
             $RemoteUrl = GetIncomingValue('remote');
             if ($RemoteUrl) {
                 SaveToConfig('Garden.Embed.RemoteUrl', $RemoteUrl);
             }
         }
         if ($RemoteUrl) {
             $Sender->AddDefinition('RemoteUrl', $RemoteUrl);
         }
         // Force embedding?
         if (!IsSearchEngine() && !IsMobile() && strtolower($Sender->ControllerName) != 'entry') {
             $Sender->AddDefinition('ForceEmbedForum', C('Garden.Embed.ForceForum') ? '1' : '0');
             $Sender->AddDefinition('ForceEmbedDashboard', C('Garden.Embed.ForceDashboard') ? '1' : '0');
         }
         $Sender->AddDefinition('Path', Gdn::Request()->Path());
         // $Sender->AddDefinition('MasterView', $Sender->MasterView);
         $Sender->AddDefinition('InDashboard', $Sender->MasterView == 'admin' ? '1' : '0');
         if ($Embed === 2) {
             $Sender->AddJsFile('vanilla.embed.local.js');
         } else {
             $Sender->AddJsFile('embed_local.js');
         }
     } else {
         $Sender->SetHeader('X-Frame-Options', 'SAMEORIGIN');
     }
     // Allow return to mobile site
     $ForceNoMobile = Gdn_CookieIdentity::GetCookiePayload('VanillaNoMobile');
     if ($ForceNoMobile !== FALSE && is_array($ForceNoMobile) && in_array('force', $ForceNoMobile)) {
         $Sender->AddAsset('Foot', Wrap(Anchor(T('Back to Mobile Site'), '/profile/nomobile/1'), 'div'), 'MobileLink');
     }
 }
Exemplo n.º 20
0
 /**
  *
  *
  * @param $Sender
  */
 public function assetModel_styleCss_handler($Sender)
 {
     if (!$this->hasLayoutTables() || IsMobile()) {
         $Sender->addCssFile('indexphotos.css', 'plugins/IndexPhotos');
     }
 }
Exemplo n.º 21
0
 public static function CssPath($ThemeType, $Filename, $Folder)
 {
     if (!$ThemeType) {
         $ThemeType = IsMobile() ? 'mobile' : 'desktop';
     }
     // 1. Check for a url.
     if (IsUrl($Filename)) {
         return array($Filename, $Filename);
     }
     // 2. Check for a full path.
     if (strpos($Filename, '/') !== FALSE) {
         $Filename = '/' . ltrim($Filename, '/');
         $Path = PATH_ROOT . $Filename;
         if (file_exists($Path)) {
             return array($Path, $Filename);
         } else {
             return FALSE;
         }
     }
     // 3. Check the theme.
     if ($Theme = Gdn::ThemeManager()->ThemeFromType($ThemeType)) {
         $Paths[] = array(PATH_THEMES . "/{$Theme}/design/{$Filename}", "/themes/{$Theme}/design/{$Filename}");
     }
     if ($Folder) {
         // 4. Check static, a plugin or application.
         if (in_array($Folder, array('resources', 'static'))) {
             $path = "/resources/css/{$Filename}";
             $Paths[] = array(PATH_ROOT . $path, $path);
         } elseif (StringBeginsWith($Folder, 'plugins/')) {
             $Folder = substr($Folder, strlen('plugins/'));
             $Paths[] = array(PATH_PLUGINS . "/{$Folder}/design/{$Filename}", "/plugins/{$Folder}/design/{$Filename}");
             $Paths[] = array(PATH_PLUGINS . "/{$Folder}/{$Filename}", "/plugins/{$Folder}/{$Filename}");
         } else {
             $Paths[] = array(PATH_APPLICATIONS . "/{$Folder}/design/{$Filename}", "/applications/{$Folder}/design/{$Filename}");
         }
     }
     // 5. Check the default.
     if ($Folder != 'dashboard') {
         $Paths[] = array(PATH_APPLICATIONS . '/dashboard/design/$Filename', "/applications/dashboard/design/{$Filename}");
     }
     foreach ($Paths as $Info) {
         if (file_exists($Info[0])) {
             return $Info;
         }
     }
     return FALSE;
 }
 private function Enabled()
 {
     $Session = Gdn::Session();
     return !($Session->IsValid() && !$this->GetUserMeta($Session->UserID, 'Theme', true, true) || !C('ThemeChooser.Mobile', false) && IsMobile());
 }
Exemplo n.º 23
0
 /**
  * Undocumented method.
  *
  * @todo Method RenderMaster() needs a description.
  */
 public function RenderMaster()
 {
     // Build the master view if necessary
     if (in_array($this->_DeliveryType, array(DELIVERY_TYPE_ALL))) {
         $this->MasterView = $this->MasterView();
         // Only get css & ui components if this is NOT a syndication request
         if ($this->SyndicationMethod == SYNDICATION_NONE && is_object($this->Head)) {
             //            if (ArrayHasValue($this->_CssFiles, 'style.css')) {
             //               $this->AddCssFile('custom.css');
             //
             //               // Add the theme option's css file.
             //               if ($this->Theme && $this->ThemeOptions) {
             //                  $Filenames = GetValueR('Styles.Value', $this->ThemeOptions);
             //                  if (is_string($Filenames) && $Filenames != '%s')
             //                     $this->_CssFiles[] = array('FileName' => ChangeBasename('custom.css', $Filenames), 'AppFolder' => FALSE, 'Options' => FALSE);
             //               }
             //            } elseif (ArrayHasValue($this->_CssFiles, 'admin.css')) {
             //               $this->AddCssFile('customadmin.css');
             //            }
             $this->EventArguments['CssFiles'] =& $this->_CssFiles;
             $this->FireEvent('BeforeAddCss');
             $ETag = AssetModel::ETag();
             $CombineAssets = C('Garden.CombineAssets');
             $ThemeType = IsMobile() ? 'mobile' : 'desktop';
             // And now search for/add all css files.
             foreach ($this->_CssFiles as $CssInfo) {
                 $CssFile = $CssInfo['FileName'];
                 // style.css and admin.css deserve some custom processing.
                 if (in_array($CssFile, array('style.css', 'admin.css'))) {
                     if (!$CombineAssets) {
                         // Grab all of the css files from the asset model.
                         $AssetModel = new AssetModel();
                         $CssFiles = $AssetModel->GetCssFiles($ThemeType, ucfirst(substr($CssFile, 0, -4)), $ETag);
                         foreach ($CssFiles as $Info) {
                             $this->Head->AddCss($Info[1], 'all', TRUE, $CssInfo);
                         }
                     } else {
                         $Basename = substr($CssFile, 0, -4);
                         $this->Head->AddCss(Url("/utility/css/{$ThemeType}/{$Basename}-{$ETag}.css", '//'), 'all', FALSE, $CssInfo['Options']);
                     }
                     continue;
                 }
                 if (StringBeginsWith($CssFile, 'http')) {
                     $this->Head->AddCss($CssFile, 'all', GetValue('AddVersion', $CssInfo, TRUE), $CssInfo['Options']);
                     continue;
                 } elseif (strpos($CssFile, '/') !== FALSE) {
                     // A direct path to the file was given.
                     $CssPaths = array(CombinePaths(array(PATH_ROOT, str_replace('/', DS, $CssFile))));
                 } else {
                     //                  $CssGlob = preg_replace('/(.*)(\.css)/', '\1*\2', $CssFile);
                     $AppFolder = $CssInfo['AppFolder'];
                     if ($AppFolder == '') {
                         $AppFolder = $this->ApplicationFolder;
                     }
                     // CSS comes from one of four places:
                     $CssPaths = array();
                     if ($this->Theme) {
                         // Use the default filename.
                         $CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'design' . DS . $CssFile;
                     }
                     // 3. Application or plugin.
                     if (StringBeginsWith($AppFolder, 'plugins/')) {
                         // The css is coming from a plugin.
                         $AppFolder = substr($AppFolder, strlen('plugins/'));
                         $CssPaths[] = PATH_PLUGINS . "/{$AppFolder}/design/{$CssFile}";
                         $CssPaths[] = PATH_PLUGINS . "/{$AppFolder}/{$CssFile}";
                     } elseif (in_array($AppFolder, array('static', 'resources'))) {
                         // This is a static css file.
                         $CssPaths[] = PATH_ROOT . "/resources/css/{$CssFile}";
                     } else {
                         // Application default. eg. root/applications/app_name/design/
                         $CssPaths[] = PATH_APPLICATIONS . DS . $AppFolder . DS . 'design' . DS . $CssFile;
                     }
                     // 4. Garden default. eg. root/applications/dashboard/design/
                     $CssPaths[] = PATH_APPLICATIONS . DS . 'dashboard' . DS . 'design' . DS . $CssFile;
                 }
                 // Find the first file that matches the path.
                 $CssPath = FALSE;
                 foreach ($CssPaths as $Glob) {
                     $Paths = SafeGlob($Glob);
                     if (is_array($Paths) && count($Paths) > 0) {
                         $CssPath = $Paths[0];
                         break;
                     }
                 }
                 // Check to see if there is a CSS cacher.
                 $CssCacher = Gdn::Factory('CssCacher');
                 if (!is_null($CssCacher)) {
                     $CssPath = $CssCacher->Get($CssPath, $AppFolder);
                 }
                 if ($CssPath !== FALSE) {
                     $CssPath = substr($CssPath, strlen(PATH_ROOT));
                     $CssPath = str_replace(DS, '/', $CssPath);
                     $this->Head->AddCss($CssPath, 'all', TRUE, $CssInfo['Options']);
                 }
             }
             // Add a custom js file.
             if (ArrayHasValue($this->_CssFiles, 'style.css')) {
                 $this->AddJsFile('custom.js');
             }
             // only to non-admin pages.
             // And now search for/add all JS files.
             $Cdns = array();
             if (Gdn::Request()->Scheme() != 'https' && !C('Garden.Cdns.Disable', FALSE)) {
                 $Cdns = array('jquery.js' => 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
             }
             $this->EventArguments['Cdns'] =& $Cdns;
             $this->FireEvent('AfterJsCdns');
             foreach ($this->_JsFiles as $Index => $JsInfo) {
                 $JsFile = $JsInfo['FileName'];
                 if (isset($Cdns[$JsFile])) {
                     $JsFile = $Cdns[$JsFile];
                 }
                 if (strpos($JsFile, '//') !== FALSE) {
                     // This is a link to an external file.
                     $this->Head->AddScript($JsFile, 'text/javascript', GetValue('Options', $JsInfo, array()));
                     continue;
                 } elseif (strpos($JsFile, '/') !== FALSE) {
                     // A direct path to the file was given.
                     $JsPaths = array(CombinePaths(array(PATH_ROOT, str_replace('/', DS, $JsFile)), DS));
                 } else {
                     $AppFolder = $JsInfo['AppFolder'];
                     if ($AppFolder == '') {
                         $AppFolder = $this->ApplicationFolder;
                     }
                     // JS can come from a theme, an any of the application folder, or it can come from the global js folder:
                     $JsPaths = array();
                     if ($this->Theme) {
                         // 1. Application-specific js. eg. root/themes/theme_name/app_name/design/
                         $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . $AppFolder . DS . 'js' . DS . $JsFile;
                         // 2. Garden-wide theme view. eg. root/themes/theme_name/design/
                         $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'js' . DS . $JsFile;
                     }
                     // 3. The application or plugin folder.
                     if (StringBeginsWith(trim($AppFolder, '/'), 'plugins/')) {
                         $JsPaths[] = PATH_PLUGINS . strstr($AppFolder, '/') . "/js/{$JsFile}";
                         $JsPaths[] = PATH_PLUGINS . strstr($AppFolder, '/') . "/{$JsFile}";
                     } else {
                         $JsPaths[] = PATH_APPLICATIONS . "/{$AppFolder}/js/{$JsFile}";
                     }
                     // 4. Global JS folder. eg. root/js/
                     $JsPaths[] = PATH_ROOT . DS . 'js' . DS . $JsFile;
                     // 5. Global JS library folder. eg. root/js/library/
                     $JsPaths[] = PATH_ROOT . DS . 'js' . DS . 'library' . DS . $JsFile;
                 }
                 // Find the first file that matches the path.
                 $JsPath = FALSE;
                 foreach ($JsPaths as $Glob) {
                     $Paths = SafeGlob($Glob);
                     if (is_array($Paths) && count($Paths) > 0) {
                         $JsPath = $Paths[0];
                         break;
                     }
                 }
                 if ($JsPath !== FALSE) {
                     $JsSrc = str_replace(array(PATH_ROOT, DS), array('', '/'), $JsPath);
                     $Options = (array) $JsInfo['Options'];
                     $Options['path'] = $JsPath;
                     $Version = GetValue('Version', $JsInfo);
                     if ($Version) {
                         TouchValue('version', $Options, $Version);
                     }
                     $this->Head->AddScript($JsSrc, 'text/javascript', $Options);
                 }
             }
         }
         // Add the favicon.
         $Favicon = C('Garden.FavIcon');
         if ($Favicon) {
             $this->Head->SetFavIcon(Gdn_Upload::Url($Favicon));
         }
         // Make sure the head module gets passed into the assets collection.
         $this->AddModule('Head');
     }
     // Master views come from one of four places:
     $MasterViewPaths = array();
     $MasterViewPath2 = ViewLocation($this->MasterView() . '.master', '', $this->ApplicationFolder);
     if (strpos($this->MasterView, '/') !== FALSE) {
         $MasterViewPaths[] = CombinePaths(array(PATH_ROOT, str_replace('/', DS, $this->MasterView) . '.master*'));
     } else {
         if ($this->Theme) {
             // 1. Application-specific theme view. eg. root/themes/theme_name/app_name/views/
             $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
             // 2. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/
             $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, 'views', $this->MasterView . '.master*'));
         }
         // 3. Application default. eg. root/app_name/views/
         $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
         // 4. Garden default. eg. root/dashboard/views/
         $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', $this->MasterView . '.master*'));
     }
     // Find the first file that matches the path.
     $MasterViewPath = FALSE;
     foreach ($MasterViewPaths as $Glob) {
         $Paths = SafeGlob($Glob);
         if (is_array($Paths) && count($Paths) > 0) {
             $MasterViewPath = $Paths[0];
             break;
         }
     }
     if ($MasterViewPath != $MasterViewPath2) {
         Trace("Master views differ. Controller: {$MasterViewPath}, ViewLocation(): {$MasterViewPath2}", TRACE_WARNING);
     }
     $this->EventArguments['MasterViewPath'] =& $MasterViewPath;
     $this->FireEvent('BeforeFetchMaster');
     if ($MasterViewPath === FALSE) {
         trigger_error(ErrorMessage("Could not find master view: {$this->MasterView}.master*", $this->ClassName, '_FetchController'), E_USER_ERROR);
     }
     /// A unique identifier that can be used in the body tag of the master view if needed.
     $ControllerName = $this->ClassName;
     // Strip "Controller" from the body identifier.
     if (substr($ControllerName, -10) == 'Controller') {
         $ControllerName = substr($ControllerName, 0, -10);
     }
     // Strip "Gdn_" from the body identifier.
     if (substr($ControllerName, 0, 4) == 'Gdn_') {
         $ControllerName = substr($ControllerName, 4);
     }
     $this->SetData('CssClass', $this->Application . ' ' . $ControllerName . ' ' . $this->RequestMethod . ' ' . $this->CssClass, TRUE);
     // Check to see if there is a handler for this particular extension.
     $ViewHandler = Gdn::Factory('ViewHandler' . strtolower(strrchr($MasterViewPath, '.')));
     if (is_null($ViewHandler)) {
         $BodyIdentifier = strtolower($this->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::AlphaNumeric(strtolower($this->RequestMethod)));
         include $MasterViewPath;
     } else {
         $ViewHandler->Render($MasterViewPath, $this);
     }
 }
Exemplo n.º 24
0
 /**
  *
  *
  * @param SiteNavModule $sender
  */
 public function siteNavModule_init_handler($sender)
 {
     // GLOBALS
     // Add a link to the community home.
     $sender->addLinkToGlobals(t('Community Home'), '/', 'main.home', '', -100, array('icon' => 'home'), false);
     $sender->addGroupToGlobals('', 'etc', '', 100);
     $sender->addLinkToGlobalsIf(Gdn::session()->isValid() && IsMobile(), t('Full Site'), '/profile/nomobile', 'etc.nomobile', '', 100, array('icon' => 'resize-full'));
     $sender->addLinkToGlobalsIf(Gdn::session()->isValid(), t('Sign Out'), SignOutUrl(), 'etc.signout', '', 100, array('icon' => 'signout'));
     $sender->addLinkToGlobalsIf(!Gdn::session()->isValid(), t('Sign In'), SigninUrl(), 'etc.signin', '', 100, array('icon' => 'signin'));
     // DEFAULTS
     if (!Gdn::session()->isValid()) {
         return;
     }
     $sender->addLinkIf(Gdn::session()->isValid(), t('Profile'), '/profile', 'main.profile', 'profile', 10, array('icon' => 'user'))->addLinkIf('Garden.Activity.View', t('Activity'), '/activity', 'main.activity', 'activity', 10, array('icon' => 'time'));
     // Add the moderation items.
     $sender->addGroup(t('Moderation'), 'moderation', 'moderation', 90);
     if (Gdn::session()->checkPermission('Garden.Users.Approve')) {
         $RoleModel = new RoleModel();
         $applicant_count = (int) $RoleModel->getApplicantCount();
         if ($applicant_count > 0 || true) {
             $sender->addLink(t('Applicants'), '/user/applicants', 'moderation.applicants', 'applicants', array(), array('icon' => 'user', 'badge' => $applicant_count));
         }
     }
     $sender->addLinkIf('Garden.Moderation.Manage', t('Spam Queue'), '/log/spam', 'moderation.spam', 'spam', array(), array('icon' => 'spam'))->addLinkIf('Garden.Settings.Manage', t('Dashboard'), '/settings', 'etc.dashboard', 'dashboard', array(), array('icon' => 'dashboard'));
     $user = Gdn::controller()->data('Profile');
     $user_id = val('UserID', $user);
     //EDIT PROFILE SECTION
     // Users can edit their own profiles and moderators can edit any profile.
     $sender->addLinkToSectionIf(hasEditProfile($user_id), 'EditProfile', t('Profile'), userUrl($user, '', 'edit'), 'main.editprofile', '', array(), array('icon' => 'edit'))->addLinkToSectionIf('Garden.Users.Edit', 'EditProfile', t('Edit Account'), '/user/edit/' . $user_id, 'main.editaccount', 'Popup', array(), array('icon' => 'cog'))->addLinkToSection('EditProfile', t('Back to Profile'), userUrl($user), 'main.profile', '', 100, array('icon' => 'arrow-left'));
     //PROFILE SECTION
     $sender->addLinkToSectionIf(c('Garden.Profile.ShowActivities', true), 'Profile', t('Activity'), userUrl($user, '', 'activity'), 'main.activity', '', array(), array('icon' => 'time'))->addLinkToSectionIf(Gdn::controller()->data('Profile.UserID') == Gdn::session()->UserID, 'Profile', t('Notifications'), userUrl($user, '', 'notifications'), 'main.notifications', '', array(), array('icon' => 'globe', 'badge' => Gdn::controller()->data('Profile.CountNotifications')))->addLinkToSectionIf(strcasecmp(c('Garden.Registration.Method'), 'invitation') === 0, 'Profile', t('Invitations'), userUrl($user, '', 'invitations'), 'main.invitations', '', array(), array('icon' => 'ticket'))->addLinkToSectionIf(hasEditProfile($user_id), 'Profile', t('Edit Profile'), userUrl($user, '', 'edit'), 'Profile', 'main.editprofile', '', array(), array('icon' => 'edit'));
 }
Exemplo n.º 25
0
 /**
  * Lookup the path to a CSS file and return its info array
  *
  * @param string $Filename name/relative path to css file
  * @param string $Folder optional. app or plugin folder to search
  * @param string $ThemeType mobile or desktop
  * @return array|bool
  */
 public static function cssPath($Filename, $Folder = '', $ThemeType = '')
 {
     if (!$ThemeType) {
         $ThemeType = IsMobile() ? 'mobile' : 'desktop';
     }
     // 1. Check for a url.
     if (IsUrl($Filename)) {
         return array($Filename, $Filename);
     }
     $Paths = array();
     // 2. Check for a full path.
     if (strpos($Filename, '/') !== false) {
         $Filename = ltrim($Filename, '/');
         // Direct path was given
         $Filename = "/{$Filename}";
         $Path = PATH_ROOT . $Filename;
         if (file_exists($Path)) {
             Deprecated("AssetModel::CssPath() with direct paths");
             return array($Path, $Filename);
         }
         return false;
     }
     // 3. Check the theme.
     $Theme = Gdn::ThemeManager()->ThemeFromType($ThemeType);
     if ($Theme) {
         $Path = "/{$Theme}/design/{$Filename}";
         $Paths[] = array(PATH_THEMES . $Path, "/themes{$Path}");
     }
     // 4. Static, Plugin, or App relative file
     if ($Folder) {
         if (in_array($Folder, array('resources', 'static'))) {
             $Path = "/resources/design/{$Filename}";
             $Paths[] = array(PATH_ROOT . $Path, $Path);
             // A plugin-relative path was given
         } elseif (stringBeginsWith($Folder, 'plugins/')) {
             $Folder = substr($Folder, strlen('plugins/'));
             $Path = "/{$Folder}/design/{$Filename}";
             $Paths[] = array(PATH_PLUGINS . $Path, "/plugins{$Path}");
             // Allow direct-to-file links for plugins
             $Paths[] = array(PATH_PLUGINS . "/{$Folder}/{$Filename}", "/plugins/{$Folder}/{$Filename}", true);
             // deprecated
             // An app-relative path was given
         } else {
             $Path = "/{$Folder}/design/{$Filename}";
             $Paths[] = array(PATH_APPLICATIONS . $Path, "/applications{$Path}");
         }
     }
     // 5. Check the default application.
     if ($Folder != 'dashboard') {
         $Paths[] = array(PATH_APPLICATIONS . "/dashboard/design/{$Filename}", "/applications/dashboard/design/{$Filename}", true);
         // deprecated
     }
     foreach ($Paths as $Info) {
         if (file_exists($Info[0])) {
             if (!empty($Info[2])) {
                 // This path is deprecated.
                 unset($Info[2]);
                 Deprecated("The css file '{$Filename}' in folder '{$Folder}'");
             }
             return $Info;
         }
     }
     if (!(StringEndsWith($Filename, 'custom.css') || StringEndsWith($Filename, 'customadmin.css'))) {
         trace("Could not find file '{$Filename}' in folder '{$Folder}'.");
     }
     return false;
 }
Exemplo n.º 26
0
    <link rel="stylesheet" href="foundation/css/foundation.css" />
    <script src="foundation/js/vendor/modernizr.js"></script>

</head>
<body >
<?php 
?>
    <!-- Inicio do Container -->
    
    <div class="container">
        <!-- Inicio do Conteúdo Header -->
        <header class="row">

            <h1 style="display:none;">Criação de Sites / Desenvolvimento de Sistemas Web - Com espírito inovador, a Scripting Studios Art desenvolve soluções criativas e inteligentes para seus clientes, com o intuito de que a apresentação da empresa na internet alcance os resultados esperados.</h1>
            <?php 
if (IsMobile() === 0) {
    ?>

            <ul class="nav nav-tabs sans">
                <li <?php 
    if (!isset($page)) {
        ?>
 class="active" <?php 
    }
    ?>
 >
                    <a <?php 
    if (isset($page)) {
        ?>
 href="Home" <?php 
    } else {
Exemplo n.º 27
0
 public function CurrentTheme()
 {
     return C(!IsMobile() ? 'Garden.Theme' : 'Garden.MobileTheme', 'default');
 }
Exemplo n.º 28
0
 /**
  *
  *
  * @param SiteNavModule $sender
  */
 public function siteNavModule_all_handler($sender)
 {
     // Add a link to the community home.
     $sender->addLink('main.home', array('text' => t('Community Home'), 'url' => '/', 'icon' => icon('home'), 'sort' => -100));
     $sender->addGroup('etc', array('sort' => 100));
     if (Gdn::session()->isValid()) {
         // Switch between the full site and mobile.
         if (IsMobile()) {
             $sender->addLink('etc.nomobile', array('text' => t('Full Site'), 'url' => '/profile/nomobile', 'icon' => icon('resize-full'), 'sort' => 100));
         }
         $sender->addLink('etc.signout', array('text' => t('Sign Out'), 'url' => SignOutUrl(), 'icon' => icon('signout'), 'sort' => 100));
     } else {
         $sender->addLink('etc.signin', array('text' => t('Sign In'), 'url' => SignInUrl(), 'icon' => icon('signin'), 'sort' => 100));
     }
 }
Exemplo n.º 29
0
 /**
  * Returns a boolean value indicating if sign in windows should be "popped"
  * into modal in-page popups.
  */
 function SignInPopup()
 {
     return C('Garden.SignIn.Popup') && !IsMobile();
 }
Exemplo n.º 30
0
<?php

$format = strtolower($this->data('_EditorInputFormat'));
$html_toolbar = '';
// for regular text
$css_upload_class = $this->data('_canUpload') ? 'editor-uploads' : 'editor-uploads-disabled';
$css_ismobile_class = IsMobile() ? 'editor-mobile' : 'editor-desktop';
$html_toolbar = '<div class="editor editor-format-' . $format . ' ' . $css_upload_class . ' ' . $css_ismobile_class . '">';
$html_arrow_down = '<span class="icon icon-caret-down"></span>';
$editor_file_input_name = $this->data('_editorFileInputName');
foreach ($this->data('_EditorToolbar') as $button) {
    // If the type is not an array, it's a regular button (type==button)
    if (!is_array($button['type'])) {
        $html_toolbar .= wrap('', 'span', $button['attr']);
    } else {
        // Else this button has dropdown options, so generate them
        $html_button_dropdown_options = '';
        foreach ($button['type'] as $type_key => $button_option) {
            // If any text, use it
            $action_text = isset($button_option['text']) ? $button_option['text'] : '';
            // If the dropdown child elements require a different tag,
            // specify it in the array, then grab it here, otherwise
            // use the default, being a span.
            $html_tag = isset($button_option['html_tag']) ? $button_option['html_tag'] : 'span';
            // Concatenate child elements
            if (isset($button_option['attr'])) {
                $html_button_dropdown_options .= wrap($action_text, $html_tag, $button_option['attr']);
            }
        }
        switch ($button['action']) {
            case 'link':