예제 #1
0
 function listReleases($project_id)
 {
     $pluginBase = 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'listingx';
     require_once ABSPATH . $pluginBase . DIRECTORY_SEPARATOR . 'listingx_list.php';
     global $filter;
     $list = new listingx_list();
     $list->search = false;
     $list->orderForm = false;
     $list->omit = array("cb");
     $list->fold = true;
     $rows = array();
     $headers["r.lx_release_version"] = "Version";
     $headers["u.user_login"] = "******";
     $headers["r.lx_release_notes"] = "Notes";
     $headers["r.lx_release_log"] = "Log";
     $headers["r.lx_release_public"] = "Public";
     $headers["r.lx_release_approved"] = "Approved";
     $query = "select r.lx_release_version as version, ";
     $query .= "r.lx_release_id as id, ";
     $query .= "u.user_login as owner, ";
     $query .= "r.lx_release_notes as notes, ";
     $query .= "r.lx_release_log as log, ";
     $query .= "r.lx_release_public as public, ";
     $query .= "r.lx_release_approved as approved ";
     $query .= "from " . $this->wpdb->prefix . "lx_release r ";
     $query .= "left join " . $this->wpdb->prefix . "users u on u.ID = r.user_id ";
     $query .= "where r.lx_project_id = '{$project_id}' order by r.lx_release_date asc";
     $result = $this->wpdb->get_results($query);
     foreach ($result as $row) {
         $approved = $filter[$row->approved];
         $public = $filter[$row->public];
         $rows[$row->id] = array($row->version, $row->owner, $row->notes, $row->log, $public, $approved);
         $query = "select lx_file_id as id, lx_file_name as name, lx_file_size as size, ";
         $query .= "lx_file_type as type, lx_file_download as download from " . $this->wpdb->prefix . "lx_file where ";
         $query .= "lx_release_id = '" . $row->id . "'";
         $result1 = $this->wpdb->get_results($query);
         $s = array();
         foreach ($result1 as $r) {
             $s[] = array("id" => $r->id, "name" => $r->name, "size" => $r->size, "type" => $r->type, "download" => $r->download);
         }
         $rows[$row->id]["sub"] = $s;
     }
     $url = "admin.php?page=lx_projects&action=release&releaseAction=form&id=";
     $list->startList($headers, $url, '', '', $rows, array("page" => "lx_projects"));
     $text .= $list->text . "</div>";
     return $text;
 }
예제 #2
0
 function listCat()
 {
     $pluginBase = 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'listingx';
     require_once ABSPATH . $pluginBase . DIRECTORY_SEPARATOR . 'listingx_list.php';
     global $filter;
     $nonce = wp_create_nonce();
     $list = new listingx_list();
     $list->search = false;
     $list->orderForm = false;
     $list->omit = array("cb");
     $list->addFilter("c.lx_project_cat_approved", "Approved", array("0" => "No", "1" => "Yes"));
     $text = "<div class=\"wrap\">";
     $text .= "<h2>ListingX - Project Categories</h2>";
     $text .= "<a href=\"?page=lx_categories&action=form&sub=add\">Add Category</a>";
     $text .= $this->parent->message;
     $headers["cb"] = "<input type=\"checkbox\" />";
     $headers["c.lx_project_cat_name"] = "Category Name";
     $headers["c.user_id"] = "Added By";
     $headers["c.lx_project_cat_approved"] = "Approved";
     $order = "c.lx_project_cat_name";
     $sort = "asc";
     $query = "select c.lx_project_cat_id, c.lx_project_cat_name, u.user_login, c.lx_project_cat_approved from ";
     $query .= $this->wpdb->prefix . "lx_project_cat c left join " . $this->wpdb->prefix . "users u on u.ID = c.user_id ";
     if ($_GET["c_lx_project_cat_approved"] != '') {
         $query .= "where c.lx_project_cat_approved = %d ";
     }
     $query .= "order by %s %s";
     if ($_GET["c_lx_project_cat_approved"] != '') {
         $result = $this->wpdb->get_results($this->wpdb->prepare($query, $_GET["c_lx_project_cat_approved"], $order, $sort));
     } else {
         $result = $this->wpdb->get_results($this->wpdb->prepare($query, $order, $sort));
     }
     foreach ($result as $row) {
         if ($row->lx_project_cat_approved == 1) {
             $approved = $filter[$row->lx_project_cat_approved];
         } else {
             $approved = "<a href=\"admin.php?page=lx_categories&action=approve&_wpnonce={$nonce}&id=" . $row->lx_project_cat_id . "\">No</a>";
         }
         $rows[$row->lx_project_cat_id] = array($row->lx_project_cat_name, $row->user_login, $approved);
     }
     $url = "admin.php?page=lx_categories&action=form&id=";
     $list->startList($headers, $url, $order, $sort, $rows, array("page" => "lx_categories"));
     $text .= $list->text . "</div>";
     $this->text = $text;
 }
