public function getXML($rss = false)
 {
     if ($rss) {
         $output = '<item>' . '<title>' . htmlspecialchars($this->getName()) . '</title>' . '<link>' . htmlspecialchars(Tools::get('url') . '/themeGroup/show/' . $this->getId()) . '</link>' . '<description>' . htmlspecialchars($this->getTitle()) . '</description>' . '<pubDate>' . date('r', strtotime($this->getUpdatedAt())) . '</pubDate>' . '<guid>' . htmlspecialchars(Tools::get('url') . '/themeGroup/show/' . $this->getId()) . '</guid>' . '</item>';
     } else {
         $output = '<theme_group>';
         $output .= '<id>' . $this->getId() . '</id>';
         $output .= '<name>' . htmlspecialchars($this->getName()) . '</name>';
         $output .= '<title>' . htmlspecialchars($this->getTitle()) . '</title>';
         $output .= '<known>' . intval($this->getKnown()) . '</known>';
         $output .= '<created_at>' . $this->getCreatedAt() . '</created_at>';
         $output .= '<updated_at>' . $this->getUpdatedAt() . '</updated_at>';
         $output .= '</theme_group>';
     }
     return $output;
 }
 public function getXML($rss = false)
 {
     if ($rss) {
         $output = '<item>' . '<title>Comment for ' . htmlspecialchars($this->getObject()->getName()) . ' by ' . htmlspecialchars($this->getUser()->getName()) . '</title>' . '<link>' . htmlspecialchars(Tools::get('url') . '/comment/show/' . $this->getId()) . '</link>' . '<description>' . htmlspecialchars($this->getComment()) . '</description>' . '<pubDate>' . date('r', strtotime($this->getUpdatedAt())) . '</pubDate>' . '<guid>' . htmlspecialchars(Tools::get('url') . '/comment/show/' . $this->getId()) . '</guid>' . '</item>';
     } else {
         $output = '<comment>';
         $output .= '<id>' . $this->getId() . '</id>';
         $output .= '<message>' . htmlspecialchars($this->getComment()) . '</message>';
         if ($this->getObject()->getObjectType() == Object::THEME) {
             $output .= '<theme_id>' . $this->getObjectId() . '</theme_id>';
         } else {
             $output .= '<module_id>' . $this->getObjectId() . '</module_id>';
         }
         $output .= '<user_id>' . $this->getUserId() . '</user_id>';
         $output .= '<created_at>' . $this->getCreatedAt() . '</created_at>';
         $output .= '<updated_at>' . $this->getUpdatedAt() . '</updated_at>';
         $output .= '</comment>';
     }
     return $output;
 }
 public function getXML($rss = false)
 {
     if ($rss) {
         $output = '<item>' . '<title>' . htmlspecialchars($this->getName()) . '</title>' . '<link>' . htmlspecialchars(Tools::get('url') . '/application/show/' . $this->getId()) . '</link>' . '<description>' . htmlspecialchars('	<a href="' . Tools::get('url') . '/application/show/' . $this->getId() . '">' . '<img src="' . Tools::get('url') . $this->getUrlPath() . 'smallthumb.png" alt="Thumbnail">' . '</a><br/>' . $this->getDescription()) . '</description>' . '<pubDate>' . date('r', strtotime($this->getUpdatedAt())) . '</pubDate>' . '<guid>' . htmlspecialchars(Tools::get('url') . '/application/show/' . $this->getId()) . '</guid>' . '</item>';
     } else {
         $output = '<application>';
         $output .= '<id>' . $this->getId() . '</id>';
         $output .= '<name>' . htmlspecialchars($this->getName()) . '</name>';
         $output .= '<description>' . htmlspecialchars($this->getDescription()) . '</description>';
         $output .= '<url>' . htmlspecialchars($this->getSourceUrl()) . '</url>';
         $output .= '<thumbnail>' . htmlspecialchars(Tools::get('url') . $this->getUrlPath() . 'smallthumb.png') . '</thumbnail>';
         $output .= '<screenshot>' . htmlspecialchars(Tools::get('url') . $this->getUrlPath() . 'screenshot.png') . '</screenshot>';
         $output .= '<rating>' . $this->getRating() . '</rating>';
         $output .= '<user_id>' . $this->getUserId() . '</user_id>';
         $output .= '<created_at>' . $this->getCreatedAt() . '</created_at>';
         $output .= '<updated_at>' . $this->getUpdatedAt() . '</updated_at>';
         $output .= '</application>';
     }
     return $output;
 }
 public static function update($values, $user)
 {
     $id = $values['id'];
     if ($id) {
         $q = new Doctrine_Query();
         $q = $q->select('t.*')->from('Theme t');
         $q = $q->addWhere('id = ?', array($id));
         if (!$user->getRole() == User::ADMIN) {
             $q = $q->addWhere('user_id = ?', array($user->getId()));
         }
         $theme = $q->fetchOne();
     } else {
         $theme = new Theme();
     }
     if ($theme) {
         $theme->setName($values['name']);
         $theme->setDescription($values['description']);
         if (!$theme->getUserId()) {
             $theme->setUserId($user->getId());
         }
         $file = $values['file'];
         if ($file) {
             $filename = $file->getOriginalName();
             $theme->setFileName($filename);
         }
         $theme->setApproved(false);
         $theme->save();
         $folderpath = $theme->getFolderPath();
         if (!is_dir($folderpath)) {
             mkdir($folderpath);
         }
         if ($file) {
             $filepath = $folderpath . $theme->getFileName();
             $file->save($filepath);
         }
         $screenshot = $values['screenshot'];
         if ($screenshot) {
             $screenshotpath = $folderpath . $theme->getId() . $screenshot->getOriginalName();
             $screenshot->save($screenshotpath);
             $smallThumb = new Thumbnail($screenshotpath);
             if ($smallThumb->getCurrentWidth() > 150 || $smallThumb->getCurrentHeight() > 150) {
                 $smallThumb->resize(150, 150);
             }
             $smallThumb->show(100, $folderpath . 'smallthumb.png');
             $bigThumb = new Thumbnail($screenshotpath);
             if ($bigThumb->getCurrentWidth() > 500 || $bigThumb->getCurrentHeight() > 500) {
                 $bigThumb->resize(500, 500);
             }
             $bigThumb->show(100, $folderpath . 'bigthumb.png');
             $screenshot = new Thumbnail($screenshotpath);
             $screenshot->show(100, $folderpath . 'screenshot.png');
             unlink($screenshotpath);
         }
         $outputs = array();
         if ($file) {
             exec(Tools::get('edje_list_path') . ' ' . $filepath, $outputs);
             $groups = array_splice($outputs, 4);
             $groups = array_keys(array_flip($groups));
             $name = substr($outputs[0], 6);
             if ($name) {
                 $theme->setName($name);
             }
             $author = substr($outputs[1], 8);
             if ($author) {
                 $theme->setAuthor($author);
             }
             $license = substr($outputs[2], 9);
             $theme->setLicense($license);
             $version = substr($outputs[3], 9);
             $theme->setVersion($version);
             $theme->save();
             $theme->clearThemeGroups();
             foreach ($groups as $group) {
                 $theme->addThemeGroup($group);
             }
         }
         return $theme;
     }
     return null;
 }
