public static function get_link($movieId)
 {
     $link = self::find_by_id($movieId);
     $exists = $link ? true : false;
     if ($link && days_from_now($link->timestamp) < LINK_UPDATE_DAYS) {
         // good
     } else {
         $exists = $link ? true : false;
         $movie = Movie::find_by_id($movieId);
         $link = new Netflix();
         $link->id = $movieId;
         $link->timestamp = gen_timestamp();
         $years_from_search = array();
         $links_from_search = array();
         $titles_from_search = array();
         $html = file_get_contents("http://instantwatcher.com/titles?q=" . urlencode($movie->title));
         $matches = strallpos($html, "<span class=\"releaseYear\">");
         $link_matches = strallpos($html, "location.href");
         $title_matches = strallpos($html, "class=\"title-list-item-link");
         if (sizeof($matches) == sizeof($link_matches)) {
             for ($i = 0; $i < sizeof($matches); $i++) {
                 $years_from_search[] = substr($html, $matches[$i] + 26, 4);
                 $links_from_search[] = str_replace('Player?movieid=', 'Movie/', strstr(substr($html, $link_matches[$i] + 17), "'", true));
                 $titles_from_search[] = substr(strstr(strstr(substr($html, $title_matches[$i]), ">"), "</a>", true), 1);
                 if ($years_from_search[$i] == $movie->year && levenshtein($titles_from_search[$i], $movie->title) < 2) {
                     $link->link = $links_from_search[$i];
                     break;
                 }
             }
         }
         if ($exists) {
             $link->update();
         } else {
             $link->create();
         }
     }
     return $link;
 }
