コード例 #1
0
 public function execute($request)
 {
     $request->setRequestFormat('xml');
     $this->date = gmdate('Y-m-d\\TH:i:s\\Z');
     $this->title = sfconfig::get('app_siteTitle');
     $this->description = sfconfig::get('app_siteDescription');
     $this->protocolVersion = '2.0';
     list($this->earliestDatestamp) = Propel::getConnection()->query('SELECT MIN(' . QubitObject::UPDATED_AT . ') FROM ' . QubitObject::TABLE_NAME)->fetch();
     $this->granularity = 'YYYY-MM-DDThh:mm:ssZ';
     $this->deletedRecord = 'no';
     $this->compression = 'gzip';
     $this->path = url_for('oai/oaiAction');
     $this->attributes = $this->request->getGetParameters();
     $this->attributesKeys = array_keys($this->attributes);
     $this->requestAttributes = '';
     foreach ($this->attributesKeys as $key) {
         $this->requestAttributes .= ' ' . $key . '="' . $this->attributes[$key] . '"';
     }
     $criteria = new Criteria();
     $criteria->add(QubitAclUserGroup::GROUP_ID, QubitAclGroup::ADMINISTRATOR_ID);
     $criteria->addJoin(QubitAclUserGroup::USER_ID, QubitUser::ID);
     $users = QubitUser::get($criteria);
     $this->adminEmail = array();
     foreach ($users as $user) {
         $this->adminEmail[] = $user->getEmail() . "\n";
     }
 }
コード例 #2
0
 public function getThumbnail()
 {
     if (!$this->thumbnail) {
         $this->thumbnail = new self($this->getUrlDir() . '/' . sfconfig::get('app_sf_media_browser_thumbnails_dir') . '/' . $this->getName());
     }
     return file_exists($this->thumbnail->getPath()) ? $this->thumbnail : null;
 }
コード例 #3
0
 public function preExecute()
 {
     // symfony web path
     $this->web_path = sfConfig::get('sf_web_dir');
     // Configured root dir
     $this->root_dir = sfconfig::get('app_sf_media_browser_root_dir');
     $this->root_path = realpath($this->web_path . '/' . $this->root_dir);
 }
コード例 #4
0
 public function preExecute()
 {
     // Configured root dir
     $this->root_dir = sfconfig::get('app_sf_media_browser_root_dir');
     // Calculated root path
     $this->root_path = realpath(sfConfig::get('sf_web_dir') . '/' . $this->root_dir);
     $this->requested_dir = urldecode($this->getRequestParameter('dir'));
     $this->requested_dir = $this->checkPath($this->root_path . '/' . $this->requested_dir) ? preg_replace('`(/)+`', '/', $this->requested_dir) : '/';
 }