?>
bigthumb.png" alt="<?php 
echo $theme->getName();
?>
 Thumbnail" ?>
</a>
</div>
<br/>
<h2>Provides</h2>
<?php 
include_component('themeGroup', 'table', array('theme_id' => $theme->getId(), 'compact' => true));
?>
<br/>
<br/>
<h2>Comments</h2>
<?php 
include_component('comment', 'table', array('theme_id' => $theme->getId()));
?>
</div>
<?php 
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="<?php 
echo $theme->getName();
?>
's Comments" href="<?php 
echo Tools::get('url') . '/rss/comment/theme_id/' . $theme->getId();
?>
" />
<?php 
end_slot();
	<?php 
if ($theme_group) {
    ?>
for <?php 
    echo $theme_group->getDisplayName();
}
?>
</h1>
<?php 
if ($sf_user->hasCredential('user')) {
    ?>
	<?php 
    echo link_to('Add new Theme', '/theme/create');
}
if ($sf_user->hasCredential('admin')) {
    ?>
	| <?php 
    echo link_to('Theme Groups', '/themeGroup/index');
}
?>

<?php 
include_component('theme', 'table');
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="Themes" href="<?php 
echo Tools::get('url') . '/rss/theme';
?>
" />
<?php 
end_slot();
<?php

