public function initcronjobs()
 {
     global $init;
     require_once PATH_CORE . '/classes/cron.class.php';
     $cObj = new cron($init['apiKey']);
     $cObj->initJobs();
     set_flash(array('notice' => "Finished initializing cron jobs."));
     redirect(url_for($this->name, 'cronjobs'));
 }
 public function syncallocations()
 {
     global $init;
     require_once PATH_CORE . '/classes/cron.class.php';
     $cObj = new cron($init['apiKey']);
     $cObj->forceJob('facebookAllocations');
     echo 'Completed';
     set_flash(array('notice' => "Finished synching allocations"));
     redirect(url_for($this->name, 'index'));
 }
示例#3
0
 public static function downloadUrl($url, $path, $name)
 {
     if (empty($url)) {
         throw new Exception('[ERROR] Class cron, function downloadUrl, $url is empty !');
     }
     if (empty($path)) {
         throw new Exception('[ERROR] Class cron, function downloadUrl, $path is empty !');
     }
     cron::message(sprintf("Class cron, function downloadUrl, de volgende url word aangeroepen: %s, naar %s/%s !", $url, $path, $name));
     if (!($fp = fopen($path . '/' . $name, 'w+'))) {
         //This is the file where we save the information
         cron::message(sprintf("Class cron, function downloadUrl, fopen error !"), 'error');
         fclose($fp);
         return false;
     }
     $ch = curl_init(str_replace(' ', '%20', $url));
     //Here is the file we are downloading, replace spaces with %20
     curl_setopt($ch, CURLOPT_TIMEOUT, 50);
     curl_setopt($ch, CURLOPT_FILE, $fp);
     // write curl response to file
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     if (false === curl_exec($ch)) {
         cron::message(sprintf("Class cron, function downloadUrl, curl_exec error: %s", curl_error($ch)), 'error');
         // Close handle
         curl_close($ch);
         fclose($fp);
         return false;
     }
     // Close handle
     curl_close($ch);
     fclose($fp);
     return true;
 }
示例#4
0
function ewattch_remove()
{
    $cron = cron::byClassAndFunction('ewattch', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
}
示例#5
0
function tesla_remove()
{
    $cron = cron::byClassAndFunction('tesla', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
}
示例#6
0
 function run()
 {
     //called by outside cron NOT autocron
     Cron::MailFetcher();
     Cron::TicketMonitor();
     cron::PurgeLogs();
 }
示例#7
0
function xpl_remove()
{
    $cron = cron::byClassAndFunction('xpl', 'deamon');
    if (is_object($cron)) {
        $cron->remove();
    }
}
function callback_inactive()
{
    global $m;
    $m->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "pch18_relist`");
    $m->query("DELETE FROM `" . DB_NAME . "`.`" . DB_PREFIX . "options` WHERE `name`= 'relist'");
    cron::del('pch18_relist');
}
 public static function health()
 {
     $return = array();
     $demon_state = self::deamonRunning();
     $return[] = array('test' => __('Démon local', __FILE__), 'result' => $demon_state ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $demon_state ? '' : __('Peut être normal si vous êtes en déporté', __FILE__), 'state' => $demon_state);
     $version = openzwave::getVersion('openzwave');
     $return[] = array('test' => __('Version d\'openzwave', __FILE__), 'result' => $version, 'advice' => $demon_state ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => version_compare(config::byKey('openzwave_version', 'openzwave'), $version, '<='));
     $compilation = openzwave::compilationOk();
     $return[] = array('test' => __('Compilation', __FILE__), 'result' => $compilation ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $compilation ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => $compilation);
     if (config::byKey('jeeNetwork::mode') == 'master') {
         $cron = cron::byClassAndFunction('openzwave', 'pull');
         $running = false;
         if (is_object($cron)) {
             $running = $cron->running();
         }
         $return[] = array('test' => __('Tâche Z-Wave', __FILE__), 'result' => $running ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $running ? '' : __('Allez sur la page du moteur des tâches et vérifiez lancer la tache openzwave::pull', __FILE__), 'state' => $running);
         foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
             try {
                 $demon_state = $jeeNetwork->sendRawRequest('deamonRunning', array('plugin' => 'openzwave'));
             } catch (Exception $e) {
                 $demon_state = false;
             }
             $return[] = array('test' => __('Démon sur ', __FILE__) . $jeeNetwork->getName(), 'result' => $demon_state ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => '', 'state' => $demon_state);
             $version = $jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave'));
             $return[] = array('test' => __('Version d\'openzwave sur ', __FILE__) . $jeeNetwork->getName(), 'result' => $version, 'advice' => $demon_state ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => version_compare(config::byKey('openzwave_version', 'openzwave'), $version, '<='));
             $compilation = $jeeNetwork->sendRawRequest('compilationOk', array('plugin' => 'openzwave'));
             $return[] = array('test' => __('Compilation sur', __FILE__) . $jeeNetwork->getName(), 'result' => $compilation ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $compilation ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => $compilation);
         }
     }
     return $return;
 }
