Beispiel #1
0
 /**
  * Setup initial
  * $this->aPageVars variables.
  * This variables are used by tplMain
  * - a main web page templates, regardless of
  * which controller is called - these vars are
  * always added to the page
  *
  *
  * @return object $this
  */
 protected function initPageVars()
 {
     if (!$this->bInitPageVars || Request::isAjax() || 'logout' === $this->action || 'login' === $this->action) {
         d('special case: ' . $this->action);
         return $this;
     }
     $Viewer = $this->Registry->Viewer;
     $this->aPageVars = \tplMain::getVars();
     $Ini = $this->Registry->Ini;
     $this->aPageVars['site_title'] = $Ini->SITE_TITLE;
     $this->aPageVars['site_url'] = $Ini->SITE_URL;
     $this->aPageVars['description'] = $this->aPageVars['site_description'] = $Ini->SITE_NAME;
     $this->aPageVars['show_comments'] = $Ini->SHOW_COMMENTS;
     $this->aPageVars['max_comments'] = $Ini->MAX_COMMENTS;
     $this->aPageVars['comments_timeout'] = $Ini->COMMENT_EDIT_TIME;
     $this->aPageVars['layoutID'] = $this->layoutID;
     $this->aPageVars['DISABLE_AUTOCOMPLETE'] = $Ini->DISABLE_AUTOCOMPLETE;
     $this->aPageVars['JS_MIN_ID'] = JS_MIN_ID;
     $this->aPageVars['home'] = $this->_('Home');
     /**
      * @todo later can change to something like
      * $this->oRegistrty->Viewer->getStyleID()
      *
      */
     $css = true === LAMPCMS_DEBUG ? '/_main.css' : '/main.css';
     $this->aPageVars['main_css'] = $Ini->CSS_SITE . '/style/' . STYLE_ID . '/' . VTEMPLATES_DIR . $css;
     if ('' !== ($gfcID = $Ini->GFC_ID)) {
         $this->addGFCCode($gfcID);
     }
     $aFacebookConf = $Ini->getSection('FACEBOOK');
     if (!empty($aFacebookConf)) {
         if (!empty($aFacebookConf['APP_ID'])) {
             $this->addMetaTag('fbappid', $aFacebookConf['APP_ID']);
             $this->addFacebookJs($aFacebookConf['APP_ID']);
             if (!empty($aFacebookConf['EXTENDED_PERMS'])) {
                 $this->addMetaTag('fbperms', $aFacebookConf['EXTENDED_PERMS']);
             }
         }
     }
     $this->aPageVars['session_uid'] = $Viewer->getUid();
     $this->aPageVars['role'] = $Viewer->getRoleId();
     $this->aPageVars['rep'] = $Viewer->getReputation();
     $this->aPageVars['version_id'] = Form::generateToken();
     /**
      * meta 'tw' will be set to string "1" if user has conneted Twitter
      */
     $this->addMetaTag('tw', '' !== (string) $Viewer->getTwitterSecret());
     /**
      * meta 'tw' will be set to string "1" if user has conneted Facebook
      */
     $this->addMetaTag('fb', '' !== (string) $Viewer->getFacebookToken());
     $js = true === LAMPCMS_DEBUG ? '/qa.js' : '/min/qa_' . JS_MIN_ID . '.js';
     //$js = (true === LAMPCMS_DEBUG) ? '/temp1.js' : '/min/qa_'.JS_MIN_ID.'.js';
     $src = $Ini->JS_SITE . '/js' . $js;
     $this->aPageVars['JS'] = $src;
     /**
      * @todo
      *  also add twitter id or username or just 'yes'
      *  of viewer so that we know viewer has twitter account
      *  and is capable of using twitter from our API
      *  Also we can ask use to add Twitter account
      *  if we know he does not have one connected yet
      */
     return $this;
 }
 protected function prepareVars()
 {
     $this->aVars = array('titleBar' => 'Welcome to ' . $this->Registry->Ini->SITE_NAME, 'token' => Form::generateToken(), 'title' => 'Welcome to ' . $this->Registry->Ini->SITE_NAME, 'header2' => '<div class="step2">@@Join us! It\'s super easy and free@@!</div>', 'captcha' => $this->makeCaptchaBlock(), 'action' => 'quickreg', 'td1width' => '200px', 'td2' => $this->makeSocialAuthBlock(), 'loginBlock' => $this->makeLoginBlock());
     $this->addUsernameBlock();
     return $this;
 }
    /**
     *
     * Make html form that asks
     * a user to select one blog from the
     * list of all user's blogs on Blogger
     * 
     * @return string html of the form
     */
    protected function makeBlogSelectionForm()
    {
        /**
         * @todo Translate string
         */
        $label = 'You have more than one blog on Blogger.<br>
			 Please select one blog that will be connected to this account.<br>
			 <br>When you select the "Post to Blogger" option, your<br>
			 Posts will be posted to this blog.';
        /**
         * @todo Translate string
         */
        $save = 'Save';
        $token = \Lampcms\Forms\Form::generateToken();
        $options = '';
        $tpl = '<option value="blog%s">%s</option>';
        foreach ($this->aBlogs as $id => $blog) {
            $options .= sprintf($tpl, $id, $blog['title']);
        }
        $vars = array('token' => $token, 'options' => $options, 'label' => $label, 'save' => $save, 'a' => 'connectblogger');
        return \tplTumblrblogs::parse($vars);
    }
 public function __construct(\Lampcms\Registry $R, $selected = 0)
 {
     $this->selected = $selected;
     parent::__construct($R);
 }
 /**
  *
  * Generates HTML with drop-down roles menu
  * and a Shred button if current Viewer has necessary
  * permissions
  *
  * @param Registry $Registry
  * @param User $User user whose profile is being viewed now
  * @return string html fragment with Form and button
  */
 public static function getHtml(Registry $Registry, User $User)
 {
     $oACL = $Registry->Acl;
     $options = '';
     $shredButton = '';
     $token = '';
     $uid = $User->getUid();
     $role = $Registry->Viewer->getRoleId();
     d('role: ' . $role);
     if ($oACL->isAllowed($role, null, 'change_user_role')) {
         d('change_user_role is allowed');
         $userRole = $User->getRoleId();
         $roles = $oACL->getRegisteredRoles();
         $token = Form::generateToken();
         foreach ($roles as $roleName => $val) {
             $selected = $roleName === $userRole ? ' selected' : '';
             $options .= "\n" . vsprintf('<option value="%1$s"%2$s>%1$s</option>', array($roleName, $selected));
         }
     }
     if ($oACL->isAllowed($role, null, 'shred_user')) {
         d('getting shred button');
         $shredButton = '<div class="fl cb"><input type="button" class="ajax btn_shred rounded4" value="@@Shred User@@" id="shred' . $uid . '"></div>';
     }
     if (empty($options) && empty($shredButton)) {
         return '';
     }
     return \tplSelectrole::parse(array($token, $uid, $options, $shredButton), false);
 }
