/**
  * Updates an existing Section model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $section = section::find()->where(['id' => $id])->one();
     $section_ru = section_ru::find()->where(['section_id' => $id])->one();
     $section_en = section_en::find()->where(['section_id' => $id])->one();
     if (!empty(UploadedFile::getInstances($section, 'images'))) {
         if ($section->load(Yii::$app->request->post())) {
             if (file_exists($path = getcwd() . '\\..\\..' . $section->photo_path)) {
                 unlink($path);
             }
             if (file_exists($path = getcwd() . '\\..\\..' . $section->photo_path427320)) {
                 unlink($path);
             }
             $images = UploadedFile::getInstances($section, 'images');
             $newFileName = date("YmdHis");
             $filePath = Yii::getAlias('@frontend') . '/web/uploads/' . $newFileName . '.' . $images[0]->extension;
             $file427320 = Yii::getAlias('@frontend') . '/web/uploads/427320/' . $newFileName . '.' . $images[0]->extension;
             $images[0]->saveAs($filePath);
             Image::thumbnail($filePath, 427, 320)->save($file427320, ['quality' => 50]);
             $section->photo_path = Yii::getAlias('@resource') . '/uploads/' . $newFileName . '.' . $images[0]->extension;
             $section->photo_path427320 = Yii::getAlias('@resource') . '/uploads/427320/' . $newFileName . '.' . $images[0]->extension;
         }
     }
     if ($section_ru->load(Yii::$app->request->post()) && $section_en->load(Yii::$app->request->post()) && $section->save()) {
         $section_ru->save();
         $section_en->save();
         return $this->redirect(['update', 'id' => $section->id]);
     } else {
         return $this->render('update', ['section' => $section, 'section_ru' => $section_ru, 'section_en' => $section_en]);
     }
 }
Exemplo n.º 2
0
function createProcessSection($section_process_list, $section_id, $module)
{
    $section = new section($section_id);
    $section->changeID($section_id);
    $i = 0;
    foreach ($section_process_list as $module_page) {
        $process = new process($section_id . "  " . $module_page);
        $process->module["name"] = $module;
        $process->module["section"] = $section_id;
        $process->module["page"] = $module_page;
        if ($module_page != "index" or $module_page != "list") {
            $process->status = "core";
        }
        $process->setProcessID();
        $process_id = $process->getID();
        $section->addContent($process);
        if ($i == 0) {
            $section->setDefault($process_id);
        }
        $i += 1;
    }
    //superprint($section);
    return $section;
}
Exemplo n.º 3
0
 function getSection($id)
 {
     $result = $connector->query("SELECT * FROM section WHERE `sec_id` = '{$id}'");
     $row = $connector->fetchArray($result);
     if ($result = mysql_query($query)) {
         $section = new section();
         $section->setSec_id($row['sec_id']);
         $section->setSec_title($row['sec_title']);
         $section->setSec_url($row['sec_url']);
         $section->setSec_order($row['sec_order']);
         $section->setSec_despription($row['sec_despription']);
         return $post;
     } else {
         echo mysql_errno() . ": " . mysql_error() . "\n";
     }
 }
#
# Exponent 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.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
// Bail in case someone has visited us directly, or the Exponent framework is
// otherwise not initialized.
if (!defined('EXPONENT')) {
    exit('');
}
$section = section::updatePageset($_POST, null);
if (exponent_permissions_check('manage', exponent_core_makeLocation('NavigationModule', '', $section->parent))) {
    // Still have to do some pageset processing, mostly handled by a handy
    // member method of the NavigationModule class.
    // Since this is new, we need to increment ranks, in case the user
    // added it in the middle of the level.
    $db->increment('section', 'rank', 1, 'rank >= ' . $section->rank . ' AND parent=' . $section->parent);
    // New section (Pagesets always are).  Insert a new database
    // record, and save the ID for the processing methods that need them.
    $section->id = $db->insertObject($section, 'section');
    // Process the pageset, to add sections and subsections, as well as default content
    // that the pageset writer added to each element of the set.
    if (isset($_SESSION['nav_cache']['kids'])) {
        unset($_SESSION['nav_cache']['kids']);
    }
    NavigationModule::process_section($section, $_POST['pageset']);
 if (isset($_GET['id'])) {
     // Check to see if an id was passed in get.  If so, retrieve that section from
     // the database, and perform an edit on it.
     $section = $db->selectObject('section', 'id=' . intval($_GET['id']));
     $check_id = $section->id;
 } else {
     if (isset($_GET['parent'])) {
         // The isset check is merely a precaution.  This action should
         // ALWAYS be invoked with a parent or id value in the GET.
         $section->parent = intval($_GET['parent']);
         $check_id = $section->parent;
         //$section->parent = $db->selectObject('section','parent='.intval($_GET['parent']));
     }
 }
 if (exponent_permissions_check('manage', exponent_core_makeLocation('NavigationModule', '', $check_id))) {
     $form = section::form($section);
     $form->meta('module', 'NavigationModule');
     $form->meta('action', 'save_contentpage');
     // Create a template for the form output, to allow the themer to optionally
     // change the form titles and captions, and to aide in translation.
     $template = new template('NavigationModule', '_form_editContentPage');
     // Assign the concentional 'is_edit' flag to let the view show different text to the
     // use in case of a create and an edit operation.
     $template->assign('is_edit', isset($section->id));
     // Assign the form/s rendered HTML to the template, using the customary
     // name of 'form_html'
     $template->assign('form_html', $form->toHTML());
     $template->output();
 } else {
     // User does not have permission to manage sections.  Throw a 403
     echo SITE_403_HTML;
        // factories and create other sections).
        $section = $db->selectObject('section', 'id=' . intval($_GET['id']));
        $check_id = $section->id;
    } else {
        if (isset($_GET['parent'])) {
            // The isset check is merely a precaution.  This action should
            // ALWAYS be invoked with a parent or id value in the GET.
            $section->parent = intval($_GET['parent']);
            $check_id = $section->parent;
        }
    }
}
if ($check_id != -1 && exponent_permissions_check('manage', exponent_core_makeLocation('NavigationModule', '', $check_id))) {
    if (!isset($section->id)) {
        // Adding pagesets only works for adding, not editting.
        $form = section::pagesetForm($section);
        $form->meta('module', 'NavigationModule');
        $form->meta('action', 'save_pagesetpage');
        // Create a template for the form output, so that the themer can
        // optionally change the form title and caption
        $template = new template('NavigationModule', '_form_addPagesetPage');
        // Assign the form's rendered HTML, with the customary name 'form_html'
        $template->assign('form_html', $form->toHTML());
        $template->output();
    } else {
        // User is trying to edit a pageset page.  This is an error.
        // FIXME: Need some sort of Internal Server Error message.
        // FIXME: For now, using SITE_404_HTML.
        echo SITE_404_HTML;
    }
} else {
Exemplo n.º 7
0
# 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 Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: move_standalone.php,v 1.3 2005/04/03 07:57:14 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
if ($user && $user->is_acting_admin == 1) {
    $sect = null;
    $sect->parent = $_GET['parent'];
    $form = section::moveStandaloneForm($sect);
    $form->meta('action', 'reparent_standalone');
    $form->meta('module', 'navigationmodule');
    $template = new template('navigationmodule', '_move_standalone');
    $template->assign('form_html', $form->toHTML());
    $template->output();
} else {
    echo SITE_403_HTML;
}
Exemplo n.º 8
0
 /**
  * list sections
  *
  * @param resource the SQL result
  * @return a string to be displayed
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // no hovering label
     $href_title = '';
     // we build an array for the skin::build_tabs() function
     $panels = array();
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // get the overlay for content of this section, if any
         $content_overlay = NULL;
         if (isset($item['content_overlay'])) {
             $content_overlay = Overlay::bind($item['content_overlay']);
         }
         // panel content
         $text = '';
         // insert anchor prefix
         if (is_object($anchor)) {
             $text .= $anchor->get_prefix();
         }
         // the introduction text, if any
         if (is_object($overlay)) {
             $text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
         } elseif (isset($item['introduction']) && trim($item['introduction'])) {
             $text .= Skin::build_block($item['introduction'], 'introduction');
         }
         // get text related to the overlay, if any
         if (is_object($overlay)) {
             $text .= $overlay->get_text('view', $item);
         }
         // filter description, if necessary
         if (is_object($overlay)) {
             $description = $overlay->get_text('description', $item);
         } else {
             $description = $item['description'];
         }
         // the beautified description, which is the actual page body
         if ($description) {
             // use adequate label
             if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
                 $text .= Skin::build_block($label, 'title');
             }
             // beautify the target page
             $text .= Skin::build_block($description, 'description', '', $item['options']);
         }
         // delegate rendering to the overlay, where applicable
         if (is_object($content_overlay) && ($overlaid = $content_overlay->render('articles', 'section:' . $item['id'], 1))) {
             $text .= $overlaid;
             // regular rendering
         } elseif (!isset($item['articles_layout']) || $item['articles_layout'] != 'none') {
             // select a layout
             if (!isset($item['articles_layout']) || !$item['articles_layout']) {
                 include_once '../articles/layout_articles.php';
                 $layout = new Layout_articles();
             } else {
                 $layout = Layouts::new_($item['articles_layout'], 'article');
             }
             // avoid links to this page
             if (is_object($layout) && is_callable(array($layout, 'set_variant'))) {
                 $layout->set_focus('section:' . $item['id']);
             }
             // the maximum number of articles per page
             if (is_object($layout)) {
                 $items_per_page = $layout->items_per_page();
             } else {
                 $items_per_page = ARTICLES_PER_PAGE;
             }
             // sort and list articles
             $offset = 0;
             if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
                 $order = $matches[1];
             } elseif (is_callable(array($layout, 'items_order'))) {
                 $order = $layout->items_order();
             } else {
                 $order = 'edition';
             }
             // create a box
             $box = array('top_bar' => array(), 'text' => '', 'bottom_bar' => array());
             // the command to post a new page
             //if(Articles::allow_creation($item, $anchor)) {
             if ($anchor->allows('creation', 'article')) {
                 Skin::define_img('ARTICLES_ADD_IMG', 'articles/add.gif');
                 $url = 'articles/edit.php?anchor=' . urlencode('section:' . $item['id']);
                 if (is_object($content_overlay) && ($label = $content_overlay->get_label('new_command', 'articles'))) {
                 } else {
                     $label = ARTICLES_ADD_IMG . i18n::s('Add a page');
                 }
                 $box['top_bar'] += array($url => $label);
             }
             // list pages under preparation
             $this_section = new section();
             $this_section->load_by_content($item, $anchor);
             if ($this_section->is_assigned()) {
                 if ($order == 'publication' && ($items =& Articles::list_for_anchor_by('draft', 'section:' . $item['id'], 0, 20, 'compact'))) {
                     if (is_array($items)) {
                         $items = Skin::build_list($items, 'compact');
                     }
                     $box['top_bar'] += array('_draft' => Skin::build_sliding_box(i18n::s('Draft pages'), $items));
                 }
             }
             // top menu
             if ($box['top_bar']) {
                 $box['text'] .= Skin::build_list($box['top_bar'], 'menu_bar');
             }
             // get pages
             $items =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], $offset, $items_per_page, $layout);
             // items in the middle
             if (is_array($items) && isset($item['articles_layout']) && $item['articles_layout'] == 'compact') {
                 $box['text'] .= Skin::build_list($items, 'compact');
             } elseif (is_array($items)) {
                 $box['text'] .= Skin::build_list($items, 'decorated');
             } elseif (is_string($items)) {
                 $box['text'] .= $items;
             }
             // no navigation bar with alistapart
             if (!isset($item['articles_layout']) || $item['articles_layout'] != 'alistapart') {
                 // count the number of articles in this section
                 if ($count = Articles::count_for_anchor('section:' . $item['id'])) {
                     if ($count > 20) {
                         $box['bottom_bar'] += array('_count' => sprintf(i18n::ns('%d page', '%d pages', $count), $count));
                     }
                     // navigation commands for articles
                     $home = Sections::get_permalink($item);
                     $prefix = Sections::get_url($item['id'], 'navigate', 'articles');
                     $box['bottom_bar'] += Skin::navigate($home, $prefix, $count, $items_per_page, 1);
                 }
             }
             // bottom menu
             if ($box['bottom_bar']) {
                 $box['text'] .= Skin::build_list($box['bottom_bar'], 'menu_bar');
             }
             // there is some box content
             if ($box['text']) {
                 $text .= $box['text'];
             }
         }
         // layout sub-sections
         if (!isset($item['sections_layout']) || $item['sections_layout'] != 'none') {
             // select a layout
             if (!isset($item['sections_layout']) || !$item['sections_layout']) {
                 include_once 'layout_sections.php';
                 $layout = new Layout_sections();
             } else {
                 $layout = Layouts::new_($item['sections_layout'], 'section');
             }
             // the maximum number of sections per page
             if (is_object($layout)) {
                 $items_per_page = $layout->items_per_page();
             } else {
                 $items_per_page = SECTIONS_PER_PAGE;
             }
             // build a complete box
             $box = array('top_bar' => array(), 'text' => '', 'bottom_bar' => array());
             // the command to add a new section
             //if(Sections::allow_creation($item, $anchor)) {
             if ($anchor->allows('creation', 'section')) {
                 Skin::define_img('SECTIONS_ADD_IMG', 'sections/add.gif');
                 $box['top_bar'] += array('sections/edit.php?anchor=' . urlencode('section:' . $item['id']) => SECTIONS_ADD_IMG . i18n::s('Add a section'));
             }
             // top menu
             if ($box['top_bar']) {
                 $box['text'] .= Skin::build_list($box['top_bar'], 'menu_bar');
             }
             // list items by family then title
             $offset = 0 * $items_per_page;
             $items = Sections::list_by_title_for_anchor('section:' . $item['id'], $offset, $items_per_page, $layout, TRUE);
             // actually render the html for the section
             if (is_array($items) && is_string($item['sections_layout']) && $item['sections_layout'] == 'compact') {
                 $box['text'] .= Skin::build_list($items, 'compact');
             } elseif (is_array($items)) {
                 $box['text'] .= Skin::build_list($items, 'decorated');
             } elseif (is_string($items)) {
                 $box['text'] .= $items;
             }
             // count the number of subsections
             if ($count = Sections::count_for_anchor('section:' . $item['id'])) {
                 if ($count > 20) {
                     $box['bottom_bar'] = array('_count' => sprintf(i18n::ns('%d section', '%d sections', $count), $count));
                 }
                 // navigation commands for sections
                 $home = Sections::get_permalink($item);
                 $prefix = Sections::get_url($item['id'], 'navigate', 'sections');
                 $box['bottom_bar'] += Skin::navigate($home, $prefix, $count, $items_per_page, 1);
             }
             // bottom menu
             if ($box['bottom_bar']) {
                 $box['text'] .= Skin::build_list($box['bottom_bar'], 'menu_bar');
             }
             // there is some box content
             if ($box['text']) {
                 $text .= $box['text'];
             }
         }
         // ensure that the surfer can change content
         if (Sections::allow_modification($item, $anchor)) {
             // view or modify this section
             $menu = array();
             $menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('View the sub-section'), 'span');
             if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'sections'))) {
                 $label = i18n::s('Edit this sub-section');
             }
             $menu[] = Skin::build_link(Sections::get_url($item['id'], 'edit'), $label, 'span');
             $text .= Skin::finalize_list($menu, 'menu_bar');
         }
         // assemble the full panel
         $panels[] = array('stt' . $item['id'], ucfirst(Skin::strip($item['title'], 30)), 'stc' . $item['id'], $text);
     }
     // format tabs
     if ($this->has_variant('as_array')) {
         $text = $panels;
     } else {
         $text = Skin::build_tabs($panels);
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
Exemplo n.º 9
0
 /**
  * Define core header styles
  *
  * @since 1.0.0
  * @access public
  */
 public function set_assets()
 {
     $this->assets['style']['header'] = $this->url . 'assets/css/header' . UIX_ASSET_DEBUG . '.css';
     parent::set_assets();
 }
