public function manage_messages()
 {
     expHistory::set('manageable', $this->params);
     $page = new expPaginator(array('model' => 'order_status_messages', 'controller' => $this->params['controller'], 'action' => $this->params['action'], 'where' => 1, 'order' => 'body'));
     //eDebug($page);
     assign_to_template(array('page' => $page));
 }
Esempio n. 2
0
 function manage()
 {
     global $db;
     expHistory::set('manageable', $this->params);
     $classes = array();
     $dir = BASE . "framework/modules/ecommerce/billingcalculators";
     if (is_readable($dir)) {
         $dh = opendir($dir);
         while (($file = readdir($dh)) !== false) {
             if (is_file("{$dir}/{$file}") && substr("{$dir}/{$file}", -4) == ".php") {
                 include_once "{$dir}/{$file}";
                 $classname = substr($file, 0, -4);
                 $id = $db->selectValue('billingcalculator', 'id', 'calculator_name="' . $classname . '"');
                 if (empty($id)) {
                     $calobj = null;
                     $calcobj = new $classname();
                     if ($calcobj->isSelectable() == true) {
                         $obj = new billingcalculator(array('title' => $calcobj->name(), 'user_title' => $calcobj->title, 'body' => $calcobj->description(), 'calculator_name' => $classname, 'enabled' => false));
                         $obj->save();
                     }
                 }
             }
         }
     }
     $bcalc = new billingcalculator();
     $calculators = $bcalc->find('all');
     assign_to_template(array('calculators' => $calculators));
 }
 function manage_vendors()
 {
     expHistory::set('viewable', $this->params);
     $vendor = new vendor();
     $vendors = $vendor->find('all');
     assign_to_template(array('vendors' => $vendors));
 }
Esempio n. 4
0
 function showByTitle()
 {
     global $db, $user, $router;
     //eDebug($this->params,true);
     expHistory::set('viewable', $this->params);
     $count_sql_start = 'SELECT COUNT(DISTINCT p.id) FROM ' . DB_TABLE_PREFIX . '_product p ';
     $sql_start = 'SELECT DISTINCT p.* FROM ' . DB_TABLE_PREFIX . '_product p ';
     //$sql = 'JOIN '.DB_TABLE_PREFIX.'_product_storeCategories sc ON p.id = sc.product_id ';
     $sql = 'WHERE ';
     if (!($user->is_admin || $user->is_acting_admin)) {
         $sql .= '(p.active_type=0 OR p.active_type=1) AND ';
     }
     //$sql .= 'sc.storecategories_id IN (';
     //$sql .= 'SELECT id FROM '.DB_TABLE_PREFIX.'_storeCategories WHERE rgt BETWEEN '.$this->category->lft.' AND '.$this->category->rgt.')';
     $sql .= 'p.companies_id=' . $this->params['id'];
     $count_sql = $count_sql_start . $sql;
     $sql = $sql_start . $sql;
     //eDebug($sql);
     $order = 'p.id';
     //$this->config['orderby'];
     $dir = 'DESC';
     $this->config['orderby_dir'];
     //eDebug($this->config);
     $page = new expPaginator(array('model_field' => 'product_type', 'sql' => $sql, 'count_sql' => $count_sql, 'limit' => $this->config['pagination_default'], 'order' => $order, 'dir' => $dir, 'controller' => $this->params['controller'], 'action' => $this->params['action'], 'columns' => array('Model #' => 'model', 'Product Name' => 'title', 'Price' => 'base_price')));
     //$ancestors = $this->category->pathToNode();
     //$categories = ($this->parent == 0) ? $this->category->getTopLevel(null,false,true) : $this->category->getChildren(null,false,true);
     //eDebug($page);
     //$rerankSQL = "SELECT DISTINCT p.* FROM ".DB_TABLE_PREFIX."_product p JOIN ".DB_TABLE_PREFIX."_product_storeCategories sc ON  p.id = sc.product_id WHERE sc.storecategories_id=".$this->category->id." ORDER BY rank ASC";
     //eDebug($router);
     $defaultSort = $router->current_url;
     assign_to_template(array('record' => new company($this->params['id']), 'page' => $page, 'defaultSort' => $defaultSort));
 }
