Code Search for Developers
 
 
  

groupoffice-cron.php from Group-Office groupware at Krugle


Show groupoffice-cron.php syntax highlighted

<?php
/**
 * Copyright Intermesh 2005
 *  Author: Merijn Schering <mschering@intermesh.nl>
 *  Version: 1.0 Release date: 29 June 2005
 *
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; either version 2 of the License, or (at your
 *  option) any later version.
 *
 * Run this script in a cronjob as root every minute.
 */ 
 

require_once('Group-Office.php');

load_basic_controls();

require($GO_CONFIG->class_path.'mail/RFC822.class.inc');
$RFC822 = new RFC822;

$email_module = $GO_MODULES->get_module('email');
$cal_module = $GO_MODULES->get_module('calendar');




$old = umask(0);
	
require_once($email_module['class_path'].'email.class.inc');
$email = new email();

require_once($cal_module['class_path'].'calendar.class.inc');
$cal = new calendar();
$cal2 = new calendar();

require_once ($GO_LANGUAGE->get_language_file('calendar'));


$GO_USERS->get_users();	
while($GO_USERS->next_record())
{
	if($email_module)
	{
		$username = trim($GO_USERS->f('username'));
		$pos = strrpos($username, '@');
		if ($pos) {
			$username = substr($username, 0, $pos);
		}
		
		if(!empty($username))
		{		
			$homedir = '/home/'.$username;
			
			$vacation_file = $homedir.'/.vacation.msg';
			$db_file = $homedir.'/.vacation.db';
			$forward_file = $homedir.'/.forward';
			
			$settings = $email->get_settings($GO_USERS->f('id'));
			if($settings && $settings['enable_vacation'])
			{
				$forward_file_contents = '\\'.$username.', "|/usr/bin/vacation '.$username.'"';	
				
				
				$middle_name = $GO_USERS->f('middle_name') != '' ? ' '.$GO_USERS->f('middle_name').' ' : ' ';			
				$name = $GO_USERS->f('first_name').$middle_name.$GO_USERS->f('last_name');
				
				$vacation_file_contents = 
					'From: '.$RFC822->write_address($name, $GO_USERS->f('email'))."\n".
					'Subject: '.$settings['vacation_subject']."\n\n".
					$settings['vacation_text'];
					
				if (!$fp = fopen($forward_file, 'w+')) {
	         go_log(LOG_INFO, "Cannot open file ($forward_file)");
	      }else
	      {
	      	if (fwrite($fp, $forward_file_contents) === false) {
		       echo "Cannot write to file ($forward_file)";
		       exit;
	   			}
	   			fclose($fp);
	      }
	      if (!$fp = fopen($vacation_file, 'w+')) {
	         go_log(LOG_INFO, "Cannot open file ($vacation_file)");
	      }else
	      {
	      	if (fwrite($fp, $vacation_file_contents) === false) {
		       echo "Cannot write to file ($vacation_file)";
		       exit;
	   			}
	   			fclose($fp);
	      }
	      
	      chown($vacation_file, $username);
	      chown($forward_file, $username);
	      
	      
	      chmod($vacation_file, 0640);
	      chmod($forward_file, 0640);
	      
			}else
			{
				if(file_exists($vacation_file)) unlink($vacation_file);
				if(file_exists($forward_file)) unlink($forward_file);
				if(file_exists($db_file)) unlink($db_file);
			}		
		}		
	}
	
	if($cal_module)
	{
		$cal_settings=$cal->get_settings($GO_USERS->f('id'));
		if($cal_settings['email_reminders']=='1')
		{		
			if($cal->get_events_to_remind($GO_USERS->f('id'), true,true,true))
			{
				while($cal->next_record())
				{
					$date_format = get_dateformat($GO_USERS->f('date_format'), $GO_USERS->f('date_seperator'));
					$start_time = date($date_format, $cal->f('start_time'));
					$subject = $sc_reminder.': '.$start_time.' '.$cal->f('name');
					
					$link = new hyperlink($GO_CONFIG->full_url.'index.php?return_to='.urlencode($cal_module['url'].'event.php?event_id='.urlencode($cal->f('id'))), $cal_event_mail_open);
					$link->set_attribute('target','_blank');
					$link->set_attribute('class','blue');
					$body = $link->get_html();
					
					sendmail($GO_USERS->f('email'), $GO_CONFIG->webmaster_email, $GO_CONFIG->title, $subject, $body, '3', 'text/HTML');
					
					if($event = $cal2->get_event($cal->f('id')))
					{
						$cal2->reminder_mail_sent($GO_USERS->f('id'), $event['id']);
					}
				}		
			}
		}
	}	
}
umask($old);




See more files for this project here

Group-Office groupware

Group-Office is a powerfull modular Internet/Intranet application framework. It features calendaring, project management, e-mail, tasks, addressbook, file management.

