Beispiel #1
0
function bigtouch_theme_action_icon($url, $image_url, $text)
{
    $image_url = str_replace('.png', 'L.png', $image_url);
    $image_url = str_replace('.gif', 'L.png', $image_url);
    if ($text == 'MAP') {
        return "<a href='{$url}' alt='{$text}' target='" . get_target() . "'><img src='{$image_url}' width='24' height='24' /></a>";
    }
    return "<a href='{$url}'><img src='{$image_url}' alt='{$text}' width='24' height='24' /></a>";
}
Beispiel #2
0
function touch_theme_action_icon($url, $image_url, $text)
{
    if ($text == 'MAP') {
        return "<a href='{$url}' target='" . get_target() . "'><img src='{$image_url}' alt='{$text}' width='12' height='12' /></a>";
    } else {
        if ($text == 'DM') {
            return "<a href='{$url}'><img src='{$image_url}' alt='{$text}' width='16' height='11' /></a>";
        } else {
            return "<a href='{$url}'><img src='{$image_url}' alt='{$text}' width='12' height='12' /></a>";
        }
    }
}
Beispiel #3
0
function theme_action_icon($url, $display, $text)
{
    //	If the user doesn't want icons, display as text
    if ('yes' !== setting_fetch('menu_icons')) {
        $display = $text;
        $class = "action-text";
    } else {
        $class = "action";
    }
    // Maps open in a new tab
    if ($text == 'Location') {
        return "<a href='{$url}' target='" . get_target() . "' class='{$class}'>{$display}</a>";
    }
    //	Verified ticks & RT notifications don't need to be linked
    if ("Verified" == $text || "retweeted" == $text) {
        return "<span class='{$class}' title='{$text}'>{$display}</span>";
    }
    // if (0 === strpos($image_url, "images/"))
    // {
    //     return "<a href='$url'><img src='$image_url' alt='$text' /></a>";
    // }
    return "<a href='{$url}' class='{$class}' title='{$text}'>{$display}</a>";
}
Beispiel #4
0
function sync_horse($target_id, $product_id)
{
    $rt = array();
    $rt['query_status'] = 0;
    $rt['query_msg'] = '';
    $rt['so_sql'] = '';
    $product = get_product($product_id);
    $target = get_target($target_id);
    // first create workflow_object if workflow_object is not there
    $sql = sprintf("SELECT * FROM horse WHERE product_id = %d AND target_id = %d", $product_id, $target_id);
    $st = mysql_query($sql);
    $h = mysql_fetch_array($st);
    if (!$h || empty($h['workflow_object_id'])) {
        // Create workflow_object
        $sql = sprintf("INSERT INTO workflow_object (workflow_id, start_time, status)\n\t\t\t\t\t\t\tSELECT workflow_id, NULL, %d FROM product WHERE id = %d", WAITING, $product_id);
        $st = mysql_query($sql);
        $rt['query_status'] = $st ? $rt['query_status'] : 1;
        $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem creating workflow_object:" . mysql_error();
        $workflow_object_id = mysql_insert_id();
    } else {
        $workflow_object_id = $h['workflow_object_id'];
        // also need to check whether this workflow_object is for the workflow we are syncing.
        // If not, we need to create new workflow_object and update horse, remove this orphan workflow_object
        $sql = sprintf("SELECT wo.workflow_id FROM workflow_object wo, product p WHERE wo.workflow_id = p.workflow_id AND wo.id = %d AND p.id = %d", $workflow_object_id, $product_id);
        $st = mysql_query($sql);
        $wo = mysql_fetch_array($st);
        if (!$wo || empty($wo['workflow_id'])) {
            // the existing workflow_object_id in the horse is not used anymore
            // create workflow_object
            $sql = sprintf("INSERT INTO workflow_object (workflow_id, start_time, status)\n\t\t\t\t\t\t\t\t\tSELECT workflow_id, NULL, %d FROM product WHERE id = %d", WAITING, $product_id);
            $st = mysql_query($sql);
            $workflow_object_id = mysql_insert_id();
            // update horse for the new workflow_object_id
            $sql = sprintf("UPDATE horse SET workflow_object_id = %d WHERE  product_id = %d AND target_id = %d", $workflow_object_id, $product_id, $target_id);
            $st = mysql_query($sql);
        }
    }
    $rt['wo_sql'] = $sql;
    $rt['workflow_object_id'] = $workflow_object_id;
    // create sequence_object entries if it is not there
    $sql = sprintf("SELECT wo.workflow_id, wo.id AS workflow_object_id, ws.id AS workflow_sequence_id, so.id AS sequence_object_id   \n\t\t\t\t\t\tFROM workflow_object wo\n\t\t\t\t\t\tINNER JOIN workflow_sequence ws ON ws.workflow_id = wo.workflow_id\n\t\t\t\t\t\tLEFT JOIN sequence_object so ON wo.id = so.workflow_object_id AND ws.id = so.workflow_sequence_id\n\t\t\t\t\t\tWHERE wo.id = %d", $workflow_object_id);
    $st = mysql_query($sql);
    if (mysql_num_rows($st) == 0) {
        // new workflow object, need to create one sequence_object for each
        $sql = sprintf("INSERT INTO sequence_object (workflow_object_id, workflow_sequence_id, status)\n\t\t\t\t\t\t\tSELECT %d, workflow_sequence.id, 0 FROM workflow_sequence, workflow_object\n\t\t\t\t\t\t\t\tWHERE workflow_sequence.workflow_id = workflow_object.workflow_id\n\t\t\t\t\t\t\t\t\tAND workflow_object.id = %d", $workflow_object_id, $workflow_object_id);
        $wo_st = mysql_query($sql);
        $rt['query_status'] = $wo_st ? $rt['query_status'] : 1;
        $rt['query_msg'] = $wo_st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem creating sequence_object:" . mysql_error();
        $rt['so_sql'] = $sql;
    } else {
        // loop through to see any new sequence created
        while ($workflow = @mysql_fetch_assoc($st)) {
            if (empty($workflow['sequence_object_id'])) {
                // create sequence_object
                $so_sql = sprintf("INSERT INTO sequence_object ( workflow_object_id, workflow_sequence_id, status )\n\t\t\t\t\t\t\t\t\t\tVALUES ( %d, %d, 0)", $workflow['workflow_object_id'], $workflow['workflow_sequence_id']);
                $so_st = mysql_query($so_sql);
                if (!$so_st) {
                    get_out(1, "Failed to create sequence_object for workflow_object_id " . $workflow['workflow_object_id'] . " workflow_sequence_id " . $workflow['workflow_sequence_id'], $so_sql, mysql_error());
                } else {
                    $workflow['sequence_object_id'] = mysql_insert_id();
                }
            }
        }
    }
    // check and create goal_object entries
    $sql = sprintf("SELECT go.id AS goal_object_id, g.id AS goal_id, so.workflow_sequence_id, so.id AS sequence_object_id\n\t\t\t\t\t\tFROM sequence_object so\n\t\t\t\t\t\tINNER JOIN goal g ON g.workflow_sequence_id = so.workflow_sequence_id\n\t\t\t\t\t\tLEFT JOIN goal_object go ON g.id = go.goal_id AND go.sequence_object_id = so.id\n\t\t\t\t\t\tWHERE so.workflow_object_id = %d", $workflow_object_id);
    $st = mysql_query($sql);
    $rt['query_status'] = $st ? $rt['query_status'] : 1;
    while ($go = mysql_fetch_assoc($st)) {
        if (empty($go['goal_object_id'])) {
            // need to create goal_object
            $sql = sprintf("INSERT INTO goal_object (goal_id, status, sequence_object_id )\n\t\t\t\t\t\t\t\tVALUES ( %d, 0, %d)", $go['goal_id'], $go['sequence_object_id']);
            $st1 = mysql_query($sql);
            $rt['query_status'] = $st ? $rt['query_status'] : 1;
            $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem creating goal_object:" . mysql_error();
            $rt['so_sql'] .= " " . $sql;
        }
    }
    // check again if this is a new horse
    if ($h) {
        // this is an old horse, we can get out now
        $rt['horse_id'] = $h['id'];
        return $rt;
    }
    // we can create horse now, since content_header is not created yet, use 0 for now
    $sql = sprintf("INSERT INTO horse (product_id, target_id, start_time, content_header_id, workflow_object_id)\n\t\t\t\t\t\tVALUES ( %d, %d, NULL, 0, %d)", $product_id, $target_id, $workflow_object_id);
    $st = mysql_query($sql);
    $rt['query_status'] = $st ? $rt['query_status'] : 1;
    $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem creating horse:" . mysql_error();
    $horse_id = mysql_insert_id();
    $rt['h_sql'] = $sql;
    $rt['horse_id'] = $horse_id;
    // create content header record
    $sql = sprintf("INSERT INTO content_header (project_id, content_type, content_object_id, horse_id, title, create_time, status)\n\t\t\t\t\t\tVALUES (%d, %d, 0, %d, '%s', now(), 0)", $product['project_id'], $product['content_type'], $horse_id, $target['short_name'] . " - " . $product['name']);
    $st = mysql_query($sql);
    $rt['query_status'] = $st ? $rt['query_status'] : 1;
    $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem creating content_header:" . mysql_error();
    $content_header_id = mysql_insert_id();
    $rt['ch_sql'] = $sql;
    $rt['content_header_id'] = $content_header_id;
    // update horse with newly generated content_header_id
    $sql = sprintf("UPDATE horse SET content_header_id = %d WHERE id = %d", $content_header_id, $horse_id);
    $st = mysql_query($sql);
    $rt['query_status'] = $st ? $rt['query_status'] : 1;
    $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem updating horse: " . mysql_error();
    // create content object
    if ($product['content_type'] == JOURNAL) {
        // create entry in journal_content_object
        $sql = sprintf("INSERT INTO journal_content_object (content_header_id, body, journal_config_id) VALUES (%d, null, %d)", $content_header_id, $product['product_config_id']);
        $st = mysql_query($sql);
        $rt['query_status'] = $st ? $rt['query_status'] : 1;
        $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem creating  journal_content_object: " . mysql_error();
        $content_object_id = mysql_insert_id();
        $rt['jco_sql'] = $sql;
        // update content header using newly generated content_object_id
        $sql = sprintf("UPDATE content_header SET content_object_id = %d WHERE id = %d", $content_object_id, $content_header_id);
        $st = mysql_query($sql);
        $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem updating content_header: " . mysql_error();
    } else {
        // survey type, create survey_content_object entry
        $sql = sprintf("INSERT INTO survey_content_object (content_header_id, survey_config_id) VALUES ( %d, %d)", $content_header_id, $product['product_config_id']);
        $st = mysql_query($sql);
        $rt['query_status'] = $st ? $rt['query_status'] : 1;
        $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem creating content_header: " . mysql_error();
        $content_object_id = mysql_insert_id();
        $rt['sco_sql'] = $sql;
        // update content header using newly generated content_object_id
        $sql = sprintf("UPDATE content_header SET content_object_id = %d WHERE id = %d", $content_object_id, $content_header_id);
        $st = mysql_query($sql);
        $rt['query_status'] = $st ? $rt['query_status'] : 1;
        $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem updating content_header: " . mysql_error();
        // create survey_answer entries
        $sql = sprintf("INSERT INTO survey_answer (survey_content_object_id, survey_question_id, answer_object_id, answer_user_id)\n\t\t\t\t\t\t\tSELECT %d, id, null, null FROM survey_question\n\t\t\t\t\t\t\t\tWHERE survey_config_id = %d", $content_object_id, $product['product_config_id']);
        $st = mysql_query($st);
        $rt['query_status'] = $st ? $rt['query_status'] : 1;
        $rt['query_msg'] = $st ? $rt['query_msg'] : $rt['query_msg'] . ". Problem creating survey_answer entries: " . mysql_error();
        $rt['sa_sql'] = $sql;
    }
    $rt['content_object_id'] = $content_object_id;
    return $rt;
}
Beispiel #5
0
function theme_action_icon($url, $image_url, $text)
{
    // alt attribute left off to reduce bandwidth by about 720 bytes per page
    if ($text == 'MAP') {
        return "<a href='{$url}' alt='{$text}' target='" . get_target() . "'><img src='{$image_url}' /></a>";
    }
    return "<a href='{$url}'><img src='{$image_url}' alt='{$text}' /></a>";
}
Beispiel #6
0
    $date_field = $file_info['date_field'];
    $code_field = $file_info['code_field'];
    $result_field = $file_info['result_field'];
    $date_str = $file_info['date_str'];
    $link = start_nchsls();
    $uploaddir = '/';
    $uploadfile = $uploaddir . basename($_FILES['import_file']['name']);
    echo 'uploading from:' . $uploadfile . '<br>';
    echo '<pre>';
    if ($handle = fopen($_FILES['import_file']['tmp_name'], "r")) {
        while (($data = fgetcsv($handle, 0, $delimiter)) !== FALSE) {
            print_r($data);
            if (isset($data[$sample_id_field]) && isset($data[$code_field]) && isset($data[$result_field]) && isset($data[$repeat_id_field]) && isset($data[$date_field])) {
                if (is_str_interger($data[$sample_id_field]) && is_str_num($data[$result_field]) && $data[$result_field] > 0) {
                    if ($data[$sample_id_field] > 500000000 && $data[$sample_id_field] < 599999999 || $data[$sample_id_field] > 800000000 && $data[$sample_id_field] < 899999999) {
                        $qc_value = get_target($data[$sample_id_field], $equipment_name, $data[$code_field]);
                        $sql = 'insert into qc (equipment_name,sample_id,repeat_id,time_data,code,result,target,sd,lot,comment) values (
							\'' . $equipment_name . '\' ,									
							\'' . $data[$sample_id_field] . '\' ,				
							\'' . $data[$repeat_id_field] . '\' ,				
							str_to_date(\'' . $data[$date_field] . '\',\'' . $date_str . '\'),
							\'' . $data[$code_field] . '\' ,
							\'' . $data[$result_field] . '\' ,						
							\'' . $qc_value['target'] . '\' , 
							\'' . $qc_value['sd'] . '\' ,
							\'' . $qc_value['lot'] . '\' ,
							\'1\')';
                        echo '<br>' . $sql;
                        if (!($result = mysql_query($sql, $link))) {
                            echo 'insert error:' . mysql_error();
                            $sql_update = 'update qc set 
Beispiel #7
0
function twitter_status_page($query)
{
    $id = (string) $query[1];
    if (is_numeric($id)) {
        $cb = get_codebird();
        $api_options = "id={$id}";
        $status = $cb->statuses_show_ID($api_options);
        twitter_api_status($status);
        $text = $status->text;
        //	Grab the text before it gets formatted
        $content = theme('status', $status);
        //	Show a link to the original tweet
        $screen_name = $status->from->screen_name;
        $content .= '<p>
		                <a href="https://twitter.com/' . $screen_name . '/status/' . $id . '" target="' . get_target() . '">View original tweet on Twitter</a> | ';
        //	Translate the tweet
        $content .= '   <a href="https://translate.google.com/m?hl=en&sl=auto&ie=UTF-8&q=' . urlencode($text) . '" target="' . get_target() . '">Translate this tweet</a>
		            </p>';
        $content .= "<p>\n\t\t                <strong>\n\t\t                    <a href=\"https://mobile.twitter.com/{$screen_name}/status/{$id}/report\" target=\"" . get_target() . "\">\n\t\t                        Report Abusive Tweet\n\t\t                    </a>\n\t\t                </strong>\n\t\t            </p>";
        /* NO LONGER SUPPORTED WITH THE MOVE TO 1.1
        		if (!$status->user->protected) {
        			$thread = twitter_thread_timeline($id);
        		}
        		if ($thread) {
        			$content .= '<p>And the experimental conversation view...</p>'.theme('timeline', $thread);
        			$content .= "<p>Don't like the thread order? Go to <a href='settings'>settings</a> to reverse it. Either way - the dates/times are not always accurate.</p>";
        		}
        		*/
        theme('page', "{$screen_name} Status {$id}", $content);
    }
}
Beispiel #8
0
        $trackpoint_end = "</Trackpoint>";
        $data_line = $trackpoint_line . $time_line . $position_line . $latitude_line . $longitude_line . $position_close . $altitude_line . $distance_line . $heartrate_line . $value_line . $heartrate_close . $cadence_line . $extensions_open . $watts_line . $extensions_close . $trackpoint_end;
    }
    return $data_line;
}
/***************
END FUNCTIONS
***************/
ini_set('user_agent', '[your app name here]');
//Strava says they like it if you use a user-agent name
//PHONY USER INPUTS
//these are where your user-provided data go.
$file_type = 'GPX';
$user_url = 'http://app.strava.com/rides/13969368';
//PARSING SUBMISSIONS, ASKING FOR API DATA
$target_array = get_target($user_url);
//CHECKING THE RESPONSE FROM STRAVA
check_response($target_array[stream], $target_array[id]);
//SELECTING THE DATA I WANT
$ride_data_array = loop_setup($file_type, $target_array);
//ASSEMBLING A HEADER FOR THE APPROPRIATE FILETYPE
$header = add_header($file_type, $ride_data_array);
//GETTING DATA FOR EACH POINT ON THE STRAVA TARGET
$stream_data = api_call($target_array[id], $target_array[stream]);
//SETTING INITIAL VALUES FOR THE LOOP
$trackpoints = '';
$start_epoch = gps_to_epoch($ride_data_array[ride_date]);
if ($target_array[object] === 'segment') {
    //segments have no time stamps
    $stop_at = count($stream_data->latlng) - 1;
} else {
Beispiel #9
0
function twitter_status_page($query)
{
    $id = (string) $query[1];
    if (is_numeric($id)) {
        $api_options = "id={$id}";
        $status = execute_codebird("statuses_show_ID", $api_options);
        $text = $status->text;
        //	Grab the text before it gets formatted
        $content = theme('status', $status);
        //	Show a link to the original tweet
        $screen_name = $status->from->screen_name;
        $content .= '<p>
		                <a href="https://twitter.com/' . $screen_name . '/status/' . $id . '" target="' . get_target() . '">' . _(LINK_VIEW_ORIGINAL) . '</a> | ';
        //	Translate the tweet
        $content .= '   <a href="https://translate.google.com/m?hl=en&sl=auto&ie=UTF-8&q=' . urlencode($text) . '" target="' . get_target() . '">' . _(LINK_TRANSLATE) . '</a>
		            </p>';
        $content .= "<p>\n\t\t                <strong>\n\t\t                    <a href=\"https://mobile.twitter.com/{$screen_name}/status/{$id}/report\" " . "target=\"" . get_target() . "\">" . _(LINK_ABUSE) . "</a>\n\t\t                </strong>\n\t\t            </p>";
        theme('page', "{$screen_name} - {$id}", $content);
    }
}
Beispiel #10
0
function page_menu()
{
    global $menu;
    global $html_dir;
    $menu2 = $menu;
    // bug in php 5.1.6 (redhat 5.2)
    $position = get_menu_entry();
    $parent = $menu2[$position]['parent'];
    if ($parent == Null) {
        $parent = $position;
    } elseif (is_array($parent)) {
        $parent = $parent[0];
    }
    echo '<table border="0" cellspacing="0" cellpadding="10">';
    echo '<tr>';
    $first = true;
    foreach ($menu2 as $id => $entrie) {
        if (count($entrie['parent']) > 0) {
            continue;
        }
        if (!isset($entrie['always_display']) && get_nb_child($id) == 0) {
            continue;
        }
        echo '<td style="min-width: 60px; height: 81px; text-align: center; vertical-align: middle;';
        if ($id == $parent) {
            if ($html_dir === 'ltr') {
                if ($first !== true) {
                    echo ' border-left: 1px solid  #ccc;';
                }
                echo ' background: #eee; border-right: 1px solid #ccc; border-bottom: 0px;';
            } else {
                if ($first !== true) {
                    echo ' border-right: 1px solid  #ccc;';
                }
                echo ' background: #eee; border-left: 1px solid #ccc; border-bottom: 0px;';
            }
        } else {
            echo ' border-bottom: 1px solid #ccc;';
        }
        if (isset($entrie['mod'])) {
            $img = '' . $entrie['mod'] . '/media/image/menu_' . $entrie['mod_id'] . '.png';
        } else {
            $img = 'media/image/menu/' . $id . '.png';
        }
        echo '" class="menu"><a href="' . ROOT_ADMIN_URL . '/' . get_target($id) . '"><img src="' . ROOT_ADMIN_URL . '/' . $img . '" width="32" height="32" alt="' . $entrie['name'] . '" title="' . $entrie['name'] . '" /><br />';
        echo '<span class="menulink';
        if ($id == $parent) {
            echo '_active';
        }
        echo '">' . $entrie['name'] . '</span></a></td>' . "\n";
        $first = false;
    }
    echo '</tr>';
    echo '</table>';
}
Beispiel #11
0
	</head>
	<body>
		<?php 
echo '<div id = "page">';
include_once 'header.php';
if ($login == True) {
    try {
    } catch (Exception $e) {
        echo $e;
    }
    if (!isset($_GET['user'])) {
        $target_username = $username;
    } else {
        $target_username = mysql_real_escape_string($_GET['user']);
    }
    $target = get_target();
    if (!isset($_GET['user'])) {
        header('Location: main.php?user='******'user'];
    }
    echo '<div id="main">';
    $chandle = mysql_connect($dbhost, $dbusername, $dbpassword);
    mysql_select_db($dbname, $chandle);
    //View user's profile
    if ($target_username == $username) {
        $user_info_m = mysql_query("SELECT * FROM users WHERE Username = '******'", $chandle);
        $user_info_o = mysql_fetch_object($user_info_m);
        $cur_jobs = $user_info_o->Jobs;
        echo '<div id = "user_info">';
Beispiel #12
0
			                 VALUES (	\'' . $_POST['equipment_name'] . '\', 
										\'' . $sample_id_normal . '\', 
										0,
										\'' . strftime('%Y-%m-%d %H:%M:%S') . '\',
										\'' . $_POST['code'] . '\',
										\'' . $_POST['qc_normal'] . '\',
										\'' . $qc_data['target'] . '\',
										\'' . $qc_data['sd'] . '\',
										\'' . $qc_data['lot'] . '\' ,
										\'1\')';
            //echo $sqln;
            $result = mysql_query($sqln, $link);
            echo mysql_error();
        }
        if (is_str_num($_POST['qc_abnormal'])) {
            $qc_data = get_target($sample_id_abnormal, $_POST['equipment_name'], $_POST['code']);
            $sqla = 'INSERT INTO qc (`equipment_name`, `sample_id`, `repeat_id`, `time_data`, `code`, `result`, `target`, `sd`,lot, `comment`) 
			                 VALUES (	\'' . $_POST['equipment_name'] . '\', 
										\'' . $sample_id_abnormal . '\', 
										0,
										\'' . strftime('%Y-%m-%d %H:%M:%S') . '\',
										\'' . $_POST['code'] . '\',
										\'' . $_POST['qc_abnormal'] . '\',
										\'' . $qc_data['target'] . '\',
										\'' . $qc_data['sd'] . '\',
										\'' . $qc_data['lot'] . '\' ,
										\'\')';
            //echo $sqla;
            $result = mysql_query($sqla, $link);
            echo mysql_error();
        }
Beispiel #13
0
function theme_action_icon($url, $display, $text)
{
    //	If the user doesn't want icons, display as text
    if ('yes' !== setting_fetch('dabr_show_icons', 'yes')) {
        $display = $text;
        $class = "action-text";
    } else {
        $class = "action";
    }
    // Maps open in a new tab
    if ($text == _(PROFILE_LOCATION)) {
        return "<a href='{$url}' target='" . get_target() . "' class='{$class}'>{$display}</a>";
    }
    //	Verified ticks & RT notifications don't need to be linked
    if (_(VERIFIED) == $text || _(RETWEETED) == $text) {
        return "<span class='{$class}' title='{$text}'>{$display}</span>";
    }
    return "<a href='{$url}' class='{$class}' title='{$text}'>{$display}</a>";
}