Esempio n. 5
0
 function showall()
 {
     expHistory::set('viewable', $this->params);
     $causes = $this->donation->find('all');
     //eDebug($causes);
     assign_to_template(array('causes' => $causes));
 }
Esempio n. 6
0
 public function ask_question()
 {
     global $user;
     expHistory::set('editable', $this->params);
     //        if ($user->isAdmin()) {
     //            redirect_to(array('controller'=>'faq', 'action'=>'edit', 'src'=>$this->loc->src));
     //        }
 }
Esempio n. 7
0
 public function slideshow()
 {
     expHistory::set('viewable', $this->params);
     $where = $this->aggregateWhereClause();
     $order = 'rank';
     $s = new photo();
     $slides = $s->find('all', $where, $order);
     assign_to_template(array('slides' => $slides));
 }
 function showall()
 {
     expHistory::set('viewable', $this->params);
     $modelname = $this->basemodel_name;
     $where = $this->aggregateWhereClause();
     $limit = isset($this->params['limit']) ? $this->params['limit'] : null;
     $order = "rank";
     $page = new expPaginator(array('model' => $modelname, 'where' => $where, 'limit' => $limit, 'order' => $order, 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('ID#' => 'id', 'Title' => 'title', 'Body' => 'body')));
     assign_to_template(array('page' => $page, 'items' => $page->records));
 }
Esempio n. 9
0
 public function manage()
 {
     expHistory::set('manageable', $this->params);
     // build out a SQL query that gets all the data we need and is sortable.
     $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';
     $sql .= 'FROM ' . DB_TABLE_PREFIX . '_banner b, ' . DB_TABLE_PREFIX . '_companies c , ' . DB_TABLE_PREFIX . '_content_expFiles f ';
     $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type="banner")';
     $page = new expPaginator(array('model' => 'banner', 'controller' => $this->params['controller'], 'action' => $this->params['action'], 'sql' => $sql, 'order' => 'title', 'columns' => array('Title' => 'title', 'Company' => 'companyname', 'Impressions' => 'impressions', 'Clicks' => 'clicks')));
     assign_to_template(array('page' => $page));
 }
Esempio n. 10
0
 function showall()
 {
     expHistory::set('viewable', $this->params);
     $modelname = $this->basemodel_name;
     $where = $this->hasSources() ? $this->aggregateWhereClause() : null;
     $limit = isset($this->config['limit']) ? $this->config['limit'] : null;
     $order = isset($this->config['order']) ? $this->config['order'] : "rank";
     $links = $this->{$modelname}->find('all', $where, $order, $limit);
     assign_to_template(array('items' => $links, 'rank' => $order === 'rank' ? 1 : 0));
 }
Esempio n. 11
0
 public function showUnpublished()
 {
     expHistory::set('viewable', $this->params);
     $modelname = $this->basemodel_name;
     // setup the where clause for looking up records.
     $where = "(unpublish != 0 AND unpublish < " . time() . ") OR (publish > " . time() . ")";
     $where .= "AND " . $this->aggregateWhereClause();
     $page = new expPaginator(array('model' => 'news', 'where' => $where, 'limit' => 25, 'order' => 'unpublish', 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('Title' => 'title', 'Published On' => 'publish', 'Status' => 'unpublish')));
     assign_to_template(array('page' => $page));
 }
Esempio n. 12
0
 public function showall_highlight()
 {
     expHistory::set('viewable', $this->params);
     $where = $this->aggregateWhereClause();
     $order = 'rank ASC';
     //		$items = $this->text->find('all', $where, $order);
     $items = $this->snippet->find('all', $where, $order);
     foreach ($items as $item) {
         $item->body = highlight_string($item->body, true);
     }
     assign_to_template(array('items' => $items));
 }
 function view_registrants()
 {
     expHistory::set('viewable', $this->params);
     $event = new eventregistration($this->params['id']);
     //eDebug($event);
     //eDebug("a:" . isset($event->registrants));
     //eDebug("b:" . is_array($event->registrants));
     if (isset($event->registrants)) {
         $registrants = expUnserialize($event->registrants);
     } else {
         $registrants = null;
     }
     //eDebug($registrants);
     assign_to_template(array('event' => $event, 'registrants' => $registrants));
 }
