© Сделано на LiveStreet
Дизайн - ©2009 MODx RED Group
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href='[(site_url)]'>
<meta name="author" content="Luka Cvrk (www.solucija.com)" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<title>[*pagetitle*] | Уроки по созданию сайтов на CMS Modx</title>
<meta name="description" content="[*longtitle*]" />
</head><?php
/**
* Register
*
* Copyright 2010 by Shaun McCormick <shaun@modx.com>
*
* Register is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* Register is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* Register; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package login
*/
/**
* MODx Confirm Register Activation Snippet. Snippet to place on an activation
* page that the user using the Register snippet would be sent to via the
* activation email.
*
* @var modX $modx
* @var Login $login
* @var array $scriptProperties
*
* @package login
*/
require_once $modx->getOption('login.core_path',null,$modx->getOption('core_path').'components/login/').'model/login/login.class.php';
$login = new Login($modx,$scriptProperties);
$controller = $login->loadController('ConfirmRegister');
$output = $controller->run($scriptProperties);
return $output;
[!Ditto? &summarize=`1` &startID=`1` &randomize=`1` &depth=`6` &hideFolders=`1` &tpl=`randompost`!]
xmpp:modx@conference.jabber.ru
<?php
if(!isset($id)) $id = 2;
if(!isset($level)) $level = 1;
if ($level > 1){
$tblsc = $modx->getFullTableName('site_content');
$access = "AND lvl{$level}.deleted=0 AND lvl{$level}.published=1";
$inner = '';
for ($i = $level-1; $i > 0; --$i){
$nextlvl = $i+1;
$inner .= "INNER JOIN $tblsc AS lvl{$i} ON lvl{$nextlvl}.parent=lvl{$i}.id AND lvl{$i}.deleted=0 AND lvl{$i}.published=1 ";
}
$sql = "SELECT lvl{$level}.id FROM $tblsc AS lvl{$level} " . $inner . "WHERE lvl1.parent=$id $access;";
$res = $modx->db->query($sql);
$children = array();
while($childId = $modx->db->getValue($res)){
$children[] = $childId;
}
}
else{
$children = $modx->getChildIds($id, 1);
}
return implode(',', $children);
?><?php
if(!isset($id)) $id = 2;
if(!isset($level)) $level = 5;
if($level>2) {
if(!function_exists('LevelChildren')){
function LevelChildren($docId, $levels){
global $modx;
$tblsc = $modx->getFullTableName('site_content');
$access = "AND lvl{$levels}.deleted=0 AND lvl{$levels}.published=1";
$inner = '';
for ($i = $levels-1; $i > 1; --$i){
$nextlvl = $i+1;
$inner .= "INNER JOIN $tblsc AS lvl{$i} ON lvl{$nextlvl}.parent=lvl{$i}.id AND lvl{$i}.deleted=0 AND lvl{$i}.published=1 ";
}
$sql = "SELECT lvl{$levels}.* FROM $tblsc AS lvl{$levels} " .
$inner .
"WHERE lvl2.parent=$docId $access;";
$res = $modx->db->query($sql);
$res = $modx->db->makeArray($res);
foreach($res as $v) {
$child[] = $v['id'];
}
return implode(",",$child);
}
}
$levelID = LevelChildren($id,$level);
return $levelID;
}
else { return '';}
?>$array1 = $modx->getChildIds($parent,$depth);
$array2 = $modx->getChildIds($parent,$depth-1);
$childParents = array_diff($array1, $array2);
<?php
$mode = isset($mode) ? $mode : 'show';
$outerTpl = isset($outerTpl) ? $outerTpl : '@CODE: <h1>Вы уже смотрели:</h1><ul class="[+outer-class+]">[+rows+]</ul>';
$outerClass = isset($outerClass) ? $outerClass : 'last-view';
$rowTpl = isset($rowTpl) ? $rowTpl : '@CODE: <li><a href="[+url+]">[+name+]</a></li>';
$maxRows = isset($maxRows) ? $maxRows : 10;
if(!function_exists('fetchTpl')) {
function fetchTpl($tpl){
global $modx;
$template = "";
if(substr($tpl, 0, 6) == "@FILE:") {
$tpl_file = MODX_BASE_PATH . substr($tpl, 6);
$template = file_get_contents($tpl_file);
} else if (substr($tpl, 0, 6) == "@CODE:") {
$template = substr($tpl, 6);
} else if($modx->getChunk($tpl) != "") {
$template = $modx->getChunk($tpl);
} else {
$template = false;
}
return $template;
}
}
if(!function_exists('parseTplChunk')) {
function parseTplChunk($tpl,$placeholder=array()){
$chunk = fetchTpl($tpl);
foreach ($placeholder as $key => $value){
$chunk = str_replace("[+".$key."+]", $value, $chunk);
}
return $chunk;
}
}
$item = array();
if (isset($_COOKIE['last_view']) and $_COOKIE['last_view'] != '') {
$item = explode(',', $_COOKIE['last_view']);
}
switch ($mode) {
case 'register':
if (!in_array($modx->documentIdentifier, $item)) {
if (count($item) >= $maxRows) {
array_shift($item);
array_unshift($item, $modx->documentIdentifier);
} else {
array_unshift($item, $modx->documentIdentifier);
}
setcookie('last_view', implode(',', $item), time()+60*60*24*30, '/');
}
break;
case 'show':
if (!empty($item)) {
$docs = $modx->getDocuments($item);
$output = '';
foreach ($docs as $doc) {
$rows .= parseTplChunk($rowTpl, array('url'=>$modx->makeUrl($doc['id']), 'name'=>$doc['pagetitle']));
}
return parseTplChunk($outerTpl, array('rows'=>$rows, 'outer-class'=>$outerClass));
}
break;
}
?>$rows .= parseTplChunk($rowTpl, array('url'=>$modx->makeUrl($doc['id']), 'name'=>$doc['pagetitle'], 'image'=>$modx->getTemplateVar('img_product_home')));Array