コード例 #5
0
 public function execute($filterChain)
 {
     $context = $this->getContext();
     $user = $context->getUser();
     $firstCall = $this->isFirstCall();
     //attempt to log in user if they have the sfRemember cookie
     if (sfconfig::get('app_login_enabled') && $firstCall && (!$user->isAuthenticated() || !$user->getGuardUser())) {
         if ($cookie = $context->getRequest()->getCookie(sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember'))) {
             $q = Doctrine_Query::create()->from('sfGuardRememberKey r')->innerJoin('r.sfGuardUser u')->where('r.remember_key = ?', $cookie);
             //if login restricted to admins only
             if (sfConfig::get('app_login_admin_only') == 'on') {
                 $q->leftJoin('u.sfGuardUserGroup g')->leftJoin('u.sfGuardUserPermission p')->andWhere('g.group_id = 1 OR p.permission_id = 1');
             }
             if ($q->count()) {
                 $user->signIn($q->fetchOne()->sfGuardUser);
             } else {
                 $context->getResponse()->setCookie(sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember'), false, time() - 86400);
             }
         }
     }
     if ($firstCall && sfConfig::get('app_login_admin_only') == 'on' && $user->isAuthenticated()) {
         if (!sfGuardUserTable::isAdmin($user->getGuardUser()->id)) {
             $options = $context->getStorage()->getOptions();
             $cookieName = $options['session_name'];
             $user->setAuthenticated(false);
             $context->getResponse()->setCookie(sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember'), false, time() - 86400);
             $context->getResponse()->setCookie($cookieName, false, time() - 86400);
         }
     }
     if (!sfconfig::get('app_login_enabled')) {
         $user->signOut();
     }
     $filterChain->execute();
     //set cookie to indicate whether user us logged in
     if (sfconfig::get('app_login_enabled') && $user->isAuthenticated()) {
         $context->getResponse()->setCookie('LittleSisUser', true);
     } else {
         $context->getResponse()->setCookie('LittleSisUser', false, time() - 86400);
     }
 }
コード例 #6
0
  /**
   * Get ByTo from Component
   * @param int $memberIdTo member id
   * @return array object array
   */
  public function getComponentByTo($memberIdTo)
  {
    $introFriends = $this->getListQuery($memberIdTo)
      ->limit(sfConfig::get('app_max_introfriend'))
      ->execute();

    $list = array();
    foreach ($introFriends as $i => $introFriend)
    {
      $list[$i] = array();
      $string = $introFriend->getContent();
      $list[$i]['member'] = $introFriend->getMember_2();
      for ($j = 0, $pos = 0; $j < sfconfig::get('app_line_introfriend'); $j++)
      {
        $pos = mb_strpos($string, "\n", $pos + 1);
        if (!$pos) { break; }
      }
      if ($pos) { $string = mb_substr($string, 0, $pos - 1); }
      $list[$i]['essay'] = $string;
    }

    return $list;
  }
コード例 #7
0
ファイル: sfMmwHelper.php プロジェクト: njch/PatBati
function addMmwExtJsJavaScriptAndCss()
{
    $context = sfContext::getInstance();
    $response = $context->getResponse();
    $moduleName = $context->getModuleName();
    $baseExtjsDir = sfConfig::get('sf_mmw_extjs_javascript_dir');
    $mainExtjsJavascript = sfConfig::get('sf_extjs_javascript_main');
    $mainMmwExtjsJavascript = sfConfig::get('sf_mmw_extjs_javascript_main');
    $mainExtjsCss = sfConfig::get('sf_extjs_css_main');
    $mainMmwExtjsCss = sfConfig::get('sf_mmw_extjs_css_main');
    // add extjs javascripts
    foreach ($mainExtjsJavascript as $javascript) {
        $response->addJavascript($baseExtjsDir . $javascript, 'first');
    }
    // add i18n javascripts
    $defaultLangJavascript = $baseExtjsDir . 'lang/base/mmwExtjs-base-default.js';
    if (file_exists(sfconfig::get("sf_web_dir") . $defaultLangJavascript)) {
        $response->addJavascript($defaultLangJavascript, 'first');
    }
    $localLangJavascript = $baseExtjsDir . 'lang/base/mmwExtjs-base-' . sfContext::getInstance()->getUser()->getCulture() . '.js';
    if (file_exists(sfconfig::get("sf_web_dir") . $localLangJavascript)) {
        $response->addJavascript($localLangJavascript, 'first');
    }
    $customLocalLangJavascript = $baseExtjsDir . 'lang/custom/mmwExtjs-custom-' . sfContext::getInstance()->getUser()->getCulture() . '.js';
    if (file_exists(sfconfig::get("sf_web_dir") . $customLocalLangJavascript)) {
        $response->addJavascript($customLocalLangJavascript, 'first');
    }
    // add mmwExtjs javascripts
    foreach ($mainMmwExtjsJavascript as $javascript) {
        $response->addJavascript($baseExtjsDir . $javascript, 'first');
    }
    // add javascript added to the module.yml in the module/config
    $configuration = sfContext::getInstance()->getConfiguration();
    // On récupère les fichiers module.yml surchargés ou non du module
    $configFiles = $configuration->getConfigPaths('modules/' . $moduleName . '/config/module.yml');
    $moduleConfig['mmw_extjs_javascript_helper'] = array();
    $moduleConfig['mmw_extjs_css_helper'] = array();
    // Puis on les traite
    foreach ($configFiles as $configFile) {
        if (is_readable($configFile)) {
            $temp = sfYaml::load($configFile);
            if (isset($temp['all'])) {
                if (isset($temp['all']['mmw_extjs_javascript_helper'])) {
                    $moduleConfig['mmw_extjs_javascript_helper'] = array_values($temp['all']['mmw_extjs_javascript_helper']);
                }
                if (isset($temp['all']['mmw_extjs_css_helper'])) {
                    $moduleConfig['mmw_extjs_css_helper'] = array_values($temp['all']['mmw_extjs_css_helper']);
                }
            }
        }
    }
    // On ajoute les fichiers javascripts du module à la page
    if (isset($moduleConfig['mmw_extjs_javascript_helper'])) {
        foreach ($moduleConfig['mmw_extjs_javascript_helper'] as $javascriptFile) {
            $response->addJavascript($baseExtjsDir . $javascriptFile, 'first');
        }
    }
    // add extjs css
    foreach ($mainExtjsCss as $css) {
        $response->addStylesheet($baseExtjsDir . $css, 'first');
    }
    // add mmwExtjs css
    foreach ($mainMmwExtjsCss as $css) {
        $response->addStylesheet($baseExtjsDir . $css, 'first');
    }
    // On ajoute les fichiers css du module à la page
    if (isset($moduleConfig['mmw_extjs_css_helper'])) {
        foreach ($moduleConfig['mmw_extjs_css_helper'] as $cssFile) {
            $response->addStylesheet($baseExtjsDir . $cssFile, 'first');
        }
    }
}
コード例 #8
0
<div class="row">
	<div class="twelvecol">
		<a name="top"></a>
		<?php 
echo include_partial('datiStorici/searchWithAutocompleter', array('limit' => sfconfig::get('app_limit_interessi_argomento', 50), 'tags' => $tags, 'ramo' => $ramo, 'tag_count' => TagPeer::getAllWithCount()));
?>


	      <?php 
if (count($tags_ids)) {
    ?>
	        <div class="evidence-box float-container">

	          <h5 class="subsection">
	            I <?php 
    echo sfconfig::get('app_limit_interessi_argomento', 50);
    ?>
	            <?php 
    if ($ramo == 'C') {
        ?>
	              deputati
	            <?php 
    } else {
        ?>
	              senatori
	            <?php 
    }
    ?>
	            che pi&ugrave; si occupano di <em><?php 
    echo $tags;
    ?>