public function executeMail(sfWebRequest $request) { $templates = array(); $it = new directoryIterator($template_dir = sfConfig::get('sf_root_dir') . '/lib/email/modules/reservation/templates'); $tmp_dir = sfConfig::get('sf_web_dir') . '/tmp'; @mkdir($tmp_dir); while ($it->valid()) { if ('.' !== substr($it->current(), 0, 1) and !$it->isDir()) { $filename = $it->current(); file_put_contents($tmp_dir . '/' . $filename, str_replace(array('<?php', '?>', 'echo', ';'), array('<span style="background-color: #F9F3BD;">', '</span>', '', ''), file_get_contents($template_dir . '/' . $filename))); $templates[(string) $filename] = array('type' => substr($filename, 1, 4), 'source' => $filename); } $it->next(); } $this->templates = $templates; }