/**
 * Takes the payment data gotten from process_pdt_function.php's function
 * checks the transaction details and gives a code based on several things:
 * [receiver_email] => the seller's email
 * [payment_gross] => the amount paid
 * [mc_currency] => the type of currency (USD)
 * [item_name] => the item name (Chinese Hack Code, English Hack Code)
 * @param $data     the array returned from the pdt function
 * @param $mysql    the mysql connection
 * @return          the code or invalid transaction ID message
 */
function id_to_code($data, $mysql)
{
    //check payment reciever's emails
    if ($data[receiver_email] !== "*****@*****.**" && $data[receiver_email] !== "*****@*****.**") {
        return "Looks like you paid the wrong person...";
    }
    //check currency type
    if ($data[mc_currency] !== "USD") {
        return "We like USD. Pay in USD.";
    }
    //set timezone to pdt
    date_default_timezone_set('America/Vancouver');
    //today's date
    $month = jdmonthname(gregoriantojd(date(m), 13, 1998), 0);
    $this_date = jdmonthname($jd, 0) . " " . date(Y) . " PDT";
    //date of purchase
    $payment_date = $data[payment_date];
    $payment_date1 = substr($payment_date, -9);
    $payment_date2 = substr($payment_date, 9, 3);
    /*check time of purchase
    	if ( strcmp($this_date, $payment_date2 . $payment_date1) !== 0)
    	{
    		return "You're a little late on redeeming...";
    	}
    	*/
    //check kind of item
    if ($data[item_name] == "somethin") {
        $db = mysql_select_db("somethin", $mysql);
    } else {
        if ($data[item_name] == "somethin2") {
            $db = mysql_select_db("somethin2", $mysql);
        } else {
            return "We're not sure what you bought...";
        }
    }
    //check amount paid
    if ($data[payment_gross] == 20.0) {
        $table = "20";
    } else {
        if ($data[payment_gross] == 7.0) {
            $table = "7";
        } else {
            if ($data[payment_gross] == 2.0) {
                $table = "2";
            } else {
                return "You paid an incorrect amount...";
            }
        }
    }
    //look around table for code that has matching transaction ID
    $result = mysql_query("SELECT * FROM `{$table}` WHERE `id` LIKE '{$data['txn_id']}' LIMIT 1");
    //if there is none found, make a new entry
    if (mysql_num_rows($result) == 0) {
        mysql_query("UPDATE `{$table}` SET id='{$data['txn_id']}',date='{$data['payment_date']}',ip='{$ip}' WHERE `id` LIKE '' LIMIT 1");
        $result = mysql_query("SELECT * FROM `{$table}` WHERE `id` LIKE '{$data['txn_id']}' LIMIT 1");
    }
    //get the row that the transaction ID is found on and return the cod value
    $row = mysql_fetch_array($result);
    return $row['cod'];
}
/**
 * Returns the current date in gregorian and hebrew
 *
 * The $params array can receive the parameters as follows:
 * ['gregorianDate']   -> Timestamped Gregorian Date
 * ['hebrewCaracters'] -> Returns the date in hebrew caracters. The param must be a boolean (true or false)
 *
 * @param array $params
 * @return string
 */
