โŒˆโŒ‹ โŽ‡ branch:  freshcode


Check-in [7ee36caef9]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:7ee36caef989251c167b855aad1d0928af22850c
Date: 2014-11-25 16:46:18
User: mario
Comment:Introduce `IS_ADMIN` shortcut, header stats for moderator infos, fix flagged entry clearing.
Tags And Properties
  • branch=trunk inherited from [82405bb421]
  • sym-trunk inherited from [82405bb421]
Context
2014-11-25
16:46
[db90e8a5a7] Add linuxgamenews.biz as news source. (user: mario, tags: trunk)
16:46
[7ee36caef9] Introduce `IS_ADMIN` shortcut, header stats for moderator infos, fix flagged entry clearing. (user: mario, tags: trunk)
2014-11-22
21:31
[a19ff10c97] Decode sourceforge URLs to skip %20 for version extraction, also try to capture -beta and -rc suffixes. (user: mario, tags: trunk)
Changes

Changes to config.php.

41
42
43
44
45
46
47


48

49
curl::$defaults["useragent"] = FRESHCODE_USER_AGENT;
ini_set("user_agent", FRESHCODE_USER_AGENT);

// List of administrative OpenID handles
$moderator_ids = array();
include("config.local.php");   





?>







>
>

>

41
42
43
44
45
46
47
48
49
50
51
52
curl::$defaults["useragent"] = FRESHCODE_USER_AGENT;
ini_set("user_agent", FRESHCODE_USER_AGENT);

// List of administrative OpenID handles
$moderator_ids = array();
include("config.local.php");   

// stats
define("IS_ADMIN", in_array($_SESSION["openid"], $moderator_ids));


?>

Changes to cron.daily/header_stats.php.

38
39
40
41
42
43
44




45

46
47
48

49
50
51
52
53
54
55
56





// releases
$s_num_vers = db("SELECT COUNT(name) AS cnt FROM (SELECT DISTINCT name, version FROM release WHERE version != ?)", "")->cnt;

// autoupdating entries
$s_num_auto = db("SELECT COUNT(name) AS cnt FROM (SELECT name FROM release WHERE autoupdate_module != ? GROUP BY name)", "none")->cnt;
$s_num_auto = round($s_num_auto / $s_num_proj * 100, 1);







file_put_contents("template/stats.htm",
<<<HTML
   <ul id=stats>

      <li> <var>$s_num_proj</var> projects
      <li> <var>$s_num_vers</var> releases
      <li> <var>$s_num_auto%</var> auto updating
      <li> <var>$s_visitors</var> visitors/wk
      <li> <var>$s_pageviews</var> recent pageviews
   </ul>
HTML
);












>
>
>
>

>

<
<
>





<
<
|
>
>
>
>
>
38
39
40
41
42
43
44
45
46
47
48
49
50
51


52
53
54
55
56
57


58
59
60
61
62
63
// releases
$s_num_vers = db("SELECT COUNT(name) AS cnt FROM (SELECT DISTINCT name, version FROM release WHERE version != ?)", "")->cnt;

// autoupdating entries
$s_num_auto = db("SELECT COUNT(name) AS cnt FROM (SELECT name FROM release WHERE autoupdate_module != ? GROUP BY name)", "none")->cnt;
$s_num_auto = round($s_num_auto / $s_num_proj * 100, 1);

// admin infos
$s_flags = db("SELECT COUNT(reason) AS cnt FROM flags")->cnt;
$s_col = $s_flags ? "style=color:red" : "";
$s_spool = count(array_filter(glob("incoming/??*"), "is_file"));


file_put_contents("template/stats.htm",


"
      <li> <var>$s_num_proj</var> projects
      <li> <var>$s_num_vers</var> releases
      <li> <var>$s_num_auto%</var> auto updating
      <li> <var>$s_visitors</var> visitors/wk
      <li> <var>$s_pageviews</var> recent pageviews


");
file_put_contents("template/stats.admin.htm",
"
      <li> <var $s_col>$s_flags</var> flags ยท <var>$s_spool</var> incoming
"
);

Changes to freshcode.css.

118
119
120
121
122
123
124

125
126
127
128
129
130
131
...
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
}
#logo #stats {
    display: inline-block;
    font-size: 70%;
    float: right;
    width: 20%;
    color: #999;

}
#logo #stats li {
    list-style: none;
    text-align: right;
}
#logo #stats li var {
    box-shadow: 0 0 3px 2px #f3f3f3;
................................................................................
    overflow-y: scroll;
    overflow-x: hidden;
    border: 1px solid #ccc;
    font-size: 85%;
}
#trove_tags.pick-tags {
    width: 220px;
    height: 2250px;
    top: 0px;
    border: none;
    font-size: 92%;
}
#trove_tags span {
    display: block;
    margin: 0; padding: 0;







>







 







|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
}
#logo #stats {
    display: inline-block;
    font-size: 70%;
    float: right;
    width: 20%;
    color: #999;
    margin: 0; padding-top: 5pt;
}
#logo #stats li {
    list-style: none;
    text-align: right;
}
#logo #stats li var {
    box-shadow: 0 0 3px 2px #f3f3f3;
................................................................................
    overflow-y: scroll;
    overflow-x: hidden;
    border: 1px solid #ccc;
    font-size: 85%;
}
#trove_tags.pick-tags {
    width: 220px;
    height: 1550px;
    top: 0px;
    border: none;
    font-size: 92%;
}
#trove_tags span {
    display: block;
    margin: 0; padding: 0;

Changes to page_admin.php.

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
...
193
194
195
196
197
198
199




200
201
202
203
204
205
206
207
208
209
210
                    array($field), $value,
                    $name, $t_published, $t_changed
                );
            }
        }
        
        // Manually empty `flags` table
        if ($action["flag"] === 0) {
            db("DELETE FROM flags WHERE name=?", $name);
        }
    }



    /**
................................................................................
      <td> <input type=text name="action[field][3]" value=""> </td>
      <td> <input type=text name="action[value][3]" value="" size=40> </td>
    </tr>
    <tr>
      <td> <input type=text name="action[field][4]" value=""> </td>
      <td> <input type=text name="action[value][4]" value="" size=40> </td>
    </tr>




    </table>
    <br>
    <input type=submit value=Apply>
    <br>
    <br>
HTML;
}



?>







|







 







>
>
>
>











81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
                    array($field), $value,
                    $name, $t_published, $t_changed
                );
            }
        }
        
        // Manually empty `flags` table
        if ($action["flag"] === "0") {
            db("DELETE FROM flags WHERE name=?", $name);
        }
    }



    /**
................................................................................
      <td> <input type=text name="action[field][3]" value=""> </td>
      <td> <input type=text name="action[value][3]" value="" size=40> </td>
    </tr>
    <tr>
      <td> <input type=text name="action[field][4]" value=""> </td>
      <td> <input type=text name="action[value][4]" value="" size=40> </td>
    </tr>
    <tr>
      <td> <input type=text name="action[field][5]" value=""> </td>
      <td> <input type=text name="action[value][5]" value="" size=40> </td>
    </tr>
    </table>
    <br>
    <input type=submit value=Apply>
    <br>
    <br>
HTML;
}



?>