slot('title');
?>
Users<?php 
end_slot();
?>
<h1>Users</h1>

<?php 
include_component('user', 'table');
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="Users" href="<?php 
echo Tools::get('url') . '/rss/user';
?>
" />
<?php 
end_slot();
?>
</h3>
<?php 
if ($sf_user->hasCredential('admin')) {
    ?>
	<?php 
    echo link_to('Edit Theme Group', '/themeGroup/update?id=' . $themeGroup->getId());
    ?>
 |
<?php 
}
if ($sf_user->hasCredential('user')) {
    ?>
	<?php 
    echo link_to('Add new Theme', '/theme/create');
}
include_component('theme', 'table', array('theme_group_id' => $themeGroup->getId()));
?>
</div>
<?php 
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="Themes - <?php 
echo $themeGroup->getTitle();
?>
" href="<?php 
echo Tools::get('url') . '/rss/theme_group_id/' . $themeGroup->getId();
?>
" />
<?php 
end_slot();
    echo $user->getName();
}
end_slot();
?>
<h1>Applications
	<?php 
if ($user) {
    ?>
by <?php 
    echo $user->getName();
}
?>
</h1>
<?php 
if ($sf_user->hasCredential('user')) {
    ?>
	<?php 
    echo link_to('Add new Application', '/application/create');
}
?>

<?php 
include_component('application', 'table');
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="Applications" href="<?php 
echo Tools::get('url') . '/rss/application';
?>
" />
<?php 
end_slot();
 public function sendForgotPasswordEmail()
 {
     $password = User::generatePassword();
     $this->setPassword(md5($password));
     $this->save();
     $to = $this->getEmail();
     $subject = 'Forgot Password - ' . Tools::get('name');
     $message = 'Unbelievable! You forgot your password. ' . "\n" . 'Here\'s a newly generated one: ' . $password . '' . "\n" . 'Go login and change your password immediately.' . "\n" . Tools::get('url');
     $headers = 'From: ' . Tools::get('webmaster_email') . "\n" . 'Reply-To: ' . Tools::get('webmaster_email') . "\n" . 'X-Mailer: ' . Tools::get('name') . ' Mailer';
     mail($to, $subject, $message, $headers);
 }
    ?>
by <?php 
    echo $user->getName();
}
?>
	<?php 
if ($application) {
    ?>
for <?php 
    echo $application->getName();
}
?>
</h1>
<?php 
if ($sf_user->hasCredential('user')) {
    ?>
	<?php 
    echo link_to('Add new Module', '/module/create');
}
?>

<?php 
include_component('module', 'table');
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="Modules" href="<?php 
echo Tools::get('url') . '/rss/module';
?>
" />
<?php 
end_slot();
<h2>Comments made by this user</h2>
<?php 
include_component('comment', 'table', array('user_id' => $user->getId()));
?>
</div>
<?php 
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="<?php 
echo $user->getName();
?>
's Themes" href="<?php 
echo Tools::get('url') . '/rss/theme/user_id/' . $user->getId();
?>
" />
<link rel="alternate" type="application/rss+xml" title="<?php 
echo $user->getName();
?>
's Modules" href="<?php 
echo Tools::get('url') . '/rss/module/user_id/' . $user->getId();
?>
" />
<link rel="alternate" type="application/rss+xml" title="<?php 
echo $user->getName();
?>
's Comments" href="<?php 
echo Tools::get('url') . '/rss/comment/user_id/' . $user->getId();
?>
" />
<?php 
end_slot();
<h2>Themes for <?php 
    echo $application->getName();
    ?>
