Пример #1
0
 /**
  *  check for pending notification and send corresponding emails (trigger by cronjob) 
  * @return void 
  */
 public static function do_notification_queue()
 {
     $l = new OC_L10N('mailnotify');
     $nm_upload = self::db_get_nm_upload();
     $shares = self::db_get_share();
     $mailTo = array();
     $filesList = array();
     $fileInfo = array();
     //list all unique nm_upload path. add most recent timestamp and list editors.
     foreach ($nm_upload as $upload) {
         $filesList[$upload['path']] = array();
         if (!isset($filesList[$upload['path']]['timestamp']) || $filesList[$upload['path']]['timestamp'] < $upload['timestamp']) {
             $filesList[$upload['path']]['timestamp'] = $upload['timestamp'];
         }
     }
     // find who want wich notifications
     foreach ($filesList as $filePath => $Mod_timestamp) {
         foreach ($shares as $sharesKey => $row) {
             if (self::is_under($row["file_source"], $filePath)) {
                 if (!self::is_uid_exclude('/Shared' . $row['file_target'], $row['share_with'])) {
                     $mailTo[$row['share_with']][] = $sharesKey;
                 } elseif (!self::is_uid_exclude($row['file_target'], $row['uid_owner'])) {
                     $mailTo[$row['uid_owner']][] = $sharesKey;
                 }
                 if (self::db_isgroup($row['share_with'])) {
                     foreach (self::db_get_usersOfGroup($row['share_with']) as $key => $user) {
                         if (!self::is_uid_exclude('/Shared' . $row['file_target'], $row['share_with'])) {
                             //if shared with user
                             $mailTo[$user][] = $sharesKey;
                         }
                     }
                 }
             }
         }
     }
     //var_dump($mailTo);
     //assamble emails
     if (!empty($mailTo)) {
         foreach ($mailTo as $uid => $files) {
             $msg = '<ul> Following files have been modified. <br><br>';
             foreach ($files as $rowId) {
                 $url_path = self::db_get_filecash_path($shares[$rowId]['item_source']);
                 $url_name = substr($shares[$rowId]['file_target'], 1);
                 $msg .= '<li><a href="' . OCP\Util::linkTo('index.php/apps/files?dir=//Shared', '') . '" target="_blank">' . $url_name . '</a></li>';
                 //FIXME static redirection :(
                 OC_MailNotify_Mailing::db_remove_all_nmuploads_for($shares[$rowId]['file_source']);
             }
             OC_MailNotify_Mailing::sendEmail($msg, $l->t('New upload'), $uid);
         }
     }
 }
Пример #2
0
<?php

$cloud_root = dirname(dirname(dirname(dirname(__FILE__))));
include_once $cloud_root . '/lib/base.php';
include 'mailing.php';
OC_MailNotify_Mailing::do_notification_queue();
//
//TODO owncloud's cron jobs methode
/*
static OC_BackgroundJob_QueuedTask::add	(	 	$app,
	$klass,
	$method,
	$parameters 
)		
static
queues a task

Parameters
$app	app name
$klass	class name
$method	method name
$parameters	all useful data as text
Returns
id of task
* 
* 
*/
?>
Done.
Пример #3
0
 /**
 *  Notify a new internal_message.
 		//array('fromUid' => $msgfrom,'toUid' => $user,'msgContent' => $msgcontent, 'msgFlag' => $msgflag);	
 */
 public static function notify_IntMsg($params)
 {
     OC_MailNotify_Mailing::email_IntMsg($params['fromUid'], $params['toUid'], $params['msgContent']);
     return true;
 }
Пример #4
0
<?php

OCP\JSON::callCheck();
$action = '';
$action_gid = '';
if (isset($_POST['action']) && isset($_POST['action_gid'])) {
    $action = $_POST['action'];
    $action_gid = $_POST['action_gid'];
    if ($action == 'get_status' and $action_gid != '') {
        echo OC_MailNotify_Mailing::db_user_setting_get_status(OCP\User::getUser(), $action_gid);
        exit;
    }
    if ($action == 'do_enable' and $action_gid != '') {
        echo OC_MailNotify_Mailing::db_remove_user_setting(OCP\User::getUser(), $action_gid);
        exit;
    }
    if ($action == 'do_disable' and $action_gid != '') {
        echo OC_MailNotify_Mailing::db_user_setting_disable(OCP\User::getUser(), $action_gid);
        exit;
    }
}
echo '0';
exit;