function getDateJewishCalendar(array $params)
{
    $gregorianDate = date('d/m/Y', $params['gregorianDate']);
    list($gregorianDay, $gregorianMonth, $gregorianYear) = explode('/', $gregorianDate);
    // Converting gregorian to julian date
    $julianDate = gregoriantojd($gregorianMonth, $gregorianDay, $gregorianYear);
    // Getting the Hebrew Month name
    $hebrewMonthName = jdmonthname($julianDate, 4);
    // Converting the date from Julian to Jewish.
    $jewishDate = jdtojewish($julianDate);
    list($jewishMonth, $jewishDay, $jewishYear) = explode('/', $jewishDate);
    $jewishDateStr = "";
    $jewishDateStr = "{$gregorianDate}  -  ";
    $jewishDateStr .= "{$jewishDay} {$hebrewMonthName} {$jewishYear}";
    if ($params['hebrewCaracters'] === true) {
        // Converting the date from Julian to Jewish, but in hebrew caracters
        $hebrewDate = jdtojewish($julianDate, true);
        /*
         * This plugin is UTF8 only and the jdtojewish function only return iso,
         * so we need to convert it with mb_string, mb_convert_encoding function.
         */
        $jewishDateStr .= "  -  " . mb_convert_encoding(jdtojewish($julianDate, true), "UTF-8", "ISO-8859-8");
    }
    return $jewishDateStr;
}
Beispiel #3
0
 public function Mese($mese)
 {
     switch ($mese) {
         case 1:
             $giorno = $mese * 30;
             break;
         case 3:
         case 5:
         case 7:
         case 8:
         case 10:
         case 12:
             $giorno = $mese * 30 - 25;
             break;
         case 2:
             $giorno = $mese * 28 + 2;
             break;
         case 4:
         case 6:
         case 9:
         case 11:
             $giorno = $mese * 30 - 25;
             break;
     }
     $nome = jdmonthname($giorno, 3);
     return $nome;
 }
 public function testSectorGraph()
 {
     $mostRecentDateInGraph = SectorHistoricals::getMostRecentSectorHistoricalsDate();
     $mostRecentMonth = jdmonthname(explode("-", $mostRecentDateInGraph)[1], 2);
     $mostRecentYear = explode("-", $mostRecentDateInGraph)[0];
     $this->visit('/sectorGraph/Banks/last_month/Market%20Cap')->see('Date')->see('Market Cap')->see($mostRecentMonth)->see($mostRecentYear);
     $this->visit('/sectorGraph/Banks/last_6_months/Market%20Cap')->see('Date')->see('Market Cap')->see($mostRecentMonth)->see($mostRecentYear);
 }
 public function testStockGraph()
 {
     $mostRecentDateInGraph = Historicals::getMostRecentHistoricalDate('TLS');
     $mostRecentMonth = jdmonthname(explode("-", $mostRecentDateInGraph)[1], 2);
     $mostRecentYear = explode("-", $mostRecentDateInGraph)[0];
     $this->visit('/stockGraph/TLS/last_month/Price')->see('Date')->see('Price')->see($mostRecentMonth)->see($mostRecentYear);
     $this->visit('/stockGraph/TLS/all_time/Price')->see('Date')->see('Price')->see('Feb 1, 2000')->see($mostRecentMonth)->see($mostRecentYear);
 }
Beispiel #6
0
<?php

$jd_days = array(2453396, 2440588, -1, array(), 10000000);
foreach ($jd_days as $jd_day) {
    echo "=== ", $jd_day, "\n";
    var_dump(jdmonthname($jd_day, 0));
    var_dump(jdmonthname($jd_day, 1));
    var_dump(jdmonthname($jd_day, 2));
    var_dump(jdmonthname($jd_day, 3));
    var_dump(jdmonthname($jd_day, 4));
    var_dump(jdmonthname($jd_day, 5));
    echo "\n";
}
echo "Done\n";
Beispiel #7
0
function displaycalendar()
{
    // THIS FUNCTION CANNOT GO BACK MORE THAN TWO MONTH
    $dayfetched = date(d);
    $monthfetched = date(m);
    $yearfetched = date(Y);
    // The "< number" determines the days you want to display in past
    for ($i = 0; $i < 7; $i++) {
        if ($dayfetched - $i > 0) {
            echo "<a href='?d=" . ($dayfetched - $i) . "&m=" . $monthfetched . "&y=" . $yearfetched . "'>" . ($dayfetched - $i) . " " . jdmonthname(juliantojd($monthfetched, $dayfetched - $i, $yearfetched), 2) . "</a> • ";
        } else {
            $previousmonth = $monthfetched - 1;
            if ($previousmonth > 0) {
                $query_date = $yearfetched . "-" . $previousmonth . "01";
                $numberofdaysinpreviousmonth = date('t', strtotime($query_date));
                echo "<a href='?d=" . ($numberofdaysinpreviousmonth + ($dayfetched - $i)) . "&m=" . $previousmonth . "&y=" . $yearfetched . "'>" . ($numberofdaysinpreviousmonth + ($dayfetched - $i)) . " " . jdmonthname(juliantojd($previousmonth, $numberofdaysinpreviousmonth + ($dayfetched - $i), $yearfetched), 2) . "</a> •";
            } else {
                echo "Previous year...";
            }
        }
    }
}
        <?php 