Project homepage: http://sourceforge.net/projects/group-office
Programming language(s): JavaScript,Pascal,PHP
License: other

  classes/
    base/
      controls/
        acl.class.inc
        activities_list.class.inc
        autocomplete.class.inc
        autocomplete_select.class.inc
        button.class.inc
        button_menu.class.inc
        checkbox.class.inc
        color_selector.class.inc
        csv.class.inc
        datagrid.class.inc
        datatable.class.inc
        date_picker.class.inc
        dbrecord.class.inc
        dropbox.class.inc
        dynamic_tabstrip.class.inc
        form.class.inc
        global_autocomplete.class.inc
        html_element.class.inc
        htmlarea.class.inc
        htmleditor.class.inc
        hyperlink.class.inc
        image.class.inc
        input.class.inc
        links_list.class.inc
        object_select.class.inc
        overlib.class.inc
        radio_list.class.inc
        radiogroup.class.inc
        select.class.inc
        select_link.class.inc
        select_users.class.inc
        statusbar.class.inc
        table.class.inc
        tabstrip.class.inc
        tabtable.class.inc
        testButton.php
        textarea.class.inc
        tooltip.class.inc
        treeview.class.inc
        user_autocomplete.class.inc
      base.auth.class.inc
      base.groups.class.inc
      base.security.class.inc
      base.users.class.inc
      config.class.inc
      controls.class.inc
      crypto.class.inc
      email.auth.class.inc
      language.class.inc
      ldap.auth.class.inc
      ldap.groups.class.inc
      ldap.security.class.inc
      ldap.users.class.inc
      links.class.inc
      modules.class.inc
      passwd.groups.class.inc
      passwd.security.class.inc
      passwd.users.class.inc
      search.class.inc
      sql.auth.class.inc
      sql.groups.class.inc
      sql.security.class.inc
      sql.users.class.inc
      theme.class.inc
      userlog.class.inc
    date/
      Date/
      tests/
      Date.php
      TODO
    dompdf/
      include/
      lib/
      www/
      ChangeLog
      HACKING
      INSTALL
      LICENSE.LGPL
      README
      TODO
      dompdf.php
      dompdf_config.inc.php
      load_font.php
    fpdf/
      font/
      faq.css
      faq.htm
      fpdf.class.inc
      xfpdf.class.inc
    mail/
      phpmailer/
      RFC822.class.inc
      imap.class.inc
      mimeDecode.class.inc
    xml/
      wbxml.class.inc
      xml.class.inc
      xpath.class.inc
    admin.class.inc
    dav.class.inc
    filesystem.class.inc
    highlighter.class.inc
    html2text.class.inc
    htmlparser.class.inc
    profiles.class.inc
    sajax.class.inc
    validate.class.inc
  configuration/
    index.php
    look.inc
    notations.inc
    privacy.inc
    profile.inc
    security.inc
    statistics.inc
  controls/
    FCKeditor/
    JUpload/
    htmlarea/
    jscalendar/
    overlib/
    overlibmws/
    phpthumb/
    select/
    acl.php
    backend_treeview.php
    color_selector.php
    fixpng.inc
    global_search_xml.php
    group.php
    reminder.php
    table_config.php
    user.php
    userlog.php
  database/
    ldap.class.inc
    mysql.class.inc
    oci8.class.inc
    odbc.class.inc
    oracle.class.inc
    pgsql.class.inc
    usql.class.inc
  error_docs/
    401.inc
    401.php
    403.inc
    403.php
    404.php
  ext/
    adapter/
    resources/
    ext-all-debug.js
    ext-all.js
  install/
    Intermesh.gif
    gotest.php
    install.css
    install.inc
    install.php
    install.sh
    macAddr
    macAddr.c
    test.inc
    update.sh
    update_single.sh
    upgrade.php
  javascript/
    actb.js
    autocomplete.php
    common.js
    datatable.js
    multifile.js
    pngfix.js
    select_users.js
  language/
    about/
    account/
    common/
    filetypes/
    login/
    preferences/
    sync/
    holidays.inc
    languages.inc
    make_language_pack
  lib/
    dav/
    icons/
    ldap/
    scripts/
    sql/
    favicon.ico
    intermesh.gif
    mime.types
    updates.inc
  login_screens/
    Default/
  modules/
    addressbook/
    bookmarks/
    calendar/
    chat/
    cms/
    comics/
    csvimport/
    email/
    example/
    filesystem/
    forum/
    gallery/
    groups/
    modules/
  phpUnit/
  themes/
  yui/
  CHANGELOG
  DEVELOPERS
  FAQ
  Group-Office.php
  LICENSE.GPL
  README
  README.ldap
  RELEASE
  TODO
  TRANSLATORS
  about.php
  adodb-time.inc.php
  auth_sources.dist
  checker.php
  fullscreen.php
  functions.inc
  functions_compat.inc
  groupoffice-cron.php
  groupofficeperson.schema
  index.php
  link.php
  links.js
  lost_password.php
  phpdoc.ini
  register.php
  search.php