function login_status($redirect, $username, $http_code, $access_token, $refresh_token, $login_id, $expires)
{
    $redirect_string = "";
    if ($access_token != "" && $http_code == "200") {
        // Check if the session refresh_token is current:
        $refresh_current = check_refresh_stored($username, $refresh_token);
        // login_functions.inc.php; True or False; compares session, stored tokens (below)
        // Compute time left (for display) and determine if login is current based on $expired time:
        $now = date("U");
        $seconds_left = $expires - time();
        $time_left = seconds_to_time($seconds_left);
        //login_functions.inc.php; calculates d-h-m-s from seconds
        $time_left = $time_left['time'];
        $login_current = $expires < $now ? "False" : "True";
        // Assign appropriate redirect string based on refresh_token (highest priority), login time left:
        if ($refresh_current == "False") {
            $redirect_string = "logout_exec.php?id={$login_id}&msg=refresh&redirect={$redirect}";
        } elseif ($login_current == "False") {
            $redirect_string = "logout_exec.php?id={$login_id}&msg=expired&redirect={$redirect}";
        }
    } elseif ($refresh_token != "" && $access_token == "") {
        // If session value of refresh_token is not current, assign redirect string for logout that resets all session values including refresh_token
        $refresh_current = check_refresh_stored($username, $refresh_token);
        // login_functions.inc.php; compares session, stored tokens (below)
        if ($refresh_current == "False") {
            $redirect_string = "logout_exec.php?id={$login_id}&msg=refresh&redirect={$redirect}";
        }
    }
    return array($redirect_string, $time_left, $refresh_current);
}
Exemple #2
0
function list_vote_chain()
{
    echo "\n";
    if ($con = connect_db('auth.txt')) {
        $sql = "SELECT * FROM votes";
        $result = pg_query($con, $sql);
        $votes = array();
        while ($row = pg_fetch_array($result)) {
            $url = $row[0];
            $time = $row[1];
            // convert to time format
            $votes[$url] = (int) $time;
        }
        arsort($votes);
        foreach ($votes as $url => $time) {
            $time_str = seconds_to_time($time);
            echo "{$time_str} <a href='http://{$url}'>http://{$url}</a>\n";
        }
    }
}
$row = false;
foreach ($ranked_user_ids as $ranked_user_id) {
    $person = $people[$ranked_user_id];
    // change the color of alternating rows.
    if ($row == true) {
        echo "    <tr class=\"even\">";
        $row = false;
    } else {
        echo "    <tr class=\"odd\">";
        $row = true;
    }
    printf("      <td>%s</td>", $person->name);
    for ($i = 1; $i <= $NUM_PROBLEMS; ++$i) {
        printf("      <td align=\"center\" class=\"timecol\">%s</td><td align=\"right\" class=\"numcol\">%s</td>", $person->problems[$i]->time, $person->problems[$i]->submissions);
    }
    printf("      <td>%s</td>", seconds_to_time($person->total_seconds()));
    printf("      <td>%s</td>", $person->total_problems_solved());
    echo "    </tr>";
}
?>
  </tbody>
  </table>
      </div>
      </div>
      </td>
