function get_template($template_id, $section) { include STARRATING_PATH . 'code/t2/gd-star-t2-templates.php'; if (intval($template_id) == 0) { $t = GDSRDB::get_templates($section, true, true); $template_id = $t->template_id; } return new gdTemplateRender($template_id, $section); }
} if ($_POST["gdsr_remove_settings"] == __("Remove Settings", "gd-star-rating")) { delete_option('gd-star-rating'); delete_option('widget_gdstarrating'); ?> <div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"><p><strong><?php _e("Settings are removed from WordPress installation.", "gd-star-rating"); ?> </strong></p></div> <?php } if ($_POST["gdsr_remove_templates"] == __("Reinstall Templates", "gd-star-rating")) { gdDBInstallGDSR::drop_table("gdsr_templates"); gdDBInstallGDSR::create_tables(STARRATING_PATH); GDSRDB::insert_default_templates(STARRATING_PATH); GDSRDB::insert_extras_templates(STARRATING_PATH); GDSRDB::insert_extras_templates(STARRATING_XTRA_PATH, false); delete_option('gd-star-rating-templates'); ?> <div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"><p><strong><?php _e("Plugins default templates are reinstalled.", "gd-star-rating"); ?> </strong></p></div> <?php } if ($_POST["gdsr_reset_imports"] == __("Reset Imports", "gd-star-rating")) { delete_option('gd-star-rating-import'); ?> <div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"><p><strong><?php _e("Import Information is reseted.", "gd-star-rating"); ?> </strong></p></div> <?php }
function star_menu_t2() { $options = $this->o; $wpv = $this->wp_version; include $this->plugin_path . 'code/t2/gd-star-t2-templates.php'; if (isset($_GET["tplid"])) { $id = $_GET["tplid"]; $mode = $_GET["mode"]; include $this->plugin_path . 'options/templates/templates_editor.php'; } else { if (isset($_POST["gdsr_defaults"])) { include $this->plugin_path . 'options/templates/templates_defaults.php'; } else { if (isset($_POST["gdsr_create"])) { $id = 0; $mode = "new"; include $this->plugin_path . 'options/templates/templates_editor.php'; } else { if (isset($_POST["gdsr_setdefaults"])) { GDSRDB::set_templates_defaults($_POST["gdsr_section"]); include $this->plugin_path . 'options/templates/templates_list.php'; } else { include $this->plugin_path . 'options/templates/templates_list.php'; } } } } }
function render_templates_section($section, $name, $selected = "0", $width = 205) { $templates = GDSRDB::get_templates($section, true); ?> <select style="width: <?php echo $width; ?> px;" name="<?php echo $name; ?> " id="<?php echo $name; ?> "> <?php foreach ($templates as $t) { if ($t->template_id == $selected) { $select = ' selected="selected"'; } else { $select = ''; } echo sprintf('<option value="%s"%s>%s</option>', $t->template_id, $select, $t->name); } ?> </select> <?php }
?> <th scope="col"><?php _e("Review", "gd-star-rating"); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php $tr_class = ""; foreach ($rows as $row) { $row = GDSRDB::convert_row($row); $moderate_articles = GDSRDatabase::get_moderation_count($row->pid); $moderate_comments = GDSRDatabase::get_moderation_count_joined($row->pid); if ($moderate_articles == 0) { $moderate_articles = "[ <strong>0</strong> ] "; } else { $moderate_articles = sprintf('[<a href="./admin.php?page=gd-star-rating-stats&gdsr=moderation&pid=%s&vt=article"> <strong style="color: red;">%s</strong> </a>] ', $row->pid, $moderate_articles); } if ($moderate_comments == 0) { $moderate_comments = "[ <strong>0</strong> ] "; } else { $moderate_comments = sprintf('[<a href="./admin.php?page=gd-star-rating-stats&gdsr=moderation&pid=%s&vt=post"> <strong style="color: red;">%s</strong> </a>] ', $row->pid, $moderate_comments); } $comment_count = GDSRDatabase::get_comments_count($row->pid); if ($comment_count == 0) { $comment_count = '<a class="post-com-count" title="0"><span class="comment-count">0</span></a>';
_e("Vote Rules", "gd-star-rating"); ?> </th> <th scope="col"><?php _e("Posts", "gd-star-rating"); ?> </th> </tr> </thead> <tbody> <?php $tr_class = ""; for ($i = $cat_from; $i < $cat_to; $i++) { $row = $categories[$i]; $row = GDSRDB::convert_category_row($row); if ($options["timer_active"] == 1) { if ($row->expiry_type == "D") { $timer_info = '<strong><span style="color: red">' . __("date limit", "gd-star-rating") . '</span></strong><br />'; $timer_info .= $row->expiry_value; } else { if ($row->expiry_type == "T") { $timer_info = '<strong><span style="color: red">' . __("countdown", "gd-star-rating") . '</span></strong><br />'; $timer_info .= substr($row->expiry_value, 1) . " "; switch (substr($row->expiry_value, 0, 1)) { case "H": $timer_info .= __("Hours", "gd-star-rating"); break; case "D": $timer_info .= __("Days", "gd-star-rating"); break;
<?php if ($id == 0) { $section = $_POST["tpl_section"]; } else { $tpl = GDSRDB::get_template($id); $section = $tpl->section; $elements = unserialize($tpl->elements); $dependencies = unserialize($tpl->dependencies); } if ($mode == "copy") { $id = 0; $tpl->name = "New Template"; $tpl->description = ""; } else { if ($mode == "edit" && $tpl->preinstalled == "1") { $id = 0; } } $template = $tpls->get_list($section); ?> <div class="wrap"><h2 class="gdptlogopage">GD Star Rating: T2 <?php _e("Template Editor", "gd-star-rating"); ?> </h2> <form method="post"> <input type="hidden" name="gdsr_save_tpl" value="" /> <input type="hidden" name="tpl_section" value="<?php echo $section; ?>
</th> <th scope="col" width="120"><?php _e("Total", "gd-star-rating"); ?> </th> <th scope="col"><?php _e("Review", "gd-star-rating"); ?> </th> </tr> </thead> <tbody> <?php $tr_class = ""; foreach ($rows as $row) { $row = GDSRDB::convert_comment_row($row); if ($row->rating_total > $options["cmm_stars"] || $row->rating_visitors > $options["cmm_stars"] || $row->rating_users > $options["cmm_stars"]) { $tr_class .= " invalidarticle"; } echo '<tr id="post-' . $row->comment_id . '" class="' . $tr_class . ' author-self status-publish" valign="top">'; echo '<th scope="row" class="check-column"><input name="gdsr_item[]" value="' . $row->comment_id . '" type="checkbox"></th>'; echo '<td>' . $row->comment_content . '</td>'; echo '<td><strong>' . $row->comment_author . '</strong></td>'; echo '<td>' . $row->comment_date . '</td>'; echo '<td>' . $row->votes . '</td>'; echo '<td>' . $row->total . '</td>'; echo '<td>' . $row->review . '</td>'; echo '</tr>'; if ($tr_class == "") { $tr_class = "alternate "; } else {
function moderation_approve($ids, $ids_array) { global $wpdb, $table_prefix; $sql = sprintf("select * from %s where record_id in %s", $table_prefix . "gdsr_moderate", $ids); $rows = $wpdb->get_results($sql); foreach ($rows as $row) { if ($row->vote_type == "article") { GDSRDatabase::add_vote($row->id, $row->user_id, $row->ip, $row->user_agent, $row->vote); } if ($row->vote_type == "comment") { GDSRDatabase::add_vote_comment($row->id, $row->user_id, $row->ip, $row->user_agent, $row->vote); } } GDSRDB::moderation_delete($ids); }
?> </th> <th scope="col"><?php _e("Tag", "gd-star-rating"); ?> </th> <th scope="col" style="text-align: right"><?php _e("Options", "gd-star-rating"); ?> </th> </tr> </thead> <tbody> <?php $templates = GDSRDB::get_templates($filter_section); $tr_class = ""; foreach ($templates as $t) { $mode = $t->preinstalled == "0" ? "edit" : "copy"; $url = "admin.php?page=gd-star-rating-t2&"; echo '<tr id="post-' . $t->template_id . '" class="' . $tr_class . ' author-self status-publish" valign="top">'; echo '<td><strong>' . $t->template_id . '</strong></td>'; echo '<td><strong><a href="' . $url . 'mode=' . $mode . '&tplid=' . $t->template_id . '">' . $t->name . '</a></strong></td>'; echo '<td>' . $all_sections[$t->section] . '</td>'; echo '<td>' . $t->description . '</td>'; echo '<td>' . $tpls->find_template_tag($t->section) . '</td>'; echo '<td style="text-align: right">'; if ($t->preinstalled == "0") { echo '<a href="' . $url . 'deltpl=' . $t->template_id . '">delete</a> | '; } if ($t->preinstalled == "0") {
echo $options["admin_width"]; ?> px"> <?php } else { ?> <div class="wrap"><?php } ?> <form id="gdsr-comments" method="post" action=""> <p><strong><?php _e("Vote log for post", "gd-star-rating"); ?> : <?php echo sprintf('<a href="./post.php?action=edit&post=%s">%s</a> <a href="%s" target="_blank">[view]</a>', $post_id, GDSRDB::get_post_title($post_id), get_permalink($post_id)); ?> </strong></p> <ul class="subsubsub"> <li><a<?php echo $select == "total" ? ' class="current"' : ''; ?> href="<?php echo $url; ?> &vg=total">All Votes (<?php echo $number_posts_all; ?> )</a> |</li> <li><a<?php echo $select == "users" ? ' class="current"' : '';
</th> <th scope="col"><?php _e("IP", "gd-star-rating"); ?> </th> <th scope="col"><?php _e("User Agent", "gd-star-rating"); ?> </th> </tr> </thead> <tbody> <?php $tr_class = ""; foreach ($rows as $row) { $row = GDSRDB::convert_moderation_row($row); echo '<tr id="post-' . $row->record_id . '" class="' . $tr_class . ' author-self status-publish" valign="top">'; echo '<th scope="row" class="check-column"><input name="gdsr_item[]" value="' . $row->record_id . '" type="checkbox"></th>'; echo '<td><strong>' . $row->voted . '</strong></td>'; echo '<td>' . $row->username . '</td>'; echo '<td><strong>' . $row->vote . '</strong></td>'; echo '<td>' . $row->ip . '</td>'; echo '<td>' . $row->user_agent . '</td>'; echo '</tr>'; if ($tr_class == "") { $tr_class = "alternate "; } else { $tr_class = ""; } } ?>
function gdTemplateRender($id, $section) { $this->tpl = wp_gdsr_get_template($id); if (!is_object($this->tpl) || $this->tpl->section != $section) { $t = GDSRDB::get_templates($section, true, true); $id = $t->template_id; $this->tpl = wp_gdsr_get_template($id); } $this->dep = array(); $dependencies = unserialize($this->tpl->dependencies); if (is_array($dependencies)) { foreach ($dependencies as $key => $value) { $this->dep[$key] = new gdTemplateRender($value, $key); } } $this->elm = unserialize($this->tpl->elements); if (is_array($this->elm)) { foreach ($this->elm as $key => $value) { preg_match_all('(%.+?%)', $value, $matches, PREG_PATTERN_ORDER); $this->tag[$key] = $matches[0]; } } }
<?php $votes_articles = GDSRDB::front_page_article_totals(); $votes_comments = GDSRDB::front_page_comment_totals(); $moderation = GDSRDB::front_page_moderation_totals(); $moderation_articles = 0; $moderation_comments = 0; if (is_array($moderation)) { foreach ($moderation as $m) { if ($m->vote_type == 'article') { $moderate_articles = $m->queue; } else { $moderation_comments = $m->queue; } } } ?> <div id="gdpt_server" class="postbox gdrgrid frontleft"> <h3 class="hndle"><span><?php _e("Quick Rating Facts", "gd-star-rating"); ?> </span></h3> <div class="inside"> <p class="gdptyouhave" style="font-size:13px;"> <?php printf(__("Registered users rated %s articles with average rating of %s and %s comments with average rating of %s. Visitors rated %s articles with average rating of %s and %s comments with average rating of %s.", "gd-star-rating"), '<strong>' . $votes_articles->votersu . '</strong>', '<strong><span style="color: red">' . @number_format($votes_articles->votesu / $votes_articles->votersu, 1) . '</span></strong>', '<strong>' . $votes_comments->votersu . '</strong>', '<strong><span style="color: red">' . @number_format($votes_comments->votesu / $votes_comments->votersu, 1) . '</span></strong>', '<strong>' . $votes_articles->votersv . '</strong>', '<strong><span style="color: red">' . @number_format($votes_articles->votesv / $votes_articles->votersv, 1) . '</span></strong>', '<strong>' . $votes_comments->votersv . '</strong>', '<strong><span style="color: red">' . @number_format($votes_comments->votesv / $votes_comments->votersv, 1) . '</span></strong>'); if ($options["moderation_active"] == 1) { printf(__(" There are %s article and %s comments ratings waiting in moderation queue.", "gd-star-rating"), '<strong><span style="color: red">' . $moderation_articles . '</span></strong>', '<strong><span style="color: red">' . $moderation_comments . '</span></strong>'); } ?>