示例#1
0
文件: ad.php 项目: Kheros/MMOver
                    $sort = false;
            }
            if ($comp and $sort and $ad_swap = $db->query_first("SELECT adid, displayorder FROM " . TABLE_PREFIX . "ad WHERE displayorder {$comp} {$ad_orig['displayorder']} ORDER BY displayorder {$sort}, title ASC LIMIT 1")) {
                $db->query_write("\r\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "ad\r\n\t\t\t\t\tSET displayorder = CASE adid\r\n\t\t\t\t\t\tWHEN {$ad_orig['adid']} THEN {$ad_swap['displayorder']}\r\n\t\t\t\t\t\tWHEN {$ad_swap['adid']} THEN {$ad_orig['displayorder']}\r\n\t\t\t\t\t\tELSE displayorder END\r\n\t\t\t\t\tWHERE adid IN({$ad_orig['adid']}, {$ad_swap['adid']})\r\n\t\t\t\t");
                // tell the datastore to update
                $changes = true;
            }
        }
    }
    //update the ad templates
    if ($changes) {
        require_once DIR . '/includes/functions_ad.php';
        require_once DIR . '/includes/adminfunctions_template.php';
        foreach ($changed_locations as $location) {
            // same as above, we're not telling user errors here, because they already confirmed the error else where
            $template = wrap_ad_template(build_ad_template($location), $location);
            $template_un = $template;
            $template = compile_template($template);
            $db->query_write("\r\n\t\t\t\tUPDATE " . TABLE_PREFIX . "template SET\r\n\t\t\t\t\ttemplate = '" . $db->escape_string($template) . "',\r\n\t\t\t\t\ttemplate_un = '" . $db->escape_string($template_un) . "',\r\n\t\t\t\t\tdateline = " . TIMENOW . ",\r\n\t\t\t\t\tusername = '******'username']) . "'\r\n\t\t\t\tWHERE\r\n\t\t\t\t\ttitle = 'ad_" . $db->escape_string($location) . "'\r\n\t\t\t\t\tAND styleid IN (-1,0)\r\n\t\t\t");
        }
    }
    $_REQUEST['do'] = 'modify';
}
// #############################################################################
// list existing ads
if ($_REQUEST['do'] == 'modify') {
    print_form_header('ad', 'quickupdate');
    print_column_style_code(array('width:100%', 'white-space:nowrap'));
    print_table_header($vbphrase['ad_manager']);
    $ad_result = $db->query("SELECT * FROM " . TABLE_PREFIX . "ad ORDER BY displayorder, title");
    $ad_count = $db->num_rows($ad_result);
示例#2
0
 /**
  * Step #12 - rebuild ads that use the is_date criterion #36100 or browsing forum criteria #34416
  *
  */
 function step_12()
 {
     $this->show_message($this->phrase['version']['403']['rebuilding_ad_criteria']);
     $ad_result = $this->db->query_read("\n\t\t\tSELECT ad.*\n\t\t\tFROM " . TABLE_PREFIX . "ad AS ad\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "adcriteria AS adcriteria ON(adcriteria.adid = ad.adid)\n\t\t\tWHERE adcriteria.criteriaid IN('is_date', 'browsing_forum_x', 'browsing_forum_x_and_children')\n\t\t");
     if ($this->db->num_rows($ad_result) > 0) {
         $ad_cache = array();
         $ad_locations = array();
         while ($ad = $this->db->fetch_array($ad_result)) {
             $ad_cache["{$ad['adid']}"] = $ad;
             $ad_locations[] = $ad['adlocation'];
         }
         require_once DIR . '/includes/functions_ad.php';
         require_once DIR . '/includes/adminfunctions_template.php';
         foreach ($ad_locations as $location) {
             $template = wrap_ad_template(build_ad_template($location), $location);
             $template_un = $template;
             $template = compile_template($template);
             if (template === false) {
                 $this->show_message(sprintf($this->phrase['vbphrase']['compile_template_x_failed'], 'ad_' . $location));
             } else {
                 $this->run_query(sprintf($this->phrase['vbphrase']['update_table'], TABLE_PREFIX . 'templatehistory'), "\n\t\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "template SET\n\t\t\t\t\t\t\t\ttemplate = '" . $this->db->escape_string($template) . "',\n\t\t\t\t\t\t\t\ttemplate_un = '" . $this->db->escape_string($template_un) . "',\n\t\t\t\t\t\t\t\tdateline = " . TIMENOW . ",\n\t\t\t\t\t\t\t\tusername = '******'username']) . "'\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\ttitle = 'ad_" . $this->db->escape_string($location) . "'\n\t\t\t\t\t\t\t\tAND styleid IN (-1,0)\n\t\t\t\t\t\t");
             }
         }
         build_all_styles();
     }
 }