Fix and add a lot of templates

tags/0.1.0
Daniel Berteaud 11 years ago
parent 1fafc84198
commit 688dd2adf2
  1. 11
      createlinks
  2. 1
      root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/limesurvey
  3. 3
      root/etc/e-smith/templates.metadata/usr/share/limesurvey/application/config/config.php
  4. 47
      root/etc/e-smith/templates/etc/e-smith/sql/init/limesurvey
  5. 33
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98LimeSurvey
  6. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/60LimeSurveySSL
  7. 1
      root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/10BasePath
  8. 39
      root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/20Conf
  9. 48
      root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/25ProfileHook

@ -0,0 +1,11 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
# Templates to expand
templates2events("/etc/e-smith/sql/init/opensondage", qw(bootstrap-console-save webapps-update));
templates2events("/usr/share/limesurvey/application/config/config.php", qw(bootstrap-console-save webapps-update));
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/template-end");

@ -0,0 +1,47 @@
{
my $db = ${'limesurvey'}{'DbName'} || 'limesurvey';
my $user = ${'limesurvey'}{'DbUser'} || 'limesurvey';
my $pass = ${'limesurvey'}{'DbPassword'} || 'secret';
my $schema = "/usr/share/limesurvey/installer/sql/create-mysql.sql";
$OUT .= <<"END";
#! /bin/sh
if [ ! -d /var/lib/mysql/$db ]; then
/usr/bin/mysql -e 'create database $db'
cat $schema | perl -pe 's/prefix_//g' | /usr/bin/mysql $db
fi
/usr/bin/mysql <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
password)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'));
REPLACE INTO db (
host,
db,
user,
select_priv, insert_priv, update_priv, delete_priv,
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
grant_priv, lock_tables_priv, references_priv)
VALUES (
'localhost',
'$db',
'$user',
'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y',
'N', 'Y', 'Y');
FLUSH PRIVILEGES;
EOF
END
}

@ -2,10 +2,14 @@
my $access = $limesurvey{'access'} || 'private';
my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess";
my $alias = (($limesurvey{'AliasOnPrimary'} || 'enabled') eq 'enabled') ?
my $alias = (($limesurvey{'AliasOnPrimary'} || 'enabled') ne 'enabled') ?
'':"Alias /limesurvey/tmp /var/lib/limesurvey/tmp\n" .
"Alias /limesurvey/upload /var/lib/limesurvey/upload\n" .
"Alias /limesurvey /usr/share/limesurvey";
my $auth = (($limesurvey{'Authentication'} || 'http') eq 'http') ? "AuthName \"LimeSurvey\"\n" .
" AuthType Basic\n" .
" AuthExternal pwauth\n" .
" Require valid-user\n" : '';
if ($limesurvey{'status'} eq 'enabled'){
@ -15,7 +19,9 @@ $OUT .=<<"END"
$alias
<Directory /usr/share/limesurvey>
AllowOverride None
Options None
Options +FollowSymLinks
AllowOverride All
SSLRequireSSL on
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/limesurvey:/var/lib/limesurvey
@ -33,28 +39,13 @@ $alias
allow from $allow
Satisfy all
</Directory>
<DirectoryMatch "/var/lib/limesurvey/(tmp|upload)">
AllowOverride None
<Directory /usr/share/limesurvey/admin>
SSLRequireSSL on
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/limesurvey:/var/lib/limesurvey
php_admin_flag file_uploads On
php_admin_flag magic_quotes Off
php_admin_flag magic_quotes_gpc Off
php_admin_value upload_max_filesize 10M
php_admin_value post_max_size 12M
php_admin_value memory_limit 100M
php_admin_value max_execution_time 120
php_admin_value upload_tmp_dir /var/lib/limesurvey/tmp
php_admin_value session.save_path /var/lib/limesurvey/sessions
order deny,allow
deny from all
allow from $allow
Satisfy all
$auth
</Directory>
<DirectoryMatch "/usr/share/limesurvey/(framework|console|installer/sql|locale)">
<DirectoryMatch "/usr/share/limesurvey/(framework|console|installer/sql|locale|application/(logs|config)|docs)">
Deny from all
</Directory>
</DirectoryMatch>
END
}

@ -6,7 +6,7 @@ my $alias = $limesurvey{'AliasOnPrimary'} || 'enabled';
if (($port ne $sslport) && ($status eq 'enabled') && ($alias eq 'enabled')){
## Redirect Web Address to Secure Address
$OUT .= " RewriteRule ^/limesurvey(/.*|\$) https://%{HTTP_HOST}/limesurvey\$1 \[L,R\]\n";
$OUT .= " RewriteRule ^/limesurvey/admin(/.*|\$) https://%{HTTP_HOST}/limesurvey/admin\$1 \[L,R\]\n";
}
}

@ -0,0 +1 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');

@ -0,0 +1,39 @@
return array(
'basePath' => dirname(dirname(__FILE__)),
'runtimePath' => dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'runtime',
'name' => 'LimeSurvey',
'defaultController' => 'survey',
'import' => array(
'application.core.*',
'application.models.*',
'application.controllers.*',
'application.modules.*',
),
'components' => array(
'db' => array(
'connectionString' => 'mysql:unix_socket=/var/lib/mysql/mysql.sock;dbname={$limesurevey{'DbName'} || 'limesurvey'};',
'emulatePrepare' => true,
'username' => '{$limesurevey{'DbUser'} || 'limesurvey'}',
'password' => '{$limesurevey{'DbPassword'} || 'limesurvey'}',
'charset' => 'utf8',
'tablePrefix' => '',
),
'urlManager' => array(
'urlFormat' => 'path',
'rules' => require('routes.php'),
'showScriptName' => true,
),
),
'config'=>array(
'debug'=>0,
'debugsql'=>0,
'auth_webserver' => true,
'auth_webserver_autocreate_user' => true,
'siteadminemail' => 'admin@'.{$DomainName},
'emailmethod' => 'smtp',
'protocol' => 'smtp',
'emailsmtphost' => 'localhost',
)
);

@ -0,0 +1,48 @@
{
my $lang = $sysconfig{'Language'} || 'en_US';
$lang = substr $lang, 0, 2;
$OUT .=<<"EOF";
function hook_get_auth_webserver_profile(\$user_name) {
if (!isset(\$_SERVER['REMOTE_USER'])){
return false;
}
\$login = \$_SERVER['REMOTE_USER'];
if (isset(\$_SERVER['HTTP_USER_NAME'])){
\$name = \$_SERVER['HTTP_USER_NAME'];
}
else{
\$name = \$login;
}
if (isset(\$_SERVER['HTTP_USER_EMAIL'])){
\$email = \$_SERVER['HTTP_USER_EMAIL'];
}
else{
\$email = \$login . '\@$DomainName';
}
if (isset(\$_SERVER['HTTP_USER_GROUPS']) && in_array('admins', preg_split("/; /", \$_SERVER['HTTP_USER_GROUPS']))){
\$admin = 1;
}
else{
\$admin = 0;
}
return Array(
'full_name' => \$name,
'email' => \$email,
'lang' => '$lang',
'htmleditormode' => 'inline',
'templatelist' => 'default,basic,MyOrgTemplate',
'create_survey' => 1,
'create_user' => \$admin,
'delete_user' => \$admin,
'superadmin' => \$admin,
'configurator' => \$admin,
'manage_template' => \$admin,
'manage_label' => \$admin
);
}
EOF
}
Loading…
Cancel
Save