function login() { // // $db = login(); // // Tries to connect to database using session vars. // Sends user to login script if the session has not been initialized // or if the current session values are not valid. // init_session(); if (isset($_SESSION['dbname']) && isset($_SESSION['username']) && isset($_SESSION['password'])) { list($db, $msg) = dbConnect($_SESSION['username'], $_SESSION['password'], $_SESSION['dbname'], 'localhost'); if (!$db) { destroy_session(); header("Location: login.php?continueURL=" . urlencode(hostURL() . "/" . $_SERVER["REQUEST_URI"]) . "&msg=" . urlencode($msg)); exit; } else { return $db; } } else { destroy_session(); header("Location: login.php?continueURL=" . urlencode(hostURL() . "/" . $_SERVER["REQUEST_URI"])); exit; } if (!isset($_SESSION['username'])) { // Session not started OK trigger_error("Session failed to initialize- problem with cookies?"); exit; } // $db = FALSE; // // Force basic auth // $realm = "mrData"; // if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) // list($db,$msg) = dbConnect($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], 'mrDataDB'); // if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || !$db){ // header('WWW-Authenticate: Basic realm="'.$realm.'"'); // header('HTTP/1.0 401 Unauthorized'); // // We only get here if the user cancels the basic auth dialog. // echo 'Sorry- you must log in.'; // exit; // } else { // //echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>"; // //echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>"; // } // return($db); }
/** * Generates page level actions * Admin(+admin), Settings(+settings), Permissions(+grant), * Login(+login), Profile(+profile), and Logout(+logout) * * @param $userId The user for whom the list of permitted actions must be computed. * @param $pageId The page on which the permissible action for the user is computed * * @return $actionbar The list of permitted actions for the 'user' of 'page'. */ function getActionbarPage($userId, $pageId) { $action_query = "SELECT perm_id, perm_action, perm_text FROM `" . MYSQL_DATABASE_PREFIX . "permissionlist` WHERE page_module = 'page'"; $action_result = mysql_query($action_query); $allow_login_query = "SELECT `value` FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute` = 'allow_login'"; $allow_login_result = mysql_query($allow_login_query); $allow_login_result = mysql_fetch_array($allow_login_result); $actionbarPage = array(); while ($action_row = mysql_fetch_assoc($action_result)) { if (getPermissions($userId, $pageId, $action_row['perm_action'])) { $actionbarPage[$action_row['perm_action']] = $action_row['perm_text']; } } if ($userId == 0) { if ($allow_login_result[0]) { $actionbarPage["login"] = "******"; $actionbarPage["login&subaction=register"] = "Register"; } } else { $actionbarPage["logout"] = "Logout"; ///profile has been changed to display the username. $actionbarPage["profile"] = getUserName($userId); } $actionbarPage["search"] = "Search"; $actionbar = "<div id=\"cms-actionbarPage\">"; foreach ($actionbarPage as $action => $actionname) { global $templateFolder; global $cmsFolder; $hostURLL = hostURL(); $tuname = getUserName($userId); global $onlineSiteUrl; if ($action == "profile") { $actionbar .= "<span class=\"cms-actionbarPageItem\"><a class=\"robots-nofollow cms-action{$action}\" rel=\"nofollow\" href=\"{$onlineSiteUrl}/../user:{$tuname}\"><img src=\"{$hostURLL}/{$cmsFolder}/{$templateFolder}/common/images/usericon.png\" \\/> {$actionname}</a></span>\n"; } else { if ($action == "pdf") { $actionbar .= "<span class=\"cms-actionbarPageItem\"><a id=\"a\" onclick=\"javascript:var x=prompt('Enter Depth (0 for current page only, -1 for all child pages)','0');if(x)document.getElementById('a').href = document.getElementById('a').href + '&depth=' + x; else return false;\" class=\"robots-nofollow cms-action{$action}\" rel=\"nofollow\" href=\"./+{$action}\">{$actionname}</a></span>\n"; } else { $actionbar .= "<span class=\"cms-actionbarPageItem\"><a class=\"robots-nofollow cms-action{$action}\" rel=\"nofollow\" href=\"./+{$action}\">{$actionname}</a></span>\n"; } } } $actionbar .= "</div>"; return $actionbar; }
function prettyurl($str) { global $urlRequestRoot; if (strpos("a" . $str, "http") == 1) { if (!strpos("a" . $str, hostURL())) { return $str; } } if (strpos("a" . $str, $urlRequestRoot . "/cms")) { return $str; } $page = isset($_GET['page']) ? $_GET['page'] : "/"; $file = ""; $ch = strpos("a" . $str, hostURL()) == 1 ? strlen(hostURL()) : 2; if (strripos("a" . $str, ".") > $ch && ($ch == 2 || strpos("a" . $str, hostURL() . "/home/") == 1)) { $file = substr($str, strripos($str, "/") + 1); $str = substr($str, 0, strripos($str, "/") + 1); } if (substr($str, 0, 3) == "../") { $page = substr($page, 0, strripos($page, "/") - 1); $page = substr($page, 0, strripos($page, "/") + 1); } if (strpos($str, "../")) { $pos = strpos($str, "../"); $page = substr($page, 0, strripos($page, "/") - 1); $page = substr($page, 0, strripos($page, "/") + 1); $str = substr($str, 0, $pos) . substr($str, $pos + 3); } $str = preg_replace("/^.\\//", $urlRequestRoot . "/?page=" . $page, $str); $str = preg_replace("/^..\\//", $urlRequestRoot . "/?page=" . $page, $str); $str = preg_replace("/\\+/", "&action=", $str); $str = preg_replace("/^" . str_replace("/", "\\/", hostURL()) . "\\/home/", hostURL() . "/?page=", $str); $str = preg_replace("/^" . str_replace("/", "\\/", $urlRequestRoot) . "\\/home/", "./?page=", $str); if ($file != "") { $str .= "&fileget=" . $file; } return $str; }
} else { $_industries = selectList('Industry', ''); $_countries = selectList('Country', ''); } $ACL = array('public', '1', 'acl', '2', 'private', '3'); } } if ($_form == "login") { $_sid = ""; $_realm = ""; } $_hostLinks = str_replace('[HOST]', hostURL(), ' <link rel="openid.server" title="OpenID Server" href="[HOST]/openid" />' . ' <link rel="openid2.provider" title="OpenID v2 Server" href="[HOST]/openid" />'); $_userLinks = ''; if ($_userName != "") { $_userLinks = ' <link rel="meta" type="application/rdf+xml" title="SIOC" href="[HOST]/dataspace/[USER]/sioc.rdf" />' . ' <link rel="meta" type="application/rdf+xml" title="FOAF" href="[HOST]/dataspace/person/[USER]/foaf.rdf" />' . ' <link rel="meta" type="text/rdf+n3" title="FOAF" href="[HOST]/dataspace/person/[USER]/foaf.n3" />' . ' <link rel="meta" type="application/json" title="FOAF" href="[HOST]/dataspace/person/[USER]/foaf.json" />' . ' <link rel="http://xmlns.com/foaf/0.1/primaryTopic" title="About" href="[HOST]/dataspace/person/[USER]#this" />' . ' <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />' . ' <meta name="dc.language" content="en" scheme="rfc1766" />' . ' <meta name="dc.creator" content="[USER]" />' . ' <meta name="dc.description" content="ODS HTML [USER]\'s page" />' . ' <meta name="dc.title" content="ODS HTML [USER]\'s page" />' . ' <link rev="describedby" title="About" href="[HOST]/dataspace/person/[USER]#this" />' . ' <link rel="schema.geo" href="http://www.w3.org/2003/01/geo/wgs84_pos#" />' . ' <meta http-equiv="X-XRDS-Location" content="[HOST]/dataspace/[USER]/yadis.xrds" />' . ' <meta http-equiv="X-YADIS-Location" content="[HOST]/dataspace/[USER]/yadis.xrds" />' . ' <link rel="meta" type="application/xml+apml" title="APML 0.6" href="[HOST]/dataspace/[USER]/apml.xml" />' . ' <link rel="alternate" type="application/atom+xml" title="OpenSocial Friends" href="[HOST]/feeds/people/[USER]/friends" />'; $_userLinks = str_replace('[HOST]', hostURL(), $_userLinks); $_userLinks = str_replace('[USER]', $_userName, $_userLinks); } ?> <html> <head> <meta charset="utf-8" /> <title>ODS user's pages</title> <?php echo $_hostLinks; echo $_userLinks; ?> <link rel="stylesheet" type="text/css" href="/ods/users/css/users.css" /> <link rel="stylesheet" type="text/css" href="/ods/default.css" /> <link rel="stylesheet" type="text/css" href="/ods/nav_framework.css" /> <link rel="stylesheet" type="text/css" href="/ods/typeahead.css" />
public function getHTML() { global $urlRequestRoot, $cmsFolder; if ($this->globaldisable == '1' || $this->globaldisable == 'Yes') { return ""; } $ran = ''; if ($this->makeunique == '1' || $this->makeunique == 'Yes') { $ran = $this->widgetInstanceId; } $divid = $this->divid . $ran; $type = $this->type; $width = $this->width; $height = $this->height; $show_face = false; $color = $this->color; if ($this->show_face == "Yes") { $show_face = "true"; } if ($type == "Facebook Page") { $url = urlencode($this->pageurl); $stream = $header = false; if ($this->stream == "Yes") { $stream = "true"; } if ($this->header == "Yes") { $header = "true"; } $like = <<<FBHTML \t\t<iframe src="http://www.facebook.com/plugins/likebox.php?href={$url}&width={$width}&colorscheme={$color}&show_faces={$show_face}&stream={$stream}&header={$header}&height={$height}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$width}; height:{$height};" allowTransparency="true"></iframe> FBHTML; } else { $layout = $this->layout; if ($type == "Site") { $url = urlencode(hostURL()); $like = <<<FBHTML \t\t<iframe src="http://www.facebook.com/plugins/like.php?href={$url}&layout={$layout}&show_faces={$show_face}&width={$width}&action=like&colorscheme={$color}&height={$height}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$width}; height:{$height};" allowTransparency="true"></iframe> FBHTML; } else { if ($type == "Each Page") { $url = urlencode(selfURI()); $like = <<<FBHTML \t\t<iframe src="http://www.facebook.com/plugins/like.php?href={$url}&layout={$layout}&show_faces={$show_face}&width={$width}&action=like&colorscheme={$color}&height={$height}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$width}; height:{$height};" allowTransparency="true"></iframe> FBHTML; } } } $fbHTML = "<div class='{$this->divclass}' id='{$divid}'>" . $like . "</div>"; return $fbHTML; }
/** * Get the ChildList for the current item in menu. * @param $pageId the page Id of the current Page * @param $depth The number of levels of menu that should be generated * @param $userId The viewers id - To check for permissions. * @return Associative Array containing the child pages informaion.; */ function getChildList($pageId, $depth, $rootUri, $userId, $curdepth) { if ($depth > 0 || $depth == -1) { if ($curdepth == 1 || $pageId == 0) { $classname = "topnav"; } else { $classname = "subnav"; } $MYHOST = hostURL(); $pageRow = getChildren($pageId, $userId); $var = "<div class='div_{$classname}'><ul class='{$classname} depth{$curdepth}'>"; for ($i = 0; $i < count($pageRow); $i += 1) { $query = "SELECT `page_openinnewtab` FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_id` = '{$pageRow[$i][0]}'"; $result = mysql_query($query); $result = mysql_fetch_assoc($result); $opennewtab = ""; if ($result['page_openinnewtab'] == '1') { $opennewtab = ' target="_blank" '; } $newdepth = $curdepth + 1; $imageTag = ''; if ($pageRow[$i][4]) { if ($pageRow[$i][3] != NULL) { $imageTag = "<img width=32 height=32 src=\"{$MYHOST}/{$pageRow[$i][3]}\" alt=\"{$pageRow[$i][1]}\" />"; } /* *@usage: display a default folder icon if the table value is NULL *@code: else { global $cmsFolder; global $templateFolder; $imageTag = "<img src=\"{$hostt}/$cmsFolder/$templateFolder/common/images/folder.png\" alt=\"{$pageRow[$i][1]}\" width=\"16\" height=\"16\"/>"; }*/ } $var .= "\n<li id=\"cms-menu-item{$i}\"><a href=\"" . $rootUri . '/home' . getPagePath($pageRow[$i][0]) . "\" {$opennewtab} ><div class='cms-menuitem'>" . $imageTag . " " . $pageRow[$i][2] . "</div></a>"; $var .= getChildList($pageRow[$i][0], $depth == -1 ? $depth : $depth - 1, $rootUri, $userId, $newdepth, true); $var .= "</li>"; } $var .= "</ul></div>"; if (count($pageRow) == 0) { return ""; } return $var; } }
/** * Function getListOfFiles * @description "To generate File list given a folder" * @param dir Name of the directory : Relative path * @param isTopLevel This is to ensure that the $iconList doesnt get emptied when recursion occurs. * @usage Always call the function as getListOfFiles(<Directory>, true) */ function getListOfFiles($dir, $isTopLevel = false) { global $iconList; if (substr($dir, -1) != '/') { $dir .= "/"; } $rootUri = hostURL(); if ($isTopLevel) { $iconList = ""; } if (is_readable($dir)) { $handle = scandir($dir); foreach ($handle as $item) { if ($item != '.' && $item != '..' && $item[0] != ".") { if (is_dir($dir . $item)) { getListOfFiles($dir . $item); } else { if (is_readable($dir . $item)) { $type = explode("/", mime_content_type($dir . $item)); if ($type[0] == "image") { $iconList .= "<div class=\"dragme\" draggable=\"true\" ondragstart=\"dragStartHandler(event,this)\" onclick=\"selectIcon(event,this)\">"; $iconList .= "<img title='{$item}' alt='{$item}' src='{$rootUri}/{$dir}{$item}' width=32 height=32 /></div>\n"; } } } } } } return $iconList; }
/** * @param $userId The user for whom the list of permitted actions must be computed. * @param $pageId The page on which the permissible action for the user is computed * * @return $searchbar The search bar for tags. */ function getSearchbar($userId, $pageId) { if (isset($_GET['searchbar']) && isset($_GET['searchContents'])) { $_GET['searchbar'] = escape($_GET['searchbar']); $_GET['searchContents'] = escape($_GET['searchContents']); $allPageQuery = "SELECT `page_id`, `page_module` FROM `" . MYSQL_DATABASE_PREFIX . "pages`"; $allPageResult = mysql_query($allPageQuery); $pagesIdList = array(); //Contains all pages for which the user has view permission while ($row = mysql_fetch_assoc($allPageResult)) { if (getPermissions($userId, $row['page_id'], $action = "view", $module = $row['page_module'])) { array_push($pagesIdList, intval($row['page_id'])); } } $searchQueryParams = ""; foreach ($pagesIdList as $key => $value) { $searchQueryParams .= $value . ","; } $searchQueryParams = substr($searchQueryParams, 0, -1); $searchQuery = "SELECT * FROM `" . MYSQL_DATABASE_PREFIX . "pagetags` WHERE `tag_text` LIKE '%{$_GET['searchContents']}%' AND `page_id` IN (" . $searchQueryParams . ");"; $tagsWithPermsResult = mysql_query($searchQuery); $searchResult = mysql_query($searchQuery); $suggestions = ""; while ($row = mysql_fetch_assoc($searchResult)) { $suggestions .= "<a href=" . hostURL() . getPagePath($row['page_id']) . ">"; $pageInfo = getPageInfo($row['page_id']); $suggestions .= $pageInfo['page_title'] . "</a><br/>"; } echo $suggestions; exit(0); } $searchbar = <<<SEARCHSCRIPT <script> function showResult(searchstr) { if (searchstr.length==0) { document.getElementById("tagSuggestions").innerHTML=""; document.getElementById("tagSuggestions").style.border="0px"; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { if(xmlhttp.responseText != "") { console.log(xmlhttp.responseText); document.getElementById("tagSuggestions").innerHTML=xmlhttp.responseText; document.getElementById("tagSuggestions").style.border="1px solid #A5ACB2"; } else { document.getElementById("tagSuggestions").innerHTML=""; document.getElementById("tagSuggestions").style.border="0px"; } } } xmlhttp.open("GET","./&searchbar=1&searchContents="+searchstr,true); xmlhttp.send(); } </script> SEARCHSCRIPT; $searchbar .= "<div id='cms-searchbar'>"; $searchbar .= "<input type='text' size='30' onkeyup='showResult(this.value)'>"; $searchbar .= "<div id='tagSuggestions'></div>"; $searchbar .= "</div>"; return $searchbar; }
/** * Handles the widgets configurations for a particular page * @param $pageId Page ID of the current page * @return HTML code of the widget configuration interface for page settings */ function handleWidgetPageSettings($pageId) { global $ICONS, $ICONS_SRC, $urlRequestRoot, $cmsFolder, $moduleFolder; /** * @todo Add widget builder, template editor to change the $WIDGET locations, location-visualizer etc. */ $quicklinks = "\n\t<fieldset>\n <legend>{$ICONS['Widgets']['small']}Widgets</legend>\n <table class='iconspanel'>\n <tr>\n <td><a href='./+widgets#enabledwidgets'><div>{$ICONS['Widgets']['large']}<br/>Enabled Widgets for this Page</div></a></td>\n <td><a href='./+widgets#inheritedwidgets'><div>{$ICONS['Propagate']['large']}<br/>Inherited Widgets for this Page</div></a></td>\n <td><a href='./+widgets&subaction=enable'><div>{$ICONS['Add']['large']}<br/>Add More Widgets</div></a></td>\n </tr>\n </table> \n </fieldset>\n "; $html = ""; if (isset($_GET['subaction']) && $_GET['subaction'] == 'enable') { if (isset($_GET['widgetid'])) { $widgetId = escape($_GET['widgetid']); createWidgetInstance($pageId, $widgetId); } $widgetsarr = getAllWidgetsInfo(); $allwidgets = "<fieldset><legend>{$ICONS['Add']['small']}Add Widgets</legend>"; $allwidgets .= "<table width=100%><tr><th colspan=4>Available Widgets<br/><i>Mouse over for description</i></th></tr>\n\t\t<tr><th>Name</th><th>Version</th><th>Author</th><th>Add</th></tr>"; foreach ($widgetsarr as $widget) { $allwidgets .= "\n<tr><td><a title='" . $widget['description'] . "'>" . $widget['name'] . "</a></td><td>{$widget['version']}</td><td>{$widget['author']}</td><td><a href='./+widgets&subaction=enable&widgetid={$widget['id']}'><img src='{$ICONS_SRC['Add']['large']}' title='Add an instance of this widget' /></a></td></tr>"; } $allwidgets .= "</table></fieldset>"; $html .= $allwidgets; } if (isset($_GET['subaction']) && isset($_GET['widgetid']) && isset($_GET['widgetinstanceid'])) { $subaction = escape($_GET['subaction']); $widgetid = escape($_GET['widgetid']); $widgetinstanceid = escape($_GET['widgetinstanceid']); if ($subaction == "config") { /// POST variables are processed inside this function if (isset($_GET['subsubaction']) && $_GET['subsubaction'] == "update") { updateWidgetConf($widgetid, $widgetinstanceid, FALSE); } $widgetinfo = getWidgetInfo($widgetid); $widgetpageconfigs = getWidgetPageConfigInfo($widgetid); /// @todo Do something about file uploads by widgets $containsFileUploadFields = false; $formElements = getConfigFormAsArray($widgetpageconfigs, $containsFileUploadFields, $widgetinstanceid, FALSE); $jsPath = "{$urlRequestRoot}/{$cmsFolder}/templates/common/scripts/formValidator.js"; //validation.js $calpath = "{$urlRequestRoot}/{$cmsFolder}/{$moduleFolder}/form/calendar"; $jsPathMooTools = "{$urlRequestRoot}/{$cmsFolder}/templates/common/scripts/mootools-1.11-allCompressed.js"; $html .= '<link rel="stylesheet" type="text/css" media="all" href="' . $calpath . '/calendar.css" title="Aqua" />' . '<script type="text/javascript" src="' . $calpath . '/calendar.js"></script>'; $html .= '<fieldset><legend>' . $ICONS['Widgets']['small'] . 'Widget Page Settings</legend><div class="registrationform"><form class="fValidator-form" name="widgetpagesettings" action="./+widgets&subaction=config&subsubaction=update&widgetid=' . $widgetid . '&widgetinstanceid=' . $widgetinstanceid . '" method="post"'; if ($containsFileUploadFields) { $html .= ' enctype="multipart/form-data"'; } $html .= '>'; $html .= "<table class='pragyan_fulltable'><tr><th colspan=2>Widget : {$widgetinfo['name']}</th><tr>"; $html .= "<tr><td>Description : </td><td> {$widgetinfo['description']}</td></tr>"; $html .= "<tr>" . join($formElements, "</tr>\n<tr>") . "</tr>"; $html .= "</table><input name='update_widget_page_settings' type='submit' value='Update'/>" . "<input type='reset' value='Reset'/>"; $html .= "</form><br/></fieldset>"; } else { if ($subaction == "delete") { deleteWidgetInstance($widgetid, $widgetinstanceid); } else { if ($subaction == 'propagate') { propagateWidgetInstance($widgetid, $widgetinstanceid); } else { if ($subaction == 'unpropagate') { unpropagateWidgetInstance($widgetid, $widgetinstanceid); } } } } } if (isset($_GET['subaction']) && isset($_GET['subsubaction']) && isset($_GET['widgetid']) && isset($_GET['widgetinstanceid'])) { $subaction = escape($_GET['subaction']); $subsubaction = escape($_GET['subsubaction']); $widgetid = escape($_GET['widgetid']); $widgetinstanceid = escape($_GET['widgetinstanceid']); if ($subaction == "location") { if ($subsubaction == "up") { modifyWidgetInstanceLocation($pageId, $widgetid, $widgetinstanceid, "-1"); } if ($subsubaction == "down") { modifyWidgetInstanceLocation($pageId, $widgetid, $widgetinstanceid, "+1"); } } else { if ($subaction == "order") { if ($subsubaction == "up") { modifyWidgetInstanceOrder($pageId, $widgetid, $widgetinstanceid, "-1"); } if ($subsubaction == "down") { modifyWidgetInstanceOrder($pageId, $widgetid, $widgetinstanceid, "+1"); } } } } $enabledwidgetsarr = getEnabledWidgets($pageId); $enabled = "<fieldset><legend>{$ICONS['Widgets']['small']}Enabled Widgets</legend><a name='enabledwidgets'></a>"; $enabled .= "<table class='pragyan_fulltable'><tbody><tr><th colspan=4>Enabled Widgets <br/><i>in order of their appearance</i></th></tr>\n\t<tr><th>Widget</th><th>Location</th><th>Order</th><th>Actions</th></tr>"; foreach ($enabledwidgetsarr as $widget) { $propagatebtn = "<a href='./+widgets&subaction=propagate&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'><img src='{$ICONS_SRC['Propagate']['small']}' title='Propagate : Add this widget to all the child pages recursively. Widget will retain its location.' /></a>"; $unpropagatebtn = "<a href='./+widgets&subaction=unpropagate&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'><img src='{$ICONS_SRC['Unpropagate']['small']}' title='Unpropagate : Remove the copies of this widget from all the child pages recursively.' /></a>"; $configbtn = "<a href='./+widgets&subaction=config&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'><img src='{$ICONS_SRC['Edit']['small']}' title='Edit : Configure this instance of this widget' /></a>"; $deletebtn = "<a href='./+widgets&subaction=delete&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'><img src='{$ICONS_SRC['Delete']['small']}' title='Delete : Delete this instance of this widget' /></a>"; $locationup = "<a href='./+widgets&subaction=location&subsubaction=up&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'><img src='{$ICONS_SRC['Up']['small']}' title='Move to an upper location' /></a>"; $locationdown = "<a href='./+widgets&subaction=location&subsubaction=down&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'><img src='{$ICONS_SRC['Down']['small']}' title='Move to a lower location' /></a>"; $orderup = "<a href='./+widgets&subaction=order&subsubaction=up&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'><img src='{$ICONS_SRC['Up']['small']}' title='Move to an upper order' /></a>"; $orderdown = "<a href='./+widgets&subaction=order&subsubaction=down&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'><img src='{$ICONS_SRC['Down']['small']}' title='Move to a lower order' /></a>"; if ($widget['propagate'] == '1') { $propunpropbtn = $unpropagatebtn; } else { $propunpropbtn = $propagatebtn; } $enabled .= "\n<tr><td><a title='{$widget['description']}' href='./+widgets&subaction=config&widgetid={$widget['id']}&widgetinstanceid={$widget['instanceid']}'>{$widget['name']}</a></td><td>{$widget['location']} {$locationup} {$locationdown}</td><td>{$widget['order']} {$orderup} {$orderdown}</td><td>{$configbtn} {$deletebtn} {$propunpropbtn}</td></tr>"; } $enabled .= "</tbody></table></fieldset>"; $enabled .= "<fieldset><legend>{$ICONS['Propagate']['small']}Inherited Widgets</legend><a name='inheritedwidgets'></a><b>Note: Inherited widgets can be configured from the origin page only and they are always ordered last in their location in the inherited pages.</b>"; $enabled .= "<table class='pragyan_fulltable'><tbody><tr><th colspan=3>Inherited Widgets <br/><i>due to propagation from a parent page</i></th></tr><tr><th>Widget</th><th>Location</th><th>Origin</th></tr>"; $inheritedwidgetsarr = getInheritedWidgets($pageId); foreach ($inheritedwidgetsarr as $widget) { $link = hostURL() . $widget['source']; $enabled .= "\n<tr><td><a title='{$widget['description']}'>{$widget['name']}</a></td><td>{$widget['location']}</td><td><a href='{$link}'>{$widget['source']}</a></td></tr>"; } $enabled .= "</tbody></table>"; $enabled .= "</fieldset>"; return $html . $enabled . $quicklinks; }