Esempio n. 14
0
 /**
  * manage tags
  */
 function manage()
 {
     global $db;
     expHistory::set('manageable', $this->params);
     $modelname = $this->basemodel_name;
     $where = $this->hasSources() ? $this->aggregateWhereClause() : null;
     $order = "title";
     $page = new expPaginator(array('model' => $modelname, 'where' => $where, 'limit' => 50, 'order' => $order, 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'src' => $this->hasSources() == true ? $this->loc->src : null, 'columns' => array('ID#' => 'id', 'Title' => 'title', 'Body' => 'body')));
     foreach ($db->selectColumn('content_expTags', 'content_type', null, null, true) as $contenttype) {
         foreach ($page->records as $key => $value) {
             $attatchedat = $page->records[$key]->findWhereAttachedTo($contenttype);
             if (!empty($attatchedat)) {
                 $page->records[$key]->attachedcount = @$page->records[$key]->attachedcount + count($attatchedat);
                 $page->records[$key]->attached[$contenttype] = $attatchedat;
             }
         }
     }
     assign_to_template(array('page' => $page));
 }
Esempio n. 15
0
 /**
  * generic config action
  */
 function configure()
 {
     expHistory::set('editable', $this->params);
     $pullable_modules = expModules::listInstalledControllers($this->classname, $this->loc);
     $views = get_config_templates($this, $this->loc);
     $page = new expPaginator(array('records' => $pullable_modules, 'limit' => count($pullable_modules), 'order' => 'section', 'columns' => array('Title' => 'title', 'Page' => 'section')));
     assign_to_template(array('config' => $this->config, 'pullable_modules' => $pullable_modules, 'page' => $page, 'views' => $views));
 }
 function configure()
 {
     expHistory::set('editable', $this->params);
     // little bit of trickery so that that categories can have their own configs
     $this->loc->src = "@store-" . $this->params['id'];
     $config = new expConfig($this->loc);
     $this->config = $config->config;
     $pullable_modules = expModules::listInstalledControllers($this->classname, $this->loc);
     $views = get_config_templates($this, $this->loc);
     assign_to_template(array('config' => $this->config, 'pullable_modules' => $pullable_modules, 'views' => $views));
 }
Esempio n. 17
0
 /** exdoc
  * Useful only if theme does not use self::main
  *
  * @return
  * @internal param bool $public Whether or not the page is public.
  * @node     Subsystems:Theme
  */
 public static function mainContainer()
 {
     global $router;
     if (!AUTHORIZED_SECTION) {
         // Set this so that a login on an Auth Denied page takes them back to the previously Auth-Denied page
         //			expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);
         expHistory::set('manageable', $router->params);
         echo SITE_403_HTML;
         return;
     }
     if (PUBLIC_SECTION) {
         //			expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_SECTIONAL);
         expHistory::set('viewable', $router->params);
     } else {
         //			expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_SECTIONAL);
         expHistory::set('manageable', $router->params);
     }
     #   if (expSession::is_set("themeopt_override")) {
     #       $config = expSession::get("themeopt_override");
     self::showSectionalModule("containermodule", "Default", "", "@section", false, true);
     //FIXME change to showModule call
     #   } else {
     #       self::showSectionalModule("containermodule","Default","","@section");
     #   }
 }
Esempio n. 18
0
 function configure()
 {
     expHistory::set('editable', $this->params);
     // little bit of trickery so that that categories can have their own configs
     $this->loc->src = "@globalstoresettings";
     $config = new expConfig($this->loc);
     $this->config = $config->config;
     $pullable_modules = expModules::listInstalledControllers($this->classname, $this->loc);
     $views = get_config_templates($this, $this->loc);
     $gc = new geoCountry();
     $countries = $gc->find('all');
     $gr = new geoRegion();
     $regions = $gr->find('all');
     assign_to_template(array('config' => $this->config, 'pullable_modules' => $pullable_modules, 'views' => $views, 'countries' => $countries, 'regions' => $regions));
 }
