Ejemplo n.º 1
0
function display_page_content()
{
    $section_name = requestIdParam();
    $section = Sections::FindByName($section_name);
    $items = $section->findItems();
    ?>
		
		<div id="right">
			<h3>Item Thumbnail</h3>
		</div>
		<div id="center">
			<h3>All the <?php 
    echo $section->display_name;
    ?>
</h3>
			<?php 
    echo $section->content;
    ?>
		<?php 
    echo "<ul>\r\n";
    foreach ($items as $item) {
        echo "\t\t\t<li><a href=\"" . get_link("portfolio/item/{$section_name}/" . $item->name) . "\">{$item->display_name}</a></li>\r\n";
    }
    echo "\t\t</ul>\r\n";
    ?>
		</div>
		<?php 
}
Ejemplo n.º 2
0
 /**
  * list sections
  *
  * @param resource the SQL result
  * @return an array of $url => (NULL, $title, NULL, 'section_123', NULL, 'visit this section')
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // no hovering label
     $href_title = '';
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // the url to view this item
         $url = Sections::get_permalink($item);
         // initialize variables
         $prefix = $suffix = '';
         // list all components for this item
         $items[$url] = array($prefix, ucfirst(Skin::strip($item['index_title'], 30)), $suffix, 'section_' . $item['id'], NULL, $href_title);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
Ejemplo n.º 3
0
 /**
  * list sections
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return some text
     $text = '';
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // we want to make it visual
         if (!$item['thumbnail_url']) {
             continue;
         }
         // a title for the image --do not force a title
         if (isset($item['title'])) {
             $title = $item['title'];
         } else {
             $title = '';
         }
         // the url to view this item
         $url = Sections::get_permalink($item);
         // use the skin to shape it
         $text .= Skin::build_image('thumbnail', $item['thumbnail_url'], $title, $url);
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
Ejemplo n.º 4
0
function display_page_content()
{
    $section_name = requestIdParam();
    $section = Sections::FindByName($section_name);
    $item_name = getRequestVarAtIndex(3);
    $item = Items::FindByName($item_name);
    $gallery = $item->getGallery();
    ?>

		<h1><?php 
    echo $item->display_name;
    ?>
</h1>
<?php 
    $next_item = $item->findNext($section);
    $prev_item = $item->findPrev($section);
    if ($prev_item) {
        echo "\t\t\t\t<a href=\"" . get_link("portfolio/item/{$section_name}/" . $prev_item->name) . "\">previous</a>\n";
    }
    if ($next_item) {
        echo "\t\t\t\t<a href=\"" . get_link("portfolio/item/{$section_name}/" . $next_item->name) . "\">next</a>\n";
    }
    echo $item->content;
    foreach ($gallery->get_photos() as $photo) {
        echo "<img src=\"/" . $photo->getPublicUrl() . "\" /><br />";
    }
}
Ejemplo n.º 5
0
function breadCrumbs($section)
{
    $data = Sections::bread($section);
    $str = "";
    for ($i = count($data) - 1; $i >= 0; $i--) {
        $str .= "<a href='/?section=" . $data[$i]['id'] . "'>" . $data[$i]['name'] . "</a>/";
    }
    return $str;
}
Ejemplo n.º 6
0
function display_page_content()
{
    $listname = getRequestVarAtIndex(2);
    switch ($listname) {
        case "portfolio":
            foreach ($_POST as $ordered_objects => $order_value) {
                // splits up the key to see if we are ordering a section, item or ignoring a portfolio area
                $ordered_parts = explode("_", $ordered_objects);
                // NOTICE: I have learned that when there are portfoli orphans, this reordering script breaks. I removed the hidden fields in the Orphans section, but check in on that if you notice reordering breaking again.
                //$debug = "";
                if ($ordered_parts[0] != "PortFolioAreas") {
                    if ($ordered_parts[0] == "SectionOrder") {
                        $section = Sections::FindById($ordered_parts[1]);
                        $section->display_order = $order_value;
                        $section->save();
                        //$debug .= $section->display_name." updated";
                    } else {
                        $section = Sections::FindById($ordered_parts[0]);
                        $item = Items::FindById($ordered_parts[1]);
                        $item->updateOrderInSection($section, $order_value);
                        //$debug .= $item->display_name." updated";
                    }
                }
                //setFlash( "<h3>".$debug."</h3>" );
                //setFlash( "<h3>".var_export( $_POST, true )."</h3>" );
            }
            break;
        case "areaspages":
            foreach ($_POST as $ordered_objects => $order_value) {
                // splits up the key to see if we are ordering a section, item or ignoring a portfolio area
                $ordered_parts = explode("_", $ordered_objects);
                //$debug = "";
                if ($ordered_parts[0] == "AreaOrder") {
                    $area = Areas::FindById($ordered_parts[1]);
                    $area->display_order = $order_value;
                    $area->save();
                    //$debug .= "$area->display_name updated";
                } else {
                    if ($ordered_parts[0] == "SubPage") {
                        $page = Pages::FindById($ordered_parts[1]);
                        $page->display_order = $order_value;
                        $page->save();
                        //$debug .= "$page->display_name sub page updated";
                    } else {
                        $area = Areas::FindById($ordered_parts[0]);
                        $page = Pages::FindById($ordered_parts[1]);
                        $page->updateOrderInArea($area, $order_value);
                        //$debug .= "$page->display_name updated in $area->display_name";
                    }
                }
            }
            //setFlash( "<h3>".$debug."</h3>" );
            //setFlash( "<h3>".var_export( $_POST, true )."</h3>" );
            break;
    }
}
Ejemplo n.º 7
0
 public function run()
 {
     DB::table('sections')->delete();
     $section = array('title' => Lang::get('display.teachers'), 'description' => '', 'file' => false, 'status' => 'publish', 'type' => 'teachers', 'order' => 1);
     Sections::create($section);
     $section = array('title' => Lang::get('display.promotioners'), 'description' => '', 'file' => false, 'status' => 'publish', 'type' => 'promotioners', 'order' => 2);
     Sections::create($section);
     $section = array('title' => Lang::get('display.supporters'), 'description' => '', 'file' => false, 'status' => 'publish', 'type' => 'supporters', 'order' => 3);
     Sections::create($section);
     $section = array('title' => Lang::get('display.inscriptions'), 'description' => '', 'file' => false, 'status' => 'publish', 'type' => 'inscriptions', 'order' => 4);
     Sections::create($section);
     $section = array('title' => Lang::get('display.works'), 'description' => '', 'file' => false, 'status' => 'publish', 'type' => 'works', 'order' => 5);
     Sections::create($section);
 }
Ejemplo n.º 8
0
 function FindBySectionName($section_name = "")
 {
     if ($section_name == "") {
         return array();
     }
     $section = Sections::FindByName($section_name);
     $items = $section->findItems();
     $id_list = "";
     foreach ($items as $item) {
         $id_list .= "{$item->id},";
     }
     $id_list = trim($id_list, ',');
     return MyActiveRecord::FindBySql('Keywords', "SELECT DISTINCT k.* FROM keywords k inner join items_keywords ik ON ik.keywords_id = k.id and ik.items_id in ({$id_list})");
 }
Ejemplo n.º 9
0
 /**
  * list sections
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // get the related overlay
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // more text
         $text .= Sections::to_xml($item, $overlay);
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
Ejemplo n.º 10
0
<?php

/*
 * Print edit folder
 *********************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database, false);
$Sections = new Sections($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->csrf_cookie("create", "folder");
# strip tags - XSS
$_POST = $User->strip_input_tags($_POST);
# validate action
$Admin->validate_action($_POST['action'], true);
# ID must be numeric
if ($_POST['action'] != "add") {
    if (!is_numeric($_POST['subnetId'])) {
        $Result->show("danger", _("Invalid ID"), true, true);
    }
}
# verify that user has permissions to add subnet
if ($_POST['action'] == "add") {
Ejemplo n.º 11
0
Archivo: links.php Proyecto: rair/yacs
 /**
  * reference another page at this site
  *
  * The function transforms a local reference (e.g;, [code][user=2][/code])
  * to an actual link relative to the YACS directory (e.g., [code]users/view.php/2[/code]),
  * adds a title and, sometimes, set a description as well.
  *
  * @param string any string, maybe with a local reference in it
  * @return an array($url, $title, $description) or NULL
  *
  * @see images/view.php
  * @see links/edit.php
  * @see shared/codes.php
  */
 public static function transform_reference($text)
 {
     global $context;
     // translate this reference to an internal link
     if (preg_match("/^\\[(article|section|file|image|category|user)=(.+?)\\]/i", $text, $matches)) {
         switch ($matches[1]) {
             // article link
             case 'article':
                 if ($item = Articles::get($matches[2])) {
                     return array(Articles::get_permalink($item), $item['title'], $item['introduction']);
                 }
                 return array('', $text, '');
                 // section link
             // section link
             case 'section':
                 if ($item = Sections::get($matches[2])) {
                     return array(Sections::get_permalink($item), $item['title'], $item['introduction']);
                 }
                 return array('', $text, '');
                 // file link
             // file link
             case 'file':
                 if ($item = Files::get($matches[2])) {
                     return array(Files::get_url($matches[2]), $item['title'] ? $item['title'] : str_replace('_', ' ', ucfirst($item['file_name'])));
                 }
                 return array('', $text, '');
                 // image link
             // image link
             case 'image':
                 include_once $context['path_to_root'] . 'images/images.php';
                 if ($item = Images::get($matches[2])) {
                     return array(Images::get_url($matches[2]), $item['title'] ? $item['title'] : str_replace('_', ' ', ucfirst($item['image_name'])));
                 }
                 return array('', $text, '');
                 // category link
             // category link
             case 'category':
                 if ($item = Categories::get($matches[2])) {
                     return array(Categories::get_permalink($item), $item['title'], $item['introduction']);
                 }
                 return array('', $text, '');
                 // user link
             // user link
             case 'user':
                 if ($item = Users::get($matches[2])) {
                     return array(Users::get_permalink($item), $item['full_name'] ? $item['full_name'] : $item['nick_name']);
                 }
                 return array('', $text, '');
         }
     }
     return array('', $text, '');
 }
