Example #1
0
 /** */
 function AddMeas($row)
 {
     //{{{
     $this->fStartTime = strtotime($row['start_time']);
     $this->fStopTime = strtotime($row['stop_time']);
     $this->fTimeDiff = dateTimeDiff($this->fStartTime, $this->fStopTime);
     $this->fType = $row['type'];
     $this->fBeamEnergy = $row['beam_energy'];
     global $POLARIMETER_ID, $HJ_POLARIMETER_ID;
     $polId = $row['polarimeter_id'];
     $ringId = $row['ring_id'];
     $this->fTargetOrients[$polId] = is_null($row['target_orient']) ? -1 : $row['target_orient'];
     $this->fTargetIds[$polId] = is_null($row['target_id']) ? -1 : $row['target_id'];
     if (array_key_exists($polId, $POLARIMETER_ID)) {
         //if ($row['polar_err'] >= 0) //!isset($this->fPCPolars[$polId]) ) // assign values once (ignore two target orientations)
         //{
         $this->fPCPolars[$polId] = new pair($row['polar'], $row['polar_err']);
         $this->fPCPolarP0s[$polId] = new pair($row['polar_p0'], $row['polar_p0_err']);
         // invalidate polar slope if it does not exist
         if ($row['polar_slope'] == 0 && $row['polar_slope_err'] == 0) {
             $this->fPCPolarSlopes[$polId] = new pair(0, -1);
         } else {
             $this->fPCPolarSlopes[$polId] = new pair($row['polar_slope'], $row['polar_slope_err']);
         }
         //$this->fPCProfRs[$polId]      = new pair($row['prof_r'], $row['prof_r_err']);
         //print "<br>{$this->fFillId}<br>$polId: ".print_r($this->fPCPolars[$polId]);
         //}
         $tgtOrient = $this->fTargetOrients[$polId];
         if ($tgtOrient >= 0) {
             $this->fPCProfRs[$polId][$tgtOrient] = new pair($row['prof_r'], $row['prof_r_err']);
             $this->fPCProfR0s[$polId][$tgtOrient] = new pair($row['prof_r0'], $row['prof_r0_err']);
             $this->fPCProfRSlopes[$polId][$tgtOrient] = new pair($row['prof_rslope'], $row['prof_rslope_err']);
             $this->fBeamProfRs[$ringId][$tgtOrient] = calcWeigtedAvrgErrPairs($this->fBeamProfRs[$ringId][$tgtOrient], $this->fPCProfRs[$polId][$tgtOrient]);
             $this->fBeamProfR0s[$ringId][$tgtOrient] = calcWeigtedAvrgErrPairs($this->fBeamProfR0s[$ringId][$tgtOrient], $this->fPCProfR0s[$polId][$tgtOrient]);
             $this->fBeamProfRSlopes[$ringId][$tgtOrient] = calcWeigtedAvrgErrPairs($this->fBeamProfRSlopes[$ringId][$tgtOrient], $this->fPCProfRSlopes[$polId][$tgtOrient]);
         }
     } else {
         if ($polId == $HJ_POLARIMETER_ID) {
             $this->fHJPolars[$ringId] = new pair($row['polar'], $row['polar_err']);
         }
     }
     //print "<br>".count($this->fPCPolars);
     //print " ".count($this->fHJPolars);
 }
