Location: PHPKode > scripts > AfterLogic WebMail Lite PHP > afterlogic-webmail-lite-php/webmail/common/class_exim.php
<?php

/*
 * AfterLogic WebMail Pro PHP by AfterLogic Corp. <hide@address.com>
 *
 * Copyright (C) 2002-2010  AfterLogic Corp. (www.afterlogic.com)
 * Distributed under the terms of the license described in COPYING
 *
 */

	defined('WM_ROOTPATH') || define('WM_ROOTPATH', (dirname(__FILE__).'/../'));

	require_once(WM_ROOTPATH.'common/class_log.php');

class CExim
{
	/**
	 * @param	string	$login
	 * @param	string	$domain
	 * @param	int		$quota
	 * @return	bool
	 */
	static public function CreateUserShell($login, $domain, $quota)
	{
		$loginArr = explode('@', $login, 2);
		$cmd = trim('/usr/mailsuite/scripts/maildirmake.sh '.$domain.' '.$login.' '.$quota);
		self::ExecCmd($cmd, __FUNCTION__);
		return true;
	}

	/**
	 * @param	string	$login
	 * @param	string	$domain
	 * @return	bool
	 */
	static public function DeleteUserShell($login, $domain)
	{
		$loginArr = explode('@', $login, 2);
		$cmd = trim('/usr/mailsuite/scripts/maildirdel.sh '.$domain.' '.$loginArr[0]);
		self::ExecCmd($cmd, __FUNCTION__);
		return true;
	}

	/**
	 * @param	string	$login
	 * @param	string	$domain
	 * @return	bool
	 */
	static public function DisableAutoresponder($login, $domain)
	{
		$loginArr = explode('@', $login, 2);
		$cmd = trim('/usr/mailsuite/scripts/autoresponder.sh '.$domain.' '.$loginArr[0].' 0');
		self::ExecCmd($cmd, __FUNCTION__);
		return true;
	}

	/**
	 * @param	string	$login
	 * @param	string	$domain
	 * @return	bool
	 */
	static public function EnableAutoresponder($login, $domain)
	{
		$loginArr = explode('@', $login, 2);
		$cmd = trim('/usr/mailsuite/scripts/autoresponder.sh '.$domain.' '.$loginArr[0].' 1');
		self::ExecCmd($cmd, __FUNCTION__);
		return true;
	}

	static private function ExecCmd($cmd, $functionName)
	{
		$log =& CLog::CreateInstance();
		$log->WriteLine('Exim: '.$functionName.' / exec(\''.$cmd.'\');');

		$output = array();
		@exec($cmd, $output);
		if (is_array($output) && count($output) > 0)
		{
			$log->WriteLine('Exim: '.$functionName.' / $output = '.print_r($output, true));
		}
	}
}
Return current item: AfterLogic WebMail Lite PHP