示例#1
0
 /**
  * Changes the content language
  *
  */
 function changeContentLanguage()
 {
     if ($this->request('i')) {
         $lngid = (int) $this->request('i');
         if (rad_lang::changeContentLanguage($lngid)) {
             $lng = rad_lang::getLangByID($lngid);
             echo 'RADCHLangs.changeContentResult(1,' . $lng->lng_id . ',"' . $lng->lng_code . '");';
         } else {
             echo 'RADCHLangs.changeContentResult(0);';
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
示例#2
0
 /**
  * Get URL using URL alias
  * @static
  * @param string $alias
  * @return false|string
  */
 public static function getUrlByAlias($alias)
 {
     $result = rad_dbpdo::query('SELECT item_type, item_id, lang_id FROM ' . RAD . 'url_aliases WHERE alias=:alias', array('alias' => $alias));
     if (empty($result['item_type'])) {
         return false;
     }
     $lng = rad_lang::getLangByID($result['lang_id']);
     rad_lang::changeLanguage($lng->lng_code);
     switch ($result['item_type']) {
         //List all supported item types here (if they don't need some special processing)
         case 'product':
             return rad_input::makeURL('alias=' . $result['item_type'] . '&p=' . $result['item_id'], false);
         default:
             return false;
             //For not supported item types
     }
 }