Esempio n. 19
0
 public function approve()
 {
     expHistory::set('editable', $this->params);
     /* The global constants can be overriden by passing appropriate params */
     //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
     $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
     $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
     $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
     $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
     if (empty($this->params['id'])) {
         flash('error', gt('No ID supplied for comment to approve'));
         expHistory::back();
     }
     $comment = new expComment($this->params['id']);
     assign_to_template(array('comment' => $comment));
 }
Esempio n. 20
0
 function edit()
 {
     global $db;
     //Make sure that the view is the edit.tpl and not any ajax views
     if (isset($this->params['view']) && $this->params['view'] == 'edit') {
         expHistory::set('editable', $this->params);
     }
     // first we need to figure out what type of ecomm product we are dealing with
     if (!empty($this->params['id'])) {
         // if we have an id lets pull the product type from the products table.
         $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);
     } else {
         if (empty($this->params['product_type'])) {
             redirect_to(array('controller' => 'store', 'action' => 'picktype'));
         }
         $product_type = $this->params['product_type'];
     }
     if (!empty($this->params['id'])) {
         $record = new $product_type($this->params['id']);
         if (!empty($this->user_input_fields) && !is_array($record->user_input_fields)) {
             $record->user_input_fields = expUnserialize($record->user_input_fields);
         }
     } else {
         $record = new $product_type();
         $record->user_input_fields = array();
     }
     //        if (!empty($this->params['parent_id']))
     // get the product options and send them to the form
     $editable_options = array();
     //$og = new optiongroup();
     $mastergroups = $db->selectExpObjects('optiongroup_master', null, 'optiongroup_master');
     //eDebug($mastergroups,true);
     foreach ($mastergroups as $mastergroup) {
         // if this optiongroup_master has already been made into an option group for this product
         // then we will grab that record now..if not, we will make a new one.
         $grouprec = $db->selectArray('optiongroup', 'optiongroup_master_id=' . $mastergroup->id . ' AND product_id=' . $record->id);
         //if ($mastergroup->id == 9) eDebug($grouprec,true);
         //eDebug($grouprec);
         if (empty($grouprec)) {
             $grouprec['optiongroup_master_id'] = $mastergroup->id;
             $grouprec['title'] = $mastergroup->title;
             $group = new optiongroup($grouprec);
         } else {
             $group = new optiongroup($grouprec['id']);
         }
         $editable_options[$group->title] = $group;
         if (empty($group->option)) {
             foreach ($mastergroup->option_master as $optionmaster) {
                 $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);
                 $editable_options[$group->title]->options[] = $opt;
             }
         } else {
             if (count($group->option) == count($mastergroup->option_master)) {
                 $editable_options[$group->title]->options = $group->option;
             } else {
                 // check for any new options or deleted since the last time we edited this product
                 foreach ($mastergroup->option_master as $optionmaster) {
                     $opt_id = $db->selectValue('option', 'id', 'option_master_id=' . $optionmaster->id . " AND product_id=" . $record->id);
                     if (empty($opt_id)) {
                         $opt = new option(array('title' => $optionmaster->title, 'option_master_id' => $optionmaster->id), false, false);
                     } else {
                         $opt = new option($opt_id);
                     }
                     $editable_options[$group->title]->options[] = $opt;
                 }
             }
         }
         //eDebug($editable_options[$group->title]);
     }
     //die();
     uasort($editable_options, array("optiongroup", "sortOptiongroups"));
     // get the shipping options and their methods
     $shipping = new shipping();
     foreach ($shipping->available_calculators as $calcid => $name) {
         $calc = new $name($calcid);
         $shipping_services[$calcid] = $calc->title;
         $shipping_methods[$calcid] = $calc->availableMethods();
     }
     #        eDebug($shipping_services);
     #        eDebug($shipping_methods);
     if ($this->params['product_type'] == "product" || $this->params['product_type'] == "childProduct") {
         //if new record and it's a child, then well set the child rank to be at the end
         if (empty($record->id) && $record->isChild()) {
             $record->child_rank = $db->max('product', 'child_rank', null, 'parent_id=' . $record->parent_id) + 1;
         }
         //eDebug($record,true);
     }
     $view = '';
     $parent = null;
     if (isset($this->params['parent_id']) && empty($record->id)) {
         //NEW child product
         $view = 'edit';
         $parent = new $product_type($this->params['parent_id'], false, true);
         $record->parent_id = $this->params['parent_id'];
     } elseif (!empty($record->id) && $record->parent_id != 0) {
         //EDIT child product
         $view = 'edit';
         $parent = new $product_type($record->parent_id, false, true);
     } else {
         $view = 'edit';
     }
     assign_to_template(array('record' => $record, 'parent' => $parent, 'form' => $record->getForm($view), 'optiongroups' => $editable_options, 'shipping_services' => isset($shipping_services) ? $shipping_services : '', 'shipping_methods' => isset($shipping_methods) ? $shipping_methods : '', 'product_types' => isset($this->config['product_types']) ? $this->config['product_types'] : ''));
 }
