function display(&$pageData) { $common = new common($this); // Check if the portal is installed or needs upgraded. $thisVersion = "2.5.0"; if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/classes/settings.class.php")) { header("Location: /install/install.php"); } elseif ($common->getSetting("version") != $thisVersion) { header("Location: /install/upgrade.php"); } // The Base URL of this page (needed for Plane Finder client link) $pageData['baseurl'] = $common->getBaseUrl(); // Load the master template along with required data for the master template.. $master = $this->readTemplate('master.tpl'); require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "links.class.php"; $links = new links(); $pageData['links'] = $links->getAllLinks(); // Load the template for the requested page. $page = $this->readTemplate($common->removeExtension($_SERVER["SCRIPT_NAME"]) . '.tpl'); $output = $this->mergeAreas($master, $page); $output = $this->mergeSettings($output); $output = $this->mergePageData($output, $pageData); $output = $this->processIfs($output, $pageData); $output = $this->processForeach($output, $pageData); $output = $this->processFors($output, $pageData); $output = $this->processWhiles($output, $pageData); $output = $this->removeComments($output); // Insert page ID mainly used to mark an active navigation link when using Bootstrap. $output = str_replace("{template:pageId}", $common->removeExtension($_SERVER["SCRIPT_NAME"]) . "-link", $output); echo $output; }
/** * Public function that creates a single instance */ public static function getInstance() { if (!isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
<?php /** * 友情链接后台管理栏目新增文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage links */ require_once '../config/config.inc.php'; require_once "../class/links.class.php"; require_once '../..' . __WEBADMIN_ROOT . '/checklogin.php'; $objWebInit = new links(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; //图片上传参数 $objWebInit->arrGPic = $arrGPic; $objWebInit->db(); //访问权限检查 if (!$objWebInit->checkPopedomG($_SESSION['user_id'])) { check::AlertExit('对不起,您没有权限访问此页', -1); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_FILES['Filedata']['name'] != "") { $_POST['UploadFile'] = $objWebInit->uploadInfoImage($_FILES['Filedata']); } //取得图片链接的文件类型
<? if(!defined("NODIRECT")){ die("No direct Access !!"); } require_once(PATH_CLASS."/links.php"); // new products class $links = new links; $links->konek(); // def var $template = "links.tpl"; $smarty->assign('judul',$kate."Links Management"); $smarty->assign('refresh',$_SERVER['REQUEST_URI']); $meta = '<meta http-equiv="refresh" content="3;url=\''.$_SERVER['SCRIPT_NAME'].'?aksi=link" />'; if($_SERVER['HTTP_REFERER']){ $smarty->assign('referer',$_SERVER['HTTP_REFERER']); }else{ $smarty->assign('referer',$_SERVER['SCRIPT_NAME']."?aksi=link"); } $smarty->assign('path_editor',PATH_EDITOR); // fetch data $x = 0; $links->sql = "select id,substr(content,1,100) as isi,gambar,link, if(status=1,'aktif', 'non aktif') as status from tbl_links order by id Desc"; $links->perPage = REC_PER_PAGE; $links->gul = 10; $sql = $links->genSql(); $result = $links->exQ($sql); while($data = mysql_fetch_array ($result,MYSQL_ASSOC)){
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// session_start(); // Load the require PHP classes. require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "links.class.php"; $common = new common(); $account = new account(); $links = new links(); // Check if the user is logged in. if (!$account->isAuthenticated()) { // The user is not logged in so forward them to the login page. header("Location: login.php"); } $nameExists = FALSE; if ($common->postBack()) { // Check if the name already exists. $nameExists = $links->nameExists($_POST['name']); if (!$nameExists) { // Add this link.. $links->addLink($_POST['name'], $_POST['address']); // Forward the user to the link management index page. header("Location: /admin/links/"); }
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// session_start(); // Load the require PHP classes. require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "links.class.php"; $common = new common(); $account = new account(); $links = new links(); // Check if the user is logged in. if (!$account->isAuthenticated()) { // The user is not logged in so forward them to the login page. header("Location: login.php"); } if ($common->postBack()) { // Update the contents of the blog post. $links->editLinkByName(urldecode($_POST['originalName']), $_POST['name'], $_POST['address']); // Forward the user to the link management index page. header("Location: /admin/links/"); } // Get the link data. $link = $links->getLinkByName(urldecode($_GET['name'])); //////////////// // BEGIN HTML
<?php // $Id: edit_links.php 1128 2005-08-03 22:16:55Z mysz $ // deklaracja zmiennej $action::form $action = empty($_GET['action']) ? '' : $_GET['action']; $ft->define("error_reporting", "error_reporting.tpl"); $ft->define_dynamic("error_row", "error_reporting"); $link = new links(); switch ($action) { case "show": $link->show($_GET['id']); break; case "edit": $link->edit($_GET['id']); break; case "remark": $link->remark($_GET['id']); break; case "delete": $link->delete(); break; default: if (isset($_POST['sub_delete'])) { $link->multidelete(); } else { $link->list_links(); } }
function getLinks($db, $links_array, $iteration) { $sql = "SELECT HEX(correlator) AS corr, HEX(parent_correlator) AS pcorr FROM transaction_file WHERE iteration =" . $iteration . " AND HEX(parent_correlator) IS NOT NULL ORDER BY starttime LIMIT 4999;"; //echo $sql; if ($stmt = $db->prepare($sql)) { /* create a prepared statement */ //if ($stmt = $db->prepare("SELECT s.context AS 'origin', d.context AS 'destination',HEX(d.correlator) AS corr,HEX(d.parent_correlator) AS pcorr FROM transaction_iter d INNER JOIN transaction_iter s ON d.parent_correlator = s.correlator")) { /* execute query */ if ($stmt->execute()) { /* bind result variables */ $stmt->bind_result($l_corr, $l_pcorr); /* fetch values */ while ($stmt->fetch()) { $temp_object = new links(); $object = $temp_object->createLink($l_corr, $l_pcorr); //echo json_encode($object); array_push($links_array, $object); } //echo json_encode($links_array); } else { echo "Error code ({$stmt->errno}): {$stmt->error}"; } /* close statement */ $stmt->close(); //array_splice($links_array,0,100); echo json_encode($links_array); //return $links_array; } else { echo "Error code ({$db->errno}): {$db->error}"; } }
$baseDir = $bvsSiteIni['ENVIRONMENT']['LETTER_UNIT'].$bvsSiteIni['ENVIRONMENT']['DATABASE_PATH']; }else{ $baseDir = $bvsSiteIni['ENVIRONMENT']['DATABASE_PATH']; } $site = parse_ini_file($baseDir."ini/" . $lang . "/bvs.ini", true); $ini = parse_ini_file(dirname(__FILE__)."/../scielo.def", true); $home = $ini['this']['url']; //ob_start("ob_gzhandler"); //session_start(); if(isset($_COOKIE['userID'])) { $link = new links(); $link->setUser_id($_COOKIE['userID']); $linkList = $link->getInHomeLinks(); if (count($linkList) > 0){ ?><ul><? for($i = 0; $i < count($linkList); $i++) { $link_id = $linkList[$i]->getLink_id(); $name = $linkList[$i]->getName(); $description = $linkList[$i]->getDescription(); $rate = $linkList[$i]->getRate(); $url = $linkList[$i]->getUrl(); ?> <li> <a href="<?=$url?>" target="_blank"><?=$name?></a> </li>
<?php /* * 友情链接数据库安装文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * modified 2009-1-3 */ include_once 'config/config.inc.php'; include_once "class/links.class.php"; $objWebInit = new links(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; $objWebInit->db(); $charset = str_replace('-', '', $arrGWeb['charset']); $extend = $objWebInit->db->getAttribute(PDO::ATTR_SERVER_VERSION) > '4.1' ? " DEFAULT CHARSET={$charset} " : ""; //写入频道数组 $strWEB_ROOT_pre = $arrGWeb['WEB_ROOT_pre']; unset($arrGWeb); $strFilename = __WEB_ROOT . '/data/webconfig.inc.php'; include $strFilename; $arrGMeta['links']['name'] = '友情链接'; $arrGMeta['links']['admin'] = array(array('href' => '../links/admin/index.php', 'name' => '友情链接管理')); $somecontent = '<?php' . "\n" . '$arrGWeb = ' . var_export($arrGWeb, true) . ';' . "\n" . '$arrGMeta = ' . var_export($arrGMeta, true) . ';' . "\n" . '?>'; // 首先我们要确定文件存在并且可写。 if (is_writable($strFilename)) { if (!($handle = fopen($strFilename, 'w'))) {
/** * 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; }
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// session_start(); // Load the require PHP classes. require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "links.class.php"; $common = new common(); $account = new account(); $links = new links(); // Check if the user is logged in. if (!$account->isAuthenticated()) { // The user is not logged in so forward them to the login page. header("Location: login.php"); } if ($common->postBack()) { // Delete the selected link. $links->deleteLinkByName(urldecode($_GET['name'])); // Forward the user to the link management index page. header("Location: /admin/links/"); } // Get the data for this link. $link = $links->getLinkByName(urldecode($_GET['name'])); //////////////// // BEGIN HTML
/** * Delete link logo * * @param void * @return null */ function delete_logo() { if (!logged_user()->isAdministrator(owner_company())) { flash_error(lang('no access permissions')); $this->redirectTo('links', 'index'); } // if $link = links::findById(get_id()); if (!($link instanceof link)) { flash_error(lang('link dnx')); $this->redirectToReferer(get_url('links', 'index')); } // if try { DB::beginWork(); $link->deleteLogo(); $link->save(); ApplicationLogs::createLog($link, active_project(), ApplicationLogs::ACTION_EDIT); DB::commit(); flash_success(lang('success delete logo')); } catch(Exception $e) { DB::rollback(); flash_error(lang('error delete logo')); } // try $this->redirectToUrl($link->getEditLogoUrl()); } // delete_logo
<?php /** * 友情链接后台管理栏目修改文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage links */ require_once '../config/config.inc.php'; require_once "../class/links.class.php"; require_once '../..' . __WEBADMIN_ROOT . '/checklogin.php'; $objWebInit = new links(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; //图片上传参数 $objWebInit->arrGPic = $arrGPic; $objWebInit->db(); //访问权限检查 if (!$objWebInit->checkPopedomG($_SESSION['user_id'])) { check::AlertExit('对不起,您没有权限访问此页', -1); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_FILES['Filedata']['name'] != "") { $strOldFile = $arrGPic['FileSavePath'] . $_POST['savefilename']; if (is_file($strOldFile)) { // 原文件删除
public static function init($base_url, $admin_url_path) { // set paths self::$base_url = substr($base_url, 0, -1); self::$admin_url_path = $admin_url_path; // set default rules self::set("base_home", "[base]/\$"); /* * SET GENERAL */ self::set("admin_content", "^[admin]/content/"); self::set("admin_design", "^[admin]/design/"); self::set("admin_accounts", "^[admin]/accounts/"); self::set("admin_settings", "^[admin]/settings/"); self::set("admin_extender", "^[admin]/extender/"); /* * CONTENT */ self::set("admin_pages", "^[admin]/content/pages/\$"); self::set("admin_pages_add", "^[admin]/content/pages/add/([a-zA-Z0-9-_]{0,})\$"); self::set("admin_pages_edit", "^[admin]/content/pages/edit/[num]/\$"); self::set("admin_pages_delete", "^[admin]/content/pages/delete/[num]/\$"); self::set("admin_categories", "^[admin]/content/categories/\$"); self::set("admin_media", "^[admin]/content/media/\$"); self::set("admin_menus", "^[admin]/content/menus/\$"); self::set("admin_menus_view", "^[admin]/content/menus/view/[num]/\$"); self::set("admin_menus_item_edit", "^[admin]/content/menus/view/[num]/item/[num]/\$"); self::set("admin_trash", "^[admin]/trash/\$"); /* * DESIGN */ self::set("admin_templates", "^[admin]/design/template/\$"); self::set("admin_template_install", "^[admin]/design/template/install/[any]/\$"); self::set("admin_design_widgets", "^[admin]/design/widgets/\$"); /* * ACCOUNTS */ self::set("admin_accounts_users", "^[admin]/accounts/users/\$"); self::set("admin_accounts_users_add", "^[admin]/accounts/users/add/\$"); self::set("admin_accounts_users_edit", "^[admin]/accounts/users/edit/[num]/\$"); self::set("admin_accounts_groups", "^[admin]/accounts/groups/\$"); self::set("admin_accounts_groups_add", "^[admin]/accounts/groups/add/\$"); self::set("admin_accounts_groups_edit", "^[admin]/accounts/groups/edit/[num]/\$"); /* * EXTENDER */ self::set("admin_plugins", "^[admin]/extender/plugins/\$"); self::set("admin_plugin_install", "^[admin]/extender/plugins/install/[any]/\$"); self::set("admin_plugin_uninstall", "^[admin]/extender/plugins/uninstall/[any]/\$"); self::set("admin_marketplace", "^[admin]/marketplace/\$"); /* * SETTINGS */ self::set("admin_settings_general", "^[admin]/settings/general/\$"); self::set("admin_settings_security", "^[admin]/settings/security/\$"); self::set("admin_settings_seo", "^[admin]/settings/seo/\$"); self::set("admin_settings_maintenance", "^[admin]/settings/maintenance/\$"); self::set("admin_settings_backend", "^[admin]/settings/backend/\$"); self::set("admin_settings_email", "^[admin]/settings/email/\$"); self::set("admin_settings_backup", "^[admin]/settings/backup/\$"); /* * misc */ self::set("admin_home", "^[admin]/\$"); self::set("admin_login", "^[admin]/login/\$"); self::set("admin_logout", "^[admin]/logout/\$"); }
"> <div id="wrapper"> <?php echo theme::render_header(); ?> <div id="header"> <div id="logo" class="left"> <h1><?php echo html::anchor(url::site(), store::name()); ?> </h1> </div> <div id="navigation" class="right"> <ul> <?php foreach (links::get('main') as $link) { ?> <li><?php echo $link->display(); ?> </li> <?php } ?> </ul> </div> <div class="clear"></div> </div> <div id="sidebar" class="left"> <div id="categories" class="box">
function get($id = 0) { if (self::$cached_links != null) { if ($id == 0) { return self::$cached_links; } else { return self::$cached_links_index[$id]; } } global $user; //$this->db->query("select * from be_links where id in (select link_id as id from be_link_permissions where group_id in(1,3))"); $this->db->from("be_link_permissions"); $this->db->where('be_link_permissions.group_id in (' . implode(',', $user->groups) . ')'); $this->db->join('be_links', 'be_links.id = be_link_permissions.link_id', 'inner'); $this->db->group_by('be_links.id'); $this->db->order_by("be_links.order", "ASC"); $data = $this->db->get(); $links = array(); $links_index = array(); $results = $data->result(); //print_r($results); //die(); foreach ($results as $link_entry) { if ($link_entry->parent != 0 && $id == 0) { continue; } $link['id'] = $link_entry->id; $link['name'] = $link_entry->name; $link['target'] = $link_entry->target; $link['title'] = $link_entry->title; $link['tags'] = trim(str_replace("|", ",", $link_entry->tags), ","); $link['parent'] = $link_entry->parent; $link['order'] = $link_entry->order; $link['childs'] = array(); foreach ($results as $sublink_entry) { if ($sublink_entry->parent == 0 || $sublink_entry->parent != $link_entry->id) { continue; } $sublink['id'] = $sublink_entry->id; $sublink['name'] = $sublink_entry->name; $sublink['target'] = $sublink_entry->target; $sublink['title'] = $sublink_entry->title; $sublink['tags'] = trim(str_replace("|", ",", $sublink_entry->tags), ","); $sublink['parent'] = $sublink_entry->parent; $sublink['order'] = $sublink_entry->order; array_push($link['childs'], $sublink); $links_index[$sublink_entry->id] = $sublink; } $links[$link_entry->id] = $link; $links_index[$link_entry->id] = $link; } /*foreach($results as $link_entry) { if(!array_key_exists($link_entry->id, $links)){ $links[$link_entry->id] = array(); $links[$link_entry->id]['groups'] = array(); $links[$link_entry->id]['childs'] = array(); } $links[$link_entry->id]['id'] = $link_entry->id; $links[$link_entry->id]['name'] = $link_entry->name; $links[$link_entry->id]['target'] = $link_entry->target; $links[$link_entry->id]['title'] = $link_entry->title; $links[$link_entry->id]['tags'] = trim(str_replace("|", ",", $link_entry->tags), ","); $links[$link_entry->id]['parent'] = $link_entry->parent; $links[$link_entry->id]['order'] = $link_entry->order; if($link_entry->parent != 0){ $links[$link_entry->parent]['childs'][$link_entry->id] = $links[$link_entry->id]; if(!array_key_exists('groups', $links[$link_entry->parent])) $links[$link_entry->parent]['groups'] = array(); } array_push($links[$link_entry->id]['groups'], intval($link_entry->group_id)); }*/ foreach ($links as $key => $link) { $links[$key] = (object) $links[$key]; } foreach ($links_index as $key => $link) { $links_index[$key] = (object) $links_index[$key]; } self::$cached_links = $links; self::$cached_links_index = $links_index; if ($id == 0) { return self::$cached_links; } else { return self::$cached_links[$id]; } }
<?php /** * 最新文字链接文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage links */ if (is_object($objWebInit)) { if (!isset($objlinks)) { include_once __WEB_ROOT . '/links/class/links.class.php'; include_once __WEB_ROOT . '/links/config/var.inc.php'; $objlinks = new links(); $objlinks->setDBG($arrGPdoDB); $objlinks->arrGPic = $arrGPic; if (is_object($objWebInit->db)) { $objlinks->db = $objWebInit->db; } else { $objlinks->db(); } } $arrLinkList = array(); $arrLinkList = $objlinks->getInfoList(" where pass=1 AND flag=1", " ORDER BY submit_date DESC", 0, 12, '*', '', false); print_r($arrLinkList); exit; // 输出到模板 $arrMOutput["smarty_assign"]['arrLinkList'] = $arrLinkList; $arrMOutput["smarty_assign"]['linkImg'] = $objlinks->arrGPic['FileCallPath'];
<?php foreach (products::all() as $product) { ?> <li><?php echo $product->link(); ?> </li> <?php } ?> </ul> <ul class="left"> <li>Resources</li> <?php foreach (links::get('footer') as $link) { ?> <li><?php echo $link->display(); ?> </li> <?php } ?> </ul> <div class="clear"></div> </div> </div> <?php echo theme::render_footer(); ?>