@@ -63,7 +63,7 @@ |
||
63 | 63 | 50 |
64 | 64 | ); |
65 | 65 | |
66 | - // $df->setSize(100); |
|
66 | + // $df->setSize(100); |
|
67 | 67 | $params->push($df); |
68 | 68 | |
69 | 69 | return $params; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | public function sourceRecords($params = null) { |
32 | - return DataList::create('Advert');//->limit(10); |
|
32 | + return DataList::create('Advert'); //->limit(10); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $fields->push(new TabSet('Root', $mainTab = new Tab('Main'))); |
37 | 37 | $mainTab->setTitle(_t('SiteTree.TABMAIN', 'Main')); |
38 | 38 | |
39 | - $fields->addFieldToTab('Root.Main', new TextField('Title', 'The name of the category')); |
|
39 | + $fields->addFieldToTab('Root.Main', new TextField('Title', 'The name of the category')); |
|
40 | 40 | $fields->addFieldToTab('Root.Main', new CheckboxField('Enabled', 'Are adverts for this category enabled?')); |
41 | 41 | |
42 | 42 | return $fields; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $advert = Advert::get()->filter('DigitalSignature', $digsig)->first(); // should only be the one but make sure |
34 | 34 | |
35 | 35 | if (!$advert) { |
36 | - $this->httpError(404, 'Advert "'.$digsig.'"" not found'); |
|
36 | + $this->httpError(404, 'Advert "' . $digsig . '"" not found'); |
|
37 | 37 | } else { |
38 | 38 | // record the click |
39 | 39 | $advert->Clickthroughs = $advert->Clickthroughs + 1; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $advert = Advert::get()->filter('DigitalSignature', $digsig)->first(); // should only be the one but make sure |
53 | 53 | if (!$advert) { |
54 | - $this->httpError(404, 'Advert "'.$digsig.'"" not found'); |
|
54 | + $this->httpError(404, 'Advert "' . $digsig . '"" not found'); |
|
55 | 55 | } else { |
56 | 56 | // record the click |
57 | 57 | $advert->Impressions = $advert->Impressions + 1; |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | |
160 | 160 | // Normal operation: |
161 | 161 | $mimeType = HTTP::get_mime_type($file_name); |
162 | - header("Content-Type: {$mimeType}; name=\"".addslashes($file_name).'"'); |
|
163 | - header('Content-Disposition: attachment; filename='.addslashes($file_name)); |
|
162 | + header("Content-Type: {$mimeType}; name=\"" . addslashes($file_name) . '"'); |
|
163 | + header('Content-Disposition: attachment; filename=' . addslashes($file_name)); |
|
164 | 164 | header('Cache-Control: max-age=1, private'); |
165 | 165 | header("Content-Length: {$file_size}"); |
166 | 166 | header('Pragma: '); |
167 | 167 | |
168 | 168 | if (self::$use_x_sendfile) { |
169 | 169 | session_write_close(); |
170 | - header('X-Sendfile: '.$file_path); |
|
170 | + header('X-Sendfile: ' . $file_path); |
|
171 | 171 | exit(); |
172 | 172 | } elseif ($filePointer = @fopen($file_path, 'rb')) { |
173 | 173 | session_write_close(); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | public static $db = array( |
6 | 6 | 'MpuAboveFoldPosition' => 'Int', |
7 | 7 | 'MpuBelowFoldPosition' => 'Int', |
8 | - ); |
|
8 | + ); |
|
9 | 9 | |
10 | 10 | public static $defaults = array( |
11 | 11 | 'MpuAboveFoldPosition' => '4', |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $where = "AdvertLayoutType.Title = '$adverttype'"; |
48 | 48 | |
49 | 49 | if (isset($advertcategory)) { |
50 | - $where .= ' AND Advert.AdvertCategoryID = '.$advertcategoryid; |
|
50 | + $where .= ' AND Advert.AdvertCategoryID = ' . $advertcategoryid; |
|
51 | 51 | $where .= ' AND (StartDate IS NULL OR !StartDate OR StartDate < NOW()) AND (FinishDate IS NULL OR !FinishDate OR NOW() < FinishDate)'; |
52 | 52 | |
53 | 53 | if (count(self::$advertsalreadyserved) > 0) { |
@@ -214,15 +214,15 @@ |
||
214 | 214 | |
215 | 215 | // Normal operation: |
216 | 216 | $mimeType = HTTP::getMimeType($file_name); |
217 | - header("Content-Type: {$mimeType}; name=\"".addslashes($file_name).'"'); |
|
218 | - header('Content-Disposition: attachment; filename='.addslashes($file_name)); |
|
217 | + header("Content-Type: {$mimeType}; name=\"" . addslashes($file_name) . '"'); |
|
218 | + header('Content-Disposition: attachment; filename=' . addslashes($file_name)); |
|
219 | 219 | header('Cache-Control: max-age=1, private'); |
220 | 220 | header("Content-Length: {$file_size}"); |
221 | 221 | header('Pragma: '); |
222 | 222 | |
223 | 223 | if (self::$use_x_sendfile) { |
224 | 224 | session_write_close(); |
225 | - header('X-Sendfile: '.$file_path); |
|
225 | + header('X-Sendfile: ' . $file_path); |
|
226 | 226 | exit(); |
227 | 227 | } elseif ($filePointer = @fopen($file_path, 'rb')) { |
228 | 228 | session_write_close(); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Handles requests for secure files by url. |
|
4 | - * |
|
5 | - * @author Hamish Campbell <[email protected]> |
|
6 | - * @copyright copyright (c) 2010, Hamish Campbell |
|
7 | - */ |
|
3 | + * Handles requests for secure files by url. |
|
4 | + * |
|
5 | + * @author Hamish Campbell <[email protected]> |
|
6 | + * @copyright copyright (c) 2010, Hamish Campbell |
|
7 | + */ |
|
8 | 8 | class SecureFileController extends Controller implements PermissionProvider |
9 | 9 | { |
10 | 10 | /** |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | { |
8 | 8 | public static $searchable_fields = array( |
9 | 9 | 'WebsiteLink', |
10 | - ); |
|
10 | + ); |
|
11 | 11 | |
12 | 12 | public static $db = array( |
13 | 13 | // title to show in model admin |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // stats |
34 | 34 | 'Impressions' => 'Int', |
35 | 35 | 'Clickthroughs' => 'Int', |
36 | - ); |
|
36 | + ); |
|
37 | 37 | |
38 | 38 | public static $has_one = array( |
39 | 39 | 'AdvertImage' => 'Image', |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | // a Javascript toggle on this field displays either the adbroker text field, or an image with URL |
76 | 76 | $fields->addFieldToTab('Root.Main', new DropdownField('AdvertSource', 'The type of advert', |
77 | 77 | singleton('Advert')->dbObject('AdvertSource')->enumValues() |
78 | - )); |
|
78 | + )); |
|
79 | 79 | |
80 | 80 | if ($this->ID == 0) { |
81 | 81 | $html = '<div class="field text">An image can be uploaded after the advert is saved for the first time</div>'; |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | parent::onBeforeWrite(); |
119 | 119 | } |
120 | 120 | |
121 | - /* |
|
121 | + /* |
|
122 | 122 | Calculate a digital signature from several of the fields |
123 | 123 | */ |
124 | - public function CalculateDigitalSignature() |
|
125 | - { |
|
124 | + public function CalculateDigitalSignature() |
|
125 | + { |
|
126 | 126 | /* because we save the impression counter on every rendition this cannot include |
127 | 127 | - number of impressions |
128 | 128 | - last edited |
@@ -133,5 +133,5 @@ discard block |
||
133 | 133 | $hashed = hash('sha512', $data); |
134 | 134 | //error_log("HASH CREATED:".$hashed); |
135 | 135 | return $hashed; |
136 | - } |
|
136 | + } |
|
137 | 137 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $mainTab->setTitle(_t('SiteTree.TABMAIN', 'Main')); |
70 | 70 | |
71 | 71 | // human readable title |
72 | - $fields->addFieldToTab('Root.Main', new TextField('Title', |
|
72 | + $fields->addFieldToTab('Root.Main', new TextField('Title', |
|
73 | 73 | 'Human readable title for the advert')); |
74 | 74 | |
75 | 75 | // a Javascript toggle on this field displays either the adbroker text field, or an image with URL |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | // quick tags, faster than the grid editor - these are processed prior to save to create/assign tags |
92 | - $fields->addFieldToTab('Root.Main', new TextField('WebsiteLink', |
|
92 | + $fields->addFieldToTab('Root.Main', new TextField('WebsiteLink', |
|
93 | 93 | 'The URL that will be shown when the advert image is clicked')); |
94 | 94 | |
95 | - $fields->addFieldToTab('Root.Main', new TextareaField('AdbrokerJavascript', |
|
95 | + $fields->addFieldToTab('Root.Main', new TextareaField('AdbrokerJavascript', |
|
96 | 96 | 'JavaScript provided by the adbroker')); |
97 | 97 | |
98 | 98 | $fields->addFieldToTab('Root.Main', $sdf = new DateField('StartDate', 'The date the advert becomes active')); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $categoryfield = new DropdownField('AdvertCategoryID', 'Category', AdvertCategory::get()->sort('Title')->map('ID', 'Title')); |
104 | 104 | $categoryfield->setEmptyString('-- Select one --'); |
105 | 105 | $mapping = AdvertLayoutType::get()->sort('Title')->map('ID', 'Title')->toArray(); |
106 | - error_log(print_r($mapping,1)); |
|
106 | + error_log(print_r($mapping, 1)); |
|
107 | 107 | $layoutfield = new DropdownField('AdvertLayoutTypeID', 'Layout Type', $mapping); |
108 | 108 | $layoutfield->setEmptyString('-- Select one --'); |
109 | 109 | |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | - last edited |
130 | 130 | Otherwise the clickthrough will fail |
131 | 131 | */ |
132 | - $data = $this->ID.'_'.$this->AdvertCategory()->Title.'_'.$this->AdvertLayoutType()->Title.'_'.$this->AdbrokerJavascript; |
|
133 | - $data .= '_'.$this->StartDate.'_'.$this->FinishDate.'_'.$this->ClickThroughs.'_advert'; |
|
132 | + $data = $this->ID . '_' . $this->AdvertCategory()->Title . '_' . $this->AdvertLayoutType()->Title . '_' . $this->AdbrokerJavascript; |
|
133 | + $data .= '_' . $this->StartDate . '_' . $this->FinishDate . '_' . $this->ClickThroughs . '_advert'; |
|
134 | 134 | $hashed = hash('sha512', $data); |
135 | 135 | //error_log("HASH CREATED:".$hashed); |
136 | 136 | return $hashed; |
@@ -47,7 +47,7 @@ |
||
47 | 47 | parent::onBeforeWrite(); |
48 | 48 | } |
49 | 49 | |
50 | - /* |
|
50 | + /* |
|
51 | 51 | Get the advert category. Either use the cached advert category, or traverse the tree towards the root looking for it |
52 | 52 | */ |
53 | 53 | public function CalculateAdvertCategoryID() |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $fields->push(new TabSet('Root', $mainTab = new Tab('Main'))); |
37 | 37 | $mainTab->setTitle(_t('SiteTree.TABMAIN', 'Main')); |
38 | 38 | |
39 | - $fields->addFieldToTab('Root.Main', new TextField('Title', 'The name of the category')); |
|
39 | + $fields->addFieldToTab('Root.Main', new TextField('Title', 'The name of the category')); |
|
40 | 40 | $fields->addFieldToTab('Root.Main', new CheckboxField('Enabled', 'Are adverts for this category enabled?')); |
41 | 41 | |
42 | 42 | return $fields; |