Esempio n. 21
0
 /**
  * Create or Edit details about a help version
  */
 public function edit_version()
 {
     expHistory::set('editable', $this->params);
     $id = empty($this->params['id']) ? null : $this->params['id'];
     $version = new help_version($id);
     assign_to_template(array('record' => $version));
 }
Esempio n. 22
0
 public function show()
 {
     global $template;
     expHistory::set('viewable', $this->params);
     $id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];
     $blog = new blog($id);
     // since we are probably getting here via a router mapped url
     // some of the links (tags in particular) require a source, we will
     // populate the location data in the template now.
     $loc = expUnserialize($blog->location_data);
     assign_to_template(array('__loc' => $loc, 'record' => $blog));
 }
Esempio n. 23
0
# This file is part of Exponent
#
# 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
#
##################################################
/** @define "BASE" "../../../.." */
if (!defined('EXPONENT')) {
    exit('');
}
expHistory::set('editable', array("module" => "containermodule", "action" => "edit"));
$container = null;
$iloc = null;
$cloc = null;
if (isset($_GET['id'])) {
    $container = $db->selectObject('container', 'id=' . intval($_GET['id']));
    if ($container != null) {
        $iloc = unserialize($container->internal);
        $cloc = unserialize($container->external);
        $cloc->int = $container->id;
    }
} else {
    $container->rank = $_GET['rank'];
}
$loc->src = urldecode($loc->src);
if (expPermissions::check('edit_module', $loc) || expPermissions::check('add_module', $loc) || $iloc != null && expPermissions::check('administrate', $iloc) || $cloc != null && expPermissions::check('delete_module', $cloc)) {
Esempio n. 24
0
 public function manage_group_memberships()
 {
     global $db, $user;
     expHistory::set('manageable', $this->params);
     $memb = $db->selectObject('groupmembership', 'member_id=' . $user->id . ' AND group_id=' . $this->params['id'] . ' AND is_admin=1');
     $perm_level = 0;
     if ($memb) {
         $perm_level = 1;
     }
     if (expPermissions::check('user_management', expCore::makeLocation('administrationmodule'))) {
         $perm_level = 2;
     }
     $group = $db->selectObject('group', 'id=' . $this->params['id']);
     $users = user::getAllUsers(0);
     $members = array();
     $admins = array();
     foreach ($db->selectObjects('groupmembership', 'group_id=' . $group->id) as $m) {
         $members[] = $m->member_id;
         if ($m->is_admin == 1) {
             $admins[] = $m->member_id;
         }
     }
     for ($i = 0; $i < count($users); $i++) {
         if (in_array($users[$i]->id, $members)) {
             $users[$i]->is_member = 1;
         } else {
             $users[$i]->is_member = 0;
         }
         if (in_array($users[$i]->id, $admins)) {
             $users[$i]->is_admin = 1;
         } else {
             $users[$i]->is_admin = 0;
         }
     }
     //$limit = empty($this->config['limit']) ? 10 : $this->config['limit'];
     $order = empty($this->config['order']) ? 'username' : $this->config['order'];
     $page = new expPaginator(array('records' => $users, 'where' => 1, 'limit' => 9999, 'order' => $order, 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('Username' => 'username', 'First Name' => 'firstname', 'Last Name' => 'lastname', 'Is Member' => 'is_member', 'Is Admin' => 'is_admin')));
     assign_to_template(array('page' => $page, 'group' => $group, 'users' => $users, 'canAdd' => count($members) < count($users) ? 1 : 0, 'hasMember' => count($members) > 0 ? 1 : 0, 'perm_level' => $perm_level));
 }
Esempio n. 25
0
 function configure()
 {
     expHistory::set('editable', $this->params);
     $this->loc->src = "@globalcartsettings";
     $config = new expConfig($this->loc);
     $this->config = $config->config;
     assign_to_template(array('config' => $this->config));
 }
Esempio n. 26
0
# 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
#
##################################################
// Part of the Extensions category
if (!defined('EXPONENT')) {
    exit('');
}
global $router;
if (expPermissions::check('extensions', expCore::makeLocation('administrationmodule'))) {
    //	expHistory::flowSet(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
    expHistory::set('manageable', $router->params);
    // get new bots into the database
    if (is_readable(BASE . 'framework/modules-1/bots/bots')) {
        $dh = opendir(BASE . 'framework/modules-1/bots/bots');
        while (($file = readdir($dh)) !== false) {
            $botfile = BASE . 'framework/modules-1/bots/bots/' . $file;
            if (is_file($botfile) && is_readable($botfile) && substr($file, -4) == '.php') {
                include_once $botfile;
                $botname = substr($file, 0, -4);
                $bot = $db->selectObject('bots', "name='" . $botname . "'");
                if (empty($bot)) {
                    $botobj = new $botname();
                    $bot = null;
                    $bot->name = $botname;
                    $bot->state = 0;
                    $bot->displayname = $botobj->displayname();
Esempio n. 27
0
 public function showall_by_tags()
 {
     global $db;
     // set history
     expHistory::set('viewable', $this->params);
     // get the tag being passed
     $tag = new expTag($this->params['tag']);
     // find all the id's of the blog posts for this blog module
     $port_ids = $db->selectColumn('portfolio', 'id', $this->aggregateWhereClause());
     // find all the blogs that this tag is attached to
     $ports = $tag->findWhereAttachedTo('portfolio');
     // loop the blogs for this tag and find out which ones belong to this module
     $ports_by_tags = array();
     foreach ($ports as $port) {
         if (in_array($port->id, $port_ids)) {
             $ports_by_tags[] = $port;
         }
     }
     // create a pagination object for the blog posts and render the action
     $order = 'created_at';
     $limit = empty($this->config['limit']) ? 10 : $this->config['limit'];
     $page = new expPaginator(array('records' => $ports_by_tags, 'limit' => $limit, 'order' => $order, 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('Title' => 'title')));
     $page->records = expSorter::sort(array('array' => $page->records, 'sortby' => 'rank', 'order' => 'ASC', 'ignore_case' => true));
     assign_to_template(array('page' => $page));
 }
Esempio n. 28
0
 public function showall()
 {
     expHistory::set('viewable', $this->params);
     // if no RSS feed is set yet get public photostream of "everyone"
     if (empty($this->config['pull_rss'])) {
         $this->config['pull_rss'] = array(0 => "http://api.flickr.com/services/feeds/photos_public.gne?format=php&id=");
     }
     $photos = array();
     //        $RSS = new rssfeed();  // we'll use curl instead of magpierss
     foreach ($this->config['pull_rss'] as $url) {
         // we need to get at one of the query paramerers and change it
         // parse the url into its parts
         $url = parse_url($url);
         // parse the params into an associative array
         parse_str($url['query'], $url['query']);
         // set the 'format'  param to 'php_serial'
         $url['query']['format'] = 'php_serial';
         // stitch the params back together
         $url['query'] = http_build_query($url['query'], '', '&');
         // stitch the whole thing back together
         // scheme
         $uri = !empty($url['scheme']) ? $url['scheme'] . '://' : '';
         // user & pass
         if (!empty($url['user'])) {
             $uri .= $url['user'] . ':' . $url['pass'] . '@';
         }
         // host
         $uri .= $url['host'];
         // port
         $port = !empty($url['port']) ? ':' . $url['port'] : '';
         $uri .= $port;
         // path
         $uri .= $url['path'];
         // fragment or query
         if (isset($url['fragment'])) {
             $uri .= '#' . $url['fragment'];
         } elseif (isset($url['query'])) {
             $uri .= '?' . $url['query'];
         }
         // create curl resource
         $ch = curl_init();
         // set url
         curl_setopt($ch, CURLOPT_URL, $uri);
         //return the transfer as a string
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         // $output contains the output string
         $output = curl_exec($ch);
         // close curl resource to free up system resources
         curl_close($ch);
         $output = unserialize($output);
         foreach ($output['items'] as $rssItem) {
             $rssObject = new stdClass();
             $rssObject->title = !empty($rssItem['title']) ? $rssItem['title'] : "";
             $rssObject->link = !empty($rssItem['url']) ? $rssItem['url'] : "";
             $rssObject->description = !empty($rssItem['description']) ? $rssItem['description'] : "";
             $rssObject->raw_description = !empty($rssItem['description_raw']) ? $rssItem['description_raw'] : "";
             $rssObject->src_t = !empty($rssItem['t_url']) ? $rssItem['t_url'] : "";
             $rssObject->src_m = !empty($rssItem['m_url']) ? $rssItem['m_url'] : "";
             $rssObject->src_l = !empty($rssItem['l_url']) ? $rssItem['l_url'] : "";
             $rssObject->src_o = !empty($rssItem['photo_url']) ? $rssItem['photo_url'] : "";
             $rssObject->date_taken = !empty($rssItem['date_taken_nice']) ? $rssItem['date_taken_nice'] : "";
             $rssObject->author_name = !empty($rssItem['author_name']) ? $rssItem['author_name'] : "";
             $rssObject->author_url = !empty($rssItem['author_url']) ? $rssItem['author_url'] : "";
             // There is more data that Flickr returns that I am not adding to the object.
             //Some is redundant some just wasn't useful at this time
             $photos[] = $rssObject;
         }
     }
     //eDebug($photos);
     assign_to_template(array('items' => $photos));
 }
 public function approve()
 {
     expHistory::set('editable', $this->params);
     /* The global constants can be overriden by passing appropriate params */
     //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
     $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
     $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
     $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
     $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
     if (empty($this->params['id'])) {
         flash('error', gt('No ID supplied for note to approve'));
         $lastUrl = expHistory::getLast('editable');
     }
     $simplenote = new expSimpleNote($this->params['id']);
     assign_to_template(array('simplenote' => $simplenote, 'require_login' => $require_login, 'require_approval' => $require_approval, 'require_notification' => $require_notification, 'notification_email' => $notification_email, 'tab' => $this->params['tab']));
 }
Esempio n. 30
0
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
/** @define "BASE" "../../../.." */
if (!defined('EXPONENT')) {
    exit('');
}
$template = new template('formbuilder', '_data_view');
if (isset($_GET['id'])) {
    $_GET['id'] = intval($_GET['id']);
    $f = $db->selectObject("formbuilder_form", "id=" . $_GET['id']);
    $rpt = $db->selectObject("formbuilder_report", "form_id=" . $_GET['id']);
    $items = $db->selectObjects("formbuilder_" . $f->table_name);
    if (expPermissions::check("viewdata", unserialize($f->location_data))) {
        expHistory::set('editable', $_GET);
        $columndef = "paginate.columns = new Array(";
        $columns = array();
        $sortfuncts = "";
        if ($rpt->column_names == '') {
            //define some default columns...
            $controls = $db->selectObjects("formbuilder_control", "form_id=" . $f->id . " and is_readonly = 0 and is_static = 0");
            $controls = expSorter::sort(array('array' => $controls, 'sortby' => 'rank', 'order' => 'ASC'));
            foreach (array_slice($controls, 0, 5) as $control) {
                if ($rpt->column_names != '') {
                    $rpt->column_names .= '|!|';
                }
                $rpt->column_names .= $control->name;
            }
        }
        foreach (explode("|!|", $rpt->column_names) as $column_name) {