<!-- Side Bar -->
<td valign="top">
<!--Submission status-->
<?php 
if ($show_submission_result != 0) {
    echo "<div class=\"sidebar\">";
Exemple #4
0
 /**
  * Main output function
  */
 function out()
 {
     global $roster, $addon;
     $this->fetchEquip();
     // Equipment
     $this->equip_slot('Head');
     $this->equip_slot('Neck');
     $this->equip_slot('Shoulder');
     $this->equip_slot('Back');
     $this->equip_slot('Chest');
     $this->equip_slot('Shirt');
     $this->equip_slot('Tabard');
     $this->equip_slot('Wrist');
     $this->equip_slot('MainHand');
     if (isset($this->equip['SecondaryHand'])) {
         $this->equip_slot('SecondaryHand');
     }
     if (isset($this->equip['Ranged'])) {
         $this->equip_slot('Ranged');
     }
     //no longer used
     //$this->equip_slot('Ammo');
     $this->equip_slot('Hands');
     $this->equip_slot('Waist');
     $this->equip_slot('Legs');
     $this->equip_slot('Feet');
     $this->equip_slot('Finger0');
     $this->equip_slot('Finger1');
     $this->equip_slot('Trinket0');
     $this->equip_slot('Trinket1');
     // Resists
     $this->resist_value('arcane');
     $this->resist_value('fire');
     $this->resist_value('nature');
     $this->resist_value('frost');
     $this->resist_value('shadow');
     if ($roster->auth->getAuthorized($addon['config']['show_played'])) {
         $TimeLevelPlayedConverted = seconds_to_time($this->data['timelevelplayed']);
         $TimePlayedConverted = seconds_to_time($this->data['timeplayed']);
         $roster->tpl->assign_block_vars('info_stats', array('NAME' => $roster->locale->act['timeplayed'], 'VALUE' => $TimePlayedConverted['days'] . $TimePlayedConverted['hours'] . $TimePlayedConverted['minutes'] . $TimePlayedConverted['seconds']));
         $roster->tpl->assign_block_vars('info_stats', array('NAME' => $roster->locale->act['timelevelplayed'], 'VALUE' => $TimeLevelPlayedConverted['days'] . $TimeLevelPlayedConverted['hours'] . $TimeLevelPlayedConverted['minutes'] . $TimeLevelPlayedConverted['seconds']));
     }
     if ($roster->auth->getAuthorized($addon['config']['show_talents']) && $this->data['talent_points']) {
         $roster->tpl->assign_block_vars('info_stats', array('NAME' => $roster->locale->act['unusedtalentpoints'], 'VALUE' => $this->data['talent_points']));
     }
     // Code to write a "Max Exp bar" just like in SigGen
     $expbar_amount = $expbar_max = $expbar_rest = '';
     if ($this->data['level'] == ROSTER_MAXCHARLEVEL) {
         $exp_percent = 100;
         $expbar_amount = $roster->locale->act['max_exp'];
         $expbar_type = 'max';
     } elseif ($this->data['exp'] == '0') {
         $exp_percent = 0;
         $expbar_type = 'normal';
     } else {
         $xp = explode(':', $this->data['exp']);
         if (isset($xp) && $xp[1] != '0' && $xp[1] != '') {
             $exp_percent = $xp[1] > 0 ? floor($xp[0] / $xp[1] * 100) : 0;
             $expbar_amount = $xp[0];
             $expbar_max = $xp[1];
             $expbar_rest = $xp[2] > 0 ? $xp[2] : '';
             $expbar_type = $xp[2] > 0 ? 'rested' : 'normal';
         }
     }
     $roster->tpl->assign_vars(array('EXP_AMOUNT' => $expbar_amount, 'EXP_MAX' => $expbar_max, 'EXP_REST' => $expbar_rest, 'EXP_PERC' => $exp_percent, 'EXP_TYPE' => $expbar_type));
     switch ($this->data['classid']) {
         case ROSTER_CLASS_WARRIOR:
         case ROSTER_CLASS_PALADIN:
         case ROSTER_CLASS_ROGUE:
         case ROSTER_CLASS_MONK:
             $rightbox = 'melee';
             break;
         case ROSTER_CLASS_HUNTER:
             $rightbox = 'ranged';
             break;
         case ROSTER_CLASS_SHAMAN:
         case ROSTER_CLASS_DRUID:
         case ROSTER_CLASS_MAGE:
         case ROSTER_CLASS_WARLOCK:
         case ROSTER_CLASS_PRIEST:
             $rightbox = 'spell';
             break;
     }
     $roster->tpl->assign_var('RIGHTBOX', $rightbox);
     // Print stat boxes
     $this->status_box('stats', 'left', true);
     $this->status_box('melee', 'left');
     $this->status_box('ranged', 'left');
     $this->status_box('spell', 'left');
     $this->status_box('defense', 'left');
     $this->status_box('stats', 'right');
     $this->status_box('melee', 'right', $rightbox == 'melee');
     $this->status_box('ranged', 'right', $rightbox == 'ranged');
     $this->status_box('spell', 'right', $rightbox == 'spell');
     $this->status_box('defense', 'right');
     // Buffs
     $this->show_buffs();
     // PvP
     $this->show_pvp();
     // Item bonuses
     if ($roster->auth->getAuthorized($addon['config']['show_item_bonuses'])) {
         require_once $addon['inc_dir'] . 'charbonus.lib.php';
         $char_bonus = new CharBonus($this);
         $char_bonus->dumpBonus();
         unset($char_bonus);
     }
     // Selected default tab
     $select_tab = isset($_GET['t']) ? $_GET['t'] : 'profile';
     // Print tabs
     $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['profile'], 'VALUE' => 'profile', 'SELECTED' => $select_tab == 'profile' ? true : false));
     // Pet Tab
     if ($roster->auth->getAuthorized($addon['config']['show_pets']) && $this->show_pets()) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['pets'], 'VALUE' => 'pets', 'SELECTED' => $select_tab == 'pets' ? true : false));
     } else {
         $roster->tpl->assign_var('S_PET_TAB', false);
     }
     // Companion tab
     if ($roster->auth->getAuthorized($addon['config']['show_companions']) && $this->show_companions()) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['companions'], 'VALUE' => 'companions', 'SELECTED' => $select_tab == 'companions' ? true : false));
     } else {
         $roster->tpl->assign_var('S_COMPAN_TAB', false);
     }
     // Reputation Tab
     if ($roster->auth->getAuthorized($addon['config']['show_reputation']) && $this->show_reputation()) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['reputation'], 'VALUE' => 'reputation', 'SELECTED' => $select_tab == 'reputation' ? true : false));
     } else {
         $roster->tpl->assign_var('S_REP_TAB', false);
     }
     // Skills Tab
     if ($roster->auth->getAuthorized($addon['config']['show_skills']) && $this->show_skills()) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['skills'], 'VALUE' => 'skills', 'SELECTED' => $select_tab == 'skills' ? true : false));
     } else {
         $roster->tpl->assign_var('S_SKILL_TAB', false);
     }
     // Talents Tab
     if ($roster->auth->getAuthorized($addon['config']['show_talents']) && $this->show_talents()) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['talents'], 'VALUE' => 'talents', 'SELECTED' => $select_tab == 'talents' ? true : false));
     } else {
         $roster->tpl->assign_var('S_TALENT_TAB', false);
     }
     // Glyphs Tab
     if (!$roster->auth->getAuthorized($addon['config']['show_glyphs']) || !$this->show_glyphs()) {
         $roster->tpl->assign_var('S_GLYPH_TAB', false);
     }
     // Spell Book Tab
     if ($roster->auth->getAuthorized($addon['config']['show_spellbook']) && $this->show_spellbook()) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['spellbook'], 'VALUE' => 'spellbook', 'SELECTED' => $select_tab == 'spellbook' ? true : false));
     } else {
         $roster->tpl->assign_var('S_SPELL_TAB', false);
     }
     // Currency Tab
     if ($roster->auth->getAuthorized($addon['config']['show_currency']) && $this->show_currency()) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['currency'], 'VALUE' => 'currency', 'SELECTED' => $select_tab == 'currency' ? true : false));
     } else {
         $roster->tpl->assign_var('S_CURRENCY_TAB', false);
     }
     $roster->tpl->set_filenames(array('char' => $addon['basename'] . '/char.html'));
     return $roster->tpl->fetch('char');
 }
