function swIsAdmin() { if (swValidate('s_username') && strcmp($_SESSION['type'], 'admin') == 0) { return true; } return false; }
public static function printField($name, $formattedString) { if (swValidate('edit')) { echo "<div style='position:absolute'><a target='_top' class='edit' href='swcms/editrecord.php?edittype=record&name={$name}' class='edit'></a></div>"; } $fieldList = StructuredField::getSortedRecords(StructuredUnit::getUnitId($name), true); $rank = 1; if ($fieldList) { foreach ($fieldList as $field) { $output = $formattedString; $output = str_replace("@@rank", $rank++, $output); $values = StructuredFieldValue::getValues($field[0]); $index = 1; if ($values) { foreach ($values as $value) { $output = str_replace("@@" . $index++, displayValue($value[3]), $output); } } $index = 1; $assets = StructuredFieldAsset::getAssets($field[0]); if ($assets) { foreach ($assets as $asset) { $output = str_replace("@@a" . $index, displayValue($asset[2]), $output); $output = str_replace("@@t" . $index, displayValue($asset[1]), $output); $index++; } } echo $output; } } }
public static function includeText($name) { $value = StaticField::getStaticFieldValueByName($name); if (swValidate('edit')) { echo "<a target='_top' class='edit' href='swcms/editstatic.php?name={$name}' class='edit'></a>"; } echo displayValue($value); }
public static function includePicture($name) { $asset = StaticAsset::getStaticAssetByName($name); if (swValidate('edit')) { echo "<a target='_top' class='edit' href='swcms/editstaticasset.php?name={$name}' class='edit'></a>"; } if ($asset) { echo "<img alt='" . $asset[1] . "' src='swcms/assets/" . $asset[2] . "'></img>"; } }
<?php // admin header session_start(); require_once 'lib/php/DOLib.php'; if (!swValidate('s_username')) { header("location: index.php"); } if (empty($_SESSION['edit'])) { $_SESSION['edit'] = $GLOBALS['DOCUMENT_ROOT']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>standupweb CMS - Edit mode</title> <link rel="stylesheet" href="css/style.css" type="text/css" media="all" /> <link rel="shortcut icon" href="images/favicon.ico" /> </head> <body> <div class="header"> <div id='options'> <div id='setting'> <a href="editsetting.php"></a> </div> <div id='logoff'> <a href="index.php?logoff=1"></a> </div> </div>