Example #2
0
 $current_page = $pagination[0]['current_page'];
 $total_records = $pagination[0]['total_records'];
 $next_page = $pagination[0]['next_page'];
 $prev_page = $pagination[0]['prev_page'];
 $nl = $pagination[0]['nl'];
 $pl = $pagination[0]['pl'];
 $result_featured = array();
 $sql = "SELECT {$which_query_rows} FROM blogs WHERE category_id = '{$blog_category}' AND approved='yes' ORDER BY indexer DESC LIMIT {$set_limit}, {$limit}";
 $query = @mysql_query($sql);
 while ($result1 = @mysql_fetch_array($query)) {
     $blog_owner = mysql_real_escape_string($result1['blog_owner']);
     $user_id = mysql_real_escape_string($result1['user_id']);
     $blog_id = mysql_real_escape_string($result1['indexer']);
     $pagi_link = mysql_real_escape_string($result1['category']);
     // change db time date to 2 days ago 12 mins ago etc
     $change_date = dateTimeDiff($result1['date_created']);
     $result1['date_created'] = $change_date;
     // select any replies to blog article IF any
     $sql2 = "SELECT indexer FROM blog_replys WHERE blog_id = {$blog_id}";
     $query2 = @mysql_query($sql2);
     $reply_number = @mysql_num_rows($query2);
     $reply_array = array('replies' => $reply_number);
     // get rating stars
     $id = mysql_real_escape_string($result1['indexer']);
     include 'stars_include.php';
     $stars_array = array('star1' => $star1, 'star2' => $star2, 'star3' => $star3, 'star4' => $star4, 'star5' => $star5);
     // get blog member photo
     $a1_sql = "SELECT file_name, approved FROM pictures WHERE user_id = {$user_id}";
     $a1_result = @mysql_query($a1_sql);
     if (@mysql_num_rows($a1_result) != 0) {
         $a1_result = @mysql_fetch_array($a1_result);
Example #3
0
    // get videos by member
    $sql = "SELECT indexer FROM videos WHERE user_id = {$member_id} AND approved='yes'";
    $membersvideos = mysql_num_rows(mysql_query($sql));
    $membersvideos_array = array('membersvideos' => $membersvideos);
    // getmembers favs
    $sql = "SELECT indexer FROM favorites WHERE user_id = {$member_id}";
    $membersfavs = mysql_num_rows(mysql_query($sql));
    $membersfavs_array = array('membersfavs' => $membersfavs);
    // getmembers friends
    $sql = "SELECT * FROM friends WHERE user_id = {$member_id} AND invitation_status = 'accepted' OR friends_id = {$member_id} AND invitation_status = 'accepted'";
    $membersfriends = mysql_num_rows(mysql_query($sql));
    $membersfriends_array = array('membersfriends' => $membersfriends);
    // get last seen / active
    $sql = "SELECT * FROM member_profile WHERE account_status = 'active' AND user_id = {$member_id}";
    $db_date = $result['last_seen'];
    $change_date = dateTimeDiff($db_date);
    $result['last_seen'] = $change_date;
    if ($db_date == '0000-00-00 00:00:00') {
        $result['last_seen'] = $lang_never;
    }
    $last_seen_array = array('member_last_seen' => $result['last_seen']);
    // count member_profile comments
    $sql = "SELECT indexer FROM profilecomments WHERE members_id = {$member_id} ORDER BY indexer DESC ";
    $member_comments = mysql_num_rows(mysql_query($sql));
    $member_comments_array = array('member_comments' => $member_comments);
    // merge arrays
    $merged_array = array_merge($membersvideos_array, $result, $membersfavs_array, $membersfriends_array, $picture_array, $thumb_new_width_array, $thumb_new_height_array, $last_seen_array, $member_comments_array);
    $members_full[] = $merged_array;
}
// end while
if ($sort_by_choice == 'most_comments') {
Example #4
0
     $browse_blogs[] = $result_all_blogs;
 }
 // end featured blogs
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //get featured images
 $browse_images = array();
 if ($featured_display == 'random') {
     $sql = "SELECT indexer, image_id, gallery_id, user_id, title, title_seo, date_uploaded, public_private, approved, featured FROM images WHERE featured = 'yes' AND approved='yes' AND public_private = 'public' ORDER BY RAND() DESC LIMIT {$limit}";
 } else {
     $sql = "SELECT indexer, image_id, gallery_id, user_id, title, title_seo, date_uploaded, public_private, approved, featured FROM images WHERE featured = 'yes' AND approved='yes' AND public_private = 'public' ORDER BY indexer DESC LIMIT {$limit}";
 }
 $query = @mysql_query($sql);
 define('images', true);
 while ($result_images = @mysql_fetch_array($query)) {
     $change_date = dateTimeDiff($result_images['date_uploaded']);
     $result_images['date_uploaded'] = $change_date;
     $uploaded_by = mysql_real_escape_string($result_images['user_id']);
     $image_indexer = mysql_real_escape_string($result_images['indexer']);
     $image_id = mysql_real_escape_string($result_images['image_id']);
     list($width, $height) = getimagesize("addons/albums/thumbs/{$image_id}");
     // this is per each template??
     $page_display_small_width = 120;
     $page_display_small_height = 90;
     if ($width < $page_display_small_width && $height < $page_display_small_height) {
         $new_smallwidth = $width;
         $new_smallheight = $height;
     }
     // this will resize our default thumbnail size e.g. 150x150 to rescale per template design var's
     if ($width > $page_display_small_width) {
         $large_img_ratio = $width / $height;