Exemple #5
0
            </tr>
           </tbody>
          </table>
        </div>
      </div>


      <div class="row">
        <div class="col-lg-6">
          <h4>Hardware</h4>

          <?php 
$output = shell_exec('cat /sys/class/thermal/thermal_zone0/temp');
$temp = intval($output) / 1000;
$output = shell_exec('echo "$(</proc/uptime awk \'{print $1}\')"');
$time_alive = seconds_to_time(intval($output));
?>

          <table class="table table-striped table-hover">
            <tbody>
            <tr>
              <td><p>Time Alive: </p></td>
              <td><p class="text-right"><?php 
echo "{$time_alive}";
?>
</p></td>
            </tr>
            <tr>
              <td><p>Board Temperature: </p></td>
              <td><p class="text-right"><?php 
echo "{$temp}&deg;C";
Exemple #6
0
 //Determine login status and display appropriate text/form.
 if (!$auth_url || (!$gsq_app_id && $GSQ_CompResources == "Remote" || !$gth_app_id && $GTH_CompResources == "Remote")) {
     $login_msg = "<span id=\"remote_config_error\" class=\"warning\"> You have selected <b>Remote</b> resources but configuration is incomplete <a href=\"/XGDB/jobs/apps.php\">(check it)</a>";
 } elseif ($access_token == "") {
     $login_msg = "<td><span class=\"warning  normalfont\" id=\"login_required\">Authorization required for access to HPC.  </span></td><td>" . $login_redirect . "</td>";
     $logged_in = "";
 } elseif ($_SESSION['http_code'] == "0") {
     $login_msg = "<span id=\"auth_error\" class=\"warning\">It appears the authorization URL is not correctly configured. <a href=\"/XGDB/jobs/configure.php#auth\">(check it)</a></span>";
     //login_functions.inc.php  - displays login form which POSTs action=authenticate to login.php which then redirects back here.
     $logged_in = "";
 } elseif ($_SESSION['http_code'] == "401") {
     $login_msg = "<td><span class=\"warning normalfont\" id=\"login_fail\" >Login Failed. Try Again. </span></td><td>" . $login_redirect . "</td>";
     $logged_in = "";
 } elseif ($_SESSION['http_code'] == "200") {
     $time_left = $expires - date("U");
     $time_left = seconds_to_time($time_left);
     //login_functions.inc.php; calculates d-h-m-s from seconds
     $time_left = $time_left['time'];
     $login_msg = "\n            <table width=\"100%\">\n                <colgroup>\n                    <col width =\"90%\" style=\"background-color: #EEE\"  />\n                    <col width =\"10%\"/>\n                </colgroup>\n                <tr>\n\t\t\t\t\t<td style=\"padding:10px; border: 2px solid yellow\"> <span class=\"status_box\"> \n\t\t\t\t\t\t<span class=\"checked smallerfont\">\"{$username}\" </span> <span class=\"smallerfont\"> is authorized to <a title=\"click here to submit standalone HPC jobs\" href=\"/XGDB/jobs/submit.php\">submit jobs </a> \n\t\t\t\t\t\t(token expires in <span class=\"alertnotice\">{$time_left}</span>) </span>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<span class=\"smallerfont\">{$gsq_message}</span><br />\n\t\t\t\t\t\t<span class=\"smallerfont\">{$gth_message}</span><br />\n\t\t\t\t\t\t<span class=\"smallerfont\">{$gth_present_message}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td style=\"padding:10px; border: 2px solid yellow\">\n\t\t\t\t\t\t<span class=\"smallerfont {$conditional_display_refresh}\">\n\t\t\t\t\t\t    <form action=\"/XGDB/jobs/login_exec.php\" method=\"post\">\n\t\t\t\t\t\t        <input type=\"hidden\" name=\"action\" value=\"refresh\" />\n\t\t\t\t\t\t        <input type=\"hidden\" name=\"redirect\" value=\"view\" />\n\t\t\t\t\t\t        <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n                                <input type=\"submit\" name=\"refresh\" value=\" refresh\">\n                            </form>\n                            \n                        </span>\n\t\t\t\t\t\t<span class=\"smallerfont\">\n\t\t\t\t\t\t    <form action=\"/XGDB/jobs/logout_exec.php\" method=\"post\">\n\t\t\t\t\t\t        <input type=\"hidden\" name=\"msg\" value=\"logout\" />\n\t\t\t\t\t\t        <input type=\"hidden\" name=\"redirect\" value=\"view\" />\n\t\t\t\t\t\t        <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n                                <input type=\"submit\" name=\"logout\" value=\" log out\">\n                            </form>\n                        </span>\n                        <span  class=\"{$conditional_display_login} normalfont nowrap\">\n                            <a style=\"text-decoration: none\" href=\"/XGDB/jobs/login.php#login\"> &nbsp; log in</a>\n                        </span>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t";
     /* $login_msg = 
     			"<div style=\"border:2px solid yellow; padding:1em; background:#DDD\">
     			    <span id=\"logged_in\" class=\"normalfont\">
     			        <img class=\"nudge2\" src=\"/XGDB/images/remote_compute.png\" />&nbsp; 
     			            <span class=\"checked\">
     			                Logged in</span> with <b>Remote Compute Option</b> (token expires in <span class=\"alertnotice\">$time_left</span>).
     			                Verify that input data are valid, then click 'Data Process Options' to run pipeline, 
     			                or go to <a href=\"/XGDB/jobs/submit.php\">Remote Jobs &rarr; Submit</a> if this is a <b>standalone job.</b>
     			            <br />
     			            <img class=\"nudge2\" src=\"/XGDB/images/remote_compute.png\" />
     			            $gth_present_message
     			        </span>";
 /**
  * Main output function
  */
 function out()
 {
     global $roster, $addon;
     $this->fetchEquip();
     $this->_altNameHover();
     // Equipment
     $this->printEquip('Head');
     $this->printEquip('Neck');
     $this->printEquip('Shoulder');
     $this->printEquip('Back');
     $this->printEquip('Chest');
     $this->printEquip('Shirt');
     $this->printEquip('Tabard');
     $this->printEquip('Wrist');
     $this->printEquip('MainHand');
     $this->printEquip('SecondaryHand');
     $this->printEquip('Ranged');
     $this->printEquip('Ammo');
     $this->printEquip('Hands');
     $this->printEquip('Waist');
     $this->printEquip('Legs');
     $this->printEquip('Feet');
     $this->printEquip('Finger0');
     $this->printEquip('Finger1');
     $this->printEquip('Trinket0');
     $this->printEquip('Trinket1');
     // Resists
     $this->printResist('arcane');
     $this->printResist('fire');
     $this->printResist('nature');
     $this->printResist('frost');
     $this->printResist('shadow');
     if ($this->data['talent_points']) {
         $roster->tpl->assign_block_vars('info_stats', array('NAME' => $roster->locale->act['unusedtalentpoints'], 'VALUE' => $this->data['talent_points']));
     }
     if ($roster->auth->getAuthorized($addon['config']['show_played'])) {
         $TimeLevelPlayedConverted = seconds_to_time($this->data['timelevelplayed']);
         $TimePlayedConverted = seconds_to_time($this->data['timeplayed']);
         $roster->tpl->assign_block_vars('info_stats', array('NAME' => $roster->locale->act['timeplayed'], 'VALUE' => $TimePlayedConverted['days'] . $TimePlayedConverted['hours'] . $TimePlayedConverted['minutes'] . $TimePlayedConverted['seconds']));
         $roster->tpl->assign_block_vars('info_stats', array('NAME' => $roster->locale->act['timelevelplayed'], 'VALUE' => $TimeLevelPlayedConverted['days'] . $TimeLevelPlayedConverted['hours'] . $TimeLevelPlayedConverted['minutes'] . $TimeLevelPlayedConverted['seconds']));
     }
     // Code to write a "Max Exp bar" just like in SigGen
     if ($this->data['level'] == ROSTER_MAXCHARLEVEL) {
         $expbar_width = '216';
         $expbar_text = $roster->locale->act['max_exp'];
         $expbar_type = 'expbar_full';
     } elseif ($this->data['exp'] == '0') {
         $expbar_width = 0;
         $expbar_type = 'expbar_full';
         $expbar_text = '';
     } else {
         $xp = explode(':', $this->data['exp']);
         if (isset($xp) && $xp[1] != '0' && $xp[1] != '') {
             $expbar_width = $xp[1] > 0 ? floor($xp[0] / $xp[1] * 216) : 0;
             $exp_percent = $xp[1] > 0 ? floor($xp[0] / $xp[1] * 100) : 0;
             if ($xp[2] > 0) {
                 $expbar_text = $xp[0] . '/' . $xp[1] . ' : ' . $xp[2] . ' (' . $exp_percent . '%)';
                 $expbar_type = 'expbar_full_rested';
             } else {
                 $expbar_text = $xp[0] . '/' . $xp[1] . ' (' . $exp_percent . '%)';
                 $expbar_type = 'expbar_full';
             }
         }
     }
     switch ($this->data['classid']) {
         case ROSTER_CLASS_WARRIOR:
         case ROSTER_CLASS_PALADIN:
         case ROSTER_CLASS_ROGUE:
             $rightbox = 'melee';
             break;
         case ROSTER_CLASS_HUNTER:
             $rightbox = 'ranged';
             break;
         case ROSTER_CLASS_SHAMAN:
         case ROSTER_CLASS_DRUID:
         case ROSTER_CLASS_MAGE:
         case ROSTER_CLASS_WARLOCK:
         case ROSTER_CLASS_PRIEST:
             $rightbox = 'spell';
             break;
     }
     $roster->tpl->assign_vars(array('EXP_WIDTH' => $expbar_width, 'EXP_TYPE' => $expbar_type, 'EXP_TEXT' => $expbar_text, 'RIGHTBOX' => $rightbox));
     // Print stat boxes
     $this->printBox('stats', 'left', true);
     $this->printBox('melee', 'left');
     $this->printBox('ranged', 'left');
     $this->printBox('spell', 'left');
     $this->printBox('defense', 'left');
     $this->printBox('stats', 'right');
     $this->printBox('melee', 'right', $rightbox == 'melee');
     $this->printBox('ranged', 'right', $rightbox == 'ranged');
     $this->printBox('spell', 'right', $rightbox == 'spell');
     $this->printBox('defense', 'right');
     // Buffs
     $this->printBuffs();
     // Pets
     $pet_num = $this->printPet();
     $roster->tpl->assign_var('S_PET_TAB', $pet_num);
     // Reputation
     $this->printReputation();
     // Skills
     $this->printSkills();
     // PvP
     $this->printHonor();
     // Print tabs
     $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['tab1'], 'VALUE' => 'tab1', 'SELECTED' => true));
     if ($roster->auth->getAuthorized($addon['config']['show_tab2']) && $pet_num) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['tab2'], 'VALUE' => 'tab2', 'SELECTED' => false));
     }
     if ($roster->auth->getAuthorized($addon['config']['show_tab3'])) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['tab3'], 'VALUE' => 'tab3', 'SELECTED' => false));
     }
     if ($roster->auth->getAuthorized($addon['config']['show_tab4'])) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['tab4'], 'VALUE' => 'tab4', 'SELECTED' => false));
     }
     if ($roster->auth->getAuthorized($addon['config']['show_tab5'])) {
         $roster->tpl->assign_block_vars('tabs', array('NAME' => $roster->locale->act['tab5'], 'VALUE' => 'tab5', 'SELECTED' => false));
     }
     $roster->tpl->set_filenames(array('char' => $addon['basename'] . '/char.html'));
     return $roster->tpl->fetch('char');
 }
