Overview
Comment:Correction enregistrement de la date
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8ddd48cc4883fe18118a5de93931630ef5879e23
User & Date: bohwaz on 2015-01-18 04:59:47
Other Links: manifest | tags
Context
2015-01-18
05:16
Forcer le type de bindValue, sinon bindValue(1, 0) ne fonctionne pas correctement (WTF) check-in: bb7d06009b user: bohwaz tags: trunk
04:59
Correction enregistrement de la date check-in: 8ddd48cc48 user: bohwaz tags: trunk
04:52
Implémentation du critère {age} dans les squelettes (fix [6938d30404]). Utilisation de bindValue de SQLite plutôt que escapeString dans les squelettes, c'est mieux. check-in: 5eca57ed8c user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Wiki.php from [a4b54b7c9f] to [e177dfd955].

117
118
119
120
121
122
123






124
125
126
127
128
129
130
    }

    public function edit($id, $data = [])
    {
        $db = DB::getInstance();
        $this->_checkFields($data);







        if (isset($data['uri']))
        {
            $data['uri'] = self::transformTitleToURI($data['uri']);

            if ($db->simpleQuerySingle('SELECT 1 FROM wiki_pages WHERE uri = ? AND id != ? LIMIT 1;', false, $data['uri'], (int)$id))
            {
                throw new UserException('Cette adresse de page est déjà utilisée pour une autre page, il faut en choisir une autre.');







>
>
>
>
>
>







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
    }

    public function edit($id, $data = [])
    {
        $db = DB::getInstance();
        $this->_checkFields($data);

        // Modification de la date de création
        if (isset($data['date_creation']) && !Utils::checkDateTime($data['date_creation']))
        {
            throw new UserException('Date invalide: '.$data['date_creation']);
        }
        
        if (isset($data['uri']))
        {
            $data['uri'] = self::transformTitleToURI($data['uri']);

            if ($db->simpleQuerySingle('SELECT 1 FROM wiki_pages WHERE uri = ? AND id != ? LIMIT 1;', false, $data['uri'], (int)$id))
            {
                throw new UserException('Cette adresse de page est déjà utilisée pour une autre page, il faut en choisir une autre.');
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
        if (isset($data['parent']) && (int)$data['parent'] == (int)$id)
        {
            $data['parent'] = 0;
        }

        $data['date_modification'] = gmdate('Y-m-d H:i:s');

        // Modification de la date de création
        if (isset($data['date_creation']))
        {
            // Si la date n'est pas valide tant pis
            if (!(strtotime($data['date_creation']) > 0))
            {
                unset($data['date_creation']);
            }
            else
            {
                $data['date_creation'] = gmdate('Y-m-d H:i:s', $data['date_creation']);
            }
        }

        $db->simpleUpdate('wiki_pages', $data, 'id = '.(int)$id);
        return true;
    }

    public function delete($id)
    {
        $db = DB::getInstance();







<
<
<
<
<
<
<
<
<
<
<
<
<
<







145
146
147
148
149
150
151














152
153
154
155
156
157
158
        if (isset($data['parent']) && (int)$data['parent'] == (int)$id)
        {
            $data['parent'] = 0;
        }

        $data['date_modification'] = gmdate('Y-m-d H:i:s');















        $db->simpleUpdate('wiki_pages', $data, 'id = '.(int)$id);
        return true;
    }

    public function delete($id)
    {
        $db = DB::getInstance();

Modified src/www/admin/wiki/editer.php from [af7fadd2c7] to [7de34b2e99].

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
    $page['chiffrement'] = $page['contenu']['chiffrement'];
    $page['contenu'] = $page['contenu']['contenu'];
}

if (Utils::post('date'))
{
    $date = strtotime(Utils::post('date') . ' ' . Utils::post('date_h') . ':' . Utils::post('date_min'));
}
else
{
    $date = false;
}

if (!empty($_POST['save']))







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
    $page['chiffrement'] = $page['contenu']['chiffrement'];
    $page['contenu'] = $page['contenu']['contenu'];
}

if (Utils::post('date'))
{
    $date = Utils::post('date') . ' ' . Utils::post('date_h') . ':' . Utils::post('date_min');
}
else
{
    $date = false;
}

if (!empty($_POST['save']))