</h2>
<?php 
    include_component('theme', 'table', array('application_id' => $application->getId()));
}
?>
<h2>Comments</h2>
<?php 
include_component('comment', 'table', array('application_id' => $application->getId()));
?>
</div>
<?php 
if ($sf_user->hasCredential('admin')) {
    ?>
<h2>This Application is associated with</h2>
<?php 
    include_component('themeGroup', 'table', array('application_id' => $application->getId()));
}
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="<?php 
echo $application->getName();
?>
's Comments" href="<?php 
echo Tools::get('url') . '/rss/comment/application_id/' . $application->getId();
?>
" />
<?php 
end_slot();
 public function executeList()
 {
     $rss = $this->getRequestParameter('rss');
     $object = $this->getRequestParameter('object');
     $output = '';
     $title = Tools::get('name');
     $link = Tools::get('url');
     $description = Tools::get('rss_desc');
     $offset = $this->getRequestParameter('offset');
     $limit = $this->getRequestParameter('limit');
     if ($object == 'application') {
         $title .= ' - Applications';
         $user_id = $this->getRequestParameter('user_id');
         if ($this->getRequestParameter('user_name')) {
             $user_id = User::getByName($this->getRequestParameter('user_name'))->getId();
         }
         $q = new Doctrine_Query();
         $q = $q->select('a.*')->from('Application a');
         if ($user_id) {
             $q = $q->addWhere('user_id = ?', array($user_id));
         }
         $q = $q->addWhere('approved = ?', array(true));
         $q = $q->orderby('updated_at desc');
         if ($limit) {
             $q->limit($limit);
         }
         if ($offset) {
             $q->offset($offset);
         }
         $applications = $q->execute();
         if (!$rss) {
             $output .= '<applications count="' . $applications->count() . '">';
         }
         foreach ($applications as $application) {
             $output .= $application->getXML($rss);
         }
         if (!$rss) {
             $output .= '</applications>';
         }
     } elseif ($object == 'comment') {
         $title .= ' - Comments';
         $user_id = $this->getRequestParameter('user_id');
         if ($this->getRequestParameter('user_name')) {
             $user_id = User::getByName($this->getRequestParameter('user_name'))->getId();
         }
         $application_id = $this->getRequestParameter('application_id');
         $module_id = $this->getRequestParameter('module_id');
         $theme_id = $this->getRequestParameter('theme_id');
         $q = new Doctrine_Query();
         $q = $q->select('c.*')->from('Comment c');
         if ($user_id) {
             $q = $q->addWhere('user_id = ?', array($user_id));
         }
         if ($application_id) {
             $q = $q->addWhere('application_id = ?', array($application_id));
         }
         if ($module_id) {
             $q = $q->addWhere('madule_id = ?', array($module_id));
         }
         if ($theme_id) {
             $q = $q->addWhere('theme_id = ?', array($theme_id));
         }
         $q = $q->orderby('updated_at desc');
         if ($limit) {
             $q->limit($limit);
         }
         if ($offset) {
             $q->offset($offset);
         }
         $comments = $q->execute();
         if (!$rss) {
             $output .= '<comments count="' . $comments->count() . '">';
         }
         foreach ($comments as $comment) {
             $output .= $comment->getXML($rss);
         }
         if (!$rss) {
             $output .= '</comments>';
         }
     } elseif ($object == 'module') {
         $title .= ' - Modules';
         $application_id = $this->getRequestParameter('application_id');
         $user_id = $this->getRequestParameter('user_id');
         if ($this->getRequestParameter('user_name')) {
             $user_id = User::getByName($this->getRequestParameter('user_name'))->getId();
         }
         $q = new Doctrine_Query();
         $q = $q->select('m.*')->from('Madule m');
         if ($application_id) {
             $q = $q->addWhere('application_id = ?', array($application_id));
         }
         if ($user_id) {
             $q = $q->addWhere('user_id = ?', array($user_id));
         }
         $q = $q->addWhere('approved = ?', array(true));
         $q = $q->orderby('updated_at desc');
         if ($limit) {
             $q->limit($limit);
         }
         if ($offset) {
             $q->offset($offset);
         }
         $modules = $q->execute();
         if (!$rss) {
             $output .= '<modules count="' . $modules->count() . '">';
         }
         foreach ($modules as $module) {
             $output .= $module->getXML($rss);
         }
         if (!$rss) {
             $output .= '</modules>';
         }
     } elseif ($object == 'theme') {
         $title .= ' - Themes';
         $user_id = $this->getRequestParameter('user_id');
         if ($this->getRequestParameter('user_name')) {
             $user_id = User::getByName($this->getRequestParameter('user_name'))->getId();
         }
         $theme_group_id = $this->getRequestParameter('theme_group_id');
         if ($this->getRequestParameter('theme_group_title')) {
             $theme_group_id = ThemeGroup::getByTitle($this->getRequestParameter('theme_group_title'))->getId();
         }
         if ($this->getRequestParameter('theme_group_name')) {
             $theme_group_id = ThemeGroup::getByName($this->getRequestParameter('theme_group_name'))->getId();
         }
         $application_id = $this->getRequestParameter('application_id');
         $module_id = $this->getRequestParameter('module_id');
         $q = new Doctrine_Query();
         $q = $q->select('t.*')->from('Theme t');
         if ($application_id) {
             $q = $q->addWhere('t.id IN (SELECT ttg.theme_id from ThemeThemeGroup ttg where ttg.theme_group_id IN ' . '(SELECT ag.theme_group_id FROM ApplicationThemeGroup ag where ag.application_id = ?))', array($application_id));
         } elseif ($module_id) {
             $q = $q->addWhere('t.id IN (SELECT ttg.theme_id from ThemeThemeGroup ttg where ttg.theme_group_id IN ' . '(SELECT mg.theme_group_id FROM MaduleThemeGroup mg where mg.madule_id = ?))', array($module_id));
         } elseif ($theme_group_id) {
             $q = $q->innerJoin('t.ThemeThemeGroups ttg')->addWhere('ttg.theme_group_id = ?', array($theme_group_id));
         }
         if ($user_id) {
             $q = $q->addWhere('user_id = ?', array($user_id));
         }
         $q = $q->addWhere('approved = ?', array(true));
         $q = $q->orderby('updated_at desc');
         if ($limit) {
             $q->limit($limit);
         }
         if ($offset) {
             $q->offset($offset);
         }
         $themes = $q->execute();
         if (!$rss) {
             $output .= '<themes count="' . $themes->count() . '">';
         }
         foreach ($themes as $theme) {
             $output .= $theme->getXML($rss);
         }
         if (!$rss) {
             $output .= '</themes>';
         }
     } elseif ($object == 'theme_group') {
         $title .= ' - Theme Groups';
         $theme_id = $this->getRequestParameter('theme_id');
         $q = new Doctrine_Query();
         $q = $q->select('t.*')->from('ThemeGroup t');
         if ($theme_id) {
             $q = $q->innerJoin('t.ThemeThemeGroups ttg')->addWhere('ttg.theme_id = ? and t.known = ?', array($theme_id, true));
         }
         $q = $q->orderby('updated_at desc');
         if ($limit) {
             $q->limit($limit);
         }
         if ($offset) {
             $q->offset($offset);
         }
         $themeGroups = $q->execute();
         if (!$rss) {
             $output .= '<theme_groups count="' . $themeGroups->count() . '">';
         }
         foreach ($themeGroups as $themeGroup) {
             $output .= $themeGroup->getXML($rss);
         }
         if (!$rss) {
             $output .= '</theme_groups>';
         }
     } elseif ($object == 'user') {
         $title .= ' - Users';
         $q = new Doctrine_Query();
         $q = $q->select('u.*')->from('User u')->orderby('updated_at desc');
         if ($limit) {
             $q->limit($limit);
         }
         if ($offset) {
             $q->offset($offset);
         }
         $users = $q->execute();
         if (!$rss) {
             $output .= '<users count="' . $users->count() . '">';
         }
         foreach ($users as $user) {
             $output .= $user->getXML($rss);
         }
         if (!$rss) {
             $output .= '</users>';
         }
     }
     if ($rss) {
         $this->output = '<rss version="2.0">' . '<channel>' . '<title>' . $title . '</title>' . '<link>' . $link . '</link>' . '<description>' . $description . '</description>' . '<generator>' . $title . '</generator>' . $output . '</channel>' . '</rss>';
     } else {
         $this->output = '<rsp stat="ok">' . $output . '</rsp>';
     }
     $this->setTemplate('index');
 }