//$i=date("Y");
echo '<select name="mnth" class="other">';
$i = 1;
do {
    $mname = cal_to_jd(CAL_GREGORIAN, $i, 1, date("Y"));
    if (intval($i) < 10) {
        $i = '0' . $i;
    }
    if ($mname == cal_to_jd(CAL_GREGORIAN, date("m"), 1, date("Y"))) {
        echo "<option value=" . $i . " selected>";
        echo jdmonthname($mname, 1);
        echo "</option>";
    } else {
        echo "<option value=" . $i . ">";
        echo jdmonthname($mname, 1);
        echo "</option>";
    }
    $i++;
} while ($i < 13);
echo "</select>";
?>
&nbsp;</td>
      <td width="3%" align="center" valign="middle" nowrap>
        <?php 
$i = '2007';
echo '<select name="yrs"  class="other">';
do {
    if ($i == date("Y")) {
        echo "<option selected>";
        echo $i;
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
<?php 
html_rtl($lang);
?>
<HEAD>
<?php 
echo setCharSet();
?>

<?php 
require $root_path . 'include/inc_js_gethelp.php';
require $root_path . 'include/inc_css_a_hilitebu.php';
// GET TYPE
$type = $_GET['type'];
$dts = cal_to_jd(CAL_GREGORIAN, $_GET['mnth'], 1, $_GET['yrs']);
$dts = jdmonthname($dts, 1);
$real_dts = $dts . '/' . $_GET['yrs'];
$content = $_GET['mnth'] . ':' . $_GET['yrs'] . ':' . $_GET['type'] . ':' . 'whiterow' . ':' . 'colorrow';
?>

</HEAD>

<link href="../../dental/dental_reports.css" rel="stylesheet" type="text/css">

<BODY topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 onLoad="javascript:window.print();"
<?php 
if (!$cfg['dhtml']) {
    echo 'link=' . $cfg['body_txtcolor'] . ' alink=' . $cfg['body_alink'] . ' vlink=' . $cfg['body_txtcolor'];
}
?>
>
 public function getMonth($date, $type = 1)
 {
     $date = date('Y-n-j', strtotime($date));
     $date_parts = explode('-', $date);
     $jd = cal_to_jd(CAL_GREGORIAN, $date_parts[1], $date_parts[2], $date_parts[0]);
     return __(jdmonthname($jd, $type));
 }
 private function get_month_name($date, $type = 1)
 {
     $date = date('Y n j', strtotime($date));
     $date_info = explode(' ', $date);
     $jd = cal_to_jd(CAL_GREGORIAN, $date_info[1], $date_info[2], $date_info[0]);
     return __(jdmonthname($jd, $type));
 }
Beispiel #12
0
                    </div>
                    <ul class="gauge-meta clearfix">
                        <li id="gauge-textfield" class="pull-left gauge-value"></li>
                        <li class="pull-right gauge-title">Safe</li>
                    </ul>
                </div>
            </div>
        </section>
    </div>
    <div class="col-md-3">
        <section class="panel">
            <div class="panel-body">
                <div class="top-stats-panel">
                    <div class="daily-visit">
                        <h4 class="widget-h"><?php 
echo jdmonthname(gregoriantojd($this_month, $this_day, $this_year), 1);
?>
 Sold</h4>
                        <div id="daily-visit-chart" style="width:100%; height: 100px; display: block">

                        </div>
                        <ul class="chart-meta clearfix">
                            <li class="pull-left visit-chart-value">$<?php 
echo select_data('orders', 'SUM(order_total)', "order_date>='{$month_start}' ") + 0;
?>
</li>
                            <li class="pull-right visit-chart-title"><i class="fa fa-arrow-up"></i> 15%</li>
                        </ul>
                    </div>
                </div>
            </div>
Beispiel #13
0
 public function showMonth($sede_id, $ano, $mes)
 {
     if (Input::has('cdate')) {
         $cdate = explode('-', Input::get('cdate'));
         return Redirect::action('TurnoController@showMonth', array($sede_id, $cdate[0], $cdate[1]));
     }
     if ($sede_id == Sedes::TODAS) {
         return Redirect::action('TurnoController@index');
     }
     $sede = Sedes::where('id', $sede_id)->firstOrFail();
     $turnos = Turnos::where('fecha_turno', 'LIKE', "{$ano}-{$mes}-%")->where('sede_id', $sede_id)->orderBy('fecha_turno')->get();
     //-----------------------------------------
     // Si no existe turno para ese mes, crearlo a partir del anterior
     if (count($turnos) == 0) {
         $query = array('sede' => $sede_id, 'cdate' => $ano . '-' . $mes);
         return Redirect::action('TurnoController@create', $query);
     }
     $turnosArray = array();
     $turnosHtml = array();
     $incidenciasArray = array();
     foreach ($turnos as $turno) {
         $profesional = Profesional::find($turno->profesional_id);
         $turnosHtml[$turno->fecha_turno][$turno->tipo_turno] = $this->getHtmlProfRow($turno, $profesional);
         // $turnosArray
         $day = explode('-', $turno->fecha_turno)[2];
         if ($profesional !== null) {
             $turnosArray[$day][$turno->tipo_turno] = array($turno->profesional_id, "{$profesional->nombre} {$profesional->apellido1}");
         } else {
             $turnosArray[$day][$turno->tipo_turno] = array($turno->profesional_id, "");
         }
         $incidenciasArray[$day][$turno->tipo_turno] = $turno->incidencia_text;
     }
     $events = array();
     $turnosHtmlSelect = $this->getHtmlProfesionalesSedeSelects($sede_id, $turnos);
     foreach ($turnosHtml as $fecha => $value) {
         $div = $this->getHtmlCasillaCalendario($fecha, $sede_id, $turnosHtml, $turnosHtmlSelect);
         $events[$fecha] = array($div);
     }
     $calendario = $this->getTurnoCalendar($events, $ano . '-' . $mes, '/turno/' . $sede_id);
     $d = gregoriantojd($mes, 1, $ano);
     $fecha = jdmonthname($d, 1) . ' de ' . $ano;
     return View::make('turnos.show')->with(array('calendario' => $calendario, 'sede' => $sede, 'fecha' => $fecha, 'incidencias' => $incidenciasArray));
 }
Beispiel #14
0
<?php

/*$num = rand (1 , 100);
echo "your new random valus is {$num}\n";*/
date_default_timezone_set('AMERICA/Los_Angeles');
$num = 0;
$monthnumber = 1;
$month = jdmonthname(gregoriantojd($monthnumber, 1, 1), CAL_MONTH_GREGORIAN_LONG);
$months = array();
while ($num < 12) {
    $month = jdmonthname(gregoriantojd($monthnumber++, 1, 1), CAL_MONTH_GREGORIAN_LONG);
    $months[$num] = $month;
    $num++;
}
sort($months, SORT_STRING);
foreach ($months as $key => $val) {
    echo "months[" . $key . "] = " . $val . "\n";
}
//echo "<pre>"; print_r($months);
<?php

$today_in_julian_day = gregoriantojd(8, 16, 2011);
// $mese, $giorno, $anno
$today_in_jewish_cal = jdtojewish($today_in_julian_day);
// restituisce una stringa del formato 'mese/giorno/anno'
echo jdmonthname($today_in_julian_day, 4) . "\n";
$today_in_french_cal = JDToFrench($today_in_julian_day);
$month_in_french_cal = jdmonthname($today_in_julian_day, CAL_FRENCH);
var_dump($today_in_french_cal);
var_dump($month_in_french_cal);
$today_in_julian_day = cal_to_jd(CAL_GREGORIAN, 00, 16, 2011);
// con CAL_GREGORIAN costante statica e gli altri parametri corrispondenti alla sintassi di data all'americana con, in ordine, $mese, $giorno, $anno.
var_dump($today_in_julian_day);
 public static function layout_to_name($layout_ids)
 {
     $type = $layout_ids['type'];
     $item = !empty($layout_ids['item']) ? preg_replace("/^{$type}-/", "", $layout_ids['item']) : "";
     $specificity = !empty($layout_ids['specificity']) ? preg_replace("/^{$type}-{$item}-/", "", $layout_ids['specificity']) : "";
     if ($type == 'single') {
         $post_type = get_post_type_object($item ? $item : 'post');
         $name = is_object($post_type->labels) ? $post_type->labels->singular_name : $post_type->labels['singular_name'];
         if ($specificity) {
             return sprintf("Single %s: %s", $name, $specificity);
         }
         return sprintf("Single %s", $name);
     } else {
         if ($type == 'archive') {
             if ($item == 'home') {
                 return __("Home Page");
             } else {
                 if ($item == 'date' || empty($item)) {
                     if ($specificity) {
                         return sprintf("Archive: %s", jdmonthname($specificity, CAL_MONTH_GREGORIAN_LONG));
                     }
                     return __("Archive");
                 } else {
                     if ($item == 'search') {
                         if ($specificity) {
                             return sprintf("Search term: %s", $specificity);
                         }
                         return __("Search");
                     } else {
                         if ($item == 'author') {
                             if ($specificity) {
                                 return sprintf("Author: %s", $specificity);
                             }
                             return __("Author");
                         } else {
                             // means this is taxonomy
                             $taxonomy = get_taxonomy($item);
                             $name = is_object($taxonomy->labels) ? $taxonomy->labels->singular_name : $taxonomy->labels['singular_name'];
                             if ($specificity) {
                                 return sprintf("%s: %s", $name, $specificity);
                             }
                             return $name;
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #17
0
 function print_nice_date($jd)
 {
     // format of Thursday, Septemeber 22nd 2012
     if ($jd == 0) {
         return '';
     }
     $date = explode("/", JDToGregorian($jd));
     $output = jddayofweek($jd, 1) . ", " . jdmonthname($jd, 3) . " {$date[1]}, {$date[2]}";
     return $output;
 }
Beispiel #18
0
    //SEGMENT 1.0
    $arSeg1 = array("Ianuarius", "Februarius", "Martius", "Aprilis", "Maius", "Iunius", "Iulius", "Augustus", "October", "Messidor", "November", "December");
    //SEGMENT 2.0
    $arSeg2 = array("Ianuariis", "Februariis", "Martiis", "Aprilibus", "Maiis", "Iuniis", "Iuliis", "Augustis", "Septembribus", "Octobribus", "Novembribus", "Decembribus");
    //SEGMENT 3.0
    $arSeg3 = array("Ianuarias", "Februarias", "Martias", "Apriles", "Maias", "Iunias", "Iulias", "Augustas", "Septembres", "Octobres", "Novembres", "Decembres");
    /*
    	   if ((date('L'))==1){ 
    	   		return $arSeg3[(date('n')-1];
    	   } else {
    	if (rand(1,2) == 1) {
    		return $arSeg2[(date('n'))-1];
    	} else {
    		return $arSeg1[(date('n'))-1];
    	}
    	   }
    */
}
function GetLatinDate($timeseed)
{
    return decrom(date('yyyy')) . ' of year ' . LatinMonthNames($timeseed) . ' in day ' . decrom(date('t'));
}
//$arDateFrench = gregorian2FrenchDateArray(date('d',$tme), date('m',$tme), date('Y',$tme)) ;
$gregorianMonth = date(n, $tme);
$gregorianDay = date(j, $tme);
$gregorianYear = date(Y, $tme);
$arDateFrench = cal_from_jd(gregoriantojd($gregorianMonth, $gregorianDay, $gregorianYear), CAL_FRENCH);
$jdDate = gregoriantojd($gregorianMonth, $gregorianDay, $gregorianYear);
$hebrewMonthName = jdmonthname($jdDate, 4);
$hebrewDate = jdtojewish($jdDate);
list($hebrewMonth, $hebrewDay, $hebrewYear) = split('/', $hebrewDate);
Beispiel #19
0
function setVacationToFromDate($dateStr)
{
    $seeker_alert_date = 0;
    $seeker_alert_month = 0;
    $seeker_alert_year = 0;
    $split_alert = explode("-", $dateStr);
    $seeker_alert_date = $split_alert[2];
    $seeker_alert_month = $split_alert[1];
    $seeker_alert_year = $split_alert[0];
    return $seeker_alert_date . " " . @jdmonthname($seeker_alert_month, 0) . " " . $seeker_alert_year;
}