Exemplo n.º 10
0
    // Check to see if an id was passed in get.  If so, retrieve that section from
    // the database, and perform an edit on it.
    $section = $db->selectObject('section', 'id=' . $_GET['id']);
    if ($section) {
        $check_id = $section->id;
    }
} else {
    if (isset($_GET['parent'])) {
        // The isset check is merely a precaution.  This action should
        // ALWAYS be invoked with a parent or id value in the GET.
        $section->parent = $_GET['parent'];
        $check_id = $section->parent;
    }
}
if ($check_id != -1 && pathos_permissions_check('manage', pathos_core_makeLocation('navigationmodule', '', $check_id))) {
    $form = section::internalAliasForm($section);
    $form->meta('module', 'navigationmodule');
    $form->meta('action', 'save_internalalias');
    // Create a template for the form's output, to allow the themer to optionally
    // change the form's title and caption.  This will also help with translation.
    $template = new template('navigationmodule', '_form_editInternalAlias');
    // Assign the customary 'is_edit' flag with the template, to allow the view to
    // display different text to the user when they are editting an alias and when they
    // are creating a new alias.
    $template->assign('is_edit', isset($section->id));
    // Assign the form's rendered HTML output to the template, using the
    // conventional name of 'form_html'
    $template->assign('form_html', $form->toHTML());
    $template->output();
} else {
    // User is not authorized to manage sections.  Throw a 403
Exemplo n.º 11
0
}
?>
					</select>
					<input class="sub2" id="submitBtn" type="submit" value="修改">
				</span>
  </div>
