srchub

srchub Commit Details


Date:2015-02-09 23:24:51 (9 years 10 months ago)
Author:Natalie Adams
Branch:master
Commit:4febdda65f88f134706fa88d20126e1acd1188f6
Parents: feb001ed8ee381e58b42df319558e4ac56562fd3
Message:Issue 91: Create feature to disable a repo

Changes:

File differences

indefero/src/IDF/Form/ProjectConf.php
8686
8787
8888
89
90
91
92
93
94
8995
9096
9197
......
94100
95101
96102
103
97104
98105
99106
......
228235
229236
230237
231
232
238
239
240
241
233242
234243
235244
'initial' => $this->project->enableads,
'widget' => 'Pluf_Form_Widget_CheckboxInput',
));
$this->fields['disabled'] = new Pluf_Form_Field_Boolean(
array('required' => false,
'label' => __('Disable Project'),
'initial' => $this->project->disabled,
'widget' => 'Pluf_Form_Widget_CheckboxInput',
));
} else {
$this->fields['enableads'] = new Pluf_Form_Field_Boolean(
array('required' => false,
'widget' => 'Pluf_Form_Widget_CheckboxInput',
'widget_attrs' => array('disabled' => 'disabled')
));
}
$tags = $this->project->get_tags_list();
for ($i=1;$i<7;$i++) {
$this->project->description = $this->cleaned_data['description'];
$this->project->batchAssoc('IDF_Tag', $tagids);
$this->project->syntaxtheme = $this->cleaned_data["syntaxtheme"];
if ($this->user->administrator)
$this->project->enableads = $this->cleaned_data['enableads'];
if ($this->user->administrator) {
$this->project->enableads = $this->cleaned_data['enableads'];
$this->project->disabled = $this->cleaned_data["disabled"];
}
$this->project->update();
$conf = $this->project->getConf();
indefero/src/IDF/Middleware/GoogleAds.php
4040
4141
4242
43
44
4345
4446
4547
*/
function process_response($request, $response)
{
if (isset($response) && !isset($response->status_code))
return $response;
if (!Pluf::f('google_ads', false)) {
return $response;
}
indefero/src/IDF/Migrations/30SyntaxHighlightTheme.php
1818
1919
2020
21
21
2222
2323
2424
}
function IDF_Migrations_28OTPKey_down()
function IDF_Migrations_30SyntaxHighlightTheme_down()
{
$table = Pluf::factory('IDF_Project')->getSqlTable();
indefero/src/IDF/Migrations/31DisableProject.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
function IDF_Migrations_31DisableProject_up()
{
$table = Pluf::factory('IDF_Project')->getSqlTable();
$sql = array();
$sql["MySQL"] = "ALTER TABLE " . $table . " ADD COLUMN `disabled` int(11) NULL AFTER `current_activity`;";
$db = Pluf::db();
$engine = Pluf::f('db_engine');
if (!isset($sql[$engine])) {
throw new Exception('SQLite complex migration not supported.');
}
$db->execute($sql[$engine]);
}
function IDF_Migrations_31DisableProject_down()
{
$table = Pluf::factory('IDF_Project')->getSqlTable();
$sql = array();
$sql["MySQL"] = "ALTER TABLE " . $table . " DROP COLUMN `disabled`;";
$db = Pluf::db();
$engine = Pluf::f('db_engine');
if (!isset($sql[$engine])) {
throw new Exception('SQLite complex migration not supported.');
}
$db->execute($sql[$engine]);
}
indefero/src/IDF/Precondition.php
3434
3535
3636
37
38
39
40
3741
3842
3943
*/
static public function baseAccess($request)
{
if ($request->user->administrator)
return true;
if ($request->project->disabled)
return false;
if (!$request->project->private) {
return true;
}
indefero/src/IDF/Project.php
117117
118118
119119
120
121
122
123
124
125
126
127
120128
121129
122130
'default' => 1,
),
'disabled' =>
array(
'type' => 'Pluf_DB_Field_Integer',
'blank' => false,
'verbose' => __('disabled'),
'default' => 0,
),
'syntaxtheme' =>
array(
'type' => 'Pluf_DB_Field_Text',
indefero/src/IDF/Views.php
393393
394394
395395
396
397
398
399
400
401
402
403
404
396405
397406
398407
......
400409
401410
402411
403
412
413
414
404415
405416
417
418
406419
407420
408421
......
418431
419432
420433
421
434
422435
423436
424437
// anonymous users can only see non-private projects
$false = Pluf_DB_BooleanToDb(false, $db);
$true = Pluf_DB_BooleanToDb(true, $db);
$dbpfx = $db->pfx;
$disabled_results = $db->select("SELECT id FROM ${dbpfx}idf_projects WHERE disabled = $true");
$disabled_ids = [];
foreach($disabled_results as $id) {
$disabled_ids[] = $id['id'];
}
$sql_results = $db->select(
'SELECT id FROM '.$db->pfx.'idf_projects '.
'WHERE '.$db->qn('private').'='.$false
$ids = array();
foreach ($sql_results as $id) {
$ids[] = $id['id'];
if (!in_array($id['id'], $disabled_ids)) {
$ids[] = $id['id'];
}
}
// registered users may additionally see private projects with which
// they're somehow affiliated
if (!$user->isAnonymous()) {
$rows = Pluf::factory('Pluf_RowPermission')->getList(array('filter' => $permSql->gen()));
if ($rows->count() > 0) {
foreach ($rows as $row) {
if (in_array($row->model_id, $ids))
if (in_array($row->model_id, $ids) || in_array($row->model_id, $disabled_ids))
continue;
$ids[] = $row->model_id;
}
indefero/src/IDF/templates/idf/admin/summary.html
7878
7979
8080
81
82
83
84
85
86
8187
8288
8389
</td>
</tr>
<tr>
<th>{$form.f.disabled.labelTag}:</th>
<td>{if $form.f.disabled.errors}{$form.f.disabled.fieldErrors}{/if}
{$form.f.disabled|unsafe}
</td>
</tr>
<tr>
<th>{$form.f.syntaxtheme.labelTag}:</th>
<td>{if $form.f.syntaxtheme.errors}{$form.f.syntaxtheme.fieldErrors}{/if}
{$form.f.syntaxtheme|unsafe}
pluf/src/Pluf/Middleware/Stats.php
4242
4343
4444
45
46
4547
4648
4749
*/
function process_response($request, $response)
{
if (isset($response) && !isset($response->status_code))
return $response;
if (!in_array($response->status_code,
array(200, 201, 202, 203, 204, 205, 206, 404, 501))) {
return $response;

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.08330s using 20 queries.