Beispiel #1
0
echo gu_config::get('theme_name');
?>
/favicon.png" />
<!--[if IE]>
	<link rel="shortcut icon" type="image/x-icon" href="themes/<?php 
echo gu_config::get('theme_name');
?>
/favicon.ico" /> 
<![endif]--> 
<title><?php 
echo GUTUMA_TITLE;
?>
</title>
</head>

<body>
	<?php 
if (gu_is_demo()) {
    ?>
<div id="demobanner">DEMO MODE</div><?php 
}
?>
	<div id="page">
		<div id="header">
			<div id="headertitle"><h1><?php 
echo t('Gutuma');
?>
</h1></div>
			
		
Beispiel #2
0
 /**
  * Sends a message using the Swift mailer
  * @param Swift_Message $message The Swift message object
  * @param Swift_RecipientList $recipients The recipient list
  * @return int The number of messages sent successfully, else FALSE
  */
 private function send(Swift_Message $message, Swift_RecipientList $recipients)
 {
     if (gu_is_demo()) {
         return gu_error(t('Unable to send message in demo mode'));
     }
     try {
         $num_sent = $this->swift->send($message, $recipients, $this->from_address);
     } catch (Swift_ConnectionException $e) {
         gu_debug($e->getMessage());
         return gu_error(t('Unable to send message due to connection error'));
     }
     if (gu_is_debugging()) {
         $log =& Swift_LogContainer::getLog();
         gu_debug('gu_mailer::send(...)<br />' . nl2br(htmlspecialchars($log->dump(true))) . ' => ' . $num_sent);
         $log->clear();
     }
     return $num_sent;
 }
Beispiel #3
0
 /**
  * Creates a new address list
  * @param string $name The list name
  * @param bool $private TRUE if the list should be private (default is FALSE)  
  * @param array $addresses
  * @return mixed The new list if it was successfully created, else FALSE
  */
 public static function create($name, $private = FALSE, $addresses = NULL)
 {
     if ($name == '' || preg_match('[^a-zA-Z0-9 \\-]', $name)) {
         return gu_error(t("Invalid list name. Names must only contain alphanumeric characters, spaces and dashes"));
     }
     // Demo mode check for number of addresses
     if (isset($addresses) && gu_is_demo() && count($addresses) >= GUTUMA_DEMO_MAX_LIST_SIZE) {
         return gu_error(t('Lists can have a maximum of % addresses in demo mode', array(GUTUMA_DEMO_MAX_LIST_SIZE)));
     }
     // Check for duplicate name
     $all_lists = gu_list::get_all();
     foreach ($all_lists as $l) {
         if (strcasecmp($l->name, $name) == 0) {
             return gu_error(t('A list with the name <b><i>%</i></b> already exists', array($name)));
         }
     }
     // Demo mode check for number of lists
     if (gu_is_demo() && count($all_lists) >= GUTUMA_DEMO_MAX_NUM_LISTS) {
         return gu_error(t("You can have a maximum of % lists in demo mode", array(GUTUMA_DEMO_MAX_NUM_LISTS)));
     }
     $list = new gu_list();
     $list->id = time();
     $list->name = $name;
     $list->private = $private;
     $list->addresses = isset($addresses) ? $addresses : array();
     // Save the list
     if (!$list->update()) {
         return FALSE;
     }
     return $list;
 }
Beispiel #4
0
 /**
  * Saves the current settings values by writing them to the config.php file
  * @return bool TRUE if operation was successful, else FALSE
  */
 public static function save()
 {
     if (gu_is_demo()) {
         return gu_error(t('Settings cannot be changed in demo mode'));
     }
     // Data checks
     if (preg_match('[^A-Za-z0-9]', self::$values['admin_username'])) {
         return gu_error(t('Username can only contain alphanumeric characters'));
     }
     if (strlen(self::$values['admin_password']) < GUTUMA_PASSWORD_MIN_LEN) {
         return gu_error(t('Password must be at least % characters long', array(GUTUMA_PASSWORD_MIN_LEN)));
     }
     if (!check_email(self::$values['admin_email'])) {
         return gu_error(t('A valid administrator email must be at provided'));
     }
     if (!is_dir(RPATH . 'themes/' . self::$values['theme_name'])) {
         return gu_error(t("Theme <em>%</em> doesn't exists. You need to create it first !", array(self::$values['theme_name'])));
     }
     $lh = @fopen(GUTUMA_CONFIG_FILE, 'w');
     if ($lh == FALSE) {
         return gu_error(t("Unable to create/open % file for writing", array(GUTUMA_CONFIG_FILE)));
     }
     fwrite($lh, "\$gu_config_version = " . GUTUMA_VERSION_NUM . ";\n");
     foreach (array_keys(self::$values) as $key) {
         if (is_bool(self::$values[$key])) {
             fwrite($lh, "\$gu_config['" . $key . "'] = " . (self::$values[$key] ? 'TRUE' : 'FALSE') . ";\n");
         } elseif (is_numeric(self::$values[$key])) {
             fwrite($lh, "\$gu_config['" . $key . "'] = " . self::$values[$key] . ";\n");
         } else {
             fwrite($lh, "\$gu_config['" . $key . "'] = '" . str_replace(array('\\"', "'"), array('"', "\\'"), self::$values[$key]) . "';\n");
         }
     }
     fclose($lh);
     $f = file_get_contents(GUTUMA_CONFIG_FILE);
     // Version encodée (voir ligne 185)
     file_put_contents(GUTUMA_CONFIG_FILE, "<?php /*\n" . base64_encode($f) . "\n*/  ?>");
     // Version décodée (voir ligne 187)
     /* file_put_contents(GUTUMA_CONFIG_FILE,"<?php \n".$f."\n?>");*/
     return TRUE;
 }
Beispiel #5
0
 /**
  * Saves this newsletter
  * @return bool TRUE if operation was successful, else FALSE
  */
 public function save()
 {
     if (gu_is_demo()) {
         return gu_error(t('Newsletters cannot be saved or sent in demo mode'));
     }
     // Create newsletter's temp directory if it doesn't already exist
     $dir = $this->get_dir();
     if (!file_exists($dir)) {
         mkdir($dir);
         mkdir($dir . '/attachments');
     }
     // Save message file
     $fh = @fopen($dir . '/' . MESSAGE_FILE, 'w');
     if ($fh == FALSE) {
         return gu_error(t('Unable to save newsletter draft'), ERROR_EXTRA);
     }
     fwrite($fh, FILE_MARKER);
     fwrite($fh, $this->recipients . "\n");
     fwrite($fh, $this->subject . "\n");
     fwrite($fh, $this->html . "\n");
     fwrite($fh, FILE_MARKER);
     fwrite($fh, $this->text . "\n");
     fclose($fh);
     // Create lock file
     file_put_contents($dir . '/' . LOCK_FILE, FILE_MARKER);
     return TRUE;
 }