Exemple #8
0
 /**
  * This method fetches and prepairs the data for the completed orders
  * The data is to be shown in datatable
  *
  * @return json encoded object of arrays
  */
 public function datatable_completed_orders_data()
 {
     $this->load->model('order_model');
     $this->load->helper('my_helper');
     $data = array();
     $orders = $this->order_model->get_all_records(['end_date IS NOT' => NULL, 'payment_status' => 'paid']);
     foreach ($orders as $order) {
         $order->store_table_info();
         $order->user_info();
         $diff = get_seconds_diff_from_dates($order->start_date, $order->end_date);
         array_push($data, [0 => $order->record_id, 1 => $order->store_table_info->caption, 2 => $order->user_info->lastname . ' ' . $order->user_info->firstname, 3 => $order->time_zone_greece($order->start_date, 'H:i:s'), 4 => $order->time_zone_greece($order->end_date, 'H:i:s'), 5 => seconds_to_time($diff), 6 => $order->calculate_total_cost(), 7 => '<a href="/orders/print_order_modal_form/' . $order->record_id . '" class="view-order btn btn-success btn-block" data-toggle="modal" data-target="#myModal"><i class="fa fa-print fa-fw fa-lg"></i>Εκτύπωση</a>']);
     }
     /* Create an object of arrays */
     $obj = (object) array();
     $obj->data = array_values($data);
     echo json_encode($obj);
 }
