/wp-content/plugins/gd-star-rating/options/users.php

https://github.com/hewu/blogwp · PHP · 146 lines · 124 code · 22 blank · 0 comment · 29 complexity · 868895176add0395100e2fdb44f8af2c MD5 · raw file

  1. <?php
  2. $posts_per_page = $options["admin_rows"];
  3. $url = $_SERVER['REQUEST_URI'];
  4. $url_pos = strpos($url, "&gdsr=");
  5. if (!($url_pos === false))
  6. $url = substr($url, 0, $url_pos);
  7. $log_url = $url."&gdsr=userslog";
  8. $url.= "&amp;gdsr=users";
  9. $page_id = 1;
  10. if (isset($_GET["pg"])) $page_id = $_GET["pg"];
  11. $number_posts = gdsrAdmDB::get_valid_users_count();
  12. $max_page = floor($number_posts / $posts_per_page);
  13. if ($max_page * $posts_per_page != $number_posts) $max_page++;
  14. $pager = $max_page > 1 ? gdFunctionsGDSR::draw_pager($max_page, $page_id, $url, "pg") : "";
  15. $users = array();
  16. $pre_users = gdsrAdmDB::get_valid_users();
  17. $count = -1;
  18. $usrid = -1;
  19. foreach ($pre_users as $user) {
  20. if ($user->user_id != $usrid) $count++;
  21. $users[$count]["id"] = $user->user_id;
  22. $users[$count][$user->vote_type]["votes"] = $user->votes;
  23. $users[$count][$user->vote_type]["voters"] = $user->voters;
  24. $users[$count][$user->vote_type]["ips"] = $user->ips;
  25. $users[$count]["name"] = $user->user_id == 0 ? __("Visitor", "gd-star-rating") : $user->display_name;
  26. $users[$count]["email"] = $user->user_id == 0 ? "/" : $user->user_email;
  27. $usrid = $user->user_id;
  28. }
  29. $usr_from = ($page_id - 1) * $posts_per_page;
  30. $usr_to = $page_id * $posts_per_page;
  31. if ($usr_to > $number_posts) $usr_to = $number_posts;
  32. ?>
  33. <div class="wrap">
  34. <form id="gdsr-articles" method="post" action="">
  35. <h2 class="gdptlogopage">GD Star Rating: <?php _e("Users", "gd-star-rating"); ?></h2>
  36. <div class="tablenav">
  37. <div class="alignleft">
  38. </div>
  39. <div class="tablenav-pages">
  40. <?php echo $pager; ?>
  41. </div>
  42. </div>
  43. <br class="clear"/>
  44. <table class="widefat">
  45. <thead>
  46. <tr>
  47. <th scope="col"><?php _e("Name", "gd-star-rating"); ?></th>
  48. <th scope="col"><?php _e("ID", "gd-star-rating"); ?></th>
  49. <th scope="col"><?php _e("Email", "gd-star-rating"); ?></th>
  50. <th scope="col"><?php _e("Thumbs Articles", "gd-star-rating"); ?></th>
  51. <th scope="col"><?php _e("Thumbs Comments", "gd-star-rating"); ?></th>
  52. <th scope="col"><?php _e("Ratings Articles", "gd-star-rating"); ?></th>
  53. <th scope="col"><?php _e("Ratings Comments", "gd-star-rating"); ?></th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. <?php
  58. $tr_class = "";
  59. for ($i = $usr_from; $i < $usr_to; $i++) {
  60. $row = $users[$i];
  61. $usr_url = $row["name"];
  62. if ($row["id"] > 0) $usr_url = '<a href="./user-edit.php?user_id='.$row["id"].'">'.$row["name"].'</a>';
  63. if ($row["id"] == 0) $tr_class.= " visitor";
  64. if ($row["id"] == 1) $tr_class.= " admin";
  65. $ip_pst = 0;
  66. $r_pst = 0;
  67. if (isset($row["article"]["voters"]) && $row["article"]["voters"] > 0) $r_pst = @number_format($row["article"]["votes"] / $row["article"]["voters"], 1);
  68. else $row["article"]["voters"] = "0";
  69. $ip_pst = (isset($row["article"]["ips"]) && $row["article"]["ips"] > 0) ? $row["article"]["ips"] : 0;
  70. $ip_pst_thumb = 0;
  71. if (!isset($row["artthumb"]["voters"])) $row["artthumb"]["voters"] = 0;
  72. $r_pst_thumb = $row["artthumb"]["voters"];
  73. $ip_pst_thumb = (isset($row["artthumb"]["ips"]) && $row["artthumb"]["ips"] > 0) ? $row["artthumb"]["ips"] : 0;
  74. $ip_cmm = 0;
  75. $r_cmm = 0;
  76. if (isset($row["comment"]["voters"]) && $row["comment"]["voters"] > 0) $r_cmm = @number_format($row["comment"]["votes"] / $row["comment"]["voters"], 1);
  77. else $row["comment"]["voters"] = "0";
  78. $ip_cmm = (isset($row["comment"]["ips"]) && $row["comment"]["ips"] > 0) ? $row["comment"]["ips"] : 0;
  79. $ip_cmm_thumb = 0;
  80. if (!isset($row["cmmthumb"]["voters"])) $row["cmmthumb"]["voters"] = 0;
  81. $r_cmm_thumb = $row["cmmthumb"]["voters"];
  82. $ip_cmm_thumb = (isset($row["cmmthumb"]["ips"]) && $row["cmmthumb"]["ips"] > 0) ? $row["cmmthumb"]["ips"] : 0;
  83. echo '<tr id="post-'.$row["id"].'" class="'.$tr_class.' author-self status-publish" valign="top">';
  84. echo '<td><strong>'.$usr_url.'</strong></td>';
  85. echo '<td>'.$row["id"].'</td>';
  86. echo '<td>'.$row["email"].'</td>';
  87. echo '<td>';
  88. echo __("votes", "gd-star-rating").': <strong><a href="'.$log_url.'&amp;ui='.$row["id"].'&amp;vt=artthumb&amp;un='.urlencode($row["name"]).'">'.$row["artthumb"]["voters"].'</a></strong><br />';
  89. echo __("rating", "gd-star-rating").': <strong style="color: red">'.$r_pst_thumb.'</strong><br />';
  90. echo __("unique ip's", "gd-star-rating").': <strong>'.$ip_pst_thumb.'</strong>';
  91. echo '</td>';
  92. echo '<td>';
  93. echo __("votes", "gd-star-rating").': <strong><a href="'.$log_url.'&amp;ui='.$row["id"].'&amp;vt=cmmthumb&amp;un='.urlencode($row["name"]).'">'.$row["cmmthumb"]["voters"].'</a></strong><br />';
  94. echo __("rating", "gd-star-rating").': <strong style="color: red">'.$r_cmm_thumb.'</strong><br />';
  95. echo __("unique ip's", "gd-star-rating").': <strong>'.$ip_cmm_thumb.'</strong>';
  96. echo '</td>';
  97. echo '<td>';
  98. echo __("votes", "gd-star-rating").': <strong><a href="'.$log_url.'&amp;ui='.$row["id"].'&amp;vt=article&amp;un='.urlencode($row["name"]).'">'.$row["article"]["voters"].'</a></strong><br />';
  99. echo __("rating", "gd-star-rating").': <strong style="color: red">'.$r_pst.'</strong><br />';
  100. echo __("unique ip's", "gd-star-rating").': <strong>'.$ip_pst.'</strong>';
  101. echo '</td>';
  102. echo '<td>';
  103. echo __("votes", "gd-star-rating").': <strong><a href="'.$log_url.'&amp;ui='.$row["id"].'&amp;vt=comment&amp;un='.urlencode($row["name"]).'">'.$row["comment"]["voters"].'</a></strong><br />';
  104. echo __("rating", "gd-star-rating").': <strong style="color: red">'.$r_cmm.'</strong><br />';
  105. echo __("unique ip's", "gd-star-rating").': <strong>'.$ip_cmm.'</strong>';
  106. echo '</td>';
  107. echo '</tr>';
  108. if ($tr_class == "")
  109. $tr_class = "alternate ";
  110. else
  111. $tr_class = "";
  112. }
  113. ?>
  114. </tbody>
  115. </table>
  116. <!--<div class="tablenav">
  117. <div class="alignleft">
  118. </div>
  119. <div class="tablenav-pages">
  120. </div>
  121. </div>-->
  122. <br class="clear"/>
  123. </form>
  124. </div>