public function testQuery()
    {
        $florence_eleve = EleveQuery::create()->findOneByLogin('Florence Michu');
         
        saveSetting('abs2_saisie_par_defaut_sans_manquement','n');
        $traitements = AbsenceEleveTraitementQuery::create()->filterByManquementObligationPresence(true)
        ->useJTraitementSaisieEleveQuery()->useAbsenceEleveSaisieQuery()
        ->filterByEleve($florence_eleve)->filterByPlageTemps(new DateTime(VENDREDI_s40j5),new DateTime(DIMANCHE_s42j7.' 23:59:59'))
        ->endUse()->endUse()->find();
        $this->assertEquals(12,$traitements->count());
        $traitements = AbsenceEleveTraitementQuery::create()->filterByManquementObligationPresence(false)
        ->useJTraitementSaisieEleveQuery()->useAbsenceEleveSaisieQuery()
        ->filterByEleve($florence_eleve)->filterByPlageTemps(new DateTime(VENDREDI_s40j5),new DateTime(DIMANCHE_s42j7.' 23:59:59'))
        ->endUse()->endUse()->find();
        $this->assertEquals(7,$traitements->count());

        saveSetting('abs2_saisie_par_defaut_sans_manquement','y');
        $traitements = AbsenceEleveTraitementQuery::create()->filterByManquementObligationPresence(true)
        ->useJTraitementSaisieEleveQuery()->useAbsenceEleveSaisieQuery()
        ->filterByEleve($florence_eleve)->filterByPlageTemps(new DateTime(VENDREDI_s40j5),new DateTime(DIMANCHE_s42j7.' 23:59:59'))
        ->endUse()->endUse()->find();
        $this->assertEquals(10,$traitements->count());

        saveSetting('abs2_saisie_par_defaut_sans_manquement','n');
    }
Example #2
0
 function on_install()
 {
     $query = DB::query('SHOW TABLES');
     $tables = array();
     while ($table = DB::fetch($query)) {
         $tables[] = implode('', $table);
     }
     if (!in_array('x_meizi_a', $tables)) {
         DB::query("create table if not exists x_meizi_a(id int(10) unsigned not null auto_increment primary key,uid int(10) unsigned not null,votetype tinyint(1) unsigned not null,userid int(12) unsigned NOT NULL,fid int(12) unsigned not null,name varchar(32) not null,kw varchar(128) not null,statue text not null) ENGINE=InnoDB DEFAULT CHARSET=utf8");
         DB::query("create table if not exists x_meizi_b(id int(10) unsigned not null auto_increment primary key,uid int(10) unsigned not null,islogin tinyint(1) not null default 0,userid int(12) unsigned not null,name varchar(32) not null,cookie text not null,voted tinyint(1) unsigned not null default 0) ENGINE=InnoDB DEFAULT CHARSET=utf8");
         DB::query("create table if not exists x_meizi_log(id int(10) unsigned not null,uid int(10) unsigned NOT NULL, date int(11) not null DEFAULT 0, status tinyint(1) NOT NULL DEFAULT 0, success int(4) NOT NULL DEFAULT 0, failed int(4) NOT NULL DEFAULT 0,UNIQUE KEY id (id,date),KEY uid (uid)) ENGINE=InnoDB DEFAULT CHARSET=utf8");
         DB::query("replace into cron (`id`, `enabled`, `nextrun`, `order`) values ('x_meizi_daily',1,0, 96),('x_meizi_vote',1,0,97)");
         saveSetting('x_mz_nowid', '0');
         saveSetting('x_mz_nextrun', '0');
         saveSetting('x_meizi', $this->nowversion);
         showmessage("妹纸刷票插件" . substr($this->nowversion, 0, 5) . "版安装成功");
     }
     $version = getSetting('x_meizi');
     switch ($version) {
         case '0.1.0_13-12-03':
             DB::query("alter table x_meizi_a add votetype tinyint(1) unsigned not null default 1");
             DB::query("alter table x_meizi_log_a add votenum int(4) NOT NULL DEFAULT 0");
         case '0.1.1_13-12-04':
             DB::query("drop table x_meizi_log_b");
             DB::query("alter table x_meizi_log_a rename to x_meizi_log");
             DB::query("alter table x_meizi_log change votenum success int(4) not null default 0");
             DB::query("alter table x_meizi_log add failed int(4) not null default 0");
             DB::query("alter table x_meizi_b add voted tinyint(1) unsigned not null default 0");
         case '0.1.2_13-12-05':
             saveSetting('x_mz_nextrun', '0');
         default:
             saveSetting('x_meizi', $this->nowversion);
             showmessage('妹纸刷票插件已升级到' . substr($this->nowversion, 0, 5) . '版!');
     }
 }
Example #3
0
 function on_config()
 {
     if ($_POST['limit']) {
         saveSetting('ip_reglimit', $_POST['limit']);
         showmessage('设置已经保存!');
     } else {
         return '<p>单个 IP 注册上限:<input type="text" name="limit" value="' . getSetting('ip_reglimit') . '" /></p>';
     }
 }