示例#10
0
function weather_update()
{
    $crons = cron::searchClassAndFunction('weather', 'updateWeatherData');
    foreach ($crons as $cron) {
        $cron->remove();
    }
}
示例#11
0
function domogeek_remove()
{
    $cron = cron::byClassAndFunction('domogeek', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
}
示例#12
0
function remove()
{
    $cron = cron::byClassAndFunction('zwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
}
示例#13
0
function sonos3_remove()
{
    $cron = cron::byClassAndFunction('sonos3', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
}
示例#14
0
function remove()
{
    $cron = cron::byId(config::byKey('xPLDeamonCronId', 'xPL'));
    if (is_object($cron)) {
        $cron->remove();
    }
    config::remove('xPLDeamonCronId', 'xPL');
}
function callback_init()
{
    option::add('wmzz_mailer_title');
    option::add('wmzz_mailer_text');
    option::set('wmzz_mailer_limit', '5');
    option::set('wmzz_mailer_last', '0');
    cron::set('wmzz_mailer', 'plugins/wmzz_mailer/wmzz_mailer_cron.php', 0, 0, 0);
}
function callback_remove()
{
    cron::del('reg_supervise');
    option::xdel('reg_supervise');
    global $m;
    $m->query('DROP TABLE `' . DB_NAME . '`.`' . DB_PREFIX . 'reg`');
    option::del('reg_supervise_run');
}
示例#17
0
    function run_all()
    {
        # ensure that tasks complete and dont hang on
        # running=1
        set_time_limit(2 * 60 * 60);
        # Loop through the tasks:
        global $VAR;
        $db =& DB();
        $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'task WHERE
					site_id     = ' . $db->qstr(DEFAULT_SITE) . ' AND
					( running = 0 OR running IS NULL )';
        $result = $db->Execute($sql);
        if ($result->RecordCount() > 0) {
            include_once PATH_INCLUDES . 'cron/cron.inc.php';
            $cron = new cron();
            while (!$result->EOF) {
                $_r = false;
                $_s = (int) $result->fields['date_start'];
                $_e = (int) $result->fields['date_expire'];
                $_l = (int) $result->fields['date_last'];
                $_c = $result->fields['int_min'] . " ";
                $_c .= $result->fields['int_hour'] . " ";
                $_c .= $result->fields['int_month_day'] . " ";
                $_c .= $result->fields['int_month'] . " ";
                $_c .= $result->fields['int_week_day'];
                $_n = (int) time();
                if (!$_l > 0) {
                    $_l = $_n - 86400 * 365;
                }
                # Verify it has not expired:
                if ($_s <= $_n || $_s == "" || $_s == "0") {
                    # Verify it is past the start date:
                    if ($_e >= $_n || $_e == "" || $_e == "0") {
                        # Verify that it is time to run:
                        if ($cron->due($_l, $_n, $_c)) {
                            # Run the task:
                            $this->id = $result->fields['id'];
                            $this->run($VAR, $this);
                        }
                    }
                }
                $result->MoveNext();
            }
        }
    }
示例#18
0
function openzwave_remove()
{
    if (openzwave::deamonRunning()) {
        openzwave::stopDeamon();
    }
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
}
示例#19
0
function mySensors_remove()
{
    $cron = cron::byClassAndFunction('mySensors', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    if (method_exists('mySensors', 'stopDeamon')) {
        mySensors::stopDeamon();
    }
}
示例#20
0
 public static function health()
 {
     $return = array();
     $cron = cron::byClassAndFunction('ewattch', 'pull');
     $running = false;
     if (is_object($cron)) {
         $running = $cron->running();
     }
     $return[] = array('test' => __('Tâche de synchronisation', __FILE__), 'result' => $running ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $running ? '' : __('Allez sur la page du moteur des tâches et vérifiez lancer la tache ewattch::pull', __FILE__), 'state' => $running);
     return $return;
 }
示例#21
0
 /**
  * cron constructor
  */
 public function __construct()
 {
     // Mail center
     $date = JFactory::getDate();
     $today = time();
     $day = date('D', $today);
     $time = date('H:i', $today);
     if (DISCOUNT_MAIL_SEND) {
         cron::after_purchased_order_mail();
     }
     // Move Container to Stockroom start
     $fdate = date('Y-m-d', $today);
     $db = JFactory::getDbo();
     // Calculation for move Container once in day
     $query = "SELECT count(id) FROM #__" . TABLE_PREFIX . "_cron WHERE date = " . $db->quote($fdate);
     $db->setQuery($query);
     $data = $db->loadResult();
     if ($data != 1) {
         // Default $data != 1
         $q_update = "UPDATE #__" . TABLE_PREFIX . "_cron SET date = " . $db->quote($fdate) . " WHERE id = 1";
         $db->setQuery($q_update);
         $db->query();
         if (SEND_CATALOG_REMINDER_MAIL) {
             cron::catalog_mail();
         }
         cron::color_mail();
         // Send subscription renewal mail.
         cron::subscription_renewal_mail();
         // End mail center
         if (USE_CONTAINER) {
             $query = "SELECT * FROM #__" . TABLE_PREFIX . "_container";
             $db->setQuery($query);
             $data = $db->loadObjectList();
             foreach ($data as $cont_data) {
                 $date_diff = $today - $cont_data->creation_date;
                 $diff_day = $date_diff / (60 * 60 * 24);
                 // Calculation of Days For moving
                 $remain_day = $cont_data->max_del_time * 7 - floor($diff_day);
                 if ($remain_day >= 0 && $remain_day <= 7) {
                     $container_id = $cont_data->container_id;
                     $stockroom_id = $cont_data->stockroom_id;
                     // Move Container into stockroom
                     $move = cron::move($container_id, $stockroom_id);
                     if ($move) {
                         // Call Order Status Change
                         cron::order_status($container_id);
                     }
                 }
             }
         }
     }
 }
示例#22
0
function gCalendar_remove()
{
    $cron = cron::byClassAndFunction('gCalendar', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    // supprimer les fichiers cache et le répertoire //
    array_map('unlink', glob(GCALENDAR_CACHE_PATH . "gCalendar_*.tmp.xml"));
    if (rmdir(GCALENDAR_CACHE_PATH) === true) {
        log::add('gCalendar', 'info', 'gCalendar_remove(): Le répertoire (' . GCALENDAR_CACHE_PATH . ') et ses fichiers ont correctement été supprimés.');
    } else {
        log::add('gCalendar', 'error', 'gCalendar_remove(): Impossible de supprimer le répertoire: ' . GCALENDAR_CACHE_PATH);
    }
}
示例#23
0
function arduidom_remove()
{
    $cron = cron::byClassAndFunction('arduidom', 'checkdaemon');
    if (is_object($cron)) {
        $cron->remove();
    }
    arduidom::stopdaemon(1);
    arduidom::stopdaemon(2);
    arduidom::stopdaemon(3);
    arduidom::stopdaemon(4);
    arduidom::stopdaemon(5);
    arduidom::stopdaemon(6);
    arduidom::stopdaemon(7);
    arduidom::stopdaemon(8);
}
示例#24
0
function ecodevice_remove()
{
    $cron = cron::byClassAndFunction('ecodevice', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    $cron = cron::byClassAndFunction('ecodevice', 'cron');
    if (is_object($cron)) {
        $cron->remove();
    }
    foreach (eqLogic::byType('ecodevice_compteur') as $SubeqLogic) {
        $SubeqLogic->remove();
    }
    foreach (eqLogic::byType('ecodevice_teleinfo') as $SubeqLogic) {
        $SubeqLogic->remove();
    }
    foreach (eqLogic::byType('ecodevice') as $eqLogic) {
        $eqLogic->remove();
    }
}
示例#25
0
function openzwave_update()
{
    if (!file_exists(dirname(__FILE__) . '/../data')) {
        mkdir(dirname(__FILE__) . '/../data');
        if (file_exists('/opt/python-openzwave/xml_backups')) {
            shell_exec('cp -R /opt/python-openzwave/xml_backups ' . dirname(__FILE__) . '/../data');
            shell_exec('cp -R /opt/python-openzwave/zwcfg_*.xml ' . dirname(__FILE__) . '/../data');
            shell_exec('rm -rf /opt/python-openzwave/xml_backups');
            shell_exec('rm -rf /opt/python-openzwave/zwcfg_*.xml');
        }
    }
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    openzwave::syncconfOpenzwave();
}
示例#26
0
function cron_wmzz_mailer()
{
    global $m;
    $check = option::get('wmzz_mailer_check');
    if ($check == '1') {
        $text = option::get('wmzz_mailer_text');
        $title = option::get('wmzz_mailer_title');
        $limit = option::get('wmzz_mailer_limit');
        $last = option::get('wmzz_mailer_last');
        $done = 0;
        $z = $m->query("SELECT * FROM  `" . DB_NAME . "`.`" . DB_PREFIX . "users` LIMIT {$last},{$limit}");
        while ($v = $m->fetch_array($z)) {
            $done++;
            misc::mail($v['email'], $title, $text);
        }
        if ($done - $limit <= -1) {
            option::set('wmzz_mailer_check', '0');
            option::set('wmzz_mailer_last', '0');
            cron::set('wmzz_mailer', 'plugins/wmzz_mailer/wmzz_mailer_cron.php', 1);
            return '所有邮件群发任务于 ' . date('Y-m-d H:m:s') . ' 完成';
        }
        option::set('wmzz_mailer_last', $done + $last);
    }
}
示例#27
0
 public function run()
 {
     global $db;
     $today = date('Y-m-d');
     $cron = new cron();
     $data = $cron->select_crons_to_run();
     $return['cron_message'] = "Cron started";
     $number_of_crons_run = "0";
     $cron_log = new cronlog();
     $cron_log->run_date = $today;
     foreach ($data as $key => $value) {
         $cron->domain_id = $value['domain_id'];
         $cron_log->cron_id = $value['id'];
         $cron_log->domain_id = $domain_id = $value['domain_id'];
         $check_cron_log = $cron_log->check();
         $i = "0";
         if ($check_cron_log == 0) {
             //only proceed if cron has not been run for today
             $run_cron = false;
             $start_date = date('Y-m-d', strtotime($value['start_date']));
             $end_date = $value['end_date'];
             // Seconds in a day = 60 * 60 * 24 = 86400
             $diff = number_format((strtotime($today) - strtotime($start_date)) / 86400, 0);
             //only check if diff is positive
             if ($diff >= 0 and ($end_date == "" or $end_date >= $today)) {
                 if ($value['recurrence_type'] == 'day') {
                     $modulus = $diff % $value['recurrence'];
                     if ($modulus == 0) {
                         $run_cron = true;
                     } else {
                         #$return .= "cron does not runs TODAY-days";
                     }
                 }
                 if ($value['recurrence_type'] == 'week') {
                     $period = 7 * $value['recurrence'];
                     $modulus = $diff % $period;
                     if ($modulus == 0) {
                         $run_cron = true;
                     } else {
                         #$return .= "cron is not runs TODAY-week";
                     }
                 }
                 if ($value['recurrence_type'] == 'month') {
                     $start_day = date('d', strtotime($value['start_date']));
                     $start_month = date('m', strtotime($value['start_date']));
                     $start_year = date('Y', strtotime($value['start_date']));
                     $today_day = date('d');
                     $today_month = date('m');
                     $today_year = date('Y');
                     $months = $today_month - $start_month + 12 * ($today_year - $start_year);
                     $modulus = $months % $value['recurrence'];
                     if ($modulus == 0 and $start_day == $today_day) {
                         $run_cron = true;
                     } else {
                         #$return .= "cron is not runs TODAY-month";
                     }
                 }
                 if ($value['recurrence_type'] == 'year') {
                     $start_day = date('d', strtotime($value['start_date']));
                     $start_month = date('m', strtotime($value['start_date']));
                     $start_year = date('Y', strtotime($value['start_date']));
                     $today_day = date('d');
                     $today_month = date('m');
                     $today_year = date('Y');
                     $years = $today_year - $start_year;
                     $modulus = $years % $value['recurrence'];
                     if ($modulus == 0 and $start_day == $today_day and $start_month == $today_month) {
                         $run_cron = true;
                     } else {
                         #$return .= "cron is not runs TODAY-year";
                     }
                 }
                 //run the recurrence for this invoice
                 if ($run_cron) {
                     $number_of_crons_run++;
                     $return['cron_message_' . $value['cron_id']] = "Cron ID: " . $value['cron_id'] . " - Cron for " . $value['index_name'] . " with start date of " . $value['start_date'] . ", end date of " . $value['end_date'] . " where it runs each " . $value['recurrence'] . " " . $value['recurrence_type'] . " was run today :: Info diff=" . $diff;
                     $i++;
                     $ni = new invoice();
                     $ni->id = $value['invoice_id'];
                     $ni->domain_id = $domain_id;
                     // $domain_id gets propagated from invoice to be copied from
                     $new_invoice_id = $ni->recur();
                     //insert into cron_log date of run
                     //$cron_log = new cronlog();
                     //$cron_log->run_date = $today;
                     //$cron_log->domain_id = $domain_id;
                     //$cron_log->cron_id = $value['cron_id'];
                     $cron_log->insert();
                     ## email the people
                     $invoiceobj = new invoice();
                     $invoice = $invoiceobj->select($new_invoice_id, $domain_id);
                     $preference = getPreference($invoice['preference_id'], $domain_id);
                     $biller = getBiller($invoice['biller_id'], $domain_id);
                     $customer = getCustomer($invoice['customer_id'], $domain_id);
                     #print_r($customer);
                     #create PDF nameVj
                     $spc2us_pref = str_replace(" ", "_", $invoice['index_name']);
                     $pdf_file_name_invoice = $spc2us_pref . ".pdf";
                     // email invoice
                     if ($value['email_biller'] == "1" or $value['email_customer'] == "1") {
                         $export = new export();
                         $export->domain_id = $domain_id;
                         $export->format = "pdf";
                         $export->file_location = 'file';
                         $export->module = 'invoice';
                         $export->id = $invoice['id'];
                         $export->execute();
                         #$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
                         $email = new email();
                         $email->domain_id = $domain_id;
                         $email->format = 'cron_invoice';
                         $email_body = new email_body();
                         $email_body->email_type = 'cron_invoice';
                         $email_body->customer_name = $customer['name'];
                         $email_body->invoice_name = $invoice['index_name'];
                         $email_body->biller_name = $biller['name'];
                         $email->notes = $email_body->create();
                         $email->from = $biller['email'];
                         $email->from_friendly = $biller['name'];
                         $email->to = $this->getEmailSendAddresses($value, $customer['email'], $biller['email']);
                         $email->invoice_name = $invoice['index_name'];
                         $email->subject = $email->set_subject();
                         $email->attachment = $pdf_file_name_invoice;
                         $return['email_message'] = $email->send();
                     }
                     //Check that all details are OK before doing the eway payment
                     $eway_check = new eway();
                     $eway_check->domain_id = $domain_id;
                     $eway_check->invoice = $invoice;
                     $eway_check->customer = $customer;
                     $eway_check->biller = $biller;
                     $eway_check->preference = $preference;
                     $eway_pre_check = $eway_check->pre_check();
                     //do eway payment
                     if ($eway_pre_check == 'true') {
                         // input customerID,  method (REAL_TIME, REAL_TIME_CVN, GEO_IP_ANTI_FRAUD) and liveGateway or not
                         $eway = new eway();
                         $eway->domain_id = $domain_id;
                         $eway->invoice = $invoice;
                         $eway->biller = $biller;
                         $eway->customer = $customer;
                         $payment_done = $eway->payment();
                         $payment_id = $db->lastInsertID();
                         $pdf_file_name_receipt = 'payment' . $payment_id . '.pdf';
                         if ($payment_done == 'true') {
                             //do email of receipt to biller and customer
                             if ($value['email_biller'] == "1" or $value['email_customer'] == "1") {
                                 /*
                                  * If you want a new copy of the invoice being emailed to the customer 
                                  * use this code
                                  */
                                 $export_rec = new export();
                                 $export_rec->domain_id = $domain_id;
                                 $export_rec->format = "pdf";
                                 $export_rec->file_location = 'file';
                                 $export_rec->module = 'invoice';
                                 $export_rec->id = $invoice['id'];
                                 $export_rec->execute();
                                 #$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
                                 $email_rec = new email();
                                 $email_rec->domain_id = $domain_id;
                                 $email_rec->format = 'cron_invoice';
                                 $email_body_rec = new email_body();
                                 $email_body_rec->email_type = 'cron_invoice_receipt';
                                 $email_body_rec->customer_name = $customer['name'];
                                 $email_body_rec->invoice_name = $invoice['index_name'];
                                 $email_body_rec->biller_name = $biller['name'];
                                 $email_rec->notes = $email_body_rec->create();
                                 $email_rec->from = $biller['email'];
                                 $email_rec->from_friendly = $biller['name'];
                                 $email_rec->to = $this->getEmailSendAddresses($value, $customer['email'], $biller['email']);
                                 $email_rec->invoice_name = $invoice['index_name'];
                                 $email_rec->attachment = $pdf_file_name_invoice;
                                 $email_rec->subject = $email_rec->set_subject('invoice_eway_receipt');
                                 $return['email_message'] = $email_rec->send();
                                 /*
                                  * If you want a receipt as PDF being emailed to the customer
                                  * uncomment the code below
                                  */
                                 /*
                                 $export = new export();
                                 $export -> format = "pdf";
                                 $export -> file_location = 'file';
                                 $export -> module = 'payment';
                                 $export -> id = $payment_id;
                                 $export -> execute();
                                 
                                 $email = new email();
                                 $email -> format = 'cron_payment';
                                 
                                     $email_body = new email_body();
                                     $email_body->email_type = 'cron_payment';
                                     $email_body->customer_name = $customer['name'];
                                     $email_body->invoice_name = 'payment'.$payment_id;
                                     $email_body->biller_name = $biller['name'];
                                 
                                 $email -> notes = $email_body->create();
                                 $email -> from = $biller['email'];
                                 $email -> from_friendly = $biller['name'];
                                 if($value['email_customer'] == "1")
                                 {
                                     $email -> to = $customer['email'];
                                 }
                                 if($value['email_biller'] == "1" AND $value['email_customer'] == "1")
                                 {
                                     $email -> to = $customer['email'].";".$biller['email'];
                                 }
                                 if($value['email_biller'] == "1" AND $value['email_customer'] == "0")
                                 {
                                     $email -> to = $customer['email'];
                                 }
                                 $email -> subject = $pdf_file_name_receipt." from ".$biller['name'];
                                 $email -> attachment = $pdf_file_name_receipt;
                                 $return['email_message'] = $email->send();
                                 */
                             }
                         } else {
                             //do email to biller/admin - say error
                             $email = new email();
                             $email->domain_id = $domain_id;
                             $email->format = 'cron_payment';
                             $email->from = $biller['email'];
                             $email->from_friendly = $biller['name'];
                             $email->to = $biller['email'];
                             $email->subject = "Payment failed for " . $invoice['index_name'];
                             $error_message = "Invoice:  " . $invoice['index_name'] . "<br /> Amount: " . $invoice['total'] . " <br />";
                             foreach ($eway->get_message() as $key => $value) {
                                 $error_message .= "\n<br>\$ewayResponseFields[\"{$key}\"] = {$value}";
                             }
                             $email->notes = $error_message;
                             $return['email_message'] = $email->send();
                         }
                     }
                 } else {
                     //cron not run for this cron_id
                     $return['cron_message_' . $value['cron_id']] = "Cron ID: " . $value['cron_id'] . " NOT RUN: Cron for " . $value['index_name'] . " with start date of " . $value['start_date'] . ", end date of " . $value['end_date'] . " where it runs each " . $value['recurrence'] . " " . $value['recurrence_type'] . " did not recur today :: Info diff=" . $diff;
                 }
             } else {
                 //days diff is negative - whats going on
                 $return['cron_message_' . $value['cron_id']] = "Cron ID: " . $value['cron_id'] . " NOT RUN: - Not cheduled for today - Cron for " . $value['index_name'] . " with start date of " . $value['start_date'] . ", end date of " . $value['end_date'] . " where it runs each " . $value['recurrence'] . " " . $value['recurrence_type'] . " did not recur today :: Info diff=" . $diff;
             }
         } else {
             // cron has already been run for that cron_id today
             $return['cron_message_' . $value['cron_id']] = "Cron ID: " . $value['cron_id'] . " - Cron has already been run for domain: " . $domain_id . " for the date: " . $today . " for invoice " . $value['invoice_id'];
             $return['email_message'] = "";
         }
     }
     // no crons scheduled for today
     if ($number_of_crons_run == '0') {
         $return['id'] = $i;
         $return['cron_message'] = "No invoices recurred for this cron run for domain: " . $domain_id . " for the date: " . $today;
         $return['email_message'] = "";
     }
     //insert into cron_log date of run
     /*
     		    $cron_log = new cronlog();
         $cron_log->run_date = $today;
         $cron_log->domain_id = $domain_id;
         $cron_log->insert();
     */
     /*
      * If you want to get an email once cron has been run edit the below details
      *
      */
     /*
         $email = new email();
         $email -> format = 'cron';
         #$email -> notes = $return;
         $email -> from = "simpleinvoices@localhost";
         $email -> from_friendly = "Simple Invoices - Cron";
         $email -> to = "simpleinvoices@localhost";
         #$email -> bcc = $_POST['email_bcc'];
         $email -> subject = "Cron for Simple Invoices has been run for today:";
         $email -> send ();
     */
     return $return;
 }
function callback_inactive()
{
    cron::del('weixinArticle');
}
示例#29
0
<?php

$crons = cron::all();
foreach ($crons as $cron) {
    $c = new Cron\CronExpression($cron->getSchedule(), new Cron\FieldFactory());
    try {
        $c->getNextRunDate();
    } catch (Exception $ex) {
        $cron->remove();
    }
}
示例#30
0
    $session->cronCheck = 0;
    $session->language = 'en';
    $session->theme = 'light';
    $session->lastpage = '/';
    $session->admin = false;
    $session->translate = true;
    router::refresh();
}
// connect to localhost:3306/root
mysql::$models = root . 'models/';
mysql::connect('adm78', 'csodb');
// check cron but block spam
if ($debug || $session->cronCheck < time() - 3) {
    cron::$crondir = root . 'cron/';
    cron::$maxRuns = 16;
    cron::checkAll();
    $session->cronCheck = time();
}
// url routing
router::$views = root . 'views/';
router::$index = 'index';
router::$error = '404';
$uri = $_SERVER['REQUEST_URI'];
$page = router::path($uri);
// auto-html template
$tpl = new template();
$tpl->url = $_SERVER['REQUEST_URI'];
$css = ['/style/main.css', '/style/' . $session->theme . '.css'];
$js = ['http://code.jquery.com/jquery-1.10.2.min.js'];
$favicon = '/style/favicon.ico';
// translate with vars