Beispiel #6
0
 /**
  * @param \Lampcms\Registry $R
  * @param int               $selected the category id. This only applies to Question
  * @param bool              $isAnswer if true then this edit form is for the Answer
  *                                    otherwise the form is for the question
  */
 public function __construct(\Lampcms\Registry $R, $selected = 0, $isAnswer = false)
 {
     $this->selected = $selected;
     $this->isAnswer = $isAnswer;
     parent::__construct($R);
 }
 /**
  * Render the form with textarea where admin
  * will enter the mongo shell command
  */
 protected function renderForm()
 {
     $this->aPageVars['title'] = '@@Update Mongo Database@@';
     $this->aPageVars['body'] = \tplMongoShell::parse(array(\Lampcms\Forms\Form::generateToken()));
 }
Beispiel #8
0
 /**
  * Setup initial
  * $this->aPageVars variables.
  * This variables are used by tplMain
  * - a main web page templates, regardless of
  * which controller is called - these vars are
  * always added to the page
  *
  *
  * @return object $this
  */
 protected function initPageVars()
 {
     if (!$this->bInitPageVars || Request::isAjax() || 'logout' === $this->action || 'login' === $this->action) {
         d('special case: ' . $this->action);
         return $this;
     }
     $Viewer = $this->Registry->Viewer;
     $this->aPageVars = \tplMain::getVars();
     $Ini = $this->Registry->Ini;
     $this->aPageVars['site_title'] = $Ini->SITE_TITLE;
     $this->aPageVars['site_url'] = $Ini->SITE_URL;
     $this->aPageVars['description'] = $this->aPageVars['site_description'] = $Ini->SITE_NAME;
     $this->aPageVars['show_comments'] = $Ini->SHOW_COMMENTS;
     $this->aPageVars['max_comments'] = $Ini->MAX_COMMENTS;
     $this->aPageVars['comments_timeout'] = $Ini->COMMENT_EDIT_TIME;
     $this->aPageVars['layoutID'] = $this->layoutID;
     $this->aPageVars['DISABLE_AUTOCOMPLETE'] = $Ini->DISABLE_AUTOCOMPLETE;
     $this->aPageVars['VERSION_ID'] = VERSION_ID;
     $this->aPageVars['home'] = $this->_('Home');
     /**
      * @todo later can change to something like
      * $this->Registrty->Viewer->getStyleID()
      *       To load style selected by user
      *
      */
     /**
      * If In debug mode OR running from github (not from build) then include non-minified version of css
      */
     $css = true === LAMPCMS_DEBUG || \strstr(VERSION_ID, 'package_version') ? '/_main.css?t=' . time() : '/main.css';
     $this->aPageVars['main_css'] = '{_CSS_SITE_}{_DIR_}/style/' . STYLE_ID . '/' . VTEMPLATES_DIR . $css;
     $aFacebookConf = $Ini->getSection('FACEBOOK');
     if (!empty($aFacebookConf)) {
         if (!empty($aFacebookConf['APP_ID'])) {
             $this->addMetaTag('fbappid', $aFacebookConf['APP_ID']);
             $this->addFacebookJs($aFacebookConf['APP_ID']);
             if (!empty($aFacebookConf['EXTENDED_PERMS'])) {
                 $this->addMetaTag('fbperms', $aFacebookConf['EXTENDED_PERMS']);
             }
         }
     }
     $this->aPageVars['session_uid'] = $Viewer->getUid();
     $this->aPageVars['role'] = $Viewer->getRoleId();
     $this->aPageVars['rep'] = $Viewer->getReputation();
     $this->aPageVars['version_id'] = Form::generateToken();
     /**
      * meta 'tw' will be set to string "1" if user has connected Twitter
      */
     $this->addMetaTag('tw', '' !== (string) $Viewer->getTwitterSecret());
     /**
      * meta 'tw' will be set to string "1" if user has connected Facebook
      */
     $this->addMetaTag('fb', '' !== (string) $Viewer->getFacebookToken());
     /**
      * If running in debug mode OR from github (not from build) then include non-minified version of qa.js
      */
     $js = true === LAMPCMS_DEBUG || \strstr(VERSION_ID, 'package_version') ? '/qa.js?t=' . time() : '/min/qa_' . VERSION_ID . '.js';
     $src = '{_JS_SITE_}{_DIR_}/js' . $js;
     $this->aPageVars['JS'] = $src;
     return $this;
 }