Пример #1
0
    function showMainPage($showsettings = true)
    {
        global $wp_version, $csyn_banner;
        echo $csyn_banner;
        echo '<form action="' . csyn_REQUEST_URI() . '" method="post">' . "\n";
        echo '<table class="form-table" width="100%">';
        echo "<tr><td align=\"right\">\n";
        echo 'New Feed URL: <input type="text" name="feed_url" value="" size="100">' . "\n";
        echo '&nbsp;<input class="button-primary" name="new_feed" value="Syndicate &raquo;" type="submit">' . "\n";
        echo "</td></tr>\n";
        echo "</table>\n";
        echo "</form>";
        echo '<form id="syndycated_feeds" action="' . csyn_REQUEST_URI() . '" method="post">' . "\n";
        if (count($this->feeds) > 0) {
            echo '<table class="widefat" style="margin-top: .5em" width="100%">' . "\n";
            echo '<thead>' . "\n";
            echo '<tr>' . "\n";
            echo '<th width="3%" align="center"><input type="checkbox" onclick="checkAll(document.getElementById(\'syndycated_feeds\'));"></th>' . "\n";
            echo '<th width="25%">Feed title</th>' . "\n";
            echo '<th width="50%">URL</th>' . "\n";
            echo '<th width="10%">Next update</th>' . "\n";
            echo '<th width="12%">Last update</th>' . "\n";
            echo "</tr>\n";
            echo '</thead>' . "\n";
            for ($i = 0; $i < count($this->feeds); $i++) {
                if ($i % 2) {
                    echo "<tr>\n";
                } else {
                    echo '<tr class="alternate">' . "\n";
                }
                echo '<td align="center"><input name="feed_ids[]" value="' . $i . '" type="checkbox"></td>' . "\n";
                echo '<td>' . $this->feeds[$i]['title'] . ' [<a href="' . csyn_REQUEST_URI() . '&edit-feed-id=' . $i . '">edit</a>]</td>' . "\n";
                echo '<td>' . '<a href="' . $this->feeds[$i]['url'] . '" target="_blank">' . csyn_short_str(htmlspecialchars($this->feeds[$i]['url']), 100) . '</a></td>' . "\n";
                echo "<td>" . $this->getUpdateTime($this->feeds[$i]) . "</td>\n";
                $last_update = $this->feeds[$i]['updated'];
                if ($last_update) {
                    echo "<td>" . intval((time() - $last_update) / 60) . " minutes ago</td>\n";
                } else {
                    echo "<td> - </td>\n";
                }
                echo "</tr>\n";
            }
            echo "</table>\n";
            if (version_compare($wp_version, '2.5', '<')) {
                echo "<br /><hr>\n";
            }
        }
        ?>
        <div class="submit">
            <table width="100%">
                <tr>
                    <td>
                        <div align="left">
                            <input class="button-primary" name="check_for_updates" value="Pull selected feeds now!" type="submit">
                        </div>
                    </td>
                    <td>
                        <div align="right">
                            <input class="button secondary" name="delete_feeds_and_posts" value="Delete selected feeds and syndicated posts" type="submit">
                            <input class="button secondary" name="delete_feeds" value="Delete selected feeds" type="submit">
                            <input class="button secondary" name="delete_posts" value="Delete posts syndycated from selected feeds" type="submit">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><br />
                        <div align="right">
                            <input class="button secondary" name="alter_default_settings" value="Alter default settings" type="submit">
                        </div>
                    </td>
                </tr>
            </table>
            <?php 
        update_option('CSYN_TOKEN', rand());
        ?>
            <input type="hidden" name="csyn_token" value="<?php 
        echo get_option('CSYN_TOKEN');
        ?>
" />
        </form>
        </div>
        <?php 
        if ($showsettings) {
            $this->showSettings(false, $this->global_options);
        }
    }
if (!function_exists('curl_init') && !ini_get('allow_url_fopen')) {
    $problems .= "PHP variable <a href=\"http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen\" target=\"_blank\">allow_url_fopen</a> is disabled. You must enable it in order to make CyberSyn work properly.\n<br />";
}
if ($problems != "") {
    echo "<div id=\"message\" class=\"error\"><p>{$problems}</p></div>\n";
}
?>

    <img class="alignleft" style="margin:6px;" src="<?php 
echo plugins_url('/images/settings32.png', __FILE__);
?>
" />   
    <h2>General Settings</h2>

    <form method="post" action="<?php 
echo csyn_REQUEST_URI();
?>
" name="general_settings">

        <table class="form-table">
            <tr valign="top">
                <th align="left">RSS pull mode</th>
                <td align="left">
                    <select style="width: 160px;" name="<?php 
echo CSYN_RSS_PULL_MODE;
?>
" onchange="changeMode();"<?php 
if (defined('CSYN_ENABLE_RSS_PULL_MODE') && !CSYN_ENABLE_RSS_PULL_MODE) {
    echo "disabled";
}
?>