Example #4
0
function showSettingsGUI()
{
    // adminpage, stop here if not logged in/right access-level
    if (!isValidAdmin()) {
        echo getString("not_valid_admin", "Administratorside, du må logge inn for å få tilgang her");
        return;
    }
    if (isset($_REQUEST['module'])) {
        $module = $_REQUEST['module'];
    } else {
        $module = "";
    }
    if (isset($_REQUEST['key'])) {
        $key = $_REQUEST['key'];
    } else {
        $key = "";
    }
    h3(getString("settings_header", "Innstillinger"));
    // mulighet til å velge andre moduler:
    showModulesDropDown($module);
    if (isset($_REQUEST['save'])) {
        if ($_REQUEST['save'] == true && $key != "") {
            // check if we got a value, if we did not, it's a unchecked checkbox.'
            // did we get a value to save?
            if (isset($_REQUEST['setting'])) {
                $value = $_REQUEST['setting'];
                // "bugfix" kind of
                if (getSettingType($key) == "boolean") {
                    // check if it is an checkbox, if so, its value is "on"
                    if ($value == "on") {
                        $value = "true";
                    }
                }
            } else {
                // setting the value to false, as this probably is an unchecked checkbox.
                $value = "false";
            }
            // save
            $result = saveSetting($key, $value);
            div_open();
            // success? reset key.
            if ($result == true) {
                // reset
                $key = "";
                echo getString("settings_saved_setting", "Innstilling lagret!");
            } else {
                echo getString("settings_could_not_save_setting", "Greide ikke å lagre innstilling!");
            }
            div_close();
        }
    }
    // if chosen, show the settings
    if ($module) {
        showModuleSettings($module, $key);
    }
}
function checkLastGuid()
{
    global $log, $cronlog, $db, $settings;
    $mylog = null;
    if (isset($cronlog) && $cronlog instanceof FroxlorLogger) {
        $mylog = $cronlog;
    } else {
        $mylog = $log;
    }
    $group_lines = array();
    $group_guids = array();
    $update_to_guid = 0;
    $froxlor_guid = 0;
    $result = $db->query_first("SELECT MAX(`guid`) as `fguid` FROM `" . TABLE_PANEL_CUSTOMERS . "`");
    $froxlor_guid = $result['fguid'];
    $g_file = '/etc/group';
    if (file_exists($g_file)) {
        if (is_readable($g_file)) {
            if (true == ($groups = file_get_contents($g_file))) {
                $group_lines = explode("\n", $groups);
                foreach ($group_lines as $group) {
                    $group_guids[] = explode(":", $group);
                }
                foreach ($group_guids as $idx => $group) {
                    /**
                     * nogroup | nobody have very high guids
                     * ignore them
                     */
                    if ($group[0] == 'nogroup' || $group[0] == 'nobody') {
                        continue;
                    }
                    $guid = isset($group[2]) ? (int) $group[2] : 0;
                    if ($guid > $update_to_guid) {
                        $update_to_guid = $guid;
                    }
                }
                if ($update_to_guid < $froxlor_guid) {
                    $update_to_guid = $froxlor_guid;
                    if ($update_to_guid != $settings['system']['lastguid']) {
                        $mylog->logAction(CRON_ACTION, LOG_NOTICE, 'Updating froxlor last guid to ' . $update_to_guid);
                        saveSetting('system', 'lastguid', $update_to_guid);
                        $settings['system']['lastguid'] = $update_to_guid;
                    }
                }
            } else {
                $mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
            }
        } else {
            $mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
        }
    } else {
        $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group does not exist; cannot check for latest guid');
    }
}
 private function enregistre($nom)
 {
     if (isset($_POST[$nom])) {
         $temp = 'yes';
     } else {
         $temp = 'no';
     }
     if (!saveSetting($nom, $temp)) {
         $msg .= "Erreur lors de l'enregistrement de " . $nom . " avec la valeur " . $temp . " !<br />";
     }
 }
/**
 * This file is part of the SysCP project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**>
 * @license    GPLv2 http://files.syscp.org/misc/COPYING.txt
 * @package    Functions
 * @version    $Id$
 */
function storeSettingField($fieldname, $fielddata, $newfieldvalue)
{
    if (is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] != '' && isset($fielddata['varname']) && $fielddata['varname'] != '') {
        if (saveSetting($fielddata['settinggroup'], $fielddata['varname'], $newfieldvalue) != false) {
            return array($fielddata['settinggroup'] . '.' . $fielddata['varname'] => $newfieldvalue);
        } else {
            return false;
        }
    } else {
        return false;
    }
}
/**
 * This file is part of the SysCP project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**>
 * @license    GPLv2 http://files.syscp.org/misc/COPYING.txt
 * @package    Functions
 * @version    $Id$
 */
function storeSettingIpAddress($fieldname, $fielddata, $newfieldvalue)
{
    $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
    if ($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'ipaddress') {
        $mysql_access_host_array = array_map('trim', explode(',', getSetting('system', 'mysql_access_host')));
        $mysql_access_host_array[] = $newfieldvalue;
        $mysql_access_host_array = array_unique(array_trim($mysql_access_host_array));
        $mysql_access_host = implode(',', $mysql_access_host_array);
        correctMysqlUsers($mysql_access_host_array);
        saveSetting('system', 'mysql_access_host', $mysql_access_host);
    }
    return $returnvalue;
}
Example #9
0
function loadRoomList()
{
    include_once dirname(__FILE__) . '/yaml/spyc.php';
    $settings = loadSettings();
    $areas = getAreaList();
    $rooms = array();
    foreach ($areas as $k => $l) {
        $array = Spyc::YAMLLoad($settings['base_game'] . '/entities/areas/' . $k . '/rooms.yml');
        foreach ($array as $a) {
            $rooms[$a['location']] = array('title' => $a['title']['en'], 'area' => $k);
        }
    }
    saveSetting('rooms', $rooms);
}
/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**> (2003-2009)
 * @author     Froxlor team <*****@*****.**> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Functions
 *
 */
function storeSettingApsPhpExtensions($fieldname, $fielddata, $newfieldvalue)
{
    $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
    if ($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'aps' && isset($fielddata['varname']) && $fielddata['varname'] == 'php-extension') {
        $newfieldvalue_array = explode(',', $newfieldvalue);
        if (in_array('mcrypt', $newfieldvalue_array)) {
            $functions = 'mcrypt_encrypt,mcrypt_decrypt';
        } else {
            $functions = '';
        }
        if ($functions != getSetting('aps', 'php-function')) {
            saveSetting('aps', 'php-function', $functions);
        }
    }
    return $returnvalue;
}
Example #11
0
 public static function do_register()
 {
     global $siteurl;
     list($id, $key) = self::_get_id_and_key();
     if ($id && $key) {
         return true;
     }
     $ret = kk_fetch_url(self::API_ROOT . 'register.php', 0, 'url=' . bin2hex(authcode($siteurl, 'ENCODE', 'CLOUD-REGISTER')));
     if (!$ret) {
         return false;
     }
     list($errno, $sid, $key) = explode("\t", $ret);
     if ($errno != 1) {
         throw new Exception('Fail to register in cloud system.');
     }
     saveSetting('cloud', authcode("{$sid}\t{$key}", 'ENCODE', '-TiebaSignAPI-'));
 }
