GetDb(); #****************************************************************************** # global vars definition #****************************************************************************** # this var is used to store any error that may occur. $error = ""; # this one is used later to store all the css found, because they won't appear in the dropdown $csslist = array(); $type = ""; #****************************************************************************** # we now get the parameters #****************************************************************************** # getting variables if (isset($_GET["type"])) $type = $_GET["type"] ; else $error = lang('typenotvalid'); if (isset($_GET["id"])) $id = $_GET["id"] ; else $error = lang('idnotvalid'); # if type is template, we get the name if (isset($type) && "template" == $type) { $query = "SELECT css_name FROM ".cms_db_prefix()."css WHERE css_id = ?"; $result = $db->Execute($query, array($id)); if ($result) { $line = $result->FetchRow(); $name = $line["css_name"]; } else { $error = lang('errorretrievingtemplate'); } } #****************************************************************************** # first getting all user permissions #****************************************************************************** $userid = get_userid(); $modify = check_permission($userid, 'Modify Stylesheet Assoc'); $modifytpl = check_permission($userid,'Modify Templates'); $delasso = check_permission($userid, 'Remove Stylesheet Assoc'); $addasso = check_permission($userid, 'Add Stylesheet Assoc'); $query = "SELECT assoc_to_id, template_name FROM ".cms_db_prefix()."css_assoc, ".cms_db_prefix()."templates WHERE assoc_type=? AND assoc_css_id = ? AND assoc_to_id = template_id"; $result = $db->Execute($query, array($type, $id)); #****************************************************************************** # displaying erros if any #****************************************************************************** if (isset($_GET["message"])) { $message = preg_replace('/\

'.$message.'

'; } if ("" != $error) { echo "

".$error."

"; } if (!$addasso && !$modify && !$delasso) { echo "

".lang('noaccessto', array(lang('addcssassociation')))."

"; } else { #****************************************************************************** # now really starting #****************************************************************************** ?>
ShowHeader('currentassociations'); ?>
'.lang('stylesheet').''?>:

RecordCount() > 0) { echo "\n"; echo ''; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ''; echo ''; # this var is used to show each line with different color $currow = "row1"; # now showing each line while ($one = $result->FetchRow()) { # we store ids of templates found for them not to appear in the dropdown $csslist[] = $one["assoc_to_id"]; echo "\n"; if( $modifytpl ) { echo "\n"; } else { echo "\n"; } # if user has right to delete if ($modify || $delasso) { echo "\n"; } else { echo ""; } echo "\n"; ("row1" == $currow) ? $currow="row2" : $currow="row1"; } ## foreach echo ''; echo "
".lang('title')." 
".$one["template_name"]."".$one['template_name'].""; echo $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'),'','','systemicon'); echo " 
\n"; } # end of if result if( $modify || $addasso ) { # this var is used to store the css ids that should not appear in the # dropdown $notinto = ""; foreach($csslist as $key) { $notinto .= "$key,"; } $notinto = substr($notinto, 0, strlen($notinto) - 1); # this var contains the dropdown $dropdown = ""; # we generate the dropdown if ("" == $notinto) { $query = "SELECT * FROM ".cms_db_prefix()."templates WHERE active = 1 ORDER BY template_name"; } else { $query = "SELECT * FROM ".cms_db_prefix()."templates WHERE template_id NOT IN (".$notinto.") AND active = 1 ORDER BY template_name"; } $result = $db->Execute($query); if ($result && $result->RecordCount() > 0) { ?>

"; ?>

« '.lang('back').'

'; include_once("footer.php"); # vim:ts=4 sw=4 noet ?>