Ejemplo n.º 12
0
    /**
     * Add document to binder
     * @param $docId
     */
    public static function addDocumentToBinder($docId)
    {
        $document = Documents::model()->findByPk($docId);
        if ($document) {
            $year = substr($document->Created, 0, 4);
            Storages::createProjectStorages($document->Project_ID, $year);
            $subsectionId = 0;
            if ($document->Document_Type == Documents::PM) {
                $payment = Payments::model()->findByAttributes(array(
                    'Document_ID' => $docId,
                ));
                $year = substr($payment->Payment_Check_Date, 0, 4);
                $subsectionId = Sections::createLogBinder($document->Project_ID, $document->Document_Type, $year);
            } elseif ($document->Document_Type == Documents::PO) {
                $po = Pos::model()->findByAttributes(array(
                    'Document_ID' => $docId,
                ));
                $year = substr($po->PO_Date, 0, 4);
                $subsectionId = Sections::createLogBinder($document->Project_ID, $document->Document_Type, $year);
                if ($po->PO_Backup_Document_ID != 0) {
                    $bu = LibraryDocs::model()->findByAttributes(array(
                        'Document_ID' => $po->PO_Backup_Document_ID,
                        'Subsection_ID' => $subsectionId,
                    ));
                    if (!$bu) {
                        $libDoc = new LibraryDocs();
                        $libDoc->Document_ID = $po->PO_Backup_Document_ID;
                        $libDoc->Subsection_ID = $subsectionId;
                        $libDoc->Access_Type = Storages::HAS_ACCESS;
                        $libDoc->Sort_Numb = 0;
                        if ($libDoc->validate()) {
                            $libDoc->save();
                        }
                    }
                }
            }

            $libDoc = LibraryDocs::model()->findByAttributes(array(
                'Document_ID' => $docId,
                'Subsection_ID' => $subsectionId,
            ));

            if (!$libDoc) {
                $libDoc = new LibraryDocs();
                $libDoc->Document_ID = $docId;
                $libDoc->Subsection_ID = $subsectionId;
                $libDoc->Access_Type = Storages::HAS_ACCESS;
                $libDoc->Sort_Numb = 0;
                if ($libDoc->validate()) {
                    $libDoc->save();
                }
            }

            LibraryDocs::sortDocumentsInSubsection($subsectionId);
        }
    }
