$tabindex = 1; echo "<br><br>"; echo "<form name='clientform' method='post' action='campaign-edit.php' onSubmit='return (phpAds_formCheck(this) && phpAds_priorityCheck(this));'>"; echo "<input type='hidden' name='campaignid' value='" . (isset($campaignid) ? $campaignid : '') . "'>"; echo "<input type='hidden' name='clientid' value='" . (isset($clientid) ? $clientid : '') . "'>"; echo "<input type='hidden' name='expire' value='" . (isset($row["expire"]) ? $row["expire"] : '') . "'>"; echo "<input type='hidden' name='move' value='" . (isset($move) ? $move : '') . "'>"; echo "<input type='hidden' name='target_old' value='" . (isset($row['target']) ? (int) $row['target'] : 0) . "'>"; echo "<input type='hidden' name='weight_old' value='" . (isset($row['weight']) ? (int) $row['weight'] : 0) . "'>"; echo "<input type='hidden' name='active_old' value='" . (isset($row['active']) && $row['active'] == 't' ? 't' : 'f') . "'>"; echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; echo "<tr><td height='25' colspan='3'><b>" . $strBasicInformation . "</b></td></tr>"; echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "<tr><td height='10' colspan='3'> </td></tr>"; echo "<tr><td width='30'> </td><td width='200'>" . $strName . "</td><td>"; echo "<input onBlur='phpAds_formUpdate(this);' class='flat' type='text' name='clientname' size='35' style='width:350px;' value='" . phpAds_htmlQuotes($row["clientname"]) . "' tabindex='" . $tabindex++ . "'></td>"; echo "</tr><tr><td height='10' colspan='3'> </td></tr>"; echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "</table>"; echo "<br><br>"; echo "<br><br>"; echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; echo "<tr><td height='25' colspan='3'><b>" . $strContractInformation . "</b></td></tr>"; echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "<tr><td height='10' colspan='3'> </td></tr>"; if (isset($row['active']) && $row['active'] == 'f') { $expire_ts = mktime(0, 0, 0, $row["expire_month"], $row["expire_dayofmonth"], $row["expire_year"]); $inactivebecause = array(); if ($row['clicks'] == 0) { $inactivebecause[] = $strNoMoreClicks; }
echo "<tr><td height='1' colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "</table>"; } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; echo "<tr><td height='10' colspan='3'> </td></tr>"; if ($phpAds_config['use_keywords']) { echo "<tr><td width='30'> </td>"; echo "<td width='200'>" . $strKeyword . "</td>"; echo "<td><input class='flat' size='35' type='text' name='keyword' style='width:350px;' value='" . phpAds_htmlQuotes($row["keyword"]) . "' tabindex='" . $tabindex++ . "'></td></tr>"; echo "<tr><td><img src='images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; } echo "<tr><td width='30'> </td>"; echo "<td width='200'>" . $strDescription . "</td>"; echo "<td><input class='flat' size='35' type='text' name='description' style='width:350px;' value='" . phpAds_htmlQuotes($row["description"]) . "' tabindex='" . $tabindex++ . "'></td></tr>"; echo "<tr><td><img src='images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; echo "<tr><td width='30'> </td>"; echo "<td width='200'>" . $strWeight . "</td>"; echo "<td><input class='flat' size='6' type='text' name='weight' value='" . (isset($row["weight"]) ? $row["weight"] : $phpAds_config['default_banner_weight']) . "' tabindex='" . $tabindex++ . "'></td></tr>"; echo "<tr><td height='10' colspan='3'> </td></tr>"; echo "<tr><td height='1' colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "</table>"; } echo "<br><br>"; echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; echo "<tr><td height='35' colspan='3'><input type='submit' name='submit' value='" . $strSaveChanges . "' tabindex='" . $tabindex++ . "'></td></tr>"; echo "</table>"; echo "</form>"; echo "<br><br>";
while (list($ukey, $uvalue) = each($phpAds_OS)) { if ($i % 3 == 0) { echo "<tr>"; } echo "<td><input type='checkbox' name='acl[" . $key . "][data][]' value='" . $ukey . "'" . (in_array($ukey, $acl[$key]['data']) ? ' CHECKED' : '') . " tabindex='" . $tabindex++ . "'> " . $ukey . " </td>"; if (($i + 1) % 3 == 0) { echo "</tr>"; } $i++; } if (($i + 1) % 3 != 0) { echo "</tr>"; } echo "</table>"; } else { echo "<input type='text' size='40' name='acl[" . $key . "][data]' value='" . phpAds_htmlQuotes(stripslashes(isset($acl[$key]['data']) ? $acl[$key]['data'] : "")) . "' tabindex='" . $tabindex++ . "'>"; } echo "<br><br></td></tr>"; $previous_type = $acl[$key]['type']; $current_i++; } // Show Footer if (!isset($acl[$key]['type']) || $acl[$key]['type'] != $previous_type && $previous_type != '') { echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; } } else { echo "<tr><td height='24' colspan='4' bgcolor='#F6F6F6'> " . $strNoLimitations . "</td></tr>"; echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; } echo "<tr><td height='30' colspan='2'>"; if (isset($acl) && count($acl) > 1) {
echo "<input type='hidden' name='weight_old' value='" . (isset($row['weight']) ? (int) $row['weight'] : 0) . "'>" . "\n"; echo "<input type='hidden' name='active_old' value='" . (isset($row['active']) && $row['active'] == 't' ? 't' : 'f') . "'>" . "\n"; echo "<input type='hidden' name='previousweight' value='" . (isset($row["weight"]) ? $row["weight"] : '') . "'>" . "\n"; echo "<input type='hidden' name='previoustarget' value='" . (isset($row["target"]) ? $row["target"] : '') . "'>" . "\n"; echo "<input type='hidden' name='previousactive' value='" . (isset($row["active"]) ? $row["active"] : '') . "'>" . "\n"; echo "<input type='hidden' name='previousviews' value='" . (isset($row["views"]) ? $row["views"] : '') . "'>" . "\n"; echo "<input type='hidden' name='previousclicks' value='" . (isset($row["clicks"]) ? $row["clicks"] : '') . "'>" . "\n"; echo "<input type='hidden' name='previousconversions' value='" . (isset($row["conversions"]) ? $row["conversions"] : '') . "'>" . "\n"; echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>" . "\n"; echo "<tr><td height='25' colspan='3'><b>" . $strBasicInformation . "</b></td></tr>" . "\n"; echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>" . "\n"; echo "<tr><td height='10' colspan='3'> </td></tr>" . "\n"; echo "<tr>" . "\n"; echo "\t" . "<td width='30'> </td>" . "\n"; echo "\t" . "<td width='200'>" . $strName . "</td>" . "\n"; echo "\t" . "<td><input onBlur='phpAds_formPriorityUpdate(this.form);' class='flat' type='text' name='campaignname' size='35' style='width:350px;' value='" . phpAds_htmlQuotes($row['campaignname']) . "' tabindex='" . $tabindex++ . "'></td>" . "\n"; echo "</tr>" . "\n"; echo "<tr><td height='10' colspan='3'> </td></tr>" . "\n"; echo "<tr><td height='25' colspan='3'><b>" . $strInventoryDetails . "</b></td></tr>" . "\n"; echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>" . "\n"; echo "<tr><td height='10' colspan='3'> </td></tr>" . "\n"; if (isset($row['active']) && $row['active'] == 'f') { $expire_ts = mktime(0, 0, 0, $row["expire_month"], $row["expire_dayofmonth"], $row["expire_year"]); $inactivebecause = array(); if ($row['views'] == 0) { $inactivebecause[] = $strNoMoreViews; } if ($row['clicks'] == 0) { $inactivebecause[] = $strNoMoreClicks; } if ($row['conversions'] == 0) {
// Error message? if (isset($errormessage) && count($errormessage)) { echo "<tr><td> </td><td height='10' colspan='2'>"; echo "<table cellpadding='0' cellspacing='0' border='0'><tr><td>"; echo "<img src='images/error.gif' align='absmiddle'> "; while (list($k, $v) = each($errormessage)) { echo "<font color='#AA0000'><b>" . $v . "</b></font><br>"; } echo "</td></tr></table></td></tr><tr><td height='10' colspan='3'> </td></tr>"; echo "<tr><td><img src='images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; } // Username echo "<tr><td width='30'> </td><td width='200'>" . $strUsername . "</td>"; if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { echo "<td width='370'><input onBlur='phpAds_formUpdate(this);' class='flat' type='text' name='username' size='25' value='" . phpAds_htmlQuotes($affiliate['username']) . "' tabindex='" . $tabindex++ . "'></td>"; } else { echo "<td width='370'>" . (isset($affiliate['username']) ? $affiliate['username'] : ''); } echo "</tr><tr><td><img src='images/spacer.gif' height='1' width='30'></td>"; echo "<td colspan='1'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td><td><img src='images/spacer.gif' height='1' width='100%'></tr>"; // Password if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { echo "<tr><td width='30'> </td><td width='200'>" . $strPassword . "</td>"; echo "<td width='370'><input class='flat' type='password' name='password' size='25' value='" . $affiliate['password'] . "' tabindex='" . $tabindex++ . "'></td>"; echo "</tr><tr><td height='10' colspan='3'> </td></tr>"; } else { echo "<tr><td width='30'> </td><td width='200'>" . $strOldPassword . "</td><td width='100%'>"; echo "<input onBlur='phpAds_formUpdate(this);' class='flat' type='password' name='pwold' size='25' value='' tabindex='" . $tabindex++ . "'>"; echo "</td></tr><tr><td><img src='images/spacer.gif' height='1' width='30'></td>"; echo "<td colspan='1'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td><td><img src='images/spacer.gif' height='1' width='100%'></tr>";
while (list($key, $val) = each($result)) { list($url, $target) = $val; if ($i > 0) { echo "<tr><td height='20' colspan='4'> </td></tr>"; echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "<tr><td height='10' colspan='4'> </td></tr>"; } echo "<tr><td width='30'> </td><td width='30'><input type='checkbox' name='convert_links[]' value='" . $key . "' checked></td>"; echo "<td width='200'>" . $strURL . "</td>"; echo "<td><input class='flat' size='35' type='text' name='overwrite_link[" . $key . "]' style='width:300px;' dir='ltr' value='" . phpAds_htmlQuotes($url) . "'>"; echo "<input type='radio' name='chosen_link' value='" . $key . "'" . ($i == 0 ? ' checked' : '') . "></td></tr>"; echo "<tr><td colspan='2'><img src='images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; echo "<tr><td width='30'> </td><td width='30'> </td>"; echo "<td width='200'>" . $strTarget . "</td>"; echo "<td><input class='flat' size='16' type='text' name='overwrite_target[" . $key . "]' style='width:150px;' dir='ltr' value='" . phpAds_htmlQuotes($target) . "'>"; echo "</td></tr>"; if (count($result) > 1) { echo "<tr><td colspan='2'><img src='images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; echo "<tr><td width='30'> </td><td width='30'> </td>"; echo "<td width='200'>" . $strOverwriteSource . "</td>"; echo "<td><input class='flat' size='50' type='text' name='overwrite_source[" . $key . "]' style='width:150px;' dir='ltr' value=''>"; echo "</td></tr>"; } $i++; } echo "<tr><td height='20' colspan='4'> </td></tr>"; echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "</table>"; echo "<br><br>";
function phpAds_upgradeSplitBanners() { global $phpAds_config; // Check if splitting is needed if (!isset($phpAds_config['config_version']) || $phpAds_config['config_version'] < 200.07) { $banners = array(); // Fetch all banners $res = phpAds_dbQuery("SELECT * FROM " . $phpAds_config['tbl_banners']); while ($row = phpAds_dbFetchArray($res)) { $banners[] = $row; } for ($i = 0; $i < count($banners); $i++) { // Requote fields $banners[$i]['alt'] = phpAds_htmlQuotes(stripslashes($banners[$i]['alt'])); $banners[$i]['bannertext'] = phpAds_htmlQuotes(stripslashes($banners[$i]['bannertext'])); // Resplit keywords if (isset($banners[$i]['keyword']) && $banners[$i]['keyword'] != '') { $keywordArray = split('[ ,]+', trim($banners[$i]['keyword'])); $banners[$i]['keyword'] = implode(' ', $keywordArray); } // Determine storagetype switch ($banners[$i]['format']) { case 'url': $banners[$i]['storagetype'] = 'url'; break; case 'html': $banners[$i]['storagetype'] = 'html'; break; case 'web': $banners[$i]['storagetype'] = 'web'; break; default: $banners[$i]['storagetype'] = 'sql'; break; } switch ($banners[$i]['storagetype']) { case 'sql': // Determine contenttype $banners[$i]['contenttype'] = $banners[$i]['format']; // Store the file $banners[$i]['filename'] = 'banner_' . $banners[$i]['bannerid'] . '.' . $banners[$i]['contenttype']; $banners[$i]['filename'] = phpAds_ImageStore($banners[$i]['storagetype'], $banners[$i]['filename'], $banners[$i]['banner']); $banners[$i]['imageurl'] = $phpAds_config['url_prefix'] . '/adimage.php?filename=' . $banners[$i]['filename'] . "&contenttype=" . $banners[$i]['contenttype']; $banners[$i]['htmltemplate'] = phpAds_getBannerTemplate($banners[$i]['contenttype']); $banners[$i]['htmlcache'] = addslashes(phpAds_getBannerCache($banners[$i])); $banners[$i]['htmltemplate'] = addslashes($banners[$i]['htmltemplate']); $banners[$i]['banner'] = ''; break; case 'web': // Get the contenttype $ext = substr($banners[$i]['banner'], strrpos($banners[$i]['banner'], ".") + 1); switch (strtolower($ext)) { case 'jpeg': $banners[$i]['contenttype'] = 'jpeg'; break; case 'jpg': $banners[$i]['contenttype'] = 'jpeg'; break; case 'html': $banners[$i]['contenttype'] = 'html'; break; case 'png': $banners[$i]['contenttype'] = 'png'; break; case 'gif': $banners[$i]['contenttype'] = 'gif'; break; case 'swf': $banners[$i]['contenttype'] = 'swf'; break; } // Store the file $banners[$i]['filename'] = basename($banners[$i]['banner']); $banners[$i]['imageurl'] = $banners[$i]['banner']; $banners[$i]['htmltemplate'] = phpAds_getBannerTemplate($banners[$i]['contenttype']); $banners[$i]['htmlcache'] = addslashes(phpAds_getBannerCache($banners[$i])); $banners[$i]['htmltemplate'] = addslashes($banners[$i]['htmltemplate']); $banners[$i]['banner'] = ''; break; case 'url': // Get the contenttype $ext = parse_url($banners[$i]['banner']); $ext = $ext['path']; $ext = substr($ext, strrpos($ext, ".") + 1); switch (strtolower($ext)) { case 'jpeg': $banners[$i]['contenttype'] = 'jpeg'; break; case 'jpg': $banners[$i]['contenttype'] = 'jpeg'; break; case 'html': $banners[$i]['contenttype'] = 'html'; break; case 'png': $banners[$i]['contenttype'] = 'png'; break; case 'gif': $banners[$i]['contenttype'] = 'gif'; break; case 'swf': $banners[$i]['contenttype'] = 'swf'; break; } $banners[$i]['imageurl'] = $banners[$i]['banner']; $banners[$i]['htmltemplate'] = phpAds_getBannerTemplate($banners[$i]['contenttype']); $banners[$i]['htmlcache'] = addslashes(phpAds_getBannerCache($banners[$i])); $banners[$i]['htmltemplate'] = addslashes($banners[$i]['htmltemplate']); $banners[$i]['filename'] = ''; $banners[$i]['banner'] = ''; break; case 'html': // Get the contenttype $banners[$i]['contenttype'] = 'html'; $banners[$i]['htmltemplate'] = stripslashes($banners[$i]['banner']); $banners[$i]['htmlcache'] = addslashes(phpAds_getBannerCache($banners[$i])); $banners[$i]['htmltemplate'] = addslashes($banners[$i]['htmltemplate']); $banners[$i]['imageurl'] = ''; $banners[$i]['filename'] = ''; $banners[$i]['banner'] = ''; break; } // Update the banner $res = phpAds_dbQuery("\n\t\t\t\tUPDATE\n\t\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\t\tSET\n\t\t\t\t\tstoragetype = '" . $banners[$i]['storagetype'] . "',\n\t\t\t\t\tcontenttype = '" . $banners[$i]['contenttype'] . "',\n\t\t\t\t\tfilename = '" . $banners[$i]['filename'] . "',\n\t\t\t\t\timageurl = '" . $banners[$i]['imageurl'] . "',\n\t\t\t\t\tbanner = '" . $banners[$i]['banner'] . "',\n\t\t\t\t\thtmltemplate = '" . $banners[$i]['htmltemplate'] . "',\n\t\t\t\t\thtmlcache = '" . $banners[$i]['htmlcache'] . "',\n\t\t\t\t\talt = '" . $banners[$i]['alt'] . "',\n\t\t\t\t\tstatus = '" . $banners[$i]['status'] . "',\n\t\t\t\t\tbannertext = '" . $banners[$i]['bannertext'] . "',\n\t\t\t\t\tkeyword = '" . $banners[$i]['keyword'] . "'\n\t\t\t\tWHERE\n\t\t\t\t\tbannerid = " . $banners[$i]['bannerid'] . "\n\t\t\t"); } // Delete unneeded columns $res = phpAds_dbQuery("ALTER TABLE " . $phpAds_config['tbl_banners'] . " DROP COLUMN banner"); $res = phpAds_dbQuery("ALTER TABLE " . $phpAds_config['tbl_banners'] . " DROP COLUMN format"); } }
function buildBannerForm($type, $aBanner, &$oComponent = null, $formDisabled = false) { //-- Build forms $form = new OA_Admin_UI_Component_Form("bannerForm", "POST", $_SERVER['SCRIPT_NAME'], null, array("enctype" => "multipart/form-data")); $form->forceClientValidation(true); $form->addElement('hidden', 'clientid', $aBanner['clientid']); $form->addElement('hidden', 'campaignid', $aBanner['campaignid']); $form->addElement('hidden', 'bannerid', $aBanner['bannerid']); $form->addElement('hidden', 'type', $type); $form->addElement('hidden', 'status', $aBanner['status']); if ($type == 'sql' || $type == 'web') { $form->addElement('custom', 'banner-iab-note', null, null); } if ($aBanner['contenttype'] == 'swf' && empty($aBanner['alt_contenttype']) && empty($aBanner['alt_imageurl'])) { $form->addElement('custom', 'banner-backup-note', null, null); } $form->addElement('header', 'header_basic', $GLOBALS['strBasicInformation']); if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $form->addElement('text', 'description', $GLOBALS['strName']); } else { $form->addElement('static', 'description', $GLOBALS['strName'], $aBanner['description']); } //local banners if ($type == 'sql' || $type == 'web') { if ($type == 'sql') { $header = $form->createElement('header', 'header_sql', $GLOBALS['strMySQLBanner'] . " - banner creative"); } else { $header = $form->createElement('header', 'header_sql', $GLOBALS['strWebBanner'] . " - banner creative"); } $header->setAttribute('icon', 'icon-banner-stored.gif'); $form->addElement($header); $imageName = _getContentTypeIconImageName($aBanner['contenttype']); $size = _getBannerSizeText($type, $aBanner['filename']); addUploadGroup($form, $aBanner, array('uploadName' => 'upload', 'radioName' => 'replaceimage', 'imageName' => $imageName, 'fileName' => $aBanner['filename'], 'fileSize' => $size, 'newLabel' => $GLOBALS['strNewBannerFile'], 'updateLabel' => $GLOBALS['strUploadOrKeep'], 'handleSWF' => true)); $altImageName = null; $altSize = null; if ($aBanner['contenttype'] == 'swf') { $altImageName = _getContentTypeIconImageName($aBanner['alt_contenttype']); $altSize = _getBannerSizeText($type, $aBanner['alt_filename']); } $aUploadParams = array('uploadName' => 'uploadalt', 'radioName' => 'replacealtimage', 'imageName' => $altImageName, 'fileSize' => $altSize, 'fileName' => $aBanner['alt_filename'], 'newLabel' => $GLOBALS['strNewBannerFileAlt'], 'updateLabel' => $GLOBALS['strUploadOrKeep'], 'handleSWF' => false); if ($aBanner['contenttype'] != 'swf') { $aUploadParams = array_merge($aUploadParams, array('decorateId' => 'swfAlternative')); } addUploadGroup($form, $aBanner, $aUploadParams); $form->addElement('header', 'header_b_links', "Banner link"); if (count($aBanner['hardcoded_links']) == 0) { $form->addElement('text', 'url', $GLOBALS['strURL']); $targetElem = $form->createElement('text', 'target', $GLOBALS['strTarget']); $targetElem->setAttribute('maxlength', '16'); $form->addElement($targetElem); } else { foreach ($aBanner['hardcoded_links'] as $key => $val) { $link['text'] = $form->createElement('text', "alink[" . $key . "]", null); $link['text']->setAttribute("style", "width:330px"); $link['radio'] = $form->createElement('radio', "alink_chosen", null, null, $key); $form->addGroup($link, 'url_group', $GLOBALS['strURL'], "", false); if (isset($aBanner['hardcoded_targets'][$key])) { $targetElem = $form->createElement('text', "atar[" . $key . "]", $GLOBALS['strTarget']); $targetElem->setAttribute('maxlength', '16'); $form->addElement($targetElem); } if (count($aBanner['hardcoded_links']) > 1) { $form->addElement('text', "asource[" . $key . "]", $GLOBALS['strOverwriteSource']); } } $form->addElement('hidden', 'url', $aBanner['url']); } $form->addElement('header', 'header_b_display', 'Banner display'); $form->addElement('text', 'alt', $GLOBALS['strAlt']); $form->addElement('text', 'statustext', $GLOBALS['strStatusText']); $form->addElement('text', 'bannertext', $GLOBALS['strTextBelow']); if (!empty($aBanner['bannerid'])) { $sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":"); $sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['width']->setSize(5); $sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":"); $sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['height']->setSize(5); $form->addGroup($sizeG, 'size', $GLOBALS['strSize'], " ", false); //validation rules $translation = new OX_Translation(); $widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required'); $widthPositiveRule = array($translation->translate($GLOBALS['strXGreaterThanZeroField'], array($GLOBALS['strWidth'])), 'min', 1); $heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required'); $heightPositiveRule = array($translation->translate($GLOBALS['strXGreaterThanZeroField'], array($GLOBALS['strHeight'])), 'min', 1); $numericRule = array($GLOBALS['strNumericField'], 'numeric'); $form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule, $widthPositiveRule), 'height' => array($heightRequiredRule, $numericRule, $heightPositiveRule))); } if (!isset($aBanner['contenttype']) || $aBanner['contenttype'] == 'swf') { $form->addElement('checkbox', 'transparent', $GLOBALS['strSwfTransparency'], $GLOBALS['strSwfTransparency']); } //TODO $form->addRule("size", 'Please enter a number', 'numeric'); //this should make all fields in group size are numeric } //external banners if ($type == "url") { $header = $form->createElement('header', 'header_txt', $GLOBALS['strURLBanner']); $header->setAttribute('icon', 'icon-banner-url.gif'); $form->addElement($header); $form->addElement('text', 'imageurl', $GLOBALS['strNewBannerURL']); if ($aBanner['contenttype'] == 'swf') { $altImageName = _getContentTypeIconImageName($aBanner['alt_contenttype']); $altSize = _getBannerSizeText($type, $aBanner['alt_filename']); $form->addElement('text', 'alt_imageurl', $GLOBALS['strNewBannerFileAlt']); } $form->addElement('header', 'header_b_links', "Banner link"); $form->addElement('text', 'url', $GLOBALS['strURL']); $targetElem = $form->createElement('text', 'target', $GLOBALS['strTarget']); $targetElem->setAttribute('maxlength', '16'); $form->addElement($targetElem); $form->addElement('header', 'header_b_display', 'Banner display'); $form->addElement('text', 'alt', $GLOBALS['strAlt']); $form->addElement('text', 'statustext', $GLOBALS['strStatusText']); $form->addElement('text', 'bannertext', $GLOBALS['strTextBelow']); $sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":"); $sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['width']->setSize(5); $sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":"); $sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");'); $sizeG['height']->setSize(5); $form->addGroup($sizeG, 'size', $GLOBALS['strSize'], " ", false); if (!isset($aBanner['contenttype']) || $aBanner['contenttype'] == 'swf') { $form->addElement('checkbox', 'transparent', $GLOBALS['strSwfTransparency'], $GLOBALS['strSwfTransparency']); } //validation rules $translation = new OX_Translation(); $widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required'); $widthPositiveRule = array($translation->translate($GLOBALS['strXGreaterThanZeroField'], array($GLOBALS['strWidth'])), 'min', 1); $heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required'); $heightPositiveRule = array($translation->translate($GLOBALS['strXGreaterThanZeroField'], array($GLOBALS['strHeight'])), 'min', 1); $numericRule = array($GLOBALS['strNumericField'], 'numeric'); $form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule, $widthPositiveRule), 'height' => array($heightRequiredRule, $numericRule, $heightPositiveRule))); } //html & text banners if ($oComponent) { $oComponent->buildForm($form, $aBanner); } $translation = new OX_Translation(); //common for all banners if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $form->addElement('header', 'header_additional', "Additional data"); $form->addElement('text', 'keyword', $GLOBALS['strKeyword']); $weightElem = $form->createElement('text', 'weight', $GLOBALS['strWeight']); $weightElem->setSize(6); $form->addElement($weightElem); $form->addElement('textarea', 'comments', $GLOBALS['strComments']); $weightPositiveRule = $translation->translate($GLOBALS['strXPositiveWholeNumberField'], array($GLOBALS['strWeight'])); $form->addRule('weight', $weightPositiveRule, 'numeric'); } //we want submit to be the last element in its own separate section $form->addElement('controls', 'form-controls'); $form->addElement('submit', 'submit', 'Save changes'); //validation rules if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $urlRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName'])); $form->addRule('description', $urlRequiredMsg, 'required'); } //set banner values $form->setDefaults($aBanner); foreach ($aBanner['hardcoded_links'] as $key => $val) { $swfLinks["alink[" . $key . "]"] = phpAds_htmlQuotes($val); if ($val == $aBanner['url']) { $swfLinks['alink_chosen'] = $key; } if (isset($aBanner['hardcoded_targets'][$key])) { $swfLinks["atar[" . $key . "]"] = phpAds_htmlQuotes($aBanner['hardcoded_targets'][$key]); } if (count($aBanner['hardcoded_links']) > 1) { $swfLinks["asource[" . $key . "]"] = phpAds_htmlQuotes($aBanner['hardcoded_sources'][$key]); } } $form->setDefaults($swfLinks); if ($formDisabled) { $form->freeze(); } return $form; }
if ($i > 0) { echo "<tr><td height='20' colspan='4'> </td></tr>"; echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; echo "<tr><td height='10' colspan='4'> </td></tr>"; } echo "<tr><td width='30'> </td><td width='30'><input type='checkbox' id='convert_links" . $key . "' name='convert_links[]' value='" . $key . "' checked></td>"; echo "<td width='200'><label for='convert_links" . $key . "'>" . $strURL . "</label></td>"; echo "<td><input class='flat' size='35' type='text' name='overwrite_link[" . $key . "]' style='width:300px;' dir='ltr' "; echo " value='" . phpAds_htmlQuotes($url) . "'>"; echo "<input type='radio' name='chosen_link' value='" . $key . "'" . ($i == 0 ? ' checked' : '') . "></td></tr>"; echo "<tr><td colspan='2'><img src='" . OX::assetPath() . "/images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; echo "<tr><td width='30'> </td><td width='30'> </td>"; echo "<td width='200'>" . $strTarget . "</td>"; echo "<td><input class='flat' size='16' type='text' name='overwrite_target[" . $key . "]' style='width:150px;' dir='ltr' "; echo " value='" . phpAds_htmlQuotes($target) . "'>"; echo "</td></tr>"; if (count($result) > 1) { echo "<tr><td colspan='2'><img src='" . OX::assetPath() . "/images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; echo "<tr><td width='30'> </td><td width='30'> </td>"; echo "<td width='200'>" . $strOverwriteSource . "</td>"; echo "<td><input class='flat' size='50' type='text' name='overwrite_source[" . $key . "]' style='width:150px;' dir='ltr' value=''>"; echo "</td></tr>"; } $i++; } echo "<tr><td height='20' colspan='4'> </td></tr>"; echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; echo "</table>"; echo "<br /><br />";
echo "<tr><td height='10' colspan='3'> </td></tr>"; // Error message? if (isset($errormessage) && count($errormessage)) { echo "<tr><td> </td><td height='10' colspan='2'>"; echo "<table cellpadding='0' cellspacing='0' border='0'><tr><td>"; echo "<img src='images/error.gif' align='absmiddle'> "; while (list($k, $v) = each($errormessage)) { echo "<font color='#AA0000'><b>" . $v . "</b></font><br>"; } echo "</td></tr></table></td></tr><tr><td height='10' colspan='3'> </td></tr>"; echo "<tr><td><img src='images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; } echo "<tr><td width='30'> </td><td width='200'>" . $strUsername . "</td>"; if (phpAds_isUser(phpAds_Admin)) { echo "<td><input onBlur='phpAds_formUpdate(this);' class='flat' type='text' name='clientusername' size='25' value='" . phpAds_htmlQuotes($client['clientusername']) . "' tabindex='" . $tabindex++ . "'></td>"; } else { echo "<td>" . (isset($client['clientusername']) ? $client['clientusername'] : '') . "</td>"; } echo "</tr><tr><td><img src='images/spacer.gif' height='1' width='100%'></td>"; echo "<td colspan='2'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td></tr>"; // Password if (phpAds_isUser(phpAds_Admin)) { echo "<tr><td width='30'> </td><td width='200'>" . $strPassword . "</td>"; echo "<td width='370'><input class='flat' type='password' name='clientpassword' size='25' value='" . $client['clientpassword'] . "' tabindex='" . $tabindex++ . "'></td>"; echo "</tr><tr><td height='10' colspan='3'> </td></tr>"; } else { echo "<tr><td width='30'> </td><td width='200'>" . $strOldPassword . "</td><td width='100%'>"; echo "<input onBlur='phpAds_formUpdate(this);' class='flat' type='password' name='pwold' size='25' value='' tabindex='" . $tabindex++ . "'>"; echo "</td></tr><tr><td><img src='images/spacer.gif' height='1' width='30'></td>"; echo "<td colspan='1'><img src='images/break-l.gif' height='1' width='200' vspace='6'></td><td><img src='images/spacer.gif' height='1' width='100%'></tr>";