Example #1
0
function endElement($parser, $name)
{
    global $inLocTag, $buffer, $user_id;
    if (strtolower($name) == 'loc') {
        $inLocTag = false;
        // Now, let's process the contents
        $url = $buffer;
        $buffer = '';
        $url_id = getUrlId(resolveRedirects($url), false);
        if (is_null($url_id)) {
            error_log("Troubles getting / creating a URL for {$url}. Skipping.");
            return;
        }
        $query = sprintf("INSERT IGNORE INTO user_urls (user_id, url_id) VALUES (%d, %d)", $user_id, $url_id);
        $result = mysql_query($query);
        if (!$result) {
            error_log(mysql_error());
        }
    }
}
Example #2
0
function checkMediaForWarnings($media_url, $post, $type)
{
    global $warnings;
    $resolved_url = resolveRedirects($media_url);
    if (false !== stripos($resolved_url, 'tumblr.com')) {
        # Audio file is hosted on Tumblr, and won't be accessible.
        $warnings[] = array('url' => $post, 'error' => "Post references a {$type} file hosted on\n Tumblr.com. This file will not be accessible\n from a post hosted on your own site. You need to host\n `{$media_url}`\n elsewhere and update the post.");
    }
}
Example #3
0
$noMoreURLs = false;
if ($maxURLsPerUser) {
    $query = sprintf('SELECT count(*) AS cnt FROM user_urls	WHERE user_urls.user_id = %d', $current_user->getID());
    $result = mysql_query($query);
    if (!$result) {
        error_log(mysql_error());
    }
    $cnt = mysql_fetch_row($result);
    if (is_array($cnt) && $cnt[0] >= $maxURLsPerUser) {
        $noMoreURLs = true;
        $MESSAGES[] = $maxURLsMessage;
    }
    mysql_free_result($result);
}
if (!$noMoreURLs && array_key_exists('url', $_REQUEST)) {
    $url_id = getUrlId(resolveRedirects($_REQUEST['url']), false);
    if (is_null($url_id)) {
        header('Location: ' . $showslow_base . 'my.php#invalid');
        exit;
    }
    $query = sprintf("INSERT IGNORE INTO user_urls (user_id, url_id) VALUES (%d, %d)", $current_user->getID(), $url_id);
    $result = mysql_query($query);
    if (!$result) {
        error_log(mysql_error());
    }
    $current_user->recordActivity(SHOWSLOW_ACTIVITY_ADD_URL);
    header('Location: ' . $showslow_base . 'my.php#added');
    exit;
}
$query = sprintf("SELECT urls.id as id, url, last_update,\n\t\tyslow2.o as o,\n\t\tpagespeed.o as ps_o,\n\t\tdynatrace.rank as dt_o\n\tFROM urls INNER JOIN user_urls ON urls.id = user_urls.url_id\n\t\tLEFT JOIN yslow2 ON urls.yslow2_last_id = yslow2.id\n\t\tLEFT JOIN pagespeed ON urls.pagespeed_last_id = pagespeed.id\n\t\tLEFT JOIN dynatrace ON urls.dynatrace_last_id = dynatrace.id\n\tWHERE user_urls.user_id = %d ORDER BY url", $current_user->getID());
$result = mysql_query($query);