<table style="margin-top:10px;"  cellspacing="0" cellpadding="0" class="tab" width="98%">
	<tr>
		<th align="left"><input type="checkbox" id="menu_selectAll" value="1" onclick="power_selectAll('menu_selectAll','menu_item_')" >選單</th>
		<th align="left"><input type="checkbox" id="list_selectAll" value="1" onclick="power_selectAll('list_selectAll','list_')">列表</th>
		<th align="left"><input type="checkbox" id="add_selectAll" value="1" onclick="power_selectAll('add_selectAll','add_')" >新增</th>
		<th align="left"><input type="checkbox" id="edit_selectAll" value="1" onclick="power_selectAll('edit_selectAll','edit_')" >修改</th>
		<th align="left"><input type="checkbox" id="delete_selectAll" value="1" onclick="power_selectAll('delete_selectAll','delete_')" >刪除</th>
	</tr>
	<?php 
$class = new section();
foreach (resetArray(0, $class->getList()) as $rs) {
    ?>
	<tr onMouseOver="this.bgColor='#00CCFF'" onMouseOut="this.bgColor='#FFFFFF'">
		<td><input type="checkbox" name="perm_id[]" pid="<?php 
    echo $rs['parent_id'];
    ?>
" id="menu_item_<?php 
    echo $rs["id"];
    ?>
_END" value="<?php 
    echo $rs["id"];
    ?>
" onclick="power_selectAll('menu_item_<?php 
    echo $rs["id"];
    ?>
Exemplo n.º 12
0
Arquivo: view.php Projeto: rair/yacs
     $order = 'edition';
 }
 // create a box
 $box = array('top_bar' => array(), 'text' => '', 'bottom_bar' => array());
 // the command to post a new page
 if ($cur_section->allows('creation', 'article')) {
     Skin::define_img('ARTICLES_ADD_IMG', 'articles/add.gif');
     $url = 'articles/edit.php?anchor=' . urlencode('section:' . $item['id']);
     if (is_object($content_overlay) && ($label = $content_overlay->get_label('new_command', 'article'))) {
     } else {
         $label = ARTICLES_ADD_IMG . i18n::s('Add a page');
     }
     $box['top_bar'] += array($url => $label);
 }
 // list pages under preparation
 $this_section = new section();
 $this_section->load_by_content($item, $anchor);
 if ($this_section->is_assigned()) {
     if ($order == 'publication' && ($items =& Articles::list_for_anchor_by('draft', 'section:' . $item['id'], 0, 20, 'compact'))) {
         if (is_array($items)) {
             $items = Skin::build_list($items, 'compact');
         }
         $box['top_bar'] += array('_draft' => Skin::build_sliding_box(i18n::s('Draft pages'), $items));
     }
 }
 // top menu
 if ($box['top_bar']) {
     $box['text'] .= Skin::build_list($box['top_bar'], 'menu_bar');
 }
 // get pages
 $items =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], $offset, $items_per_page, $layout);
