Example #1
0
 function getSeries()
 {
     $strSql = "SELECT * FROM " . SERIES_TABLE;
     $objResult = mysql_query($strSql);
     $arrResult = convertToArray($objResult);
     return $arrResult;
 }
Example #2
0
 function APIlityCampaign($name, $id, $status, $startDate, $endDate, $budgetAmount, $budgetPeriod, $networkTargeting, $languages, $geoTargets, $isEnabledOptimizedAdServing, $campaignNegativeKeywordCriteria = array(), $campaignNegativeWebsiteCriteria = array(), $adScheduling, $budgetOptimizerSettings = array(), $conversionOptimizerSettings = array())
 {
     $this->name = $name;
     $this->id = $id;
     $this->status = $status;
     $this->startDate = $startDate;
     $this->endDate = $endDate;
     $this->budgetAmount = $budgetAmount;
     $this->budgetPeriod = $budgetPeriod;
     $this->networkTargeting = convertToArray($networkTargeting);
     $this->languages = convertToArray($languages);
     $this->geoTargets = $geoTargets;
     $this->campaignNegativeKeywordCriteria = convertToArray($campaignNegativeKeywordCriteria);
     $this->campaignNegativeWebsiteCriteria = convertToArray($campaignNegativeWebsiteCriteria);
     $this->isEnabledOptimizedAdServing = convertBool($isEnabledOptimizedAdServing);
     $this->adScheduling = $adScheduling;
     $this->budgetOptimizerSettings = $budgetOptimizerSettings;
     $authenticationContext =& APIlityManager::getContext();
     $this->belongsToClientEmail = is_a($authenticationContext, 'APIlityUser') ? $authenticationContext->getClientEmail() : '';
     $this->conversionOptimizerSettings = $conversionOptimizerSettings;
 }
Example #3
0

