Пример #1
0
 function generate_captcha_html($question)
 {
     global $PHORUM;
     // We only have upper case chars in our banner class.
     $question = strtoupper($question);
     // Create a bitmap for the generated question.
     $banner = new banner("banner_large.fnt");
     $asciiart = implode("\n", $banner->format($question));
     $asciiart = str_replace("#", "*", $asciiart);
     // Create the HTML code for the captcha.
     $captcha = "<div id=\"spamhurdles_captcha_image\">" . "<pre id=\"spamhurdles_captcha_asciiart\">" . $asciiart . "</pre>" . "</div>";
     return array($captcha, "");
 }
Пример #2
0
 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new banner();
         $o->select_max('position');
         $o->get();
         if (count($o->all) != 0) {
             $max = $o->position + 1;
             $this->position = $max;
         } else {
             $this->postion = 1;
         }
     }
     return parent::save($object, $related_field);
 }
Пример #3
0
 function detail($id)
 {
     $id = $this->uri->segment(3);
     $galleriesCat = new bannercat($id);
     $dis['galleriesCat'] = $galleriesCat;
     $banner = new banner();
     $banner->where('bannercat_id', $id);
     $banner->get_iterated();
     $dis['banner'] = $banner;
     $this->page_title = $banner->name;
     $this->page_description = $banner->name;
     $this->page_keyword = $banner->name;
     // products
     $galleriesSame = new bannercat();
     $galleriesSame->where('id !=', 25);
     $galleriesSame->where('id !=', $galleriesCat->id);
     $galleriesSame->get_iterated();
     $dis['galleriesSame'] = $galleriesSame;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/galleries/galleries-de';
     $this->viewfront($dis);
 }
Пример #4
0
class banner
{
    private $ancho;
    private $alto;
    private $mensaje;
    private $imagen;
    private $colorTexto;
    private $colorFondo;
    public function __construct($an, $alt, $men)
    {
        $this->ancho = $an;
        $this->alto = $alt;
        $this->mensaje = $men;
        $this->imagen = imagecreate($this->ancho, $this->alto);
        $this->colorTexto = imagecolorallocate($this->imagen, 255, 255, 0);
        $this->colorFondo = imagecolorallocate($this->imagen, 255, 0, 00);
        imagefill($this->imagen, 0, 0, $this->colorFondo);
    }
    public function dibujar()
    {
        imagestring($this->imagen, 5, 50, 10, $this->mensaje, $this->colorTexto);
        header("Content-type: image/png");
        imagepng($this->imagen);
    }
    public function __destruct()
    {
        imagedestroy($this->imagen);
    }
}
$banner1 = new banner(428, 45, "Sistemas de ventas por mayor y menor.");
$banner1->dibujar();
Пример #5
0
 function delete_image($bannercat_id, $banner_id)
 {
     $this->load->library('file_lib');
     $bannercat = new bannercat($bannercat_id);
     $banner = new banner($banner_id);
     if (!$bannercat->exists()) {
         show_404();
     }
     if ($banner->isCanNotDelete == 1) {
         flash_message('error', 'Không thể xóa banner này');
     } else {
         $banner->delete();
         flash_message('success', 'Xóa thành công');
     }
     redirect($this->admin_url . "bannercats/list_image/" . $bannercat_id);
 }
Пример #6
0
}
?>
                	</ul>
                </div>
            </div>
        </div>
    </div>
    <div class="groupcol2">
        <div class="constructioncol2">
            <div class="titleconstructioncol2"><h1>Hình ảnh khác<?php 
//lang('galleries')
?>
</h1></div>
            <?php 