예제 #3
0
 function listProjects()
 {
     $pluginBase = 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'listingx';
     require_once ABSPATH . $pluginBase . DIRECTORY_SEPARATOR . 'listingx_list.php';
     global $filter;
     $list = new listingx_list();
     $list->search = true;
     $list->orderForm = true;
     $list->omit = array("cb");
     $list->addFilter("p.lx_project_approved", "Approved", array("0" => "No", "1" => "Yes"));
     $text = "<div class=\"wrap\">";
     $text .= "<h2>ListingX - Projects</h2>";
     $text .= "<a href=\"?page=lx_projects&action=form&sub=add\">Add Project</a>";
     $text .= $this->parent->message;
     $headers["cb"] = "<input type=\"checkbox\" />";
     $headers["p.lx_project_name"] = "Project Name";
     $headers["u.user_login"] = "******";
     $headers["c.lx_project_cat_name"] = "Categories";
     $headers["p.lx_project_approved"] = "Approved";
     $order = "p.lx_project_name";
     $sort = "asc";
     $query = "select p.lx_project_id, p.lx_project_name, u.user_login, p.lx_project_approved from ";
     $query .= $this->wpdb->prefix . "lx_project p left join " . $this->wpdb->prefix . "users u on u.ID = p.user_id order by {$order} {$sort}";
     $result = $this->wpdb->get_results($query);
     foreach ($result as $row) {
         $approved = $filter[$row->lx_project_approved];
         $categories = $this->catForm("list", $row->lx_project_id);
         $rows[$row->lx_project_id] = array($row->lx_project_name, $row->user_login, $categories, $approved);
     }
     $url = "admin.php?page=lx_projects&action=view&id=";
     $list->startList($headers, $url, $order, $sort, $rows, array("page" => "lx_projects"));
     $text .= $list->text . "</div>";
     $this->text = $text;
 }
예제 #4
0
 function listingx_admin_page()
 {
     /**
      * Creates the Admin page
      */
     $dateFormat = get_option("date_format") . ", " . get_option("time_format");
     $pluginBase = 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'listingx';
     require_once ABSPATH . $pluginBase . DIRECTORY_SEPARATOR . 'listingx_list.php';
     require_once ABSPATH . $pluginBase . DIRECTORY_SEPARATOR . 'listingx_projects.php';
     global $filter;
     $projectObj = new listingx_projects($this, false);
     $nonce = wp_create_nonce();
     $list = new listingx_list();
     $list->search = false;
     $list->orderForm = false;
     $list->filters = false;
     $list->omit = array("cb");
     $text .= "<div class=\"wrap\">";
     $text .= "<h2>ListingX</h2>";
     $text .= $this->parent->message;
     $headers["p.lx_project_name"] = "Project Name";
     $headers["u.user_login"] = "******";
     $headers["r.lx_release_version"] = "Approve";
     $headers["r.lx_release_date"] = "Date";
     $headers["r.lx_release_notes"] = "Notes";
     $headers["r.lx_release_log"] = "Change Log";
     $order = "p.lx_project_name";
     $sort = "asc";
     $query = "select p.lx_project_id as project_id, ";
     $query .= "p.lx_project_name as project, ";
     $query .= "u.user_login as username, ";
     $query .= "r.lx_release_id as release_id, ";
     $query .= "r.lx_release_date as releaseDate, ";
     $query .= "r.lx_release_version as version, ";
     $query .= "r.lx_release_notes as notes, ";
     $query .= "r.lx_release_log as log ";
     $query .= "from (" . $this->wpdb->prefix . "lx_release r,";
     $query .= $this->wpdb->prefix . "lx_project p) ";
     $query .= "left join " . $this->wpdb->prefix . "users u on u.ID = r.user_id ";
     $query .= "where r.lx_release_approved = 0 and r.lx_project_id = p.lx_project_id ";
     $query .= "and r.lx_release_public = 1 ";
     $query .= "order by {$order} {$sort}";
     $result = $this->wpdb->get_results($query);
     foreach ($result as $row) {
         $approved = "<a href=\"admin.php?page=lx_projects&action=release&releaseAction=approve&_wpnonce={$nonce}&id=" . $row->release_id . "\">Approve</a>";
         $date = date($dateFormat, $row->releaseDate);
         $rows[$row->project_id] = array($row->project, $row->username, $approved, $date, $row->version, $row->notes, $row->log);
     }
     $url = "admin.php?page=lx_projects&action=view&id=";
     $list->startList($headers, $url, $order, $sort, $rows, array("page" => "lx_projects"));
     $list1 = new listingx_list();
     $list1->search = false;
     $list1->orderForm = false;
     $list1->omit = array("cb");
     $headers = array();
     $headers["p.lx_project_name"] = "Project Name";
     $headers["u.user_login"] = "******";
     $headers["c.lx_project_cat_name"] = "Categories";
     $headers["p.lx_project_approved"] = "Approved";
     $order = "p.lx_project_name";
     $sort = "asc";
     $query = "select p.lx_project_id, p.lx_project_name, u.user_login, p.lx_project_approved from ";
     $query .= $this->wpdb->prefix . "lx_project p left join " . $this->wpdb->prefix . "users u on u.ID = p.user_id ";
     $query .= "where p.lx_project_approved = 0 order by {$order} {$sort}";
     $result = $this->wpdb->get_results($query);
     foreach ($result as $row) {
         $approved = "<a href=\"admin.php?page=lx_projects&action=approve&_wpnonce={$nonce}&id=" . $row->lx_project_id . "\">Approve</a>";
         $categories = $projectObj->catForm("list", $row->lx_project_id);
         $rows[$row->lx_project_id] = array($row->lx_project_name, $row->user_login, $categories, $approved);
     }
     $url = "admin.php?page=lx_projects&action=view&id=";
     $list1->startList($headers, $url, $order, $sort, $rows, array("page" => "lx_projects"));
     $text .= $list->text . "<br /><br />" . $list1->text . "</div>";
     $this->stroke($text);
 }