Exemple #9
0
            echo '
                <div class="alert forum-notice" title="Notice!">' . $noticeContents . '
                </div>';
        }
        // Check for a poll made in the last 3 days
        $poll = mysqli_fetch_array(mysqli_query($db, "SELECT `id`,`created`,`question` FROM `polls` WHERE `show_on_forum` = 1 ORDER BY `polls`.`id` DESC LIMIT 1 "), MYSQL_ASSOC);
        // Set time to that day to, 00h:00m, first thing in the morning so that the poll will disappear at midnight
        $pollDatetime = new DateTime('@' . $poll['created']);
        $pollDatetime->setTime(0, 0);
        $pollTimestamp = $pollDatetime->getTimestamp();
        // NUmber of seconds in 3 days, take away the time since the poll was created
        $timeLeft = 60 * 60 * 24 * 3 - (time() - $pollTimestamp);
        if ($timeLeft > 0) {
            echo '
                <div class="alert forum-notice" title="Notice!">
                    <small style="cursor:pointer" title="This will disappear when the time reaches 0" class="pull-right">' . seconds_to_time($timeLeft) . '</small>
                    <img src="images/emoji/normal-smilies/pstar.gif" alt="Pstar">
                    New Poll! 
                    <img src="images/emoji/normal-smilies/pstar.gif" alt="Pstar">
                    <a href="polls/' . $poll['id'] . '">' . $poll['question'] . '</a>

                </div>';
        }
    } else {
        if ($forumId == '2') {
            mysqli_query($db, "UPDATE committee_users SET commforum='" . time() . "' WHERE user='******'");
        }
    }
}
// Bug image that link to 404 forum
if ($forumId != '404') {
Exemple #10
0
/**
 * Turn a date into a time, a date, an "X minutes ago...", etc
 *
 * @retval string
 */
function autodate($date, $html = true)
{
    global $config;
    $format = $config->get_string('autodate_format', "F j, Y");
    $seconds = time() - strtotime($date);
    $ago = seconds_to_time($seconds) . " ago";
    $on = "on " . date($format, strtotime($date));
    if ($config->get_bool('use_autodate', true)) {
        return $html ? "<span title='{$on}'>{$ago}</span>" : $ago;
    } else {
        return $on;
    }
}
    $r[$i]['summary']['SUMMARY']['MHS av'] = isset($r[$i]['summary']['SUMMARY']['MHS av']) ? $r[$i]['summary']['SUMMARY']['MHS av'] : 0;
    $r[$i]['summary']['SUMMARY']['Accepted'] = isset($r[$i]['summary']['SUMMARY']['Accepted']) ? $r[$i]['summary']['SUMMARY']['Accepted'] : 0;
    $r[$i]['summary']['SUMMARY']['Rejected'] = isset($r[$i]['summary']['SUMMARY']['Rejected']) ? $r[$i]['summary']['SUMMARY']['Rejected'] : 0;
    $r[$i]['summary']['SUMMARY']['Hardware Errors'] = isset($r[$i]['summary']['SUMMARY']['Hardware Errors']) ? $r[$i]['summary']['SUMMARY']['Hardware Errors'] : 0;
    $r[$i]['summary']['SUMMARY']['Work Utility'] = isset($r[$i]['summary']['SUMMARY']['Work Utility']) ? $r[$i]['summary']['SUMMARY']['Work Utility'] : 0;
    $r[$i]['stats']['STATS0']['Elapsed'] = isset($r[$i]['stats']['STATS0']['Elapsed']) ? $r[$i]['stats']['STATS0']['Elapsed'] : 'N/A';
    $r[$i]['coin']['COIN']['Hash Method'] = isset($r[$i]['coin']['COIN']['Hash Method']) ? $r[$i]['coin']['COIN']['Hash Method'] : 'sha256';
    $invalid_ratio = 0;
    $wu_ratio = 0;
    if ($r[$i]['summary']['SUMMARY']['Accepted'] + $r[$i]['summary']['SUMMARY']['Rejected'] > 0) {
        $invalid_ratio = round($r[$i]['summary']['SUMMARY']['Rejected'] / ($r[$i]['summary']['SUMMARY']['Accepted'] + $r[$i]['summary']['SUMMARY']['Rejected']) * 100, 2);
    }
    if ($r[$i]['stats']['STATS0']['Elapsed'] == 'N/A') {
        $running = 'N/A';
    } else {
        $t = seconds_to_time($r[$i]['stats']['STATS0']['Elapsed']);
        $running = $t['d'] . 'd ' . $t['h'] . ':' . $t['m'] . ':' . $t['s'];
    }
    if ($r[$i]['summary']['SUMMARY']['MHS av'] > 0) {
        $wu_ratio = round($r[$i]['summary']['SUMMARY']['Work Utility'] / ($r[$i]['summary']['SUMMARY']['MHS av'] * 1000), 3);
        if ($wu_ratio < 0.9 && $t['d'] >= 1) {
            $wu_ratio = '<span class="error">' . $wu_ratio . '</span>';
        }
    }
    $hash_sum = $hash_sum + $r[$i]['summary']['SUMMARY']['MHS av'];
    $a_sum = $a_sum + $r[$i]['summary']['SUMMARY']['Accepted'];
    $r_sum = $r_sum + $r[$i]['summary']['SUMMARY']['Rejected'];
    $hw_sum = $hw_sum + $r[$i]['summary']['SUMMARY']['Hardware Errors'];
    $wu_sum = $wu_sum + $r[$i]['summary']['SUMMARY']['Work Utility'];
    ?>
		<tr>
function Minus_times( $firsttime, $secondtime )
{
$temp	=	time_to_seconds( $firsttime ) - time_to_seconds( $secondtime );

$Total	= seconds_to_time( $temp );

return $Total;
}
 function testSecondsMinutesHoursDaysYearsBoth()
 {
     $seconds = 60 * 60 * 24 * 365 + 60 * 60 * 24 + 80;
     $convert = seconds_to_time($seconds);
     $this->assertEquals($convert, '1 years, 1 days, 0:1:20');
 }
Exemple #14
0
 if (mysqli_num_rows($query)) {
     $user = mysqli_fetch_assoc($query);
     $registrationdate = mwdatetotimestamp($user["user_registration"]);
     $cuentaregistrada = $user["user_registration"] < $datetimemw ? true : false;
     if (isset($mincontribuciones)) {
         $query3 = mysqli_query($con, "SELECT null FROM revision_userindex rev JOIN page ON rev.rev_page = page.page_id WHERE rev.rev_user = "******"user_id"] . " AND rev.rev_timestamp < " . $datetimemw . ($espacioprincipalyanexo === true ? " AND page.page_namespace in (0, 104)" : "")) or die(mysqli_error($con));
         $contribuciones = mysqli_num_rows($query3);
         $contribucionescorrectas = $contribuciones < $mincontribuciones ? false : true;
         if (isset($minantiguedad)) {
             $query2 = mysqli_query($con, "SELECT rev_timestamp FROM revision_userindex WHERE rev_user = "******"user_id"] . " AND rev_timestamp < " . $datetimemw . " ORDER BY rev_timestamp ASC LIMIT 1") or die(mysqli_error($con));
             if (mysqli_num_rows($query2)) {
                 $rev = mysqli_fetch_assoc($query2);
                 $firstcontribdate = mwdatetotimestamp($rev["rev_timestamp"]);
                 $secondsago = $datetime - $firstcontribdate;
                 $antiguedadcorrecta = $secondsago > $minantiguedad ? true : false;
                 $antiguedad = seconds_to_time($firstcontribdate, $datetime);
             } else {
                 $antiguedad = 0;
                 $antiguedadcorrecta = false;
             }
         }
     }
 } else {
     $cuentaregistrada = false;
     if (isset($mincontribuciones)) {
         $contribucionescorrectas = false;
         $contribuciones = 0;
     }
     if (isset($minantiguedad)) {
         $antiguedadcorrecta = false;
         $antiguedad = 0;