コード例 #1
0
ファイル: menus.php プロジェクト: TheReaCompany/pooplog
 function star_multi_sets()
 {
     $wpv = $this->g->wp_version;
     $gdsr_page = isset($_GET["gdsr"]) ? $_GET["gdsr"] : "";
     $editor = true;
     if (isset($_POST['gdsr_action']) && $_POST['gdsr_action'] == 'save') {
         $editor = false;
         $eset = new GDMultiSingle(false);
         $eset->multi_id = $_POST["gdsr_ms_id"];
         $eset->name = stripslashes(htmlentities($_POST["gdsr_ms_name"], ENT_QUOTES, STARRATING_ENCODING));
         $eset->description = stripslashes(htmlentities($_POST["gdsr_ms_description"], ENT_QUOTES, STARRATING_ENCODING));
         if (isset($_POST["gdsr_ms_stars"])) {
             $eset->stars = $_POST["gdsr_ms_stars"];
         }
         $eset->auto_insert = $_POST["gdsr_ms_autoinsert"];
         $eset->auto_categories = $_POST["gdsr_ms_autocategories"];
         $eset->auto_location = $_POST["gdsr_ms_autolocation"];
         $elms = $_POST["gdsr_ms_element"];
         $elwe = $_POST["gdsr_ms_weight"];
         $i = 0;
         foreach ($elms as $el) {
             if ($el != "" && $eset->multi_id == 0 || $eset->multi_id > 0) {
                 $eset->object[] = stripslashes(htmlentities($el, ENT_QUOTES, STARRATING_ENCODING));
                 $ew = $elwe[$i];
                 if (!is_numeric($ew)) {
                     $ew = 1;
                 }
                 $eset->weight[] = $ew;
                 $i++;
             }
         }
         if ($eset->name != "") {
             if ($eset->multi_id == 0) {
                 $set_id = GDSRDBMulti::add_multi_set($eset);
             } else {
                 $set_id = $eset->multi_id;
                 GDSRDBMulti::edit_multi_set($eset);
             }
         }
     }
     $options = $this->g->o;
     if (($gdsr_page == "munew" || $gdsr_page == "muedit") && $editor) {
         include STARRATING_PATH . 'options/multis/editor.php';
     } else {
         switch ($gdsr_page) {
             case "mulist":
             default:
                 include STARRATING_PATH . 'options/multis/sets.php';
                 break;
             case "murpost":
                 include STARRATING_PATH . 'options/multis/results_post.php';
                 break;
             case "murset":
                 include STARRATING_PATH . 'options/multis/results_set.php';
                 break;
         }
     }
 }