public function validateLogin() { $result = false; if ($login = $this->getRequestParameter('login')) { $password = $this->getRequestParameter('password'); $c = new Criteria(); $c->add(UserPeer::LOGIN, $login); $user = UserPeer::doSelectOne($c); if ($user) { if ($user->getPublicationStatus() != "ACTIVE") { UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.Not-active", $culture), UtilsHelper::MSG_INFO); } elseif (sha1($user->getSalt() . $password) == $user->getSha1Password()) { $this->getUser()->setAttribute('pass', $password); $this->getUser()->signIn($user); // redirect to dashboard $this->showDashboard(); $result = true; } else { UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.Wrong-login", $culture), UtilsHelper::MSG_ERROR); } } else { UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.Wrong-login", $culture), UtilsHelper::MSG_ERROR); } } else { if ($this->getUser()->isAuthenticated()) { // redirect to dashboard $this->showDashboard(); } } }
public function executeValidateEmail() { $myValidator = new sfEmailValidator(); $myValidator->initialize($this->getContext(), array()); $value = urldecode($this->getRequestParameter('value')); if (!$myValidator->execute($value, $error)) { exit(UtilsHelper::Localize('system.frontend.Validate_email_error')); } exit("ok"); }
public function validateContact() { $result = true; if ($this->getRequestParameter('submitted') == "submitted") { $request = $this->getRequest(); $params = $request->getParameterHolder()->getAll(); foreach ($params as $key => $param) { if (!is_array($param)) { ${$key} = trim($param); } else { ${$key} = $param; } } $fields = array("cf_name" => "", "cf_email" => "Email", "cf_msg" => "", "cf_captcha" => "Captcha"); foreach ($fields as $field => $validator) { $validatorClass = ""; $value = ${$field}; if (!$value) { $request->setError('err' . $field, UtilsHelper::Localize("website.frontend.No-" . $field)); $result = false; } elseif ($validator && $validator != "Captcha") { $validatorClass = "sf" . $validator . "Validator"; $myValidator = new $validatorClass(); $myValidator->initialize($this->getContext(), array()); if ($validator == "Email" || $validator == "Url") { $value = urldecode($value); } if (!$myValidator->execute($value, $error)) { $request->setError('err' . $field, UtilsHelper::Localize("website.frontend.Wrong-" . $field)); $result = false; } } elseif ($validator == "Captcha") { $request = $this->getRequest(); if ($this->getUser()->getAttribute('captcha_code') != $value) { $request->setError('errcaptcha', UtilsHelper::Localize("website.frontend.Wrong-Captcha")); $result = false; } } } } return $result; }
<?php $classes = $brand->getNiceClasses() ? explode(',', $brand->getNiceClasses()) : array(); foreach ($classes as $cl) { $cl = intval($cl); if ($cl < 10) { $cl = "0" . $cl; } ?> <div class="qfSessClasTable"> <div class="qfSessClasCell qfSessClasNum"><span><?php echo $cl; ?> </span></div> <div class="qfSessClasCell qfSessClasTxt"><?php echo UtilsHelper::Localize("nice.class_{$cl}"); ?> </div> </div> <?php } ?> </div> </div> </div> <div class="qfSess1ColWrap"> <div class="qfSessFullColWrap qfSessCell <?php if (array_intersect(array('ViennaClasses'), $searchOf)) { ?> qfRedBorderCell<?php }
public function validateProcessSale() { $result = true; if ($this->getRequestParameter('submitted') == "submitted") { $request = $this->getRequest(); $params = $request->getParameterHolder()->getAll(); foreach ($params as $key => $param) { if (!is_array($param)) { ${$key} = trim($param); } else { ${$key} = $param; } } $fields = array("x_first_name" => "", "x_last_name" => "", "x_address" => "", "x_email" => "Email", "x_phone" => "", "x_zip" => "", "x_city" => "", "x_state" => "", "x_card_type" => "", "x_card_num" => "", "exp_month" => "", "exp_year" => "", "x_card_code" => ""); foreach ($fields as $field => $validator) { $validatorClass = ""; $value = ${$field}; if (!$value) { //echo $field; $request->setError('err' . $field, ""); //$request->setError('err'.$field, UtilsHelper::Localize("website.frontend.No-".$field)); $result = false; } elseif ($validator && $validator != "Captcha") { $validatorClass = "sf" . $validator . "Validator"; $myValidator = new $validatorClass(); $myValidator->initialize($this->getContext(), array()); if ($validator == "Email" || $validator == "Url") { $value = urldecode($value); } if (!$myValidator->execute($value, $error)) { $request->setError('err' . $field, UtilsHelper::Localize("website.frontend.Wrong-" . $field)); $result = false; } } elseif ($validator == "Captcha") { $request = $this->getRequest(); if ($this->getUser()->getAttribute('captcha_code') != $value) { $request->setError('errcaptcha', UtilsHelper::Localize("website.frontend.Wrong-Captcha")); $result = false; } } } } return $result; }
} ?> </p> <?php php; ?> </div> </div> </div> <div class="qfRepImpSsCol qfRepImpSsRight"> <?php foreach ($searchOf as $f) { ?> <p><?php echo UtilsHelper::Localize(strtolower($f)); ?> </p> <?php } ?> </div> </div> <?php } ?> <!--<a href="import-session-highlight.php"> <div class="qfRepImpSsItem"> <div class="qfRepImpSsCol qfRepImpSsLeft"> <div class="qfRepImpSsColInn">
public function validateLogin() { $result = false; $culture = $this->getUser()->getCulture(); if ($login = $this->getRequestParameter('login')) { $password = $this->getRequestParameter('password'); $c = new Criteria(); $c->add(UserPeer::LOGIN, $login); $user = UserPeer::doSelectOne($c); if ($user) { if ($user->getPublicationStatus() != "ACTIVE") { UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.frontend.Not-active", $culture), UtilsHelper::MSG_INFO); } elseif (sha1($user->getSalt() . $password) == $user->getSha1Password()) { $this->getUser()->setAttribute('pass', $password); $this->getUser()->signIn($user); $tag = "website_page_home"; $completeUrl = false; $page = Document::getDocumentByExclusiveTag($tag); if ($page) { $this->redirect($page->getHref(true)); } $result = true; } else { UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.frontend.Wrong-login", $culture), UtilsHelper::MSG_ERROR); } } else { UtilsHelper::setFlashMsg(UtilsHelper::Localize("user.frontend.Wrong-login", $culture), UtilsHelper::MSG_ERROR); } } elseif ($this->getRequestParameter('logout')) { $this->getUser()->signOut(); } elseif ($activation_code = $this->getRequestParameter('hash')) { $c = new Criteria(); $c->add(UserPeer::ACTIVATION_CODE, $activation_code); $c->add(UserPeer::ACTIVATION_CODE, "{$activation_code}", Criteria::LIKE); $user = UserPeer::doSelectOne($c); if ($user) { $user->setPublicationStatus(UtilsHelper::STATUS_ACTIVE); $user->setActivationCode(''); $user->save(); try { UtilsHelper::setFlashMsg("Your account has been activated successfully. Thank you for your registration.", UtilsHelper::MSG_SUCCESS); $this->noform = true; } catch (Exception $e) { UtilsHelper::setFlashMsg("There was a problem while activating your account."); } } else { UtilsHelper::setFlashMsg("Your account is already activated. "); } } }
public static function makeBlock($itemsArr, $label, $paramStr) { $str = '<td width="20%" valign="top" height="100%"> <table cellspacing="0" cellpadding="0" border="0" class="top_ten_location"> <tr> <td valign="top"> <h2 class="top_ten_title">' . UtilsHelper::Localize('properties.frontend.' . $label) . '</h2> <ul class="top_ten_list"> '; foreach ($itemsArr as $item) { $str .= ' <li><a title="' . $item['label'] . ' (' . $item['count'] . ') " href="' . $listUrl . '?' . $paramStr . '=' . $item['id'] . '">' . $item['label'] . ' (' . $item['count'] . ')</a></li> '; } $str .= ' </ul> </td> </tr> </table> </td>'; return $str; }
<!--<h1 id="lead" class="lead serif-italic"><?php echo UtilsHelper::Localize("website.frontend.News-title"); ?> </h1>--> <?php $count = $pager->getNbResults(); foreach ($pager->getResults() as $n) { $url = UtilsHelper::cleanURL($n); ?> <div class="news" style="float: left; width: 190px;"> <h3><?php echo $n->getLabel(); ?> </h3> <?php echo UtilsHelper::Date($n->getStartDate(), "m.d.Y"); ?> <br /> <?php echo $n->getShortDescription(); ?> <?php if ($n->getImage() != NULL) { ?> <br /> <img src="/media/upload/thumbs/<?php echo $n->getImage(); ?> " /> <?php }
<?php $culture = $sf_user->getCulture(); $loginLabel = UtilsHelper::Localize("user.frontend.Login-label", $culture); $loginPass = UtilsHelper::Localize("user.frontend.Login-pass", $culture); $loginEnter = UtilsHelper::Localize("user.frontend.Enter", $culture); ?> <form method="post" name="" action=""> <span class="twikiActionFormStepSign">►</span> <b><?php echo $loginLabel; ?> </b> <p> <?php echo frontend_input("login", null, array("class" => "twikiInputField twikiFocus", "size" => "40")); ?> </p><p> </p> <span class="twikiActionFormStepSign">►</span> <b><?php echo $loginPass; ?> </b> <p> <input type="password" value="" name="password" size="40" class="twikiInputField"> </p><p> </p> <input type="submit" value="<?php echo $loginEnter;
</div> <div style="float:right;"> <?php if ($pages != $pager->getPage()) { ?> <a href="#" onclick="parseMainList( null, <?php echo $parent; ?> , <?php echo $pager->getNextPage(); ?> , '<?php echo $filter; ?> ');" class="next"> <?php echo UtilsHelper::Localize('media.frontend.gallery-next', $lang); ?> </a> » <?php } ?> </div> <?php } ?> </td> </tr> </table> <?php }
</div> <h1><?php if ($culture == "bg") { echo UtilsHelper::DateBG($date, "d F Y"); } else { echo UtilsHelper::Date($date, "d F Y"); } ?> </h1> <br> <?php if (count($events) > 0) { ?> <h2><?php echo UtilsHelper::Localize("website.frontend.EventsTitle"); ?> </h2> <ul class="event"> <?php foreach ($events as $event) { ?> <li> <div class="eventPlus" onclick="toggleEvent('<?php echo $event->getId(); ?> ', this)"> <b><?php echo UtilsHelper::DateBG($event->getStartDate(), "d F Y"); ?> </b>
public function executeAddNewTrademark() { $this->setLayout(false); $this->trademarkTypes = UtilsHelper::loadTrademarkTypes(); if ($trademark = Document::getDocumentInstance($this->getRequestParameter('trademark_id'))) { if (get_class($trademark) != 'Trademark') { $trademark = null; } } if (!$trademark) { $trademark = new Trademark(); } $ownersArr = array(); $root = Rootfolder::getRootfolderByModule('clients'); $owners = Document::getChildrenOf($root->getId(), 'Client'); foreach ($owners as $ow) { $ownersArr[$ow->getId()] = $ow->getLabel(); } $this->ownersArr = $ownersArr; $success = false; if ($this->getRequestParameter('submit') > '') { // check input data $request = $this->getRequest(); $params = $request->getParameterHolder()->getAll(); //var_dump($params); $errors = false; $fields = array("label" => 'Наименование', "application_number" => 'Заявка номер', "kind" => 'Тип', "application_date" => 'Дата на заявяване', "expires_on" => 'Срок', "contestation" => 'Краен срок за опозиция', "nice_classes" => 'Класове по Ницска класификация', "rights_owner" => 'Притежател', "office_of_origin" => 'Държава на регистрация', "designated_contracting_party" => 'Държави в които е в сила'); foreach ($fields as $fl => $label) { $val = trim($params[$fl]); if ($val == '') { if ($fl == 'rights_owner') { if ($params['owner'] == '') { $errors = true; $request->setError('err' . $fl, '- ' . $label); } } else { $errors = true; $request->setError('err' . $fl, '- ' . $label); } } } $image = null; if ($errors) { UtilsHelper::setFlashMsg('Моля, въведете необходимите данни:<br>', UtilsHelper::MSG_ERROR); } else { if ($request->getFileName('image')) { try { $image = Media::upload('image', 'upload', array('image/gif', 'image/jpeg', 'image/jpg', 'image/png')); //var_dump($image); list($w, $h) = getimagesize($image->getServerAbsoluteUrl()); if ($w > $h) { $image->resizeImage("thumbs", null, 105); } else { $image->resizeImage("thumbs", 95); } } catch (Exception $e) { $errors = true; $request->setError('errImage', '- ' . UtilsHelper::Localize('media.' . $e->getMessage())); } } if ($errors) { // remove uploaded image if ($image) { $image->delete(); } UtilsHelper::setFlashMsg('Моля, коригирайте:<br>', UtilsHelper::MSG_ERROR); } } // if everithing is OK if (!$errors) { //$trademark = new Brand(); $trademark->setLabel($params['label']); $trademark->setFromSystem(1); if ($params['owner'] > '') { //$trademark->setClientId($params['owner']); $client = Document::getDocumentInstance($params['owner']); $trademark->setRightsOwner($client->getLabel()); } else { $val = trim($params['rights_owner']); $client = new Client(); $client->setLabel($val); $client->save(); //$trademark->setClientId($client->getId()); $this->client = $client; $trademark->setRightsOwner($val); } $trademark->setApplicationNumber($params['application_number']); $trademark->setRegisterNumber($params['register_number']); if ($params['registration_date']) { $trademark->setRegistrationDate($params['registration_date']); } $trademark->setKind($params['kind']); $trademark->setApplicationDate($params['application_date']); $trademark->setStatus($params['status']); $trademark->setExpiresOn($params['expires_on']); $trademark->setContestation($params['contestation']); $trademark->setPublications($params['publications']); $trademark->setViennaClasses(str_replace(' ', '', $params['vienna_classes'])); $trademark->setColors($params['colors']); $trademark->setNiceClasses(str_replace(' ', '', $params['nice_classes'])); $trademark->setRightsOwnerAddress($params['rights_owner_address']); $trademark->setRightsRepresentative($params['rights_representative']); $trademark->setRightsRepresentativeAddress($params['rights_representative_address']); $trademark->setOfficeOfOrigin($params['office_of_origin']); $trademark->setDesignatedContractingParty($params['designated_contracting_party']); if ($image) { $trademark->setImage($image->getId()); } $trademark->save(); $success = true; } } $this->trademark = $trademark; $this->success = $success; }
<h1 class="content-heading"><span><?php echo UtilsHelper::Localize("website.frontend.Contact_title"); ?> </span></h1> <div class="content"> <h3>Quote Form</h3> <form id="quote_form" method="POST"> <div class="form-holder"> <?php if (!$success) { ?> <!--<div id="flashMsg"></div>--> <div class="field"> <label>Full Name <span class="obligated">*</span></label> <?php echo frontend_input("full_name", null, array('class' => 'large')); ?> </div> <div class="field"> <label>E-mail <span class="obligated">*</span></label> <?php echo frontend_input("email", null, array('class' => 'large')); ?> </div> <div class="field"> <label>Address <span class="obligated">*</span></label>
if ($sf_params->get('terms')) { echo "checked"; } ?> > </div> </div> <p><?php echo UtilsHelper::Localize("website.frontend.order_text"); ?> </p> <p class="no-border"><a class="button-cont" title="#" href="#" onclick="$('#payment_form').submit();"><span>Submit Order</span></a></p> </form> <div class="clear"></div> </div> <?php } else { ?> <h1 class="content-heading"><span><?php echo UtilsHelper::Localize("website.frontend.Process_sale_success"); ?> </span></h1> <div class="content"> <h3> <?php echo UtilsHelper::Localize("website.frontend.Process_sale_success_text"); ?> </h3> </div> <?php }
<h3 class="serif lead"><?php echo UtilsHelper::Localize("website.frontend.Reservations_menu_title"); ?> </h3> <div class="reserve-api"> <script type="text/javascript" src="http://www.opentable.com/frontdoor/default.aspx?rid=50647&restref=50647&bgcolor=1d1d1d&titlecolor=FFFFFF&subtitlecolor=FFFFFF&btnbgimage=http://www.opentable.com/frontdoor/img/ot_btn_red.png&otlink=FFFFFF&icon=light&mode=short&hover=1"></script> <div class="clear"></div> </div>
public function executeSaveMedia() { try { $media = Media::upload('attrFilename'); if ($media && $media->IsImage()) { list($originalWidth, $originalHeight) = getimagesize($media->getServerAbsoluteUrl()); if ($originalWidth > $originalHeight && $originalWidth > 1500) { $media->resizeImage(null, null, 1500); } else { if ($originalHeight > 1500) { $media->resizeImage(null, 1500); } } $media->resizeImage("thumbs", 100); } else { if ($media && in_array($media->getFiletype(), array("video/x-msvideo", "video/mpeg", "video/mp4", "video/quicktime", "video/x-ms-wmv", "video/avi", "video/wmv"))) { $media->convertToFlv(); } else { if ($media && in_array($media->getFiletype(), array("video/x-flv", "flv-application/octet-stream"))) { $media->saveFlv(); } else { if ($media && in_array($media->getFiletype(), array("application/octet-stream")) && substr($media->getFilename(), -4) == ".flv") { $media->saveFlv(); } else { if ($media && in_array($media->getFiletype(), array("application/binary")) && substr($media->getFilename(), -4) == ".mpg" || $media && in_array($media->getFiletype(), array("application/binary")) && substr($media->getFilename(), -5) == ".mpeg") { $media->convertToFlv(); } } } } } UtilsHelper::setBackendMsg("Saved"); } catch (Exception $e) { UtilsHelper::setBackendMsg("Error while saving: " . UtilsHelper::Localize("media.backend." . $e->getMessage(), "en"), "error"); } $this->forward(strtolower($this->getRequestParameter('moduleName')), "edit" . $this->getRequestParameter('documentName')); }
<div class="right-box" id="cart"> <h3 class="right-heading"><span class="cart"><?php echo UtilsHelper::Localize("website.frontend.Cart_order_title"); ?> </span></h3> <div class="box-cont"> <!-- <span id="haveItems" <?php //if ($count == 0): ?> style="display:none"<?php //endif; ?> > <p>You have <strong><span id="count"><?php //echo $count; ?> </span> products</strong> in the cart</p> <ul class="cart-list" id="items" style="display:block"> <?php //foreach ($products as $product): //$id = $product->getId(); ?> <li id='cart_<?php //echo $id ?> '> <span class="cart-name"> <?php //echo $product->getLabel()
<div class="row"> <div class="grid_1 right"><strong id="sub_total">$<?php echo $sub_total; ?> </strong></div><div class="grid_2 right">Merchandise Total:</div> <div class="clear"></div> <div class="grid_1 right"><strong id="taxes_total">$<?php echo $total_taxes; ?> </strong></div><div class="grid_2 right">Estimated Taxes:</div> <div class="clear"></div> <div class="grid_1 right"><strong id="total">$<?php echo $total; ?> </strong></div><div class="grid_2 right">Total:</div> <div class="clear"></div> </div> <br /> <p class="extra"></p> </div> <p><?php echo UtilsHelper::Localize("website.frontend.checkout_text"); ?> </p> <p class="no-border"><a class="button-cont" title="#" href="<?php echo $processPageUrl; ?> "><span>Check out</span></a></p> <div class="clear"></div> </div>
<?php $lang = $sf_user->getCulture(); if ($err) { ?> <br> <br> <h3 style="color:red;margin:10px"><?php echo UtilsHelper::Localize("media.backend." . $err, $lang); ?> <h3> <?php } echo $sf_params->get("backendMsg"); ?> <div id='content_tabs'> <div id="cropdiv"></div> <?php echo form_tag('media/saveMedia', array('id' => 'form', 'enctype' => 'multipart/form-data', 'onsubmit' => 'return validateEditForm();')); if ($moduleName && $documentName) { ?> <?php echo backend_hidden('moduleName', $moduleName); ?> <?php echo backend_hidden('documentName', $documentName); } ?> <table> <?php
</div> <div style="float:right;"> <?php if ($pager->getLastPage() != $pager->getPage()) { ?> <a href="?page=<?php echo $pager->getNextPage(); ?> " class="next"><?php echo UtilsHelper::Localize('media.frontend.gallery-next', $lang); ?> </a> » <?php } ?> </div> </div> </div> <?php } else { ?> <?php echo UtilsHelper::Localize('media.frontend.Gallery-no-tag-warn', $lang); ?> "<?php echo $tag; ?> " ! <?php }
</p> </li> <?php } ?> </ul> </div> <div class="tree-col-c"> <h4>Useful Information</h4> <?php echo MenuHelper::get_menu_by_tag("website_menu_subfooter", array('depth' => 1, 'mainMasterClass' => 'subf-menu')); ?> </div> <div class="tree-col-r"> <h4><?php echo UtilsHelper::Localize("website.frontend.Contact-us-subfooter"); ?> </h4> <p>Mobile: phone</p> <p>E-mail: <a href="#">email</a></p> <p><a href="contact-us.html">Write us a message</a></p> <p><a href="#" style="margin-right:5px;"><img src="/images//facebook.png"/></a></p> </div> <div class="clear"></div> <script type="text/javascript"> $(document).ready(function () { $('.subf-menu').easyListSplitter({ colNumber: 3 }); }); </script>
<div class="right-box no-border"> <h3 class="right-heading"><span class="cats"><?php echo UtilsHelper::Localize("website.frontend.Products_menu_title"); ?> </span></h3> <ul class="cat-nav"> <?php foreach ($categories as $cat) { $id = $cat->getId(); ?> <li> <a href="<?php echo UtilsHelper::cleanRssURL($cat); ?> " title="" <?php if ($id == $currentId) { ?> class="active"<?php } ?> > <?php echo $cat->getLabel(); ?> <span>(<?php echo $prodNum[$id]; ?> )</span> </a> </li> <?php
public static function getSiteMap($root = null, &$sitemap, $depth = 1000, $level = 1, $path = null, $getIndex = false, $getInvisible = false) { if ($level > $depth) { return array(); } $nolabel = UtilsHelper::Localize("website.frontend.nolabel"); if (!$root) { $root = Rootfolder::getRootfolderByModule("website"); if (!$root) { return; } } if (is_object($root)) { $root = $root->getId(); } $pathSet = false; if (Document::hasChildren($root)) { // $oldRelationsFlag = sfConfig::get('sf_cache_relations'); // sfConfig::set('sf_cache_relations', false); try { $children = Document::getChildrenOf($root, null, true, false); foreach ($children as $child) { // skip Urlrewrite objects if (get_class($child) == "Urlrewrite" || get_class($child) == "Media") { continue; } $href = ""; $label = $nolabel; $childId = $child->getId(); $class = get_class($child); $showItem = true; if (Document::getStatus($child) != UtilsHelper::STATUS_ACTIVE) { continue; } if (!$getIndex && Document::hasTag($child, "website_page_index")) { continue; } if (!$getInvisible) { if ($class == 'Page' && Document::hasTag($child, "website_page_nonvisible") || $class == 'Topic' && Document::hasTag($child, "website_topic_nonvisible")) { $id = $childId; $showItem = false; //continue; } } if ($showItem) { if ($class == "Page") { $type = $child->getPageType(); $secure = $child->getIsSecure(); //$label = $child->getLabel(); $label = $child->getNavigationTitle(); $href = $child->getHref(); $id = $childId; } elseif ($class == "Topic") { $label .= $child->getLabel(); // " (".$child->getLabel().")"; $indexPage = $child->getIndexPage(); $id = 0; if ($indexPage) { //$id = $indexPage->getId(); $id = $childId; $href = $indexPage->getHref(); $label = $indexPage->getLabel(); $type = $indexPage->getPageType(); // if ($type == "REFERENCE") // { // //echo "--- Topic: ".$id." ---\n"; // $pg = Document::getDocumentByCulture($indexPage->getPageId(), null, true); // get PageI18n object // if($pg) // { // $id = $pg->getId(); // $href = $pg->getHref(); // $secure = $pg->getIsSecure(); // } // } } } else { $id = $childId; $label = $child->getLabel(); } } if ($id && !$pathSet) { $path[] = $id; $pathSet = true; } else { $c = count($path); $path[$c - 1] = $id; } $sitemap[$root][$childId]['path'] = $path; $sitemap[$root][$childId]['id'] = $id; $sitemap[$root][$childId]['href'] = $href; $sitemap[$root][$childId]['label'] = $label; if (array_key_exists('secure', $sitemap[$root][$childId])) { $sitemap[$root][$childId]['secure'] = $secure; } $sitemap[$root][$childId]['level'] = $level; $sitemap[$root][$childId]['model'] = $class; $sitemap[$root][$childId]['show'] = $showItem; self::getSiteMap($child->getId(), $sitemap, $depth, $level + 1, $path, $getIndex, $getInvisible); } } catch (Exception $e) { return null; } // sfConfig::set('sf_cache_relations', $oldRelationsFlag); } return $sitemap; }
public function executeUploadBanners() { $this->setLayout("backend"); $c = new Criteria(); $c->add(PrefPeer::LABEL, "newsletter"); $info = PrefPeer::doSelectOne($c); if (!$info) { $info = new Pref(); $info->setLabel("newsletter"); $info->save(); } if ($this->getRequestParameter('submitted')) { $request = $this->getRequest(); try { $request->setParameter('parent', $info->getId()); if ($request->getFileName('banner1')) { $request->setParameter('id', $this->getRequestParameter('banner1Id')); $request->setParameter('attrLabel', 'newsletter468x60'); $media = Media::upload('banner1', "upload/newsletter", array("image/gif", "image/png", "image/jpeg", "image/pjpeg", "image/x-png")); if ($media && $media->IsImage()) { $media->resizeImage(null, 60, 468); $media->resizeImage("thumbs", 30, 231); } } if (!$media) { $media = Document::getDocumentInstance($this->getRequestParameter('banner1Id')); } if ($media) { $media->setDescription($this->getRequestParameter('banner1Url')); $media->save(); } if ($request->getFileName('banner2')) { $request->setParameter('id', $this->getRequestParameter('banner2Id')); $request->setParameter('attrLabel', 'newsletter160x600'); $media2 = Media::upload('banner2', "upload/newsletter", array("image/gif", "image/png", "image/jpeg", "image/pjpeg", "image/x-png")); if ($media2 && $media2->IsImage()) { $media2->resizeImage(null, 600, 160); $media2->resizeImage("thumbs", 125, 40); } } if (!$media2) { $media2 = Document::getDocumentInstance($this->getRequestParameter('banner2Id')); } if ($media2) { $media2->setDescription($this->getRequestParameter('banner2Url')); $media2->save(); } $infoVal = $this->getRequestParameter('info'); if (!$infoVal) { $infoVal = null; } $info->setContent($infoVal); $info->save(); } catch (Exception $e) { $this->message = UtilsHelper::Localize("media.backend." . $e->getMessage()); } } $c = new Criteria(); $c->add(PrefPeer::LABEL, "newsletter"); $this->info = PrefPeer::doSelectOne($c); $c = new Criteria(); $c->add(MediaPeer::LABEL, "newsletter468x60"); $this->banner1 = MediaPeer::doSelectOne($c); $c = new Criteria(); $c->add(MediaPeer::LABEL, "newsletter160x600"); $this->banner2 = MediaPeer::doSelectOne($c); }
public function executeEditGalleryMedia() { try { $request = $this->getRequest(); // $params = array(); if ($id = $this->getRequestParameter("id")) { $media = Document::getDocumentInstance($id); $parentId = Document::getParentOf($id, null, false); $request->setParameter("parent", $parentId); $request->setParameter("attrLabel", $parentId . " gallery pic"); if ($this->getRequestParameter("submitted")) { if ($pathParam = trim($this->getRequestParameter("gp"))) { $pathAdd = DIRECTORY_SEPARATOR . str_replace("_", DIRECTORY_SEPARATOR, $pathParam); } // check for TAGged folder if ($parent = Document::getDocumentByExclusiveTag('media_folder_' . $pathParam, false)) { $this->getRequest()->setParameter("parent", $parent->getId()); } $allowedParam = trim($this->getRequestParameter("allowed")); if ($allowedParam == "images") { //if ($allowedParam == "images" || empty($allowedParam)) $allowedArr = array("image/gif", "image/jpeg", "image/pjpeg"); } elseif (!empty($allowedParam)) { $allowedArr = explode(",", $this->getRequestParameter("allowed")); } $media = Media::upload('galPic', "upload" . $pathAdd, $allowedArr, false); // $media = Media::upload('galPic', "upload", $allowedArr, false); if ($media && $media->IsImage()) { $fileName = $media->getServerAbsoluteUrl(); //$media->getFiledirpath().$media->getFilename(); list($w, $h) = getimagesize($fileName); $params['gw'] = $this->getRequestParameter("gw"); $params['gh'] = $this->getRequestParameter("gh"); $params['gtw'] = $this->getRequestParameter("gtw"); $params['gth'] = $this->getRequestParameter("gth"); $params['gcw'] = $this->getRequestParameter("gcw"); $params['gch'] = $this->getRequestParameter("gch"); $cropData = array(0, 0); if ($params['gcw'] || $params['gch']) { if ($params['gcw'] && $params['gch']) { $cropData = array($params['gcw'], $params['gch']); } else { if ($params['gcw']) { $cropData = array($params['gcw'], 0); } else { $cropData = array(0, $params['gch']); } } } if ($params['gw'] || $params['gh']) { if ($params['gw'] > 0 && $w > $params['gw'] || $params['gh'] > 0 && $h > $params['gh']) { $media->resizeImage(null, $params['gh'], $params['gw'], null, $cropData); } else { $media->resizeImage(null, null, 800, null, $cropData); } } else { $media->resizeImage(null, null, 800, null, array(800, 600)); } // thumbs if ($params['gtw'] || $params['gth']) { $media->resizeImage("thumbs", $params['gth'], $params['gtw']); } else { if ($h > $w) { $media->resizeImage("thumbs", 80, null, null, array(120, 80)); } else { $media->resizeImage("thumbs", null, 120, null, array(120, 80)); } } /* if ($h > $w) { $media->resizeImage(null, 600); $media->resizeImage(1, 80, null, null, array(120, 80)); } else { $media->resizeImage(null, null, 800); $media->resizeImage(1, null, 120, null, array(120, 80)); }*/ } } $this->description = $media->getDescription(); $this->newId = $media->getId(); } } catch (Exception $e) { // $this->message = $e->getMessage(); $this->message = UtilsHelper::Localize("media." . $e->getMessage()); } }