for ($i=0;$i<count($arr);$i++){
	for($j=0;$j<(count($arr)-$i);$j++){
		
		$word1 = str_split(substr($n,0,$i));
		$word2 = str_split(substr($n,$i,$j));
		$word3 = str_split(substr($n,$i+$j));
		
		$r1 = getResults ($word1);
		$r2 = getResults ($word2);
		$r3 = getResults ($word3);
		
		$a1 = convertToArray($r1);
		$a2 = convertToArray($r2);
		$a3 = convertToArray($r3);
		//printArray($a3);
		//print "<br>";

		//print ("Count before padding:" . count($a1). " ". count($a2) . " " . count($a3) . "<br>");
		
		$count_bp = count($a1) + count ($a2) + count ($a3); 
		//print (mysql_num_rows($r3). "<br>");	
		if (count($a1) > 0 ) {
			$a1[count($a1)] = substr($n,0,$i);
		} else {
		//	echo "(zero in 1)";
			$a1[0] = substr($n,0,$i);
		}
		if (count($a2) > 0) {
			$a2[count($a2)] = substr($n,$i,$j);
Example #4
0
 function getLatestEvent($iSeriesChoice)
 {
     $strSql = "SELECT * FROM events WHERE series_id = " . mysql_escape_string($iSeriesChoice) . " ORDER BY date DESC, race_no DESC limit 1";
     $objResult = mysql_query($strSql) or die("A MySQL error has occurred.<br />Your Query: " . $strSql . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());
     $arrResult = convertToArray($objResult);
     if ($arrResult) {
         return $arrResult[0];
     }
 }
Example #5
0
function searchByCaption($text)
{
    $res = conn()->query("SELECT * FROM users JOIN posts ON users.id = posts.user_id\n      WHERE caption LIKE '%{$text}%' AND is_private=b'0'");
    $arr = convertToArray($res);
    foreach ($arr as $ind => $result) {
        $arr[$ind]['link'] = 'post/' . $result['id'];
        $arr[$ind]['header'] = $result['caption'];
        $arr[$ind]['type'] = 'Post By Caption';
    }
    return $arr;
}
Example #6
0
 function APIlityMobileImageAd($id, $belongsToAdGroupId, $image, $markupLanguages, $mobileCarriers, $displayUrl, $destinationUrl, $status, $isDisapproved)
 {
     // we need to construct the superclass first, this is php-specific
     // object-oriented behaviour
     APIlityAd::APIlityAd($id, $belongsToAdGroupId, $displayUrl, $destinationUrl, $status, $isDisapproved, 'MobileImageAd');
     // now construct the mobile ad which inherits all other ad attributes
     $this->markupLanguages = convertToArray($markupLanguages);
     $this->mobileCarriers = convertToArray($mobileCarriers);
     $this->image = $image;
 }
Example #7
0
<?php 
$twitter_uri = "http://api.twitter.com/1/trends/1.json";
$zeecurl = curl_init($twitter_uri);
curl_setopt($zeecurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($zeecurl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
$resp = curl_exec($zeecurl);
curl_close($zeecurl);
$decoded_resp = json_decode($resp);
//  Find trends ...
foreach ($decoded_resp as $idx => $val) {
    foreach ($val as $k => $v) {
        // echo "<br><p>Processing key " . $k . " ... \n";
        if ($k == "trends") {
            foreach ($v as $idx => $trend) {
                // echo "<br><p>trend #" . $idx . " : " . print_r($trend) . "...\n";
                $t = convertToArray($trend);
                echo "<tr id='trendrow'>\n";
                echo "  <td class='trend' colspan='2' title='search for trending tweets'>" . "    <a href='#' onClick='javascript:loadmo(\"" . $t["name"] . "\");'>" . $t["name"] . "</a>" . "  </td>\n";
                echo "</tr>\n";
            }
        }
    }
}
?>

        </table>
      </div>
      <div id="clearalignment">&nbsp;</div>
    </div>
  </body>
</html>
Example #8
0
 function getPointsForDriver($iDriverId, $iRemoveEventId)
 {
     $strSql = "SELECT SUM(points) AS points\n                FROM\n                  (SELECT " . POINTS_TABLE . ".points\n                   FROM " . POINTS_TABLE . " JOIN " . DRIVERS_TO_EVENTS_TABLE . " \n                   ON(" . DRIVERS_TO_EVENTS_TABLE . ".position = " . POINTS_TABLE . ".position)\n                   WHERE " . DRIVERS_TO_EVENTS_TABLE . ".driver_id = " . mysql_escape_string($iDriverId);
     if (isset($iRemoveEventId)) {
         $strSql .= " AND " . DRIVERS_TO_EVENTS_TABLE . ".event_id != " . mysql_escape_string($iRemoveEventId);
     }
     $strSql .= " UNION ALL ";
     $strSql .= "SELECT " . MODEL_POINTS_TABLE . ".points\n                   FROM " . MODEL_POINTS_TABLE . " JOIN " . DRIVERS_TO_EVENTS_TABLE . " \n                   ON(" . DRIVERS_TO_EVENTS_TABLE . ".heat_position = " . MODEL_POINTS_TABLE . ".position)\n                   WHERE " . DRIVERS_TO_EVENTS_TABLE . ".driver_id = " . mysql_escape_string($iDriverId);
     if (isset($iRemoveEventId)) {
         $strSql .= " AND " . DRIVERS_TO_EVENTS_TABLE . ".event_id != " . mysql_escape_string($iRemoveEventId);
     }
     $strSql .= " UNION ALL ";
     $strSql .= "SELECT COUNT(*) AS points\n                   FROM " . DRIVERS_TO_EVENTS_TABLE . "\n                   WHERE led = 'Y' \n                   AND driver_id = " . mysql_escape_string($iDriverId);
     if (isset($iRemoveEventId)) {
         $strSql .= " AND event_id != " . mysql_escape_string($iRemoveEventId);
     }
     $strSql .= " UNION ALL\n                   SELECT " . ELIMINATOR_POINTS . " AS points\n                   FROM " . DRIVERS_TABLE . "\n                   WHERE eliminator = 'Y' \n                   AND driver_id = " . mysql_escape_string($iDriverId) . "\n                   UNION ALL\n                   SELECT COUNT(*) AS points\n                   FROM " . DRIVERS_TO_EVENTS_TABLE . "\n                   WHERE led_most = 'Y' \n                   AND driver_id = " . mysql_escape_string($iDriverId);
     if (isset($iRemoveEventId)) {
         $strSql .= " AND event_id != " . mysql_escape_string($iRemoveEventId);
     }
     $strSql .= ") \n                driver_points";
     $objResult = mysql_query($strSql) or die("A MySQL error has occurred.<br />Your Query: " . $strSql . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());
     $arrResult = convertToArray($objResult);
     if (is_array($arrResult) && count($arrResult) > 0) {
         foreach ($arrResult as $arrPoints) {
             $iPoints = $arrPoints['points'];
         }
     }
     if (!empty($iPoints)) {
         return $iPoints;
     } else {
         return 0;
     }
 }
}
//  Search for newer tweets.
$zeecurl = curl_init($twitter_uri);
curl_setopt($zeecurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($zeecurl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
$resp = curl_exec($zeecurl);
curl_close($zeecurl);
$decoded_resp = json_decode($resp);
//  Insert each tweet into the MongoDB collection.
$beancounter = 0;
foreach ($decoded_resp as $k => $v) {
    // echo "<br><p>Processing key " . $k . " ... \n";
    if ($k == "results") {
        foreach ($v as $idx => $tweet) {
            // echo "<br><p>loading item #" . $idx . " : " . print_r($tweet) . "...\n";
            $entry = convertToArray($tweet);
            $entry["search_term"] = $search_term;
            $collection->insert($entry);
            $beancounter++;
        }
    }
}
echo "<p><b>Search URI: </b><font size='-1'>" . $twitter_uri . "</font>\n";
echo "<br/>\n";
echo "<p><b>Tweets Loaded: " . $beancounter . "</b>\n";
?>

    <br><br/>
    You will soon be automatically redirected back to the home page ...
  </body>
</html>