Exemplo n.º 13
0
 function updatePageset($values, $object)
 {
     $object = section::_updateCommon($values, $object);
     $object->active = 1;
     $object->public = isset($values['public']) ? 1 : 0;
     // Can't really do much with pageset updating, because we
     // need to save the section before we can add subsections or copy
     // any content.
     return $object;
 }
Exemplo n.º 14
0
Arquivo: edit.php Projeto: rair/yacs
    $item['active'] = $anchor->get_active();
}
// get the related overlay, if any
$overlay = NULL;
if (isset($item['overlay']) && $item['overlay']) {
    $overlay = Overlay::load($item, 'section:' . $item['id']);
} elseif (isset($_REQUEST['variant']) && $_REQUEST['variant']) {
    $overlay = Overlay::bind($_REQUEST['variant']);
} elseif (isset($_SESSION['pasted_variant']) && $_SESSION['pasted_variant']) {
    $overlay = Overlay::bind($_SESSION['pasted_variant']);
    unset($_SESSION['pasted_variant']);
} elseif (!isset($item['id']) && is_object($anchor)) {
    $overlay = $anchor->get_overlay('section_overlay');
}
// current edited section as object
$cur_section = new section();
$cur_section->item = $item;
$cur_section->anchor = $anchor;
$cur_section->overlay = $overlay;
// we are at site root
if ($anchor === null && Surfer::is_associate()) {
    $permitted = TRUE;
} elseif (!isset($item['id']) && $anchor->allows('creation', 'section')) {
    $permitted = TRUE;
} elseif (isset($item['id']) && $cur_section->allows('modification')) {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
global $render_overlaid;
$whole_rendering = !$render_overlaid;
Exemplo n.º 15
0
    function change_scope_form($id_photo, $error = '')
    {
        $header = "<span class=header1>Изменение области видимости</span>";
        $query = "SELECT `id_photo`, `photo`.`name` 'pname', `medium`, `original`, alb.`name` 'albname', `scope`, `descr`,\n\t\t\t\t DATE_FORMAT(`pubdate`, '%e.%m.%Y&nbsp;&nbsp;%k:%i:%s') 'pubdate', alb.`id_album` 'idalbum' \n\t\t\tFROM `photo` LEFT JOIN `album` alb ON `photo`.`id_album`=alb.`id_album`\n\t\t\tWHERE  `photo`.`id_user`=" . $_SESSION['id_user'] . " AND `medium`!='' AND `photo`.`id_photo`=" . $id_photo;
        $row_photos = mysql_fetch_assoc($this->q($query));
        $comments = $this->q("SELECT `comment`.`comment_txt` 'commenttxt', `comment`.`date` 'date', u.`name` 'user', `anonymous`\n\t\t\t\t\t\t\t  FROM `comment` \n\t\t\t\t\t\t\t  LEFT JOIN `user` u ON `comment`.`id_user` = u.`id_user`\n\t\t\t\t\t\t\t  WHERE `comment`.`id_photo`=" . $id_photo);
        $num_com = mysql_num_rows($comments);
        if (isset($_SESSION['id_user']) and $_SESSION['id_user'] == $row_photos['author']) {
            $scope_vis = $row_photos['scope'];
        } else {
            $scope_vis = "";
        }
        $albpht[1] = new medium_photo($row_photos['id_photo'], $row_photos['pname'], $row_photos['medium'], $row_photos['original'], $row_photos['pubdate'], $num_com, $scope_vis, $row_photos['descr'], $row_photos['tag'], $row_photos['idalbum'], $_SESSION['user'], $_SESSION['id_user'], 0, 'forbid');
        $album_name = '<td colspan="11" valign="middle" align="right" height="40">
					<span class="help">Альбом: </span> <span class="cur">' . $row_photos['albname'] . '</span></td>
					<td width=51 colspan=2></td>
        </tr>
        <tr> 
          <td width=24><p></p></td>';
        $photoalb = new section($header, 11, 3);
        $photoalb->add_phts_in_alb($albpht, $album_name, true);
        $scope_box[1] = $row_photos['scope'];
        if ($error != '') {
            $scope_box = $_SESSION['scopebox'];
        }
        $scope_form = sh_change_scope_form($id_photo, $error, $scope_box);
        $scope_con = new content($photoalb, $scope_form . sh_my_album_photos_spacers());
        $this->set_content($scope_con);
    }
Exemplo n.º 16
0
 /**
  * 'Builds' the page based on $uri.
  * Finds all the different nodes this page is made of
  * and initializes all the sub-requests, placing the response
  * in the right section of the page.
  *
  * @param string $uri - page uri
  */
 public function action_index($uri = NULL)
 {
     $this->title = 'hello';
     $this->template = View::factory('templates/default');
     $this->request->response = $this->template;
     return;
     // parse the URI and find parameters
     $segments = explode('/', $uri);
     $current_segment = NULL;
     $page = ORM::factory('page');
     foreach ($segments as $segment) {
         if ($current_segment === NULL) {
             $current_segment = $segment;
             $page = $page->where('uri', '=', $current_segment);
         } else {
             $current_segment .= '/' . $segment;
             $page = $page->or_where('uri', '=', $current_segment);
         }
     }
     // find the most complete match
     $page = $page->order_by('uri', 'DESC')->find();
     if (!$page->loaded()) {
         // yuriko page doesn't exist
         Event::run('yuriko.404');
         return;
     }
     // get parameters
     $parameters = substr($uri, strlen($page->uri));
     // set the template defined in the database
     $this->template = new View('templates/' . $page->template);
     //get all nodes on this page
     $page_nodes = $page->page_nodes->find_all();
     foreach ($page_nodes as $page_node) {
         $route_params = array();
         //get this node
         $node = $page_node->node;
         //get custom parameters for this node
         $params = $node->node_route_parameters->find_all();
         foreach ($params as $param) {
             $route_params[$param->key] = $param->value;
         }
         //replace node params with page_node params
         $params = $page_node->node_route_parameters->find_all();
         foreach ($params as $param) {
             $route_params[$param->key] = $param->value;
         }
         //get the route
         $node_route = $node->node_route;
         //route name (to make the sub-request)
         $route = route::get($node_route->name);
         //find the uri and append the parameters to it
         $uri = $route->uri($route_params) . $parameters;
         if ($page_node->section === NULL) {
             //execute sub-request and let the node handle outputting
             Request::factory($uri)->execute();
         } else {
             //execute sub-request and put output in the right section
             section::set($page_node->section, Request::factory($uri)->execute());
         }
     }
     $this->request->response = $this->template;
 }
Exemplo n.º 17
0
function createNewObject($object_type, $post_vars, $system_data_classes, $object_save = 0)
{
    if (!$object_type) {
        return false;
    }
    if (!in_array($object_type, $system_data_classes)) {
        return false;
    }
    switch ($object_type) {
        case "page":
            $object = new page("new page");
            $object->update_document_props($post_vars);
            if ($object_save == 1) {
                $object->createContent();
                $object->save();
            }
            break;
        case "process":
            $object = new process("new process");
            $object->update_document_props($post_vars);
            $object->update_design_props($post_vars);
            if ($object_save == 1) {
                $object->save();
            }
            break;
        case "section":
            $object = new section("new section");
            $object->update_document_props($post_vars);
            if ($object_save == 1) {
                $object->createContent();
                $object->save();
            }
            break;
        case "image":
            $object = new image("new image");
            $object->update_document_props($post_vars);
            if ($object_save == 1) {
                $object->save();
            }
            break;
        case "file":
            $object = new file("new file");
            $object->update_document_props($post_vars);
            if ($object_save == 1) {
                $object->save();
            }
            break;
        default:
            break;
    }
    return $object;
}
Exemplo n.º 18
0
		<div class="grid_4 section side_panel">
			<?php 
foreach (section::get('Side Panel') as $node) {
    ?>
				<?php 
    echo $node;
    ?>
			<?php 
}
?>
		</div>
		<!-- END SECTION -->
		<!-- BEGIN SECTION -->
		<div class="grid_16 section gutter">
			<?php 
foreach (section::get('Gutter') as $node) {
    ?>
				<?php 
    echo $node;
    ?>
			<?php 
}
?>
		</div>
		<!-- END SECTION -->
		<div class="clear"></div>
    </div>
	<div class="dev">
		<pre>
		<?php 
echo Kohana::debug($_POST);
        if (isset($_GET['parent'])) {
            // The isset check is merely a precaution.  This action should
            // ALWAYS be invoked with a parent or id value in the GET.
            $section->parent = $_GET['parent'];
        }
    }
} else {
    if (isset($_GET['parent'])) {
        // The isset check is merely a precaution.  This action should
        // ALWAYS be invoked with a parent or id value in the GET.
        $section->parent = $_GET['parent'];
        $check_id = $section->parent;
    }
}
if ($check_id != -1 && exponent_permissions_check('manage', exponent_core_makeLocation('navigationmodule', '', $check_id))) {
    $form = section::externalAliasForm($section);
    $form->meta('module', 'navigationmodule');
    $form->meta('action', 'save_externalalias');
    // Create a template for the form's output, to allow the themer to optionally
    // change the form title and caption.  This will help with translation.
    $template = new template('navigationmodule', '_form_editExternalAlias');
    // Assign the customary 'is_edit' flag with the template, so that the view can show different
    // text to the user if they are creating a new alias or editing an existing one.
    $template->assign('is_edit', isset($section->id));
    // Assign the form's rendered HTML output to the tempalte using the
    // conventional name of 'form_html'.
    $template->assign('form_html', $form->toHTML());
    $template->output();
} else {
    echo SITE_403_HTML;
}
Exemplo n.º 20
0
##################################################
// Bail in case someone has visited us directly, or the Exponent framework is
// otherwise not initialized.
if (!defined('EXPONENT')) {
    exit('');
}
$section = section::updatePageset($_POST, null);
// make sure the SEF name is valid
global $router;
if (empty($section->sef_name)) {
    $section->sef_name = $router->encode($section->name);
}
if (!section::isValidName($section->sef_name)) {
    expValidator::failAndReturnToForm(gt('You have invalid characters in the SEF Name field.'));
}
if (section::isDuplicateName($section)) {
    expValidator::failAndReturnToForm(gt('The name specified in the SEF Name field is a duplicate of an existing page.'));
}
if (expPermissions::check('manage', expCore::makeLocation('navigationmodule', '', $section->parent))) {
    // Still have to do some pageset processing, mostly handled by a handy
    // member method of the navigationmodule class.
    // Since this is new, we need to increment ranks, in case the user
    // added it in the middle of the level.
    $db->increment('section', 'rank', 1, 'rank >= ' . $section->rank . ' AND parent=' . $section->parent);
    // New section (Pagesets always are).  Insert a new database
    // record, and save the ID for the processing methods that need them.
    $section->id = $db->insertObject($section, 'section');
    // Process the pageset, to add sections and subsections, as well as default content
    // that the pageset writer added to each element of the set.
    expSession::clearAllUsersSessionCache('navigationmodule');
    navigationmodule::process_section($section, $_POST['pageset']);
 $i18n = exponent_lang_loadFile('modules/NavigationModule/actions/save_internalalias.php');
 // Update the section from the _POST data.
 $section = section::updateInternalAlias($_POST, $section);
 if ($section->active == 0) {
     // User tried to link to an inactive section.  This makes little or no sense in
     // this context, so throw them back to the edit form, with an error message.
     $_POST['_formError'] = $i18n['internal_link_err'];
     exponent_sessions_set('last_POST', $_POST);
     header('Location: ' . $_SERVER['HTTP_REFERER']);
     exit('');
 }
 if (isset($section->id)) {
     if ($section->parent != $old_parent) {
         // Old_parent id was different than the new parent id.  Need to decrement the ranks
         // of the old children (after ours), and then add
         $section = section::changeParent($section, $old_parent, $section->parent);
     }
     // Existing section.  Update the database record.
     // The 'id=x' WHERE clause is implicit with an updateObject
     if (isset($_SESSION['nav_cache']['kids'])) {
         unset($_SESSION['nav_cache']['kids']);
     }
     $db->updateObject($section, 'section');
 } else {
     // Since this is new, we need to increment ranks, in case the user
     // added it in the middle of the level.
     $db->increment('section', 'rank', 1, 'rank >= ' . $section->rank . ' AND parent=' . $section->parent);
     // New section.  Insert a new database record.
     if (isset($_SESSION['nav_cache']['kids'])) {
         unset($_SESSION['nav_cache']['kids']);
     }
Exemplo n.º 22
0
function hotspot($source = null)
{
    if (!empty($source)) {
        global $sectionObj;
        //FIXME there is NO 'page' object and section has not _construct method
        $page = new section($sectionObj->id);
        $modules = $page->getModulesBySource($source);
        //FIXME there is no getModulesBySource method anywhere
        //eDebug($modules);exit();
        foreach ($modules as $module) {
            renderAction(array('controller' => $module->type, 'action' => $module->action, 'instance' => $module->id));
        }
    }
}