foreach ($galleriesSame as $row) {
    $banner = new banner();
    $banner->where('bannercat_id', $row->id);
    $banner->get();
    ?>
            <div class="listgalleries">
                <div class="imglistgalleries">
                    <a title="<?php 
    echo $row->name;
    ?>
" href="<?php 
    echo $base_url . $this->lang->lang();
    ?>
/gallery/<?php 
    echo $row->id;
    ?>
">
Пример #7
0
    function generate_captcha_html($question)
    {
        $PHORUM = $GLOBALS["PHORUM"];
        $lang = $GLOBALS["PHORUM"]["DATA"]["LANG"]["mod_spamhurdles"];
        // We only have upper case chars in our banner class.
        $question = strtoupper($question);
        // Create a bitmap for the generated question.
        $banner = new banner();
        $formatted = $banner->format($question);
        // Extract all active pixels from the bitmap.
        $points = array();
        $rows = count($formatted);
        $cols = strlen($formatted[0]);
        foreach ($formatted as $row => $raster) {
            for ($col = 0; $col < strlen($raster); $col++) {
                if ($raster[$col] != ' ') {
                    $points[] = array($col, $row);
                }
            }
        }
        // Pixelsize.
        $psx = 4;
        $psy = 3;
        // Generate the HTML content.
        ob_start();
        $captcha_h = ($rows + 3) * $psy;
        $captcha_w = ($cols + 2) * $psx;
        ?>
        <div style="overflow:hidden; position:relative; padding:0px; background-color: #fff; border: 1px solid black; width: <?php 
        print $captcha_w;
        ?>
px; height: <?php 
        print $captcha_h;
        ?>
px;" id="spamhurdles_captcha_image">
        </div>
        <?php 
        $form = ob_get_contents();
        ob_end_clean();
        ob_start();
        ?>
        <script type="text/javascript">

        function spamhurdles_captcha_add_pixel(x,y) {
            if (!document.getElementById) return;

            var captcha = document.getElementById("spamhurdles_captcha_image"); 
            var pixel = document.createElement("div");
            pixel.innerHTML = "<span></span>";
            pixel.style.backgroundColor = randomcolor(20,130);
            pixel.style.width = "<?php 
        print $psx;
        ?>
px";
            pixel.style.height = "<?php 
        print $psy;
        ?>
px";
            pixel.style.position = "absolute";
            pixel.style.top = ((1+y)*<?php 
        print $psy;
        ?>
) + "px";
            pixel.style.left = ((1+x)*<?php 
        print $psx;
        ?>
) + "px";
            captcha.appendChild(pixel);
        }

        function spamhurdles_captcha_background() {
            if (!document.getElementById) return;

            var captcha = document.getElementById("spamhurdles_captcha_image"); 
            captcha.style.backgroundColor = randomcolor(150,200);
            var blockwidth = Math.ceil(<?php 
        print ($cols + 2) * $psx;
        ?>
/10);
            for (i=0; i<10; i++) {
                var block = document.createElement("div");
                block.innerHTML = "<span></span>";
                block.style.backgroundColor = randomcolor(100,230);
                block.style.width = blockwidth + "px";
                block.style.height = "<?php 
        print $captcha_h;
        ?>
px";
                block.style.position = "absolute";
                block.style.top = 0;
                block.style.left = (blockwidth * i) + "px";
                captcha.appendChild(block);
            }
        }

        function randomcolor(min, max) {
            r = min + Math.floor(Math.random()*(max-min)+1);
            g = min + Math.floor(Math.random()*(max-min)+1);
            b = min + Math.floor(Math.random()*(max-min)+1);
            return "rgb("+r+","+g+","+b+")";
        }

        spamhurdles_captcha_background();
        <?php 
        shuffle($points);
        foreach ($points as $point) {
            print "spamhurdles_captcha_add_pixel({$point[0]},{$point[1]});\n";
        }
        ?>
        </script>
        <?php 
        $after_form = ob_get_contents();
        ob_end_clean();
        // Some extra scrambling to make things harder for spammers.
        $form = spamhurdles_iScramble($form, false, false, '<div id="spamhurdles_captcha_image">' . $lang["JavascriptCaptchaNoscript"] . '</div>');
        $after_form = spamhurdles_iScramble($after_form, false, false, "");
        return array($form, $after_form);
    }
Пример #8
0
/**
 * Generate Banner Section
 *
 * @param connection $object
 * @param integer $position
 * @param integer $interval
 * @return string
 */
function getBanner($object, $position, $interval = 2000)
{
    if (!$object) {
        $object = new banner();
    }
    $object->Select(array('bn_title', 'bn_photo_img', 'bn_href', 'bn_company'), '', " WHERE bn_position = {$position}", null, null, false);
    $cntRows = $object->RowCount();
    switch ($position) {
        case 1:
            $wImg = 186;
            $hImg = 199;
            break;
        case 2:
            $wImg = 187;
            $hImg = 153;
            break;
        case 3:
        case 4:
            $wImg = 187;
            $hImg = 70;
            break;
        case 5:
            $wImg = 209;
            $hImg = 176;
            break;
    }
    if ($cntRows) {
        if (1 == $cntRows) {
            $row = $object->Row();
            if ($row->bn_href) {
                $href = "href=\"{$row->bn_href}\" target=\"_blank\"";
            }
            $banner = "<a id=\"banner{$position}_a\" {$href} ><img src=\"" . PROJECT_UPLOAD_URL . $row->bn_photo_img . "\" title=\"{$row->bn_title}\" alt=\"{$row->bn_title}\" width=\"{$wImg}\" height=\"{$hImg}\" id=\"banner{$position}\" border=\"0\" /></a>";
        } else {
            while (!$object->EOF()) {
                $row = $object->Row();
                if (!$banner) {
                    $i = 0;
                    $banner = "\n<a id=\"banner{$position}_a\" target=\"_blank\" ><img src=\"" . PROJECT_UPLOAD_URL . $row->bn_photo_img . "\" title=\"{$row->bn_title}\" alt=\"{$row->bn_title}\" width=\"{$wImg}\" height=\"{$hImg}\" id=\"banner{$position}\" border=\"0\" /></a>\n<script type=\"text/javascript\">\n    var banner{$position}Arr    = new Array();\n    var banner{$position}HRef   = new Array();\n    var banner{$position}Title  = new Array();\n\t";
                } else {
                    ++$i;
                }
                $banner .= "\n    banner{$position}Arr[{$i}]    = '" . PROJECT_UPLOAD_URL . $row->bn_photo_img . "';\n    banner{$position}HRef[{$i}]   = '" . $row->bn_href . "';\n    banner{$position}Title[{$i}]  = '" . $row->bn_title . "';";
                $imgArrLoad[] = "'" . PROJECT_UPLOAD_URL . $row->bn_photo_img . "'";
            }
            $banner .= "\n            \n    slideAdIni('banner{$position}', {$interval});\n    \n    jQuery().ready(function() {\n        MM_preloadImages(" . implode(', ', $imgArrLoad) . ");\n    });\n</script>";
        }
    } else {
        $banner = "<img src=\"img/img_banner{$position}.jpg\" width=\"{$wImg}\" height=\"{$hImg}\" id=\"banner{$position}\" />";
    }
    return $banner;
}
Пример #9
0
 function delete_image($id)
 {
     $banner = new banner($id);
     if (!$banner->exists()) {
         show_404();
     }
     $bannercat_id = $banner->bannercat_id;
     $banner->delete();
     redirect($this->admin_url . "bannercats/list_image/" . $bannercat_id);
 }
Пример #10
0
get_header();
?>

                    
<div id="pageContentFront">

<?php 
if (has_post_thumbnail()) {
    ?>
<div class="bannerBackground">
<div class="container">

  <div class="row">
	
	<?php 
    $banner = new banner();
    $banner->frontBanner();
    ?>
    
	</div>
</div>
</div>
<?php 
}
?>

<?php 
if (is_active_sidebar('features')) {
    ?>
<div class="features">
	<div class="container">
Пример #11
0
    /**
     * main routine to convert old school module data into new controller format
     * @global db the exponent database object
     * @param  $iloc
     * @param  $module
     * @param int $hc
     * @return
     */
    private function convert($iloc, $module, $hc = 0)
    {
        if (!array_key_exists($iloc->mod, $this->params['migrate'])) {
            return $module;
        }
        global $db;
        $old_db = $this->connect();
        $linked = false;
        $loc = null;
        switch ($iloc->mod) {
            case 'textmodule':
                @($module->view = 'showall');
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "text";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'textmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'textmodule';
                $textitems = $old_db->selectObjects('textitem', "location_data='" . serialize($iloc) . "'");
                if ($textitems) {
                    foreach ($textitems as $ti) {
                        $text = new text();
                        $loc = expUnserialize($ti->location_data);
                        $loc->mod = "text";
                        $text->location_data = serialize($loc);
                        $text->body = $ti->text;
                        $text->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'rotatormodule':
                $module->action = 'showRandom';
                $module->view = 'showRandom';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "text";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'rotatormodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'rotatormodule';
                $textitems = $old_db->selectObjects('rotator_item', "location_data='" . serialize($iloc) . "'");
                if ($textitems) {
                    foreach ($textitems as $ti) {
                        $text = new text();
                        $loc = expUnserialize($ti->location_data);
                        $loc->mod = "text";
                        $text->location_data = serialize($loc);
                        $text->body = $ti->text;
                        $text->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'snippetmodule':
                $module->view = 'showall';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "snippet";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'snippetmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'snippetmodule';
                $textitems = $old_db->selectObjects('textitem', "location_data='" . serialize($iloc) . "'");
                if ($textitems) {
                    foreach ($textitems as $ti) {
                        $text = new snippet();
                        $loc = expUnserialize($ti->location_data);
                        $loc->mod = "snippet";
                        $text->location_data = serialize($loc);
                        $text->body = $ti->text;
                        // if the item exists in the current db, we won't save it
                        $te = $text->find('first', "location_data='" . $text->location_data . "'");
                        if (empty($te)) {
                            $text->save();
                            @$this->msg['migrated'][$iloc->mod]['count']++;
                            @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                        }
                    }
                }
                break;
            case 'linklistmodule':
                switch ($module->view) {
                    case 'Quick Links':
                        @($module->view = "showall_quicklinks");
                        break;
                    default:
                        @($module->view = 'showall');
                        break;
                }
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "links";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'linklistmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'linklistmodule';
                $links = $old_db->selectArrays('linklist_link', "location_data='" . serialize($iloc) . "'");
                if ($links) {
                    foreach ($links as $link) {
                        $lnk = new links();
                        $loc = expUnserialize($link['location_data']);
                        $loc->mod = "links";
                        $lnk->title = !empty($link['name']) ? $link['name'] : 'Untitled';
                        $lnk->body = $link['description'];
                        $lnk->new_window = $link['opennew'];
                        $lnk->url = !empty($link['url']) ? $link['url'] : '#';
                        $lnk->rank = $link['rank'];
                        $lnk->poster = 1;
                        $lnk->editor = 1;
                        $lnk->location_data = serialize($loc);
                        $lnk->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'linkmodule':
                // user mod, not widely distributed
                switch ($module->view) {
                    case 'Summary':
                        @($module->view = "showall_quicklinks");
                        break;
                    default:
                        @($module->view = 'showall');
                        break;
                }
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "links";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'linkmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'linkmodule';
                $links = $old_db->selectArrays('link', "location_data='" . serialize($iloc) . "'");
                $oldconfig = $old_db->selectObject('linkmodule_config', "location_data='" . serialize($iloc) . "'");
                if ($links) {
                    foreach ($links as $link) {
                        $lnk = new links();
                        $loc = expUnserialize($link['location_data']);
                        $loc->mod = "links";
                        $lnk->title = !empty($link['name']) ? $link['name'] : 'Untitled';
                        $lnk->body = $link['description'];
                        $lnk->new_window = $link['opennew'];
                        $lnk->url = !empty($link['url']) ? $link['url'] : '#';
                        $lnk->rank = $link['rank'];
                        $lnk->poster = 1;
                        $lnk->editor = 1;
                        $lnk->location_data = serialize($loc);
                        $lnk->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                    if ($oldconfig->enable_rss == 1) {
                        $config['enable_rss'] = true;
                        $config['feed_title'] = $oldconfig->feed_title;
                        $config['feed_desc'] = $oldconfig->feed_desc;
                        $config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
                        $config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
                        $newconfig = new expConfig();
                        $newconfig->config = $config;
                        $newconfig->location_data = $loc;
                        $newconfig->save();
                        $newrss = new expRss();
                        $newrss->module = $loc->mod;
                        $newrss->src = $loc->src;
                        $newrss->enable_rss = $oldconfig->enable_rss;
                        $newrss->feed_title = $oldconfig->feed_title;
                        $newrss->feed_desc = $oldconfig->feed_desc;
                        $newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
                        $newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
                        $newrss->save();
                    }
                }
                break;
            case 'swfmodule':
                $module->view = 'showall';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "text";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'swfmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'swfmodule';
                $swfitems = $old_db->selectObjects('swfitem', "location_data='" . serialize($iloc) . "'");
                if ($swfitems) {
                    foreach ($swfitems as $ti) {
                        $text = new text();
                        $file = new expFile($ti->swf_id);
                        $loc = expUnserialize($ti->location_data);
                        $loc->mod = "text";
                        $text->location_data = serialize($loc);
                        $text->title = $ti->name;
                        $swfcode = '
							<p>
							 <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" height="' . $ti->height . '" width="' . $ti->width . '">
								 <param name="bgcolor" value="' . $ti->bgcolor . '" />
									' . ($ti->transparentbg ? "<param name=\"wmode\" value=\"transparent\" />" : "") . '
								 <param name="quality" value="high" />
								 <param name="movie" value="' . $file->path_relative . '" />
								 <embed bgcolor= "' . $ti->bgcolor . '" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="' . $file->path_relative . '" type="application/x-shockwave-flash" height="' . $ti->height . '" width="' . $ti->width . '"' . ($ti->transparentbg ? " wmode=\"transparent\"" : "") . '>
								 </embed>
							 </object>
							</p>
						';
                        $text->body = $swfcode;
                        $text->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'newsmodule':
                if ($module->view == 'Featured News') {
                    $only_featured = true;
                }
                switch ($module->view) {
                    case 'Headlines':
                        $module->view = 'showall_headlines';
                        break;
                    case 'Summary':
                        $module->view = 'showall_summary';
                        break;
                    default:
                        $module->view = 'showall';
                        break;
                }
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "news";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'newsmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'newsmodule';
                $newsitems = $old_db->selectArrays('newsitem', "location_data='" . serialize($iloc) . "'");
                $oldconfig = $old_db->selectObject('newsmodule_config', "location_data='" . serialize($iloc) . "'");
                if ($newsitems) {
                    $files_attached = false;
                    foreach ($newsitems as $ni) {
                        unset($ni['id']);
                        $news = new news($ni);
                        $loc = expUnserialize($ni['location_data']);
                        $loc->mod = "news";
                        $news->location_data = serialize($loc);
                        $news->title = !empty($ni['title']) ? $ni['title'] : gt('Untitled');
                        $news->body = !empty($ni['body']) ? $ni['body'] : gt('(empty)');
                        $news->save();
                        // default is to create with current time
                        $news->created_at = $ni['posted'];
                        $news->edited_at = $ni['edited'];
                        $news->update();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                        if (!empty($ni['file_id'])) {
                            $file = new expFile($ni['file_id']);
                            $news->attachitem($file, '');
                            $files_attached = true;
                        }
                    }
                    $newconfig = new expConfig();
                    if ($files_attached) {
                        // fudge a config to get attached files to appear
                        $newconfig->config = 'a:14:{s:9:"feedmaker";s:0:"";s:11:"filedisplay";s:7:"Gallery";s:6:"ffloat";s:4:"Left";s:6:"fwidth";s:3:"120";s:7:"fmargin";s:1:"5";s:7:"piwidth";s:3:"100";s:5:"thumb";s:3:"100";s:7:"spacing";s:2:"10";s:10:"floatthumb";s:8:"No Float";s:6:"tclass";s:0:"";s:5:"limit";s:0:"";s:9:"pagelinks";s:14:"Top and Bottom";s:10:"feed_title";s:0:"";s:9:"feed_desc";s:0:"";}';
                    }
                    if ($oldconfig->enable_rss == 1) {
                        if ($newconfig->config != null) {
                            $config = expUnserialize($newconfig->config);
                        }
                        $config['enable_rss'] = true;
                        $config['feed_title'] = $oldconfig->feed_title;
                        $config['feed_desc'] = $oldconfig->feed_desc;
                        $config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
                        $config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
                        $newconfig->config = $config;
                        $newrss = new expRss();
                        $newrss->module = $loc->mod;
                        $newrss->src = $loc->src;
                        $newrss->enable_rss = $oldconfig->enable_rss;
                        $newrss->feed_title = $oldconfig->feed_title;
                        $newrss->feed_desc = $oldconfig->feed_desc;
                        $newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
                        $newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
                        $newrss->save();
                    }
                    if ($only_featured) {
                        $newconfig->config['only_featured'] = true;
                    }
                    if ($newconfig != null) {
                        $newconfig->location_data = $loc;
                        $newconfig->save();
                    }
                }
                break;
            case 'resourcesmodule':
                switch ($module->view) {
                    case 'One Click Download - Descriptive':
                        $module->view = 'showall_quick_download_with_description';
                        break;
                    default:
                        $module->view = 'showall';
                        break;
                }
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "filedownload";
                if ($db->countObjects('filedownloads', "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'resourcesmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'resourcesmodule';
                $resourceitems = $old_db->selectArrays('resourceitem', "location_data='" . serialize($iloc) . "'");
                $oldconfig = $old_db->selectObject('resourcesmodule_config', "location_data='" . serialize($iloc) . "'");
                if ($resourceitems) {
                    foreach ($resourceitems as $ri) {
                        unset($ri['id']);
                        $filedownload = new filedownload($ri);
                        $loc = expUnserialize($ri['location_data']);
                        $loc->mod = "filedownload";
                        $filedownload->title = !empty($ri['name']) ? $ri['name'] : 'Untitled';
                        $filedownload->body = $ri['description'];
                        $filedownload->downloads = $ri['num_downloads'];
                        $filedownload->location_data = serialize($loc);
                        if (!empty($ri['file_id'])) {
                            $filedownload->save();
                            @$this->msg['migrated'][$iloc->mod]['count']++;
                            @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                            $file = new expFile($ri['file_id']);
                            $filedownload->attachitem($file, 'downloadable');
                            // default is to create with current time
                            $filedownload->created_at = $ri['posted'];
                            $filedownload->edited_at = $ri['edited'];
                            $filedownload->update();
                        }
                    }
                    if (isset($oldconfig->enable_rss)) {
                        $dorss = $oldconfig->enable_rss;
                    } elseif (isset($oldconfig->enable_podcasting)) {
                        $dorss = $oldconfig->enable_podcasting;
                    } else {
                        $dorss = false;
                    }
                    if ($dorss) {
                        $config['enable_rss'] = true;
                        $config['feed_title'] = $oldconfig->feed_title;
                        $config['feed_desc'] = $oldconfig->feed_desc;
                        $config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
                        $config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
                        $newconfig = new expConfig();
                        $newconfig->config = $config;
                        $newconfig->location_data = $loc;
                        $newconfig->save();
                        $newrss = new expRss();
                        $newrss->module = $loc->mod;
                        $newrss->src = $loc->src;
                        //						$newrss->enable_rss = $oldconfig->enable_rss;
                        $newrss->enable_rss = true;
                        $newrss->feed_title = $oldconfig->feed_title;
                        $newrss->feed_desc = $oldconfig->feed_desc;
                        $newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
                        $newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
                        $newrss->save();
                    }
                }
                break;
            case 'imagegallerymodule':
                switch ($module->view) {
                    case 'Slideshow':
                        $module->action = 'slideshow';
                        $module->view = 'showall';
                        break;
                    default:
                        $module->view = 'showall';
                        break;
                }
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "photos";
                if ($db->countObjects('photo', "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'imagegallerymodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'imagegallerymodule';
                $galleries = $old_db->selectArrays('imagegallery_gallery', "location_data='" . serialize($iloc) . "'");
                if ($galleries) {
                    foreach ($galleries as $gallery) {
                        $gis = $old_db->selectArrays('imagegallery_image', "gallery_id='" . $gallery['id'] . "'");
                        foreach ($gis as $gi) {
                            $photo = new photo();
                            $loc = expUnserialize($gallery['location_data']);
                            $loc->mod = "photos";
                            $photo->title = !empty($gi['name']) ? $gi['name'] : 'Untitled';
                            $photo->body = $gi['description'];
                            $photo->alt = $gi['alt'];
                            $photo->location_data = serialize($loc);
                            if (!empty($gi['file_id'])) {
                                $photo->save();
                                @$this->msg['migrated'][$iloc->mod]['count']++;
                                @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                                $file = new expFile($gi['file_id']);
                                $photo->attachitem($file, '');
                                $photo->created_at = $gi['posted'];
                                $photo->edited_at = $gi['posted'];
                                $photo->update(array("validate" => false));
                            }
                        }
                    }
                }
                break;
            case 'slideshowmodule':
                $module->action = 'slideshow';
                $module->view = 'showall';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "photos";
                if ($db->countObjects('photo', "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'slideshowmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'slideshowmodule';
                $galleries = $old_db->selectArrays('imagegallery_gallery', "location_data='" . serialize($iloc) . "'");
                if ($galleries) {
                    foreach ($galleries as $gallery) {
                        $gis = $old_db->selectArrays('imagegallery_image', "gallery_id='" . $gallery['id'] . "'");
                        foreach ($gis as $gi) {
                            $photo = new photo();
                            $loc = expUnserialize($gallery['location_data']);
                            $loc->mod = "photos";
                            $photo->title = !empty($gi['name']) ? $gi['name'] : 'Untitled';
                            $photo->body = $gi['description'];
                            $photo->alt = $gi['alt'];
                            $photo->location_data = serialize($loc);
                            $te = $photo->find('first', "location_data='" . $photo->location_data . "'");
                            if (empty($te)) {
                                if (!empty($gi['file_id'])) {
                                    $photo->save();
                                    @$this->msg['migrated'][$iloc->mod]['count']++;
                                    @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                                    $file = new expFile($gi['file_id']);
                                    $photo->attachitem($file, '');
                                    $photo->created_at = $gi['posted'];
                                    $photo->edited_at = $gi['posted'];
                                    $photo->update();
                                }
                            }
                        }
                    }
                }
                break;
            case 'headlinemodule':
                $module->view = 'showall';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "text";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'headlinemodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'headlinemodule';
                $headlines = $old_db->selectObjects('headline', "location_data='" . serialize($iloc) . "'");
                if ($headlines) {
                    foreach ($headlines as $hl) {
                        $headline = new text();
                        $loc = expUnserialize($hl->location_data);
                        $loc->mod = "text";
                        $headline->location_data = serialize($loc);
                        $headline->title = $hl->headline;
                        $headline->poster = 1;
                        //                        $headline->created_at = time();
                        //                        $headline->edited_at = time();
                        $headline->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'weblogmodule':
                switch ($module->view) {
                    case 'By Author':
                        $module->action = 'authors';
                        $module->view = 'authors';
                        break;
                    case 'By Tag':
                        $module->action = 'tags';
                        $module->view = 'tags_list';
                        break;
                    case 'Monthly':
                        $module->action = 'dates';
                        $module->view = 'dates';
                        break;
                    default:
                        $module->view = 'showall';
                        break;
                }
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "blog";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'weblogmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'weblogmodule';
                $blogitems = $old_db->selectArrays('weblog_post', "location_data='" . serialize($iloc) . "'");
                $oldconfig = $old_db->selectObject('weblogmodule_config', "location_data='" . serialize($iloc) . "'");
                if ($blogitems) {
                    foreach ($blogitems as $bi) {
                        unset($bi['id']);
                        $post = new blog($bi);
                        $loc = expUnserialize($bi['location_data']);
                        $loc->mod = "blog";
                        $post->location_data = serialize($loc);
                        $post->title = !empty($bi['title']) ? $bi['title'] : gt('Untitled');
                        $post->body = !empty($bi['body']) ? $bi['body'] : gt('(empty)');
                        $post->save();
                        // default is to create with current time
                        $post->created_at = $bi['posted'];
                        $post->edited_at = $bi['edited'];
                        $post->update();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                        // this next section is moot since there are no attachments to blogs
                        // if (!empty($bi['file_id'])) {
                        // $file = new expFile($bi['file_id']);
                        // $post->attachitem($file,'downloadable');
                        // }
                        if (isset($oldconfig->enable_tags) && ($oldconfig->enable_tags = true)) {
                            $params = null;
                            $oldtags = expUnserialize($bi['tags']);
                            foreach ($oldtags as $oldtag) {
                                $tagtitle = strtolower(trim($old_db->selectValue('tags', 'name', 'id = ' . $oldtag)));
                                $tag = new expTag($tagtitle);
                                //								$tag->title = $old_db->selectValue('tags','name','id = '.$oldtag);
                                if (empty($tag->id)) {
                                    $tag->update(array('title' => $tagtitle));
                                }
                                $params['expTag'][] = $tag->id;
                            }
                            $post->update($params);
                        }
                        $comments = $old_db->selectArrays('weblog_comment', "parent_id='" . $post->id . "'");
                        foreach ($comments as $comment) {
                            unset($comment['id']);
                            $newcomment = new expComment($comment);
                            $newcomment->created_at = $comment['posted'];
                            $newcomment->edited_at = $comment['edited'];
                            $newcomment->update();
                            // attach the comment to the blog post it belongs to
                            $obj->content_type = 'blog';
                            $obj->content_id = $post->id;
                            $obj->expcomments_id = $newcomment->id;
                            if (isset($this->params['subtype'])) {
                                $obj->subtype = $this->params['subtype'];
                            }
                            $db->insertObject($obj, $newcomment->attachable_table);
                        }
                    }
                    $newconfig = new expConfig();
                    $config['add_source'] = '1';
                    if ($oldconfig->enable_rss == 1) {
                        $config['enable_rss'] = true;
                        $config['feed_title'] = $oldconfig->feed_title;
                        $config['feed_desc'] = $oldconfig->feed_desc;
                        $config['rss_limit'] = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
                        $config['rss_cachetime'] = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
                        $newrss = new expRss();
                        $newrss->module = $loc->mod;
                        $newrss->src = $loc->src;
                        $newrss->enable_rss = $oldconfig->enable_rss;
                        $newrss->feed_title = $oldconfig->feed_title;
                        $newrss->feed_desc = $oldconfig->feed_desc;
                        $newrss->rss_limit = isset($oldconfig->rss_limit) ? $oldconfig->rss_limit : 24;
                        $newrss->rss_cachetime = isset($oldconfig->rss_cachetime) ? $oldconfig->rss_cachetime : 1440;
                        $newrss->save();
                    }
                    $newconfig->config = $config;
                    $newconfig->location_data = $loc;
                    $newconfig->save();
                }
                break;
            case 'faqmodule':
                $module->view = 'showall';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "faq";
                if ($db->countObjects('faqs', "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'faqmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'faqmodule';
                $faqs = $old_db->selectArrays('faq', "location_data='" . serialize($iloc) . "'");
                if ($faqs) {
                    foreach ($faqs as $fqi) {
                        unset($fqi['id']);
                        $faq = new faq($fqi);
                        $loc = expUnserialize($fqi['location_data']);
                        $loc->mod = "faq";
                        $faq->location_data = serialize($loc);
                        $faq->question = !empty($fqi['question']) ? $fqi['question'] : 'Untitled?';
                        $faq->answer = $fqi['answer'];
                        $faq->rank = $fqi['rank'];
                        $faq->include_in_faq = 1;
                        $faq->submitter_name = 'Unknown';
                        $faq->submitter_email = '*****@*****.**';
                        $faq->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'listingmodule':
                $module->view = 'showall';
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "portfolio";
                if ($db->countObjects($ploc->mod, "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'listingmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'listingmodule';
                $listingitems = $old_db->selectArrays('listing', "location_data='" . serialize($iloc) . "'");
                if ($listingitems) {
                    $files_attached = false;
                    foreach ($listingitems as $li) {
                        unset($li['id']);
                        $listing = new portfolio($li);
                        $listing->title = !empty($li['name']) ? $li['name'] : 'Untitled?';
                        $loc = expUnserialize($li['location_data']);
                        $loc->mod = "portfolio";
                        $listing->location_data = serialize($loc);
                        $listing->featured = true;
                        $listing->poster = 1;
                        $listing->body = "<p>" . $li['summary'] . "</p>" . $li['body'];
                        $listing->save();
                        // default is to create with current time
                        $listing->created_at = time();
                        $listing->edited_at = time();
                        $listing->update();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                        if (!empty($li['file_id'])) {
                            $file = new expFile($li['file_id']);
                            $listing->attachitem($file, '');
                            $files_attached = true;
                        }
                    }
                    if ($files_attached) {
                        // fudge a config to get attached files to appear
                        $config = new expConfig();
                        $config->location_data = $loc;
                        $config->config = 'a:11:{s:11:"filedisplay";s:7:"Gallery";s:6:"ffloat";s:4:"Left";s:6:"fwidth";s:3:"120";s:7:"fmargin";s:1:"5";s:7:"piwidth";s:3:"100";s:5:"thumb";s:3:"100";s:7:"spacing";s:2:"10";s:10:"floatthumb";s:8:"No Float";s:6:"tclass";s:0:"";s:5:"limit";s:0:"";s:9:"pagelinks";s:14:"Top and Bottom";}';
                        $config->save();
                    }
                }
                break;
            case 'contactmodule':
                // convert to an old school form
                $module->view == "Default";
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "formmodule";
                if ($db->countObjects('formbuilder_form', "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'contactmodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'contactmodule';
                $contactform = $old_db->selectObject('contactmodule_config', "location_data='" . serialize($iloc) . "'");
                if ($contactform) {
                    $loc = expUnserialize($contactform->location_data);
                    $loc->mod = 'formmodule';
                    $contactform->location_data = serialize($loc);
                    //				$replyto_address = $contactform->replyto_address;
                    unset($contactform->replyto_address);
                    //				$from_address = $contactform->from_address;
                    unset($contactform->from_address);
                    //				$from_name = $contactform->from_name;
                    unset($contactform->from_name);
                    unset($contactform->use_captcha);
                    $contactform->name = 'Send us an e-mail';
                    $contactform->description = '';
                    $contactform->response = $contactform->final_message;
                    unset($contactform->final_message);
                    $contactform->table_name = '';
                    $contactform->is_email = true;
                    $contactform->is_saved = false;
                    $contactform->submitbtn = 'Send Message';
                    $contactform->resetbtn = 'Reset';
                    unset($contactform->id);
                    $contactform->id = $db->insertObject($contactform, 'formbuilder_form');
                    $addresses = $old_db->selectObjects('contact_contact', "location_data='" . serialize($iloc) . "'");
                    foreach ($addresses as $address) {
                        unset($address->addressbook_contact_id);
                        unset($address->contact_info);
                        unset($address->location_data);
                        $address->form_id = $contactform->id;
                        $db->insertObject($address, 'formbuilder_address');
                    }
                    $report = null;
                    $report->name = $contactform->subject;
                    $report->location_data = $contactform->location_data;
                    $report->form_id = $contactform->id;
                    $db->insertObject($report, 'formbuilder_report');
                    // now add the controls to the form
                    $control = null;
                    $control->name = 'name';
                    $control->caption = 'Your Name';
                    $control->form_id = $contactform->id;
                    $control->data = 'O:11:"textcontrol":12:{s:4:"size";i:0;s:9:"maxlength";i:0;s:7:"caption";s:9:"Your Name";s:9:"accesskey";s:0:"";s:7:"default";s:0:"";s:8:"disabled";b:0;s:8:"required";b:1;s:8:"tabindex";i:-1;s:7:"inError";i:0;s:4:"type";s:4:"text";s:6:"filter";s:0:"";s:10:"identifier";s:4:"name";}';
                    $control->rank = 0;
                    $control->is_readonly = 0;
                    $control->is_static = 0;
                    $db->insertObject($control, 'formbuilder_control');
                    $control->name = 'email';
                    $control->caption = 'Your Email';
                    $control->data = 'O:11:"textcontrol":12:{s:4:"size";i:0;s:9:"maxlength";i:0;s:7:"caption";s:18:"Your Email Address";s:9:"accesskey";s:0:"";s:7:"default";s:0:"";s:8:"disabled";b:0;s:8:"required";b:1;s:8:"tabindex";i:-1;s:7:"inError";i:0;s:4:"type";s:4:"text";s:6:"filter";s:0:"";s:10:"identifier";s:5:"email";}';
                    $control->rank = 1;
                    $db->insertObject($control, 'formbuilder_control');
                    $control->name = 'subject';
                    $control->caption = 'Subject';
                    $control->data = 'O:11:"textcontrol":12:{s:4:"size";i:0;s:9:"maxlength";i:0;s:7:"caption";s:7:"Subject";s:9:"accesskey";s:0:"";s:7:"default";s:0:"";s:8:"disabled";b:0;s:8:"required";b:1;s:8:"tabindex";i:-1;s:7:"inError";i:0;s:4:"type";s:4:"text";s:6:"filter";s:0:"";s:10:"identifier";s:7:"subject";}';
                    $control->rank = 2;
                    $db->insertObject($control, 'formbuilder_control');
                    $control->name = 'message';
                    $control->caption = 'Message';
                    $control->data = 'O:17:"texteditorcontrol":12:{s:4:"cols";i:60;s:4:"rows";i:8;s:9:"accesskey";s:0:"";s:7:"default";s:0:"";s:8:"disabled";b:0;s:8:"required";b:0;s:8:"tabindex";i:-1;s:7:"inError";i:0;s:4:"type";s:4:"text";s:8:"maxchars";i:0;s:10:"identifier";s:7:"message";s:7:"caption";s:7:"Message";}';
                    $control->rank = 3;
                    $db->insertObject($control, 'formbuilder_control');
                    @$this->msg['migrated'][$iloc->mod]['count']++;
                    @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                }
                break;
            case 'youtubemodule':
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "youtube";
                if ($db->countObjects('youtube', "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'youtubemodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'youtubemodule';
                $videos = $old_db->selectArrays('youtube', "location_data='" . serialize($iloc) . "'");
                if ($videos) {
                    foreach ($videos as $vi) {
                        unset($vi['id']);
                        $video = new youtube($vi);
                        $loc = expUnserialize($vi['location_data']);
                        $loc->mod = "youtube";
                        $video->title = $vi['name'];
                        if (empty($video->title)) {
                            $video->title = 'Untitled';
                        }
                        $video->location_data = serialize($loc);
                        $yt = explode("watch?v=", $vi['url']);
                        if (empty($yt[1])) {
                            break;
                        } else {
                            $ytid = $yt[1];
                        }
                        unset($video->url);
                        $video->embed_code = '<iframe title="YouTube video player" width="' . $vi['width'] . '" height="' . $vi['height'] . '" src="http://www.youtube.com/embed/' . $ytid . '" frameborder="0" allowfullscreen></iframe>';
                        $video->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'mediaplayermodule':
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "flowplayer";
                if ($db->countObjects('flowplayer', "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'mediaplayermodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'mediaplayermodule';
                $movies = $old_db->selectArrays('mediaitem', "location_data='" . serialize($iloc) . "'");
                if ($movies) {
                    foreach ($movies as $mi) {
                        unset($mi['id']);
                        $movie = new flowplayer($mi);
                        $loc = expUnserialize($mi['location_data']);
                        $loc->mod = "flowplayer";
                        $movie->title = $mi['name'];
                        if (empty($movie->title)) {
                            $movie->title = 'Untitled';
                        }
                        unset($mi['bgcolor']);
                        unset($mi['alignment']);
                        unset($mi['loop_media']);
                        unset($mi['auto_rewind']);
                        unset($mi['autoplay']);
                        unset($mi['hide_controls']);
                        $movie->location_data = serialize($loc);
                        $movie->poster = 1;
                        $movie->rank = 1;
                        if (!empty($mi['media_id'])) {
                            $movie->save();
                            @$this->msg['migrated'][$iloc->mod]['count']++;
                            @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                            $file = new expFile($mi['media_id']);
                            $movie->attachitem($file, 'video');
                            if (!empty($mi['alt_image_id'])) {
                                $file = new expFile($mi['alt_image_id']);
                                $movie->attachitem($file, 'splash');
                            }
                        }
                    }
                }
                break;
            case 'bannermodule':
                //check to see if it's already pulled in (circumvent !is_original)
                $ploc = $iloc;
                $ploc->mod = "banner";
                if ($db->countObjects('banner', "location_data='" . serialize($ploc) . "'")) {
                    $iloc->mod = 'bannermodule';
                    $linked = true;
                    break;
                }
                $iloc->mod = 'bannermodule';
                $banners = $old_db->selectArrays('banner_ad', "location_data='" . serialize($iloc) . "'");
                if ($banners) {
                    foreach ($banners as $bi) {
                        $oldclicks = $old_db->selectObjects('banner_click', "ad_id='" . $bi['id'] . "'");
                        $oldcompany = $old_db->selectObject('banner_affiliate', "id='" . $bi['affiliate_id'] . "'");
                        unset($bi['id']);
                        $banner = new banner($bi);
                        $loc = expUnserialize($bi['location_data']);
                        $loc->mod = "banner";
                        $banner->title = $bi['name'];
                        $banner->url = !empty($bi['url']) ? $bi['url'] : '#';
                        if (empty($banner->title)) {
                            $banner->title = 'Untitled';
                        }
                        $banner->location_data = serialize($loc);
                        $newcompany = $db->selectObject('companies', "title='" . $oldcompany->name . "'");
                        if ($newcompany == null) {
                            $newcompany = new company();
                            $newcompany->title = !empty($oldcompany->name) ? $oldcompany->name : 'Untitled';
                            $newcompany->body = $oldcompany->contact_info;
                            $newcompany->location_data = $banner->location_data;
                            $newcompany->save();
                        }
                        $banner->companies_id = $newcompany->id;
                        $banner->clicks = 0;
                        foreach ($oldclicks as $click) {
                            $banner->clicks += $click->clicks;
                        }
                        if (!empty($bi['file_id'])) {
                            $file = new expFile($bi['file_id']);
                            $banner->attachitem($file, '');
                        }
                        $banner->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'addressbookmodule':
                // user mod, not widely distributed
                @($module->view = 'myaddressbook');
                @($module->action = 'myaddressbook');
                //check to see if it's already pulled in (circumvent !is_original)
                // $ploc = $iloc;
                // $ploc->mod = "addresses";
                // if ($db->countObjects($ploc->mod, "location_data='".serialize($ploc)."'")) {
                // $iloc->mod = 'addressbookmodule';
                // $linked = true;
                // break;
                // }
                //                $iloc->mod = 'addressbookmodule';
                $addresses = $old_db->selectArrays('addressbook_contact', "location_data='" . serialize($iloc) . "'");
                if ($addresses) {
                    foreach ($addresses as $address) {
                        //						unset($address['id']);
                        $addr = new address();
                        $addr->user_id = 1;
                        $addr->is_default = 1;
                        $addr->is_billing = 1;
                        $addr->is_shipping = 1;
                        $addr->firstname = !empty($address['firstname']) ? $address['firstname'] : 'blank';
                        $addr->lastname = !empty($address['lastname']) ? $address['lastname'] : 'blank';
                        $addr->address1 = !empty($address['address1']) ? $address['address1'] : 'blank';
                        $addr->city = !empty($address['city']) ? $address['city'] : 'blank';
                        $address['state'] = !empty($address['state']) ? $address['state'] : 'CA';
                        $state = $db->selectObject('geo_region', 'code="' . strtoupper($address['state']) . '"');
                        $addr->state = $state->id;
                        $addr->zip = !empty($address['zip']) ? $address['zip'] : '99999';
                        $addr->phone = !empty($address['phone']) ? $address['phone'] : '800-555-1212';
                        $addr->email = !empty($address['email']) ? $address['email'] : '*****@*****.**';
                        $addr->organization = $address['business'];
                        $addr->phone2 = $address['cell'];
                        $addr->save();
                        @$this->msg['migrated'][$iloc->mod]['count']++;
                        @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                    }
                }
                break;
            case 'feedlistmodule':
                @($module->view = 'showall');
                $iloc->mod = 'feedlistmodule';
                $feedlist = $old_db->selectObject('feedlistmodule_config', "location_data='" . serialize($iloc) . "'");
                if ($feedlist->enable_rss == 1) {
                    $loc = expUnserialize($feedlist->location_data);
                    $loc->mod = "rssController";
                    $config['enable_rss'] = true;
                    $config['feed_title'] = $feedlist->feed_title;
                    $config['feed_desc'] = $feedlist->feed_desc;
                    $config['rss_limit'] = isset($feedlist->rss_limit) ? $feedlist->rss_limit : 24;
                    $config['rss_cachetime'] = isset($feedlist->rss_cachetime) ? $feedlist->rss_cachetime : 1440;
                    $newconfig = new expConfig();
                    $newconfig->config = $config;
                    $newconfig->location_data = $loc;
                    $newconfig->save();
                    $newrss = new expRss();
                    $newrss->module = $loc->mod;
                    $newrss->src = $loc->src;
                    $newrss->enable_rss = $feedlist->enable_rss;
                    $newrss->feed_title = $feedlist->feed_title;
                    $newrss->feed_desc = $feedlist->feed_desc;
                    $newrss->rss_limit = isset($feedlist->rss_limit) ? $feedlist->rss_limit : 24;
                    $newrss->rss_cachetime = isset($feedlist->rss_cachetime) ? $feedlist->rss_cachetime : 1440;
                    $newrss->save();
                    @$this->msg['migrated'][$iloc->mod]['count']++;
                    @($this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod]);
                }
                break;
            default:
                @$this->msg['noconverter'][$iloc->mod]++;
                break;
        }
        // quick check for non hard coded modules
        // We add a container if they're not hard coded.
        !$hc ? $this->add_container($iloc, $module, $linked) : "";
        return $module;
    }
Пример #12
0
 public function click()
 {
     $banner = new banner($this->params['id']);
     $banner->increaseClicks();
     redirect_to($banner->url);
 }
Пример #13
0
 function MY_Controller()
 {
     parent::Controller();
     $this->load->library('enum');
     $this->load->config('fireignition');
     $this->load->helper('language');
     $this->lang->load('site');
     $this->load->library('hit_counter');
     $this->load->library('FirePHP');
     if ($this->config->item('fireignition_enabled')) {
         if (floor(phpversion()) < 5) {
             log_message('error', 'PHP 5 is required to run fireignition');
         } else {
             $this->load->library('FirePHP');
         }
     } else {
         $this->load->library('Firephp_fake');
         $this->firephp =& $this->firephp_fake;
     }
     //redirect from old website
     $this->redirectList();
     $cauhinh = new cauhinh();
     $cauhinh->get();
     $this->cauhinh = $cauhinh;
     if ($this->uri->segment(1, "") == "admin") {
         $this->logged_in_user = $this->_get_user();
         $this->admin = $this->config->item('admin');
         $this->admin_url = $this->config->item('admin_url');
         $this->admin_images = base_url() . "images/admin/";
         //LOAD HELPER
         $this->load_admin_resource();
         //check maintenance admin , only webmaster can login
         $this->resetNewsViewMost();
     } else {
         //check login user
         //$this->flogged_in_user=$this->_fget_user();
         $this->isCache = true;
         $this->userLoginFlag = 0;
         $userLogin = $this->session->userdata('userLogin');
         $userToken = $this->session->userdata('userToken');
         $customer = new Customer();
         $customer->get_by_username($userLogin);
         if ($customer->exists() && md5($customer->id) == trim($userToken)) {
             $loginUsername = $customer->username;
             $this->customer = $customer;
             if ($this->session->userdata('userloginFlag') == "1") {
                 $this->userLoginFlag = 1;
                 $this->session->set_userdata('userloginFlag', "0");
             }
         } else {
             $loginUsername = "";
         }
         $this->loginUsername = $loginUsername;
         $this->loginUser = $customer;
         $this->page_title = getconfigkey("defaultPageTitle");
         $this->load->helper('language');
         $this->show_analytic = TRUE;
         $this->page_keyword = getconfigkey("defaultKeyword");
         $this->page_description = getconfigkey("defaultDescription");
         $this->isRobotFollow = true;
         //------------------------------------------------
         // get data handler
         //------------------------------------------------
         $listAllCat = array();
         $newsCate = new Newscatalogue();
         $newsCate->order_by('position');
         $newsCate->where(array('recycle' => 0, 'parentcat_id' => 58));
         $newsCate->get_iterated();
         $this->newsCate = $newsCate;
         foreach ($newsCate as $row) {
             array_push($listAllCat, $row->id);
         }
         /*Get all business cat*/
         $businessCat = new Newscatalogue();
         $businessCat->order_by('position');
         $businessCat->where(array('recycle' => 0, 'parentcat_id' => 91));
         $businessCat->get_iterated();
         $this->businessCat = $businessCat;
         $guideCate = new Newscatalogue();
         $guideCate->order_by('position');
         $guideCate->where(array('recycle' => 0, 'parentcat_id' => 76));
         $guideCate->get_iterated();
         $this->guideCate = $guideCate;
         foreach ($guideCate as $row) {
             array_push($listAllCat, $row->id);
         }
         $this->listAllCat = $listAllCat;
         $projectsCate = new Newscatalogue();
         $projectsCate->order_by('position');
         $projectsCate->where(array('recycle' => 0, 'parentcat_id' => 83));
         $projectsCate->get_iterated();
         $this->projectsCate = $projectsCate;
         $arrayCateNewsId = array();
         foreach ($this->projectsCate as $row) {
             $arrayCateNewsId[] = $row->id;
         }
         $this->arrCateProject = $arrayCateNewsId;
         // project hot
         $projectHot = new Article();
         $projectHot->where('recycle', 0);
         $projectHot->where('hot', 1);
         $projectHot->where_in('newscatalogue_id', $arrayCateNewsId);
         $projectHot->order_by('created', 'desc');
         $projectHot->get(3);
         $this->projectHot = $projectHot;
         //get all housesale
         $typeHouseSale = new Estatetype();
         $typeHouseSale->where('estatecatalogue_id', 1);
         $typeHouseSale->order_by('position');
         $typeHouseSale->get_iterated();
         $this->typeHouseSale = $typeHouseSale;
         //get all houselease
         $typeHouseLease = new Estatetype();
         $typeHouseLease->where('estatecatalogue_id', 2);
         $typeHouseLease->order_by('position');
         $typeHouseLease->get_iterated();
         $this->typeHouseLease = $typeHouseLease;
         //get all housedemand
         $typeHouseDemand = new Estatetype();
         $typeHouseDemand->where('estatecatalogue_id', 3);
         $typeHouseDemand->order_by('position');
         $typeHouseDemand->get_iterated();
         $this->typeHouseDemand = $typeHouseDemand;
         // get all province
         $estateProvince = new Estatecity();
         $estateProvince->order_by('position', 'asc');
         $estateProvince->get_iterated();
         $this->estateProvince = $estateProvince;
         // get all Direction
         $estateDirection = new Estatedirection();
         $estateDirection->order_by('id', 'desc');
         $estateDirection->get_iterated();
         $this->estateDirection = $estateDirection;
         // get all Estatecatalogues
         $estateCatalogues = new Estatecatalogue();
         $estateCatalogues->order_by('position', 'asc');
         $estateCatalogues->get_iterated();
         $this->estateCatalogues = $estateCatalogues;
         // get all business world
         $businessWorld = new Article();
         $businessWorld->order_by('id', 'desc');
         $businessWorld->where(array('recycle' => 0, 'newscatalogue_id' => 78));
         $businessWorld->get(20);
         $this->businessWorld = $businessWorld;
         // get all project news
         $projectNews = new Article();
         $projectNews->order_by('id', 'desc');
         $projectNews->where(array('recycle' => 0, 'newscatalogue_id' => 71));
         $projectNews->get(6);
         $this->projectNews = $projectNews;
         $this->projectNewsFirst = $projectNews->limit(1);
         // get all legal advice
         $legalAdvices = new Article();
         $legalAdvices->order_by('id', 'desc');
         $legalAdvices->where(array('recycle' => 0, 'newscatalogue_id' => 82));
         $legalAdvices->get(11);
         $this->legalAdvices = $legalAdvices;
         // get all new STND
         $newsPrivate = new Article();
         $newsPrivate->order_by('id', 'desc');
         $newsPrivate->where(array('recycle' => 0, 'newscatalogue_id' => 75));
         $newsPrivate->get_iterated();
         $this->newsPrivate = $newsPrivate;
         // get all estateareas
         $estateareas = new Estatearea();
         $estateareas->order_by('position', 'asc');
         $estateareas->get_iterated();
         $this->estateareas = $estateareas;
         // get all estateprices
         $estateprices = new Estateprice();
         $estateprices->order_by('position', 'asc');
         $estateprices->get_iterated();
         $this->estateprices = $estateprices;
         //------------------------------------------------
         // Top Advertise
         //------------------------------------------------
         $banner = new banner();
         $banner->where('bannercat_id', 1);
         $banner->get_iterated();
         $this->banner = $banner;
         $bannerAdversiting = new Banner();
         $bannerAdversiting->where('bannercat_id', 19);
         $bannerAdversiting->get_iterated();
         $this->bannerAdversiting = $bannerAdversiting;
         $bannerLeft = new Banner();
         $bannerLeft->where('bannercat_id', 21);
         $bannerLeft->get_iterated();
         $this->bannerLeft = $bannerLeft;
         $bannerFooter = new Banner();
         $bannerFooter->where('bannercat_id', 20);
         $bannerFooter->get_iterated();
         $this->bannerFooter = $bannerFooter;
         $menu = new menu();
         $menu->order_by('position', 'asc');
         $menu->get_iterated(8);
         $this->menu = $menu;
         $productFooter = new menuitem();
         $productFooter->where('menu_id', 9);
         $productFooter->order_by('position', 'asc');
         $productFooter->get_iterated();
         $this->productFooter = $productFooter;
         $relation = new menuitem();
         $relation->order_by('position', 'asc');
         $relation->where('menu_id', 10);
         $relation->get_iterated();
         $this->relation = $relation;
         $this->_increaseVisiter();
         //load product manufacture
         $productManufacture = new Productmanufacture();
         $productManufacture->order_by('name', 'asc');
         $productManufacture->get_iterated();
         $this->productManufacture = $productManufacture;
         $adverHeader = new Banner();
         $adverHeader->where('bannercat_id', 25);
         $adverHeader->get(1);
         $this->adverHeader = $adverHeader;
         // get estates hot
         $newsHot = new Article();
         $newsHot->where_in('newscatalogue_id', array(71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82));
         $newsHot->order_by('id', 'desc');
         $newsHot->where('hotHome', 1);
         $newsHot->get(5);
         $this->newsHot = $newsHot;
     }
 }
Пример #14
0
 function get_all()
 {
     return banner::all();
 }