示例#1
0
文件: user.php 项目: nishad/bmtmgr
function check_current()
{
    $user = get_current();
    if (!$user) {
        render_login_form();
        exit;
    }
    return $user;
}
$openinfoman = array('url' => 'http://localhost:8984/CSD/csr/CSD-Providers-Connectathon-20150120/careServicesRequest/urn:openhie.org:openinfoman-rapidpro:get_json_for_import/adapter/rapidpro/get');
$rapidpro = array('url' => 'https://rapidpro.io/api/v1/contacts.json', 'auth_token' => 'xxxxxxxsupersecretxxxxxxxx', 'group_name' => '');
if ($url = getenv('OPENINFOMAN_URL')) {
    $openinfoman['url'] = $url;
}
if ($tok = getenv('RAPIDPRO_AUTH_TOKEN')) {
    $rapidpro['auth_token'] = $tok;
}
if ($url = getenv('RAPIDPRO_URL')) {
    $rapidpro['url'] = $url;
}
if ($group_name = getenv('RAPIDPRO_GROUP_NAME')) {
    $rapidpro['group_name'] = $group_name;
}
if (!($contacts_text = file_get_contents($openinfoman['url'])) || !is_array($contacts_json_full = json_decode($contacts_text, true)) || !array_key_exists('contacts', $contacts_json_full) || !is_array($contacts_json = $contacts_json_full['contacts']) || !is_array($current = get_current($rapidpro))) {
    if (array_key_exists('HTTP_HOST', $_SERVER)) {
        header('HTTP/1.1 401 Unauthorized', true, 401);
    }
    die("Could not do it. Sorry.");
}
$records = generate_records($contacts_json, $current, $rapidpro);
foreach ($records as $record) {
    $data_string = json_encode($record, JSON_NUMERIC_CHECK);
    $ch = curl_init($rapidpro['url']);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Token ' . $rapidpro['auth_token'], 'Content-Length: ' . strlen($data_string)));
    $result = curl_exec($ch);
    $result = json_decode($result, true);
示例#3
0
    $max = find_max($lines, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
    return $max;
}
function get_pattern($line)
{
    global $start;
    // Set up specific patter matches for extracting book versions
    $match = array();
    $match = array(array('pkg' => 'automoc', 'regex' => "/^.*automoc4-(\\d[\\d\\.]+).*\$/"), array('pkg' => 'polkit-qt', 'regex' => "/^.*polkit-qt-1-(\\d[\\d\\.]+).*\$/"), array('pkg' => 'polkit-kde-agent', 'regex' => "/^.*polkit-kde-agent-1-(\\d[\\d\\.]+).*\$/"));
    foreach ($match as $m) {
        $pkg = $m['pkg'];
        if (preg_match("/{$pkg}/", $line)) {
            return $m['regex'];
        }
    }
    return "/\\D*(\\d.*\\d)\\D*\$/";
}
get_current();
// Get what is in the book
// Get latest version for each package
foreach ($book as $pkg => $data) {
    $book_index = $pkg;
    $base = $data['basename'];
    $url = $data['url'];
    $bver = $data['version'];
    echo "book index: {$book_index} {$bver} {$url}\n";
    $v = get_packages($book_index, $url);
    $vers[$book_index] = $v;
}
html();
// Write html output
            $_SESSION['total_items'] = total_items($_SESSION['cart']);
            $_SESSION['total_price'] = total_price($_SESSION['cart']);
            header ('Location: index.php?view=product&id='.$id);
        
        break;

        case 'clear_cart':
            clear_cart();
            $_SESSION['total_items']=0;
            $_SESSION['total_price']='0.00';
            header('Location: index.php?view=cart');

    break;
    case 'change_currency':
        
        $_SESSION['currency']= get_current($_POST['curr']);

        echo $_POST['curr'];
        echo $_SESSION['currency']['name'];

//            foreach ($_POST['curr'] as $key => $value);
//                echo "the value of the $key is ".$value;
//        header('Location:'. $_SERVER['HTTP_REFERER'] );
        

    break;
        
        case ('update_cart'):
            update_cart();
            $_SESSION['total_items'] = total_items($_SESSION['cart']);
            $_SESSION['total_price'] = total_price($_SESSION['cart']);
    //	snap(__LINE__, basename(__FILE__));
    do_login(basename(__FILE__));
    $do_mu_init = array_key_exists('log_in', $_GET) ? "parent.frames['upper'].mu_init();" : "";
    // start multi-user function, 3/15/11
}
if ($istest) {
    print "GET<BR/>\n";
    if (!empty($_GET)) {
        dump($_GET);
    }
    print "POST<BR/>\n";
    if (!empty($_POST)) {
        dump($_POST);
    }
}
$remotes = get_current();
// returns array - 3/16/09
//snap(basename(__FILE__), __LINE__);
// set auto-refresh if any mobile units
$interval = intval(get_variable('auto_poll'));
$refresh = ($remotes['aprs'] || $remotes['instam']) && $interval > 0 ? "\t<META HTTP-EQUIV='REFRESH' CONTENT='" . intval($interval * 60) . "'>\n" : "";
//10/4/08
$temp = get_variable('auto_poll');
// 1/28/09
$poll_val = $temp == 0 ? "none" : $temp;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>Tickets - Full Screen Module</TITLE>
<?php 
示例#6
0
								<li class="site-menu-item <?php 
get_current('workplace');
?>
"><a href="<?php 
get_url('workplace');
?>
workplace.php" tabindex="5">Workplace</a></li>
								<li class="site-menu-item <?php 
get_current('publications');
?>
"><a href="<?php 
get_url('publications');
?>
publications.php" tabindex="6">Publications</a></li>
								<li class="site-menu-item <?php 
get_current('contact');
?>
"><a href="<?php 
get_url('contact');
?>
contact.php" tabindex="7">Contact</a></li>
							</ul>
						</nav>
					</div>
					
				</div>
			</div>
			<!-- end container -->
			<div class="break">
				
			</div>
    $start = strtotime($step, $start);
  }
  return $dates;
}

function get_current($period) {
  return date(get_date_format($period));
}

$date_start = strtotime($_GET["date_start"]);
$date_stop = strtotime($_GET["date_stop"]);
$date_step = $_GET["date_step"];
$metric = $_GET["metric"];
$dates = get_date_span($date_start, $date_stop, $date_step);
$dates = array_reverse($dates);
$current = get_current($date_step);
try {
  $sys = new ColumnFamily(cassandra_connect("fo"), "systems");
  $agg = new ColumnFamily(cassandra_connect("metrics"), "agg");
  $sys->read_consistency_level = cassandra_ConsistencyLevel::ONE;
  $agg->read_consistency_level = cassandra_ConsistencyLevel::ONE;
  if($_GET["load"] == "all") {
    $systems = array();
    $r = $sys->get_range("", "", $row_count=200, $columns=array("status"));
    foreach($r as $system => $info) $systems[] = $system;
  } else {
    $systems = explode(",", $_GET["load"]);
  }
  $keys = array();
  $totals = array();
  foreach($systems as $system) {