Ejemplo n.º 13
0
Archivo: select.php Proyecto: rair/yacs
 // flag sections that are dead, or created or updated very recently
 if ($section['expiry_date'] > NULL_DATE && $section['expiry_date'] <= $context['now']) {
     $prefix .= EXPIRED_FLAG;
 } elseif ($section['create_date'] >= $context['fresh']) {
     $suffix .= NEW_FLAG;
 } elseif ($section['edit_date'] >= $context['fresh']) {
     $suffix .= UPDATED_FLAG;
 }
 // info on related comments
 if ($count = Comments::count_for_anchor('section:' . $section['id'], TRUE)) {
     $suffix .= ' (' . $count . ')';
 }
 // details
 $details = array();
 // info on related sections
 if ($count = Sections::count_for_anchor('section:' . $section['id'])) {
     $details[] = sprintf(i18n::ns('%d section', '%d sections', $count), $count);
 }
 // info on related articles
 if ($count = Articles::count_for_anchor('section:' . $section['id'])) {
     $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
 }
 // info on related files
 if ($count = Files::count_for_anchor('section:' . $section['id'], TRUE)) {
     $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
 }
 // info on related links
 if ($count = Links::count_for_anchor('section:' . $section['id'], TRUE)) {
     $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
 }
 // the parent link
