/** * Display a login view */ function showlogin() { global $db, $user, $order; $oicount = $order ? $order->item_count : 0; // FIGURE OUT IF WE"RE IN PREVIEW MODE OR NOT $level = 99; if (expSession::is_set('uilevel')) { $level = expSession::get('uilevel'); } $previewtext = $level == UILEVEL_PREVIEW ? gt('Turn Preview Mode off') : gt('Turn Preview Mode on'); $previewclass = $level == UILEVEL_PREVIEW ? 'preview_on' : 'preview_off'; //eDebug($order); if (expSession::loggedIn() && $user->username != "anonymous") { $loggedin = 1; // Generate display name as username if the first and last name fields are blank. $display_name = $user->firstname . ' ' . $user->lastname; if (trim($display_name) == '') { $display_name = $user->username; } // Need to check for groups and whatnot if ($db->countObjects('groupmembership', 'member_id=' . $user->id . ' AND is_admin=1')) { $is_group_admin = 1; } else { $is_group_admin = 0; } assign_to_template(array('oicount' => $oicount, 'previewtext' => $previewtext, 'previewclass' => $previewclass, 'loggedin' => $loggedin, 'user' => $user, 'displayname' => $display_name, 'is_group_admin' => $is_group_admin)); } else { //$template->assign('isecom',in_array('storeController',listActiveControllers())); $loggedin = 0; assign_to_template(array('oicount' => $oicount, 'previewtext' => $previewtext, 'previewclass' => $previewclass, 'loggedin' => $loggedin, 'user' => $user)); } }
public function edit_message() { $id = isset($this->params['id']) ? $this->params['id'] : null; $msg = new order_status_messages($id); assign_to_template(array('record' => $msg)); //$msg->update($this->params); }
function showall() { expHistory::set('viewable', $this->params); $causes = $this->donation->find('all'); //eDebug($causes); assign_to_template(array('causes' => $causes)); }
function edit_vendor() { $vendor = new vendor(); if (isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' . $this->params['id']); assign_to_template(array('vendor' => $vendor)); } }
public function show() { $where = "location_data='" . serialize($this->loc) . "'"; $db_headline = $this->headline->find('first', $where); $this->metainfo = expTheme::pageMetaInfo(); $title = !empty($db_headline) ? $db_headline->title : $this->metainfo['title']; assign_to_template(array('headline' => $title, 'record' => $db_headline)); }
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)); }
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)); }
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)); }
public function page_not_found() { global $router; $params = $router->params; unset($params['controller']); unset($params['action']); $terms = empty($params[0]) ? '' : $params[0]; expCSS::pushToHead(array("unique" => "search-results", "link" => $this->asset_path . "css/results.css")); $search = new search(); $page = new expPaginator(array('model' => 'search', 'controller' => $this->params['controller'], 'action' => $this->params['action'], 'records' => $search->getSearchResults(implode(' ', $params)), 'order' => 'score', 'dir' => 'DESC')); assign_to_template(array('page' => $page, 'terms' => $terms)); }
function editor() { global $user; $file = new expFile($this->params['id']); $canSaveOg = $user->id == $file->poster || $user->is_admin ? 1 : 0; if (file_exists(BASE . $file->directory . $file->filename)) { $file->copyToDirectory(BASE . $this->cacheDir); assign_to_template(array('image' => $file, 'update' => $_GET['update'], 'saveog' => $canSaveOg)); } else { flash('error', gt('The file') . ' "' . BASE . $file->directory . $file->filename . '" ' . gt('does not exist on the server.')); redirect_to(array("controller" => 'file', "action" => 'picker', "ajax_action" => 1, "update" => $this->params['update'], "fck" => $this->params['fck'])); } }
public function show() { global $db, $template; $orig_template = $template; //instantiate an expRecord for the module in question //$mod = new $this->params['recymod'](); define('SOURCE_SELECTOR', 1); define('PREVIEW_READONLY', 1); // for mods //initialize a new recycle bin and grab the previously trashed items $bin = new recyclebin(); $orphans = $bin->moduleOrphans($this->params['recymod']); $template = $orig_template; assign_to_template(array('items' => $orphans, 'module' => $this->params['recymod'])); }
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)); }
function showall() { $yt = new $this->basemodel_name(); $vids = $yt->find('all', $this->aggregateWhereClause()); if (!empty($this->config['width']) && !empty($this->config['height'])) { foreach ($vids as $key => $val) { $val->embed_code = preg_replace("/height=\"\\d+\"/", 'height=' . $this->config['height'], $val->embed_code); $val->embed_code = preg_replace("/width=\"\\d+\"/", 'width=' . $this->config['width'], $val->embed_code); } } // force fix for menus appearing BEHIND the video in IE foreach ($vids as $key => $val) { $val->embed_code = preg_replace("/\" frameborder=\"/", '?wmode=opaque" frameborder="', $val->embed_code); } assign_to_template(array('items' => $vids)); }
/** * 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)); }
function configureTheme() { //THEME COLORS $theme_colors = array("orange" => 'Orange', "blue" => 'Blue', "red" => 'Red', "green" => 'Green', "purple" => 'Purple', "black" => 'Black', "yellow" => 'Yellow', "pink" => 'Pink', "grey" => 'Grey', "magenta" => 'Magenta'); //THEME WIDTHS $button_sizes = array("small" => 'Small', "medium" => 'Medium', "large" => 'Large'); //THEME WIDTHS $theme_widths = array("" => '980px', "w1200px" => '1200px', "w760px" => '760px', "w600px" => '600px'); //THEME FONTS $theme_fonts = array("" => 'Tahoma', "georgia" => 'Georga', "times" => 'Times', "helvetica" => 'Helvetica', "verdana" => 'Verdana', "arial" => 'Arial', "courier" => 'Courier'); $settings = expSettings::parseFile(BASE . "themes/" . $_GET['theme'] . "/config.php"); $form = new form(); $form->meta('controller', 'administration'); $form->meta('action', 'update_theme'); $form->meta('theme', $_GET['theme']); $form->register('multi_size', gt('Theme Width') . ': ', new dropdowncontrol($settings['MULTI_SIZE'], $theme_widths)); $form->register('multi_font', gt('Theme Font') . ': ', new dropdowncontrol($settings['MULTI_FONT'], $theme_fonts)); $form->register('multi_color', gt('Theme Color') . ': ', new dropdowncontrol($settings['MULTI_COLOR'], $theme_colors)); $form->register('btn_color', gt('Button Color') . ': ', new dropdowncontrol($settings['BTN_COLOR'], $theme_colors)); $form->register('btn_size', gt('Button Size') . ': ', new dropdowncontrol($settings['BTN_SIZE'], $button_sizes)); $form->register(null, '', new htmlcontrol('<br>')); $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel'))); assign_to_template(array('name' => self::name(), 'form_html' => $form->tohtml())); }
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)); }
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)); }
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)); }
/** * 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)); }
public function showall_tags() { $images = $this->image->find('all'); $used_tags = array(); foreach ($images as $image) { foreach ($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count += 1; } else { $exptag = new expTag($tag->id); $used_tags[$tag->id] = $exptag; $used_tags[$tag->id]->count = 1; } } } assign_to_template(array('tags' => $used_tags)); }
function manage_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all', null, 'rank asc,name asc'); assign_to_template(array('countries' => $countries, 'regions' => $regions, 'upcharge' => $this->config['upcharge'])); }
/** * Displays available help versions */ public function select_version() { global $db; $hv = expSession::get('help-version'); $selected = $db->selectValue('help_version', 'id', 'version="' . $hv . '"'); $versions = $db->selectDropdown('help_version', 'version', 1, 'version'); assign_to_template(array('current_version' => $hv, 'selected' => $selected, 'versions' => $versions)); }
function edit_model_alias() { global $db; if (isset($this->params['id'])) { $model_alias = $db->selectObject('model_aliases', 'id =' . $this->params['id']); assign_to_template(array('model_alias' => $model_alias)); } else { assign_to_template(array('product_id' => $this->params['product_id'])); } }
public function viewuser() { $u = new user($this->params['id']); $address = new address(); $billings = $address->find('all', 'user_id=' . $u->id . ' AND is_billing = 1'); $shippings = $address->find('all', 'user_id=' . $u->id . ' AND is_shipping = 1'); // build out a SQL query that gets all the data we need and is sortable. $sql = 'SELECT o.*, b.firstname as firstname, b.billing_cost as total, b.middlename as middlename, b.lastname as lastname, os.title as status, ot.title as order_type '; $sql .= 'FROM ' . DB_TABLE_PREFIX . '_orders o, ' . DB_TABLE_PREFIX . '_billingmethods b, '; $sql .= DB_TABLE_PREFIX . '_order_status os, '; $sql .= DB_TABLE_PREFIX . '_order_type ot '; $sql .= 'WHERE o.id = b.orders_id AND o.order_status_id = os.id AND o.order_type_id = ot.id AND o.purchased > 0 AND user_id =' . $u->id; $limit = empty($this->config['limit']) ? 50 : $this->config['limit']; //eDebug($sql, true); $orders = new expPaginator(array('controller' => $this->params['controller'], 'action' => $this->params['action'], 'sql' => $sql, 'order' => 'purchased', 'dir' => 'DESC', 'limit' => $limit, 'columns' => array('Order #' => 'invoice_id', 'Total' => 'total', 'Date Purchased' => 'purchased', 'Type' => 'order_type_id', 'Status' => 'order_status_id', 'Ref' => 'orig_referrer'))); assign_to_template(array('u' => $u, 'billings' => $billings, 'shippings' => $shippings, 'orders' => $orders)); }
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)); }
public function adder() { global $db; $allfiles = expFile::listFlat(BASE . 'files', true, null, null, BASE); foreach ($allfiles as $path => $file) { if ($file[0] != '.') { $found = false; $dbfiles = $db->selectObjects('expFiles', "filename='" . $file . "'"); foreach ($dbfiles as $dbfile) { $found = $dbfile->directory == str_replace($file, '', $path); } if (!$found) { $notindb[$path] = $file; } } } assign_to_template(array('files' => $notindb)); }
public function showall() { if (!empty($this->config['consumer_key'])) { // create instance $twitter = new Twitter($this->config['consumer_key'], $this->config['consumer_secret']); // set tokens $twitter->setOAuthToken($this->config['oauth_token']); $twitter->setOAuthTokenSecret($this->config['oauth_token_secret']); $mytwitteracct = $twitter->accountVerifyCredentials(); switch ($this->config['typestatus']) { case 1: // get users timeline including retweets $tweets = $twitter->statusesUserTimeline(null, null, null, null, $this->config['twlimit'], null, null, true); break; case 2: // get friends timeline $tweets = $twitter->statusesFriendsTimeline(null, null, $this->config['twlimit']); break; case 3: // get mentions $tweets = $twitter->statusesMentions(null, null, $this->config['twlimit']); break; case 4: // get public timeline $tweets = $twitter->statusesPublicTimeline(); break; default: // get home timeline $tweets = $twitter->statusesHomeTimeline(null, null, $this->config['twlimit']); break; } if ($this->config['twlimit']) { $tweets = array_slice($tweets, 0, $this->config['twlimit'], true); } $retweets = $twitter->statusesRetweetedByMe(null, null, $this->config['twlimit']); foreach ($tweets as $key => $value) { $tweets[$key]['retweetedbyme'] = false; if (strpos($value['text'], 'RT ') === false) { $tweets[$key]['text'] = $this->twitterify($value['text']); $tweets[$key]['screen_name'] = $value['user']['screen_name']; $tweets[$key]['image'] = $value['user']['profile_image_url']; $tweets[$key]['via'] = $value['source']; $tweets[$key]['ours'] = $value['user']['id'] == $mytwitteracct['id'] ? true : false; } else { // we're a retweet $tweets[$key]['text'] = $this->twitterify(substr($value['text'], strpos($value['text'], ':') + 2)); // strip out RT text $tweets[$key]['screen_name'] = isset($value['retweeted_status']['user']['screen_name']) ? $value['retweeted_status']['user']['screen_name'] : 'Unknown'; $tweets[$key]['image'] = isset($value['retweeted_status']['user']['profile_image_url']) ? $value['retweeted_status']['user']['profile_image_url'] : ''; if ($value['user']['id'] == $mytwitteracct['id']) { $tweets[$key]['via'] = $value['source']; $tweets[$key]['retweetedbyme'] = true; } else { $tweets[$key]['via'] = $value['source'] . ' (<img src="framework/modules/twitter/assets/images/rt.png" title="retweet by" alt="RT by"/> ' . $value['user']['screen_name'] . ')'; } $tweets[$key]['ours'] = $value['user']['id'] == $mytwitteracct['id'] ? true : false; } // $tweets[$key]['created_at'] = strtotime($value['created_at']); // convert to unix time $tweets[$key]['created_at'] = expDateTime::relativeDate(strtotime($value['created_at'])); // convert to unix time if (!isset($value['retweeted_status'])) { $tweets[$key]['retweeted_status'] = false; } foreach ($retweets as $rekey => $revalue) { if ($tweets[$key]['id'] == $retweets[$rekey]['retweeted_status']['id']) { $tweets[$key]['retweetedbyme'] = true; break; } } } assign_to_template(array('items' => $tweets)); } }
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)); }
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'])); }
public function tags() { $blogs = $this->filedownload->find('all'); $used_tags = array(); foreach ($blogs as $blog) { foreach ($blog->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count += 1; } else { $exptag = new expTag($tag->id); $used_tags[$tag->id] = $exptag; $used_tags[$tag->id]->count = 1; } } } $used_tags = expSorter::sort(array('array' => $used_tags, 'sortby' => 'title', 'order' => 'ASC', 'ignore_case' => true)); assign_to_template(array('tags' => $used_tags)); }