- Timestamp:
- 03/01/12 14:51:37 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/filters/interceptors/FilterMapping.php
r5539 r5601 81 81 foreach( $rules as $name => $data ) 82 82 { 83 //if($data['enabled'] )84 //continue;83 if( !$data['enabled'] ) 84 continue; 85 85 86 86 $criteria = $data['criteria']; … … 121 121 $require_vacation = true; 122 122 $vacation = true; 123 $script_match = "vacation";124 break;123 //$script_match = "vacation"; 124 continue; 125 125 default: 126 126 $script_criteria .= "header :"; … … 191 191 $require_vacation = true; 192 192 $action[$k]['parameter'] = "\"" . $action[$k]['parameter'] . "\""; 193 $ script_action = " :subject \"Fora do Escritório\" " . $action[$k]['parameter'] . ";";193 $vacation_action = " :subject \"Fora do Escritório\" " . $action[$k]['parameter'] . ";"; 194 194 $vacation = true; 195 break;195 continue; 196 196 case 'setflag': 197 197 $require_flag = true; … … 201 201 break; 202 202 } 203 if ($vacation == false)$script_action .= $action[$k]['type'] . " \"" . $action[$k]['parameter'] . "\";\r\n ";203 /*if ($vacation == false)*/ $script_action .= $action[$k]['type'] . " \"" . $action[$k]['parameter'] . "\";\r\n "; 204 204 } 205 205 206 if ($vacation == false)$script_action .= "}";206 /*if ($vacation == false)*/ $script_action .= "}"; 207 207 208 208 $script_rules .= $script_match . $script_criteria . $script_action . "\r\n"; … … 224 224 } 225 225 226 if( $vacation ) 227 { 228 $script_rules .= "vacation" . $vacation_action . "\r\n"; 229 } 230 226 231 $json_data = json_encode($rules); 227 232 … … 313 318 public function applySieveFilter( &$uri , &$result , &$criteria , $original ) 314 319 { 320 $result['id'] = $uri['id']; 321 315 322 if( $original['properties']['applyMessages'] ) 316 323 { 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 $imap = Controller::service( 'Imap' );332 333 324 $filter = Controller::read($uri); 325 326 $proc = array(); 327 $proc['keep'] = false; 328 329 foreach ($filter['actions'] as $v){ 330 if($v['type'] == 'keep') 331 $proc['keep'] = true; 332 else{ 333 $proc['type'] = $v['type']; 334 $proc['parameter'] = $v['parameter']; 335 } 336 } 337 338 $imap = Controller::service( 'Imap' ); 339 $imap->apliSieveFilter($original['properties']['applyMessages'] , $proc ); 340 return $result; 334 341 } 335 342 } … … 373 380 */ 374 381 public function setRule( &$uri , &$params , &$criteria , $original ) 375 { 376 if( !$this->rules )382 { 383 if( !$this->rules ) 377 384 $this->rules = $this->getRules(); 378 379 $params['id'] = isset($params['id']) ? $params['id'] : $params['name']; 380 $update = false; 381 382 foreach( $this->rules as $i => $rule ) 383 if( $update = ($rule['id'] === $params['id']) ) 384 { 385 $this->rules[$i] = $params; 386 break; 387 } 388 389 if( !$update ) 390 $this->rules[] = $params; 391 392 $content = $this->formatSieveScript( $this->rules ); 393 394 $params = array( 'name' => $this->service->config['user'], 395 'content' => $content, 396 'active' => true ); 385 386 $uri['id'] = $params['id'] = isset($params['id']) ? $params['id'] : urlencode($params['name']); 387 388 $i = 0; 389 390 for( ;$this->rules[$i] && $this->rules[$i]['id'] !== $params['id']; $i++ ); 391 392 $this->rules[$i] = $params; 393 394 $params = array( 'name' => $this->service->config['user'], 395 'content' => $this->formatSieveScript( $this->rules ), 396 'active' => true ); 397 397 } 398 398 … … 414 414 public function deleteRule( &$uri, &$params, &$criteria, $original ) 415 415 { 416 if( !$this->rules ) 417 418 416 if( !$this->rules ) { 417 $this->rules = $this->getRules(); 418 } 419 419 $params['id'] = $uri['id']; 420 420 421 421 $update = false; 422 423 $rules = array(); 422 424 423 425 foreach( $this->rules as $i => $rule ) 424 if( $rule['id'] === $uri['id'] ) 425 unset( $this->rules[$i] ); 426 426 if( $rule['id'] !== $uri['id'] ) 427 $rules[] = $this->rules[$i]; 428 429 $this->rules = $rules; 430 427 431 $uri['id'] = ''; 428 432 … … 433 437 $URI = Controller::URI( $uri['concept'], $this->service->config['user'] ); 434 438 $this->service->update( $URI, $params ); 435 439 436 440 return( false ); 437 441 }
Note: See TracChangeset
for help on using the changeset viewer.