Ejemplo n.º 1
0
 /**
  * Маршрутизатор URL.
  *
  * @param array $uri Элементы полного пути URL.
  */
 function Router($uri)
 {
     foreach ($uri as $param) {
         if (preg_match("/^(.+)\\.html\$/", $param, $match)) {
             if ($this->album = A::$DB->getRow("SELECT * FROM " . SECTION . "_albums WHERE idcat={$this->idcat} AND urlname='{$match[1]}' AND active='Y'")) {
                 $this->idalb = $this->album['id'];
             } else {
                 A::NotFound();
             }
             break;
         } else {
             if ($this->category = A::$DB->getRow("\r\r\n\t  SELECT * FROM " . SECTION . "_categories WHERE idker={$this->idcat} AND urlname='{$param}' AND active='Y'")) {
                 $this->idcat = $this->category['id'];
             } else {
                 A::NotFound();
             }
         }
     }
     if ($this->idalb > 0) {
         $this->page = "album";
     } elseif ($this->idcat > 0) {
         $this->page = "category";
     } else {
         $this->page = "main";
     }
 }
Ejemplo n.º 2
0
 /**
  * Маршрутизатор URL.
  *
  * @param array $uri Элементы полного пути URL.
  */
 function Router($uri)
 {
     if (count($uri) == 0) {
         $this->page = "result";
     } else {
         A::NotFound();
     }
 }
Ejemplo n.º 3
0
 /**
  * Маршрутизатор URL.
  *
  * @param array $uri Элементы полного пути URL.
  */
 function Router($uri)
 {
     if (count($uri) == 1) {
         if (reset($uri) == "message.html") {
             $this->page = "message";
         } else {
             A::NotFound();
         }
     } elseif (count($uri) == 0) {
         $this->page = "main";
     } else {
         A::NotFound();
     }
 }
Ejemplo n.º 4
0
 /**
  * Маршрутизатор URL.
  */
 function Router($uri)
 {
     if (count($uri) == 1) {
         if (preg_match("/^([0-9]{2})-([0-9]{2})-([0-9]{4})\\.html\$/", reset($uri), $match)) {
             $this->day = $match[1];
             $this->month = $match[2];
             $this->year = $match[3];
             $this->page = "archive";
         } else {
             A::NotFound();
         }
     } elseif (count($uri) == 0) {
         $this->page = "archive";
     } else {
         A::NotFound();
     }
 }
Ejemplo n.º 5
0
 /**
  * Маршрутизатор URL.
  *
  * @param array $uri Элементы полного пути URL.
  */
 function Router($uri)
 {
     foreach ($uri as $param) {
         if (preg_match("/^(.+)\\.html\$/", $param, $match)) {
             if ($this->pagedata = A::$DB->getRow("SELECT * FROM " . SECTION . " WHERE idker={$this->id} AND type='page' AND urlname='{$match[1]}' AND active='Y'")) {
                 $this->id = $id = $this->pagedata['id'];
                 $this->idker = $this->pagedata['idker'];
             } else {
                 A::NotFound();
             }
         } else {
             if ($this->pagedata = A::$DB->getRow("SELECT * FROM " . SECTION . " WHERE idker={$this->id} AND type='dir' AND urlname='{$param}' AND active='Y'")) {
                 $this->id = $this->pagedata['id'];
                 $this->idker = $this->pagedata['id'];
                 $this->fullpath[] = $param;
             } else {
                 A::NotFound();
             }
         }
     }
     $idker = $this->id;
     if (!isset($id)) {
         if ($this->pagedata = A::$DB->getRow("SELECT * FROM " . SECTION . " WHERE idker={$idker} AND type='page' AND urlname='index' AND active='Y'")) {
             $this->id = $id = $this->pagedata['id'];
         }
     }
     if (!isset($id)) {
         if ($this->pagedata = A::$DB->getRow("SELECT * FROM " . SECTION . " WHERE idker={$idker} AND type='page' AND active='Y' ORDER BY sort LIMIT 0,1")) {
             $this->id = $this->pagedata['id'];
         }
     }
     if (!$this->id || empty($this->pagedata)) {
         A::NotFound();
     }
     $this->template = $this->pagedata['template'];
 }
Ejemplo n.º 6
0
 /**
  * Маршрутизатор URL.
  *
  * @param array $uri Элементы полного пути URL.
  */
 function Router($uri)
 {
     foreach ($uri as $param) {
         if (preg_match("/^([^.]+)\\.html\$/", $param, $match)) {
             if ($this->idcat == 0) {
                 switch ($match[1]) {
                     case "basket":
                         $this->page = "basket";
                         return;
                     case "order":
                         $this->page = "order";
                         return;
                     case "message":
                         $this->page = "message";
                         return;
                     case "price":
                         $this->page = "price";
                         return;
                     case "compare":
                         $this->page = "compare";
                         return;
                     case "myorders":
                         $this->page = "myorders";
                         return;
                     case "favorites":
                         $_GET['favorite'] = 1;
                         $this->page = "result";
                         return;
                     case "news":
                         $_GET['new'] = 1;
                         $this->page = "result";
                         return;
                 }
             }
             if ($match[1] == 'result') {
                 $this->page = "result";
                 return;
             }
             if ($this->itemdata = A::$DB->getRow("SELECT * FROM " . SECTION . "_catalog WHERE idcat={$this->idcat} AND urlname='{$match[1]}' AND active='Y'")) {
                 $this->iditem = $this->itemdata['id'];
             } else {
                 A::NotFound();
             }
             break;
         } else {
             if ($this->category = A::$DB->getRow("SELECT * FROM " . SECTION . "_categories WHERE idker={$this->idcat} AND urlname='{$param}' AND active='Y'")) {
                 $this->idcat = $this->category['id'];
             } else {
                 A::NotFound();
             }
         }
     }
     if ($this->iditem > 0) {
         $this->page = "page";
     } elseif ($this->idcat > 0) {
         $this->page = "category";
     } else {
         $this->page = "main";
     }
 }
Ejemplo n.º 7
0
                    A::$MAINFRAME->Assign('keywords', $row['keywords']);
                }
                if ($row['description']) {
                    A::$MAINFRAME->Assign('description', $row['description']);
                }
            }
        }
    }
}
A::$OBSERVER->AddHandler('ShowPage', 'seo_ShowPage');
function seo_CreateAdminFrame($item)
{
    if ((MODE == 'site' || MODE == 'sections') && ($structure = getStructureByPlugin('seo'))) {
        A::$MAINFRAME->AddJScript("/plugins/seo/admin/seo.js");
        A::$MAINFRAME->AddJVar("SEOSTRUCTURE", $structure);
        A::$MAINFRAME->Assign("seo", $structure);
    }
}
A::$OBSERVER->AddHandler('CreateAdminFrame', 'seo_CreateAdminFrame');
if (A_MODE == A_MODE_FRONT && ($structure = getStructureByPlugin('seo'))) {
    if ($urls = A::$DB->getAssoc("SELECT url,move,notfound FROM {$structure} WHERE move<>'' OR notfound='Y'")) {
        $PURL = parse_url(urldecode(getenv('REQUEST_URI')));
        if (isset($urls[$PURL['path']])) {
            if ($urls[$PURL['path']]['notfound'] == 'Y') {
                A::NotFound();
            } elseif ($urls[$PURL['path']]['move']) {
                A::goUrl($urls[$PURL['path']]['move'], null, true);
            }
        }
    }
}