Ejemplo n.º 14
0
require_once dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object, if not already set
if (!isset($Database)) {
    $Database = new Database_PDO();
}
if (!isset($User)) {
    $User = new User($Database);
}
if (!isset($Admin)) {
    $Admin = new Admin($Database);
}
if (!isset($Tools)) {
    $Tools = new Tools($Database);
}
if (!isset($Sections)) {
    $Sections = new Sections($Database);
}
if (!isset($Subnets)) {
    $Subnets = new Subnets($Database);
}
# verify that user is logged in, to guard against direct access of page and possible exploits
$User->check_user_session();
# Get mask check
#automated $cidrformat = isset($_GET['cidrformat']) ? $_GET['cidrformat'] : "off";
#separate option $rebuildmnr = isset($_GET['rebuildmnr']) ? $_GET['rebuildmnr'] : "off";
# read again the custom fields, if any
if (!isset($custom_fields)) {
    $custom_fields = $Tools->fetch_custom_fields("subnets");
}
# fetch all l2 domains
$vlan_domains = $Admin->fetch_all_objects("vlanDomains", "id");
Ejemplo n.º 15
0
Archivo: index.php Proyecto: rair/yacs
            $menu = array_merge($menu, Skin::navigate($home, $prefix, $count, $items_per_page, $page));
            // add a menu at the bottom
            $text .= Skin::build_list($menu, 'menu_bar');
        }
        // make a box
        if ($items) {
            $text .= Skin::build_box('', $items, 'header1', 'sections');
        }
        // associates may list specific sections as well
        if ($page == 1 && Surfer::is_associate()) {
            // load the layout to use
            $layout = Layouts::new_('yahoo', 'section');
            $layout->set_variant(20);
            // show more elements at the site map
            // query the database and layout that stuff
            if ($items = Sections::list_inactive_by_title_for_anchor(NULL, 0, 50, $layout)) {
                // we have an array to format
                if (is_array($items)) {
                    $items = Skin::build_list($items, '2-columns');
                }
                // displayed as another page section
                $text .= Skin::build_box(i18n::s('Other sections'), $items, 'header1', 'other_sections');
            }
        }
        // cache this to speed subsequent queries
        Cache::put($cache_id, $text, 'sections');
    }
    $context['text'] .= $text;
}
// the suffix hook for the site map page
if (is_callable(array('Hooks', 'include_scripts'))) {
Ejemplo n.º 16
0
 /**
  * Checks permission for specified subnet
  *
  *	we provide user details and subnetId
  *
  * @access public
  * @param object $user
  * @param int $subnetid
  * @return void
  */
 public function check_permission($user, $subnetId)
 {
     # get all user groups
     $groups = json_decode($user->groups, true);
     # if user is admin then return 3, otherwise check
     if ($user->role == "Administrator") {
         return 3;
     }
     # set subnet permissions
     $subnet = $this->fetch_subnet("id", $subnetId);
     if ($subnet === false) {
         return 0;
     }
     //null?
     if (is_null($subnet->permissions) || $subnet->permissions == "null") {
         return 0;
     }
     $subnetP = json_decode(@$subnet->permissions);
     # set section permissions
     $Section = new Sections($this->Database);
     $section = $Section->fetch_section("id", $subnet->sectionId);
     $sectionP = json_decode($section->permissions);
     # default permission
     $out = 0;
     # for each group check permissions, save highest to $out
     if (sizeof($sectionP) > 0) {
         foreach ($sectionP as $sk => $sp) {
             # check each group if user is in it and if so check for permissions for that group
             if (is_array($groups)) {
                 foreach ($groups as $uk => $up) {
                     if ($uk == $sk) {
                         if ($sp > $out) {
                             $out = $sp;
                         }
                     }
                 }
             }
         }
     } else {
         return 0;
     }
     # if section permission == 0 then return 0
     if ($out == 0) {
         return 0;
     } else {
         $out = 0;
         # ok, user has section access, check also for any higher access from subnet
         if (sizeof($subnetP) > 0) {
             foreach ($subnetP as $sk => $sp) {
                 # check each group if user is in it and if so check for permissions for that group
                 foreach ($groups as $uk => $up) {
                     if ($uk == $sk) {
                         if ($sp > $out) {
                             $out = $sp;
                         }
                     }
                 }
             }
         }
     }
     # return result
     return $out;
 }
Ejemplo n.º 17
0
<?php

/*
 * Script to print some stats on home page....
 *********************************************/
# required functions if requested via AJAX
if (!is_object(@$User)) {
    require dirname(__FILE__) . '/../../../functions/functions.php';
    # classes
    $Database = new Database_PDO();
    $User = new User($Database);
    $Tools = new Tools($Database);
    $Subnets = new Subnets($Database);
    $Sections = new Sections($Database);
    $Log = new Logging($Database);
    $Result = new Result();
}
# user must be authenticated
$User->check_user_session();
# if direct request that redirect to tools page
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
    header("Location: " . create_link("tools", "changelog"));
}
# changelog to syslog
if ($User->settings->log != "syslog") {
    /* get logs */
    $clogs = $Log->fetch_all_changelogs(false, "", 50);
}
# syslog
if ($User->settings->log == "syslog") {
    $Result->show("warning", _("Changelog files are sent to syslog"), false);
Ejemplo n.º 18
0
 /**
  * list sections
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!($delta = SQL::count($result))) {
         return $text;
     }
     // process all items in the list
     $count = 0;
     $items = array();
     while ($item = SQL::fetch($result)) {
         // the url to view this item
         $url = Sections::get_permalink($item);
         // initialize variables
         $prefix = $label = $suffix = '';
         // flag sections that are draft or dead
         if ($item['activation_date'] >= $context['now']) {
             $prefix .= DRAFT_FLAG;
         } elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG;
         }
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag items updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         //			// start the label with family, if any
         //			if($item['family'])
         //				$label = ucfirst(Skin::strip($item['family'], 30)).' - ';
         // use the title to label the link
         $label .= ucfirst(Skin::strip($item['title'], 30));
         // the hovering title
         if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
             $hover = strip_tags(Codes::beautify_introduction($item['introduction']));
         } else {
             $hover = i18n::s('View the section');
         }
         // help members to reference this page
         if (Surfer::is_member()) {
             $hover .= ' [section=' . $item['id'] . ']';
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'basic', NULL, $hover);
         // limit to one page of results
         if (++$count >= COMPACT_LIST_SIZE - 1) {
             break;
         }
     }
     // end of processing
     SQL::free($result);
     // turn this to some text
     $text .= Skin::build_list($items, 'comma');
     // some indications on the number of connections
     if (($delta -= $count) > 0) {
         $text .= ', ...';
     }
     return $text;
 }
Ejemplo n.º 19
0
<?php

/**
 *	Export search results
 ****************************/
# include required scripts
require dirname(__FILE__) . '/../../../functions/functions.php';
require dirname(__FILE__) . '/../../../functions/PEAR/Spreadsheet/Excel/Writer.php';
# initialize required objects
$Database = new Database_PDO();
$Result = new Result();
$User = new User($Database);
$Subnets = new Subnets($Database);
$Sections = new Sections($Database);
$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
# verify that user is logged in
$User->check_user_session();
# fetch search term
$search_term = $_REQUEST['search_term'];
//initialize Pear IPv6 object
require_once dirname(__FILE__) . '/../../../functions/PEAR/Net/IPv6.php';
$Net_IPv6 = new Net_IPv6();
// ipv6 ?
if ($Net_IPv6->checkIPv6($search_term) != false) {
    $type = "IPv6";
} elseif (strlen($search_term) == 17 && substr_count($search_term, ":") == 5) {
    $type = "mac";
    //count : -> must be 5
} else {
    if (strlen($search_term) == 12 && substr_count($search_term, ":") == 0 && substr_count($search_term, ".") == 0) {
Ejemplo n.º 20
0
<?php

session_start();
include '../class/config.php';
include '../class/class_sections.php';
$section = new Sections();
if (!isset($_SESSION['username'])) {
    header("Location: login.php");
}
//echo $_SESSION['admin_login'];
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = mysql_escape_string($_POST['name']);
    $course_id = mysql_escape_string($_POST['course_id']);
    $section->name = $name;
    $section->course_id = $course_id;
    $section->sectionAdd();
}
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>E-Blast</title>
Ejemplo n.º 21
0
Archivo: new.php Proyecto: rair/yacs
 $anchor = Sections::lookup('letters');
 // no section yet, create one
 if (!$anchor) {
     $context['text'] .= i18n::s('Creating a section for archived letters') . BR . "\n";
     $fields['nick_name'] = 'letters';
     $fields['title'] = i18n::c('Archived letters');
     $fields['introduction'] = i18n::c('To remember our previous messages');
     $fields['description'] = i18n::c('YACS puts automatically sent letters into this section.');
     $fields['locked'] = 'Y';
     // no direct contributions
     $fields['index_map'] = 'N';
     // listed only to associates
     $fields['rank'] = 30000;
     // at the end of the list
     // reference the new section
     if ($fields['id'] = Sections::post($fields, FALSE)) {
         $anchor = 'section:' . $fields['id'];
     }
 }
 // archive the letter
 $context['text'] .= i18n::s('Archiving the new letter') . BR . "\n";
 // save the letter as a published article, but don't use special categories
 $fields = array();
 $fields['anchor'] = $anchor;
 $fields['title'] = $_REQUEST['letter_title'];
 $label = $_REQUEST['letter_recipients'];
 if ($_REQUEST['letter_recipients'] == 'custom' && isset($_REQUEST['mail_to'])) {
     $label = $_REQUEST['mail_to'];
 }
 $fields['introduction'] = sprintf(i18n::c('Sent %s to&nbsp;"%s"'), Skin::build_date(time(), 'full', $context['preferred_language']), $label);
 $fields['description'] = $_REQUEST['letter_body'];
Ejemplo n.º 22
0
<?php

/*
 * Print select vlan in subnets
 *******************************/
/* required functions */
if (!is_object($User)) {
    /* functions */
    require dirname(__FILE__) . '/../../../functions/functions.php';
    # initialize user object
    $Database = new Database_PDO();
    $User = new User($Database);
    $Tools = new Tools($Database);
    $Sections = new Sections($Database);
    $Result = new Result();
}
# verify that user is logged in
$User->check_user_session();
# fetch all permitted domains
$permitted_nameservers = $Sections->fetch_section_nameserver_sets($_POST['sectionId']);
# fetch all belonging nameserver set
$cnt = 0;
# Only parse nameserver if any exists
if ($permitted_nameservers != false) {
    foreach ($permitted_nameservers as $k => $n) {
        // fetch nameserver sets and append
        $nameserver_set = $Tools->fetch_multiple_objects("nameservers", "id", $n, "name", "namesrv1", "namesrv2", "namesrv3");
        //save to array
        $nsout[$n] = $nameserver_set;
        //count add
        $cnt++;
Ejemplo n.º 23
0
<?php

/**
 * Function to add / edit / delete subnet
 ********************************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database, false);
$Subnets = new Subnets($Database);
$Sections = new Sections($Database);
$Addresses = new Addresses($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# ID must be numeric
if ($_POST['action'] == "add") {
    if (!is_numeric($_POST['sectionId'])) {
        $Result->show("danger", _("Invalid ID"), true);
    }
} else {
    if (!is_numeric($_POST['subnetId'])) {
        $Result->show("danger", _("Invalid ID"), true);
    }
    if (!is_numeric($_POST['sectionId'])) {
        $Result->show("danger", _("Invalid ID"), true);
    }
}
Ejemplo n.º 24
0
<?php

/**
 * Function to add / edit / delete section
 *************************************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Sections = new Sections($Database);
$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# If confirm is not set print delete warning
if ($_POST['action'] == "delete" && !isset($_POST['deleteconfirm'])) {
    //for ajax to prevent reload
    print "<div style='display:none'>alert alert-danger</div>";
    //result
    print "<div class='alert alert-warning'>";
    //fetch all subsections
    $subsections = $Sections->fetch_subsections($_POST['id']);
    //print what will be deleted
    if (sizeof($subsections) > 0) {
        $subnets = $Subnets->fetch_section_subnets($_POST['id']);
        //fetch all subnets in section
        $num_subnets = sizeof($subnets);
        //number of subnets to be deleted
Ejemplo n.º 25
0
 /**
  * render a compact list of voted pages
  *
  * @param string the anchor (e.g. 'section:123')
  * @param string layout to use
  * @return string the rendered text
  **/
 public static function render_voted($anchor = '', $layout = 'simple')
 {
     global $context;
     // we return some text;
     $text = '';
     // number of items to display
     $count = COMPACT_LIST_SIZE;
     if (($position = strpos($anchor, ',')) !== FALSE) {
         $count = (int) trim(substr($anchor, $position + 1));
         if (!$count) {
             $count = COMPACT_LIST_SIZE;
         }
         $anchor = trim(substr($anchor, 0, $position));
     }
     // scope is limited to current surfer
     if ($anchor == 'self' && Surfer::get_id()) {
         $anchor = 'user:'******'section:') === 0) {
         // look at this branch of the content tree
         $anchors = Sections::get_branch_at_anchor($anchor);
         // query the database and layout that stuff
         $text =& Articles::list_for_anchor_by('rating', $anchors, 0, $count, $layout);
         // scope is limited to pages of one surfer
     } elseif (strpos($anchor, 'user:'******'rating', substr($anchor, 5), 0, $count, $layout);
     } else {
         $text =& Articles::list_by('rating', 0, $count, $layout);
     }
     // we have an array to format
     if (is_array($text)) {
         $text =& Skin::build_list($text, $layout);
     }
     // job done
     return $text;
 }
Ejemplo n.º 26
0
 function updateSelectedSections($changed_sections)
 {
     $selected_sections = $this->getSections();
     // look for added sections
     foreach ($changed_sections as $changed_section) {
         $found = false;
         foreach ($selected_sections as $selected_section) {
             if ($selected_section->id == $changed_section) {
                 $found = true;
             }
         }
         if (!$found) {
             $tmp_section = Sections::FindById($changed_section);
             $this->attach($tmp_section);
         }
     }
     // look for deleted areas
     foreach ($selected_sections as $selected_section) {
         if (!in_array($selected_section->id, $changed_sections)) {
             //the user has removed this area
             $tmp_section = Sections::FindById($selected_section->id);
             $this->detach($tmp_section);
         }
     }
 }
    $sections = Sections::where('name_of_section', '=', Input::get('name_of_section'))->first();
    $path = public_path() . '\\' . 'sections\\' . Input::get('shortname');
    $section = ['name_of_section' => Input::get('name_of_section'), 'sub_section' => Input::get('sub_section'), 'shortname' => Input::get('shortname'), 'section_url' => $path];
    $sections = ['name_of_section' => Input::get('name_of_section'), 'sub_section' => Input::get('sub_section'), 'shortname' => Input::get('shortname')];
    $rule = array('name_of_section' => 'required', 'shortname' => 'required');
    $validator = Validator::make($sections, $rule);
    if ($validator->fails()) {
        return Redirect::to('/section')->withErrors($validator->messages());
    } else {
        if (Input::get('sub_section') != "CWC References" && Input::get('sub_section') != "CWC Calculators") {
            //echo "Not ready";
            File::makeDirectory($path, $mode = 0777, true, true);
        } else {
            //echo "ready";
        }
        $sectionData = new Sections($section);
        $sectionData->save();
        return Redirect::to('/section')->withMessage('Section created');
    }
});
Route::post('editSectionValue', function () {
    $sections = Sections::where('id', '=', Input::get('id'))->first();
    $pages = Pages::where('page_section', '=', $sections->name_of_section)->get();
    $array = (array) $pages;
    $path = public_path() . '\\' . 'sections\\' . Input::get('shortname');
    $Uploadpath = public_path() . '\\' . 'uploads\\' . $sections->shortname;
    $section = ['name_of_section' => Input::get('name_of_section'), 'sub_section' => Input::get('sub_section'), 'shortname' => Input::get('shortname'), 'section_url' => $path];
    $sectionValues = ['name_of_section' => Input::get('name_of_section'), 'sub_section' => Input::get('sub_section'), 'shortname' => Input::get('shortname')];
    $rule = array('name_of_section' => 'required', 'shortname' => 'required');
    $validator = Validator::make($sectionValues, $rule);
    if ($validator->fails()) {
Ejemplo n.º 28
0
 /**
  * list sections as topics in a forum
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // layout in a table
     $text = Skin::table_prefix('wide');
     // 'even' is used for title rows, 'odd' for detail rows
     $class_title = 'odd';
     $class_detail = 'even';
     // build a list of sections
     $family = '';
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // change the family
         if ($item['family'] != $family) {
             $family = $item['family'];
             // show the family
             $text .= Skin::table_suffix() . '<h2><span>' . $family . '&nbsp;</span></h2>' . "\n" . Skin::table_prefix('wide');
         }
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // reset everything
         $prefix = $label = $suffix = $icon = '';
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // indicate the id in the hovering popup
         $hover = i18n::s('View the section');
         if (Surfer::is_member()) {
             $hover .= ' [section=' . $item['id'] . ']';
         }
         // the url to view this item
         $url = Sections::get_permalink($item);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // use the title as a link to the page
         $title =& Skin::build_link($url, $title, 'basic', $hover);
         // flag sections updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $suffix = EXPIRED_FLAG . ' ';
         } elseif ($item['create_date'] >= $context['fresh']) {
             $suffix = NEW_FLAG . ' ';
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix = UPDATED_FLAG . ' ';
         }
         // this is another row of the output
         $text .= '<tr class="' . $class_title . '"><th>' . $prefix . $title . $suffix . '</th><th>' . i18n::s('Poster') . '</th><th>' . i18n::s('Messages') . '</th><th>' . i18n::s('Last active') . '</th></tr>' . "\n";
         $count = 1;
         // get last posts for this board --avoid sticky pages
         if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
             $order = $matches[1];
         } else {
             $order = 'edition';
         }
         if ($articles =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], 0, 5, 'raw', TRUE)) {
             foreach ($articles as $id => $article) {
                 // get the related overlay, if any
                 $article_overlay = Overlay::load($article, 'article:' . $id);
                 // flag articles updated recently
                 if ($article['expiry_date'] > NULL_DATE && $article['expiry_date'] <= $context['now']) {
                     $flag = EXPIRED_FLAG . ' ';
                 } elseif ($article['create_date'] >= $context['fresh']) {
                     $flag = NEW_FLAG . ' ';
                 } elseif ($article['edit_date'] >= $context['fresh']) {
                     $flag = UPDATED_FLAG . ' ';
                 } else {
                     $flag = '';
                 }
                 // use the title to label the link
                 if (is_object($article_overlay)) {
                     $title = Codes::beautify_title($article_overlay->get_text('title', $article));
                 } else {
                     $title = Codes::beautify_title($article['title']);
                 }
                 // title
                 $title = Skin::build_link(Articles::get_permalink($article), $title, 'article');
                 // poster
                 $poster = Users::get_link($article['create_name'], $article['create_address'], $article['create_id']);
                 // comments
                 $comments = Comments::count_for_anchor('article:' . $article['id']);
                 // last editor
                 $action = '';
                 if ($article['edit_date']) {
                     // label the action
                     if (isset($article['edit_action'])) {
                         $action = Anchors::get_action_label($article['edit_action']);
                     } else {
                         $action = i18n::s('edited');
                     }
                     $action = '<span class="details">' . $action . ' ' . Skin::build_date($article['edit_date']) . '</span>';
                 }
                 // this is another row of the output
                 $text .= '<tr class="' . $class_detail . '"><td>' . $title . $flag . '</td><td>' . $poster . '</td><td style="text-align: center;">' . $comments . '</td><td>' . $action . '</td></tr>' . "\n";
             }
         }
         // more details
         $details = array();
         // board introduction
         if ($item['introduction']) {
             $details[] = Codes::beautify_introduction($item['introduction']);
         }
         // indicate the total number of threads here
         if (($count = Articles::count_for_anchor('section:' . $item['id'])) && $count >= 5) {
             $details[] = sprintf(i18n::s('%d threads'), $count) . '&nbsp;&raquo;';
         }
         // link to the section index page
         if ($details) {
             $details = Skin::build_link(Sections::get_permalink($item), join(' -&nbsp;', $details), 'basic');
         } else {
             $details = '';
         }
         // add a command for new post
         $poster = '';
         if (Surfer::is_empowered()) {
             $poster = Skin::build_link('articles/edit.php?anchor=' . urlencode('section:' . $item['id']), i18n::s('Add a page') . '&nbsp;&raquo;', 'basic');
         }
         // insert details in a separate row
         if ($details || $poster) {
             $text .= '<tr class="' . $class_detail . '"><td colspan="3">' . $details . '</td><td>' . $poster . '</td></tr>' . "\n";
         }
         // more details
         $more = array();
         // board moderators
         if ($moderators = Sections::list_editors_by_name($item, 0, 7, 'comma5')) {
             $more[] = sprintf(i18n::ns('Moderator: %s', 'Moderators: %s', count($moderators)), $moderators);
         }
         // children boards
         if ($children =& Sections::list_by_title_for_anchor('section:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
             $more[] = sprintf(i18n::ns('Child board: %s', 'Child boards: %s', count($children)), Skin::build_list($children, 'comma'));
         }
         // as a compact list
         if (count($more)) {
             $content = '<ul class="compact">';
             foreach ($more as $list_item) {
                 $content .= '<li>' . $list_item . '</li>' . "\n";
             }
             $content .= '</ul>' . "\n";
             // insert details in a separate row
             $text .= '<tr class="' . $class_detail . '"><td colspan="4">' . $content . '</td></tr>' . "\n";
         }
     }
     // end of processing
     SQL::free($result);
     $text .= Skin::table_suffix();
     return $text;
 }
Ejemplo n.º 29
0
<?php

/*
 * Print edit subnet
 *********************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Sections = new Sections($Database);
$Subnets = new Subnets($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# ID must be numeric
if (!is_numeric($_POST['subnetId'])) {
    $Result->show("danger", _("Invalid ID"), true, true);
}
# get all groups
$groups = $Admin->fetch_all_objects("userGroups", "g_id");
# get subnet details
$subnet = $Subnets->fetch_subnet(null, $_POST['subnetId']);
?>


<script type="text/javascript">
$(document).ready(function() {
/* bootstrap switch */
var switch_options = {
Ejemplo n.º 30
0
if (!$item['id']) {
    include '../error.php';
    // access denied
} elseif (!Sections::allow_access($item, $anchor)) {
    // give anonymous surfers a chance for HTTP authentication
    if (!Surfer::is_logged()) {
        Safe::header('WWW-Authenticate: Basic realm="' . utf8::to_iso8859($context['site_name']) . '"');
        Safe::header('Status: 401 Unauthorized', TRUE, 401);
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // describe the section
} else {
    // compute the url for this section
    $url = Sections::get_permalink($item);
    // get a description
    if ($item['introduction']) {
        $description = Codes::beautify($item['introduction']);
    } else {
        $description = Skin::strip(Codes::beautify($item['description']), 50);
    }
    // prepare the response
    $text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n" . '	<rdf:Description rdf:about="' . $url . '">' . "\n" . '		<dc:title>' . encode_field($item['title']) . '</dc:title>' . "\n" . '		<dc:description>' . encode_field(Skin::strip($description)) . '</dc:description>' . "\n" . '		<dc:date>' . gmdate('Y-m-d') . '</dc:date>' . "\n" . '		<dc:format>text/html</dc:format>' . "\n";
    if (isset($item['language']) && $item['language'] && $item['language'] != 'none') {
        $text .= '		<dc:language>' . $item['language'] . '</dc:language>' . "\n";
    }
    $text .= '	</rdf:Description>' . "\n" . '</rdf:RDF>';
    //
    // transfer to the user agent
    //