<h2>Themes for <?php 
    echo $madule->getName();
    ?>
</h2>
<?php 
    include_component('theme', 'table', array('module_id' => $madule->getId()));
}
?>
<h2>Comments</h2>
<?php 
include_component('comment', 'table', array('module_id' => $madule->getId()));
?>
</div>
<?php 
if ($sf_user->hasCredential('admin')) {
    ?>
<h2>This Application is associated with</h2>
<?php 
    include_component('themeGroup', 'table', array('module_id' => $madule->getId()));
}
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="<?php 
echo $madule->getName();
?>
's Comments" href="<?php 
echo Tools::get('url') . '/rss/comment/module_id/' . $madule->getId();
?>
" />
<?php 
end_slot();
Example #16
0
			<ul>
				<?php 
include_component('home', 'navigation');
?>
			</ul>
		</td>
		<td class="content">
			<?php 
echo $sf_content;
?>
		</td>
	</tr>
</table>
<div class="footer">
<?php 
echo Tools::get('copyright');
?>
 | <a href="/home/about">About</a>
</div>


<script type="text/javascript">
/* <![CDATA[ */
window.addEvent('load', function() {

	/**
	 * Default options for that one, except the origin. Getting the coordinates for the
	 * <img> element inside allows a correct positioning for the remooz clone-box.
	 * (Mainly becaue the <a> element is not exactly wrapped around the image)
	 */
<?php

slot('title');
?>
Theme Groups<?php 
if ($theme) {
    ?>
 for <?php 
    echo $theme->getName();
}
end_slot();
?>
<h1>Theme Groups<?php 
if ($theme) {
    ?>
 for <?php 
    echo $theme->getName();
}
?>
</h1>
<?php 
include_component('themeGroup', 'table');
slot('rss');
?>
<link rel="alternate" type="application/rss+xml" title="ThemeGroups" href="<?php 
echo Tools::get('url') . '/rss/theme_group';
?>
" />
<?php 
end_slot();
 public function executeSitemap()
 {
     $urls = array();
     $home = array();
     $home['url'] = Tools::get('url');
     $home['priority'] = 1.0;
     $home['changefreq'] = 'daily';
     $urls[] = $home;
     $latest = 0;
     $q = new Doctrine_Query();
     $themes = $q->select('t.*')->from('Theme t')->addWhere('t.approved = ?', array(true))->orderby('t.updated_at desc')->limit(50)->execute();
     $q->free();
     $latest_theme = 0;
     $theme_home = array();
     $theme_home['url'] = Tools::get('url') . '/theme';
     $theme_home['priority'] = 1.0;
     $theme_home['changefreq'] = 'daily';
     $urls[] = $theme_home;
     $application_home = array();
     $application_home['url'] = Tools::get('url') . '/application';
     $application_home['priority'] = 1.0;
     $application_home['changefreq'] = 'daily';
     $urls[] = $application_home;
     $module_home = array();
     $module_home['url'] = Tools::get('url') . '/module';
     $module_home['priority'] = 1.0;
     $module_home['changefreq'] = 'daily';
     $urls[] = $module_home;
     $user_home = array();
     $user_home['url'] = Tools::get('url') . '/user';
     $user_home['priority'] = 1.0;
     $user_home['changefreq'] = 'daily';
     $urls[] = $user_home;
     foreach ($themes as $theme) {
         $url = array();
         $url['url'] = Tools::get('url') . '/theme/show/' . $theme->getId();
         $url['priority'] = 0.5;
         $url['changefreq'] = 'daily';
         $url['lastmod'] = $theme->getUpdatedAt();
         $urls[] = $url;
         $current = strtotime($theme->getUpdatedAt());
         if ($current > $latest_theme) {
             $latest_theme = $current;
         }
         if ($current > $latest) {
             $latest = $current;
         }
     }
     $themes->free();
     $urls[1]['lastmod'] = date('r', $latest_theme);
     $q = new Doctrine_Query();
     $applications = $q->select('a.*')->from('Application a')->addWhere('a.approved = ?', array(true))->orderby('a.updated_at desc')->limit(50)->execute();
     $q->free();
     $latest_application = 0;
     foreach ($applications as $application) {
         $url = array();
         $url['url'] = Tools::get('url') . '/application/show/' . $application->getId();
         $url['priority'] = 0.5;
         $url['changefreq'] = 'daily';
         $url['lastmod'] = $application->getUpdatedAt();
         $urls[] = $url;
         $current = strtotime($application->getUpdatedAt());
         if ($current > $latest_application) {
             $latest_application = $current;
         }
         if ($current > $latest) {
             $latest = $current;
         }
     }
     $applications->free();
     $urls[2]['lastmod'] = date('r', $latest_application);
     $q = new Doctrine_Query();
     $modules = $q->select('m.*')->from('Madule m')->addWhere('m.approved = ?', array(true))->orderby('m.updated_at desc')->limit(50)->execute();
     $q->free();
     $latest_module = 0;
     foreach ($modules as $module) {
         $url = array();
         $url['url'] = Tools::get('url') . '/module/show/' . $module->getId();
         $url['priority'] = 0.5;
         $url['changefreq'] = 'daily';
         $url['lastmod'] = $module->getUpdatedAt();
         $urls[] = $url;
         $current = strtotime($module->getUpdatedAt());
         if ($current > $latest_module) {
             $latest_module = $current;
         }
         if ($current > $latest) {
             $latest = $current;
         }
     }
     $modules->free();
     $urls[3]['lastmod'] = date('r', $latest_module);
     $q = new Doctrine_Query();
     $users = $q->select('u.*')->from('User u')->addWhere('u.active = ?', array(true))->orderby('u.updated_at desc')->limit(50)->execute();
     $q->free();
     $latest_user = 0;
     foreach ($users as $user) {
         $url = array();
         $url['url'] = Tools::get('url') . '/user/show/' . $user->getId();
         $url['priority'] = 0.5;
         $url['changefreq'] = 'daily';
         $url['lastmod'] = $user->getUpdatedAt();
         $urls[] = $url;
         $current = strtotime($user->getUpdatedAt());
         if ($current > $latest_user) {
             $latest_user = $current;
         }
     }
     $users->free();
     $urls[4]['lastmod'] = date('r', $latest_user);
     $urls[0]['lastmod'] = date('r', $latest);
     $this->urls = $urls;
 }