/**
 * This file is part of the SysCP project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**>
 * @license    GPLv2 http://files.syscp.org/misc/COPYING.txt
 *
 * @version    $Id$
 */
function storeSettingApsWebserverModules($fieldname, $fielddata, $newfieldvalue)
{
    if (is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'aps' && isset($fielddata['varname']) && $fielddata['varname'] == 'webserver-module') {
        $newfieldvalue_array = explode(',', $newfieldvalue);
        if (in_array('mod_rewrite', $newfieldvalue_array)) {
            // Don't have to guess if we have to remove the leading comma as mod_rewrite is set anyways when we're here...
            $newfieldvalue .= ',mod_rewrite.c';
        }
        if (in_array('htaccess', $newfieldvalue_array)) {
            $htaccess = 'htaccess';
        } else {
            $htaccess = '';
        }
        if ($htaccess != getSetting('aps', 'webserver-htaccess')) {
            saveSetting('aps', 'webserver-htaccess', $htaccess);
        }
    }
    return storeSettingField($fieldname, $fielddata, $newfieldvalue);
}
function _ops_logo_update()
{
    // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
    // of $_FILES.
    if (!isset($_POST['logosite'])) {
        redirect('mgmt_website/website', "error missing logosite value");
    }
    $site = $_POST['logosite'];
    if ($_FILES['logo']['error'] != UPLOAD_ERR_OK) {
        $error_code = $_FILES['logo']['error'];
        redirect('mgmt_website/website', file_upload_error_message($error_code));
    } else {
        $fileName = $site . "-" . $_FILES['logo']['name'];
        //  . '' .$_FILES['logo']['type'];
        move_uploaded_file($_FILES['logo']['tmp_name'], "img/" . $fileName);
        saveSetting("\$SETTINGS_" . $site . "_LOGO", $fileName);
    }
    // _checkCreditials
    redirect('mgmt_website/website', "logo updated");
}
    check_token();
    $prefixe_url = isset($_POST['prefixe_url']) ? $_POST['prefixe_url'] : array();
    $suppr_prefixe_url = isset($_POST['suppr_prefixe_url']) ? $_POST['suppr_prefixe_url'] : array();
    $tab_deja = array();
    $url_absolues_gepi = "";
    for ($loop = 0; $loop < count($prefixe_url); $loop++) {
        $prefixe_url[$loop] = preg_replace("|/{1,}\$|", "", $prefixe_url[$loop]);
        if ($prefixe_url[$loop] != "" && !in_array($prefixe_url[$loop], $suppr_prefixe_url) && !in_array($prefixe_url[$loop], $tab_deja)) {
            if ($url_absolues_gepi != "") {
                $url_absolues_gepi .= "|";
            }
            $url_absolues_gepi .= $prefixe_url[$loop];
            $tab_deja[] = $prefixe_url[$loop];
        }
    }
    if (saveSetting("url_absolues_gepi", $url_absolues_gepi)) {
        $msg = "Enregistrement effectué.<br />";
    } else {
        $msg = "ERREUR lors de l'enregistrement.<br />";
    }
}
$eff_parcours = 5;
//**************** EN-TETE *****************
$titre_page = "Cahier de textes - Notices avec docs joints en URL absolues";
require_once "../lib/header.inc.php";
//**************** FIN EN-TETE *************
//debug_var();
echo "<p class='bold'><a href='../cahier_texte_admin/index.php'><img src='../images/icons/back.png' alt='Retour' class='back_link'/> Retour</a>";
$url_absolues_gepi = getSettingValue("url_absolues_gepi");
if (!isset($mode)) {
    if ($url_absolues_gepi != "") {
Example #15
0
Save a Setting (k/v) and redirect to URI u
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$k = getreq('k');
$v = getreq('v');
$u = getreq('u');
if ($k == 'currentlanguage') {
    unset($_SESSION['currenttextpage']);
    unset($_SESSION['currenttextquery']);
    unset($_SESSION['currenttexttag1']);
    unset($_SESSION['currenttexttag2']);
    unset($_SESSION['currenttexttag12']);
    unset($_SESSION['currentwordpage']);
    unset($_SESSION['currentwordquery']);
    unset($_SESSION['currentwordstatus']);
    unset($_SESSION['currentwordtext']);
    unset($_SESSION['currentwordtag1']);
    unset($_SESSION['currentwordtag2']);
    unset($_SESSION['currentwordtag12']);
    unset($_SESSION['currentarchivepage']);
    unset($_SESSION['currentarchivequery']);
    unset($_SESSION['currentarchivetexttag1']);
    unset($_SESSION['currentarchivetexttag2']);
    unset($_SESSION['currentarchivetexttag12']);
    saveSetting('currenttext', '');
}
saveSetting($k, $v);
header("Location: " . $u);
exit;
Example #16
0
    public function testRetardEnglobante()
    {
        saveSetting('abs2_retard_critere_duree',30);
        $florence_eleve = EleveQuery::create()->findOneByLogin('Florence Michu');

        $saisie = $florence_eleve->getAbsenceEleveSaisiesDuJour(VENDREDI_s40j5)->getFirst();
        $this->assertFalse($saisie->getRetardEnglobante());

        $saisie = $florence_eleve->getAbsenceEleveSaisiesDuJour(SAMEDI_s40j6)->getFirst();
        $this->assertFalse($saisie->getRetardEnglobante());

        $saisie = $florence_eleve->getAbsenceEleveSaisiesDuJour(DIMANCHE_s40j7)->getFirst();
        $this->assertFalse($saisie->getRetardEnglobante());

        $saisie = $florence_eleve->getAbsenceEleveSaisiesDuJour(LUNDI_s41j1)->getFirst();
        $this->assertTrue($saisie->getRetardEnglobante());

        $saisie = $florence_eleve->getAbsenceEleveSaisiesDuJour(MARDI_s41j2)->getFirst();
        saveSetting('abs2_retard_critere_duree',30);
        $this->assertTrue($saisie->getRetardEnglobante());
        $saisie->clearAllReferences();
        saveSetting('abs2_retard_critere_duree',20);
        $this->assertFalse($saisie->getRetardEnglobante());
        saveSetting('abs2_retard_critere_duree',30);

        $saisie = $florence_eleve->getAbsenceEleveSaisiesDuJour(MERCREDI_s41j3)->getFirst();//sur cette saisie on a plusieurs traitement, on privilégie le retard
        $this->assertTrue($saisie->getRetardEnglobante());
 
        $saisie = AbsenceEleveSaisieQuery::create()->filterByFinAbs(VENDREDI_s41j5.' 08:10:00')->findOne();
        $this->assertFalse($saisie->getRetardEnglobante());

        $saisie = AbsenceEleveSaisieQuery::create()->filterByFinAbs(DIMANCHE_s41j7.' 08:10:00')->findOne();
        $this->assertTrue($saisie->getRetardEnglobante());

        $saisie = AbsenceEleveSaisieQuery::create()->filterByFinAbs(LUNDI_s42j1.' 08:10:00')->findOne();
        $this->assertTrue($saisie->getRetardEnglobante());

        $saisie = AbsenceEleveSaisieQuery::create()->filterByFinAbs(VENDREDI_s42j5.' 08:10:00')->findOne();
        $this->assertFalse($saisie->getRetardEnglobante());

        $saisies = AbsenceEleveSaisieQuery::create()->filterByFinAbs(LUNDI_s43j1.' 09:00:00')->find();
        $this->assertTrue($saisies->getFirst()->getRetardEnglobante());
        $this->assertTrue($saisies->getNext()->getRetardEnglobante());
        
        $saisie = AbsenceEleveSaisieQuery::create()->filterByFinAbs(MARDI_a1_s22j2.' 09:10:00')->findOne();
        $this->assertFalse($saisie->getRetardEnglobante());

        $saisie = AbsenceEleveSaisieQuery::create()->filterByFinAbs(MERCREDI_a1_s22j3.' 08:10:00')->findOne();
        $this->assertTrue($saisie->getRetard());
        $this->assertFalse($saisie->getRetardEnglobante());

        $saisie = AbsenceEleveSaisieQuery::create()->filterByFinAbs(JEUDI_a1_s23j4.' 08:10:00')->findOne();
        $this->assertTrue($saisie->getRetardEnglobante());

        $saisie = AbsenceEleveSaisieQuery::create()->filterByFinAbs(LUNDIa1_s24j1.' 08:10:00')->findOne();
        $this->assertFalse($saisie->getRetardEnglobante());
    }
Example #17
0
		<option value="00" <?php if (getSettingValue("abs2_retard_critere_duree") == '00') echo " selected"; ?>>00</option>
		<option value="10" <?php if (getSettingValue("abs2_retard_critere_duree") == '10') echo " selected"; ?>>10</option>
		<option value="20" <?php if (getSettingValue("abs2_retard_critere_duree") == '20') echo " selected"; ?>>20</option>
		<option value="30" <?php if (getSettingValue("abs2_retard_critere_duree") == '30') echo " selected"; ?>>30</option>
		<option value="40" <?php if (getSettingValue("abs2_retard_critere_duree") == '40') echo " selected"; ?>>40</option>
		<option value="50" <?php if (getSettingValue("abs2_retard_critere_duree") == '50') echo " selected"; ?>>50</option>
	</select>
	min comme des retards.<br/>
	Note : si les créneaux durent 45 minutes et que ce paramètre est réglé sur 50 min, la plupart de vos saisies seront décomptées comme retard.<br/>
	Note : sont considérées comme retard les saisies de durées inférieures au paramètre ci-dessus et les saisies dont le type est décompté comme retard
	(voir la page <a href="admin_types_absences.php?action=visualiser">Définir les types d'absence</a>).<br/>

</p>
<br/>
<p>
	<?php if (getSettingValue("abs2_heure_demi_journee") == null || getSettingValue("abs2_heure_demi_journee") == '') saveSetting("abs2_heure_demi_journee", '11:55'); ?>
	<input style="font-size:88%;" name="abs2_heure_demi_journee" value="<?php echo getSettingValue("abs2_heure_demi_journee")?>" type="text" maxlength="5" size="4"/>
	Heure de bascule de demi-journée pour le décompte des demi-journées. Cette heure doit correspondre au tout début de la pause déjeuner (typiquement 11:55 ou 12:25).
</p>

<!--h2>G&eacute;rer l'acc&egrave;s des responsables d'&eacute;l&egrave;ves</h2>
<p style="font-style: italic">Vous pouvez permettre aux responsables d'acc&eacute;der aux donn&eacute;es brutes
entr&eacute;es dans Gepi par le biais du module absences.</p>
<p>
	<input type="radio" id="activerRespOk" name="activer_resp" value="y"
	<?php if (getSettingValue("active_absences_parents") == 'y') echo ' checked="checked"'; ?> />
	<label for="activerRespOk">Permettre l'acc&egrave;s aux responsables</label>
</p>
<p>
	<input type="radio" id="activerRespKo" name="activer_resp" value="n"
	<?php if (getSettingValue("active_absences_parents") == 'n') echo ' checked="checked"'; ?> />
Example #18
0
INSERT IGNORE INTO `plugin` (`id`, `name`, `module`) VALUES
(1, 'debug_info', ''),
(2, 'update_log', '');

CREATE TABLE IF NOT EXISTS `setting` (
  `k` varchar(32) NOT NULL,
  `v` varchar(64) NOT NULL,
  PRIMARY KEY (`k`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `sign_log` (
  `tid` int(10) unsigned NOT NULL,
  `uid` int(10) unsigned NOT NULL,
  `date` int(11) NOT NULL DEFAULT '0',
  `status` tinyint(4) NOT NULL DEFAULT '0',
  `exp` tinyint(4) NOT NULL DEFAULT '0',
  `retry` tinyint(3) unsigned NOT NULL DEFAULT '0',
  UNIQUE KEY `tid` (`tid`,`date`),
  KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
EOF;
$sql_array = explode(';', $sql);
foreach ($sql_array as $sql) {
    $sql = trim($sql);
    if ($sql) {
        DB::query($sql);
    }
}
saveSetting('version', '1.13.11.9');
showmessage('1.13.11.9 安装成功!', './', 1);
Example #19
0
            $sql = "UPDATE periodes SET verouiller='" . $_GET['etat'] . "', date_verrouillage=NOW() WHERE (num_periode='" . $_GET['num_periode'] . "' and id_classe='" . $_GET['id_classe'] . "')";
        }
        $res = mysqli_query($GLOBALS["mysqli"], $sql);
        if (!$res) {
            echo "<span style='color:red'>KO</a>";
        } else {
            echo "<span style='color:" . $couleur_verrouillage_periode[$_GET['etat']] . "' title=\"Période " . $traduction_verrouillage_periode[$_GET['etat']] . ".\n" . $explication_verrouillage_periode[$_GET['etat']] . "\">Période " . $traduction_verrouillage_periode[$_GET['etat']] . "</a>";
        }
    } else {
        echo "<span style='color:red'>KO</a>";
    }
    die;
}
if (isset($_POST['deverouillage_auto_periode_suivante'])) {
    check_token();
    if (!saveSetting("deverouillage_auto_periode_suivante", $_POST['deverouillage_auto_periode_suivante'])) {
        $msg .= "Erreur lors de l'enregistrement de deverouillage_auto_periode_suivante !";
        $reg_ok = 'no';
    }
}
if (isset($_POST['ok'])) {
    check_token();
    $pb_reg_ver = 'no';
    //$calldata = sql_query("SELECT DISTINCT c.id, c.classe FROM classes c, periodes p WHERE p.id_classe = c.id  ORDER BY classe");
    $calldata = sql_query("SELECT DISTINCT c.id, c.classe FROM classes c, periodes p, j_scol_classes jsc WHERE p.id_classe = c.id  AND jsc.id_classe=c.id AND jsc.login='******'login'] . "' ORDER BY classe");
    if ($calldata) {
        for ($k = 0; $row = sql_row($calldata, $k); $k++) {
            $id_classe = $row[0];
            $periode_query = sql_query("SELECT verouiller, date_fin FROM periodes WHERE id_classe = '{$id_classe}' ORDER BY num_periode");
            $nb_periode = sql_count($periode_query) + 1;
            if ($periode_query) {
Example #20
0
        $user = DB::fetch_first("SELECT * FROM member WHERE username='******' AND email='{$email}'");
        if (!$user) {
            showmessage('用户名 / 邮箱有误', './');
        }
        $info = array($user['uid'], TIMESTAMP + 3600, $user['password'], random(32));
        $token = urlencode(authcode(implode("\t", $info), 'ENCODE'));
        $link = "{$siteurl}member.php?action=find_password&token={$token}";
        $message = <<<EOF
<p>我们已经收到您的找回密码申请,请您点击下方的链接重新设置密码:</p>
<blockquote><a href="{$link}">{$link}</a></blockquote>
<p>(注:请在一小时内点击上面的链接,我们将向您提供新的密码)</p>
<br>
<p>如果您没有要求重置密码却收到本邮件,请及时删除此邮件以确保账户安全。</p>
EOF;
        DB::insert('mail_queue', array('to' => $user['email'], 'subject' => "贴吧签到助手 - 密码找回", 'content' => $message));
        saveSetting('mail_queue', 1);
        showmessage('邮件发送成功,请到邮箱查收', './');
    }
    header('Location: member.php');
    exit;
} elseif ($_GET['action'] == 'register') {
    if (getSetting('block_register')) {
        showmessage('抱歉,当前站点禁止新用户注册', 'member.php');
    }
    $count = DB::result_first('SELECT COUNT(*) FROM member');
    if ($_POST && strexists($_SERVER['HTTP_REFERER'], 'member.php')) {
        list($time, $hash, $member_count) = explode("\t", authcode($_COOKIE['key'], 'DECODE'));
        if (getSetting('register_check') && $time > TIMESTAMP - 5 || $time < TIMESTAMP - 300) {
            $_POST = array();
        }
        if (getSetting('register_limit') && $member_count != $count) {
Example #21
0
$langid = $record['TxLgID'];
mysql_free_result($res);
$sql = 'select LgTextSize, LgRemoveSpaces, LgRightToLeft from languages where LgID = ' . $langid;
$res = mysql_query($sql);
if ($res == FALSE) {
    die("Invalid Query: {$sql}");
}
$record = mysql_fetch_assoc($res);
$textsize = $record['LgTextSize'];
$removeSpaces = $record['LgRemoveSpaces'];
$rtlScript = $record['LgRightToLeft'];
mysql_free_result($res);
saveSetting('currenttext', $textid);
saveSetting('currentprintannotation', $ann);
saveSetting('currentprintstatus', $status);
saveSetting('currentprintannotationplacement', $annplcmnt);
pagestart_nobody('Print');
echo '<div id="noprint">';
echo '<h4>';
echo '<a href="edit_texts.php" target="_top">';
echo '<img src="img/lwt_icon.png" class="lwtlogo" alt="Logo" />Learning with Texts';
echo '</a>&nbsp; | &nbsp;';
quickMenu();
echo '&nbsp; | &nbsp;<a href="do_text.php?start=' . $textid . '" target="_top"><img src="icn/book-open-bookmark.png" title="Read" alt="Read" /></a> &nbsp;<a href="do_test.php?text=' . $textid . '" target="_top"><img src="icn/question-balloon.png" title="Test" alt="Test" /></a> &nbsp;<a target="_top" href="edit_texts.php?chg=' . $textid . '"><img src="icn/document--pencil.png" title="Edit Text" alt="Edit Text" /></a>';
echo '</h4><h3>PRINT&nbsp;▶ ' . tohtml($title) . '</h3>';
echo "<p id=\"printoptions\">Terms with <b>status(es)</b><select id=\"status\" onchange=\"{val=document.getElementById('status').options[document.getElementById('status').selectedIndex].value;location.href='print_text.php?text=" . $textid . "&amp;status=' + val;}\">";
echo get_wordstatus_selectoptions($status, true, true, false);
echo "</select> ...<br />will be <b>annotated</b> with ";
echo "<select id=\"ann\" onchange=\"{val=document.getElementById('ann').options[document.getElementById('ann').selectedIndex].value;location.href='print_text.php?text=" . $textid . "&amp;ann=' + val;}\">";
echo "<option value=\"0\"" . get_selected(0, $ann) . ">Nothing</option>";
echo "<option value=\"1\"" . get_selected(1, $ann) . ">Translation</option>";
Example #22
0
         $msg .= "Erreur lors de l'enregistrement de l'année scolaire !";
     } else {
         $msg .= "Enregistrement de l'année scolaire effectué.<br />";
     }
 }
 if (isset($_POST['begin_day']) and isset($_POST['begin_month']) and isset($_POST['begin_year'])) {
     $begin_bookings = mktime(0, 0, 0, $_POST['begin_month'], $_POST['begin_day'], $_POST['begin_year']);
     if (!saveSetting("begin_bookings", $begin_bookings)) {
         $msg .= "Erreur lors de l'enregistrement de begin_bookings !";
     } else {
         $msg .= "Enregistrement de begin_bookings effectué.<br />";
     }
 }
 if (isset($_POST['end_day']) and isset($_POST['end_month']) and isset($_POST['end_year'])) {
     $end_bookings = mktime(0, 0, 0, $_POST['end_month'], $_POST['end_day'], $_POST['end_year']);
     if (!saveSetting("end_bookings", $end_bookings)) {
         $msg .= "Erreur lors de l'enregistrement de end_bookings !";
     } else {
         $msg .= "Enregistrement de end_bookings effectué.<br />";
     }
 }
 if (isset($_POST['reserve_comptes_eleves']) && $_POST['reserve_comptes_eleves'] == 'y') {
     $sql = "DELETE FROM tempo_utilisateurs WHERE statut='eleve';";
     //echo "<span style='color:green;'>$sql</span><br />";
     $nettoyage = mysqli_query($GLOBALS["mysqli"], $sql);
     $sql = "INSERT INTO tempo_utilisateurs SELECT u.login,u.password,u.salt,u.email,e.ele_id,e.elenoet,u.statut,u.auth_mode,NOW(),u.statut FROM utilisateurs u, eleves e WHERE u.login=e.login AND u.statut='eleve';";
     //echo "<span style='color:green;'>$sql</span><br />";
     $svg_insert = mysqli_query($GLOBALS["mysqli"], $sql);
     if ($svg_insert) {
         $msg .= "Mise en réserve des comptes élèves effectuée.<br />";
     } else {
Example #23
0
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$textid = getreq('text');
$sql = 'select TxLgID, TxTitle, TxAudioURI, TxSourceURI from ' . $tbpref . 'texts where TxID = ' . $textid;
$res = do_mysql_query($sql);
$record = mysql_fetch_assoc($res);
$audio = $record['TxAudioURI'];
if (!isset($audio)) {
    $audio = '';
}
$audio = trim($audio);
$title = $record['TxTitle'];
$sourceURI = $record['TxSourceURI'];
$langid = $record['TxLgID'];
mysql_free_result($res);
saveSetting('currenttext', $textid);
pagestart_nobody(tohtml($title));
echo '<h2 class="center" style="margin:5px;margin-top:-10px;">';
?>

<script type="text/javascript">
//<![CDATA[
	function do_hide_t() {
		$('#showt').show(); 
		$('#hidet').hide();
		$('.anntermruby', window.parent.frames['text'].document).css('color','#E5E4E2').css('background-color', '#E5E4E2');
	}
	function do_show_t() {
		$('#showt').hide(); 
		$('#hidet').show(); 
		$('.anntermruby', window.parent.frames['text'].document).css('color','black').css('background-color', 'white');
Example #24
0
    showmessage('成功更新到 1.13.11.9!', './');
} elseif ($current_version == '1.13.11.9') {
    runquery("\nALTER TABLE `plugin` ADD `enable` TINYINT(1) NOT NULL DEFAULT '1' AFTER `id`;\nALTER TABLE `plugin` ADD `version` VARCHAR(8) NOT NULL DEFAULT '0';\nALTER TABLE `member_setting` ADD `cookie` TEXT BINARY CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;\n");
    $query = DB::query('SELECT uid, cookie FROM member');
    while ($result = DB::fetch($query)) {
        save_cookie($result['uid'], $result['cookie']);
    }
    DB::query('ALTER TABLE `member` DROP `cookie`');
    $query = DB::query('SHOW columns FROM `plugin`');
    while ($result = DB::fetch($query)) {
        if ($result['Field'] == 'module') {
            DB::query('ALTER TABLE `plugin` DROP `module`');
        }
    }
    CACHE::clear();
    CACHE::update('plugins');
    saveSetting('register_limit', 1);
    saveSetting('register_check', 1);
    saveSetting('jquery_mode', 2);
    saveSetting('version', '1.13.12.15');
    showmessage('成功更新到 1.13.12.15!', './');
} elseif ($current_version == '1.13.12.15') {
    saveSetting('version', '1.13.12.25');
    showmessage('成功更新到 1.13.12.25!', './');
} elseif ($current_version == '1.13.12.25') {
    if ($_config['adminid']) {
        saveSetting('admin_uid', $_config['adminid']);
    }
    saveSetting('version', '1.14.1.15');
    showmessage('成功更新到 1.14.1.15!', './');
}
Example #25
0
	if (($force_maj == 'yes') or (quelle_maj("1.6.5"))) {
            require 'updates/164_to_165.inc.php';
	}

	if (($force_maj == 'yes') or (quelle_maj("1.6.6"))) {
        require 'updates/165_to_166.inc.php';
	}

	if (($force_maj == 'yes') or (quelle_maj("master"))) {
        require 'updates/166_to_dev.inc.php';
	}

	// Mise à jour du numéro de version
	saveSetting("version", $gepiVersion);
	saveSetting("pb_maj", $pb_maj);
}


// Load settings
if (!loadSettings()) {
	die("Erreur chargement settings");
}

// Numéro de version effective
$version_old = getSettingValue("version");

// Pb de mise à jour lors de la dernière mise à jour
$pb_maj_bd = getSettingValue("pb_maj");

if (isset ($mess)) {
Example #26
0
 function init_mail()
 {
     if (defined('DISABLE_CRON')) {
         return;
     }
     $queue = getSetting('mail_queue');
     if (!$queue) {
         return;
     }
     $mail = DB::fetch_first("SELECT * FROM mail_queue LIMIT 0,1");
     if ($mail) {
         DB::query("DELETE FROM mail_queue WHERE id='{$mail[id]}'");
         $_mail = new mail_content();
         $_mail->address = $mail['to'];
         $_mail->subject = $mail['subject'];
         $_mail->message = $mail['content'];
         $sender = new mail_sender();
         $sender->sendMail($_mail);
     } else {
         saveSetting('mail_queue', 0);
     }
 }
Example #27
0

	if (isset($_POST['fb_mode_moyenne'])) {
		if (!saveSetting("fb_mode_moyenne", $_POST['fb_mode_moyenne'])) {
			$msg .= "Erreur lors de l'enregistrement de fb_mode_moyenne !";
		}
	}

	if (isset($_POST['fb_gab_perso'])) {
		if (!saveSetting("fb_gab_perso", $_POST['fb_gab_perso'])) {
			$msg .= "Erreur lors de l'enregistrement de fb_gab_perso !";
		}
	}

	if (isset($_POST['fb_dezip_ooo'])) {
		if (!saveSetting("fb_dezip_ooo", $_POST['fb_dezip_ooo'])) {
			$msg .= "Erreur lors de l'enregistrement de fb_dezip_ooo !";
		}
	}

	if($msg==""){$msg="Enregistrement effectué.";}
}



//=======================
//=== Initialisation des variables ===
//=======================

$titre_page = "Fiches Brevet";
    $month = date("m");
    $year  = date("Y");
    showAccessDenied($day, $month, $year, '',$back);
    exit();
}
if (isset($_GET['valid']) and ($_GET['valid'] == "yes")) {
    if (!saveSetting("begin_bookings", $_GET['begin_bookings'])) {
        echo "Erreur lors de l'enregistrement de begin_bookings !<br />";
    } else {
        $del = grr_sql_query("DELETE FROM ".TABLE_PREFIX."_entry WHERE (end_time < ".getSettingValue('begin_bookings').")");
        $del = grr_sql_query("DELETE FROM ".TABLE_PREFIX."_repeat WHERE end_date < ".getSettingValue("begin_bookings"));
        $del = grr_sql_query("DELETE FROM ".TABLE_PREFIX."_entry_moderate WHERE (end_time < ".getSettingValue('begin_bookings').")");
        $del = grr_sql_query("DELETE FROM ".TABLE_PREFIX."_calendar WHERE DAY < ".getSettingValue("begin_bookings"));
    }

    if (!saveSetting("end_bookings", $_GET['end_bookings'])) {
        echo "Erreur lors de l'enregistrement de end_bookings !<br />";
    } else {
        $del = grr_sql_query("DELETE FROM ".TABLE_PREFIX."_entry WHERE start_time > ".getSettingValue("end_bookings"));
        $del = grr_sql_query("DELETE FROM ".TABLE_PREFIX."_repeat WHERE start_time > ".getSettingValue("end_bookings"));
        $del = grr_sql_query("DELETE FROM ".TABLE_PREFIX."_entry_moderate WHERE (start_time > ".getSettingValue('end_bookings').")");
        $del = grr_sql_query("DELETE FROM ".TABLE_PREFIX."_calendar WHERE DAY > ".getSettingValue("end_bookings"));
    }

    header("Location: ./admin_config.php");

} else if (isset($_GET['valid']) and ($_GET['valid'] == "no")) {
    header("Location: ./admin_config.php");
}
# print the page header
print_header("","","","",$type="with_session", $page="admin");
Example #29
0
        saveSetting('set-text-l-framewidth-percent', $_REQUEST['set-text-l-framewidth-percent']);
        saveSetting('set-text-r-frameheight-percent', $_REQUEST['set-text-r-frameheight-percent']);
        saveSetting('set-test-h-frameheight', $_REQUEST['set-test-h-frameheight']);
        saveSetting('set-test-l-framewidth-percent', $_REQUEST['set-test-l-framewidth-percent']);
        saveSetting('set-test-r-frameheight-percent', $_REQUEST['set-test-r-frameheight-percent']);
        saveSetting('set-player-skin-name', $_REQUEST['set-player-skin-name']);
        saveSetting('set-test-main-frame-waiting-time', $_REQUEST['set-test-main-frame-waiting-time']);
        saveSetting('set-test-edit-frame-waiting-time', $_REQUEST['set-test-edit-frame-waiting-time']);
        saveSetting('set-test-sentence-count', $_REQUEST['set-test-sentence-count']);
        saveSetting('set-term-sentence-count', $_REQUEST['set-term-sentence-count']);
        saveSetting('set-archivedtexts-per-page', $_REQUEST['set-archivedtexts-per-page']);
        saveSetting('set-texts-per-page', $_REQUEST['set-texts-per-page']);
        saveSetting('set-terms-per-page', $_REQUEST['set-terms-per-page']);
        saveSetting('set-tags-per-page', $_REQUEST['set-tags-per-page']);
        saveSetting('set-show-text-word-counts', $_REQUEST['set-show-text-word-counts']);
        saveSetting('set-text-visit-statuses-via-key', $_REQUEST['set-text-visit-statuses-via-key']);
        $message = 'Settings saved';
    } else {
        $dummy = runsql("delete from settings where StKey like 'set-%'", '');
        $message = 'All Settings reset to default values';
    }
}
echo error_message_with_hide($message, 1);
?>

<form class="validate" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="post">
<table class="tab3" cellspacing="0" cellpadding="5">
<!-- ******************************************************* -->
/**
 * Renders html for editing all tblSettings field for current user
 *
 * @return nothing
 */
function editUserdataSettings($_userid = '')
{
    global $h;
    if (empty($_userid)) {
        $_userid = $h->session->id;
    }
    $list = readAllUserdata($_userid);
    if (!$list) {
        return;
    }
    echo '<div class="settings">';
    echo xhtmlForm('edit_settings_frm', '', 'post', 'multipart/form-data');
    echo xhtmlHidden('edit_settings_check', 1);
    echo '<table>';
    foreach ($list as $row) {
        if (!empty($_POST['edit_settings_check'])) {
            switch ($row['fieldType']) {
                case USERDATA_TYPE_IMAGE:
                    if (!empty($_POST['userdata_' . $row['fieldId'] . '_remove'])) {
                        $h->files->deleteFile($row['settingValue']);
                        $row['settingValue'] = 0;
                    } else {
                        if (isset($_FILES['userdata_' . $row['fieldId']])) {
                            // FIXME: Gör så att handleUpload klarar av att ta userId som parameter
                            $row['settingValue'] = $h->files->handleUpload($_FILES['userdata_' . $row['fieldId']], FILETYPE_USERDATA, $row['fieldId']);
                        }
                    }
                    break;
                case USERDATA_TYPE_EMAIL:
                    if (empty($_POST['userdata_' . $row['fieldId']])) {
                        break;
                    }
                    if (!is_email($_POST['userdata_' . $row['fieldId']])) {
                        echo '<div class="critical">' . t('The email entered is not valid!') . '</div>';
                    } else {
                        $chk = findUserByEmail($_POST['userdata_' . $row['fieldId']]);
                        if ($chk && $chk != $_userid) {
                            echo '<div class="critical">' . t('The email entered already taken!') . '</div>';
                        } else {
                            $row['settingValue'] = $_POST['userdata_' . $row['fieldId']];
                        }
                    }
                    break;
                case USERDATA_TYPE_BIRTHDATE:
                    if (empty($_POST['userdata_' . $row['fieldId'] . '_year'])) {
                        break;
                    }
                    $born = mktime(0, 0, 0, $_POST['userdata_' . $row['fieldId'] . '_month'], $_POST['userdata_' . $row['fieldId'] . '_day'], $_POST['userdata_' . $row['fieldId'] . '_year']);
                    $row['settingValue'] = sql_datetime($born);
                    break;
                case USERDATA_TYPE_BIRTHDATE_SWE:
                    if (empty($_POST['userdata_' . $row['fieldId'] . '_year'])) {
                        break;
                    }
                    $born = mktime(0, 0, 0, $_POST['userdata_' . $row['fieldId'] . '_month'], $_POST['userdata_' . $row['fieldId'] . '_day'], $_POST['userdata_' . $row['fieldId'] . '_year']);
                    if ($check = SsnValidateSwedishNum($_POST['userdata_' . $row['fieldId'] . '_year'], $_POST['userdata_' . $row['fieldId'] . '_month'], $_POST['userdata_' . $row['fieldId'] . '_day'], $_POST['userdata_' . $row['fieldId'] . '_chk']) === true) {
                        $row['settingValue'] = sql_datetime($born);
                    } else {
                        echo '<div class="critical">' . t('The Swedish SSN you entered is not valid!') . '</div>';
                    }
                    break;
                case USERDATA_TYPE_LOCATION_SWE:
                    if (empty($_POST['userdata_' . $row['fieldId']])) {
                        break;
                    }
                    if (!ZipLocation::isValid($_POST['userdata_' . $row['fieldId']])) {
                        echo '<div class="critical">' . t('The Swedish zipcode you entered is not valid!') . '</div>';
                        $h->session->log('User entered invalid swedish zipcode: ' . $_POST['userdata_' . $row['fieldId']], LOGLEVEL_WARNING);
                    } else {
                        saveSetting(SETTING_USERDATA, 0, $_userid, 'city', ZipLocation::cityId($_POST['userdata_' . $row['fieldId']]));
                        saveSetting(SETTING_USERDATA, 0, $_userid, 'region', ZipLocation::regionId($_POST['userdata_' . $row['fieldId']]));
                        $row['settingValue'] = $_POST['userdata_' . $row['fieldId']];
                    }
                    break;
                default:
                    if (!empty($_POST['userdata_' . $row['fieldId']])) {
                        $row['settingValue'] = $_POST['userdata_' . $row['fieldId']];
                    } else {
                        $row['settingValue'] = '';
                    }
                    break;
            }
            //Stores the setting
            saveSetting(SETTING_USERDATA, 0, $_userid, $row['fieldId'], $row['settingValue']);
        }
        echo '<tr>' . getUserdataInput($row) . '</tr>';
    }
    echo '</table>';
    echo xhtmlSubmit('Save');
    echo xhtmlFormClose();
    echo '</div>';
}