if ($ctrl == 'posts' && $method == 'GET') { include 'view/post.php'; } if ($ctrl == 'post' && $method == 'GET') { $con = new commentController(); $con->return_comments_list($param); } if ($ctrl == 'post' && $method == 'POST') { $con = new postController(); $con->new_post(); } if ($ctrl == 'comment' && $method == 'POST') { $con = new commentController(); $con->new_comment(); } if ($ctrl == 'search' && $method == 'GET') { $con = new searchController(); $con->search(); } if ($ctrl == 'user' && $method == 'POST') { $con = new userController(); $con->new_user(); } if ($ctrl == 'user' && $method == 'GET') { $con = new userController(); $con->get_profile(); } if ($ctrl == 'login' && $method == 'POST') { $con = new authController(); $con->login(); }
include "controllers/itemController.php"; include "controllers/searchController.php"; include "controllers/profileController.php"; include "controllers/settingsController.php"; include "controllers/uploadController.php"; include "controllers/loanController.php"; include "controllers/messageController.php"; include "controllers/imageController.php"; if (!empty($_GET['page'])) { switch ($_GET['page']) { case 'item': $item = new itemController(); $item->view(); break; case 'search': $search = new searchController(); $search->view(); break; case 'profile': $profile = new profileController(); $profile->view(); break; case 'settings': $settings = new settingsController(); $settings->view(); break; case 'loan': $loan = new loanController(); $loan->view(); break; case 'message':
/** * copy selected modules and their contents over from old site * @global db the exponent database object * @return void */ public function migrate_content() { global $db; $old_db = $this->connect(); if (isset($this->params['wipe_content'])) { $db->delete('sectionref'); $db->delete('container'); $db->delete('text'); $db->delete('snippet'); $db->delete('links'); $db->delete('news'); $db->delete('filedownloads'); $db->delete('photo'); $db->delete('headline'); $db->delete('blog'); $db->delete('faqs'); $db->delete('portfolio'); $db->delete('youtube'); $db->delete('flowplayer'); $db->delete('banner'); $db->delete('companies'); $db->delete('addresses'); $db->delete('content_expComments'); $db->delete('content_expFiles'); $db->delete('content_expSimpleNote'); $db->delete('content_expTags'); $db->delete('expComments'); $db->delete('expConfigs', 'id>1'); // don't delete migration config // $db->delete('expFiles'); // deleted and rebuilt during (previous) file migration $db->delete('expeAlerts'); $db->delete('expeAlerts_subscribers'); $db->delete('expeAlerts_temp'); $db->delete('expSimpleNote'); $db->delete('expRss'); $db->delete('expTags'); $db->delete('calendar'); $db->delete('eventdate'); $db->delete('calendarmodule_config'); $db->delete('poll_question'); $db->delete('poll_answer'); $db->delete('poll_timeblock'); $db->delete('simplepollmodule_config'); $db->delete('formbuilder_address'); $db->delete('formbuilder_control'); $db->delete('formbuilder_form'); $db->delete('formbuilder_report'); @$this->msg['clearedcontent']++; } if (!empty($this->params['replace'])) { foreach ($this->params['replace'] as $replace => $value) { switch ($replace) { case 'containermodule': $db->delete('container'); break; case 'textmodule': case 'rotatormodule': case 'swfmodule': $db->delete('text'); break; case 'snippetmodule': $db->delete('snippet'); break; case 'linklistmodule': case 'linkmodule': $db->delete('links'); break; case 'linkmodule': $db->delete('links'); break; case 'newsmodule': $db->delete('news'); break; case 'resourcesmodule': $db->delete('filedownloads'); break; case 'imagegallerymodule': case 'slideshowmodule': $db->delete('photo'); break; case 'headlinemodule': $db->delete('headline'); break; case 'weblogmodule': $db->delete('blog'); $db->delete('expComments'); $db->delete('content_expComments'); break; case 'faqmodule': $db->delete('faq'); break; case 'listingmodule': $db->delete('portfolio'); break; case 'calendarmodule': $db->delete('calendar'); $db->delete('eventdate'); $db->delete('calendarmodule_config'); break; case 'simplepollmodule': $db->delete('poll_question'); $db->delete('poll_answer'); $db->delete('poll_timeblock'); $db->delete('simplepollmodule_config'); break; case 'formmodule': $db->delete('formbuilder_address'); $db->delete('formbuilder_control'); $db->delete('formbuilder_form'); $db->delete('formbuilder_report'); break; case 'youtubemodule': $db->delete('youtube'); break; case 'mediaplayermodule': $db->delete('flowplayer'); break; case 'bannermodule': $db->delete('banner'); $db->delete('companies'); break; case 'addressmodule': $db->delete('addresses'); break; } } } //pull the sectionref data for selected modules if (empty($this->params['migrate'])) { $where = '1'; } else { $where = ''; foreach ($this->params['migrate'] as $key => $var) { if (!empty($where)) { $where .= " or"; } $where .= " module='" . $key . "'"; } } // pull the sectionref data for selected modules $secref = $old_db->selectObjects('sectionref', $where); foreach ($secref as $sr) { // hard coded modules if (array_key_exists($sr->module, $this->new_modules) && $sr->refcount == 1000) { $iloc = null; $iloc->mod = $sr->module; $iloc->src = $sr->source; $iloc->int = $sr->internal; $tmp->module = ''; // $this->convert($iloc,$iloc->mod,1); $this->convert($iloc, $tmp, 1); // convert the source to new exp controller $sr->module = $this->new_modules[$sr->module]; } if (!in_array($sr->module, $this->deprecated_modules)) { // if the module is not in the depecation list, we're hitting here if (!$db->selectObject('sectionref', "source='" . $sr->source . "'")) { if (array_key_exists($sr->module, $this->new_modules)) { // convert the source to new exp controller $sr->module = $this->new_modules[$sr->module]; } $db->insertObject($sr, 'sectionref'); @$this->msg['sectionref']++; } } } //pull over all the top level containers $containers = $old_db->selectObjects('container', 'external="N;"'); foreach ($containers as $cont) { if (!$db->selectObject('container', "internal='" . $cont->internal . "'")) { $db->insertObject($cont, 'container'); @$this->msg['container']++; } } // echo "Imported containermodules<br>"; // // // this will pull all the old modules. if we have a exp2 equivalent module // // we will convert it to the new type of module before pulling. $cwhere = ' and ('; $i = 0; foreach ($this->params['migrate'] as $key => $var) { $cwhere .= $i == 0 ? "" : " or "; $cwhere .= "internal like '%" . $key . "%'"; $i = 1; } $cwhere .= ")"; $modules = $old_db->selectObjects('container', 'external != "N;"' . $cwhere); foreach ($modules as $module) { $iloc = expUnserialize($module->internal); if (array_key_exists($iloc->mod, $this->new_modules)) { // convert new modules added via container unset($module->internal); unset($module->action); // unset($module->view); $this->convert($iloc, $module); } else { if (!in_array($iloc->mod, $this->deprecated_modules)) { // add old school modules not in the deprecation list if ($iloc->mod == 'calendarmodule' && $module->view == 'Upcoming Events - Summary') { $module->view = 'Upcoming Events - Headlines'; } $linked = $this->pulldata($iloc, $module); if ($linked) { $newmodule['i_mod'] = $iloc->mod; $newmodule['modcntrol'] = $iloc->mod; $newmodule['rank'] = $module->rank; $newmodule['views'] = $module->view; $newmodule['title'] = $module->title; $newmodule['actions'] = ''; $_POST['current_section'] = 1; $module = container::update($newmodule, $module, expUnserialize($module->external)); $config = $old_db->selectObject('calendarmodule_config', "location_data='" . serialize($iloc) . "'"); $config->id = ''; $config->enable_categories = 1; $config->enable_tags = 0; $config->location_data = $module->internal; $config->aggregate = serialize(array($iloc->src)); $db->insertObject($config, 'calendarmodule_config'); } $res = $db->insertObject($module, 'container'); if ($res) { @$this->msg['container']++; } } } } if (isset($this->params['copy_permissions'])) { $db->delete('userpermission', "module != 'navigationmodule'"); $db->delete('grouppermission', "module != 'navigationmodule'"); $users = $db->selectObjects('user', 'id > 1'); foreach ($users as $user) { $containers = $old_db->selectObjects('userpermission', "uid='" . $user->id . "' AND source != ''"); $loc = null; foreach ($containers as $item) { $loc->mod = $item->module; $loc->src = $item->source; $loc->int = ''; if (array_key_exists($item->module, $this->new_modules)) { $loc->mod = $this->new_modules[$item->module]; $item->module = $this->new_modules[$item->module]; $item = $this->convert_permission($item); } if ($item && $db->selectObject('container', "internal = '" . serialize($loc) . "'")) { $db->insertObject($item, 'userpermission'); if ($item->permission == 'edit') { // if they had edit permission, we'll also give them create permission $item->permission = 'create'; @$db->insertObject($item, 'userpermission'); } } } } $groups = $db->selectObjects('group', '1'); foreach ($groups as $group) { $containers = $old_db->selectObjects('grouppermission', "gid='" . $group->id . "' AND source != ''"); $loc = null; foreach ($containers as $item) { $loc->mod = $item->module; $loc->src = $item->source; $loc->int = ''; if (array_key_exists($item->module, $this->new_modules)) { $loc->mod = $this->new_modules[$item->module]; $item->module = $this->new_modules[$item->module]; $item = $this->convert_permission($item); } if ($item && $db->selectObject('container', "internal = '" . serialize($loc) . "'")) { $db->insertObject($item, 'grouppermission'); if ($item->permission == 'edit') { // if they had edit permission, we'll also give them create permission $item->permission = 'create'; @$db->insertObject($item, 'grouppermission'); } } } } } searchController::spider(); expSession::clearCurrentUserSessionCache(); assign_to_template(array('msg' => @$this->msg)); }