function ContainsDisguiseChars($teststr, $DisguiseChars, $DisguiseCharsThreshold)
{
    DebugToLog('DEBUG: Begin func ContainsDisguiseChars');
    $newstr = $DisguiseChars;
    DebugToLog('DEBUG: Before slash removal $DisguiseChars=' . $DisguiseChars);
    $newstr = str_replace("\\s", "", $newstr);
    // take out '\s' cause we are not using a regex here
    $newstr .= "0\t";
    // asterisk is not a 'good' disguising char but should be checked here.
    DebugToLog('DEBUG: $DisguiseCharsThreshold=' . $DisguiseCharsThreshold);
    DebugToLog('DEBUG: $DisguiseChars=' . $DisguiseChars);
    DebugToLog('DEBUG: Slightly massaged $DisguiseChars is $newstr=' . $newstr);
    DebugToLog('DEBUG: $teststr=' . $teststr);
    $num = strlen($newstr) - 1;
    $DisguiseCharsCount = 0;
    for ($x = 0; $x < $num; $x++) {
        // DebugToLog('SUPERDUMP:  $newstr[$x]=' . $newstr[$x]);
        $DisguiseCharsCount += strallpos($teststr, $newstr[$x]);
        // DebugToLog('SUPERDUMP: So far $DisguiseCharsCount=' . $DisguiseCharsCount);
        if ($DisguiseCharsCount >= $DisguiseCharsThreshold) {
            DebugToLog('SUBRULE MATCH: String contains disguise chars. Total disguise chars found=' . $DisguiseCharsCount . '  Disguise chars checked=' . $newstr);
            return true;
        }
    }
    DebugToLog('DEBUG: String does NOT contain excessive disguise chars.  Total disguise chars found=' . $DisguiseCharsCount . ' Disguise chars checked=' . $newstr);
    return false;
}
function get_netflix_link($title, $year)
{
    $years_from_search = array();
    $links_from_search = array();
    $titles_from_search = array();
    $html = file_get_contents("http://instantwatcher.com/titles?q=" . urlencode($title));
    $matches = strallpos($html, "<span class=\"releaseYear\">");
    $link_matches = strallpos($html, "nflx.openPlayer");
    $title_matches = strallpos($html, "class=\"title-list-item-link");
    $netflix = "";
    if (sizeof($matches) == sizeof($link_matches)) {
        for ($i = 0; $i < sizeof($matches); $i++) {
            $years_from_search[] = substr($html, $matches[$i] + 26, 4);
            $netflixId = preg_split('/[^0-9]/', substr(strstr(substr($html, $link_matches[$i] + 30), "titles/movies/"), 14, 20))[0];
            $links_from_search[] = "http://www.netflix.com/WiMovie/{$netflixId}";
            $titles_from_search[] = substr(strstr(strstr(substr($html, $title_matches[$i]), ">"), "</a>", true), 1);
            if ($years_from_search[$i] == $year && levenshtein($titles_from_search[$i], $title) < 2) {
                $netflix = $links_from_search[$i];
                break;
            }
        }
    }
    return $netflix;
}
Example #4
0
function buildPost($post, $res)
{
    $return = "";
    $threadid = $post['parent'] == TINYIB_NEWTHREAD ? $post['id'] : $post['parent'];
    if ($res == TINYIB_RESPAGE) {
        $reflink = "<a href=\"{$threadid}.html#{$post['id']}\">No.</a><a href=\"{$threadid}.html#q{$post['id']}\" onclick=\"javascript:quotePost('{$post['id']}')\">{$post['id']}</a>";
    } else {
        $reflink = "<a href=\"res/{$threadid}.html#{$post['id']}\">No.</a><a href=\"res/{$threadid}.html#q{$post['id']}\">{$post['id']}</a>";
    }
    if (TINYIB_3D) {
        $reflink .= " <a href=\"../3d.html#{$post['id']}\">3D</a>";
    }
    if ($post["stickied"] == 1) {
        $reflink .= ' <img src="sticky.png" alt="Stickied" title="Stickied" width="16" height="16">';
    }
    if (!isset($post["omitted"])) {
        $post["omitted"] = 0;
    }
    $embed = '';
    if ($post["file_hex"] == "YouTube" || $post["file_hex"] == "Vimeo" || $post["file_hex"] == "SoundCloud") {
        $embed = str_replace("'", "\\'", $post['file']);
    }
    if ($post["parent"] != TINYIB_NEWTHREAD) {
        $return .= <<<EOF
<table>
<tbody>
<tr>
<td class="doubledash">
\t&#0168;
</td>
<td class="reply" id="reply{$post["id"]}">
EOF;
    } elseif ($embed != "") {
        $return .= <<<EOF
<span class="filesize">Embed: <a href="#" id="tiembed{$post['id']}">{$post["file_original"]}</a>&ndash;({$post["file_hex"]})</span>
<br>
<span id="thumbembed{$post['id']}">
<a href="#" id="exembed{$post['id']}">
<img src="thumb/{$post["thumb"]}" alt="{$post["id"]}" class="thumb opthumb" id="thumbnail{$post['id']}" width="{$post["thumb_width"]}" height="{$post["thumb_height"]}">
</a>
</span>
<div id="embed{$post['id']}" class="thumb" style="display: none;"></div>
<script type="text/javascript">
\$("#tiembed{$post['id']}, #exembed{$post['id']}").click(function(){
showEmbed('{$post['id']}', '{$embed}');
return false;
});
</script>
EOF;
    } elseif ($post["file"] != "") {
        $return .= <<<EOF
<span class="filesize">File: <a href="src/{$post["file"]}">{$post["file"]}</a>&ndash;({$post["file_size_formatted"]}, {$post["image_width"]}x{$post["image_height"]}, {$post["file_original"]})</span>
<br>
<a target="_blank" href="src/{$post["file"]}">
<span id="thumb{$post['id']}"><img src="thumb/{$post["thumb"]}" alt="{$post["id"]}" class="thumb" width="{$post["thumb_width"]}" height="{$post["thumb_height"]}"></span>
</a>
EOF;
    }
    $return .= <<<EOF
<a name="{$post['id']}"></a>
<label>
\t<input type="checkbox" name="delete" value="{$post['id']}"> 
EOF;
    if ($post['subject'] != '') {
        $return .= '	<span class="filetitle">' . $post['subject'] . '</span> ';
    }
    $return .= <<<EOF
{$post["nameblock"]}
</label>
<span class="reflink">
\t{$reflink}
</span>
EOF;
    if ($post['parent'] != TINYIB_NEWTHREAD) {
        if ($embed != "") {
            $return .= <<<EOF
<br>
<span class="filesize"><a href="#" id="tiembed{$post['id']}">{$post['file_original']}</a>&ndash;({$post['file_hex']})</span>
<br>
<span id="thumbembed{$post['id']}">
<a href="#" id="exembed{$post['id']}">
\t\t<img src="thumb/{$post["thumb"]}" alt="{$post["id"]}" class="thumb" id="thumbnail{$post['id']}" width="{$post["thumb_width"]}" height="{$post["thumb_height"]}">
</a>
</span>
<div id="embed{$post['id']}" class="thumb" style="display: none;"></div>
<script type="text/javascript">
\$("#tiembed{$post['id']}, #exembed{$post['id']}").click(function(){
showEmbed('{$post['id']}', '{$embed}');
return false;
});
</script>
EOF;
        } else {
            if ($post["file"] != "") {
                $return .= <<<EOF
<br>
<span class="filesize"><a href="src/{$post["file"]}">{$post["file"]}</a>&ndash;({$post["file_size_formatted"]}, {$post["image_width"]}x{$post["image_height"]}, {$post["file_original"]})</span>
<br>
<a target="_blank" href="src/{$post["file"]}">
\t<span id="thumb{$post["id"]}"><img src="thumb/{$post["thumb"]}" alt="{$post["id"]}" class="thumb" width="{$post["thumb_width"]}" height="{$post["thumb_height"]}"></span>
</a>
EOF;
            }
        }
    }
    if ($post['parent'] == TINYIB_NEWTHREAD && $res == TINYIB_INDEXPAGE) {
        $return .= "&nbsp;[<a href=\"res/{$post["id"]}.html\">Reply</a>]";
        if (TINYIB_3D) {
            $return .= "[<a href=\"3d.html#{$post['id']}\">3D</a>]";
        }
    }
    if (TINYIB_TRUNCATE > 0 && !$res && substr_count($post['message'], '<br>') > TINYIB_TRUNCATE) {
        // Truncate messages on board index pages for readability
        $br_offsets = strallpos($post['message'], '<br>');
        $post['message'] = substr($post['message'], 0, $br_offsets[TINYIB_TRUNCATE - 1]);
        $post['message'] .= '<br><span class="omittedposts">Post truncated.  Click Reply to view.</span><br>';
    }
    $return .= <<<EOF
<div class="message">
{$post["message"]}
</div>
EOF;
    if ($post['parent'] == TINYIB_NEWTHREAD) {
        if ($res == TINYIB_INDEXPAGE && $post['omitted'] > 0) {
            $return .= '<span class="omittedposts">' . $post['omitted'] . ' ' . plural('post', $post['omitted']) . ' omitted. Click Reply to view.</span>';
        }
    } else {
        $return .= <<<EOF
</td>
</tr>
</tbody>
</table>
EOF;
    }
    return $return;
}
					<th scope="col">Date Commenced</th>
					<th scope="col">System Status</th>
				</tr>
			</thead>

			<tbody>
<?php 
// Now make the rows
if (!empty($logs['filelist'])) {
    $bEven = false;
    foreach ($logs['filelist'] as $f) {
        $info = array();
        if ($log_data = @file_get_contents(LOGS . "/" . $f)) {
            strallpos($log_data, "> SYM_LOG_ERROR:", $info[0]);
            strallpos($log_data, "> SYM_LOG_WARNING:", $info[1]);
            strallpos($log_data, "> SYM_LOG_NOTICE:", $info[2]);
        }
        if ($info[0] == 0) {
            unset($info[0]);
        } else {
            $info[0] = $info[0] . General::strPlural($info[0], " error", " errors");
        }
        if ($info[1] == 0) {
            unset($info[1]);
        } else {
            $info[1] = $info[1] . General::strPlural($info[1], " warning", " warnings");
        }
        if ($info[2] == 0) {
            unset($info[2]);
        } else {
            $info[2] = $info[2] . General::strPlural($info[2], " notice", " notices");